Browse Source

资讯添加阅读记录

gcz 1 year ago
parent
commit
9014a58629
2 changed files with 16 additions and 0 deletions
  1. 5 0
      common/apiurl.js
  2. 11 0
      pages/newsdetails.vue

+ 5 - 0
common/apiurl.js

@@ -52,6 +52,11 @@ const apiurl = {
 		url: '/system/sysInformation/selectById',
 		type: 'get'
 	},
+	// 添加浏览记录
+	addReadRecord: {
+		url: '/system/sysInformation/insertOrUpdate',
+		type: 'post',
+	},
 	// 海报二维码
 	performQrcode: {
 		url: '/merchant/merchantPerform/performQrcode',

+ 11 - 0
pages/newsdetails.vue

@@ -31,9 +31,13 @@
 		onShow() {
 		},
 		onLoad(page) {
+			let that = this;
 			this.getSystemInfo();
 			this.id = page.id;
 			this.getDetails();
+			setTimeout(()=>{
+				that.addReadRecord()
+			},2000);
 
 		},
 		methods: {
@@ -52,6 +56,13 @@
 				}).catch(err=>{
 					console.log('getDetails',err);
 				})
+			},
+			addReadRecord(){
+				this.$u.api.addReadRecord({keyId:this.id, accessedPage: "小程序",remark:'资讯浏览'},{custom:{noload:true}}).then(res=>{
+					// console.log('res',res.data);
+				}).catch(err=>{
+					console.log('getDetails',err);
+				})
 			}
 
 		}