Commit 04a9a692 by 程默

fix

parent a0102052
......@@ -20,86 +20,89 @@ import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
import login from "@/api/login";
import indexApi from "@/api/index";
export default {
data(){
return{
link : '',
shareShopName: '',//分享名称
shareLogoUrl: '',//分享图片url
newWindowHref: '',//分享页面url
}
data() {
return {
link: "",
shareShopName: "", //分享名称
shareLogoUrl: "", //分享图片url
newWindowHref: "", //分享页面url
};
},
async onLoad(options){
console.log(options,66667777777)
if(options.scene) {
async onLoad(options) {
console.log(options, '第三方页面');
/**
* scene=sso 第三方需要登录的页面
* login=1 jwt需要登录(临时方案)
*/
if (options.scene) {
//扫码
let data = await this.getParams(options.scene);
console.log(data,888999,wx.getStorageSync("sessionid"))
// debugger
if (data.sso) {
if (!wx.getStorageSync("sessionid")) {
wx.redirectTo({
url: `../login/main?scene=sso&back=${data.link}`,
});
}else{
this.getSsoBcakUrl(decodeURIComponent(data.link))
// let link = decodeURIComponent(data.link).replace(
// "${token}",
// wx.getStorageSync("sessionid")
// );
// this.link = decodeURIComponent(link);
} else {
this.getSsoBcakUrl(decodeURIComponent(data.link));
}
}
}else if(options.link){
if(getUrlKey(decodeURIComponent(options.link),'scene') == 'sso') {
this.getSsoBcakUrl(decodeURIComponent(options.link))
}else if(getUrlKey(decodeURIComponent(options.link),'login') != '1') {
this.link = decodeURIComponent(options.link)
}else {
if(wx.getStorageSync("sessionid")) {
this.link = forUrlAddKey(
decodeURIComponent(options.link),
{
} else if (options.link) {
if (getUrlKey(decodeURIComponent(options.link), "scene") == "sso") {
if (!wx.getStorageSync("sessionid")) {
wx.redirectTo({
url: `../login/main?scene=sso&back=${options.link}`,
});
} else {
this.getSsoBcakUrl(decodeURIComponent(options.link));
}
} else if (getUrlKey(decodeURIComponent(options.link), "login") != "1") {
this.link = decodeURIComponent(options.link);
} else {
if (wx.getStorageSync("sessionid")) {
this.link = forUrlAddKey(decodeURIComponent(options.link), {
token: wx.getStorageSync("sessionid"),
jwt: 1
}
)
}else {
jwt: 1,
});
} else {
let url = `/pages/login/main?scene=sso&back=${options.link}`;
wx.navigateTo({
url
})
url,
});
}
}
}
},
async onShareAppMessage(res) {
let url = ''
console.log(this.newWindowHref + 'this.newWindowHref')
let url = "";
console.log(this.newWindowHref + "this.newWindowHref");
//分享路径
if(this.newWindowHref){
if (this.newWindowHref) {
url = this.newWindowHref;
}else{
} else {
url = res.webViewUrl;
}
url = removeUrlKey(url,['token'])
url = removeUrlKey(url, ["token"]);
//分享页面去掉登录态
if (url.indexOf("sessionid") > -1) {
url = url.split("?")[0] + "?mixid=" + this.shopId;
}
this.shareUrl = url ;
this.shareUrl = url;
console.log(this.shareUrl, "index12");
console.log(`/pages/index/main?link=${encodeURIComponent(this.shareUrl)}`, '测试直播分享相关')
console.log(
`/pages/index/main?link=${encodeURIComponent(this.shareUrl)}`,
"测试直播分享相关"
);
return {
title: this.shareShopName, // 默认是小程序的名称
path: `/pages/wxArticle/main?link=${encodeURIComponent(this.shareUrl)}`, // 默认是当前页面
imageUrl: this.shareLogoUrl,
success: function(res) {
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") {
console.log(res, "分享成功");
}
},
fail: function() {
fail: function () {
// 转发失败之后的回调
if (res.errMsg == "shareAppMessage:fail cancel") {
// 用户取消转发
......@@ -108,9 +111,9 @@ export default {
// 转发失败,其中 detail message 为详细失败信息
}
},
complete: function() {
complete: function () {
// 转发结束之后的回调(转发成不成功都会执行)
}
},
};
},
methods: {
......@@ -121,14 +124,14 @@ export default {
fromAppid: "VsEOuDJqBnGNyXZJWCQS",
// mobilephone: '15821335747',hgFTLLhgnBmeOyCkcbyv
// toAppid: 'hgFTLLhgnBmeOyCkcbyv',
toAppid: getUrlKey(link,'toAppid'),//道可
toAppid: getUrlKey(link, "toAppid"), //道可
wxAvatarUrl: this.$store.state.userInfo.avatarUrl,
};
login.getSsoBcakUrl(op).then((res) => {
console.log(res,this.link,555444)
if(res.data.code == '200') {
console.log(res, this.link, 555444);
if (res.data.code == "200") {
this.link = res.data.data;
}else {
} else {
wx.showToast({ title: res.data.msg, icon: "none" });
}
});
......@@ -155,19 +158,23 @@ export default {
let len = res.target.data.length - 1;
console.log(res, "h5消息", res.target.data[len]);
this.shareShopName = res.target.data[len].shareShopName || "";
if(res.target.data[len].shareLogoUrl) {
if (res.target.data[len].shareLogoUrl) {
this.shareLogoUrl = DFSImg(res.target.data[len].shareLogoUrl, 500, 400);
}
this.newWindowHref = res.target.data[len].shareImgUrl;// + '&fromVisitorOpenId=' + wx.getStorageSync("openid")
console.log("分享信息:", this.shareLogoUrl, this.shareShopName,1111111,res);
this.newWindowHref = res.target.data[len].shareImgUrl; // + '&fromVisitorOpenId=' + wx.getStorageSync("openid")
console.log(
"分享信息:",
this.shareLogoUrl,
this.shareShopName,
1111111,
res
);
},
handleError(data) {
wx.showLoading({
title: "网页加载失败 请右上角刷新",
});
},
}
},
};
</script>
<style lang="scss" scoped></style>
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