StephenArk30 пре 6 година
родитељ
комит
aa5b8894c1

+ 1 - 1
sourcecode/h5app/vue/src/connector/basic-service.js

@@ -127,7 +127,7 @@ var BasicFunction = new (function () {
     };
 
     this.get_data = function (url, callback, data, onescope) {
-        console.log('calling get_data()');
+        // console.log('calling get_data()');
         let jsonData = data;
         if(typeof data !== "string"){
             if(data.toString().indexOf("FormData") !== -1){

+ 4 - 0
sourcecode/h5app/vue/src/views/PresentRegister.vue

@@ -185,6 +185,10 @@
                     BasicFunction.get_data("fileserver/upload?sign=abcdefg", function (res) {
                         // console.log('----- upload photo result -----');
                         // console.log(res);
+                        if (res.model.length === 0) {
+                            Toast.fail('上传失败,请重试');
+                            return;
+                        }
                         if (res.ret === '10000') {
                             imgURL = res.model;
                             // console.log('img:' + imgURL);

+ 4 - 0
sourcecode/h5app/vue/src/views/SecurityVerify.vue

@@ -166,6 +166,10 @@
                 BasicFunction.get_data("fileserver/upload?sign=abcdefg", function (res) {
                     // console.log('----- upload photo result -----');
                     // console.log(res);
+                    if (res.model.length === 0) {
+                        Toast.fail('上传失败,请重试');
+                        return;
+                    }
                     if (res.ret === '10000') {
                         let imgURL = res.model; // TODO: 把imgurl也加入用户信息
                         let userId = localStorage.getItem('frontend-userid');

+ 57 - 59
sourcecode/h5app/vue/src/views/share.vue

@@ -29,34 +29,33 @@
 </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() {
             return {
                 note: {
@@ -106,53 +105,53 @@
             if (isWeiXin()) this.isWX = true;
             // console.log(this.isWX);
 
-            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 isWeiXin() {
         let ua = window.navigator.userAgent.toLowerCase();
-        return ua.match(/MicroMessenger/i) == 'micromessenger';
+        return ua.match(/MicroMessenger/i) == 'micromessenger'; // 必须两个等号
     }
 </script>
 
@@ -170,7 +169,6 @@
     }
 
     .van-row {
-
         font-size: 1em;
         color: white;
     }