diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0dd0e93..a799570 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# 0.1.0 (2021-12-22)
+# 0.1.0 (2021-12-27)
### 🌟 新功能
范围|描述|commitId
@@ -78,6 +78,7 @@
- | 登录时提示是否合并账号样式修改 | [d82bf1a](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/d82bf1a)
- | 细节调整,添加project-webview | [4d9050b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4d9050b)
- | 绑定手机号 | [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)
- | 缓存基本信息 | [43bd024](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/43bd024)
- | 获取用户收取那,提交用户信息 | [a3c54f1](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a3c54f1)
diff --git a/src/App.vue b/src/App.vue
index e89684f..cdcffca 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -59,6 +59,7 @@ export default {
async signin() {
try {
const data = await this.$u.api.signin();
+ console.log('登录data: ', data);
if (data && data.token) {
this.setUser(data);
this.setToken(data.token);
diff --git a/src/components/Info/Info.vue b/src/components/Info/Info.vue
index 0ad773e..a594b08 100644
--- a/src/components/Info/Info.vue
+++ b/src/components/Info/Info.vue
@@ -59,7 +59,6 @@
是,每天能睡
{
- uni.redirectTo({ url: '/pages/index/index' });
+ uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}, 3000);
} else {
this.showElder = true;
@@ -95,7 +98,7 @@ export default {
}
})
.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);
})
.catch(() => {
- uni.redirectTo({ url: '/pages/index/index' });
+ uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
});
},
@@ -169,6 +172,7 @@ export default {
// 取消选择老人
cancelModel() {
this.setShowChooseElder(false);
+ uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
},
// 确定设置使用者
@@ -213,7 +217,7 @@ export default {
duration: '3000',
});
setTimeout(() => {
- uni.redirectTo({ url: '/pages/index/index' });
+ uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}, 2000);
},
},
diff --git a/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue b/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
index 28d3f7c..ba4a4e9 100644
--- a/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
+++ b/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
@@ -31,7 +31,7 @@
-
+
@@ -114,11 +114,11 @@ export default {
},
// 成功弹框
- showToast(type, title) {
- console.log('type, title: ', type, title);
+ showToast(type, title, icon) {
this.$refs.uToast.show({
type,
title,
+ icon,
});
},
diff --git a/src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue b/src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue
index b2697e8..e9f8284 100644
--- a/src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue
+++ b/src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue
@@ -86,8 +86,8 @@ export default {
},
// 成功弹框
- showToast(type, title) {
- this.$emit('showToast', type, title);
+ showToast(type, title, icon) {
+ this.$emit('showToast', type, title, icon);
},
// 添加
diff --git a/src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue b/src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue
index 8f995a1..b096f20 100644
--- a/src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue
+++ b/src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue
@@ -238,12 +238,14 @@ export default {
for (let j = 0; j < info.length; j++) {
const item = info[j];
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;
break;
}
if (!item.value) {
- this.$t.ui.showToast(`请填写${item.name}`);
+ // this.$t.ui.showToast(`请填写${item.name}`);
+ this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
break;
}
diff --git a/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue b/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
index 05d5cf3..700ad54 100644
--- a/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
+++ b/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
@@ -67,8 +67,8 @@ export default {
},
// 成功弹框
- showToast(type, title) {
- this.$emit('showToast', type, title);
+ showToast(type, title, icon) {
+ this.$emit('showToast', type, title, icon);
},
// 添加
diff --git a/src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue b/src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue
index 75b55a9..1b788c6 100644
--- a/src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue
+++ b/src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue
@@ -5,7 +5,7 @@
{{ item.title }}
- {{ colItem.name }}
+ {{ colItem.name }}
@@ -45,6 +45,7 @@
type="number"
:clearable="false"
input-align="right"
+ @focus="cancelChecked(index, itemIndex, colItem.value, colItem.type)"
@blur="change(colItem.value, index, itemIndex, colItem.type)"
/>
@@ -59,7 +60,7 @@
placeholder="每日总剂量(单位: mg)"
type="number"
input-align="center"
- @focus="cancelChecked(index, itemIndex)"
+ @focus="cancelChecked(index, itemIndex, colItem.value, colItem.type)"
@blur="change(colItem.value, index, itemIndex, colItem.type)"
/>
@@ -72,15 +73,25 @@
-
+
+
@@ -122,6 +133,7 @@ export default {
second: true,
},
isShow: false,
+ originalValue: null,
};
},
@@ -142,8 +154,11 @@ export default {
this.medicineInfo[index].date[itemIndex].show = !this.medicineInfo[index].date[itemIndex].show;
},
- cancelChecked(index, itemIndex) {
- this.medicineInfo[index].date[itemIndex].checked = false;
+ cancelChecked(index, itemIndex, value, type) {
+ if (type === 4) {
+ this.medicineInfo[index].date[itemIndex].checked = false;
+ }
+ this.originalValue = value;
},
change(e, index, itemIndex, type) {
@@ -156,7 +171,11 @@ export default {
// this.medicineInfo[0].date[1].chooseTime = e === 1 ? true : false;
this.isShow = e === 1 ? true : false;
if (!this.show) {
- this.updateMedicine(item);
+ if (item.value === this.originalValue) {
+ this.originalValue = null;
+ } else {
+ this.updateMedicine(item);
+ }
} else {
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;
item.value = valueDay;
if (!this.show) {
- this.updateMedicine(item);
+ if (item.value === this.originalValue) {
+ this.originalValue = null;
+ } else {
+ this.updateMedicine(item);
+ }
} else {
this.params[item.label] = item.value;
}
@@ -186,7 +209,15 @@ export default {
default: {
item.value = e;
if (!this.show) {
- this.updateMedicine(item);
+ if (type === 4 && !item.checked && !item.value) {
+ item.checked = true;
+ } else {
+ if (item.value === this.originalValue) {
+ this.originalValue = null;
+ } else {
+ this.updateMedicine(item);
+ }
+ }
} else {
this.params[item.label] = item.value;
}
@@ -195,10 +226,17 @@ export default {
}
},
+ changeOtherChecked(value) {
+ this.originalValue = value;
+ },
+
changeOther(item) {
- console.log(this.show);
if (!this.show) {
- this.updateMedicine(item);
+ if (item.value === this.originalValue) {
+ this.originalValue = null;
+ } else {
+ this.updateMedicine(item);
+ }
} else {
this.params[item.label] = item.value;
}
@@ -233,28 +271,28 @@ export default {
switch (item.type) {
case 2: {
if (this.isShow && !item.value) {
- this.$t.ui.showToast(`请选择测评时间`);
+ this.$emit('showToast', 'default', '请选择测评时间', false);
isComplete = false;
}
break;
}
case 3: {
if (this.isShow && !item.value) {
- this.$t.ui.showToast(`请填写${item.name}`);
+ this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
}
break;
}
case 4: {
if (!item.value && !item.checked) {
- this.$t.ui.showToast(`请填写${item.name}`);
+ this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
}
break;
}
default: {
if (!item.value) {
- this.$t.ui.showToast(`请填写${item.name}`);
+ this.$emit('showToast', 'default', `请填写${item.name}`, false);
isComplete = false;
}
break;
@@ -356,6 +394,9 @@ export default {
try {
const params = { id: this.detail.id };
params[item.label] = item.value;
+ if (item.checked) {
+ params[item.label] = '未服用';
+ }
await this.$u.api.updateMedicine(params);
this.$emit('showToast', 'success', '修改成功');
} catch (error) {
diff --git a/src/pagesProject/project/project.vue b/src/pagesProject/project/project.vue
index 30b96bc..388d810 100644
--- a/src/pagesProject/project/project.vue
+++ b/src/pagesProject/project/project.vue
@@ -63,6 +63,7 @@ export default {
chooseItem: false,
showGuide: false,
isSetting: false, // 角色是设置
+ templateCode: '',
};
},
@@ -78,19 +79,37 @@ 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 {
- console.log('0002');
- this.init(options);
+ 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 {
+ console.log('0002');
+ this.shareWeixinInit(options);
+ // TODO: 判断用户第一次进来才会显示引导页
+ // this.queryGuide(options.code);
+ // this.init(options);
+ }
}
// 分享
- wx.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline'],
- });
+ // wx.showShareMenu({
+ // withShareTicket: true,
+ // menus: ['shareAppMessage', 'shareTimeline'],
+ // });
},
watch: {
@@ -100,7 +119,6 @@ export default {
* 永久日常任务不发生改变
*/
timeNode(val) {
- console.log('timeNode: ', val);
if (val && this.roleId) {
this.clearTasksData();
this.getGlobalData(); // 查可变日常任务
@@ -119,7 +137,7 @@ export default {
if (this.isSetting) return;
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);
}
},
@@ -140,8 +158,6 @@ export default {
this.$nextTick(async () => {
const system = uni.getSystemInfoSync();
this.height = system.windowHeight + 'px';
- // TODO: 判断用户第一次进来才会显示引导页
- await this.queryGuide();
});
},
@@ -151,6 +167,18 @@ export default {
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: {
...mapActions('user', ['getToken']),
...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']),
@@ -242,7 +270,7 @@ export default {
* @param {object} query getTasks传递的参数
*/
generateGetTaskParam(query) {
- const { roleId, timeNode, timeUnit, projectId, project } = this;
+ const { roleId, timeNode, timeUnit, projectId, templateCode } = this;
return {
roleId,
timeNode: query.timeNode || timeNode,
@@ -251,7 +279,7 @@ export default {
queryNum: 3,
queryType: query.queryType,
projectId,
- templateCode: project.templateCode,
+ templateCode: templateCode,
};
},
@@ -363,6 +391,7 @@ export default {
* @param {object | null} options
*/
async init(options) {
+ console.log('init options: ', options);
if (!this.token) {
// 不论有没有token都直接从userId获取token
// token有过期时间 从本地获取可能是过期 干脆直接从userId获取
@@ -384,17 +413,9 @@ export default {
}
// TODO
// 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获取角色列表
- 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
@@ -439,12 +481,13 @@ 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);
this.setProject(data);
- // 根据项目id获取角色列表
- this.getRoles(params);
} catch (error) {
- console.error('error: ', error || '获取项目信息失败');
+ console.error('通过项目id获取项目信息 error: ', error || '获取项目信息失败');
}
},
@@ -479,8 +522,8 @@ export default {
// 获取可变全局任务
getGlobalData() {
- const { roleId, timeNode, timeUnit, projectId } = this;
- const param = { roleId, timeNode, timeUnit, projectId };
+ const { roleId, timeNode, timeUnit, projectId, templateCode } = this;
+ const param = { roleId, timeNode, timeUnit, projectId, templateCode };
this.getGlobal(param);
},
@@ -500,9 +543,9 @@ export default {
* 查询是否显示引导页
* @param {object} templateCode 模板code
*/
- async queryGuide() {
+ async queryGuide(templateCode) {
try {
- const params = { templateCode: this.project.templateCode };
+ const params = { templateCode };
const data = await this.$u.api.queryGuide(params);
if (data.status === 0) {
this.showGuide = true;
@@ -518,7 +561,7 @@ export default {
*/
async quitGuide() {
try {
- const params = { templateCode: this.project.templateCode };
+ const params = { templateCode: this.templateCode };
await this.$u.api.updateGuide(params);
this.showGuide = false;
} catch (error) {
@@ -536,16 +579,15 @@ export default {
const data = await this.$u.api.familyIsMember(params);
console.log('data: ', data);
// 是 直接打开 否 询问是否成为家属
- if ((data.familyStatus === 1 || data.familyStatus === 2) && data.keyUserId) {
+ if (data.familyStatus === 2 && data.keyUserId) {
console.log('不是成员 询问是否成为家属');
const arr = [{ keyUserId: data.keyUserId, sex: data.sex, userName: data.userName }];
this.setElderlyInfo(arr);
this.showElder = true;
}
- // if (data.familyStatus === 1) {
- // console.log('是 直接打开');
- // this.init(options);
- // }
+ if (data.familyStatus === 1) {
+ console.log('是 直接打开');
+ }
if (data.familyStatus === 0) {
console.log('申请已提交,返回首页');
this.transferContent = '家属申请已提交,请等待审核';
diff --git a/src/pagesYanyuan/assess/assess.vue b/src/pagesYanyuan/assess/assess.vue
index cf0e1ae..ccb3486 100644
--- a/src/pagesYanyuan/assess/assess.vue
+++ b/src/pagesYanyuan/assess/assess.vue
@@ -159,13 +159,14 @@ export default {
backProject() {
this.setIsEvaluated(true);
- const { name, id, url } = this.project;
+ const { name, id, url, templateCode } = this.project;
url && (uni.$t.domain = url);
this.$u.route('/pagesProject/project/project', {
u: this.userId,
p: id,
pname: name,
url: encodeURIComponent(url),
+ code: templateCode,
});
},
},