Bladeren bron

修改评论

xuzuoyun 5 jaren geleden
bovenliggende
commit
f6f12cfbbf

+ 0 - 1
src/views/modules/Statistics/Statistics.vue

@@ -72,7 +72,6 @@ export default {
         getAccountReport().then(res=>{
             if(res.code == 0){
                 console.log(res)
-                // this.statistics = res
             }
         })
     })

+ 28 - 17
src/views/modules/video/video.vue

@@ -148,6 +148,7 @@
 import ARow from 'ant-design-vue/es/grid/Row'
 import ACol from 'ant-design-vue/es/grid/Col'
 import axios from 'axios'
+var interval, objTimer
 import {
   getLoginQr,
   getUserList,
@@ -190,6 +191,7 @@ export default {
     handleChange(value) {
       this.ksid = value
       this.dataShow = []
+      clearInterval(interval)
       this.getVideoList(value, null)
       //   this.getTest()
     },
@@ -222,6 +224,7 @@ export default {
     },
     getVideoList(ksid, pcursor) {
       var that = this
+
       getVideoList({ ksid: ksid, pcursor: pcursor }).then(res => {
         if (res.code == 0) {
           var data = res.result.data.publicFeeds.list.map(item => {
@@ -233,25 +236,29 @@ export default {
           this.pcursor = res.result.data.publicFeeds.pcursor
           this.dataShow.push(...data)
           var i = 0
-          //   for (let i = 0; i < data.length; i++) {
-          setInterval(() => {
-            if (i < that.dataShow.length) {
-              setTimeout(
-                that.getCommentList(ksid, that.dataShow[i].photoId).then(dataOne => {
-                  console.log(dataOne)
-                  if (dataOne) {
-                    that.dataShow[i].commentList = dataOne
-                  }
-                  //   commentList
+          interval = setInterval(() => {
+            if (i <= that.dataShow.length) {
+              ;(function(a) {
+                setTimeout(function() {
+                  that.getCommentList(ksid, that.dataShow[a].photoId).then(dataOne => {
+                    if (dataOne && that.dataShow[a]) {
+                      that.dataShow[a].commentList = dataOne.commentList
+                    } else {
+                      that.dataShow[a].commentList = []
+                    }
+                  })
+                }, 0)
+                if (that.dataShow.length == 0) {
+                  clearInterval(interval)
+                  i = 0
+                } else {
                   i++
-                }),
-                0
-              )
+                }
+              })(i)
             } else {
+              clearInterval(interval)
             }
           }, 10000)
-
-          //   }
         }
       })
     },
@@ -259,7 +266,7 @@ export default {
       return new Promise(function(resolve) {
         getCommentList({ ksid: ksid, photoId: photoId, pcursor: null }).then(res => {
           if (res.code == 0) {
-            resolve(res.result.data.shortVideoCommentList.commentList)
+            resolve(res.result.data.shortVideoCommentList)
           }
         })
       })
@@ -334,6 +341,10 @@ export default {
     }
   },
   watch: {},
+  distoryed() {
+    clearInterval(interval)
+    window.clearInterval(objTimer)
+  },
   mounted: function() {
     this.$nextTick(() => {
       var that = this
@@ -341,7 +352,7 @@ export default {
       //   getAccountReport().then(res => {
       //     console.log(res)
       //   })
-      window.setInterval(() => {
+      objTimer = window.setInterval(() => {
         if (that.showCode) {
           setTimeout(function() {
             getLoginStatus({ requestId: that.requestId }).then(res => {

+ 14 - 17
src/views/template/creative/modules/material.vue

@@ -139,7 +139,7 @@
       <a-button @click="addTitle">添加创意标题</a-button>
       <br />
       <div v-for="(item,index) of titleData" :key="index">
-        <a-input style="width:55%" v-model="item.text" class="rending-all"></a-input>
+        <a-input style="width:55%" v-model="item.text" class="rending-all" @change="judge(item)"></a-input>
         <a-icon
           type="delete"
           style="margin-left:20px;cursor: pointer;"
@@ -163,7 +163,6 @@ import { postAction, getAction, getPackage } from '@/api/manage'
 import moment from 'moment'
 import AFormItem from 'ant-design-vue/es/form/FormItem'
 import $ from 'jquery'
-
 export default {
   name: 'BaseForm',
   props: {
@@ -233,25 +232,23 @@ export default {
   },
   methods: {
     judge(item) {
-      var left = item.text.split('{')
-      var right = item.text.split('}')
-      console.log(left)
-      if (item.countTag == 0) {
-        return
-      } else {
-        if (left.length != 3 && right.lenght != 3) {
-          item.countTag -= 1
-        }
+      var re = /{(.*?)}/g
+      var array = []
+      var temp
+      while ((temp = re.exec(item.text))) {
+        array.push(temp[1])
       }
+      console.log(array)
+      item.countTag = array.length
     },
     getChange(item, tag, index) {
-      item.countTag++
+      this.judge(item)
       if (item.text == '') {
         item.countTag = 0
       }
       if (item.countTag >= 2) {
         this.$message.error('最多插入两条词包')
-        item.countTag = 2
+        // item.countTag = 2
         return
       }
       var node = document.getElementsByClassName('rending')[index]
@@ -283,13 +280,13 @@ export default {
       }
     },
     getChangeAllTitle(item, tag, index) {
-      item.titleMany++
+      this.judge(item)
       if (item.text == '') {
-        item.titleMany = 0
+        item.countTag = 0
       }
-      if (item.titleMany >= 2) {
+      if (item.countTag >= 2) {
         this.$message.error('最多插入两条词包')
-        item.titleMany = 2
+        // item.countTag = 2
         return
       }
       var node = document.getElementsByClassName('rending-all')[index]