|
|
@ -79,12 +79,9 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
onLoad(options) { |
|
|
|
console.log('AAA: ', options); |
|
|
|
this.templateCode = options.code; |
|
|
|
if (options.share && options.share === '1') { |
|
|
|
console.log('0001'); |
|
|
|
// TODO: 判断用户第一次进来才会显示引导页 |
|
|
|
console.log('options.code: ', options.code); |
|
|
|
this.queryGuide(options.code); |
|
|
|
this.shareInit(options); |
|
|
|
} else { |
|
|
@ -97,19 +94,11 @@ export default { |
|
|
|
} |
|
|
|
}, 300); |
|
|
|
} else { |
|
|
|
console.log('0002'); |
|
|
|
this.shareWeixinInit(options); |
|
|
|
// TODO: 判断用户第一次进来才会显示引导页 |
|
|
|
// this.queryGuide(options.code); |
|
|
|
// this.init(options); |
|
|
|
this.queryGuide(options.code); |
|
|
|
this.init(options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 分享 |
|
|
|
// wx.showShareMenu({ |
|
|
|
// withShareTicket: true, |
|
|
|
// menus: ['shareAppMessage', 'shareTimeline'], |
|
|
|
// }); |
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
@ -391,7 +380,6 @@ export default { |
|
|
|
* @param {object | null} options |
|
|
|
*/ |
|
|
|
async init(options) { |
|
|
|
console.log('init options: ', options); |
|
|
|
if (!this.token) { |
|
|
|
// 不论有没有token都直接从userId获取token |
|
|
|
// token有过期时间 从本地获取可能是过期 干脆直接从userId获取 |
|
|
@ -403,7 +391,11 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
// 参数里有项目名称 就设置标题里的项目名称 |
|
|
|
options && options.pname && this.setProjectName(options.pname); |
|
|
|
if (this.project && this.project.id) { |
|
|
|
this.setProjectName(this.project.name); |
|
|
|
} else { |
|
|
|
options && options.pname && this.setProjectName(options.pname); |
|
|
|
} |
|
|
|
|
|
|
|
if (!options || !options.p) { |
|
|
|
this.$t.ui.showToast('缺少项目信息参数'); // 没有项目id参数 |
|
|
@ -442,23 +434,9 @@ export default { |
|
|
|
|
|
|
|
// 小程序进来的初始化 |
|
|
|
async shareWeixinInit(options) { |
|
|
|
console.log('小程序进来的初始化options: ', options); |
|
|
|
await this.getProjectById({ projectId: options.p, num: 0, templateCode: options.code }); // 根据项目id获取项目信息 |
|
|
|
await this.queryGuide(options.code); |
|
|
|
await this.queryFamilyIsMember(options.p); |
|
|
|
const obj = { |
|
|
|
p: options.p, |
|
|
|
u: this.userId, |
|
|
|
pname: options.pname, |
|
|
|
code: options.code, |
|
|
|
}; |
|
|
|
this.init(obj); |
|
|
|
// let timer = null; |
|
|
|
// timer = setInterval(() => { |
|
|
|
// if (!this.showGuide) { |
|
|
|
// clearInterval(timer); |
|
|
|
// } |
|
|
|
// }, 300); |
|
|
|
await this.queryFamilyIsMember(options.p, options); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -481,13 +459,10 @@ export default { |
|
|
|
*/ |
|
|
|
async getProjectById(params) { |
|
|
|
try { |
|
|
|
console.log('项目params: ', params); |
|
|
|
console.log('项目 api', uni.$u.api.findProjectById); |
|
|
|
const data = await uni.$u.api.findProjectById(params); |
|
|
|
console.log('项目信息: ', data); |
|
|
|
const data = await this.$u.api.findProjectById(params); |
|
|
|
this.setProject(data); |
|
|
|
} catch (error) { |
|
|
|
console.error('通过项目id获取项目信息 error: ', error || '获取项目信息失败'); |
|
|
|
console.error('通过项目id获取项目信息error: ', error || '获取项目信息失败'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -565,7 +540,7 @@ export default { |
|
|
|
await this.$u.api.updateGuide(params); |
|
|
|
this.showGuide = false; |
|
|
|
} catch (error) { |
|
|
|
console.log('error: ', error); |
|
|
|
console.error('error: ', error); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -573,26 +548,28 @@ export default { |
|
|
|
* 查询用户是否是项目成员 |
|
|
|
* @param {string} projectId |
|
|
|
*/ |
|
|
|
async queryFamilyIsMember(projectId) { |
|
|
|
async queryFamilyIsMember(projectId, options) { |
|
|
|
try { |
|
|
|
const params = { projectId }; |
|
|
|
const data = await this.$u.api.familyIsMember(params); |
|
|
|
console.log('data: ', data); |
|
|
|
// 是 直接打开 否 询问是否成为家属 |
|
|
|
if (data.familyStatus === 2 && data.keyUserId) { |
|
|
|
console.log('不是成员 询问是否成为家属'); |
|
|
|
if ((data.familyStatus === -1 || data.familyStatus === 2) && data.keyUserId) { |
|
|
|
const arr = [{ keyUserId: data.keyUserId, sex: data.sex, userName: data.userName }]; |
|
|
|
this.setElderlyInfo(arr); |
|
|
|
this.showElder = true; |
|
|
|
} |
|
|
|
if (data.familyStatus === 1) { |
|
|
|
console.log('是 直接打开'); |
|
|
|
const obj = { |
|
|
|
p: options.p, |
|
|
|
u: this.userId, |
|
|
|
pname: options.pname, |
|
|
|
code: options.code, |
|
|
|
}; |
|
|
|
this.init(obj); |
|
|
|
} |
|
|
|
if (data.familyStatus === 0) { |
|
|
|
console.log('申请已提交,返回首页'); |
|
|
|
this.transferContent = '家属申请已提交,请等待审核'; |
|
|
|
// 申请成为家属 |
|
|
|
this.$t.page.openPage('/pagesYanyuan/transfer-page/transfer-page?type=jiashu'); |
|
|
|
this.$t.page.openPage('/pagesYanyuan/transfer-page/transfer-page?type=isjiashu'); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('error: ', error); |
|
|
|