浏览代码

优化下拉刷新

zhujindu 1 年之前
父节点
当前提交
25db2e8b7b
共有 1 个文件被更改,包括 34 次插入33 次删除
  1. 34 33
      src/views/intelligence/index.vue

+ 34 - 33
src/views/intelligence/index.vue

@@ -399,16 +399,16 @@
 </template>
 
 <script>
-import avatar from "@/assets/avatar2.png";
-import yy from "@/assets/Icon/yy.png";
-import yt from "@/assets/Icon/yt.png";
-import aiselect from "@/assets/Icon/avatar1.png";
-import tabBar from "@/components/tabBar";
-import { getReportInfo } from "@/api";
-import { aiDialogue } from "@/api/inventory";
-import axios from "axios";
+import avatar from '@/assets/avatar2.png';
+import yy from '@/assets/Icon/yy.png';
+import yt from '@/assets/Icon/yt.png';
+import aiselect from '@/assets/Icon/avatar1.png';
+import tabBar from '@/components/tabBar';
+import { getReportInfo } from '@/api';
+import { aiDialogue } from '@/api/inventory';
+import axios from 'axios';
 export default {
-  name: "ai",
+  name: 'ai',
   components: { tabBar },
   data() {
     return {
@@ -420,9 +420,9 @@ export default {
       yt: yt,
       aiselect: aiselect,
       Ggreet: [{ textList: [] }],
-      content: "",
+      content: '',
       btnclik: true,
-      message: "",
+      message: '',
       num: 0,
       show: false,
       shows: false,
@@ -443,18 +443,18 @@ export default {
       dataList: [
         {
           type: 1,
-          text: "厨卫店中,本月进货不满50包超好贴的门店有哪些?",
+          text: '厨卫店中,本月进货不满50包超好贴的门店有哪些?',
         },
         {
           type: 2,
-          text: "点击此条信息进入推荐门店页面。",
+          text: '点击此条信息进入推荐门店页面。',
         },
       ],
     };
   },
   watch: {
     $route(to, from) {
-      if (to.path == "/ai") {
+      if (to.path == '/ai') {
         this.onLoad();
       }
     },
@@ -469,19 +469,20 @@ export default {
       });
     },
     onLoad() {
+      this.Ggreet = [];
       this.aiDialogueGgreet();
     },
     choiceSelct(val, val2) {
-      if (val.type == "高销额") {
+      if (val.type == '高销额') {
         // 跳转高销额列表
         this.$router.push({
-          path: "/topStore",
+          path: '/topStore',
           query: {},
         });
       } else {
         let loading1 = this.$toast.loading({
           duration: 0,
-          message: "发送中...",
+          message: '发送中...',
           forbidClick: true,
         });
         aiDialogue({
@@ -505,7 +506,7 @@ export default {
     aiDialogueGgreet() {
       let loading1 = this.$toast.loading({
         duration: 0,
-        message: "发送中...",
+        message: '发送中...',
         forbidClick: true,
       });
       if (this.refreshing) {
@@ -530,12 +531,12 @@ export default {
       });
     },
     Submit() {
-      if (this.content.trim() == "") {
-        this.$toast("请输入内容!");
+      if (this.content.trim() == '') {
+        this.$toast('请输入内容!');
       }
       let loading1 = this.$toast.loading({
         duration: 0,
-        message: "发送中...",
+        message: '发送中...',
         forbidClick: true,
       });
       this.btnclik = false;
@@ -543,7 +544,7 @@ export default {
         loading1.clear();
         this.btnclik = true;
         if (response.code == 200) {
-          this.content = "";
+          this.content = '';
           this.pageNum = 1;
           this.Ggreet = [];
           this.aiDialogueGgreet();
@@ -557,9 +558,9 @@ export default {
       let wx = this.wx;
       let qiyeData;
       const instance = axios.create();
-      instance.defaults.headers.common["userId"] = localStorage.getItem("loginName");
+      instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
       instance
-        .get(process.env.VUE_APP_BASE_API + "mobile/wx/ticket", {
+        .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
           params: {
             url: url,
           },
@@ -574,7 +575,7 @@ export default {
               timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
               nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
               signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
-              jsApiList: ["ready", "startRecord", "stopRecord", "onVoiceRecordEnd"], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
+              jsApiList: ['ready', 'startRecord', 'stopRecord', 'onVoiceRecordEnd'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
             });
             wx.ready(function () {
               wx.startRecord();
@@ -664,25 +665,25 @@ export default {
       this.one18 = false;
       this.one19 = false;
       this.two1 = false;
-      if (this.message.indexOf("销量") != -1 || this.num == 1) {
+      if (this.message.indexOf('销量') != -1 || this.num == 1) {
         this.one = true;
         setTimeout(() => {
           this.one1 = true;
         }, 1000);
       }
-      if (this.message.indexOf("专业时时丽") != -1 || this.num == 2) {
+      if (this.message.indexOf('专业时时丽') != -1 || this.num == 2) {
         this.one11 = true;
         setTimeout(() => {
           this.one12 = true;
         }, 1000);
       }
-      if (this.message.indexOf("碰瓷专案") != -1 || this.num == 3) {
+      if (this.message.indexOf('碰瓷专案') != -1 || this.num == 3) {
         this.one9 = true;
         setTimeout(() => {
           this.one10 = true;
         }, 1000);
       }
-      this.message = "";
+      this.message = '';
     },
     showFn() {
       this.shows = false;
@@ -742,22 +743,22 @@ export default {
     },
     goFn(row) {
       this.$router.push({
-        path: "/aipage",
+        path: '/aipage',
         query: { type: row },
       });
     },
     getReportInfo() {
-      this.deptLevel = localStorage.getItem("deptLevel");
+      this.deptLevel = localStorage.getItem('deptLevel');
       let loading1 = this.$toast.loading({
         duration: 0,
-        message: "加载中...",
+        message: '加载中...',
         forbidClick: true,
       });
       getReportInfo({ isContent: false }).then((res) => {
         loading1.clear();
         this.list = res.data.summaryTasks;
         this.historyButton = res.data.historyButton;
-        localStorage.setItem("powerGrade", res.data.positionId);
+        localStorage.setItem('powerGrade', res.data.positionId);
         this.existReject = res.data.existReject;
         this.powerGrade = res.data.positionId;
         this.showButton = res.data.showButton;