cshenfu
2023-05-17 909113b3c4ae113b60793f7f5ba22af0bd3165cc
add shar
1个文件已修改
62 ■■■■■ 已修改文件
pages/index/home.vue 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/home.vue
@@ -14,10 +14,12 @@
            <button @click="toChat" style="width: calc(100vw - 60rpx); height: 100rpx;" class="cu-btn text-bold chat-button">
                开始咨询 (余{{num}}次) </button>
        </view>
        <view class="tool padding-top-xl">
            <view class="header">
                <view class="title text-bold">功能特性</view>
            </view>
            <!-- <text>{{ user_data }}</text> -->
            <u-transition :show="true" mode="slide-up">
                <view class="grid">
                    <view class="item">
@@ -97,7 +99,8 @@
            return {
                showTab: false,
                tabIndex: 0,
                setting_data:'null'
                setting_data:'null',
                user_data:'null'
            }
        },
        computed: {
@@ -112,6 +115,63 @@
            this.setting_data = setting
            
            
        },
        created() {
            var url_local = location.href.split("#")[0]
            this.$request("/api/Member/wxH5ShareId",'POST',{
                url:url_local
            }).then((res) => {
                this.user_data = res.data
                    wx.config({
                      debug: false, // 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
                      appId: this.user_data.appId, // 必填,公众号的唯一标识
                      timestamp: this.user_data.timestamp, // 必填,生成签名的时间戳
                      nonceStr: this.user_data.nonceStr, // 必填,生成签名的随机串
                      signature: this.user_data.signature, // 必填,签名
                      jsApiList: [
                        'updateAppMessageShareData',
                        'updateTimelineShareData',
                        'onMenuShareTimeline',
                        'onMenuShareAppMessage',
                        'onMenuShareQQ',
                        'onMenuShareQZone'
                      ] // 必填,需要使用的JS接口列表
                    })
                    wx.ready(function () {
                      //分享到好友
                      wx.updateAppMessageShareData({
                        title: "ChatFox", // 分享标题
                        desc: "ChatFox", // 分享描述
                        link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
                        imgUrl: "@/static/h5/download-app/ios.png", // 分享图标
                        success: function () {
                          // 设置成功
                          console.log('成功')
                        },
                        cancel: function () {
                          // 用户取消分享后执行的回调函数
                          console.log('取消')
                        },
                        fail: function () {
                          // 用户分享失败后执行的回调函数
                          console.log('失败')
                        }
                      })
                      //分享到朋友圈
                      wx.updateTimelineShareData({
                       title: "ChatFox", // 分享标题
                       link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
                       imgUrl: "@/static/h5/download-app/ios.png", // 分享图标
                        success: function () {
                          // 设置成功
                        }
                      })
                    })
            });
        },
        onShareAppMessage() {
            console.log('转发+1')