|
@@ -1,7 +1,10 @@
|
|
|
var _request = require('../../utils/request.js')
|
|
var _request = require('../../utils/request.js')
|
|
|
Page({
|
|
Page({
|
|
|
data: {
|
|
data: {
|
|
|
- url: ''
|
|
|
|
|
|
|
+ url: '',
|
|
|
|
|
+ shareTitle: '凤凰菁选商城',
|
|
|
|
|
+ sharePath: '',
|
|
|
|
|
+ shareImageUrl: ''
|
|
|
},
|
|
},
|
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
|
console.log(options)
|
|
console.log(options)
|
|
@@ -13,18 +16,43 @@ Page({
|
|
|
links = url;
|
|
links = url;
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- url: links
|
|
|
|
|
|
|
+ url: links,
|
|
|
|
|
+ sharePath: links
|
|
|
})
|
|
})
|
|
|
// wx.setNavigationBarTitle({
|
|
// wx.setNavigationBarTitle({
|
|
|
// title: 'sdsd'
|
|
// title: 'sdsd'
|
|
|
// })
|
|
// })
|
|
|
},
|
|
},
|
|
|
|
|
+ onWebMessage: function (event) {
|
|
|
|
|
+ var list = event && event.detail && event.detail.data
|
|
|
|
|
+ if (!Array.isArray(list) || !list.length) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ var data = list[list.length - 1] || {}
|
|
|
|
|
+ if (data.shareSource !== 'tcm_constitution') {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ var next = {}
|
|
|
|
|
+ if (data.shareTitle) {
|
|
|
|
|
+ next.shareTitle = data.shareTitle
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data.shareUrl) {
|
|
|
|
|
+ next.sharePath = data.shareUrl
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data.shareImageUrl) {
|
|
|
|
|
+ next.shareImageUrl = data.shareImageUrl
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Object.keys(next).length) {
|
|
|
|
|
+ this.setData(next)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
onShareAppMessage: function (val) {
|
|
onShareAppMessage: function (val) {
|
|
|
|
|
+ var shareUrl = this.data.sharePath || this.data.url
|
|
|
return _request.share({
|
|
return _request.share({
|
|
|
- title: '凤凰菁选商城',
|
|
|
|
|
- path: '/pages/start/start?url=pages/web/web&id=' + this.data.url,
|
|
|
|
|
- imageUrl: '',
|
|
|
|
|
- sc: 'cxc_web'
|
|
|
|
|
|
|
+ title: this.data.shareTitle || '凤凰菁选商城',
|
|
|
|
|
+ path: '/pages/start/start?url=pages/web/web&id=' + encodeURIComponent(shareUrl),
|
|
|
|
|
+ imageUrl: this.data.shareImageUrl || '',
|
|
|
|
|
+ sc: this.data.shareTitle === '九型体质评测' ? 'tcm_constitution_share' : 'cxc_web'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|