|
|
@ -36,7 +36,13 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
onLoad(options) { |
|
|
|
this.init(options); |
|
|
|
if (options.share && options.share === '1') { |
|
|
|
console.log('是分享来的'); |
|
|
|
this.shareInit(options); |
|
|
|
} else { |
|
|
|
console.log('不是分享来的'); |
|
|
|
this.init(options); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
@ -126,6 +132,40 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 分享链接来的初始化 |
|
|
|
async shareInit(options) { |
|
|
|
const user = JSON.parse(this.$t.storage.getStorageSync('user')); |
|
|
|
if (user && user.id) { |
|
|
|
await this.getToken(user.id); |
|
|
|
const res = await this.clickShare({ code: options.shareId }); |
|
|
|
if (res && res.projectId) { |
|
|
|
let query = { ...this.$route.query }; |
|
|
|
query = { |
|
|
|
u: user.id, |
|
|
|
p: res.projectId, |
|
|
|
}; |
|
|
|
this.$router.push({ path: this.$route.path, query }); |
|
|
|
this.init(query); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$t.ui.showToast('缺少用户信息参数,请登录'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 点击分享连接 |
|
|
|
* @param {any} commit |
|
|
|
* @param {object} param 请求参数 |
|
|
|
*/ |
|
|
|
async clickShare(param) { |
|
|
|
try { |
|
|
|
const data = await this.$u.api.clickShare(param); |
|
|
|
return data; |
|
|
|
} catch (error) { |
|
|
|
this.$t.ui.showToast(error.msg || '获取失败'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 通过项目id获取项目信息 |
|
|
|
* @param {string} projectId |
|
|
|