| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <template>
- <div class="chatAIPage">
- <div class="header">
- <div class="icon"><van-icon name="flower-o" size="25" /></div>
- <div class="titleTip">欢迎进入随身邦chatBl,智能助理为您提供以下服务</div>
- </div>
- <div class="content">
- <div
- class="tabItem"
- v-for="item in tabData"
- :style="{ background: item.backColor }"
- @click="openAiPage(item)">
- <div class="tabName">{{ item.tabName }}</div>
- <div class="message">{{ item.message }}</div>
- <div class="icon">
- <van-icon :name="item.icon" size="45" />
- </div>
- </div>
- </div>
- <div class="footer">
- <div class="tip">对话发起</div>
- <div class="chatBox">
- <van-field
- v-model="chatBoxMessage"
- rows="3"
- type="textarea"
- :border="true"
- placeholder="【随身邦chatBl】将与您对话,请输入…." />
- <van-icon name="guide-o" class="sendIcon" size="40" />
- </div>
- </div>
- </div>
- </template>
- <script>
- import { getAiToken } from '@/api/chatAI.js';
- export default {
- name: 'chatAIPage',
- data() {
- return {
- tabData: [
- {
- tabName: '指标查询',
- message: '帮助您用自然语言查询指标、支持多条件组合查询',
- icon: 'bar-chart-o',
- backColor: '#665bb9',
- datasetId: '250514091022957',
- },
- {
- tabName: '门店圈选',
- message: '帮助您使用自然语言进行筛选,支持多条件组合筛选',
- icon: 'list-switching',
- backColor: '#68a3e7',
- datasetId: '250514091601918',
- },
- ],
- chatBoxMessage: '',
- AIToken: '',
- };
- },
- created() {
- this.getAiTokenFun();
- },
- methods: {
- getAiTokenFun() {
- this.toastLoading(0, '上传中...', true);
- getAiToken()
- .then((res) => {
- this.toastLoading().clear();
- if (res.code == 200) {
- this.AIToken = res.msg;
- } else {
- this.$toast(res.msg);
- }
- })
- .catch((error) => {
- this.toastLoading().clear();
- this.$toast(error.msg);
- });
- },
- openAiPage(item) {
- let href =
- 'http://bi.dgtis.com/cboard/h5/index.html?token=' +
- this.AIToken +
- '#/chatbi?datasetId=' +
- item.datasetId;
- window.location.href = href;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .chatAIPage {
- width: 100%;
- height: 100%;
- overflow: hidden;
- padding: 15px;
- display: flex;
- flex-direction: column;
- .header {
- width: 100%;
- display: flex;
- align-items: center;
- padding-bottom: 10px;
- .icon {
- color: #666;
- }
- .titleTip {
- font-size: 14px;
- color: #666;
- }
- }
- .content {
- flex: 1;
- overflow-y: auto;
- padding: 10px 0;
- .tabItem {
- width: 48%;
- height: 180px;
- float: left;
- margin-right: 4%;
- margin-bottom: 20px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- padding: 10px;
- color: #fff;
- border-radius: 15px;
- &:nth-child(even) {
- margin-right: 0;
- }
- .tabName {
- font-size: 16px;
- margin-bottom: 10px;
- }
- .message {
- flex: 1;
- font-size: 14px;
- margin-bottom: 15px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
- }
- .icon {
- text-align: center;
- margin-bottom: 15px;
- }
- }
- }
- .footer {
- .tip {
- font-size: 16px;
- padding: 10px;
- }
- .chatBox {
- position: relative;
- .van-cell {
- padding-bottom: 30px;
- }
- .sendIcon {
- position: absolute;
- right: 3px;
- bottom: 0px;
- color: #999;
- }
- }
- }
- }
- </style>
|