StephenArk30 6 år sedan
förälder
incheckning
8adfb8fbff

+ 11 - 2
sourcecode/h5app/vue/src/components/navBar.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <van-nav-bar
-                title="礼品卡"
+                :title="title"
                 style="background-color: #fff6e3"
                 :border="false">
             style="max-width: 30px;"
@@ -20,7 +20,16 @@
             [NavBar.name]: NavBar,
             [Icon.name]: Icon
         },
-        props: ['path'],
+        props: {
+            path: {
+                type: String,
+                default: 'index'
+            },
+            title: {
+                type: String,
+                default: "深大换换礼物交换"
+            }
+        },
         methods: {
             onClickLeft: function () {
                 this.$router.push(this.path);

+ 1 - 1
sourcecode/h5app/vue/src/views/PresentRegister.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <nav-bar path="index"/>
+        <nav-bar path="index" title="上传礼物"/>
         <div class='card'>
             <h3><strong>礼物匹配</strong></h3>
             <p>希望对方的性别是</p>

+ 1 - 1
sourcecode/h5app/vue/src/views/SecurityVerify.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <nav-bar path="index"/>
+        <nav-bar path="index" title="身份验证"/>
         <div class='card'>
             <h3><strong>个人资料</strong></h3>
             <van-cell-group :border="false">

+ 1 - 1
sourcecode/h5app/vue/src/views/giftDetail.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <nav-bar path="index"/>
+        <nav-bar path="index" title="礼品卡"/>
         <gift-card
                 v-if="myPresent.status === 2 || myPresent.status === 3"
                 :present-img="recievedPresent.imgUrl"

+ 65 - 68
sourcecode/h5app/vue/src/views/share.vue

@@ -12,7 +12,7 @@
                 <img :src="share[i]" style="max-width: 80%; position: relative;"/>
             </div>
             <a :href="share[i]" download="post">
-                <van-button size="large" type="primary">保存</van-button>
+                <van-button size="large" type="primary" @click="savePic">保存</van-button>
             </a>
             <van-button size="large" type="primary" @click="Toindex">返回首页</van-button>
         </div>
@@ -21,32 +21,32 @@
 </template>
 
 <script>
-    //  import wx from 'weixin-js-sdk';
+    import wx from 'weixin-js-sdk';
     import {
         Row, Col,
         Button, Toast
     } from 'vant';
     import 'whatwg-fetch';
-    // import { BasicFunction } from '../connector/basic-service';
+    import {BasicFunction} from '../connector/basic-service';
 
     export default {
         name: "share",
         components: {
             [Button.name]: Button,
             [Row.name]: Row, [Col.name]: Col,
-            // 'wx': {
-            //     render(createElement) {
-            //         return createElement(
-            //             'script',
-            //             {
-            //                 attrs: {
-            //                     type: 'text/javascript',
-            //                     src: 'http://res2.wx.qq.com/open/js/jweixin-1.4.0.js',
-            //                 },
-            //             },
-            //         );
-            //     },
-            // },
+            'wx': {
+                render(createElement) {
+                    return createElement(
+                        'script',
+                        {
+                            attrs: {
+                                type: 'text/javascript',
+                                src: 'http://res2.wx.qq.com/open/js/jweixin-1.4.0.js',
+                            },
+                        },
+                    );
+                },
+            },
         },
         mounted: {},
         data() {
@@ -71,6 +71,9 @@
             Toindex() {
                 this.$router.push('index');
             },
+            savePic() {
+                if (isWeiXin()) alert('请长按图片,保存至手机');
+            }
             // Toshare() {
             //     alert("请点击右上角,即可分享");
             //     Toast({
@@ -86,61 +89,55 @@
             this.i = Math.ceil(Math.random() * 4) - 1;
             console.log(this.i);
 
-//             BasicFunction.getSigned(['onMenuShareTimeline', 'onMenuShareAppMessage',], function () {
-//                 wx.ready(function () {      //需在用户可能点击分享按钮前就先调用
-//                     wx.onMenuShareTimeline({
-//                         title: '用一份礼物,邂逅一段故事', // 分享标题
-//                         link: 'https://gift.fogice.com/?res=timeline', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
-//                         imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
-//                         success: function () {
-//                             // 设置成功
-//                             Toast({
-//                                 message: "成功分享到朋友圈"
-//                             });
-//                             this.$router.push('index');
-//                         },
-//                         cancel: function () {
-//                             Toast({
-//                                 message: "分享失败,您取消了分享!"
-//                             });
-//
-//                         }
-//                     });
-//                     wx.onMenuShareAppMessage({
-//                         title: '用一份礼物,邂逅一段故事', // 分享标题
-//                         desc: '嘿~我送出了一份圣诞礼物  要和我来交换吗', // 分享描述
-//                         link: 'https://gift.fogice.com/?res=appmessage', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
-//                         imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
-//                         type: '', // 分享类型,music、video或link,不填默认为link
-//                         dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
-//                         success: function () {
-// // 用户点击了分享后执行的回调函数
-//                             Toast({
-//                                 message: "成功分享给朋友"
-//                             });
-//                             this.$router.push('index');
-//                         },
-//                         cancel: function () {
-//                             Toast({
-//                                 message: "分享失败,您取消了分享!"
-//                             });
-//
-//                         }
-//                     })
-//                 });
-//             },{});
+            BasicFunction.getSigned(['onMenuShareTimeline', 'onMenuShareAppMessage',], function () {
+                wx.ready(function () {      //需在用户可能点击分享按钮前就先调用
+                    wx.onMenuShareTimeline({
+                        title: '用一份礼物,邂逅一段故事', // 分享标题
+                        link: 'https://gift.fogice.com/?res=timeline', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+                        imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
+                        success: function () {
+                            // 设置成功
+                            Toast({
+                                message: "成功分享到朋友圈"
+                            });
+                            this.$router.push('index');
+                        },
+                        cancel: function () {
+                            Toast({
+                                message: "分享失败,您取消了分享!"
+                            });
+
+                        }
+                    });
+                    wx.onMenuShareAppMessage({
+                        title: '用一份礼物,邂逅一段故事', // 分享标题
+                        desc: '嘿~我送出了一份圣诞礼物  要和我来交换吗', // 分享描述
+                        link: 'https://gift.fogice.com/?res=appmessage', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+                        imgUrl: 'http://gift.fogice.com/attachment/upload/2018-12-13_22-45-35_dbad3cb10afe017f8ef5158f96c9a7c6c622aa04db557384883f97fe38cae380.png', // 分享图标
+                        type: '', // 分享类型,music、video或link,不填默认为link
+                        dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+                        success: function () {
+// 用户点击了分享后执行的回调函数
+                            Toast({
+                                message: "成功分享给朋友"
+                            });
+                            this.$router.push('index');
+                        },
+                        cancel: function () {
+                            Toast({
+                                message: "分享失败,您取消了分享!"
+                            });
+
+                        }
+                    })
+                });
+            }, {});
         }
     }
 
-    function down(selector, name) {
-        // 生成一个a元素
-        let a = document.createElement('a');
-        // 将a的download属性设置为我们想要下载的图片名称
-        a.download = name || 'pic';
-        // 将生成的URL设置为a.href属性
-        a.href = './boy.png';
-        // 触发a的单击事件
-        a.click();
+    function isWeiXin() {
+        let ua = window.navigator.userAgent.toLowerCase();
+        return ua.match(/MicroMessenger/i) === 'micromessenger';
     }
 </script>