| | |
| | | // pages/detailDis/case.js |
| | | import { actionDo, getWholecaseInfo } from '../../api/index' |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | bottomLift: 0 |
| | | bottomLift: 0, |
| | | showShare: false |
| | | }, |
| | | |
| | | /** |
| | |
| | | this.setData({ |
| | | bottomLift: app.bottomLift |
| | | }) |
| | | this.getDetail(options.id) |
| | | actionDo({ |
| | | actionType: 'view', |
| | | id: options.id |
| | | }) |
| | | const member = wx.getStorageSync('member') |
| | | this.setData({id: options.id, member}) |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | priviewFull(){ |
| | | let { panorama: link, title } = this.data.info |
| | | wx.navigateTo({ |
| | | url: '/pages/webView/index', |
| | | success: function(res) { |
| | | // 通过eventChannel向被打开页面传送数据 |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { link, title }) |
| | | } |
| | | }) |
| | | }, |
| | | openShare() { |
| | | this.setData({showShare: true}) |
| | | }, |
| | | handleShare() { |
| | | console.log('点击了分享'); |
| | | actionDo({ actionType: 'share', id: this.data.info.id }) |
| | | }, |
| | | // onShareAppMessage: function () { |
| | | // // let { productDetail, userInfo } = this.data |
| | | // return { |
| | | // title: productDetail.title, |
| | | // path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0' |
| | | // } |
| | | // }, |
| | | handleAction(e){ |
| | | const actionType = e.currentTarget.dataset.code |
| | | const { info } = this.data |
| | | actionDo({ |
| | | actionType, |
| | | id: this.data.info.id |
| | | }).then(res => { |
| | | info.collection = !info.collection |
| | | this.setData({info}) |
| | | wx.showToast({ |
| | | title: actionType == 'collect' ? '收藏成功' : '取消收藏', |
| | | }) |
| | | }) |
| | | }, |
| | | getDetail(id) { |
| | | getWholecaseInfo({id}).then(res => { |
| | | this.setData({ info: res.data }) |
| | | wx.setNavigationBarTitle({ |
| | | title: res.data.title |
| | | }) |
| | | }) |
| | | }, |
| | | handleDesign() { |
| | | wx.navigateTo({ |
| | | url: '/pages/design/design', |
| | | }) |
| | | }, |
| | | playVideo() { |
| | | wx.previewMedia({ |
| | | sources: [{ url: this.data.info.video, type: 'video' }] |
| | | }) |
| | | }, |
| | | onClose() { |
| | | this.setData({showShare: false}) |
| | | }, |
| | | |
| | | /** |