Browse Source

fix: 添加分享功能

develop
song 4 years ago
parent
commit
b882484a67
  1. 3
      CHANGELOG.md
  2. 1
      src/App.vue
  3. 42
      src/components/Info/Info.vue
  4. 3
      src/components/Projects/ProjectItem.vue
  5. 16
      src/mixins/tool.js
  6. 6
      src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
  7. 4
      src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue
  8. 6
      src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue
  9. 4
      src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
  10. 59
      src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue
  11. 108
      src/pagesProject/project/project.vue
  12. 3
      src/pagesYanyuan/assess/assess.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-12-22) # 0.1.0 (2021-12-27)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
@ -78,6 +78,7 @@
- | 登录时提示是否合并账号样式修改 | [d82bf1a](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/d82bf1a) - | 登录时提示是否合并账号样式修改 | [d82bf1a](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/d82bf1a)
- | 细节调整,添加project-webview | [4d9050b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4d9050b) - | 细节调整,添加project-webview | [4d9050b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4d9050b)
- | 绑定手机号 | [52e0352](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/52e0352) - | 绑定手机号 | [52e0352](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/52e0352)
- | 给设置角色加小红点 | [c3adab4](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c3adab4)
- | 缓存修改 | [63e1f0d](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/63e1f0d) - | 缓存修改 | [63e1f0d](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/63e1f0d)
- | 缓存基本信息 | [43bd024](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/43bd024) - | 缓存基本信息 | [43bd024](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/43bd024)
- | 获取用户收取那,提交用户信息 | [a3c54f1](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a3c54f1) - | 获取用户收取那,提交用户信息 | [a3c54f1](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a3c54f1)

1
src/App.vue

@ -59,6 +59,7 @@ export default {
async signin() { async signin() {
try { try {
const data = await this.$u.api.signin(); const data = await this.$u.api.signin();
console.log('登录data: ', data);
if (data && data.token) { if (data && data.token) {
this.setUser(data); this.setUser(data);
this.setToken(data.token); this.setToken(data.token);

42
src/components/Info/Info.vue

@ -59,7 +59,6 @@
每天能睡 每天能睡
<input <input
class="mx-1 w-12 h-6 text-center border-b" class="mx-1 w-12 h-6 text-center border-b"
placeholder="0"
v-model="colItem.value1" v-model="colItem.value1"
:clearable="false" :clearable="false"
type="number" type="number"
@ -79,7 +78,6 @@
曾经是但已经戒烟已戒 曾经是但已经戒烟已戒
<input <input
class="mx-1 w-12 h-6 text-center border-b" class="mx-1 w-12 h-6 text-center border-b"
placeholder="0"
v-model="colItem.value1" v-model="colItem.value1"
:clearable="false" :clearable="false"
type="number" type="number"
@ -93,7 +91,6 @@
烟龄 烟龄
<input <input
class="mx-1 w-12 h-6 text-center border-b" class="mx-1 w-12 h-6 text-center border-b"
placeholder="0"
v-model="colItem.value2" v-model="colItem.value2"
:clearable="false" :clearable="false"
type="number" type="number"
@ -102,7 +99,6 @@
每天 每天
<input <input
class="mx-1 w-12 h-6 text-center border-b" class="mx-1 w-12 h-6 text-center border-b"
placeholder="0"
:border="true" :border="true"
v-model="colItem.value3" v-model="colItem.value3"
type="number" type="number"
@ -163,7 +159,6 @@
曾经是但已经不喝已不喝 曾经是但已经不喝已不喝
<input <input
class="mx-1 w-12 h-6 text-center border-b" class="mx-1 w-12 h-6 text-center border-b"
placeholder="0"
v-model="colItem.value1" v-model="colItem.value1"
:clearable="false" :clearable="false"
type="number" type="number"
@ -177,7 +172,6 @@
已持续 已持续
<input <input
class="mx-1 w-12 h-6 text-center border-b" class="mx-1 w-12 h-6 text-center border-b"
placeholder="0"
v-model="colItem.value2" v-model="colItem.value2"
:clearable="false" :clearable="false"
type="number" type="number"
@ -676,30 +670,30 @@ export default {
const item = info[j]; const item = info[j];
if (item.type !== 5) { if (item.type !== 5) {
if (item.value === null) { if (item.value === null) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
break; break;
} }
if (item.showOther && !item.otherValue) { if (item.showOther && !item.otherValue) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
break; break;
} }
if (item.type === 10 || item.type === 11 || item.type === 12 || item.type === 13) { if (item.type === 10 || item.type === 11 || item.type === 12 || item.type === 13) {
if (item.value === 1 && !item.value1) { if (item.value === 1 && !item.value1) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
break; break;
} }
} }
if (item.showClasses && !item.classesValue) { if (item.showClasses && !item.classesValue) {
this.$t.ui.showToast(`请填写${item.name}种类`); this.$emit('showToast', 'default', `请填写${item.name}种类`, false);
isComplete = false; isComplete = false;
break; break;
} }
if (item.type === 13) { if (item.type === 13) {
if (item.showClasses && !item.frequencyValue) { if (item.showClasses && !item.frequencyValue) {
this.$t.ui.showToast(`请填写${item.name}频率`); this.$emit('showToast', 'default', `请填写${item.name}频率`, false);
isComplete = false; isComplete = false;
break; break;
} }
@ -707,12 +701,12 @@ export default {
if (item.type === 11) { if (item.type === 11) {
if (item.value === 2) { if (item.value === 2) {
if (!item.value2) { if (!item.value2) {
this.$t.ui.showToast(`请填写烟龄`); this.$emit('showToast', 'default', `请填写烟龄`, false);
isComplete = false; isComplete = false;
break; break;
} }
if (!item.value3) { if (!item.value3) {
this.$t.ui.showToast(`请填写每天抽烟数量`); this.$emit('showToast', 'default', `请填写每天抽烟数量`, false);
isComplete = false; isComplete = false;
break; break;
} }
@ -720,19 +714,19 @@ export default {
} }
if (item.type === 13) { if (item.type === 13) {
if (item.value === 2 && !item.value2) { if (item.value === 2 && !item.value2) {
this.$t.ui.showToast(`请填写持续喝茶时长`); this.$emit('showToast', 'default', `请填写持续喝茶时长`, false);
isComplete = false; isComplete = false;
break; break;
} }
} }
} else { } else {
if (item.value.length === 0) { if (item.value.length === 0) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
break; break;
} }
if (item.showOther && !item.otherValue) { if (item.showOther && !item.otherValue) {
this.$t.ui.showToast(`请填写其他${item.name}`); this.$emit('showToast', 'default', `请填写其他${item.name}`, false);
isComplete = false; isComplete = false;
break; break;
} }
@ -846,47 +840,47 @@ export default {
await this.$u.api.updateTrainee(params); await this.$u.api.updateTrainee(params);
} catch (error) { } catch (error) {
console.error('error: ', error); console.error('error: ', error);
this.$t.ui.showToast(`${item.name}修改失败`); this.$emit('showToast', 'default', `${item.name}修改失败`, false);
} }
}, },
// //
validationRequired(item) { validationRequired(item) {
if (item.showOther && !item.otherValue) { if (item.showOther && !item.otherValue) {
this.$t.ui.showToast(`请填写其他${item.name}`); this.$emit('showToast', 'default', `请填写其他${item.name}`, false);
return; return;
} }
if (item.type === 10 || item.type === 11 || item.type === 12 || item.type === 13) { if (item.type === 10 || item.type === 11 || item.type === 12 || item.type === 13) {
if (item.value === 1 && !item.value1) { if (item.value === 1 && !item.value1) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
return; return;
} }
} }
if (item.showClasses && !item.classesValue) { if (item.showClasses && !item.classesValue) {
this.$t.ui.showToast(`请填写${item.name}种类`); this.$emit('showToast', 'default', `请填写${item.name}种类`, false);
return; return;
} }
if (item.type === 13) { if (item.type === 13) {
if (item.showClasses && !item.frequencyValue) { if (item.showClasses && !item.frequencyValue) {
this.$t.ui.showToast(`请填写${item.name}频率`); this.$emit('showToast', 'default', `请填写${item.name}频率`, false);
return; return;
} }
} }
if (item.type === 11) { if (item.type === 11) {
if (item.value === 2) { if (item.value === 2) {
if (!item.value2) { if (!item.value2) {
this.$t.ui.showToast(`请填写烟龄`); this.$emit('showToast', 'default', `请填写烟龄`, false);
return; return;
} }
if (!item.value3) { if (!item.value3) {
this.$t.ui.showToast(`请填写每天抽烟数量`); this.$emit('showToast', 'default', `请填写每天抽烟数量`, false);
return; return;
} }
} }
} }
if (item.type === 13) { if (item.type === 13) {
if (item.value === 2 && !item.value2) { if (item.value === 2 && !item.value2) {
this.$t.ui.showToast(`请填写持续喝茶时长`); this.$emit('showToast', 'default', `请填写持续喝茶时长`, false);
return; return;
} }
} }

3
src/components/Projects/ProjectItem.vue

@ -122,13 +122,14 @@ export default {
// //
openProject(project) { openProject(project) {
this.setProject(project); this.setProject(project);
const { name, id, url } = project; const { name, id, url, templateCode } = project;
url && (uni.$t.domain = url); url && (uni.$t.domain = url);
this.$u.route('/pagesProject/project/project', { this.$u.route('/pagesProject/project/project', {
u: this.userId, u: this.userId,
p: id, p: id,
pname: name, pname: name,
url: encodeURIComponent(url), url: encodeURIComponent(url),
code: templateCode,
}); });
}, },

16
src/mixins/tool.js

@ -1,5 +1,5 @@
// 工具箱相关处理 // 工具箱相关处理
import { mapState, mapMutations, mapActions } from 'vuex'; import { mapState, mapMutations, mapActions, mapGetters } from 'vuex';
export default { export default {
data() { data() {
@ -20,7 +20,10 @@ export default {
}, },
}, },
computed: mapState('yanyuan', ['toolInfo', 'showChooseElder', 'keyUserIds', 'applyFamilyInfo', 'showSetUser']), computed: {
...mapState('yanyuan', ['toolInfo', 'showChooseElder', 'keyUserIds', 'applyFamilyInfo', 'showSetUser']),
...mapGetters('user', ['userId']),
},
methods: { methods: {
...mapMutations('yanyuan', ['setShowChooseElder', 'setIsApplying', 'setShowSetUser', 'setElderlyInfo']), ...mapMutations('yanyuan', ['setShowChooseElder', 'setIsApplying', 'setShowSetUser', 'setElderlyInfo']),
@ -87,7 +90,7 @@ export default {
if (!res.length) { if (!res.length) {
this.$t.ui.showToast('您的亲属还没有添加老人信息,提醒他添加老人信息进行使用吧。'); this.$t.ui.showToast('您的亲属还没有添加老人信息,提醒他添加老人信息进行使用吧。');
setTimeout(() => { setTimeout(() => {
uni.redirectTo({ url: '/pages/index/index' }); uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}, 3000); }, 3000);
} else { } else {
this.showElder = true; this.showElder = true;
@ -95,7 +98,7 @@ export default {
} }
}) })
.catch(() => { .catch(() => {
uni.redirectTo({ url: '/pages/index/index' }); uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}); });
}, },
@ -108,7 +111,7 @@ export default {
this.setShowSetUser(true); this.setShowSetUser(true);
}) })
.catch(() => { .catch(() => {
uni.redirectTo({ url: '/pages/index/index' }); uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}); });
}, },
@ -169,6 +172,7 @@ export default {
// 取消选择老人 // 取消选择老人
cancelModel() { cancelModel() {
this.setShowChooseElder(false); this.setShowChooseElder(false);
uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}, },
// 确定设置使用者 // 确定设置使用者
@ -213,7 +217,7 @@ export default {
duration: '3000', duration: '3000',
}); });
setTimeout(() => { setTimeout(() => {
uni.redirectTo({ url: '/pages/index/index' }); uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}, 2000); }, 2000);
}, },
}, },

6
src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue

@ -31,7 +31,7 @@
<!-- 内容区 --> <!-- 内容区 -->
<view v-if="item.open" class="w-full mt-3"> <view v-if="item.open" class="w-full mt-3">
<view style="border: 1px solid #e5e5e5" v-if="index === 0"> <view style="border: 1px solid #e5e5e5" v-if="index === 0">
<Info :personalInfo="personalInfo" :isEdit="true" /> <Info @showToast="showToast" :personalInfo="personalInfo" :isEdit="true" />
</view> </view>
<Medicine @showToast="showToast" ref="medicineChild" v-if="index === 1" /> <Medicine @showToast="showToast" ref="medicineChild" v-if="index === 1" />
<Caregiver @showToast="showToast" ref="caregiverChild" v-if="index === 2" /> <Caregiver @showToast="showToast" ref="caregiverChild" v-if="index === 2" />
@ -114,11 +114,11 @@ export default {
}, },
// //
showToast(type, title) { showToast(type, title, icon) {
console.log('type, title: ', type, title);
this.$refs.uToast.show({ this.$refs.uToast.show({
type, type,
title, title,
icon,
}); });
}, },

4
src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue

@ -86,8 +86,8 @@ export default {
}, },
// //
showToast(type, title) { showToast(type, title, icon) {
this.$emit('showToast', type, title); this.$emit('showToast', type, title, icon);
}, },
// //

6
src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue

@ -238,12 +238,14 @@ export default {
for (let j = 0; j < info.length; j++) { for (let j = 0; j < info.length; j++) {
const item = info[j]; const item = info[j];
if (item.showOther && !item.otherValue) { if (item.showOther && !item.otherValue) {
this.$t.ui.showToast(`请填写其他${item.name}`); // this.$t.ui.showToast(`${item.name}`);
this.$emit('showToast', 'default', `请填写其他${item.name}`, false);
isComplete = false; isComplete = false;
break; break;
} }
if (!item.value) { if (!item.value) {
this.$t.ui.showToast(`请填写${item.name}`); // this.$t.ui.showToast(`${item.name}`);
this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
break; break;
} }

4
src/pagesProject/project/components/ConfigInfo/components/Medicine.vue

@ -67,8 +67,8 @@ export default {
}, },
// //
showToast(type, title) { showToast(type, title, icon) {
this.$emit('showToast', type, title); this.$emit('showToast', type, title, icon);
}, },
// //

59
src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue

@ -5,7 +5,7 @@
<view class="pl-4 py-3 font-bold border-b">{{ item.title }}</view> <view class="pl-4 py-3 font-bold border-b">{{ item.title }}</view>
<template v-for="(colItem, itemIndex) in item.date"> <template v-for="(colItem, itemIndex) in item.date">
<view :key="itemIndex" class="flex justify-between mx-4 items-center text-sm border-b"> <view :key="itemIndex" class="flex justify-between mx-4 items-center text-sm border-b">
<view class="my-3">{{ colItem.name }}</view> <view class="my-3" :style="{ width: colItem.type === 1 ? '' : '30%' }">{{ colItem.name }}</view>
<!-- 单选 --> <!-- 单选 -->
<view v-if="colItem.type === 1"> <view v-if="colItem.type === 1">
<u-radio-group v-model="colItem.value" class="flex items-center"> <u-radio-group v-model="colItem.value" class="flex items-center">
@ -45,6 +45,7 @@
type="number" type="number"
:clearable="false" :clearable="false"
input-align="right" input-align="right"
@focus="cancelChecked(index, itemIndex, colItem.value, colItem.type)"
@blur="change(colItem.value, index, itemIndex, colItem.type)" @blur="change(colItem.value, index, itemIndex, colItem.type)"
/> />
</view> </view>
@ -59,7 +60,7 @@
placeholder="每日总剂量(单位: mg)" placeholder="每日总剂量(单位: mg)"
type="number" type="number"
input-align="center" input-align="center"
@focus="cancelChecked(index, itemIndex)" @focus="cancelChecked(index, itemIndex, colItem.value, colItem.type)"
@blur="change(colItem.value, index, itemIndex, colItem.type)" @blur="change(colItem.value, index, itemIndex, colItem.type)"
/> />
<u-checkbox-group @change="change($event, index, itemIndex, 99)"> <u-checkbox-group @change="change($event, index, itemIndex, 99)">
@ -72,15 +73,25 @@
</view> </view>
<view class="flex flex-nowrap border-b mx-4 py-1"> <view class="flex flex-nowrap border-b mx-4 py-1">
<u-input :clearable="false" style="width: 100px" placeholder="其他药物" v-model="otherName.value" @blur="changeOther(otherName)" /> <u-input
:clearable="false"
style="width: 30%"
placeholder="其他药物"
v-model="otherName.value"
@focus="changeOtherChecked(otherName.value)"
@blur="changeOther(otherName)"
/>
<u-input <u-input
:clearable="false" :clearable="false"
class="flex-1" class="flex-1"
placeholder="每日总剂量(单位: mg)" placeholder="每日总剂量(单位: mg)"
type="number" type="number"
input-align="center"
v-model="otherMedicine.value" v-model="otherMedicine.value"
@focus="changeOtherChecked(otherMedicine.value)"
@blur="changeOther(otherMedicine)" @blur="changeOther(otherMedicine)"
/> />
<view class="w-24"></view>
</view> </view>
<view class="p-4"> <view class="p-4">
@ -122,6 +133,7 @@ export default {
second: true, second: true,
}, },
isShow: false, isShow: false,
originalValue: null,
}; };
}, },
@ -142,8 +154,11 @@ export default {
this.medicineInfo[index].date[itemIndex].show = !this.medicineInfo[index].date[itemIndex].show; this.medicineInfo[index].date[itemIndex].show = !this.medicineInfo[index].date[itemIndex].show;
}, },
cancelChecked(index, itemIndex) { cancelChecked(index, itemIndex, value, type) {
if (type === 4) {
this.medicineInfo[index].date[itemIndex].checked = false; this.medicineInfo[index].date[itemIndex].checked = false;
}
this.originalValue = value;
}, },
change(e, index, itemIndex, type) { change(e, index, itemIndex, type) {
@ -156,7 +171,11 @@ export default {
// this.medicineInfo[0].date[1].chooseTime = e === 1 ? true : false; // this.medicineInfo[0].date[1].chooseTime = e === 1 ? true : false;
this.isShow = e === 1 ? true : false; this.isShow = e === 1 ? true : false;
if (!this.show) { if (!this.show) {
if (item.value === this.originalValue) {
this.originalValue = null;
} else {
this.updateMedicine(item); this.updateMedicine(item);
}
} else { } else {
this.params[item.label] = item.value; this.params[item.label] = item.value;
} }
@ -167,7 +186,11 @@ export default {
const valueDay = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second; const valueDay = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second;
item.value = valueDay; item.value = valueDay;
if (!this.show) { if (!this.show) {
if (item.value === this.originalValue) {
this.originalValue = null;
} else {
this.updateMedicine(item); this.updateMedicine(item);
}
} else { } else {
this.params[item.label] = item.value; this.params[item.label] = item.value;
} }
@ -186,7 +209,15 @@ export default {
default: { default: {
item.value = e; item.value = e;
if (!this.show) { if (!this.show) {
if (type === 4 && !item.checked && !item.value) {
item.checked = true;
} else {
if (item.value === this.originalValue) {
this.originalValue = null;
} else {
this.updateMedicine(item); this.updateMedicine(item);
}
}
} else { } else {
this.params[item.label] = item.value; this.params[item.label] = item.value;
} }
@ -195,10 +226,17 @@ export default {
} }
}, },
changeOtherChecked(value) {
this.originalValue = value;
},
changeOther(item) { changeOther(item) {
console.log(this.show);
if (!this.show) { if (!this.show) {
if (item.value === this.originalValue) {
this.originalValue = null;
} else {
this.updateMedicine(item); this.updateMedicine(item);
}
} else { } else {
this.params[item.label] = item.value; this.params[item.label] = item.value;
} }
@ -233,28 +271,28 @@ export default {
switch (item.type) { switch (item.type) {
case 2: { case 2: {
if (this.isShow && !item.value) { if (this.isShow && !item.value) {
this.$t.ui.showToast(`请选择测评时间`); this.$emit('showToast', 'default', '请选择测评时间', false);
isComplete = false; isComplete = false;
} }
break; break;
} }
case 3: { case 3: {
if (this.isShow && !item.value) { if (this.isShow && !item.value) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
} }
break; break;
} }
case 4: { case 4: {
if (!item.value && !item.checked) { if (!item.value && !item.checked) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
} }
break; break;
} }
default: { default: {
if (!item.value) { if (!item.value) {
this.$t.ui.showToast(`请填写${item.name}`); this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false; isComplete = false;
} }
break; break;
@ -356,6 +394,9 @@ export default {
try { try {
const params = { id: this.detail.id }; const params = { id: this.detail.id };
params[item.label] = item.value; params[item.label] = item.value;
if (item.checked) {
params[item.label] = '未服用';
}
await this.$u.api.updateMedicine(params); await this.$u.api.updateMedicine(params);
this.$emit('showToast', 'success', '修改成功'); this.$emit('showToast', 'success', '修改成功');
} catch (error) { } catch (error) {

108
src/pagesProject/project/project.vue

@ -63,6 +63,7 @@ export default {
chooseItem: false, chooseItem: false,
showGuide: false, showGuide: false,
isSetting: false, // isSetting: false, //
templateCode: '',
}; };
}, },
@ -78,19 +79,37 @@ export default {
}, },
onLoad(options) { onLoad(options) {
console.log('AAA: ', options);
this.templateCode = options.code;
if (options.share && options.share === '1') { if (options.share && options.share === '1') {
console.log('0001'); console.log('0001');
// TODO:
console.log('options.code: ', options.code);
this.queryGuide(options.code);
this.shareInit(options); this.shareInit(options);
} else {
if ((this.scene === 1007 || this.scene === 1008) && !this.showGuide) {
let timer = null;
timer = setInterval(() => {
if (this.token && this.userId) {
clearInterval(timer);
this.shareWeixinInit(options);
}
}, 300);
} else { } else {
console.log('0002'); console.log('0002');
this.init(options); this.shareWeixinInit(options);
// TODO:
// this.queryGuide(options.code);
// this.init(options);
}
} }
// //
wx.showShareMenu({ // wx.showShareMenu({
withShareTicket: true, // withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'], // menus: ['shareAppMessage', 'shareTimeline'],
}); // });
}, },
watch: { watch: {
@ -100,7 +119,6 @@ export default {
* 永久日常任务不发生改变 * 永久日常任务不发生改变
*/ */
timeNode(val) { timeNode(val) {
console.log('timeNode: ', val);
if (val && this.roleId) { if (val && this.roleId) {
this.clearTasksData(); this.clearTasksData();
this.getGlobalData(); // this.getGlobalData(); //
@ -119,7 +137,7 @@ export default {
if (this.isSetting) return; if (this.isSetting) return;
this.setTimeNode(Date.now()); this.setTimeNode(Date.now());
// //
const params = { roleId: val, projectId: this.projectId, templateCode: this.project.templateCode }; const params = { roleId: val, projectId: this.projectId, templateCode: this.templateCode };
this.getPermanent(params); this.getPermanent(params);
} }
}, },
@ -140,8 +158,6 @@ export default {
this.$nextTick(async () => { this.$nextTick(async () => {
const system = uni.getSystemInfoSync(); const system = uni.getSystemInfoSync();
this.height = system.windowHeight + 'px'; this.height = system.windowHeight + 'px';
// TODO:
await this.queryGuide();
}); });
}, },
@ -151,6 +167,18 @@ export default {
this.setScrollToTaskId(''); this.setScrollToTaskId('');
}, },
onShareAppMessage() {
const { name, id, url, templateCode } = this.project;
url && (uni.$t.domain = url);
return {
u: this.userId,
p: id,
pname: name,
url: encodeURIComponent(url),
code: templateCode,
};
},
methods: { methods: {
...mapActions('user', ['getToken']), ...mapActions('user', ['getToken']),
...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']), ...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']),
@ -242,7 +270,7 @@ export default {
* @param {object} query getTasks传递的参数 * @param {object} query getTasks传递的参数
*/ */
generateGetTaskParam(query) { generateGetTaskParam(query) {
const { roleId, timeNode, timeUnit, projectId, project } = this; const { roleId, timeNode, timeUnit, projectId, templateCode } = this;
return { return {
roleId, roleId,
timeNode: query.timeNode || timeNode, timeNode: query.timeNode || timeNode,
@ -251,7 +279,7 @@ export default {
queryNum: 3, queryNum: 3,
queryType: query.queryType, queryType: query.queryType,
projectId, projectId,
templateCode: project.templateCode, templateCode: templateCode,
}; };
}, },
@ -363,6 +391,7 @@ export default {
* @param {object | null} options * @param {object | null} options
*/ */
async init(options) { async init(options) {
console.log('init options: ', options);
if (!this.token) { if (!this.token) {
// tokenuserIdtoken // tokenuserIdtoken
// token userId // token userId
@ -384,17 +413,9 @@ export default {
} }
// TODO // TODO
// this.getProjectById({ projectId: options.p, num: 0 }); // id // this.getProjectById({ projectId: options.p, num: 0 }); // id
console.log('options: ', options);
// await this.queryFamilyIsMember(options.p);
console.log('this.userId: ', this.userId);
if (this.scene === 1007 || this.scene === 1008) {
console.log('查询用户是否是项目成员', this.userId);
await this.queryFamilyIsMember(options.p);
}
// id // id
this.getRoles({ projectId: options.p, num: 0, templateCode: this.project.templateCode }); this.getRoles({ projectId: options.p, num: 0, templateCode: options.code });
} }
}, },
@ -419,6 +440,27 @@ 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);
},
/** /**
* 点击分享连接 * 点击分享连接
* @param {any} commit * @param {any} commit
@ -439,12 +481,13 @@ export default {
*/ */
async getProjectById(params) { async getProjectById(params) {
try { try {
console.log('项目params: ', params);
console.log('项目 api', uni.$u.api.findProjectById);
const data = await uni.$u.api.findProjectById(params); const data = await uni.$u.api.findProjectById(params);
console.log('项目信息: ', data);
this.setProject(data); this.setProject(data);
// id
this.getRoles(params);
} catch (error) { } catch (error) {
console.error('error: ', error || '获取项目信息失败'); console.error('通过项目id获取项目信息 error: ', error || '获取项目信息失败');
} }
}, },
@ -479,8 +522,8 @@ export default {
// //
getGlobalData() { getGlobalData() {
const { roleId, timeNode, timeUnit, projectId } = this; const { roleId, timeNode, timeUnit, projectId, templateCode } = this;
const param = { roleId, timeNode, timeUnit, projectId }; const param = { roleId, timeNode, timeUnit, projectId, templateCode };
this.getGlobal(param); this.getGlobal(param);
}, },
@ -500,9 +543,9 @@ export default {
* 查询是否显示引导页 * 查询是否显示引导页
* @param {object} templateCode 模板code * @param {object} templateCode 模板code
*/ */
async queryGuide() { async queryGuide(templateCode) {
try { try {
const params = { templateCode: this.project.templateCode }; const params = { templateCode };
const data = await this.$u.api.queryGuide(params); const data = await this.$u.api.queryGuide(params);
if (data.status === 0) { if (data.status === 0) {
this.showGuide = true; this.showGuide = true;
@ -518,7 +561,7 @@ export default {
*/ */
async quitGuide() { async quitGuide() {
try { try {
const params = { templateCode: this.project.templateCode }; const params = { templateCode: this.templateCode };
await this.$u.api.updateGuide(params); await this.$u.api.updateGuide(params);
this.showGuide = false; this.showGuide = false;
} catch (error) { } catch (error) {
@ -536,16 +579,15 @@ export default {
const data = await this.$u.api.familyIsMember(params); const data = await this.$u.api.familyIsMember(params);
console.log('data: ', data); console.log('data: ', data);
// //
if ((data.familyStatus === 1 || data.familyStatus === 2) && data.keyUserId) { if (data.familyStatus === 2 && data.keyUserId) {
console.log('不是成员 询问是否成为家属'); console.log('不是成员 询问是否成为家属');
const arr = [{ keyUserId: data.keyUserId, sex: data.sex, userName: data.userName }]; const arr = [{ keyUserId: data.keyUserId, sex: data.sex, userName: data.userName }];
this.setElderlyInfo(arr); this.setElderlyInfo(arr);
this.showElder = true; this.showElder = true;
} }
// if (data.familyStatus === 1) { if (data.familyStatus === 1) {
// console.log(' '); console.log('是 直接打开');
// this.init(options); }
// }
if (data.familyStatus === 0) { if (data.familyStatus === 0) {
console.log('申请已提交,返回首页'); console.log('申请已提交,返回首页');
this.transferContent = '家属申请已提交,请等待审核'; this.transferContent = '家属申请已提交,请等待审核';

3
src/pagesYanyuan/assess/assess.vue

@ -159,13 +159,14 @@ export default {
backProject() { backProject() {
this.setIsEvaluated(true); this.setIsEvaluated(true);
const { name, id, url } = this.project; const { name, id, url, templateCode } = this.project;
url && (uni.$t.domain = url); url && (uni.$t.domain = url);
this.$u.route('/pagesProject/project/project', { this.$u.route('/pagesProject/project/project', {
u: this.userId, u: this.userId,
p: id, p: id,
pname: name, pname: name,
url: encodeURIComponent(url), url: encodeURIComponent(url),
code: templateCode,
}); });
}, },
}, },

Loading…
Cancel
Save