Commit 2981c5e4 by 李嘉林

微信分享

parent b3200e6d
......@@ -28,6 +28,8 @@
v-if="list"
@changeStatus="changeStatus"
></livedGoodsDia>
<!-- 分享弹层 -->
<livedShareDia :showShareDia="showShareDia" @closeShareDia="closeShareDia" :info="info"></livedShareDia>
<!-- 底部控制层 -->
<div class="control flex">
<template v-if="!isSend">
......@@ -36,7 +38,7 @@
<p class="goodsNum" v-if="list.length>0">{{list.length}}</p>
</div>
<div class="iptCopy" @click="isLogin">跟主播说点什么...</div>
<div class="shareIcon">
<div class="shareIcon" @click="showShare">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADwElEQVR4Xu2aS6hNURjH//+RgYGRKAMDr1tmFJGBSxmIjGTgKq/rUURi5qKQkhKlLt1IHkl05VUG7r3lkW4MPMIVRXkNFMqAqL++2len45y99mPtc/bu7FWnc2qv9X3f/7fX41trHaLFC1tcP0oAZQ9ocQLlEGjxDlBOguUQKIdAixPI1RCQ1EbyZSPfSW4ASHoGYCqABwC2kBxsBIhcAJB0CsDKCsGfAKwleTNrCHkB0A9gbpXY3wDWkDyTJYQ8AxjWvY3k4awgFAGAad9PcmcWEIoCwLQfJ7nBN4QiATDtl22yJPnDF4iiATDdAwGEdz4gFBGA6bacwXrCo7QQmg5A0iQAJ2osgy5tliusInnLVTHsecMBSBoHYAaAmcG3/R6ZUITlCgbhXML2jTsPkDQdwLrgkzTeeu22kjySxGjmPSBj4ZWa95HsigshMwCSxgDYHnzixpW0fjfJjXEaZwJAkiUsJn5CnGA81b0EoIPkryj2vAKQNA3AAQALojjPsI5trlaQ/ODy4Q2ApIUAzgMY5XLaoOdPAwiPM18GJa0H0N0gYXHcWK5gPeF2vUape4CkGwDs7ee1WK6wjGRvrQBTAZB0BcCSvCqviOsNyYleAUg6CmBzAcRbiAMk270BkGTCDUBRSjtJ20X+V2IPAUnzANSdVHJIZArJV14mQUkjAPQBmJ1DodUhfQcwluRPb8ugpIMAdhRA/BDJtihxRh4CkhYDuBrFaJPr9JGcHzWGOADs4KHZKa5L12mSlRcsrvrRzgMkLQdw1mmtuRX2ktwVN4RIPUDSfQCz4hpvYP1Okj1J/DkBSOoA4Pt66huA5wCeADC4qxOcCZrePwAWpTkXjALgguXSSegGbT4HS6cJfQFgsPpcX1Ktu0GXy/c2J5E0m4lLKIDgAHMowaGlTZj3APSTvOuKLgGAhwAsu0t9QeICEGeba/tu2xz1kgzdg1cDiQngOklbkr0UF4BrNsYcnu4AOEQycY4QA0APyU4vygMjdQFIGg/gbYizj4Hw1FfXEQEkOvV1wQoDEDb7HwvEhwFy+f73PAKATSTNp/cSBuAigKU1PNq/Nk76jCQEwFe7SCFpJ72ZlDAANvtPrvI6h6TN7l5LHQC2vJl45yqSJpgwAMP/2hq2P5rklzTO6rWVtAfA7ornlheY+NdZ+Ku0GQbAgrIZ18a5HSpa4pFZkWSriN0f2tDr8rHGRwnWmQlGMVLkOiWAIr89H7GXPcAHxSLbKHtAkd+ej9jLHuCDYpFtlD2gyG/PR+wt3wP+AsW7I1AzjlUOAAAAAElFTkSuQmCC" alt="">
</div>
<div class="heardIcon">
......@@ -79,6 +81,7 @@ import livedAnnouncement from "@/components/livedModel/livedAnnouncement";
import livedIsMsg from "@/components/livedModel/livedIsMsg";
import livedExplainingCommodities from "@/components/livedModel/livedExplainingCommodities";
import livedGoodsDia from "@/components/livedModel/livedGoodsDia";
import livedShareDia from "@/components/livedModel/livedShareDia";
import live from "@/api/live";
export default {
props: [
......@@ -106,6 +109,7 @@ export default {
num: 0,
userComing: false,
showDia: false, //显示商品列表弹窗
showShareDia: false, //显示分享弹窗
isSend: false, //显示评论输入框
sendVal: "", //输入内容
getFocus: false, //获取焦点
......@@ -117,7 +121,8 @@ export default {
livedAnnouncement,
livedIsMsg,
livedExplainingCommodities,
livedGoodsDia
livedGoodsDia,
livedShareDia
},
computed: {
likeNumCopy() {
......@@ -209,6 +214,12 @@ export default {
changeStatus() {
this.showDia = false;
},
showShare() {
this.showShareDia = true;
},
closeShareDia() {
this.showShareDia = false;
},
// 是否登录
isLogin() {
let _this = this;
......
......@@ -73,11 +73,13 @@
</template>
<script type="text/ecmascript-6">
import { DFSImg } from "@/utils/index";
import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
import live from "@/api/live";
import notStarted from "@/components/livedModel/notStarted";
import livedControls from "@/components/livedModel/livedControls";
import livedIsEnded from "@/components/livedModel/livedIsEnded";
import spokesman from "@/api/spokesman";
import shop from "@/api/shop";
export default {
name: "",
data() {
......@@ -103,7 +105,11 @@ export default {
infoTiming: null, //全局定时器
goodTiming: null, //商品定时器
endInfo: {}, //直播结束详情
firstComing: true // 首次进入
firstComing: true, // 首次进入
params: {},
userId: "",
hasInvitationStatus: 0, // 邀请资格:0-不能够邀请下级,1-能够邀请下级
spokesmanObj: {} //分销员信息
};
},
components: {
......@@ -129,17 +135,61 @@ export default {
}
}
});
let params = JSON.parse(options.params);
this.$store.commit("setOfflineShopCode", params.offlineShopCode);
this.liveId = params.liveId;
this.shopName = params.shopName;
this.backPath = params.fromPagePath || "/";
this.shopLogo = DFSImg(params.shopLogo, 40, 40);
this.params = JSON.parse(options.params);
console.log(this.params, "-----------------133");
this.$store.commit("setOfflineShopCode", this.params.offlineShopCode);
this.liveId = this.params.liveId;
this.shopName = this.params.shopName;
this.backPath = this.params.fromPagePath || "/";
this.shopLogo = DFSImg(this.params.shopLogo, 40, 40);
// 是否有分销员信息
if(params.spokesmanGroupId){
this.$store.commit("setSpokesman", {
spokesmanGroupId: params.spokesmanGroupId,
spokesmanShopId: params.spokesmanShopId,
spokesmanRelId: params.spokesmanRelId
})
}
this.init();
this.infoTiming = setInterval(() => {
this.timingGetInfo();
}, 5000);
this.userEntry("IN");
// 通过分享进入直播间重新查询订阅消息配置
this.getMsgConfig();
this.isLogin();
},
onShareAppMessage(options) {
let _this = this;
if(this.hasInvitationStatus==1){
Object.assign(this.params,this.params,this.spokesmanObj);
}
console.log(this.params,'--------------161')
let shareObj = {
title: this.liveNoticeInfo.title,
path: `/pages/lived/main?params=${JSON.stringify(this.params)}`,
imageUrl: this.liveNoticeInfo.coverUrl,
success: function(res) {
console.log("-----------success");
// 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") {
console.log(res, "分享成功");
}
},
fail: function(res) {
console.log("-----------fail");
// 转发失败之后的回调
if (res.errMsg == "shareAppMessage:fail cancel") {
console.log(res, "取消转发");
} else if (res.errMsg == "shareAppMessage:fail") {
console.log(res, "转发失败");
}
}
};
console.log(shareObj, "----------------168");
return shareObj;
},
onUnload() {
this.liveNoticeInfo.liveBroadcastState = -1;
......@@ -194,6 +244,66 @@ export default {
url: `../index/main?from=livedBackShop&backpath=${this.backPath}`
});
},
// 是否登录
isLogin() {
let _this = this;
wx.getStorage({
key: "sessionid",
success(res) {
// 查询分销员信息
_this.getSpokesman();
},
fail(res) {
console.log("未登录------150");
// 跳转登录页
let backUrl = "/lived/main";
let query = {
liveId: _this.liveId,
fromType: "mini"
};
let url = `/pages/login/main?back=${backUrl}&params=${JSON.stringify(
query
)}`;
wx.navigateTo({
url: url
});
}
});
},
getMsgConfig() {
if (!this.$store.state.subscribeMessageObj) {
shop.getWxMiniSubscribeMessageConfig().then(res => {
if (res.data.code == 200) {
const data = res.data.data;
console.log("wx mini subscribe message data: ", data);
if (data != null) {
const subscribeMessageObj = {};
for (var key in data) {
if (data[key] && data[key].template_id) {
subscribeMessageObj[key] = data[key].template_id;
}
}
this.$store.commit("setSubscribeMessageObj", subscribeMessageObj);
}
}
});
}
},
getSpokesman() {
spokesman.getSpokesmanidByShare().then(res => {
if (res.data.code == 200) {
if (res.data.data.hasInvitationStatus == 1) {
this.hasInvitationStatus = 1;
this.spokesmanObj = {
spokesmanGroupId: res.data.data.groupId,
spokesmanShopId: res.data.data.shopId,
spokesmanRelId: res.data.data.spokesmanId
};
}
}
});
},
toShop() {
// 到商城首页
this.backPath = "/";
......
{
"navigationStyle":"custom",
"navigationBarTextStyle": "white",
"disableScroll": true,
"usingComponents": {
"van-button": "/static/vant/button/index",
"van-icon": "/static/vant/icon/index",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment