Browse Source

fix: 解决部分bug

develop
song 4 years ago
parent
commit
067bd0b069
  1. 1
      CHANGELOG.md
  2. 8
      src/App.vue
  3. 2
      src/apis/tall.js
  4. 4
      src/apis/yanyuan.js
  5. 154
      src/components/Info/Info.vue
  6. 39
      src/config/yyInfo.js
  7. 34
      src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
  8. 1
      src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue
  9. 2
      src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue
  10. 2
      src/pagesProject/project/components/Evaluated/EvaluatedXLJH.vue
  11. 4
      src/pagesProject/project/components/Evaluated/components/UCharts.vue
  12. 28
      src/pagesUser/git-phone-power/git-phone-power.vue
  13. 6
      src/pagesUser/phone-bind/phone-bind.vue
  14. 2
      src/pagesYanyuan/add-info/add-info.vue
  15. 8
      src/pagesYanyuan/assess/assess.vue
  16. 16
      src/pagesYanyuan/assess/components/Test/components/TestMain.vue
  17. 19
      src/pagesYanyuan/assess/components/Test/components/TitlePosition.vue

1
CHANGELOG.md

@ -36,6 +36,7 @@
- | 填写用户信息调接口 | [a8f8267](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a8f8267)
- | 字体大小更改 | [82cfdd4](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/82cfdd4)
- | 存token | [b8a178d](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/b8a178d)
- | 完善家属成员接口 | [dcd8110](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/dcd8110)
- | 定期任务面板骨架屏添加 | [b2698c0](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/b2698c0)
富文本插件 | 富文本插件demo测试 | [ed3d644](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/ed3d644)
- | 对接测评相关api | [21451e0](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/21451e0)

8
src/App.vue

@ -25,7 +25,7 @@ export default {
this.$t.ui.showToast('缺少用户信息参数');
} else {
const data = await this.getToken(options.query.u);
this.noPhone(data.phone);
this.noPhone(data);
}
}
/* #endif */
@ -50,7 +50,7 @@ export default {
if (data && data.token) {
this.setUser(data);
this.setToken(data.token);
this.noPhone(data.phone);
this.noPhone(data);
} else {
this.$t.ui.showToast('返回数据异常');
}
@ -64,8 +64,8 @@ export default {
* 没有手机号 跳转绑定手机号的界面
* @param {string} phone
*/
async noPhone(phone) {
if (!phone) {
async noPhone(data) {
if (!data.wxInfo || !data.wxInfo.nickname || !data.phone) {
this.$u.route('/pagesUser/git-phone-power/git-phone-power');
}
},

2
src/apis/tall.js

@ -28,6 +28,8 @@ const install = (Vue, vm) => {
vm.$u.api.getSmsCode = params => vm.$u.get(`${tall}/users/smscode`, params);
// 根据userId获取token
vm.$u.api.getToken = userId => vm.$u.get(`${tall}/users/userId`, { userId });
// 绑定手机号(不用验证码)
vm.$u.api.bindPhone = params => vm.$u.http.post(`${tall}/users/bindingNoCode`, params);
// 绑定手机号
vm.$u.api.phoneBind = (phone, smsCode) => vm.$u.http.post(`${tall}/users/binding`, { phone, smsCode });
// 是否合并账号

4
src/apis/yanyuan.js

@ -14,6 +14,10 @@ const install = (Vue, vm) => {
vm.$u.api.relationTrainee = param => vm.$u.post(`${yanyuan}/trainee/relation`, param);
// 体验账号升级
vm.$u.api.upgradeTrainee = param => vm.$u.post(`${yanyuan}/trainee/upgrade`, param);
// 查询用户信息
vm.$u.api.queryTrainee = param => vm.$u.post(`${yanyuan}/trainee/query`, param);
// 修改用户信息
vm.$u.api.updateTrainee = param => vm.$u.post(`${yanyuan}/trainee/update`, param);
// 绑定工具箱
vm.$u.api.bindTool = param => vm.$u.post(`${yanyuan}/tool/bind`, param);

154
src/components/Info/Info.vue

@ -217,6 +217,20 @@
</u-radio-group>
</view>
</view>
<!-- 单选 有id -->
<view v-if="colItem.type === 14">
<u-radio-group v-model="colItem.value">
<u-radio
class="mb-2"
@change="change($event, index, itemIndex, colItem.type)"
v-for="(radioItem, radioIndex) in colItem.radioList"
:key="radioIndex"
:name="radioItem.id"
>
{{ radioItem.value }}
</u-radio>
</u-radio-group>
</view>
</view>
</view>
<view v-else :key="itemIndex" class="flex justify-between items-center text-sm border-b">
@ -322,19 +336,15 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { infoList } from '@/config/yyInfo';
export default {
name: 'Info',
props: { personalInfo: { type: Object, default: null } },
data() {
return {
headStyle: {
backgroundColor: '#fff',
height: '46px',
paddingLeft: '1rem',
fontSize: '0.875rem',
},
bodyStyle: { paddingLeft: '1rem' },
infoList,
paramsDay: {
year: true,
@ -357,9 +367,19 @@ export default {
city: true,
area: false,
},
isEdit: false,
};
},
computed: mapGetters('project', ['projectId']),
mounted() {
if (this.personalInfo && this.personalInfo.userName) {
this.setDate(this.personalInfo);
this.isEdit = true;
}
},
methods: {
changeShow(index, itemIndex) {
this.infoList[index][itemIndex].show = !this.infoList[index][itemIndex].show;
@ -381,7 +401,9 @@ export default {
}
case 5: {
//
console.log('e: ', e);
let checkerList = info.value;
console.log('checkerList: ', checkerList);
if (checkerList.length) {
const i = checkerList.findIndex(item => item === e.name);
if (i < 0) {
@ -426,15 +448,15 @@ export default {
}
default: {
info.value = e;
if (e === '否' || e === '未知' || e === '素菜') {
info.value = 0;
}
if (e === '是' || e === '男' || e === '荤菜') {
info.value = 1;
}
if (e === '女' || e === '不知道') {
info.value = 2;
}
// if (e === '' || e === '' || e === '') {
// info.value = 0;
// }
// if (e === '' || e === '' || e === '') {
// info.value = 1;
// }
// if (e === '' || e === '') {
// info.value = 2;
// }
if (type === 1) {
if (e === '其他') {
info.showOther = true;
@ -455,8 +477,11 @@ export default {
break;
}
}
console.log('info++: ', info);
this.$emit('saveInfo', info);
if (!this.isEdit) {
this.$emit('saveInfo', info);
} else {
this.updateTrainee(info);
}
},
changeInput(e, index, itemIndex, type) {
@ -505,6 +530,99 @@ export default {
}
}
},
//
setDate(date) {
if (!date || !date.userName) return;
const { infoList } = this;
for (let i = 0; i < infoList.length; i++) {
const info = infoList[i];
for (let j = 0; j < info.length; j++) {
const item = info[j];
item.value = date[item.label];
if (item.label === 'jobTitle' || item.label === 'educateStatus' || item.label === 'diagnoseResult') {
const list = item.radioList.find(i => i === date[item.label]);
if (!list) {
item.value = '其他';
item.otherValue = date[item.label];
item.showOther = true;
} else {
item.showOther = false;
}
}
if (item.type === 5) {
const array = date[item.label].split(',');
console.log('array: ', array);
item.value = array;
for (let i = 0; i < item.checkList.length; i++) {
const A = item.checkList[i];
for (let j = 0; j < array.length; j++) {
const arr = array[j];
if (A.name === arr) {
A.checked = true;
}
}
}
}
if (item.type === 7) {
item.value = date.minBloodPressure + '/' + date.maxBloodPressure;
}
}
}
},
/**
* 修改用户信息
*/
async updateTrainee(item) {
try {
console.log('item: ', item);
if (!this.validationRequired(item)) return;
const params = this.setParams(item);
await this.$u.api.updateTrainee(params);
this.$emit('showToast', 'success', `${item.name}修改成功`);
} catch (error) {
console.log('error: ', error);
this.$emit('showToast', 'error', `${item.name}修改失败`);
}
},
//
validationRequired(item) {
if (item.showOther && !item.otherValue) {
this.$t.ui.showToast(`请填写其他${item.name}`);
return;
}
return true;
},
//
setParams(item) {
let params = {};
params.projectId = this.projectId;
params[item.label] = item.value;
//
if (item.value === '其他' && item.showOther && item.otherValue) {
params[item.label] = item.otherValue;
}
//
if (item.label === 'BloodPressure') {
const arr = item.value.split('/');
params.minBloodPressure = arr[0];
params.maxBloodPressure = arr[1];
}
//
if (item.showType === 1 && item.type === 5) {
let arrValue = '';
if (item.showOther && item.otherValue) {
const index = item.value.indexOf('其他');
item.value.splice(index, 1, '其他:' + item.otherValue);
}
arrValue = item.value.toString();
params[item.label] = arrValue;
}
return params;
},
},
};
</script>

39
src/config/yyInfo.js

@ -14,7 +14,7 @@ const bloodPressure = () => {
/**
* 基本信息
* 展示类型: showType: 1 标题+折叠, 2 直接展示
* 试题类型, type:1 单选,2 日期(年月日),3 数字输入框,4 单列下拉框,5 多选,6 日期(年月日时),7 多列下拉选框, 8 文本输入框, 9 多列地区选择, 11 吸烟11 饮酒12 饮茶, 13 失眠, 99 其他
* 试题类型, type:1 单选,2 日期(年月日),3 数字输入框,4 单列下拉框,5 多选,6 日期(年月日时),7 多列下拉选框, 8 文本输入框, 9 多列地区选择, 11 吸烟11 饮酒12 饮茶, 13 失眠, 14 有id的单选 99 其他
*/
export const infoList = [
[
@ -30,8 +30,12 @@ export const infoList = [
name: '性别',
label: 'sex',
showType: 1,
type: 1,
radioList: ['男', '女', '未知'],
type: 14,
radioList: [
{ id: 1, value: '男' },
{ id: 2, value: '女' },
{ id: 0, value: '未知' },
],
value: null,
show: false,
},
@ -193,8 +197,12 @@ export const infoList = [
name: 'APOE基因',
label: 'apoeGene',
showType: 1,
type: 1,
radioList: ['是', '否', '不知道'],
type: 14,
radioList: [
{ id: '0', value: '否' },
{ id: '1', value: '是' },
{ id: '2', value: '不知道' },
],
value: '否',
show: false,
},
@ -303,8 +311,11 @@ export const infoList = [
name: '饮食是否重口',
label: 'isStrongFlavour',
showType: 1,
type: 1,
radioList: ['是', '否'],
type: 14,
radioList: [
{ id: 0, value: '否' },
{ id: 1, value: '是' },
],
value: '否',
show: false,
},
@ -312,8 +323,11 @@ export const infoList = [
name: '饮食喜好',
label: 'isLikeMeat',
showType: 1,
type: 1,
radioList: ['素菜', '荤菜'],
type: 14,
radioList: [
{ id: 0, value: '素菜' },
{ id: 1, value: '荤菜' },
],
value: null,
show: false,
},
@ -321,8 +335,11 @@ export const infoList = [
name: '炒菜放油多少',
label: 'isMoreOil',
showType: 1,
type: 1,
radioList: ['是', '否'],
type: 14,
radioList: [
{ id: 0, value: '否' },
{ id: 1, value: '是' },
],
value: '否',
show: false,
},

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

@ -10,7 +10,9 @@
{{ item.head }}
</view>
<view class="flex flex-row">
<view v-if="index === 0" class="text-gray-400 mr-2">{{ patientName }}</view>
<view v-if="index === 0 && personalInfo && personalInfo.userName" class="text-gray-400 mr-2">
{{ personalInfo.userName }}
</view>
<view v-if="index === 1" class="mr-4">
<u-icon name="plus" @click="add(index)"></u-icon>
</view>
@ -21,7 +23,7 @@
<!-- 内容区 -->
<view v-if="item.open" class="w-full mt-3">
<view style="border: 1px solid #e5e5e5" v-if="index === 0">
<Info />
<Info :personalInfo="personalInfo" @showToast="showToast" />
</view>
<Medicine @showToast="showToast" ref="child" v-if="index === 1" />
<Caregiver @showToast="showToast" v-if="index === 2" />
@ -39,6 +41,7 @@
</template>
<script>
import { mapActions, mapGetters } from 'vuex';
import Medicine from './components/Medicine.vue';
import Caregiver from './components/Caregiver.vue';
import Family from './components/Family.vue';
@ -46,10 +49,11 @@ import Family from './components/Family.vue';
export default {
name: 'ConfigInfo',
components: { Medicine, Caregiver, Family },
data() {
return {
itemList: [
{ head: '基本信息', open: true, img: 'https://www.tall.wiki/staticrec/yanyuan/menu1.png' },
{ head: '基本信息', open: false, img: 'https://www.tall.wiki/staticrec/yanyuan/menu1.png' },
{ head: '药物使用记录', open: false, img: 'https://www.tall.wiki/staticrec/yanyuan/menu2.png' },
{ head: 'Zarit照顾者负担量表', open: false, img: 'https://www.tall.wiki/staticrec/yanyuan/menu3.png' },
{ head: '家属成员', open: false, img: 'https://www.tall.wiki/staticrec/yanyuan/menu4.png' },
@ -59,11 +63,19 @@ export default {
fontSize: '16px',
width: '100%',
},
patientName: '传小控',
personalInfo: null,
};
},
computed: mapGetters('project', ['projectId']),
async created() {
await this.handlePersonalInfo();
},
methods: {
...mapActions('yanyuan', ['getPersonalInfo']),
//
changeOpen(index) {
this.itemList.forEach((item, i) => {
@ -90,6 +102,20 @@ export default {
this.$refs.child[0].add();
}
},
/**
* 查询个人信息
*/
async handlePersonalInfo() {
try {
const params = { projectId: this.projectId };
const data = await this.$u.api.queryTrainee(params);
this.personalInfo = data;
this.itemList[0].open = true;
} catch (error) {
console.error('error: ', error);
}
},
},
};
</script>

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

@ -335,6 +335,7 @@ export default {
const params = { id: this.detail.id };
params[item.label] = item.value;
await this.$u.api.updateMedicine(params);
this.$emit('showToast', 'success', '修改成功');
} catch (error) {
console.error('error: ', error);
this.$emit('showToast', 'error', '修改失败');

2
src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue

@ -1,7 +1,7 @@
<template>
<view class="charts-box">
<view class="flex justify-between">
<text>{{ task.name }}</text>
<text class="font-bold">{{ task.name }}</text>
<u-icon name="arrow-up" color="#909399" v-if="task.data.showDetail" @click="changeShowState"></u-icon>
<u-icon name="arrow-down" color="#909399" v-else @click="changeShowState"></u-icon>
</view>

2
src/pagesProject/project/components/Evaluated/EvaluatedXLJH.vue

@ -10,7 +10,7 @@
:gutter="2"
active-color="#333"
></u-rate>
<text class="mx-2">{{ task.name }}</text>
<text class="mx-2 font-bold">{{ task.name }}</text>
<view
class="rounded-full w-max u-font-xs text-white px-2 items-center"
:class="

4
src/pagesProject/project/components/Evaluated/components/UCharts.vue

@ -85,8 +85,8 @@ export default {
radar: {
max: this.max, //
gridType: 'radar', //radarcircleradar
gridColor: '#eee',
labelColor: '#B9B9B9',
gridColor: '#ddd',
labelColor: '#a3a3a3',
},
},
});

28
src/pagesUser/git-phone-power/git-phone-power.vue

@ -48,6 +48,7 @@ export default {
//
mergePop: false,
showBindPnone: false,
phone: '',
};
},
@ -76,23 +77,27 @@ export default {
const params = {
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
miniType: 'basicCar',
miniType: 'yanyuan',
};
const data = await this.$u.api.bindPhone(params);
if (data && data.id) {
this.setUser(data);
this.setToken(data.token);
// const newUser = { ...this.user, phone: data.phone };
// this.setUser(newUser);
// setTimeout(() => uni.navigateBack({ delta: 2 }), 50);
// this.$u.route('pages/questionnaire-webview/questionnaire-webview', { u: this.userId });
this.$refs.uTips.show({
title: '绑定成功, 即将跳转',
type: 'success',
duration: '2000',
});
setTimeout(() => uni.redirectTo({ url: '/pages/index/index' }), 2000);
} else {
this.phone = data.phone;
}
} catch (error) {
console.log('error: ', error);
console.error('error: ', error);
if (error.code === 75) {
this.bindingPhone = true;
this.phone = error.data.phone;
}
}
} else {
@ -111,7 +116,7 @@ export default {
//
async isMerge(merge) {
try {
const data = await this.$u.api.phoneMerge(this.model.phone, merge);
const data = await this.$u.api.phoneMerge(this.phone, merge);
this.setUser(data);
this.setToken(data.token);
this.$refs.uTips.show({
@ -119,13 +124,10 @@ export default {
type: 'success',
duration: '3000',
});
setTimeout(() => uni.redirectTo({ url: '/pages/index/index' }), 2000);
setTimeout(() => uni.redirectTo({ url: '/pages/index/index' }), 3000);
} catch (error) {
this.$refs.uTips.show({
title: error.msg || '手机号合并失败',
type: 'error',
duration: '3000',
});
console.error('error: ', error);
this.$t.ui.showToast(error.msg || '手机号合并失败');
}
this.mergePop = false;
},

6
src/pagesUser/phone-bind/phone-bind.vue

@ -224,11 +224,7 @@ export default {
});
setTimeout(() => uni.redirectTo({ url: '/pages/index/index' }), 2000);
} catch (error) {
this.$refs.uTips.show({
title: error.msg || '手机号合并失败',
type: 'error',
duration: '3000',
});
this.$t.ui.showToast(error.msg || '手机号合并失败');
}
this.mergePop = false;
},

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

@ -24,7 +24,7 @@ export default {
//
saveInfo(info) {
//
this.params.apoeGene = 0;
this.params.apoeGene = '0';
this.params.isInsomnic = 0;
this.params.isSmoke = 0;
this.params.isDrink = 0;

8
src/pagesYanyuan/assess/assess.vue

@ -75,15 +75,19 @@ export default {
*/
async nextQuestion() {
try {
if (!this.optionId) {
this.$t.ui.showToast('您尚未选择答案,请先选择答案');
return;
}
this.$refs.child.openLoading();
const param = this.setParams();
await this.$u.api.saveAnswer(param);
await this.next();
this.$refs.child.closeLoading();
await this.next();
} catch (error) {
this.$refs.child.closeLoading();
console.error('error: ', error);
this.$t.ui.showToast(error.msg || '提交失败');
this.$refs.child.closeLoading();
}
},

16
src/pagesYanyuan/assess/components/Test/components/TestMain.vue

@ -1,6 +1,6 @@
<template>
<view class="grid gap-2">
<view v-for="(option, optionIndex) in options" :key="optionIndex" :class="[`row-span-${option.row}`]">
<view v-for="(option, optionIndex) in options" :key="optionIndex" :class="[`row-span-${option.row}`]" class="mb-2">
<u-radio-group v-model="value">
<u-radio
@change="radioChange"
@ -30,6 +30,20 @@ export default {
return { value: '' };
},
mounted() {
this.$nextTick(() => {
for (let i = 0; i < this.options.length; i++) {
const option = this.options[i];
const item = option.contents.find(item => item.chooseStatus === 1);
if (item) {
this.value = item.id;
this.setOptionId(this.value);
break;
}
}
});
},
methods: {
...mapMutations('yanyuan', ['setOptionId']),

19
src/pagesYanyuan/assess/components/Test/components/TitlePosition.vue

@ -1,11 +1,18 @@
<template>
<view class="grid" :class="item.contents.length > 4 ? 'grid-cols-3' : item.contents.length > 1 ? 'grid-cols-2' : ''">
<view v-for="(con, conIndex1) in item.contents" :key="conIndex1">
<view v-if="con.showType === 0">
{{ con.content }}
<view>
<view class="flex flex-col">
<view v-for="(con, conIndex1) in item.contents" :key="conIndex1">
<view v-if="con.showType === 0">
<view class="mb-2">{{ con.content }}</view>
</view>
</view>
<view v-if="con.showType === 1">
<img class="w-full" :src="con.content" />
</view>
<view class="grid" :class="item.contents.length > 4 ? 'grid-cols-3' : item.contents.length > 1 ? 'grid-cols-2' : ''">
<view v-for="(con, conIndex1) in item.contents" :key="conIndex1">
<view v-if="con.showType === 1">
<img class="w-full" style="height: 10rem" :src="con.content" />
</view>
</view>
</view>
</view>

Loading…
Cancel
Save