Browse Source

fix: 多处bug修改

develop
song 4 years ago
parent
commit
48355814bb
  1. 3
      CHANGELOG.md
  2. 2
      rest/燕园.http
  3. 3
      src/apis/yanyuan.js
  4. 48
      src/components/Info/Info.vue
  5. 2
      src/config/yyInfo.js
  6. 2
      src/mixins/tool.js
  7. 2
      src/pages.json
  8. 12
      src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
  9. 11
      src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue
  10. 31
      src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue
  11. 12
      src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
  12. 30
      src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue
  13. 46
      src/pagesProject/project/components/NotEvaluated/NotEvaluated.vue
  14. 6
      src/pagesYanyuan/add-info/add-info.vue
  15. 17
      src/store/yanyuan/actions.js
  16. 9
      src/store/yanyuan/mutations.js
  17. 1
      src/store/yanyuan/state.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-12-16)
# 0.1.0 (2021-12-17)
### 🌟 新功能
范围|描述|commitId
@ -160,6 +160,7 @@
- | 修改添加基本信息 压缩代码 | [ce20ff7](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/ce20ff7)
- | 修改脑力测评+选项 展示问题 | [c0ccb4e](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c0ccb4e)
- | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a54c601)
- | 修改角色栏骨架屏 | [c18efb3](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c18efb3)
- | 切换到默认项目角色没有激活状态的bug | [438d448](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/438d448)
- | 切换日历时查询小红点 | [7091789](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7091789)
- | 初始展示角色修改 | [2ac4053](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/2ac4053)

2
rest/燕园.http

@ -121,7 +121,7 @@ Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"id":"2"
"id":"5"
}
}
###体验账号升级

3
src/apis/yanyuan.js

@ -29,6 +29,9 @@ const install = (Vue, vm) => {
vm.$u.api.getQuestion = param => vm.$u.post(`${yanyuan}/question/get`, param);
// 试题答案保存
vm.$u.api.saveAnswer = param => vm.$u.post(`${yanyuan}/question/saveAnswer`, param);
// 查询已经完成的试题编号
vm.$u.api.finishNum = param => vm.$u.post(`${yanyuan}/question/finish`, param);
// 选择工具
vm.$u.api.mentalTestCalculate = param => vm.$u.post(`${yanyuan}/mentalTest/calculate`, param);

48
src/components/Info/Info.vue

@ -329,6 +329,8 @@
v-model="colItem.show"
@change="changeVal($event, index, itemIndex)"
@backspace="backspace($event, index, itemIndex)"
@confirmText="confirmText(index, itemIndex)"
@cancelText="confirmText(index, itemIndex)"
></u-keyboard>
</view>
</view>
@ -347,7 +349,10 @@ import { infoList } from '@/config/yyInfo';
export default {
name: 'Info',
props: { personalInfo: { type: Object, default: () => {} } },
props: {
personalInfo: { type: Object, default: () => {} },
isEdit: { type: Boolean, default: false },
},
data() {
return {
@ -365,7 +370,6 @@ export default {
city: true,
area: false,
},
isEdit: false,
};
},
@ -381,22 +385,40 @@ export default {
},
},
watch: {
personalInfo(val) {
if (val && val.userName) {
this.setDate(val);
}
},
},
mounted() {
if (this.personalInfo && this.personalInfo.userName) {
this.setDate(this.personalInfo);
this.isEdit = true;
} else {
this.$nextTick(() => {
if (!this.isEdit) {
this.$emit('setEmptyInfo');
const info = this.$t.storage.getStorageSync('infoList');
if (info !== 'null') {
if (info !== 'null' && !this.isEdit) {
this.infoList = JSON.parse(info);
}
}
});
},
methods: {
changeVal(e, index, itemIndex) {
const info = this.infoList[index][itemIndex];
if (info.value === null) {
info.value = e.toString();
} else {
if (typeof e === 'number') {
const str = e.toString();
info.value += str;
} else {
info.value += e;
}
}
if (this.isEdit) {
this.updateTrainee(info);
}
@ -410,6 +432,10 @@ export default {
this.updateTrainee(info);
}
},
confirmText(index, itemIndex) {
const info = this.infoList[index][itemIndex];
info.show = false;
},
changeShow(index, itemIndex) {
this.infoList[index][itemIndex].show = !this.infoList[index][itemIndex].show;
@ -431,7 +457,7 @@ export default {
}
case 5: {
//
let checkerList = info.value;
let checkerList = info.value || [];
if (checkerList.length) {
const i = checkerList.findIndex(item => item === e.name || item.substring(0, 2) === e.name);
if (i < 0) {
@ -498,11 +524,11 @@ export default {
break;
}
}
this.$t.storage.setStorageSync('infoList', this.infoList);
if (this.isEdit) {
this.updateTrainee(info);
this.$t.storage.setStorageSync('infoList', null);
} else {
this.$t.storage.setStorageSync('infoList', this.infoList);
}
},

2
src/config/yyInfo.js

@ -542,7 +542,7 @@ export const careInfo = [
label: 'carePeriod',
showType: 2,
type: 4,
value: null,
value: '',
show: false,
placeholder: '请输入照顾时长(月)',
},

2
src/mixins/tool.js

@ -158,7 +158,7 @@ export default {
params = { keyUserIds: this.keyUserIds };
}
await this.$u.api.applyFamily(params);
this.transferContent = '申请已提交';
this.transferContent = '申请已提交,请等待审核';
} catch (error) {
console.error('error: ', error);
const msg = error.msg || '申请失败,稍后请重新申请';

2
src/pages.json

@ -40,7 +40,7 @@
{
"path": "add-info/add-info",
"style": {
"navigationBarTitleText": "基本信息",
"navigationBarTitleText": "长者信息",
"navigationStyle": "default"
}
},

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

@ -4,26 +4,26 @@
<view class="px-3 bg-white">
<view v-for="(item, index) in itemList" :key="index" :style="headStyle" class="py-3">
<!-- 头部 -->
<view class="w-full flex flex-row items-center justify-between" @click="changeOpen(index)">
<view class="flex flex-1 items-center">
<view class="w-full flex flex-row items-center justify-between">
<view class="flex flex-1 items-center" @click="changeOpen(index)">
<img class="w-5 h-5 mr-2" :src="item.img" alt="" />
{{ item.head }}
</view>
<view class="flex flex-row">
<view v-if="index === 0 && personalInfo && personalInfo.userName" class="text-gray-400 mr-2">
<view v-if="index === 0 && personalInfo && personalInfo.userName" class="text-gray-400 mr-2" @click="changeOpen(index)">
{{ personalInfo.userName }}
</view>
<view v-if="index === 1 || index === 2" class="mr-4">
<u-icon name="plus" @click="add(index)"></u-icon>
</view>
<u-icon name="arrow-up" v-if="item.open"></u-icon>
<u-icon name="arrow-down" v-else></u-icon>
<u-icon name="arrow-up" v-if="item.open" @click="changeOpen(index)"></u-icon>
<u-icon name="arrow-down" v-else @click="changeOpen(index)"></u-icon>
</view>
</view>
<!-- 内容区 -->
<view v-if="item.open" class="w-full mt-3">
<view style="border: 1px solid #e5e5e5" v-if="index === 0">
<Info :personalInfo="personalInfo" />
<Info :personalInfo="personalInfo" :isEdit="true" />
</view>
<Medicine @showToast="showToast" ref="medicineChild" v-if="index === 1" />
<Caregiver @showToast="showToast" ref="caregiverChild" v-if="index === 2" />

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

@ -1,7 +1,7 @@
<template>
<view>
<CaregiverDetail :detail="zaritDetail" :disabled="false" @showToast="showToast" v-if="show" @closeAdd="closeAdd" />
<view>
<view v-if="!loading">
<view v-for="(item, index) in itemList" :key="index" :style="headStyle" class="py-3">
<!-- 头部 -->
<view class="w-full flex flex-row items-center justify-between text-sm text-gray-500" @click="changeOpen(index)">
@ -25,16 +25,20 @@
</view>
</view>
</view>
<view v-else>
<skeleton :banner="false" :loading="true" :row="7" title="随访" animate class="my-2 u-line-2 skeleton"></skeleton>
</view>
</view>
</template>
<script>
import { mapState, mapGetters, mapMutations } from 'vuex';
import CaregiverDetail from './CaregiverDetail';
import Skeleton from '../../Skeleton/Skeleton';
export default {
name: 'Info',
components: { CaregiverDetail },
components: { CaregiverDetail, Skeleton },
data() {
return {
show: false,
@ -46,6 +50,7 @@ export default {
},
index: 0,
zaritDetail: null,
loading: false,
};
},
@ -112,8 +117,10 @@ export default {
*/
async queryZaritList() {
try {
this.loading = true;
const params = { projectId: this.projectId };
const date = await this.$u.api.queryZaritList(params);
this.loading = false;
if (!date.length) {
await this.queryZaritHistory();
} else {

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

@ -61,6 +61,8 @@
v-model="colItem.show"
@change="changeVal($event, index, itemIndex)"
@backspace="backspace($event, index, itemIndex)"
@confirmText="confirmText(index, itemIndex)"
@cancelText="confirmText(index, itemIndex)"
></u-keyboard>
</view>
<!-- input 文本输入框 -->
@ -83,8 +85,9 @@
</view>
</template>
</view>
<view class="p-4" v-if="!disabled">
<u-button type="primary" @click="submit">开始填表</u-button>
<view class="p-4">
<u-button type="primary" @click="submit(0)" v-if="!disabled">开始填表</u-button>
<u-button type="primary" @click="submit(1)" v-if="disabled && detail.zaritPoint === null">继续填表</u-button>
</view>
</view>
</template>
@ -129,7 +132,17 @@ export default {
changeVal(e, index, itemIndex) {
const info = this.careInfo[index][itemIndex];
if (info.value === null) {
info.value = e.toString();
} else {
if (typeof e === 'number') {
const str = e.toString();
info.value += str;
} else {
info.value += e;
}
}
},
// 退
backspace(e, index, itemIndex) {
@ -137,6 +150,10 @@ export default {
// value
if (info.value.length) info.value = info.value.substr(0, info.value.length - 1);
},
confirmText(index, itemIndex) {
const info = this.careInfo[index][itemIndex];
info.show = false;
},
changeShow(index, itemIndex) {
this.careInfo[index][itemIndex].show = !this.careInfo[index][itemIndex].show;
@ -147,6 +164,7 @@ export default {
switch (type) {
case 4: {
info.show = !info.show;
// info.value = '';
break;
}
case 99: {
@ -196,7 +214,7 @@ export default {
* 添加负担量表
* @param { Object } params
*/
async submit() {
async submit(type) {
try {
if (!this.validationRequired(this.params)) return;
const params = this.params;
@ -205,7 +223,7 @@ export default {
if (data) {
this.setReportId(data);
this.setCode('ZARIT');
await this.startAssess(data);
await this.startAssess(data, type);
}
} catch (error) {
console.error('error: ', error);
@ -256,9 +274,10 @@ export default {
* @param { number } num 题号
* @param { string } reportId 测评ID 脑力测评ID或zaritID
*/
async startAssess(id) {
async startAssess(id, type) {
console.log('type: ', type);
try {
const num = this.$t.storage.getStorageSync('ZARITNum');
let num = 0;
const params = {
code: 'ZARIT',
reportId: id,

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

@ -1,7 +1,7 @@
<template>
<view>
<MedicineDetail :detail="detail" @showToast="showToast" v-if="show" @closeAdd="closeAdd" />
<view>
<view v-if="!loading">
<view v-for="(item, index) in itemList" :key="index" :style="headStyle" class="py-3">
<!-- 头部 -->
<view class="w-full flex flex-row items-center justify-between text-sm text-gray-500" @click="changeOpen(index)">
@ -19,16 +19,21 @@
</view>
</view>
</view>
<view v-else>
<skeleton :banner="false" :loading="true" :row="5" title="随访" animate class="my-2 u-line-2 skeleton"></skeleton>
<skeleton :banner="false" :loading="true" :row="5" title="随访" animate class="my-2 u-line-2 skeleton"></skeleton>
</view>
</view>
</template>
<script>
import { mapGetters } from 'vuex';
import MedicineDetail from './MedicineDetail';
import Skeleton from '../../Skeleton/Skeleton';
export default {
name: 'Info',
components: { MedicineDetail },
components: { MedicineDetail, Skeleton },
data() {
return {
show: false,
@ -40,6 +45,7 @@ export default {
},
detail: null,
index: 0,
loading: false,
};
},
@ -92,8 +98,10 @@ export default {
*/
async queryMedicine() {
try {
this.loading = true;
const params = { projectId: this.projectId };
const date = await this.$u.api.queryMedicine(params);
this.loading = false;
if (!date.length) {
this.show = true;
} else {

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

@ -1,5 +1,6 @@
<template>
<view style="border: 1px solid #e5e5e5">
<view>
<view v-for="(item, index) in medicineInfo" :key="index">
<view class="pl-4 py-3 font-bold border-b">{{ item.title }}</view>
<template v-for="(colItem, itemIndex) in item.date">
@ -23,7 +24,7 @@
<view v-if="colItem.chooseTime">
<view @click="changeShow(index, itemIndex)">
<text :class="colItem.value ? '' : 'text-gray-350'">{{ colItem.value || '请选择' }} </text>
<u-icon name="arrow-right" class="mx-2" color="#909399"></u-icon>
<u-icon name="arrow-right" class="ml-2" color="#909399"></u-icon>
</view>
<u-picker
@confirm="change($event, index, itemIndex, colItem.type)"
@ -82,6 +83,7 @@
<u-button type="primary" @click="addMedicine" v-if="!detail || !detail.id">添加</u-button>
</view>
</view>
</view>
</template>
<script>
@ -246,19 +248,19 @@ export default {
break;
}
}
if (!isComplete) {
return;
}
if (!this.otherName.value) {
this.$t.ui.showToast(`请填写${this.otherName.name}`);
isComplete = false;
return;
}
if (!this.otherMedicine.value) {
this.$t.ui.showToast(`请填写${this.otherMedicine.name}`);
isComplete = false;
return;
}
// if (!isComplete) {
// return;
// }
// if (!this.otherName.value) {
// this.$t.ui.showToast(`${this.otherName.name}`);
// isComplete = false;
// return;
// }
// if (!this.otherMedicine.value) {
// this.$t.ui.showToast(`${this.otherMedicine.name}`);
// isComplete = false;
// return;
// }
if (isComplete) return true;
},

46
src/pagesProject/project/components/NotEvaluated/NotEvaluated.vue

@ -5,8 +5,8 @@
{{ task.description }}
</view>
<view v-if="task.data.type === 0 && task.data.mentalTest.finishStatus === 0">
<view class="flex flex-nowrap my-2">
<u-button type="primary" class="mx-0" @click="startAssess">开始测评</u-button>
<view class="flex flex-nowrap my-2" v-if="task.data.mentalTest.finishStatus !== 2">
<u-button type="primary" class="mx-0" @click="handleFinishNum">开始测评</u-button>
<view class="flex-1"></view>
</view>
<text class="text-xs text-gray-300">每两个周可进行一次测评</text>
@ -23,32 +23,54 @@ export default {
computed: mapGetters('project', ['projectId']),
methods: {
...mapActions('yanyuan', ['handleQuestion']),
...mapActions('yanyuan', ['handleQuestion', 'getFinishNum']),
...mapMutations('yanyuan', ['setCode']),
...mapMutations('task', ['setTask']),
/**
* 开始测评 试题查询
* 查询已经完成的试题编号
* @param { string } code 题目code NLCP:脑力测评 ZARIT:照顾者负担量表
* @param { number } num 题号
* @param { string } reportId 测评ID 脑力测评ID或zaritID
*/
async startAssess() {
async handleFinishNum() {
try {
const { task } = this;
this.setTask(task);
this.setCode('NLCP');
const arr = this.$t.storage.getStorageSync('NLCPNum').split('+');
console.log('arr: ', arr);
const pid = arr[0];
const num = pid === this.projectId ? arr[1] : 0;
const params = {
code: 'NLCP',
reportId: task.id,
};
const data = await this.getFinishNum(params);
this.startAssess(data);
} catch (error) {
console.error('error: ', error);
}
},
/**
* 开始测评 试题查询
* @param { string } code 题目code NLCP:脑力测评 ZARIT:照顾者负担量表
* @param { number } num 题号
* @param { string } reportId 测评ID 脑力测评ID或zaritID
*/
async startAssess(data) {
try {
let num = 0;
if (data.finishNum) {
if (data.finishNum - 0 < data.totalNum - 0) {
num = data.finishNum - 0 + 1;
}
if (data.finishNum - 0 === data.totalNum - 0) {
num = data.finishNum - 0;
}
}
const { task } = this;
const params = {
code: 'NLCP',
reportId: task.id,
num: num ? num - 0 + 1 : 1,
num,
};
console.log('params: ', params);
await this.handleQuestion(params);
uni.navigateTo({ url: '/pagesYanyuan/assess/assess' });
} catch (error) {

6
src/pagesYanyuan/add-info/add-info.vue

@ -1,7 +1,7 @@
<template>
<view>
<u-top-tips ref="uTips" type="success"></u-top-tips>
<Info class="bg-white" @submit="submit" />
<Info class="bg-white" @submit="submit" @setEmptyInfo="setEmptyInfo" />
<view class="w-full bg text-gray-200 text-center pt-4 pb-12">----------我也是有底线的----------</view>
</view>
@ -56,7 +56,9 @@ export default {
this.infoList.forEach(info => {
info.forEach(item => {
item.value = null;
if (item.show) {
if (item.showType === 1) {
item.show = true;
} else {
item.show = false;
}
if (item.otherValue) {

17
src/store/yanyuan/actions.js

@ -52,13 +52,28 @@ const actions = {
async handleQuestion({ commit }, params) {
try {
const data = await uni.$u.api.getQuestion(params);
console.log('试题查询data: ', data);
commit('setQuestionInfo', data);
return data;
} catch (error) {
console.error('error: ', error);
}
},
/**
* 查询已经完成的试题编号
* @param { string } code 题目code NLCP:脑力测评 ZARIT:照顾者负担量表
* @param { string } reportId 测评ID 脑力测评ID或zaritID
*/
async getFinishNum({ commit }, params) {
try {
const data = await uni.$u.api.finishNum(params);
console.log('已经完成的试题编号: ', data);
commit('setTestNumber', data);
return data;
} catch (error) {
console.error('error: ', error);
}
},
};
export default actions;

9
src/store/yanyuan/mutations.js

@ -151,6 +151,15 @@ const mutations = {
setToolCode(state, data) {
state.toolCode = data;
},
/**
* 设置二维码携带的工具箱code
* @param {object} state
* @param {object} data
*/
setTestNumber(state, data) {
state.testNumber = data;
},
};
export default mutations;

1
src/store/yanyuan/state.js

@ -17,6 +17,7 @@ const state = {
identityInfo: null, // 首页用户身份
enterByCode: false, // 是不是通过扫码进入
toolCode: '', // 二维码携带的工具箱code
testNumber: 0, // 已经完成的试题编号
};
export default state;

Loading…
Cancel
Save