Authored by huangyi

修正用户标签为空

修正客服点击复制url不刷新
@@ -21,6 +21,7 @@ const redbagPage = async(req, res, next) => { @@ -21,6 +21,7 @@ const redbagPage = async(req, res, next) => {
21 userInfo.data.rewardType = false; 21 userInfo.data.rewardType = false;
22 } 22 }
23 } 23 }
  24 +
24 return res.render('red-envelope/redbag-cs', { 25 return res.render('red-envelope/redbag-cs', {
25 pageHeader: headerModel.setNav({ 26 pageHeader: headerModel.setNav({
26 navTitle: '添加潮流顾问' 27 navTitle: '添加潮流顾问'
@@ -24,15 +24,20 @@ @@ -24,15 +24,20 @@
24 </div> 24 </div>
25 {{/if}} 25 {{/if}}
26 <div class="wx-account-info"> 26 <div class="wx-account-info">
27 - <div id="hasCode" style="display:{{#if userInfo.submitWechat}}block;{{else}}none;{{/if}}">已提交微信号:<span id="wxCode">{{userInfo.userWechatCode}}</span></div> 27 + <div id="hasCode" style="display:{{#if userInfo.submitWechat}}block;{{else}}none;{{/if}}">
  28 + 已提交微信号:<span id="wxCode">{{userInfo.userWechatCode}}</span></div>
28 <div id="noCode" style="display:{{#if userInfo.submitWechat}}none;{{else}}block;{{/if}}">未提交微信</div> 29 <div id="noCode" style="display:{{#if userInfo.submitWechat}}none;{{else}}block;{{/if}}">未提交微信</div>
29 </div> 30 </div>
30 </div> 31 </div>
31 <div class="user-label"> 32 <div class="user-label">
32 <div class="title">用户标签</div> 33 <div class="title">用户标签</div>
33 <div> 34 <div>
34 - <span class="label">{{userInfo.tag_address}}</span>  
35 - <span class="label">{{userInfo.tag_createTime}}</span> 35 + {{#if userInfo.tag_address}}
  36 + <span class="label">{{userInfo.tag_address}}</span>
  37 + {{/if}}
  38 + {{#if userInfo.tag_createTime}}
  39 + <span class="label">{{userInfo.tag_createTime}}</span>
  40 + {{/if}}
36 </div> 41 </div>
37 </div> 42 </div>
38 <div class="relation-list"> 43 <div class="relation-list">
@@ -18,6 +18,19 @@ let channels = { @@ -18,6 +18,19 @@ let channels = {
18 lifestyle: 4 18 lifestyle: 4
19 }; 19 };
20 20
  21 +exports.getShareCode = async(req, res, next) =>{
  22 + try {
  23 + let shareCode = await req.ctx(newHomeModel).getShareCode(req.user.uid);
  24 +
  25 + let shareUrl = '/activity/red-envelope/index?shareCode=' + shareCode.data;
  26 +
  27 + return res.json({result: true, code: 200, data: shareUrl});
  28 + } catch (e) {
  29 + return next(e);
  30 + }
  31 +
  32 +};
  33 +
21 exports.index = async(req, res, next) => { 34 exports.index = async(req, res, next) => {
22 let responseData = { 35 let responseData = {
23 isLogin: req.user.uid ? true : false, 36 isLogin: req.user.uid ? true : false,
@@ -188,7 +188,7 @@ router.get('/return/exchange/refreshDelivery', auth, exchange.refreshDelivery); @@ -188,7 +188,7 @@ router.get('/return/exchange/refreshDelivery', auth, exchange.refreshDelivery);
188 router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令 188 router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令
189 189
190 router.get('/', newHome.index); // 新个人中心首页 190 router.get('/', newHome.index); // 新个人中心首页
191 - 191 +router.get('/getCodeUrl', auth, newHome.getShareCode);
192 192
193 router.get('/family', auth, disableBFCache, family.familyIndex); // family首页 193 router.get('/family', auth, disableBFCache, family.familyIndex); // family首页
194 router.get('/family/vipDetailData', auth, family.familyVip); // 获取VIP信息 194 router.get('/family/vipDetailData', auth, family.familyVip); // 获取VIP信息
@@ -38,19 +38,27 @@ class NewHome extends Page { @@ -38,19 +38,27 @@ class NewHome extends Page {
38 } 38 }
39 39
40 copyShareUrl() { 40 copyShareUrl() {
41 - this.selector.$wxcs.click(function() { 41 + this.selector.$wxcs.click(()=> {
42 let clipboard = new Clipboard('#wxcs', { 42 let clipboard = new Clipboard('#wxcs', {
43 - text: ()=> {  
44 - return location.origin + $(this).attr('data-url'); 43 + text: () => {
  44 + return location.origin + this.selector.$wxcs.attr('data-url');
45 } 45 }
46 }); 46 });
47 47
48 - clipboard.on('success', function(e) { 48 + clipboard.on('success', (e) => {
49 e.clearSelection(); 49 e.clearSelection();
50 tip.show('复制分享地址成功'); 50 tip.show('复制分享地址成功');
  51 + $.ajax({
  52 + method: 'get',
  53 + url: '/home/getCodeUrl',
  54 + success: (data) => {
  55 + console.log(data);
  56 + this.selector.$wxcs.attr('data-url', data.data);
  57 + }
  58 + });
51 }); 59 });
52 60
53 - clipboard.on('error', function() { 61 + clipboard.on('error', () => {
54 tip.show('复制失败'); 62 tip.show('复制失败');
55 }); 63 });
56 64