소스 검색

优化AI销售参谋页面

zhujindu 1 년 전
부모
커밋
0b8d71b82a
2개의 변경된 파일71개의 추가작업 그리고 35개의 파일을 삭제
  1. 6 5
      src/views/deviceOutside/topStore.vue
  2. 65 30
      src/views/intelligence/index.vue

+ 6 - 5
src/views/deviceOutside/topStore.vue

@@ -78,6 +78,7 @@
         v-model="loading"
         :finished="finished"
         @load="onLoad"
+        :immediate-check="false"
         finished-text="--已经到底了--">
         <van-checkbox-group v-model="radio">
           <div class="cellcontent" v-for="(item, index) in list" :key="index">
@@ -752,7 +753,7 @@ export default {
         (from.path == '/My/index' && to.path == '/topStore')
       ) {
         this.lat = '';
-        this.onSearch();
+        // this.onSearch();
         var week = new Date().getDay();
         if (week > 0 && week < 6) {
           this.actions[week - 1].name = '今天';
@@ -824,8 +825,6 @@ export default {
   activated() {
     this.AItype = this.$route.query.AItype;
     this.aiCondition = localStorage.getItem(this.AItype);
-  },
-  created() {
     this.value1 = 'b';
     this.value2 = '';
     this.value3 = '';
@@ -902,6 +901,7 @@ export default {
     this.onSearch();
     this.getMonth();
   },
+  created() {},
   methods: {
     clearFn() {
       this.storeName = '';
@@ -1263,10 +1263,11 @@ export default {
       }
       let params = {};
       // AI页面跳转过来不需要筛选参数
+      debugger;
       if (this.AItype) {
         params = {
-          lat: that.lat,
-          lon: that.lon,
+          lat: 34.621986702326005,
+          lon: 112.45381110448685,
           aiCondition: this.aiCondition,
         };
       } else {

+ 65 - 30
src/views/intelligence/index.vue

@@ -8,8 +8,11 @@
     <div class="lineGrey"></div>
     <div class="lineGrey"></div>
     <div class="lineGrey"></div>
-    <van-pull-refresh v-model="loading" success-text="加载成功" @refresh="onLoad">
-      <!--    <van-list class="myList" v-model="loading" :finished="finished" finished-text="&#45;&#45;已经到底了&#45;&#45;" @refresh="onLoad">-->
+    <van-pull-refresh
+      v-model="loading"
+      :success-text="successText"
+      @refresh="onLoad"
+      :immediate-check="false">
       <div id="snb" ref="snb1">
         <div style="font-size: 14px" v-for="(item, index) in Ggreet" :key="index">
           <div style="margin: 14px" v-if="item.chatRecordFrom == 'ai' || item.chatRecordFrom == 2">
@@ -375,7 +378,7 @@
             bottom: 0;
             background-color: white;
             width: 100%;
-            height: 360px;
+            height: 260px;
           ">
           <div class="audio" v-if="shows">
             <div class="wave"></div>
@@ -385,6 +388,7 @@
             <div class="wave"></div>
           </div>
           <div
+            class="audioBox"
             style="
               background-color: rgb(0, 87, 186);
               left: 50%;
@@ -395,6 +399,7 @@
               position: absolute;
               bottom: 90px;
             ">
+            <div class="tip">{{ tips }}</div>
             <div
               style="position: absolute; width: 100%; height: 80px; z-index: 999999"
               @touchstart="lujin"
@@ -423,7 +428,7 @@ export default {
     return {
       loading: false,
       finished: false,
-      pageNum: 1,
+      pageNum: 0,
       avatar: avatar,
       yy: yy,
       yt: yt,
@@ -459,16 +464,19 @@ export default {
           text: '点击此条信息进入推荐门店页面。',
         },
       ],
+      isNoData: false, //是否加载完所有数据
+      successText: '加载成功', //上拉刷新提示语
+      tips: '按住 说话',
     };
   },
-  watch: {
-    $route(to, from) {
-      if (to.path == '/ai') {
-        this.onLoad();
-      }
-    },
-  },
-  created() {
+  // watch: {
+  //   $route(to, from) {
+  //     if (to.path == '/ai') {
+  //       this.onLoad();
+  //     }
+  //   },
+  // },
+  activated() {
     this.onLoad();
   },
   methods: {
@@ -478,7 +486,13 @@ export default {
       });
     },
     onLoad() {
-      this.Ggreet = [];
+      if (this.isNoData) {
+        this.successText = '以下所有内容!';
+        this.$toast('已经加载所有内容!');
+        this.loading = false;
+        return;
+      }
+      this.pageNum++;
       this.aiDialogueGgreet();
     },
     choiceSelct(val, val2) {
@@ -491,6 +505,7 @@ export default {
             AItype: val.type,
           },
         });
+        return;
       } else {
         let loading1 = this.$toast.loading({
           duration: 0,
@@ -521,24 +536,19 @@ export default {
         message: '发送中...',
         forbidClick: true,
       });
-      if (this.refreshing) {
-        this.Ggreet = [];
-        this.refreshing = false;
-      }
-      aiDialogue({ type: 3, pageNum: this.pageNum, pageSize: 20 }).then((response) => {
+      aiDialogue({ type: 3, pageNum: this.pageNum, pageSize: 10 }).then((response) => {
         loading1.clear();
         this.loading = false;
         if (response.code == 200) {
           this.Ggreet = response.rows.concat(this.Ggreet);
           if (this.Ggreet.length >= response.total) {
-            this.finished = true;
+            this.isNoData = true;
           } else {
-            this.finished = false;
+            this.isNoData = false;
           }
           if (this.pageNum == 1) {
             this.garbageManager();
           }
-          this.pageNum = this.pageNum + 1;
         }
       });
     },
@@ -552,14 +562,19 @@ export default {
         forbidClick: true,
       });
       this.btnclik = false;
+      this.Ggreet.push({
+        chatRecordText: this.content,
+        chatRecordFrom: 1,
+      });
       aiDialogue({ type: 1, content: this.content }).then((response) => {
         loading1.clear();
         this.btnclik = true;
         if (response.code == 200) {
           this.content = '';
-          this.pageNum = 1;
-          this.Ggreet = [];
-          this.aiDialogueGgreet();
+          // this.pageNum = 1;
+          // this.Ggreet = [];
+          this.Ggreet.push(...response.rows);
+          // this.aiDialogueGgreet();
           this.garbageManager();
         }
       });
@@ -602,9 +617,10 @@ export default {
                     success: function (res) {
                       aiDialogue({ type: 2, content: res.serverId }).then((response) => {
                         if (response.code == 200) {
-                          that.pageNum = 1;
-                          that.Ggreet = [];
-                          that.aiDialogueGgreet();
+                          // that.pageNum = 1;
+                          // that.Ggreet = [];
+                          // that.aiDialogueGgreet();
+                          this.Ggreet.push(...response.rows);
                           that.garbageManager();
                         }
                         that.show = false;
@@ -629,10 +645,11 @@ export default {
             success: function (res) {
               aiDialogue({ type: 2, content: res.serverId }).then((response) => {
                 if (response.code == 200) {
-                  that.pageNum = 1;
-                  that.Ggreet = [];
+                  // that.pageNum = 1;
+                  // that.Ggreet = [];
+                  // that.aiDialogueGgreet();
+                  this.Ggreet.push(...response.rows);
                   that.garbageManager();
-                  that.aiDialogueGgreet();
                 }
                 that.shows = false;
                 that.show = false;
@@ -868,4 +885,22 @@ p {
   overflow-y: auto;
   height: 700px;
 }
+.wrapper {
+  .audioBox {
+    -webkit-touch-callout: none;
+    -webkit-user-select: none;
+    -khtml-user-select: none;
+    -moz-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
+    .tip {
+      position: absolute;
+      top: -26px;
+      display: flex;
+      width: 100%;
+      justify-content: center;
+      font-size: 14px;
+    }
+  }
+}
 </style>