From abbd7d18ea431ee8b6b8e634abf3e8ccb1fbb1b3 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 28 三月 2025 18:43:33 +0800 Subject: [PATCH] 登录迁移 --- packageBookService/pages/bookServices/detail/index.js | 91 ++++++++++++++++++++++++--------------------- 1 files changed, 49 insertions(+), 42 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 72cd1ec..f9aefe9 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -1272,12 +1272,6 @@ // 鍥句功娣诲姞璐墿杞� addBookShopcCar() { - const token = wx.getStorageSync(app.config.tokenKey); - if (token) { - addFun() - } else { - this.logInFun(() => {}) - } const addFun = async () => { if (!this.data.expire) { const shoppingCartGetId = []; @@ -1321,6 +1315,13 @@ }); } } + const token = wx.getStorageSync(app.config.tokenKey); + if (token) { + addFun() + } else { + this.logInFun(() => {}) + } + }, showSuccessToast() { @@ -1796,13 +1797,6 @@ }, // 浜戝涔犱竴閿鍙� getFreeResource() { - const child = this.selectComponent("#learn-resource"); - const token = wx.getStorageSync(app.config.tokenKey); - if (!token) { - this.logInFun(() => {}); - } else { - getFreeFun() - } const getFreeFun = async () => { // 棰嗗彇鏌ョ湅 锛屽厛鐪嬩簯瀛︿範涓婄殑 鍐嶇湅璧勬簮涓婄殑 const cloundMenu = this.data.resourceCodeList.find((item) => item.refCode == 'jsek_cloudLearning') @@ -1871,6 +1865,14 @@ console.log(error); } } + const child = this.selectComponent("#learn-resource"); + const token = wx.getStorageSync(app.config.tokenKey); + if (!token) { + this.logInFun(() => {}); + } else { + getFreeFun() + } + }, // 浜戝涔犱竴閿喘涔� async allAddShoppiingCar() { @@ -1924,12 +1926,6 @@ }, // 浜戝涔犲叏閮ㄨ喘涔� buyCloudLearnClass() { - const token = wx.getStorageSync(app.config.tokenKey); - if (token) { - buyClass() - } else { - this.logInFun(() => {}) - } const buyClass = async () => { const cloundMenu = this.data.resourceCodeList.find((item) => item.refCode == 'jsek_cloudLearning') let query = { @@ -1954,6 +1950,13 @@ }); } } + const token = wx.getStorageSync(app.config.tokenKey); + if (token) { + buyClass() + } else { + this.logInFun(() => {}) + } + }, // 鍙樹负鎵�鏈塩heck true findAndUpdateItemsByIds(tree, ids) { @@ -2251,12 +2254,6 @@ }, // 搴曢儴璐拱鎸夐挳 buyBtn() { - const token = wx.getStorageSync(app.config.tokenKey); - if (token) { - buyFun() - } else { - this.logInFun(() => {}) - } const buyFun = () => { if (this.data.tabValue == "brief" && !this.data.bookBuy) { this.buyBook(); @@ -2267,6 +2264,13 @@ console.log(this.data.tabValue); } } + const token = wx.getStorageSync(app.config.tokenKey); + if (token) { + buyFun() + } else { + this.logInFun(() => {}) + } + }, goRead(e) { @@ -2421,12 +2425,6 @@ //鐢宠鐢靛瓙鏍蜂功 appplyElectronicBook() { - const token = wx.getStorageSync(app.config.tokenKey); - if (token) { - applyFun() - } else { - this.logInFun(() => {}) - } const applyFun = () => { // 鍏堝垽鏂笅鏁欏笀璁よ瘉锛屾湭瀵瑰師鏈夐�昏緫淇敼 let role = this.data.userInfo != null ? this.data.userInfo.role : null; @@ -2534,15 +2532,16 @@ }); } } - }, - //鐢宠绾歌川鏍蜂功 - appplyPaperBook() { const token = wx.getStorageSync(app.config.tokenKey); if (token) { applyFun() } else { this.logInFun(() => {}) } + + }, + //鐢宠绾歌川鏍蜂功 + appplyPaperBook() { const applyFun = () => { let role = this.data.userInfo != null ? this.data.userInfo.role : null; if (role && role == "Teacher") {} else { @@ -2630,6 +2629,13 @@ }); } } + const token = wx.getStorageSync(app.config.tokenKey); + if (token) { + applyFun() + } else { + this.logInFun(() => {}) + } + }, // 娣诲姞鏍蜂功 addBookFun(item, type) { @@ -2756,14 +2762,6 @@ return childrenList }, uploadFile(e) { - const token = wx.getStorageSync(app.config.tokenKey); - if (token) { - uploadFun() - } else { - this.logInFun(() => { - uploadFun() - }) - } const uploadFun = () => { const userInfo = JSON.parse(wx.getStorageSync(app.config.userInfoKey)) if (userInfo.role != 'Teacher') return wx.showToast({ @@ -2775,6 +2773,15 @@ isShowUp: true }); } + const token = wx.getStorageSync(app.config.tokenKey); + if (token) { + uploadFun() + } else { + this.logInFun(() => { + uploadFun() + }) + } + }, closeDialog() { this.setData({ -- Gitblit v1.9.1