Commit 8910fb0607f9dd8deadca81cd21241b0aa82b4ce

Authored by yvan.ni
1 parent c590feba

直播间分享的bug的优化

packageA/pages/liveStream/liveStream.js
... ... @@ -47,7 +47,8 @@ Page({
47 47 gid: '',
48 48 shareImgPath: '',
49 49 shartitle: "",
50   - anchorname:""
  50 + anchorname:"",
  51 + share_id:0 //分享的ID
51 52 },
52 53 // list: [],
53 54 // live: {
... ... @@ -338,18 +339,22 @@ Page({
338 339  
339 340 // 分享操作表
340 341 clickShare: function (e) {
341   - var sharimg = e.currentTarget.dataset.sharimg
342   - var shartitle = e.currentTarget.dataset.shartitle
343   - var anchorname= e.currentTarget.dataset.anchorname
344   - if (!getApp().globalData.user_id) {
345   - getApp().goto("/packageE/pages/togoin/togoin");
346   - return false;
347   - }
  342 + var sharimg = e.currentTarget.dataset.sharimg;
  343 + var shartitle = e.currentTarget.dataset.shartitle;
  344 + var anchorname= e.currentTarget.dataset.anchorname;
  345 + var id= e.currentTarget.dataset.id;
  346 +
  347 + // if (!getApp().globalData.user_id) {
  348 + // getApp().goto("/packageE/pages/togoin/togoin");
  349 + // return false;
  350 + // }
  351 +
348 352 this.setData({
349 353 showActionSheet: !this.data.showActionSheet,
350 354 sharimg: sharimg,
351 355 shartitle: shartitle,
352   - anchorname:anchorname
  356 + anchorname:anchorname,
  357 + share_id:id,
353 358 })
354 359 },
355 360  
... ... @@ -429,9 +434,10 @@ Page({
429 434  
430 435  
431 436  
432   - var path2 = getApp().globalData.userInfo.head_pic;
  437 + var path2 = getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:'';
433 438 if (path2 == "") {
434 439 path2 = "../../../images/share/hui_hear_pic.png";
  440 + this.data.avatarUrl=path2;
435 441 } else {
436 442 getApp().request.promiseGet("/api/weshop/marketing/help/help/imgbase64/get", {
437 443 data: {
... ... @@ -463,11 +469,13 @@ Page({
463 469  
464 470  
465 471 // 请求二维码
  472 + // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  473 + // os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo";
  474 +
466 475 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
467   - os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo";
  476 + os.stoid + "?sceneValue="+this.data.share_id + "&pageValue=packageA/pages/liveStreamDetails/liveStreamDetails";
468 477  
469 478 if (!this.data.ewm) {
470   -
471 479 await that.getImageInfo(path3).then(res => {
472 480 that.setData({
473 481 ewm: res.path
... ... @@ -484,9 +492,6 @@ Page({
484 492  
485 493 // console.log('----------------v', headImg);
486 494  
487   - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
488   - os.stoid + "?sceneValue=1012" + "&pageValue=packageA/pages/liveStreamDetails/liveStreamDetails";
489   -
490 495 // 以iPhone6为例,375/750 = 0.5
491 496 // let scale = this.data.windowWidth / 375;
492 497 let scale = this.data.screenWidth / 750 * 1.35
... ... @@ -523,10 +528,13 @@ Page({
523 528 ctx.drawImage(this.data.avatarUrl, 30, 24, 56, 56);
524 529 ctx.restore();
525 530  
526   - // 绘制昵称
527   - ctx.setFontSize(22);
528   - ctx.setFillStyle('#ADADAD');
529   - ctx.fillText(app.globalData.userInfo.nickname, 106, 60);
  531 +
  532 + if(app.globalData.userInfo) {
  533 + // 绘制昵称
  534 + ctx.setFontSize(22);
  535 + ctx.setFillStyle('#ADADAD');
  536 + ctx.fillText(app.globalData.userInfo.nickname, 106, 60);
  537 + }
530 538  
531 539 // 绘制主图
532 540 ctx.setFillStyle('#f8f8f8');
... ...
packageA/pages/liveStream/liveStream.wxml
... ... @@ -85,7 +85,7 @@
85 85 {{item['anchor_name']}}</view>
86 86 </view>
87 87 <view wx:if="{{isLogin}}" style="width: 30%;height: 90rpx;align-items: center;justify-items: center;">
88   - <view bindtap="clickShare" data-sharimg="{{item.share_img}}" data-shartitle="{{item.name}}" data-anchorname="{{item['anchor_name']}}" class="display: flex;" style="width: 70%;border-radius: 25rpx;border: 1rpx solid #fc6247;height: 46rpx;margin-top: 25rpx;margin-left: 30rpx;">
  88 + <view bindtap="clickShare" data-sharimg="{{item.share_img}}" data-id="{{item.id}}" data-shartitle="{{item.name}}" data-anchorname="{{item['anchor_name']}}" class="display: flex;" style="width: 70%;border-radius: 25rpx;border: 1rpx solid #fc6247;height: 46rpx;margin-top: 25rpx;margin-left: 30rpx;">
89 89 <view class="share-image"></view>
90 90 <view class="fs26" style="color: #fc6247;margin-left: 10rpx;line-height: 46rpx;"> 分享 </view>
91 91 </view>
... ...
packageA/pages/liveStreamDetails/liveStreamDetails.js
... ... @@ -518,7 +518,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un
518 518 var storageId=options.storageId;
519 519  
520 520 if(!options.id){
521   - var id = decodeURIComponent(t.scene);
  521 + var id = decodeURIComponent(options.scene);
522 522 if(id){
523 523 options.id=id;
524 524 }
... ...