From 84a2505e2aa5069849d54c87a10f8a9664fdbf98 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Thu, 12 Oct 2023 16:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=A1=E9=87=8D=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/clock/clock.vue | 372 +++++++++++++++++++++++++++++++----------- 1 file changed, 276 insertions(+), 96 deletions(-) diff --git a/pages/clock/clock.vue b/pages/clock/clock.vue index 6368ee1..30de8a4 100644 --- a/pages/clock/clock.vue +++ b/pages/clock/clock.vue @@ -52,7 +52,7 @@ - {{taskInfo.heading}} + {{taskInfo.title}} @@ -61,9 +61,9 @@ @error="videoErrorCallback" controls> - + - @@ -76,16 +76,14 @@ -

#{{item.TaskHeading}}#

- - - + - + + {{item.createTime}} @@ -98,39 +96,108 @@ -- 更多签到记录 -- - + - - {{item.name}} + + + {{item.nickName?item.nickName:'匿名用户'}}
- +
- - {{item.createdate}} + + + + + + + 回复 + + {{item.createTime}} + +
- + + + + + + {{item2.nickName?item2.nickName:'匿名用户'}} + 回复了 + {{item2.puserNickName?item2.puserNickName:'匿名用户'}} + + + + + + + + + + + 回复 + + {{item2.createTime}} + + + + +
+
+ + + + 回复 {{opPinglun.nickName}} + + + + + + + + + + + 提交 + + + + + + + + + + + 今日签到随想 @@ -138,7 +205,7 @@ --> - + @@ -171,8 +238,10 @@ + @click="addTextShow = true">说点什么 + +
@@ -188,9 +257,14 @@ import { mapState } from 'vuex'; + import { + param + } from 'jquery'; export default { data() { return { + opPinglun:{}, // 针对的评论对象 + pinglunShow:false, placeholder: '开始输入...', dayCurrent: 0, // 载入页面时的显示页数 showBack: false, @@ -256,6 +330,13 @@ this.bookid = e.bookid this.windowWidth = uni.getSystemInfoSync().windowWidth; }, + onPullDownRefresh() { + console.log('下拉刷新了') + this.getBookInfo() + this.initDay() + this.getmySign() + uni.stopPullDownRefresh(); + }, onShow() { this.getBookInfo() this.initDay() @@ -270,6 +351,12 @@ ...mapState(['userInfo']) }, methods: { + showPingLun(item) { + // 回复评论 + this.opPinglun = item + this.pinglunShow = true + console.log('item45456', this.opPinglun) + }, onEditorReady() { // #ifdef MP-BAIDU this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor'); @@ -292,7 +379,7 @@ } else { console.log(res.msg) } - console.log(res, 'res基本信息') + console.log(res, '书籍基本信息息') }).catch((error) => { console.log(error) }) @@ -350,12 +437,13 @@ 'userId': this.userInfo.id } this.$http - .post('book/clockinPunch/clockindays', data) + // .post('book/clockinPunch/clockindays', data) + .get('book/userClockIn/clockInDays', data) .then(res => { if (res.code == 0) { - this.currentDay = res.daysBetween - this.linshiDay = res.daysBetween - this.signList = res.dayslist + this.currentDay = res.currentDay + this.linshiDay = res.currentDay + this.signList = res.clockInDayList console.log(res, '打卡参数') let zheng = Math.floor(this.currentDay / 5) this.currentIndex = zheng @@ -382,19 +470,24 @@ // 获取当天我的发布内容 getmyWord() { + let data = { + 'userId': this.userInfo.id, + 'entryId': this.taskInfo.id + } this.$http - .post('book/clockin/myinfolist?userid=' + this.userInfo.id + '&taskid=' + this.taskInfo.id + - '&bookid=' + this.bookid) + // .post('book/clockin/myinfolist?userid=' + this.userInfo.id + '&taskid=' + this.taskInfo.id + + // '&bookid=' + this.bookid) + .get('book/clockInForum/getChatList', data) .then(res => { console.log(res, '当天我的打卡内容') - if (res.code == 0 && res.productlist.length > 0) { + if (res.code == 0 && res.chatList.length > 0) { var arr = [] - res.productlist.forEach((item1) => { + res.chatList.forEach((item1) => { var pjstr = '' var imgs = [] - imgs = item1.clockinimages.split(',') + //imgs = item1.clockinimages.split(',') pjstr = this.getHtmlComment(item1.content) - item1.clockinimages = imgs + // item1.clockinimages = imgs item1.phtml = pjstr arr.push(item1) }) @@ -423,32 +516,36 @@ getAllSign(val) { console.log(val, '-----------') let data = { - 'bookid': this.bookid, - 'limit': 5, - 'page': this.page, - 'taskid': val.id + 'entryId': val.id + // 'bookid': this.bookid, + // 'limit': 5, + // 'page': this.page, + // 'taskid': val.id } - this.$http - .post('book/clockin/applist', data) + // .post('book/clockin/applist', data) + .get('book/clockInForum/getChatList', data) .then(res => { if (res.code == 0) { console.log(res, '所有人打卡信息') - if (res.list.length > 0) { - var arr = res.list + if (res.chatList.length > 0) { + var arr = res.chatList for (var i = 0; i < arr.length; i++) { var arr1 = [] var pjstr = '' // console.log(arr[i].content,'arr[i].content') pjstr = this.getHtmlComment(arr[i].content) // console.log(pjstr,'pjstr') - arr1 = arr[i].images.split(',') - arr[i].images = arr1 - arr[i].phtml = pjstr - // console.log(arr1,'arr1') - + //arr1 = arr[i].images.split(',') + // arr[i].images = arr1 + arr[i].phtml = pjstr + for (var j = 0; j < arr[i].subCommentList.length; j++) { + var subpjstr = '' + subpjstr = this.getHtmlComment(arr[i].subCommentList[j].content) + arr[i].subCommentList[j].phtml = subpjstr + } } - // console.log(arr,'res.page.list') + console.log(arr,'评论处理后的数据结构') this.commentsList = arr } else { this.commentsList = [] @@ -462,18 +559,19 @@ getTask(index) { uni.showLoading() let data = { - 'bookid': this.bookid, - 'days': index + 'bookId': this.bookid, + 'day': index } console.log(data) this.linshiDay = index this.$http - .post('book/task/applist', data) + // .post('book/task/applist', data) + .get('book/clockInForum/getPostingInfo', data) .then(res => { if (res.code == 0) { console.log(res, '任务信息') - if (res.page.list.length > 0) { - this.taskInfo = res.page.list[0] + if (res.result != {}) { + this.taskInfo = res.result this.taskInfo.video != '' ? this.poster = this.taskInfo.video + "?x-oss-process=video/snapshot,t_0,f_jpg" : '' this.getmyWord() @@ -541,49 +639,107 @@ let data = { "bookId": this.bookid, "userId": this.userInfo.id, - "tid": this.taskInfo.id, - "days": this.currentDay + // "tid": this.taskInfo.id, + // "days": this.currentDay } + this.$http + // .post('book/clockinPunch/clockindays', data) + .get('book/userClockIn/clockIn', data) + .then(res => { + if (res.code == 0) { + //console.log(res, '快捷签到') + uni.showToast({ + title: '签到成功', + icon: 'success' + }) + setTimeout(() => { + this.addTextShow = false + this.formData.content = '' + this.formData.images = [] + this.getmySign() + this.getAllSign(this.taskInfo) + }, 1000) + } + + }); + + }, + // 提交回复评论 + goToHuiFu(){ + let myFid = null + if(this.opPinglun.fid == 0){ + myFid = this.opPinglun.id + }else if (this.opPinglun.fid != 0){ + myFid = this.opPinglun.fid + } + let data = { + // 'bookId': this.bookid, + "userId": this.userInfo.id, + "entryId": this.taskInfo.id, + 'fid': myFid, + 'puserId': this.opPinglun.userId, + // "dayId": this.currentDay, + "content": this.formData.content, + "pchatId": this.opPinglun.id, + // "imageList": imgs, + } + console.log(data, 'data回复提交数据') + // url: 'book/clockin/save', + // this.$http + // .post('book/clockInForum/addChat', data) $http.request({ - url: 'book/clockinPunch/save', - method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + url: "book/clockInForum/addChat", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data, header: { //默认 无 说明:请求头 'Content-Type': 'application/json' }, }).then(res => { + if (res.code == 0) { - //console.log(res, '快捷签到') - uni.showToast({ - title: '签到成功', - icon: 'success' - }) - this.addTextShow = false + this.pinglunShow = false + this.opPinglun = {} this.formData.content = '' this.formData.images = [] - this.getmySign() - this.getAllSign(this.taskInfo) + this.formData.imagesStr = [] + uni.showToast({ + title: '回复成功', + icon: 'success' + }) + setTimeout(() => { + this.getmySign() + this.getTask(this.currentDay) + },2000) } - + }); - }, // 说点什么 goToSign() { - let data = { - 'bookId': this.bookid, - "userId": this.userInfo.id, - "taskId": this.taskInfo.id, - "dayId": this.currentDay, - "content": this.formData.content, - // "images": this.formData.imagesStr.join(), - "imageeStrings": this.formData.images, - } + // images数据处理 + var imgs = [] + imgs = this.formData.images.map(item => { + return item.url + }) + let data = { + // 'bookId': this.bookid, + "userId": this.userInfo.id, + "entryId": this.taskInfo.id, + 'fid': 0, + 'puserId': 0, + // "dayId": this.currentDay, + "content": this.formData.content, + "pchatId": 0, + "imageList": imgs, + } console.log(data, 'data') + // url: 'book/clockin/save', + // this.$http + // .post('book/clockInForum/addChat', data) $http.request({ - url: 'book/clockin/save', - method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + url: "book/clockInForum/addChat", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 data, header: { //默认 无 说明:请求头 'Content-Type': 'application/json' @@ -591,16 +747,18 @@ }).then(res => { if (res.code == 0) { //console.log(res, '快捷签到') - uni.showToast({ - title: '发布成功', - icon: 'success' - }) this.addTextShow = false this.formData.content = '' this.formData.images = [] this.formData.imagesStr = [] - this.getmySign() - this.getTask() + uni.showToast({ + title: '发布成功', + icon: 'success' + }) + setTimeout(() => { + this.getmySign() + this.getTask(this.currentDay) + },2000) } @@ -731,20 +889,24 @@