|
@@ -27,6 +27,10 @@
|
|
|
<text class="label">零售价</text>
|
|
<text class="label">零售价</text>
|
|
|
<text class="old">¥{{product.otPrice}}</text>
|
|
<text class="old">¥{{product.otPrice}}</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <view class="share-box" @tap="handleOpenShare">
|
|
|
|
|
+ <text class="text">分享</text>
|
|
|
|
|
+ <u-icon name="share-fill" color="#FF233C" size="18"></u-icon>
|
|
|
|
|
+ </view>
|
|
|
<!-- <view class="share-box" v-if="userinfo.isShow==1&&isuser==false">
|
|
<!-- <view class="share-box" v-if="userinfo.isShow==1&&isuser==false">
|
|
|
<text class="text">分享</text>
|
|
<text class="text">分享</text>
|
|
|
<image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/share1.png" mode="">
|
|
<image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/share1.png" mode="">
|
|
@@ -294,30 +298,43 @@ import CustomToast from '@/components/custom-toast.vue';
|
|
|
this.isuser = true
|
|
this.isuser = true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- //发送给朋友
|
|
|
|
|
- onShareAppMessage(res) {
|
|
|
|
|
- if (this.$isLogin()) {
|
|
|
|
|
- var user = JSON.parse(uni.getStorageSync('userInfo'))
|
|
|
|
|
- return {
|
|
|
|
|
- title: this.product.productName,
|
|
|
|
|
- path: '/pages/shopping/productDetails?productId=' + this.product.productId + "&userId=" + user.userId,
|
|
|
|
|
- imageUrl: '/static/logo.jpg' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- //分享到朋友圈
|
|
|
|
|
- onShareTimeline(res) {
|
|
|
|
|
- if (this.$isLogin()) {
|
|
|
|
|
- var user = JSON.parse(uni.getStorageSync('userInfo'))
|
|
|
|
|
- return {
|
|
|
|
|
- title: this.product.productName,
|
|
|
|
|
- query: 'productId=' + this.product.productId + "&userId=" + user.userId, //页面参数
|
|
|
|
|
- imageUrl: '/static/logo.jpg' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ handleOpenShare() {
|
|
|
|
|
+ //#ifdef H5
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请使用APP操作',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ //#endif
|
|
|
|
|
+
|
|
|
|
|
+ //#ifdef APP-PLUS
|
|
|
|
|
+ uni.share({
|
|
|
|
|
+ provider: "weixin",
|
|
|
|
|
+ scene: 'WXSceneSession',
|
|
|
|
|
+ type: 5,
|
|
|
|
|
+ imageUrl: 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/app/vip/share.png', //分享封面图片
|
|
|
|
|
+ title: this.product.productName, // 分享标题
|
|
|
|
|
+ miniProgram: {
|
|
|
|
|
+ id: getApp().globalData.miniprogamId,
|
|
|
|
|
+ path: '/pages/shopping/productDetails?productId=' + this.product.productId + "&userId=" + this.userinfo.userId,
|
|
|
|
|
+ type: 0, //0-正式版; 1-测试版; 2-体验版。 默认值为0。
|
|
|
|
|
+ webUrl: "http://uniapp.dcloud.io"
|
|
|
|
|
+ },
|
|
|
|
|
+ success: function(res) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: "分享成功",
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function(err) {
|
|
|
|
|
+ // 此处是调起微信分享失败的回调
|
|
|
|
|
+ },
|
|
|
|
|
+ complete: (e) => {
|
|
|
|
|
+ console.log("WXSceneSession", e)
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ //#endif
|
|
|
|
|
+ },
|
|
|
getuser() {
|
|
getuser() {
|
|
|
getUserInfo().then(
|
|
getUserInfo().then(
|
|
|
res => {
|
|
res => {
|