stanley-king 7 лет назад
Родитель
Сommit
9216f11212

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/index.html


Разница между файлами не показана из-за своего большого размера
+ 0 - 2
dist/mshop/js/app.7899dda966447046048a.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
dist/mshop/js/app.7899dda966447046048a.js.map


Разница между файлами не показана из-за своего большого размера
+ 0 - 2
dist/mshop/js/manifest.4b6d9f2c0b45fa2c10c8.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
dist/mshop/js/manifest.4b6d9f2c0b45fa2c10c8.js.map


Разница между файлами не показана из-за своего большого размера
+ 0 - 34
dist/mshop/js/vendor.749e82cd5931cb1d4604.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
dist/mshop/js/vendor.749e82cd5931cb1d4604.js.map


+ 0 - 21
src/components/blocks/block_list.vue

@@ -2,7 +2,6 @@
     import Proxy from './util/proxy.js'
     import BlockUtil from './util/blockUtil.js'
     import {LoadMore} from 'vux'
-//    import WechatShare from '../../wechat/WechatShare'
     export default {
         props: ['datasLink', "hot_id", "brand_id", "keyword", "special_id"],
         watch: {
@@ -44,26 +43,6 @@
         },
         created(){
             this.getDatas();
-//            let isSpecial = this.$route.query.is_special;
-//            let title = this.$route.query.title;
-//            let shareMsg;
-//            if (isSpecial) {
-//                shareMsg = {
-//                    title: title,
-//                    desc: '丽人丽妆 内买商城',
-//                    link: 'http://p.lrlz.com/mobile/index.php?act=mshop&op=special&special_id=' + this.special_id + "&title=" + encodeURIComponent(title),
-//                    img_url: 'http://p.lrlz.com/data/resource/mobile/defimg/panda.jpeg'
-//                };
-//            } else {
-//                shareMsg = {
-//                    title: '熊猫美妆商城',
-//                    desc: '丽人丽妆 内买商城',
-//                    link: "http://" + window.location.host + '/mobile/index.php?act=mshop&op=index',
-//                    img_url: 'http://p.lrlz.com/data/resource/mobile/defimg/panda.jpeg'
-//                };
-//
-//            }
-//            let WxShare = new WechatShare(shareMsg);
         },
         beforeDestroy: function () {
             window.removeEventListener('scroll', this.loadMoreCallback);

+ 4 - 2
src/components/goods/goods_detail.vue

@@ -141,13 +141,15 @@
                 this.datas = res.body['datas'];
                 this.summary = res.body['datas'].summary;
                 this.$store.commit('updateLoadingStatus', {isLoading: false});
+                let host = window.location.protocol + '//' + window.location.host;
+
                 let shareMsg = {
                     title:'熊猫美妆为您推荐'+this.getOneSummary['goods_mobile_name'],
                     desc: '丽人丽妆 内买商城',
-                    link: "http://" + window.location.host + '/mobile/index.php?act=mshop&op=goods&goods_id='+goods_id,
+                    link: host + '/mobile/index.php?act=mshop&op=goods&goods_id='+goods_id,
                     img_url: this.getOneSummary['goods_image_url']
                 };
-                let WxShare = new WechatShare(shareMsg,Api.sign_url(location.href))
+                let WxShare = Api.create_share(shareMsg,Api.sign_url(location.href))
             },(err) => {
                 this.$vux.toast.show({
                 type: 'text',

+ 1 - 1
src/components/main/main.vue

@@ -40,7 +40,7 @@
                 link: "http://" + window.location.host + '/mobile/index.php?act=mshop&op=index',
                 img_url: 'http://p.lrlz.com/data/resource/mobile/defimg/panda.jpeg'
             };
-            let WxShare = new WechatShare(shareMsg,Api.sign_url(window.location.href));
+            let WxShare = Api.create_share(shareMsg,Api.sign_url(window.location.href));
         },
         data () {
             return {

+ 2 - 8
src/components/main/mine/mine.vue

@@ -79,14 +79,8 @@
     import DefaultImg from '../../../assets/mine_logo_icon.png'
     import WechatShare from '../../../wechat/WechatShare'
     export default {
-        created(){
-//            let shareMsg = {
-//                title: '熊猫美妆商城',
-//                desc: '丽人丽妆 内买商城',
-//                link: "http://" + window.location.host + '/mobile/index.php?act=mshop&op=index',
-//                img_url: 'http://p.lrlz.com/data/resource/mobile/defimg/panda.jpeg'
-//            };
-//            let WxShare = new WechatShare(shareMsg);
+        created()
+        {
             if (this.$store.state.isLogIn) {
                 this.userName = this.$store.state.user['name'];
                 this.userImg = this.$store.state.user['image'];

+ 0 - 7
src/components/main/shop-car/shopping_cart.vue

@@ -90,13 +90,6 @@
     export default {
         created(){
             this.getDatas();
-//            let shareMsg = {
-//                title:'熊猫美妆商城',
-//                desc: '丽人丽妆 内买商城',
-//                link: "http://" + window.location.host + '/mobile/index.php?act=mshop&op=index',
-//                img_url:'http://p.lrlz.com/data/resource/mobile/defimg/panda.jpeg'
-//            };
-//            let WxShare = new WechatShare(shareMsg);
         },
         data(){
             return {

+ 8 - 6
src/components/special/special_list.vue

@@ -11,23 +11,25 @@
             let isSpecial = this.$route.query.is_special;
             let title = this.$route.query.title;
             let shareMsg;
-            if (isSpecial) {
+            if (isSpecial)
+            {
+                let host = window.location.protocol + '//' + window.location.host;
                 shareMsg = {
                     title: title,
                     desc: '丽人丽妆 内买商城',
-                    link: 'http://p.lrlz.com/mobile/index.php?act=mshop&op=special&special_id=' + this.special_id + "&title=" + encodeURIComponent(title),
-                    img_url: 'http://p.lrlz.com/data/resource/mobile/defimg/panda.jpeg'
+                    link: host + '/mobile/index.php?act=mshop&op=special&special_id=' + this.special_id + "&title=" + encodeURIComponent(title),
+                    img_url: host + '/data/resource/mobile/defimg/panda.jpeg'
                 };
             } else {
                 shareMsg = {
                     title: '熊猫美妆商城',
                     desc: '丽人丽妆 内买商城',
-                    link: "http://" + window.location.host + '/mobile/index.php?act=mshop&op=index',
-                    img_url: 'http://p.lrlz.com/data/resource/mobile/defimg/panda.jpeg'
+                    link: host + '/mobile/index.php?act=mshop&op=index',
+                    img_url: host + '/data/resource/mobile/defimg/panda.jpeg'
                 };
 
             }
-            let WxShare = new WechatShare(shareMsg,Api.sign_url(window.location.href));
+            let WxShare = Api.create_share(shareMsg,Api.sign_url(window.location.href));
         },
         data(){
             return {

+ 20 - 1
src/lib/api.js

@@ -1,6 +1,8 @@
-let envHost = process.env.API_ROOT;
+import WechatShare from '../wechat/WechatShare.js';
 
+let envHost = process.env.API_ROOT;
 let enter_url = "";
+let gWxShare = null;
 
 let mobile = {
     Android: function() {
@@ -151,6 +153,22 @@ class Api
     {
         enter_url = href;
     }
+    static create_share(data,href)
+    {
+        if(mobile.iOS())
+        {
+            if(gWxShare == null) {
+                gWxShare = new WechatShare(data,href);
+            } else {
+                gWxShare.register(data);
+            }
+            return gWxShare;
+        }
+        else
+        {
+            return new WechatShare(data,href);
+        }
+    }
 
     static sign_url(href)
     {
@@ -160,6 +178,7 @@ class Api
             return href;
         }
     }
+
 }
 
 export default Api

+ 2 - 6
src/wechat/WechatShare.js

@@ -9,7 +9,6 @@ class WechatShare
 {
     constructor(data,surl)
     {
-        //let sign_url = encodeURIComponent(window.location.href.split('#')[0]);
         let sign_url = encodeURIComponent(surl.split('#')[0]);
         let host = window.location.protocol + '//' + window.location.host;
         let url = host + "/mobile/index.php?act=mshop&op=signurl&client_type=ajax&sign_url="+sign_url+"&callback=";
@@ -46,7 +45,7 @@ class WechatShare
                     'chooseWXPay'
                 ]
             });
-            pThis.ready(data);
+            pThis.register(data);
         });
     }
 
@@ -82,7 +81,7 @@ class WechatShare
         }, 0);
     }
 
-    ready(data)
+    register(data)
     {
         Vue.wechat.ready(function ()
         {
@@ -97,10 +96,8 @@ class WechatShare
                 success: function (res) {
                 },
                 cancel: function (res) {
-                    //alert('已取消'+res);
                 },
                 fail: function (res) {
-                    //alert(JSON.stringify(res));
                 }
             });
 
@@ -111,7 +108,6 @@ class WechatShare
                 link: data.link,    //cookie读取
                 imgUrl: data.img_url,// 分享图标
                 trigger: function (res) {
-                    // 不要尝试在trigger中使用ajax异步请求修改本次分享的内容,因为客户端分享操作是一个同步操作,这时候使用ajax的回包会还没有返回
                 },
                 success: function (res) {
                 }