discuss.js
2.4 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
73
74
75
var t = require("../../../utils/network.js");
Page({
data: {
id: "",
commentlist: []
},
onLoad: function(t) {
var o = this;
wx.getStorage({
key: "ouid",
success: function(n) {
o.setData({
id: t.id,
ouid: n.data
}), o.good_comments();
}
});
},
previewImage1: function(t) {
var o = t.currentTarget.dataset.index, n = t.currentTarget.dataset.imgindex, e = this.data.commentlist[n].img;
console.log(e.length), console.log(n), wx.previewImage({
current: e[o],
urls: e
});
},
good_comments: function() {
var o = this;
t.POST({
url: "Index/good_comments",
header: "application/x-www-form-urlencoded",
params: {
ouid: this.data.ouid,
id: this.data.id
},
success: function(t) {
"success" == t.data.state && o.setData({
commentlist: t.data.comments
});
}
});
},
onReady: function() {},
onShow: function() {},
onHide: function() {},
onUnload: function() {},
onPullDownRefresh: function() {},
onReachBottom: function() {},
onShareAppMessage: function (options) {
let that = this;
let ouid;
// 设置菜单中的转发按钮触发转发事件时的转发内容
var shareObj = {
title: '嗒咕商场', // 默认是小程序的名称(可以写slogan等)
path: '/pages/start/start?share_id=' + wx.getStorageSync('ouid'), // 默认是当前页面,必须是以‘/’开头的完整路径
imgUrl: '',//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == 'shareAppMessage:ok') { }
},
fail: function () {
// 转发失败之后的回调
if (res.errMsg == 'shareAppMessage:fail cancel') {
// 用户取消转发
} else if (res.errMsg == 'shareAppMessage:fail') {
// 转发失败,其中 detail message 为详细失败信息
}
},
complete: function () {
// 转发结束之后的回调(转发成不成功都会执行)
}
}
return shareObj;
},
});