From 38cd76c5f05fd55855038e2d393074e27909c63d Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 28 三月 2025 15:28:01 +0800 Subject: [PATCH] 剩余页面登录迁移 --- pages/digitalCourses/digitalCoursesDetails/components/question/question.js | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 deletions(-) diff --git a/pages/digitalCourses/digitalCoursesDetails/components/question/question.js b/pages/digitalCourses/digitalCoursesDetails/components/question/question.js index f17fd45..8228695 100644 --- a/pages/digitalCourses/digitalCoursesDetails/components/question/question.js +++ b/pages/digitalCourses/digitalCoursesDetails/components/question/question.js @@ -1,5 +1,8 @@ // pages/bookServices/detail/components/note/note.js const app = getApp(); +import { + loginInfo +} from '../../../../../assets/js/login'; import moment from 'moment' Component({ /** @@ -67,10 +70,15 @@ }); }, openDialog() { - this.setData({ - submitTitle: this.properties.bookInfo.name, - showNoteDialog: true, - }); + const token = wx.getStorageSync(app.config.tokenKey) + if (token) { + this.setData({ + submitTitle: this.properties.bookInfo.name, + showNoteDialog: true, + }); + } else { + loginInfo(app, (data) => {}) + } }, closeDialog() { this.setData({ @@ -147,6 +155,7 @@ } let submitData = { + bookId: this.properties.bookInfo.id, content: this.data.content.replace(/^\s*|\s*$/g, ""), name: this.data.userName.replace(/^\s*|\s*$/g, ""), email: "", @@ -212,7 +221,6 @@ this.setData({ noList: false, }); - let topicId; app.MG.ugc .getTopicMessageList({ appRefCode: app.config.appRefCode, @@ -227,22 +235,24 @@ if (!res.datas.length) { return this.setData({ loading: false, - noList: true, noteList: res.datas, }); } - // notePage.value.total = res.totalSize + let list = [] res.datas.forEach((item) => { item.title = JSON.parse(item.content).content; item.createDate = moment(item.createDate).format("YYYY-MM-DD HH:mm:ss"); item.updateDate = moment(item.updateDate).format("YYYY-MM-DD HH:mm:ss"); item.feedBack = item.feedBack ? item.feedBack : '鏆傛湭鍥炲' + if (this.properties.bookInfo.id == JSON.parse(item.content).bookId) { + list.push(item) + } }); this.setData({ - "pageCount.total": res.totalSize, - onlineQuestionsList: res.datas, + "pageCount.total": list.length, + onlineQuestionsList: list, loading: false, - noList: false, + noList: list.length ? false : true, }); console.log(this.data.onlineQuestionsList, 3456) }); -- Gitblit v1.9.1