From c192e381734b9caf173c90bb9141dff0326785ee Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期四, 17 七月 2025 14:20:11 +0800 Subject: [PATCH] 京师智教小程序的专题活动模块 不做点击进入页面提示复制链接 点击时直接提示“请移步PC端查看” --- packageBookService/pages/psychologyAnswer/psychologyAnswer.js | 110 ++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 73 insertions(+), 37 deletions(-) diff --git a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js index f4bbd95..77d6c63 100644 --- a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js +++ b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js @@ -39,20 +39,57 @@ */ onLoad(options) { // 鍦ㄦ杩涜鏄惁璐拱鐨勬煡璇� - const questionId = options.listId; - const bookId = options.bookId - const bookName = options.bookName - const formPath = options.formPath - const query = { - "cmsItemId": Number(questionId) - }; - app.MG.file.checkCmsItem(query) - .then((res) => { - const isBuys = res; + const questionName = options.listName + this.setData({ + questuionName: questionName + }); + const isEmption = questionName.includes('-璇勫') + if (isEmption) { + this.initialize() + } else { + const questionList = pastData.postData.list + var listIndex = 0 + for (let index = 0; index < questionList.length; index++) { + const item = questionList[index]; + if (item.name == questionName) { + listIndex = index + } + } + const indexof = listIndex + const idPath = questionList[indexof].idPath; + const bookId = questionList[indexof].bookId; + const bookName = "澶у鐢熷績鐞嗗仴搴凤紙绗�3鐗堬級锛堣瀺濯掍綋鐗堬級" + const formPath = "questionBank" + // 杩涜澶勭悊 + const query = { + path: "*", + queryType: "*", + productId: bookId, + cmsPath: "161796", + cmsType: "*" + }; + app.MG.store.getProductDetail(query).then(async (res) => { + const linkPathList = res.datas.cmsDatas[0].datas + const isBuyList = res.datas.purchasedSaleMethodIdList + let isBuy = false + const idParhList = idPath.split("/").reverse() + for (let index = 0; index < idParhList.length; index++) { + const item = idParhList[index]; + const thisItem = linkPathList.find(citem => item == citem.id); + if (thisItem.saleMethod.length > 0) { + if (isBuyList.includes(thisItem.saleMethod[0].Id) || thisItem.saleMethod[0].Price == 0) { + isBuy = true + break + } else { + isBuy = false + break + } + } + } this.setData({ - isBuy: isBuys + isBuy: isBuy }); - if (!isBuys) { + if (!isBuy) { wx.showModal({ icon: 'error', title: '娓╅Θ鎻愮ず', @@ -69,38 +106,16 @@ }); return; // 鐩存帴杩斿洖锛岄伩鍏嶆墽琛屽悗缁唬鐮� } - // 鍏朵粬閫昏緫 - const questuionName = options.listName; - this.setData({ - questionName: questuionName - }); - - const systInfo = wx.getSystemInfoSync(); - const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 - const navBarHeight = - (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� - - const token = wx.getStorageSync(app.config.tokenKey); - if (!token) { - loginInfo(app, (data) => { - if (data) { - this.init(); - } else { - this.init(); - } - }); - } else { - this.init(); - } - }) - .catch((err) => { + this.initialize() + }).catch((err) => { console.error('妫�鏌ラ搴撳け璐�:', err); wx.showToast({ icon: 'error', title: '鍔犺浇澶辫触锛岃閲嶈瘯' }); }); + } }, @@ -131,6 +146,7 @@ } }, 1000); } + this.setData({ startTime: Date.now(), }); @@ -152,6 +168,7 @@ } }, + /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ @@ -171,6 +188,25 @@ } }, + initialize() { + const systInfo = wx.getSystemInfoSync(); + const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅 + const navBarHeight = + (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴� + const token = wx.getStorageSync(app.config.tokenKey); + if (!token) { + loginInfo(app, (data) => { + if (data) { + this.init(); + } else { + this.init(); + } + }); + } else { + this.init(); + } + }, + count(timeStr) { const data = { appRefCode: app.config.appRefCode, -- Gitblit v1.9.1