Browse Source

fix: 添加canvas

develop
song 4 years ago
parent
commit
9bc13c7e82
  1. 3
      CHANGELOG.md
  2. 310
      rest/燕园.http
  3. 14
      src/pagesProject/project/components/Evaluated/components/EvaluatedDetail.vue
  4. 80
      src/pagesProject/project/components/Evaluated/components/ProcessRestore.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-11-30)
# 0.1.0 (2021-12-01)
### 🌟 新功能
范围|描述|commitId
@ -77,6 +77,7 @@
- | 缓存修改 | [63e1f0d](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/63e1f0d)
- | 获取用户收取那,提交用户信息 | [a3c54f1](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a3c54f1)
- | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/94cd671)
- | 解决bug | [155626c](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/155626c)
- | 训练归属界面 | [4c34cee](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4c34cee)
- | 设置小红点 | [9316bcb](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/9316bcb)
- | 设置界面基本信息板块开发 | [bbaded0](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/bbaded0)

310
rest/燕园.http

@ -0,0 +1,310 @@
@localhost = http://localhost:7260/v2.0
@localhost_tall = http://localhost:7130/v3.0
@test_tall = http://192.168.0.99:7130/v3.0
@test = https://test.tall.wiki/gateway/yanyuan/v2.0/
@www_tall = http://www.tall.wiki:7130/v3.0
@www = http://www.tall.wiki/gateway/yanyuan/v2.0/
@type = content-type: application/json;charset=utf-8
### 登录
# @name login
POST {{test_tall}}/users/signin
{{type}}
{
"client": 1,
"type": 3,
"data": {
"identifier": "song",
"credential": "999999"
}
}
### debug
GET {{test}}/debug
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
###绑定工具箱
POST {{localhost}}/tool/bind
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"toolCode":"0000000003"
}
}
###查询登录用户身份
POST {{test}}/userPower/identity
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
}
###添加用户信息
POST {{test}}/trainee/add
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"userName":"李四",
"sex":"1",
"clinicHospital":"就诊医院",
"hospitalProvinceId":"1",
"hospitalCityId":"2",
"hospitalAddress":"迎泽区XXX",
"clinicOffice":"神经内科",
"clinicDoctor":"赵医生",
"birthDate":"1965-08-01",
"height":"170",
"weight":"66",
"jobTitle":"农林渔牧",
"educateStatus":"小学",
"educateDate":"6",
"abodePlace":"太原市小店区",
"appearTime":"2021-01-01",
"diagnoseTime":"2021-02-01",
"diagnoseResult":"轻度痴呆",
"minBloodPressure":"90",
"maxBloodPressure":"120",
"bloodFat":"80",
"physicalAct":"中",
"apoeGene":"1",
"diseasesRecord":"没有疾病史",
"relativeDiseasesRecord":"亲属均无老年痴呆",
"isInsomnic":0,
"insomnicPeriod":"8",
"isSmoke":1,
"quitPeriod":2,
"sustainPeriod":3,
"averageNum":5,
"isDrink":2,
"abstinencePeriod":"2年",
"drinkType":"啤酒",
"isTea":"3",
"quitTea":"",
"continuePeriod":"1年",
"teaType":"绿茶",
"teaPeriod":"每天一杯",
"isStrongFlavour":1,
"isLikeMeat":1,
"isMoreOil":0
}
}
###查询绑定者创建的患者信息(申请成为家属前调用)
POST {{test}}/trainee/create
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"bindUserId":"1218025249493356544"
}
}
###绑定手机号后,关联用户原有的使用者
POST {{test}}/trainee/relation
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
}
###生成二维码
POST {{test}}/tool/qrCode
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"id":"1"
}
}
###体验账号升级
POST {{test}}/trainee/upgrade
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"keyUserIds":[
"1456525052375470081"
]
}
}
###查询个人信息
POST {{test}}/family/personal
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
}
###申请成为家属
POST {{test}}/family/apply
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"keyUserIds":[
"1456525052375470080",
"1456525052375470081"
],
"age":25,
"educateLevel": "本科",
"jobTitle": "码农",
"name": "小伙伴",
"sex": 1
}
}
###查询试题
POST {{test}}/question/get
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"code":"NLCP",
"reportId": "1464155290781618176",
"num": "17"
}
}
###保存答案
POST {{test}}/question/saveAnswer
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"code":"NLCP",
"reportId": "1459057596971094016",
"questionId": "21",
"optionId": "1"
}
}
###脑力测评结果计算
POST {{test}}/mentalTest/calculate
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"mentalTestId": "1458968153773838336"
}
}
###查询定期任务
POST {{test}}/task/regular
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"projectId": "1460455105006145536",
"templateCode": "yanyuan-user",
"roleId":"1",
"queryNum":2,
"queryType":0
}
}
###查询训练计划详情
POST {{test}}/trainPlan/detail
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
# "recordId": "1460549920427347968"
"recordId": "1460549920452513797"
}
}
###角色查询
POST {{test}}/role/show
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"projectId": "1459057595893157888",
"templateCode": "yanyuan-user"
}
}
###Zarit结果计算
POST {{test}}/zarit/calculate
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"careId": "21"
}
}
###选择工具箱
POST {{localhost}}/trainPlan/chooseTool
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"recordId": "1460549920427347972",
"equipmentId": "2"
}
}
###修改使用者信息
POST {{test}}/trainee/update
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"maxBloodPressure": "97",
"minBloodPressure": "57",
"diseasesRecord": "高血压,其他:其他疾病3",
"relativeDiseasesRecord": "高血脂,其他:其他疾病3",
"projectId": "1460455105006145536"
}
}
###查询使用者信息
POST {{test}}/trainee/query
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"projectId": "1464155289330388992"
}
}
###查询负担量表记录
POST {{test}}/zarit/queryList
{{type}}
Authorization: Bearer {{login.response.body.$.data.token}}
{
"param":{
"projectId": "1460455105006145536"
}
}
### 导入题目
POST {{test}}/question/importQuestion
Authorization: Bearer {{login.response.body.$.data.token}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
title
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="param"; filename="D:\项目\山大一院-燕园\过程\导入\燕园Zarit导入v1.0.xlsx"
< D:\项目\山大一院-燕园\过程\导入\燕园Zarit导入v1.0.xlsx
------WebKitFormBoundary7MA4YWxkTrZu0gW--

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

@ -8,9 +8,9 @@
</u-radio>
</u-radio-group>
</view>
<view v-if="train.contentDetails.length" class="text-xs">
<view v-if="train.contentDetails.length" class="text-xs mb-2">
<!-- 训练目标 训练元素 训练原理 训练步骤 -->
<view v-for="(purpose, purposeIndex) in train.contentDetails" :key="purposeIndex">
<view v-for="(purpose, purposeIndex) in train.contentDetails" :key="purposeIndex" class="mb-2">
<view class="font-bold my-1">{{
purpose.type === 0
? '训练目标'
@ -35,15 +35,15 @@
</view>
</view>
<!-- 训练结果 -->
<view v-if="purpose.trains.length">
<view v-for="(trainResult, resultIndex) in purpose.trains" :key="trainResult.trainRecordId">
<view v-if="train.trains.length" class="mb-2">
<view v-for="(trainResult, resultIndex) in train.trains" :key="trainResult.trainRecordId">
<view v-if="trainResult.resultType === 0">
<view class="font-bold text-xs">训练结果</view>
<view class="font-bold text-xs my-1">训练结果</view>
<ResultLevel :trains="trainResult" :resultIndex="resultIndex" />
</view>
<view v-if="trainResult.resultType === 1">
<view class="font-bold text-xs">过程还原</view>
<ProcessRestore />
<view class="font-bold text-xs my-1">过程还原</view>
<ProcessRestore :trainResult="trainResult" />
</view>
</view>
</view>

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

@ -1,9 +1,83 @@
<template>
<view class="my-2">过程还原</view>
<!-- <view>
<canvas style="width: 300px; height: 200px" canvas-id="firstCanvas" id="firstCanvas" ref="reduceCanvas"></canvas>
</view> -->
<view class="indeximg">
<canvas style="width: 100%; height: 450px" canvas-id="firstCanvas"></canvas>
</view>
</template>
<script>
export default {};
export default {
props: { trainResult: { type: Object, default: null } },
data() {
return {
canvas: null,
context: null,
points: [],
};
},
onReady(e) {
console.log('e: ', e);
// var context = uni.createCanvasContext('firstCanvas');
// console.log('context: ', context);
// context.setStrokeStyle('#00ff00');
// context.setLineWidth(5);
// context.rect(0, 0, 200, 200);
// context.stroke();
// context.setStrokeStyle('#ff0000');
// context.setLineWidth(2);
// context.moveTo(160, 100);
// context.arc(100, 100, 60, 0, 2 * Math.PI, true);
// context.moveTo(140, 100);
// context.arc(100, 100, 40, 0, Math.PI, false);
// context.moveTo(85, 80);
// context.arc(80, 80, 5, 0, 2 * Math.PI, true);
// context.moveTo(125, 80);
// context.arc(120, 80, 5, 0, 2 * Math.PI, true);
// context.stroke();
// context.draw();
},
mounted() {
this.initCanvas();
this.drawImage();
},
methods: {
// canvas ctx
initCanvas() {
this.canvas = this.$refs['reduceCanvas'];
this.context = uni.createCanvasContext('firstCanvas');
},
// 线
drawImage() {
const { context } = this;
const { cardUrl } = this.trainResult;
uni.downloadFile({
url: cardUrl,
success: function (res) {
console.log('res: ', res);
context.save();
context.beginPath();
context.arc(96, 96, 48, 0, 2 * Math.PI);
context.clip();
context.drawImage(res.tempFilePath, 48, 48, 200, 200);
context.restore();
context.draw();
},
fail(error) {
console.error('连线图片加载失败:', error);
},
});
},
},
};
</script>
<style></style>
<style scoped lang="scss"></style>

Loading…
Cancel
Save