consultationDetails.vue
5.5 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<template>
<view class="">
<view class="mainBox">
<view class="title">{{detail.title}}</view>
<view class="timenev flexD">
<view class="time">
发布时间{{detail.publishtime}}
</view>
<image src="../../static/ic_fenxiang.png" mode="" @click="shareModel=true"></image>
</view>
<rich-text :nodes="detail.content"></rich-text>
</view>
<view class="share" v-if="shareModel" @click="shareModel=false">
<image src="/static/detailShare.png" mode=""></image>
<view class="">
点击这里进行分享
</view>
</view>
</view>
</template>
<script>
import {
arc_detail
} from '@/api/index.js'
var jweixin = require('jweixin-module');
console.log(jweixin, "000")
export default {
data() {
return {
id: "",
detail: {
title: "",
publishtime: "",
content: "",
},
shareModel: false,
Images: "http://yuanjie.n.broing.cn/assets/img/share_logo.jpg",
jssdk:{},
}
},
onLoad(options) {
this.id = options.id
let title = uni.getStorageSync("deltitle")
uni.setNavigationBarTitle({
title: title //这是修改后的导航栏文字
})
this.arc_detail()
},
onUnload() {
uni.removeStorageSync("deltitle")
},
methods: {
//详情
async arc_detail() {
try {
const res = await arc_detail(this.id, window.location.href)
this.detail = res.detail
this.jssdk = res.jssdk
this.share()
console.log('arc_detail', res)
// 保存数据
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
console.log('arc_detail', err)
}
},
share() {
let that = this;
jweixin.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: that.jssdk.appId, // 必填,公众号的唯一标识
timestamp: that.jssdk.timestamp, // 必填,生成签名的时间戳
nonceStr: that.jssdk.nonceStr, // 必填,生成签名的随机串
signature: that.jssdk.signature, // 必填,签名
jsApiList: that.jssdk.jsApiList // 必填,需要使用的JS接口列表
})
jweixin.error(function(res) {
console.log(res, '错误')
});
console.log('分享了', that.jssdk.signature);
jweixin.ready(function() {
//分享给朋友
jweixin.onMenuShareAppMessage({
title: that.detail.title, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.Images, // 分享图标
success: function() {
// 用户点击了分享后执行的回调函数
uni.showToast({
title: '分享成功',
duration: 2000
});
},
cancel: function(res) {
console.log('取消分享')
}
});
jweixin.updateAppMessageShareData({
title: that.detail.title, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.Images, // 分享图标
success: function() {
console.log('设置分享给朋友成功')
},
cancel: function(res) {
console.log('取消分享')
}
});
//分享到朋友圈
jweixin.onMenuShareTimeline({
title: that.detail.title, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.Images, // 分享图标
success: function() {
// 用户点击了分享后执行的回调函数
uni.showToast({
title: '分享成功',
duration: 2000
});
},
cancel: function(res) {
console.log('取消分享')
}
});
jweixin.updateTimelineShareData({
title: that.detail.title, // 分享标题
link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: "【琉璃藏宝阁】数字藏品流转平台,顺利“琉”转,藏品“璃”手",
imgUrl: that.Images, // 分享图标
success: function() {
console.log('设置分享到朋友圈成功')
},
cancel: function(res) {
console.log('取消分享')
}
});
});
},
}
}
</script>
<style lang="less">
.mainBox {
padding: 24rpx 31rpx;
.timenev {
margin-top: 20rpx;
color: rgba(179, 179, 179, 1);
font-size: 24rpx;
font-weight: 400;
font-family: "PingFang SC";
image {
width: 40rpx;
height: 40rpx;
}
}
}
.share {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .6);
image {
position: fixed;
right: 80rpx;
top: 4rpx;
width: 188rpx;
height: 262rpx;
}
view {
position: fixed;
right: 80rpx;
top: 300rpx;
color: rgba(255, 255, 255, 1);
font-size: 36rpx;
font-weight: 700;
}
}
</style>