Browse Source

fix: 修改props默认值

develop
song 4 years ago
parent
commit
11b2c24f28
  1. 3
      CHANGELOG.md
  2. 66
      rest/燕园.http
  3. 14
      src/apis/yanyuan.js
  4. 6
      src/common/styles/tailwind.scss
  5. 2
      src/components/Info/Info.vue
  6. 2
      src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue
  7. 2
      src/pagesProject/project/components/ConfigInfo/components/FamilyDetail.vue
  8. 2
      src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue
  9. 2
      src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue
  10. 6
      src/pagesProject/project/components/Evaluated/EvaluatedXLJH.vue
  11. 2
      src/pagesProject/project/components/Evaluated/components/EvaluatedDetail.vue
  12. 2
      src/pagesProject/project/components/Evaluated/components/ProcessRestore.vue
  13. 26
      src/pagesProject/project/components/Evaluated/components/ResultLevel.vue
  14. 2
      src/pagesProject/project/components/NotEvaluated/NotEvaluated.vue
  15. 2
      src/pagesProject/project/components/TimeLine/component/TimeBoxIn.vue
  16. 2
      src/pagesProject/project/components/TimeLine/component/TimeBoxOut.vue
  17. 309
      src/pagesYanyuan/ascription/ascription.vue
  18. 74
      src/pagesYanyuan/ascription/components/ChooseTask.vue
  19. 188
      src/pagesYanyuan/ascription/components/ProcessRestore.vue
  20. 170
      src/pagesYanyuan/ascription/components/ResultLevel.vue
  21. 2
      src/pagesYanyuan/assess/components/Test/answerPage.vue
  22. 2
      src/pagesYanyuan/assess/components/Test/components/TitlePosition.vue
  23. 2
      src/pagesYanyuan/assess/components/Test/promptPage.vue
  24. 4
      src/pagesYanyuan/hold-all/hold-all.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-12-06)
# 0.1.0 (2021-12-07)
### 🌟 新功能
范围|描述|commitId
@ -44,6 +44,7 @@
- | 导入wbs | [1224fcb](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/1224fcb)
- | 导入项目,更新项目 | [5e06adf](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/5e06adf)
- | 导入项目后提示并打开项目详情页 | [410f527](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/410f527)
- | 工具箱接口对接 | [4c9c812](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4c9c812)
- | 引入dayjs | [29b8b93](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/29b8b93)
- | 提交到本地 | [9cbe411](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/9cbe411)
- | 插件参数处理调整 | [a3e68d3](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a3e68d3)

66
rest/燕园.http

@ -7,6 +7,7 @@
@type = content-type: application/json;charset=utf-8
### 登录
# song 1218763410024566784
# @name login
POST {{test_tall}}/users/signin
{{type}}
@ -221,7 +222,8 @@ Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"recordId": "1460549920452513798"
# "recordId": "1460549920427347968"
"recordId": "1460549920452513797"
}
}
@ -247,6 +249,16 @@ Authorization: Bearer {{login.response.body.$.data.token}}
"careId": "21"
}
}
###查询工具箱列表
POST {{test}}/tool/queryToolList
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
}
}
###选择工具箱
POST {{localhost}}/trainPlan/chooseTool
@ -296,6 +308,58 @@ Authorization: Bearer {{login.response.body.$.data.token}}
}
}
###查询无主的训练过程
POST {{test}}/trainBelong/queryUnknown
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"pageNum": 1,
"pageSize": 10
}
}
###查询关联的使用者信息
POST {{test}}/trainee/queryRelation
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
}
}
###查询指定日期前后一周的训练计划
POST {{test}}/trainPlan/queryRecent
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"keyUserId": 1464166326922383360,
"time": 1638773109000
}
}
###选择老人 (6,1) (3,0)
POST {{test}}/trainBelong/chooseRecord
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"trainRecordId": 3,
"resultType": 0,
"recordId": 1465510253751439362
}
}
### 导入题目
POST {{test}}/question/importQuestion
Authorization: Bearer {{login.response.body.$.data.token}}

14
src/apis/yanyuan.js

@ -18,6 +18,8 @@ const install = (Vue, vm) => {
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.queryRelation = param => vm.$u.post(`${yanyuan}/trainee/queryRelation`, param);
// 绑定工具箱
vm.$u.api.bindTool = param => vm.$u.post(`${yanyuan}/tool/bind`, param);
@ -36,9 +38,6 @@ const install = (Vue, vm) => {
// 选择工具
vm.$u.api.mentalTestCalculate = param => vm.$u.post(`${yanyuan}/mentalTest/calculate`, param);
// 试题答案保存
vm.$u.api.chooseTool = param => vm.$u.post(`${yanyuan}/trainPlan/chooseTool`, param);
// 添加药物使用
vm.$u.api.addMedicine = param => vm.$u.post(`${yanyuan}/medicine/add`, param);
// 查询药物使用
@ -57,8 +56,12 @@ const install = (Vue, vm) => {
// 查询家属成员列表
vm.$u.api.queryFamilyList = param => vm.$u.post(`${yanyuan}/family/queryList`, param);
// 试题答案保存
vm.$u.api.chooseTool = param => vm.$u.post(`${yanyuan}/trainPlan/chooseTool`, param);
// 查询训练计划详情
vm.$u.api.getTrainDetail = param => vm.$u.post(`${yanyuan}/trainPlan/detail`, param);
// 查询指定日期前后一周的训练计划
vm.$u.api.queryRecent = param => vm.$u.post(`${yanyuan}/trainPlan/queryRecent`, param);
// 添加负担量表
vm.$u.api.addZarit = param => vm.$u.post(`${yanyuan}/zarit/add`, param);
@ -73,6 +76,11 @@ const install = (Vue, vm) => {
vm.$u.api.queryGuide = param => vm.$u.post(`${yanyuan}/guide/query`, param);
// 修改引导页状态
vm.$u.api.updateGuide = param => vm.$u.post(`${yanyuan}/guide/update`, param);
// 选择老人
vm.$u.api.chooseRecord = param => vm.$u.post(`${yanyuan}/trainBelong/chooseRecord`, param);
// 查询无主的训练过程
vm.$u.api.queryUnknown = param => vm.$u.post(`${yanyuan}/trainBelong/queryUnknown`, param);
};
export default { install };

6
src/common/styles/tailwind.scss

@ -1126,12 +1126,6 @@
.h-screen {
height: 100vh;
}
.w-1 {
width: 0.25rem;
}
.w-2 {
width: 0.5rem;
}
.w-4 {
width: 1rem !important;
}

2
src/components/Info/Info.vue

@ -326,7 +326,7 @@ import { infoList } from '@/config/yyInfo';
export default {
name: 'Info',
props: { personalInfo: { type: Object, default: null } },
props: { personalInfo: { type: Object, default: () => {} } },
data() {
return {

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

@ -95,7 +95,7 @@ import { careInfo } from '@/config/yyInfo';
export default {
name: 'Info',
props: { detail: { type: Object, default: null }, disabled: { type: Boolean, default: false } },
props: { detail: { type: Object, default: () => {} }, disabled: { type: Boolean, default: false } },
data() {
return {

2
src/pagesProject/project/components/ConfigInfo/components/FamilyDetail.vue

@ -28,7 +28,7 @@ import { familyInfo } from '@/config/yyInfo';
export default {
name: 'Info',
props: { detail: { type: Object, default: null } },
props: { detail: { type: Object, default: () => {} } },
data() {
return { familyInfo };

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

@ -97,7 +97,7 @@ import { medicineInfo } from '@/config/yyInfo';
export default {
name: 'Info',
props: { detail: { type: Object, default: null } },
props: { detail: { type: Object, default: () => {} } },
data() {
return {

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

@ -49,7 +49,7 @@ import UCharts from './components/UCharts.vue';
export default {
components: { UCharts },
props: {
task: { type: Object, default: null },
task: { type: Object, default: () => {} },
taskId: { type: String, default: '' },
itemIndex: { type: Number, default: 0 },
},

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

@ -24,10 +24,10 @@
>
{{
Math.ceil(task.data.train.finishResult) === 1
? '非常困难'
? '轻松完成'
: Math.ceil(task.data.train.finishResult) === 2
? '略有困难'
: '轻松完成'
: '非常困难'
}}
轻松完成
</view>
@ -52,7 +52,7 @@ import EvaluatedDetail from './components/EvaluatedDetail';
export default {
components: { EvaluatedDetail },
props: {
task: { type: Object, default: null },
task: { type: Object, default: () => {} },
taskId: { type: String, default: '' },
itemIndex: { type: Number, default: 0 },
},

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

@ -56,7 +56,7 @@ import ProcessRestore from './ProcessRestore';
export default {
components: { ResultLevel, ProcessRestore },
props: { train: { type: Object, default: null }, task: { type: Object, default: null } },
props: { train: { type: Object, default: () => {} }, task: { type: Object, default: () => {} } },
data() {
return {
list: [

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

@ -6,7 +6,7 @@
<script>
export default {
props: { trainResult: { type: Object, default: null } },
props: { trainResult: { type: Object, default: () => {} } },
data() {
return {

26
src/pagesProject/project/components/Evaluated/components/ResultLevel.vue

@ -11,14 +11,14 @@
backgroundRepeat: 'no-repeat',
}"
>
{{ trains.finishResult === 1 ? '非常困难' : trains.finishResult === 2 ? '略有困难' : '轻松完成' }}
{{ trains.finishResult === 1 ? '轻松完成' : trains.finishResult === 2 ? '略有困难' : '非常困难' }}
</view>
<view v-for="i in levels" :key="i.value" class="flex-1" :class="i.value === 3 ? '' : 'box'">
<view class="w-full h-2" :class="i.checked ? level.boxBg : 'bg-gray-100'"></view>
</view>
</view>
<!-- 时间 -->
<view class="text-sm text-gray-400 flex flex-nowrap items-center mt-2" v-if="trains.finishTime">
<view class="text-sm text-gray-400 flex flex-nowrap items-center mt-2" v-if="trains.finishTime && showTime">
<view class="num mr-2 u-font-12">{{ resultIndex + 1 }}</view>
{{ $moment(trains.finishTime - 0).format('m分钟ss秒') }}
</view>
@ -27,7 +27,11 @@
<script>
export default {
props: { trains: { type: Object, default: null }, resultIndex: { type: Number, default: 0 } },
props: {
trains: { type: Object, default: () => {} },
resultIndex: { type: Number, default: 0 },
showTime: { type: Boolean, default: true },
},
data() {
return {
@ -102,10 +106,10 @@ export default {
setParam(type, value) {
const { level, width } = this;
if (type == 1) {
level.color = '#EB5A0D';
level.value = '非常困难';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-red.png';
level.boxBg = 'bg-red-500';
level.color = '#1890FF';
level.value = '轻松完成';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-blue.png';
level.boxBg = 'bg-blue-500';
}
if (type == 2) {
level.color = '#F4C130';
@ -114,10 +118,10 @@ export default {
level.boxBg = 'bg-yellow-500';
}
if (type == 3) {
level.color = '#1890FF';
level.value = '轻松完成';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-blue.png';
level.boxBg = 'bg-blue-500';
level.color = '#EB5A0D';
level.value = '非常困难';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-red.png';
level.boxBg = 'bg-red-500';
}
level.left = value * width + 'px';
},

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

@ -18,7 +18,7 @@
import { mapActions, mapMutations } from 'vuex';
export default {
props: { task: { type: Object, default: null } },
props: { task: { type: Object, default: () => {} } },
methods: {
...mapActions('yanyuan', ['handleQuestion']),

2
src/pagesProject/project/components/TimeLine/component/TimeBoxIn.vue

@ -73,7 +73,7 @@ export default {
props: {
task: {
type: Object,
default: null,
default: () => {},
},
taskId: {
type: String,

2
src/pagesProject/project/components/TimeLine/component/TimeBoxOut.vue

@ -69,7 +69,7 @@ export default {
props: {
task: {
type: Object,
default: null,
default: () => {},
},
taskIndex: {
type: Number,

309
src/pagesYanyuan/ascription/ascription.vue

@ -1,30 +1,24 @@
<template>
<view>
<view v-for="(list, index) in lists" :key="index">
<scroll-view
class="h-screen"
:lower-threshold="50"
:scroll-y="true"
:upper-threshold="50"
:scroll-top="scrollTop"
id="scroll"
@scrolltoupper="handleScrollTop"
@scrolltolower="handleScrollBottom"
>
<view class="w-full bg-gray text-gray-200 text-center py-4" v-if="toTop">----------已到顶部----------</view>
<view v-for="(list, index) in lists" :key="index" class="mb-4" :class="index !== lists.length - 1 ? ' border-b' : ''">
<view class="flex flex-col px-3 bg-white pb-4">
<text class="my-3">{{ list.title }}</text>
<img :src="list.img" class="w-full" />
<text class="py-3">训练结果</text>
<view class="flex flex-nowrap mt-10 rounded-3xl relative">
<view
class="bubble"
:style="{
left: list.position.left,
color: list.position.color,
backgroundImage: `url(${list.position.bgPic})`,
backgroundSize: '100% 100%',
backgroundRepeat: 'no-repeat',
}"
>
{{ list.position.value }}
</view>
<view v-for="i in list.levels" :key="i.value" class="flex-1" :class="i.value === 6 ? '' : 'box'">
<view
class="w-full h-2"
:class="i.checked ? list.position.boxBg : 'bg-gray-100'"
@click="chooseLevel($event, index, i.value)"
></view>
</view>
<view v-if="list.cardUrl" class="flex flex-col">
<text class="my-3">{{ list.cardType === 0 ? '迷宫' : '找不同' }}</text>
<ProcessRestore :trainResult="list" />
</view>
<view v-if="list.finishResult" class="flex flex-col">
<text class="my-3">训练结果</text>
<ResultLevel :finishResult="list.finishResult" />
</view>
</view>
<view class="flex flex-col px-3 bg-white mt-2">
@ -35,143 +29,158 @@
</view>
<view class="flex flex-wrap pb-3" v-if="list.showTrain">
<u-radio-group v-model="list.train" class="mr-1">
<u-radio class="mr-1" @change="radioChange" v-for="(item, trainIndex) in list.trainer" :key="trainIndex" :name="item">
{{ item }}
<u-radio
class="mr-1"
@change="radioChange($event, list.createTime, index)"
v-for="(item, trainIndex) in radios"
:key="trainIndex"
:name="item.keyUserId"
>
{{ item.userName }}{{ item.sex === 1 ? '(男)' : item.sex === 2 ? '(女)' : '(未知)' }}
</u-radio>
</u-radio-group>
</view>
</view>
<view class="flex flex-col px-3" v-if="list.showTask && list.showTrain && list.tasks.length">
<view class="py-3 flex justify-between">
训练计划
<u-button type="primary" size="mini" @click="chooseRecord(list.trainRecordId, list.resultType)">确定</u-button>
</view>
<ChooseTask :tasks="list.tasks" :time="list.createTime" :defaultId="defaultId" @changeDefaultId="changeDefaultId" />
</view>
</view>
<view class="w-full bg-gray text-gray-200 text-center pt-4 pb-12">----------我也是有底线的----------</view>
</view>
<view class="w-full bg-gray text-gray-200 text-center pt-4 pb-12" v-if="toEnd">----------我也是有底线的----------</view>
<view class="w-full bg-gray text-gray-200 text-center pt-4 pb-12" v-else>----------加载中----------</view>
</scroll-view>
</template>
<script>
import ResultLevel from './components/ResultLevel';
import ProcessRestore from './components/ProcessRestore';
import ChooseTask from './components/ChooseTask';
export default {
components: { ResultLevel, ProcessRestore, ChooseTask },
data() {
return {
lists: [
{
title: '迷宫',
img: 'https://www.tall.wiki/staticrec/yanyuan/1.png',
train: '',
showTrain: false,
trainer: ['张斌', '思南', '雪梅', '方圆', '张野', '马壮', '慧娟'],
levels: [
{
value: 1,
checked: false,
},
{
value: 2,
checked: false,
},
{
value: 3,
checked: false,
},
{
value: 4,
checked: false,
},
{
value: 5,
checked: false,
},
{
value: 6,
checked: false,
},
],
position: {
left: 0,
color: '#EDEDED',
value: '非常困难',
bgPic: 'https://www.tall.wiki/staticrec/yanyuan/bubble-gray.png',
boxBg: '',
},
},
{
title: '迷宫',
img: 'https://www.tall.wiki/staticrec/yanyuan/1.png',
train: '',
showTrain: false,
trainer: ['张斌', '思南', '雪梅', '方圆', '张野', '马壮', '慧娟'],
levels: [
{
value: 1,
checked: false,
},
{
value: 2,
checked: false,
},
{
value: 3,
checked: false,
},
{
value: 4,
checked: false,
},
{
value: 5,
checked: false,
},
{
value: 6,
checked: false,
},
],
position: {
left: 0,
color: '#EDEDED',
value: '非常困难',
bgPic: 'https://www.tall.wiki/staticrec/yanyuan/bubble-gray.png',
boxBg: '',
},
},
],
};
return { lists: [], radios: [], defaultId: '', scrollTop: 0, toTop: false, toEnd: false, pageNum: 1 };
},
created() {
this.queryUnknown();
this.queryRelation();
},
methods: {
chooseLevel(e, index, value) {
const position = this.lists[index].position;
position.left = e.target.offsetLeft + 'px';
console.log('value: ', value, 0 < value < 3);
if (value < 3) {
position.color = '#EB5A0D';
position.value = '非常困难';
position.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-red.png';
position.boxBg = 'bg-red-500';
} else if (value < 5) {
position.color = '#F4C130';
position.value = '略有困难';
position.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-yellow.png';
position.boxBg = 'bg-yellow-500';
} else {
position.color = '#1890FF';
position.value = '轻松完成';
position.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-blue.png';
position.boxBg = 'bg-blue-500';
}
async radioChange(e, time, index) {
await this.queryRecent(e, time, index);
},
changeShow(index) {
this.lists[index].showTrain = !this.lists[index].showTrain;
},
handleScrollTop() {
this.toTop = true;
},
async handleScrollBottom() {
if (this.toEnd) return;
this.pageNum += 1;
await this.queryUnknown();
},
this.lists[index].levels.forEach((line, i) => {
if (i < value) {
line.checked = true;
} else {
line.checked = false;
/**
* 查询无主的训练过程
* @param { Number } pageNum 页码
* @param { Number } pageSize 分页大小
*/
async queryUnknown() {
try {
const params = {
pageNum: this.pageNum,
pageSize: 10,
};
const data = await this.$u.api.queryUnknown(params);
if (!data.list || !data.list.length) {
this.toEnd = true;
return;
}
});
data.list.forEach(item => {
item.showTrain = false;
item.tasks = [];
item.showTask = false;
this.lists.push(item);
});
} catch (error) {
console.error('error: ', error);
}
},
radioChange(e) {
console.log(e);
/**
* 查询所有关联的用户信息
* @param { Number } pageNum 页码
* @param { Number } pageSize 分页大小
*/
async queryRelation() {
try {
const data = await this.$u.api.queryRelation();
this.radios = data;
} catch (error) {
console.error('error: ', error);
}
},
changeShow(index) {
this.lists[index].showTrain = !this.lists[index].showTrain;
/**
* 查询指定日期前后一周的训练计划
* @param { Number } pageNum 页码
* @param { Number } pageSize 分页大小
*/
async queryRecent(keyUserId, time, index) {
try {
const params = { keyUserId, time };
const data = await this.$u.api.queryRecent(params);
this.lists[index].tasks = data;
this.lists[index].showTask = true;
this.setDefaultValue(data, time);
} catch (error) {
console.error('error: ', error);
}
},
//
setDefaultValue(list, time) {
const T = this.$moment(time - 0).format('YYYY-MM-DD');
const currentTime = this.$moment(T).valueOf().toString();
const item = list.find(item => item.startTime === currentTime);
this.defaultId = item && item.recordId ? item.recordId : list[0].recordId;
},
//
changeDefaultId(id) {
this.defaultId = id;
},
/**
* 选择训练计划
* @param { Number } trainRecordId 训练结果id
* @param { Number } resultType 训练结果类型0:训练结果 1:过程记录
* @param { Number } recordId 训练计划ID
*/
async chooseRecord(trainRecordId, resultType) {
try {
const params = {
trainRecordId,
resultType,
recordId: this.defaultId,
};
await this.$u.api.chooseRecord(params);
this.$t.ui.showToast('提交成功');
const index = this.lists.findIndex(item => item.trainRecordId === trainRecordId);
this.lists.splice(index, 1);
} catch (error) {
console.error('error: ', error);
this.$t.ui.showToast(error.msg || '提交失败');
}
},
},
};
@ -182,20 +191,6 @@ page {
background-color: $uni-bg-color-grey;
}
.box {
margin-right: 2px;
}
.bubble {
position: absolute;
top: -40px;
width: 70px;
height: 30px;
line-height: 26px;
text-align: center;
font-size: 14px;
}
.bg-gray {
background-color: $uni-bg-color-grey;
}

74
src/pagesYanyuan/ascription/components/ChooseTask.vue

@ -0,0 +1,74 @@
<template>
<view v-if="list.length" class="flex flex-col">
<view
v-for="(item, index) in list"
:key="index"
class="flex flex-nowrap text-center p-2"
:class="item.checked ? 'bg-blue-500 text-white' : 'bg-gray-100'"
@click="changeChecked(index)"
>
<view class="flex-1 text-left">{{ item.content }} </view>
<view v-if="item.checked"><u-icon name="checkbox-mark"></u-icon></view>
</view>
</view>
</template>
<script>
export default {
name: 'ChooseTask',
props: { tasks: { type: Array, default: () => [] }, time: { type: String, default: '' }, defaultId: { type: String, default: '' } },
data() {
return { list: [], ids: [] };
},
watch: {
tasks(val) {
if (val) {
this.list = val;
}
},
defaultId(val) {
if (val) {
this.list.forEach(item => {
if (item.recordId === val) {
item.checked = true;
} else {
item.checked = false;
}
});
}
},
},
mounted() {
this.list = this.tasks;
this.list.forEach(item => {
if (item.recordId === this.defaultId) {
item.checked = true;
} else {
item.checked = false;
}
});
},
methods: {
// checkbox
changeChecked(index) {
let arr = [...this.list];
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
if (i === index) {
item.checked = true;
} else {
item.checked = false;
}
}
this.list = [...arr];
this.$emit('changeDefaultId', this.list[index].recordId);
},
},
};
</script>
<style lang="scss" scoped></style>

188
src/pagesYanyuan/ascription/components/ProcessRestore.vue

@ -0,0 +1,188 @@
<template>
<view class="canvas-box w-full">
<canvas style="width: 100%; height: 450px" canvas-id="firstCanvas"></canvas>
</view>
</template>
<script>
export default {
props: { trainResult: { type: Object, default: () => {} } },
data() {
return {
canvas: null,
context: null,
points: [],
timers: [],
width: '',
};
},
watch: {
trainResult(val) {
if (val) {
this.init();
}
},
},
mounted() {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query
.selectAll('.canvas-box')
.boundingClientRect(data => {
if (data && data.length) {
this.width = data[0].width;
this.init();
}
})
.exec();
});
},
methods: {
init() {
this.clearTimers();
this.initCanvas();
this.drawImage(this.width);
},
//
clearTimers() {
if (this.timers.length) {
this.timers.forEach(item => {
item && clearTimeout(item);
});
this.timers = [];
}
},
// canvas ctx
initCanvas() {
this.canvas = this.$refs['reduceCanvas'];
this.context = uni.createCanvasContext('firstCanvas', this);
},
//
drawImage(width) {
const { context } = this;
const { cardUrl, lines } = this.trainResult;
let that = this;
uni.downloadFile({
url: cardUrl,
success: function (res) {
context.drawImage(res.tempFilePath, 0, 0, width, 450);
context.draw(true);
//
lines.forEach(item => {
that.drawPath(item, width);
});
},
fail(error) {
console.error('图片加载失败:', error);
},
});
},
/**
* 绘制路径
* 图片坐标是155,194
*/
drawPath(str, width) {
const data = this.generatePathData(str);
const ctx = this.context;
this.timers.push(
setTimeout(() => {
if (!this.trainResult.lines || this.trainResult.lines.length === 0) {
return;
}
ctx.beginPath();
ctx.setLineWidth(10);
ctx.setStrokeStyle('#1890ff');
const x = (+data[0][0] * width) / 155;
const y = (+data[0][1] * 450) / 194;
ctx.moveTo(x, y);
if (data.length === 1) {
// 1
ctx.arc(x, y, 2, 0, Math.PI * 2, false);
ctx.fill();
}
}, +data[0][2]),
);
for (let i = 1, len = data.length; i < len; i++) {
if (!this.trainResult.lines || this.trainResult.lines.length === 0) return;
this.timers.push(
setTimeout(() => {
if (!this.trainResult.lines || this.trainResult.lines.length === 0) {
return;
}
if (i > 1) {
this.clearAndDraw(data, i, width);
} else {
const x = (+data[i][0] * width) / 155;
const y = (+data[i][1] * 450) / 194;
ctx.lineTo(x, y);
ctx.stroke();
ctx.draw(true);
}
ctx.closePath();
// }, +data[i][2]),
}, this.getIntervalTime(+data[i][2], +str.operateTime, +data[0][2])),
);
}
},
clearAndDraw(data, i, width) {
if (!data || data.length < 1 || i >= data.length) return;
const ctx = this.context;
const x = (+data[0][0] * width) / 155;
const y = (+data[0][1] * 450) / 194;
ctx.moveTo(x, y);
for (let j = 1; j < i + 1; j++) {
const x = (+data[j][0] * width) / 155;
const y = (+data[j][1] * 450) / 194;
ctx.lineTo(x, y);
if (j === i) {
ctx.stroke();
ctx.draw(true);
}
}
},
/**
* 计算间隔时间
* 第一条线的操作时间
* 每条线的第一个点的时间
* 时间 = 当前线条的操作时间 - 第一条线的操作时间+ 当前点的时间-同一条线的第一个点的时间
*/
getIntervalTime(pointTime, operateTime, firstPointTime) {
const { lines } = this.trainResult;
let time = 0;
time = operateTime - lines[0].operateTime + (pointTime - firstPointTime);
return time;
},
/**
* 生成绘制每段路径的数据
* @param {string} str 每条路径的数据"x,y,time;x,y,time"
* @return {array} result [[x,y,time]]
*/
generatePathData(str) {
if (!str || !str.line) return;
let result = [];
str.line.split(';').forEach(point => {
result.push(point.split(','));
});
return result;
},
},
};
</script>
<style scoped lang="scss"></style>

170
src/pagesYanyuan/ascription/components/ResultLevel.vue

@ -0,0 +1,170 @@
<template>
<view>
<view class="flex flex-nowrap mt-12 rounded-3xl relative" v-if="finishResult">
<view
class="bubble"
:style="{
left: level.left || 0,
color: level.color || '#EDEDED',
backgroundImage: `url(${level.bgPic || 'https://www.tall.wiki/staticrec/yanyuan/bubble-gray.png'})`,
backgroundSize: '100% 100%',
backgroundRepeat: 'no-repeat',
}"
>
{{ finishResult === 1 ? '轻松完成' : finishResult === 2 ? '略有困难' : '非常困难' }}
</view>
<view v-for="i in levels" :key="i.value" class="flex-1" :class="i.value === 3 ? '' : 'box'">
<view class="w-full h-2" :class="i.checked ? level.boxBg : 'bg-gray-100'"></view>
</view>
</view>
</view>
</template>
<script>
export default {
props: { finishResult: { type: Number, default: null } },
data() {
return {
levels: [
{
value: 0.5,
checked: false,
},
{
value: 1,
checked: false,
},
{
value: 1.5,
checked: false,
},
{
value: 2,
checked: false,
},
{
value: 2.5,
checked: false,
},
{
value: 3,
checked: false,
},
],
width: 0,
level: {},
};
},
watch: {
finishResult(val) {
if (val) {
this.setLevel();
}
},
},
mounted() {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query
.selectAll('.box')
.boundingClientRect(data => {
if (data && data.length) {
this.width = data[0].width;
this.setLevel();
}
})
.exec();
});
},
methods: {
setLevel() {
if (!this.finishResult) return;
if (this.finishResult <= 0.5) {
this.setParam(1, 0);
} else if (this.finishResult <= 1) {
this.setParam(1, 1);
} else if (this.finishResult <= 1.5) {
this.setParam(2, 2);
} else if (this.finishResult <= 2) {
this.setParam(2, 3);
} else if (this.finishResult <= 2.5) {
this.setParam(3, 4);
} else {
this.setParam(3, 5);
}
this.setBox();
},
setParam(type, value) {
const { level, width } = this;
if (type == 1) {
level.color = '#1890FF';
level.value = '轻松完成';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-blue.png';
level.boxBg = 'bg-blue-500';
}
if (type == 2) {
level.color = '#F4C130';
level.value = '略有困难';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-yellow.png';
level.boxBg = 'bg-yellow-500';
}
if (type == 3) {
level.color = '#EB5A0D';
level.value = '非常困难';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-red.png';
level.boxBg = 'bg-red-500';
}
level.left = value * width + 'px';
},
setBox() {
let index = 0;
this.levels.forEach((line, i) => {
if (this.finishResult > i / 2) {
index = i + 1;
}
if (this.finishResult === i / 2) {
index = i;
}
if (i < index) {
line.checked = true;
} else {
line.checked = false;
}
});
},
},
};
</script>
<style lang="scss" scoped>
.box {
margin-right: 2px;
}
.bubble {
position: absolute;
top: -40px;
width: 70px;
height: 30px;
line-height: 26px;
text-align: center;
font-size: 14px;
}
.num {
width: 30rpx;
height: 30rpx;
text-align: center;
line-height: 30rpx;
border-radius: 50%;
border: 1px solid $uni-bg-color-blue;
color: $uni-bg-color-blue;
}
</style>

2
src/pagesYanyuan/assess/components/Test/answerPage.vue

@ -74,7 +74,7 @@ export default {
},
question: {
type: Object,
default: {},
default: () => {},
},
},

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

@ -23,7 +23,7 @@ export default {
props: {
item: {
type: Object,
default: {},
default: () => {},
},
},
};

2
src/pagesYanyuan/assess/components/Test/promptPage.vue

@ -67,7 +67,7 @@ import TitlePosition from './components/TitlePosition';
export default {
components: { TestMain, TitlePosition },
props: { question: { type: Object, default: {} } },
props: { question: { type: Object, default: () => {} } },
computed: mapState('yanyuan', ['questionInfo']),

4
src/pagesYanyuan/hold-all/hold-all.vue

@ -145,4 +145,8 @@ page {
--tw-bg-opacity: 1;
background-color: rgba(16, 185, 129, var(--tw-bg-opacity));
}
.w-2 {
width: 0.5rem;
}
</style>

Loading…
Cancel
Save