From 1ebf13fcff1d64f0ab9f1981cd60ad3194a2d29c Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 27 九月 2024 11:10:00 +0800 Subject: [PATCH] zf --- pages/home/home.js | 35 +++++++++++++++++++++-------------- 1 files changed, 21 insertions(+), 14 deletions(-) diff --git a/pages/home/home.js b/pages/home/home.js index 3bce987..b94578d 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -39,14 +39,18 @@ baseRefresh: { value: false }, - loading: true + loading: true, }, onShow() { this.setData({ searchVal: "", }); - console.log(this.data.searchVal) this.loadHomePage(); + const token = wx.getStorageSync(app.config.tokenKey) + if (token) { + this.getShoppingCartList() + } + this.init(); }, onLoad() { @@ -72,11 +76,7 @@ this.init(); } }) - } else { - this.init(); - this.registe() } - }, onReachBottom() {}, onPullDownRefresh() { @@ -203,8 +203,8 @@ } app.MG.store.getProductList(obj).then((res) => { res.datas.forEach((item) => { - item.liveTime = item.liveTime ? moment(item.liveTime).format("MM-DD HH:mm:ss") : ''; - item.startTime = item.startTime ? moment(item.startTime).format("MM-DD HH:mm:ss") : ''; + item.liveTime = item.liveTime ? item.liveTime.substring(5) : ''; + item.startTime = item.startTime ? item.startTime.substring(5) : ''; item.price = item.price ? item.price.toFixed(2) : item.price; }); this.setData({ @@ -453,10 +453,17 @@ // duration: 1000 // }) const item = e.currentTarget.dataset.book - console.log(item); + // 缃戦〉绫诲瀷璺宠浆鍒扮綉鍧�澶嶅埗椤碉紝鍥犱负url浼犲弬涓嶈兘浼� 甯﹀弬鏁扮殑缃戠粶鍦板潃锛屾墍浠ユ澶勮鎶婄綉缁滃湴鍧�閲岀殑浼犲弬鎽樺嚭鏉ワ紝鏀惧埌url閲� + let urlData = '' + const flags = item.jsek_link.indexOf("?") + if (flags > -1) { + urlData = item.jsek_link.slice(flags + 1, item.jsek_link.length) + } + let url = '/packageBookService/pages/bookServices/linkPage/index' wx.navigateTo({ - url: '/pages/specialDiscussion/webView/index?link=' + item.jsek_link - }); + url: urlData ? url + `?path=${item.jsek_link.slice(0,flags)}` + '&' + urlData : url + `?path=${item.jsek_link}` + }) + }, goCourseDetail(e) { // return wx.showToast({ @@ -508,7 +515,7 @@ }) }) }, - addCart(e) { + async addCart(e) { const { info } = e.currentTarget.dataset; @@ -526,7 +533,7 @@ ) ) { wx.showToast({ - title: "璇ヤ功宸插湪璐墿杞︼紝璇峰嬁閲嶅娣诲姞绌�", + title: "璇ュ晢鍝佸凡鍦ㄨ喘鐗╄溅锛岃鍕块噸澶嶆坊鍔�", icon: 'none', duration: 1000 }) @@ -538,7 +545,7 @@ agentCode: '鐢靛瓙涔�' }] } - const addRes = app.MG.store.addShoppingCart(query) + const addRes = await app.MG.store.addShoppingCart(query) if (addRes) { wx.showToast({ title: "娣诲姞鎴愬姛", -- Gitblit v1.9.1