detail.js
2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import cmsModel from '../../models/cms/index';
import helper from '../../utils/helper';
import Yas from '../../common/yas';
import { stringify } from '../../vendors/query-stringify';
let app = getApp();
let yas;
Page({
data: {
title: '',
pic: '',
content: '',
time: '',
type: 1
},
onLoad: function(options) {
cmsModel.cmsData(options.id || 0).then(result => {
if (result.wechatUrl) {
return global.router.go('webView', {url: result.wechatUrl});
}
let type = 1;
let content;
if (result.contentSection) {
content = result.contentSection;
type = 2;
} else {
type = 1;
content = result.content;
}
this.setData({
title: result.title || '',
time: result.time || '',
pic: result.pic || '',
type,
content
});
});
app = app || getApp();
yas = new Yas(app);
yas.pageOpenReport();
},
onShareAppMessage: function(res) {
let pages = getCurrentPages();
let path = pages[pages.length - 1].route || '/pages/index/index';
let pageParams = stringify(pages[pages.length - 1].options) || '';
let params = {
FROM: res.from,
SHARE_RESULT: 0,
TITLE: this.data.title || '潮人汇聚、尖货集结,一个城市,一个潮流中心!南京新街口艾尚天地YOHO!STORE',
imageUrl: helper.imgView(this.data.pic, 750, 480),
PATH: path,
PAGE_PARAM: pageParams
};
return {
title: params.TITLE, // 分享标题
imageUrl: params.imageUrl,
success: function() {
yas.report('YB_SHARE_RESULT_L', params); // 分享上报
}
};
},
onImageUrl({detail: {url}}) {
console.log('open=>', url);
global.router.goUrl(url);
}
});