Просмотр исходного кода

存储查看记录的关联字段改为文件修订历史的id,切换查看不同修订历史存入查看记录

shenqilong 1 год назад
Родитель
Сommit
596a45837d
1 измененных файлов с 9 добавлено и 5 удалено
  1. 9 5
      src/views/component/fileTraining/index.vue

+ 9 - 5
src/views/component/fileTraining/index.vue

@@ -366,6 +366,10 @@ export default {
 
         toggleActive (activity, index) {
             if (this.activeIndex === index) { return }
+            // 查看成功时才保存查看记录
+            if (this.browseTime && this.browseTime > 0) {
+                this.handleUpdate(this.curFileID || this.leftData[0]?.zId, this.browseTime)
+            }
             this.activeIndex = index
             this.digData = activity
             this.fileShow(activity)
@@ -376,16 +380,16 @@ export default {
             clearInterval(this.clearTimeSet)
             this.browseTime = 0
             this.curFileName = activity.FILE_NAME_
-            this.curFileID = activity.zid
+            this.curFileID = activity.id
             this.checkNum(activity)// 阅读量
             // this.$forceUpdate()// 触发监听器
         },
         // 阅读量函数
         async checkNum (activity) {
-            const sql = `select t_wjcyjl.* from t_wjcyjl
-                INNER JOIN t_wjxxb ON t_wjcyjl.parent_id_ = t_wjxxb.id_
-                WHERE t_wjxxb.shu_ju_lai_yuan_ = '${activity.id}' order by create_time_ desc`
-            // const sql1 = `select * from t_wjcyjl where parent_id_= '${activity.id}' order by create_time_ desc`
+            // const sql = `select t_wjcyjl.* from t_wjcyjl
+            //     INNER JOIN t_wjxxb ON t_wjcyjl.parent_id_ = t_wjxxb.id_
+            //     WHERE t_wjxxb.shu_ju_lai_yuan_ = '${activity.id}' order by create_time_ desc`
+            const sql = `select * from t_wjcyjl where parent_id_= '${activity.id}' order by create_time_ desc`
             await this.$common.request('sql', sql).then((res) => {
                 const { data = [] } = res.variables || {}
                 this.lookNum = data.length