From 07d966afd92b3bb7e40cccfa300a125000fd69e2 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 31 七月 2024 20:16:42 +0800
Subject: [PATCH] 代码提交
---
wechat_jiaxuan/pages/detailDis/product.js | 70 +++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 27 deletions(-)
diff --git a/wechat_jiaxuan/pages/detailDis/product.js b/wechat_jiaxuan/pages/detailDis/product.js
index fd243ff..beb90e7 100644
--- a/wechat_jiaxuan/pages/detailDis/product.js
+++ b/wechat_jiaxuan/pages/detailDis/product.js
@@ -1,7 +1,9 @@
import {
getProductInfo,
- actionDo
+ actionDo,
+ getMemberInfo
} from '../../api/index'
+import { eventBus } from '../../utils/eventBus'
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
@@ -11,29 +13,53 @@
current: 0,
id: '',
origin: '',
+ isFold: false,
info: {},
member: {},
showShare: false
},
- onLoadLogin(options){
+ changeFold() {
+ this.setData({ isFold: !this.data.isFold })
+ },
+ onLoadLogin(options) {
this.getDetail(options.id, options.userId || '')
actionDo({
actionType: 'view',
id: options.id
})
+ const member = wx.getStorageSync('member') || {}
+ if(!member.id){
+ getMemberInfo().then(res => {
+ this.setData({
+ member: res.data
+ })
+ })
+ }
+ },
+ onShow() {
+ const member = wx.getStorageSync('member') || {}
+ if(member && member.id){
+ this.setData({
+ member
+ })
+ }
+ },
+ onUnload() {
+ console.log('璇︽儏杩涜浜嗛攢姣�');
+ setTimeout(() => {
+ eventBus.emit('productDeBack', this.data.info)
+ }, 500)
},
onLoad(options) {
var app = getApp().globalData
this.setData({
bottomLift: app.bottomLift
})
- if(options.origin && options.origin == 'b'){
+ if (options.origin && options.origin == 'b') {
this.setData({ origin: 'b' })
}
- const member = wx.getStorageSync('member')
this.setData({
- id: options.id,
- member
+ id: options.id
})
},
bindchange(e) {
@@ -45,7 +71,7 @@
info
} = this.data
wx.previewImage({
- urls: info.imageurlList,
+ urls: info.bannerImgList,
current: url
})
},
@@ -55,16 +81,15 @@
info
} = this.data
wx.previewImage({
- urls: info.imageurlList,
+ urls: info.spaceList.map(i => i.spaceImg),
current: url
})
},
handleAction(e) {
const actionType = e.currentTarget.dataset.code
const {
- info
+ info, member
} = this.data
- const member = wx.getStorageSync('member')
if (member.authStatus == '0') {
return wx.navigateTo({
url: '/pages/auth/auth',
@@ -80,6 +105,7 @@
})
wx.showToast({
title: actionType == 'collect' ? '鏀惰棌鎴愬姛' : '鍙栨秷鏀惰棌',
+ icon: "none"
})
})
},
@@ -125,7 +151,6 @@
})
},
handleShare() {
- console.log('鐐瑰嚮浜嗗垎浜�');
actionDo({
actionType: 'share',
id: this.data.info.id
@@ -134,13 +159,13 @@
// this.setData({showShare: false})
// })
},
- // onShareAppMessage: function () {
- // // let { productDetail, userInfo } = this.data
- // return {
- // title: productDetail.title,
- // path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0'
- // }
- // },
+ onShareAppMessage: function () {
+ let { info } = this.data
+ console.log('鐐瑰嚮浜嗗垎浜�')
+ return {
+ path: '/pages/detailDis/product?id=' + info.id + '&userId=' + info.users.id
+ }
+ },
onClose() {
this.setData({
showShare: false
@@ -188,9 +213,6 @@
onHide() {
},
- onUnload() {
-
- },
onPullDownRefresh() {
},
@@ -198,10 +220,4 @@
},
- /**
- * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
- */
- onShareAppMessage() {
-
- }
})
\ No newline at end of file
--
Gitblit v1.9.3