| | |
| | | import { |
| | | shareContent, |
| | | getProductInfo, |
| | | actionDo |
| | | actionDo, |
| | | refreshEnjoy |
| | | } from '../../api/index' |
| | | import moment from "moment"; |
| | | Page({ |
| | |
| | | */ |
| | | data: { |
| | | bottomLift: 0, |
| | | current: 0, |
| | | id: '', |
| | | info: {}, |
| | | member: {}, |
| | | showShare: false |
| | | showShare: false, |
| | | enjoyList: [] |
| | | }, |
| | | onShow(){ |
| | | console.log('onShow') |
| | | refreshEnjoy(this) |
| | | }, |
| | | onHide() { |
| | | console.log('onHide') |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | |
| | | member |
| | | }) |
| | | }, |
| | | |
| | | // 组件事件 |
| | | handleEnjoy(e) { |
| | | const info = this.data.info |
| | | if(info.id == null ){ |
| | | return |
| | | } |
| | | const enjoyList = wx.getStorageSync('enjoyList') || [] |
| | | const { type, flag } = e.detail |
| | | console.log('type', type); |
| | | console.log('flag', flag); |
| | | const info = this.data.info |
| | | console.log('flag', flag); |
| | | if(type == 'enjoy'){ |
| | | // 点击了喜欢 |
| | | const index = enjoyList.findIndex( i => i.id === info.id ) |
| | |
| | | enjoyList.splice(index, 1) |
| | | } |
| | | wx.setStorageSync('enjoyList', enjoyList) |
| | | refreshEnjoy(this) |
| | | }else{ |
| | | actionDo({ |
| | | id: info.id, |
| | |
| | | }) |
| | | } |
| | | }, |
| | | priviewBanner(e) { |
| | | const url = e.currentTarget.dataset.url |
| | | const { |
| | | info |
| | | } = this.data |
| | | wx.previewImage({ |
| | | urls: info.bannerImgList, |
| | | current: url |
| | | }) |
| | | }, |
| | | bindchange(e) { |
| | | this.setData({ current: e.detail.current }) |
| | | }, |
| | | priviewSpace(e) { |
| | | const url = e.currentTarget.dataset.url |
| | | const { |
| | | info |
| | | } = this.data |
| | | wx.previewImage({ |
| | | urls: info.spaceList.map(i => i.spaceImg), |
| | | current: url |
| | | }) |
| | | }, |
| | | onShareAppMessage() { |
| | | console.log('用户点击了分享'); |
| | | }, |