From c0ff00c32bca4077b140d0d69b2863851ae31273 Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期二, 08 七月 2025 16:29:17 +0800 Subject: [PATCH] 优化 --- packageBookService/pages/bookServices/detail/components/testResource/testResource.js | 59 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 39 insertions(+), 20 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js index 9eb668c..f508d9c 100644 --- a/packageBookService/pages/bookServices/detail/components/testResource/testResource.js +++ b/packageBookService/pages/bookServices/detail/components/testResource/testResource.js @@ -1,4 +1,7 @@ // pages/bookServices/detail/components/testResource/testResource.js +import { + loginInfo +} from "../../../../../../assets/js/login"; const app = getApp(); Component({ /** @@ -6,6 +9,9 @@ */ properties: { isBuyBank: { + type: Boolean + }, + isShoppingBank: { type: Boolean }, bankSaleData: { @@ -67,7 +73,6 @@ }, async goTest(e) { const value = e.detail.value.item; - console.log(value, "value"); const token = wx.getStorageSync("jsek-token"); if (!token) { return wx.getUserProfile({ @@ -104,7 +109,7 @@ size: 999, }, }; - if (value.childrenFolderCount == 0) { + if (value.childrenFolderCount == 0 && value.childrenCount == 0) { wx.hideLoading(); return wx.showToast({ icon: "error", @@ -125,10 +130,13 @@ wx.hideLoading(); if (value.refCode == "psychology") { const listName = value.name + const listId = value.id + const bookId = this.data.bookInfo.id + const bookName = this.data.bookInfo.name + const formPath = this.data.tab wx.navigateTo({ url: `/packageBookService/pages/psychologyAnswer/psychologyAnswer?listName=${ - listName - }` + listName}&listId=${listId}&bookId=${bookId}&bookName=${bookName}&formPath=${formPath}` }) } else { wx.navigateTo({ @@ -138,28 +146,30 @@ this.properties.bookInfo.rootCmsItemId }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${ value.name - }&answerType=${value.refCode ? value.refCode : "option"}&storeInfo=${this.properties.storeInfo}&jslx=${this.properties.jslx}`, + }&answerType=option&storeInfo=${this.properties.storeInfo}&jslx=${this.properties.jslx}`, }); } }, goMycollect(e) { - const answertype = e.currentTarget.dataset.answertype; - const token = wx.getStorageSync("jsek-token"); - if (!token) { - return wx.getUserProfile({ - desc: "鐢ㄦ埛鐧诲綍", - success: (res) => { - console.log(res); - }, + const gotoPage = () => { + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/examination/examination?bookId=${ + this.properties.bookInfo.id + }&rootCmsItemId=${this.properties.bookInfo.rootCmsItemId}&answerTitle=${ + answertype == "collectQuestion" ? "鎴戠殑鏀惰棌" : "鎴戠殑閿欓" + }&answerType=${answertype}`, }); } - wx.navigateTo({ - url: `/packageBookService/pages/bookServices/examination/examination?bookId=${ - this.properties.bookInfo.id - }&rootCmsItemId=${this.properties.bookInfo.rootCmsItemId}&answerTitle=${ - answertype == "collectQuestion" ? "鎴戠殑鏀惰棌" : "鎴戠殑閿欓" - }&answerType=${answertype}`, - }); + const answertype = e.currentTarget.dataset.answertype; + const token = wx.getStorageSync("jsek-token"); + if (token) { + gotoPage() + } else { + loginInfo(app, (data) => { + if (data) {} + }) + } + }, // 缁冧範 缁勪欢鍒囨崲 onRadioChange(e) { @@ -222,6 +232,15 @@ composed: true } // 瑙﹀彂浜嬩欢鐨勯�夐」 this.triggerEvent('buyBank', myEventDetail, myEventOption) + }, + // 棰樺簱鍔犲叆璐墿杞� + handleShoppingBank() { + var myEventDetail = {} + var myEventOption = { + bubbles: true, + composed: true + } + this.triggerEvent('handleShoppingBank', myEventDetail, myEventOption) } }, }); \ No newline at end of file -- Gitblit v1.9.1