@/bo-auth/main-auth-share.js
//全局分享页面地址
import {
convertShareUrl
} from "@/bo-auth/main-auth-share.js";
Vue.prototype.$share = {
convertShareUrl
};
created() {
//===========公共部分 start
method.init(this);
//===========公共部分 end
this.shareUrl=this.$share.convertShareUrl("https://bt.sandieji.tech", this);
},
export function doShare(that) {
//通过延迟加载,分享通常首次打开不会使用到
setTimeout(() => {
//获取一级分享
that.$store.dispatch("userFromFirstShareId", that.$route.query._ufs);
//获取二级分享
that.$store.dispatch("userFromSecondShareId", that.$route.query._uss);
}, 1000);
//that.$store.getters.userFromFirstShareId
//that.$store.state.userFromFirstShareId
// watch: {"$store.state.dataLoading": function (to, from) { }}
}
/**
*
* @param {要分享的页面地址} url
* @param {当前分享页面对象,this} that
*/
export function convertShareUrl(url, that) {
if (!url) return;
let _ufs = (that.$store.getters.user||{}).userId;
let _uss = that.$store.getters.userFromFirstShareId;
if (url.includes("?")) {
return `${url}&_ufs=${_ufs}&_uss=${_uss}`
}
return `${url}&_ufs=${_ufs}&_uss=${_uss}`
}
文档更新时间: 2021-08-26 08:00 作者:admin