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 范围|描述|commitId
@ -160,6 +160,7 @@
- | 修改添加基本信息 压缩代码 | [ce20ff7](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/ce20ff7) - | 修改添加基本信息 压缩代码 | [ce20ff7](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/ce20ff7)
- | 修改脑力测评+选项 展示问题 | [c0ccb4e](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c0ccb4e) - | 修改脑力测评+选项 展示问题 | [c0ccb4e](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c0ccb4e)
- | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a54c601) - | 修改角色栏组件 | [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) - | 切换到默认项目角色没有激活状态的bug | [438d448](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/438d448)
- | 切换日历时查询小红点 | [7091789](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7091789) - | 切换日历时查询小红点 | [7091789](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7091789)
- | 初始展示角色修改 | [2ac4053](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/2ac4053) - | 初始展示角色修改 | [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":{ "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.getQuestion = param => vm.$u.post(`${yanyuan}/question/get`, param);
// 试题答案保存 // 试题答案保存
vm.$u.api.saveAnswer = param => vm.$u.post(`${yanyuan}/question/saveAnswer`, 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); 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" v-model="colItem.show"
@change="changeVal($event, index, itemIndex)" @change="changeVal($event, index, itemIndex)"
@backspace="backspace($event, index, itemIndex)" @backspace="backspace($event, index, itemIndex)"
@confirmText="confirmText(index, itemIndex)"
@cancelText="confirmText(index, itemIndex)"
></u-keyboard> ></u-keyboard>
</view> </view>
</view> </view>
@ -347,7 +349,10 @@ import { infoList } from '@/config/yyInfo';
export default { export default {
name: 'Info', name: 'Info',
props: { personalInfo: { type: Object, default: () => {} } }, props: {
personalInfo: { type: Object, default: () => {} },
isEdit: { type: Boolean, default: false },
},
data() { data() {
return { return {
@ -365,7 +370,6 @@ export default {
city: true, city: true,
area: false, area: false,
}, },
isEdit: false,
}; };
}, },
@ -381,22 +385,40 @@ export default {
}, },
}, },
watch: {
personalInfo(val) {
if (val && val.userName) {
this.setDate(val);
}
},
},
mounted() { mounted() {
if (this.personalInfo && this.personalInfo.userName) { this.$nextTick(() => {
this.setDate(this.personalInfo); if (!this.isEdit) {
this.isEdit = true; this.$emit('setEmptyInfo');
} else {
const info = this.$t.storage.getStorageSync('infoList'); const info = this.$t.storage.getStorageSync('infoList');
if (info !== 'null') { if (info !== 'null' && !this.isEdit) {
this.infoList = JSON.parse(info); this.infoList = JSON.parse(info);
} }
} }
});
}, },
methods: { methods: {
changeVal(e, index, itemIndex) { changeVal(e, index, itemIndex) {
const info = this.infoList[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; info.value += e;
}
}
if (this.isEdit) { if (this.isEdit) {
this.updateTrainee(info); this.updateTrainee(info);
} }
@ -410,6 +432,10 @@ export default {
this.updateTrainee(info); this.updateTrainee(info);
} }
}, },
confirmText(index, itemIndex) {
const info = this.infoList[index][itemIndex];
info.show = false;
},
changeShow(index, itemIndex) { changeShow(index, itemIndex) {
this.infoList[index][itemIndex].show = !this.infoList[index][itemIndex].show; this.infoList[index][itemIndex].show = !this.infoList[index][itemIndex].show;
@ -431,7 +457,7 @@ export default {
} }
case 5: { case 5: {
// //
let checkerList = info.value; let checkerList = info.value || [];
if (checkerList.length) { if (checkerList.length) {
const i = checkerList.findIndex(item => item === e.name || item.substring(0, 2) === e.name); const i = checkerList.findIndex(item => item === e.name || item.substring(0, 2) === e.name);
if (i < 0) { if (i < 0) {
@ -498,11 +524,11 @@ export default {
break; break;
} }
} }
this.$t.storage.setStorageSync('infoList', this.infoList);
if (this.isEdit) { if (this.isEdit) {
this.updateTrainee(info); 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', label: 'carePeriod',
showType: 2, showType: 2,
type: 4, type: 4,
value: null, value: '',
show: false, show: false,
placeholder: '请输入照顾时长(月)', placeholder: '请输入照顾时长(月)',
}, },

2
src/mixins/tool.js

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

2
src/pages.json

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

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

@ -4,26 +4,26 @@
<view class="px-3 bg-white"> <view class="px-3 bg-white">
<view v-for="(item, index) in itemList" :key="index" :style="headStyle" class="py-3"> <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="w-full flex flex-row items-center justify-between">
<view class="flex flex-1 items-center"> <view class="flex flex-1 items-center" @click="changeOpen(index)">
<img class="w-5 h-5 mr-2" :src="item.img" alt="" /> <img class="w-5 h-5 mr-2" :src="item.img" alt="" />
{{ item.head }} {{ item.head }}
</view> </view>
<view class="flex flex-row"> <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 }} {{ personalInfo.userName }}
</view> </view>
<view v-if="index === 1 || index === 2" class="mr-4"> <view v-if="index === 1 || index === 2" class="mr-4">
<u-icon name="plus" @click="add(index)"></u-icon> <u-icon name="plus" @click="add(index)"></u-icon>
</view> </view>
<u-icon name="arrow-up" v-if="item.open"></u-icon> <u-icon name="arrow-up" v-if="item.open" @click="changeOpen(index)"></u-icon>
<u-icon name="arrow-down" v-else></u-icon> <u-icon name="arrow-down" v-else @click="changeOpen(index)"></u-icon>
</view> </view>
</view> </view>
<!-- 内容区 --> <!-- 内容区 -->
<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" /> <Info :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" />

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

@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<CaregiverDetail :detail="zaritDetail" :disabled="false" @showToast="showToast" v-if="show" @closeAdd="closeAdd" /> <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 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)"> <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>
</view> </view>
<view v-else>
<skeleton :banner="false" :loading="true" :row="7" title="随访" animate class="my-2 u-line-2 skeleton"></skeleton>
</view>
</view> </view>
</template> </template>
<script> <script>
import { mapState, mapGetters, mapMutations } from 'vuex'; import { mapState, mapGetters, mapMutations } from 'vuex';
import CaregiverDetail from './CaregiverDetail'; import CaregiverDetail from './CaregiverDetail';
import Skeleton from '../../Skeleton/Skeleton';
export default { export default {
name: 'Info', name: 'Info',
components: { CaregiverDetail }, components: { CaregiverDetail, Skeleton },
data() { data() {
return { return {
show: false, show: false,
@ -46,6 +50,7 @@ export default {
}, },
index: 0, index: 0,
zaritDetail: null, zaritDetail: null,
loading: false,
}; };
}, },
@ -112,8 +117,10 @@ export default {
*/ */
async queryZaritList() { async queryZaritList() {
try { try {
this.loading = true;
const params = { projectId: this.projectId }; const params = { projectId: this.projectId };
const date = await this.$u.api.queryZaritList(params); const date = await this.$u.api.queryZaritList(params);
this.loading = false;
if (!date.length) { if (!date.length) {
await this.queryZaritHistory(); await this.queryZaritHistory();
} else { } else {

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

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

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

@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<MedicineDetail :detail="detail" @showToast="showToast" v-if="show" @closeAdd="closeAdd" /> <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 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)"> <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>
</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> </view>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import MedicineDetail from './MedicineDetail'; import MedicineDetail from './MedicineDetail';
import Skeleton from '../../Skeleton/Skeleton';
export default { export default {
name: 'Info', name: 'Info',
components: { MedicineDetail }, components: { MedicineDetail, Skeleton },
data() { data() {
return { return {
show: false, show: false,
@ -40,6 +45,7 @@ export default {
}, },
detail: null, detail: null,
index: 0, index: 0,
loading: false,
}; };
}, },
@ -92,8 +98,10 @@ export default {
*/ */
async queryMedicine() { async queryMedicine() {
try { try {
this.loading = true;
const params = { projectId: this.projectId }; const params = { projectId: this.projectId };
const date = await this.$u.api.queryMedicine(params); const date = await this.$u.api.queryMedicine(params);
this.loading = false;
if (!date.length) { if (!date.length) {
this.show = true; this.show = true;
} else { } else {

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

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

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

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

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

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

17
src/store/yanyuan/actions.js

@ -52,13 +52,28 @@ const actions = {
async handleQuestion({ commit }, params) { async handleQuestion({ commit }, params) {
try { try {
const data = await uni.$u.api.getQuestion(params); const data = await uni.$u.api.getQuestion(params);
console.log('试题查询data: ', data);
commit('setQuestionInfo', data); commit('setQuestionInfo', data);
return data; return data;
} catch (error) { } catch (error) {
console.error('error: ', 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; export default actions;

9
src/store/yanyuan/mutations.js

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

1
src/store/yanyuan/state.js

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

Loading…
Cancel
Save