Authored by 肖亚东

进详情页需要先登录(主要是分享时打开)

@@ -162,6 +162,12 @@ Page(Object.assign({ @@ -162,6 +162,12 @@ Page(Object.assign({
162 appParameter 162 appParameter
163 }); 163 });
164 164
  165 + let userInfo = app.getUserInfo();
  166 + if (!userInfo.wechat || !this.getUserWechatId()) {
  167 + this.goLogin({'login': '0', 'type': 'redirectTo'});
  168 + return;
  169 + }
  170 +
165 yas = new Yas(app); // 实例化埋点 171 yas = new Yas(app); // 实例化埋点
166 172
167 this.initActionSheet(); 173 this.initActionSheet();
@@ -546,7 +552,7 @@ Page(Object.assign({ @@ -546,7 +552,7 @@ Page(Object.assign({
546 let userInfo = app.getUserInfo(); 552 let userInfo = app.getUserInfo();
547 553
548 if (!userInfo.wechat || !this.getUserWechatId()) { 554 if (!userInfo.wechat || !this.getUserWechatId()) {
549 - this.goLogin(0); 555 + this.goLogin({'login': '0'});
550 return; 556 return;
551 } 557 }
552 558
@@ -609,7 +615,7 @@ Page(Object.assign({ @@ -609,7 +615,7 @@ Page(Object.assign({
609 let userInfo = app.getUserInfo(); 615 let userInfo = app.getUserInfo();
610 616
611 if (!userInfo.wechat || !this.getUserWechatId()) { 617 if (!userInfo.wechat || !this.getUserWechatId()) {
612 - this.goLogin(0); 618 + this.goLogin({'login': '0'});
613 return; 619 return;
614 } 620 }
615 621
@@ -771,7 +777,9 @@ Page(Object.assign({ @@ -771,7 +777,9 @@ Page(Object.assign({
771 }) 777 })
772 }, 778 },
773 779
774 - goLogin(login = 1) { 780 + goLogin(params) {
  781 + let login = parseInt(params['login']) || 1;
  782 + let type = params['type'] || 'navigateTo';
775 let data = {}; 783 let data = {};
776 784
777 if (this.data.originUid) { 785 if (this.data.originUid) {
@@ -788,7 +796,8 @@ Page(Object.assign({ @@ -788,7 +796,8 @@ Page(Object.assign({
788 router.go('userCenter', { 796 router.go('userCenter', {
789 referer: `/pages/product/detail/detail?${decodeURIComponent(stringify(data))}`, 797 referer: `/pages/product/detail/detail?${decodeURIComponent(stringify(data))}`,
790 login 798 login
791 - }); 799 + },
  800 + type);
792 }, 801 },
793 onPullDownRefresh: function() { 802 onPullDownRefresh: function() {
794 this.setData({ 803 this.setData({