| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- var _request = require('../../utils/request.js')
- Page({
- data: {
- url: '',
- shareTitle: '凤凰菁选商城',
- sharePath: '',
- shareImageUrl: ''
- },
- onLoad: function (options) {
- console.log(options)
- var url = options.id;
-
-
- let links = decodeURIComponent(url);
- if(!links){
- links = url;
- }
- this.setData({
- url: links,
- sharePath: links
- })
- // wx.setNavigationBarTitle({
- // 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) {
- var shareUrl = this.data.sharePath || this.data.url
- return _request.share({
- 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'
- })
- }
- })
|