|
@@ -20,7 +20,8 @@
|
|
@mouseup="stopDrawing"
|
|
@mouseup="stopDrawing"
|
|
></canvas>
|
|
></canvas>
|
|
|
|
|
|
- <div>
|
|
|
|
|
|
+ <div v-if="isMainWin" class="absolute wh-full top-0 left-0 z-3000"></div>
|
|
|
|
+ <div v-else>
|
|
<div class="font-600 text-[20px] mb-[12px]">画笔颜色:</div>
|
|
<div class="font-600 text-[20px] mb-[12px]">画笔颜色:</div>
|
|
<div class="w-[270px] flex flex-row flex-wrap">
|
|
<div class="w-[270px] flex flex-row flex-wrap">
|
|
<div
|
|
<div
|
|
@@ -44,111 +45,146 @@
|
|
<!-- 选择文化程度 -->
|
|
<!-- 选择文化程度 -->
|
|
<el-dialog
|
|
<el-dialog
|
|
v-model="dialogVisible"
|
|
v-model="dialogVisible"
|
|
- width="30%"
|
|
|
|
|
|
+ width="24%"
|
|
:show-close="false"
|
|
:show-close="false"
|
|
:modal-append-to-body="false"
|
|
:modal-append-to-body="false"
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
- class="h-[800px]"
|
|
|
|
>
|
|
>
|
|
- <div class="font-600 text-[18px] mb-[20px]">请评分:</div>
|
|
|
|
|
|
+ <div class="font-600 text-[18px] mb-[20px]">{{ isMainWin ? '请' : '医生' }}评分:</div>
|
|
<div class="h-[690px] overflow-y-auto">
|
|
<div class="h-[690px] overflow-y-auto">
|
|
<h3>1. 锚定“12.3.6.9”四个点</h3>
|
|
<h3>1. 锚定“12.3.6.9”四个点</h3>
|
|
- <el-radio-group v-model="radios[0]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[0]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
<el-radio value="4">4分</el-radio>
|
|
<el-radio value="4">4分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[0]">{{ radios[0] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">2. 写出所有数字</h3>
|
|
<h3 style="margin-top: 5px">2. 写出所有数字</h3>
|
|
- <el-radio-group v-model="radios[1]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[1]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
<el-radio value="4">4分</el-radio>
|
|
<el-radio value="4">4分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[1]">{{ radios[1] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">3. 所有数字在钟面圆圈内</h3>
|
|
<h3 style="margin-top: 5px">3. 所有数字在钟面圆圈内</h3>
|
|
- <el-radio-group v-model="radios[2]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[2]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[2]">{{ radios[2] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">4. 顺时针排列</h3>
|
|
<h3 style="margin-top: 5px">4. 顺时针排列</h3>
|
|
- <el-radio-group v-model="radios[3]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[3]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[3]">{{ radios[3] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">5. 1-12数字次序</h3>
|
|
<h3 style="margin-top: 5px">5. 1-12数字次序</h3>
|
|
- <el-radio-group v-model="radios[4]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[4]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[4]">{{ radios[4] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">6.“12,3,6,9”分布对称</h3>
|
|
<h3 style="margin-top: 5px">6.“12,3,6,9”分布对称</h3>
|
|
- <el-radio-group v-model="radios[5]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[5]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[5]">{{ radios[5] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">7. 其他8个数字位置</h3>
|
|
<h3 style="margin-top: 5px">7. 其他8个数字位置</h3>
|
|
- <el-radio-group v-model="radios[6]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[6]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
<el-radio value="3">3分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[6]">{{ radios[6] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">8. 中央点位置</h3>
|
|
<h3 style="margin-top: 5px">8. 中央点位置</h3>
|
|
- <el-radio-group v-model="radios[7]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[7]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[7]">{{ radios[7] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">9. 钟面完整</h3>
|
|
<h3 style="margin-top: 5px">9. 钟面完整</h3>
|
|
- <el-radio-group v-model="radios[8]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[8]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[8]">{{ radios[8] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">10. 有时针和分针</h3>
|
|
<h3 style="margin-top: 5px">10. 有时针和分针</h3>
|
|
- <el-radio-group v-model="radios[9]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[9]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[9]">{{ radios[9] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">11. 时针指向正确</h3>
|
|
<h3 style="margin-top: 5px">11. 时针指向正确</h3>
|
|
- <el-radio-group v-model="radios[10]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[10]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[10]">{{ radios[10] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">12. 分针指向正确</h3>
|
|
<h3 style="margin-top: 5px">12. 分针指向正确</h3>
|
|
- <el-radio-group v-model="radios[11]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[11]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[11]">{{ radios[11] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">13. 分针比时针长</h3>
|
|
<h3 style="margin-top: 5px">13. 分针比时针长</h3>
|
|
- <el-radio-group v-model="radios[12]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[12]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[12]">{{ radios[12] }} 分</span>
|
|
|
|
+ </div>
|
|
<h3 style="margin-top: 5px">14. 时针和分针都有箭头</h3>
|
|
<h3 style="margin-top: 5px">14. 时针和分针都有箭头</h3>
|
|
- <el-radio-group v-model="radios[13]">
|
|
|
|
|
|
+ <el-radio-group v-if="isMainWin" v-model="radios[13]">
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="0">0分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="1">1分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
<el-radio value="2">2分</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <div v-else class="h-[18px] mt-4px text-[#089BAB] text-18px w-[50%] text-right">
|
|
|
|
+ <span v-if="radios[13]">{{ radios[13] }} 分</span>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- <div class="absolute right-[20px] bottom-[20px]">
|
|
|
|
- <el-button type="primary" plain @click="dialogVisible = false">关 闭</el-button>
|
|
|
|
- <el-button :loading="loading" type="primary" @click="handleSubmit">确 定</el-button>
|
|
|
|
|
|
+ <div v-if="isMainWin" class="flex-center mt-10px">
|
|
|
|
+ <el-button :disabled="loading" type="primary" plain class="mr-24px" @click="closeDialog">关 闭</el-button>
|
|
|
|
+ <el-button :loading="loading" :disabled="loading" type="primary" @click="handleSubmit">确 定</el-button>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
- <!-- <template #footer>-->
|
|
|
|
- <!-- <div class="dialog-footer text-right">-->
|
|
|
|
- <!-- <el-button :loading="loading" type="primary" @click="handleSubmit">确 定</el-button>-->
|
|
|
|
- <!-- </div>-->
|
|
|
|
- <!-- </template>-->
|
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</section>
|
|
</section>
|
|
</template>
|
|
</template>
|
|
@@ -167,7 +203,7 @@ import { useSocket } from '@/utils/websoket'
|
|
import { isJSON } from '@/utils'
|
|
import { isJSON } from '@/utils'
|
|
const { socket, wsSend, wsOn, wsOff } = useSocket()
|
|
const { socket, wsSend, wsOn, wsOff } = useSocket()
|
|
|
|
|
|
-const isPatient = ref(false)
|
|
|
|
|
|
+const isMainWin = ref(false)
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
name: 'CognitiveAbilityTaskDrawClock',
|
|
name: 'CognitiveAbilityTaskDrawClock',
|
|
@@ -192,11 +228,6 @@ const dialogVisible = ref(false) // 学历弹窗
|
|
const btnActive = ref(-1)
|
|
const btnActive = ref(-1)
|
|
const colors = ref(['#fef4ac', '#0018ba', '#ffc200', '#f32f15', '#cccccc', '#5ab639'])
|
|
const colors = ref(['#fef4ac', '#0018ba', '#ffc200', '#f32f15', '#cccccc', '#5ab639'])
|
|
const imgUrl = ref('')
|
|
const imgUrl = ref('')
|
|
-const preDrawAry = ref<ImageData[]>([])
|
|
|
|
-const middleAry = ref<ImageData[]>([])
|
|
|
|
-const nextDrawAry = ref<ImageData[]>([])
|
|
|
|
-
|
|
|
|
-const radios = ref([])
|
|
|
|
|
|
|
|
const changeColor = (color: string, index: number) => {
|
|
const changeColor = (color: string, index: number) => {
|
|
btnActive.value = index
|
|
btnActive.value = index
|
|
@@ -211,6 +242,9 @@ let isPainting = false
|
|
let lastX = 0
|
|
let lastX = 0
|
|
let lastY = 0
|
|
let lastY = 0
|
|
let ctx: CanvasRenderingContext2D | null = null
|
|
let ctx: CanvasRenderingContext2D | null = null
|
|
|
|
+const preDrawAry = ref<ImageData[]>([])
|
|
|
|
+const middleAry = ref<ImageData[]>([])
|
|
|
|
+const nextDrawAry = ref<ImageData[]>([])
|
|
|
|
|
|
const startDrawing = (event: MouseEvent) => {
|
|
const startDrawing = (event: MouseEvent) => {
|
|
if (!isPainting && ctx) {
|
|
if (!isPainting && ctx) {
|
|
@@ -231,6 +265,7 @@ const draw = (event: MouseEvent) => {
|
|
ctx.lineTo(event.offsetX, event.offsetY)
|
|
ctx.lineTo(event.offsetX, event.offsetY)
|
|
ctx.stroke()
|
|
ctx.stroke()
|
|
;[lastX, lastY] = [event.offsetX, event.offsetY]
|
|
;[lastX, lastY] = [event.offsetX, event.offsetY]
|
|
|
|
+ canvasToBase64ToStorage(0)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -288,20 +323,36 @@ function controlCanvas(action: string) {
|
|
radios.value = []
|
|
radios.value = []
|
|
break
|
|
break
|
|
}
|
|
}
|
|
|
|
+ canvasToBase64ToStorage(1)
|
|
}
|
|
}
|
|
|
|
|
|
const getImage = () => {
|
|
const getImage = () => {
|
|
imgUrl.value = paintCanvas.value?.toDataURL('image/png') ?? ''
|
|
imgUrl.value = paintCanvas.value?.toDataURL('image/png') ?? ''
|
|
dialogVisible.value = true
|
|
dialogVisible.value = true
|
|
- wsSend(
|
|
|
|
- JSON.stringify({
|
|
|
|
- dataSource: 'drawClock',
|
|
|
|
- msg: 'ping-fen-dialog-show',
|
|
|
|
- currentPatId: userStore.user.id
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
|
|
+
|
|
|
|
+ localStorage.setItem('tow-win-draw-clock-result-arr-reset', 'reset')
|
|
|
|
+ localStorage.setItem('tow-win-draw-clock-show-dialog', 'YES')
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const closeDialog = () => {
|
|
|
|
+ dialogVisible.value = false
|
|
|
|
+ localStorage.setItem('tow-win-draw-clock-show-dialog', 'NO')
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const radios = ref([])
|
|
|
|
+watch(
|
|
|
|
+ () => radios.value,
|
|
|
|
+ (newVal) => {
|
|
|
|
+ localStorage.setItem('tow-win-draw-clock-result-arr', JSON.stringify(newVal))
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ deep: true
|
|
|
|
+ }
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 提交操作
|
|
|
|
+ */
|
|
const handleSubmit = () => {
|
|
const handleSubmit = () => {
|
|
if (
|
|
if (
|
|
radios.value[0] == null ||
|
|
radios.value[0] == null ||
|
|
@@ -330,8 +381,7 @@ const handleSubmit = () => {
|
|
grade += parseInt(radios.value[i])
|
|
grade += parseInt(radios.value[i])
|
|
}
|
|
}
|
|
|
|
|
|
- loading.value = false
|
|
|
|
- let tempObj = {}
|
|
|
|
|
|
+ loading.value = true
|
|
EvaluationSTRecordInfoAPI.addCognition({
|
|
EvaluationSTRecordInfoAPI.addCognition({
|
|
parentId: props.parentId,
|
|
parentId: props.parentId,
|
|
patId: userStore.user.id,
|
|
patId: userStore.user.id,
|
|
@@ -360,8 +410,11 @@ const handleSubmit = () => {
|
|
loading.value = false
|
|
loading.value = false
|
|
ElMessage.success('提交成功!')
|
|
ElMessage.success('提交成功!')
|
|
emits('showResult', data)
|
|
emits('showResult', data)
|
|
|
|
+
|
|
|
|
+ localStorage.setItem('tow-win-draw-clock-show-result', JSON.stringify(data))
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
|
+ ElMessage.error('提交失败!')
|
|
loading.value = false
|
|
loading.value = false
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -375,46 +428,92 @@ const countDownEnd = () => {
|
|
}
|
|
}
|
|
|
|
|
|
async function exec() {
|
|
async function exec() {
|
|
- isPatient.value = ['5588', '5589'].includes(window.location.port)
|
|
|
|
- if (isPatient.value) {
|
|
|
|
|
|
+ isMainWin.value = window.location.href.includes('win=main')
|
|
|
|
+ if (isMainWin.value) {
|
|
|
|
+ countDownEnd()
|
|
|
|
+ } else {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
countDownBegin.value = true
|
|
countDownBegin.value = true
|
|
}, 2300)
|
|
}, 2300)
|
|
- } else {
|
|
|
|
- countDownEnd()
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
exec()
|
|
exec()
|
|
-})
|
|
|
|
|
|
|
|
-// ----------------------------------- WebSocket -----------------------------------
|
|
|
|
-wsOn('close', () => console.log('Socket closed!'))
|
|
|
|
-//webSocket连接上服务器时
|
|
|
|
-wsOn('open', (event: Event) => {
|
|
|
|
- console.log('webSocket连接上服务器时')
|
|
|
|
-})
|
|
|
|
-socket.on('message', (data: any) => {
|
|
|
|
- console.log('Received data:', data)
|
|
|
|
- if (data && isJSON(data)) {
|
|
|
|
- let message = JSON.parse(data)
|
|
|
|
- if (isPatient.value) {
|
|
|
|
- console.log('------')
|
|
|
|
|
|
+ window.addEventListener('storage', (val) => {
|
|
|
|
+ if (isMainWin.value) {
|
|
|
|
+ if (val.key === 'tow-win-draw-clock-img-data') {
|
|
|
|
+ let tempVal = JSON.parse(val.newValue!)
|
|
|
|
+ drawBase64ToCanvas(tempVal.optFlag, tempVal.url)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (val.key === 'tow-win-draw-clock-show-dialog' && val.newValue === 'YES') {
|
|
|
|
+ dialogVisible.value = true
|
|
|
|
+ localStorage.removeItem('tow-win-draw-clock-show-dialog')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (val.key === 'tow-win-draw-clock-result-arr-reset') {
|
|
|
|
+ radios.value = []
|
|
|
|
+ localStorage.removeItem('tow-win-draw-clock-result-arr-reset')
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- // 当 医生端 接到 患者端 从 认画钟测验 页面发出来的 开始评分 请求时
|
|
|
|
- // 根据患者的ID作为判断依据
|
|
|
|
- // 医生端弹出评分框
|
|
|
|
- if (message.dataSource === 'drawClock') {
|
|
|
|
- // TODO 医生端打开患者记录前 在缓存里面存储下该患者的真实ID 然后在这个地方调取
|
|
|
|
- // if (message.msg === 'ping-fen-dialog-show' && message.currentPatId === ) {
|
|
|
|
- // dialogVisible.value = true
|
|
|
|
- // }
|
|
|
|
|
|
+ if (val.key === 'tow-win-draw-clock-result-arr') {
|
|
|
|
+ radios.value = JSON.parse(val.newValue!)
|
|
|
|
+ localStorage.removeItem('tow-win-draw-clock-result-arr')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (val.key === 'tow-win-draw-clock-show-dialog' && val.newValue === 'NO') {
|
|
|
|
+ dialogVisible.value = false
|
|
|
|
+ localStorage.removeItem('tow-win-draw-clock-show-dialog')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (val.key === 'tow-win-draw-clock-show-result') {
|
|
|
|
+ ElMessage.success('提交成功!')
|
|
|
|
+ emits('showResult', JSON.parse(val.newValue!))
|
|
|
|
+ localStorage.removeItem('tow-win-draw-clock-show-result')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ })
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+onUnmounted(() => {
|
|
|
|
+ localStorage.removeItem('tow-win-draw-clock-img-data')
|
|
|
|
+ window.removeEventListener('storage', () => {})
|
|
})
|
|
})
|
|
-// ----------------------------------- WebSocket -----------------------------------
|
|
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 画布数据转base64并保存到localStorage
|
|
|
|
+ * @param optFlag 0:不清空画布 1:清空画布
|
|
|
|
+ */
|
|
|
|
+function canvasToBase64ToStorage(optFlag: number) {
|
|
|
|
+ console.log(paintCanvas.value?.toDataURL('image/png') ?? '')
|
|
|
|
+ localStorage.setItem(
|
|
|
|
+ 'tow-win-draw-clock-img-data',
|
|
|
|
+ JSON.stringify({
|
|
|
|
+ optFlag: optFlag,
|
|
|
|
+ url: paintCanvas.value?.toDataURL('image/png') ?? ''
|
|
|
|
+ })
|
|
|
|
+ )
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * base64转图片并绘制到画布
|
|
|
|
+ * @param optFlag 0:不清空画布 1:清空画布
|
|
|
|
+ * @param base64Data
|
|
|
|
+ */
|
|
|
|
+function drawBase64ToCanvas(optFlag: number, base64Data: string) {
|
|
|
|
+ if (optFlag === 1 && ctx) {
|
|
|
|
+ // 清空整个 Canvas
|
|
|
|
+ ctx.clearRect(0, 0, paintCanvas.value!.width!, paintCanvas.value!.height!)
|
|
|
|
+ }
|
|
|
|
+ const img = new Image()
|
|
|
|
+ img.onload = () => {
|
|
|
|
+ ctx?.drawImage(img, 0, 0)
|
|
|
|
+ }
|
|
|
|
+ img.src = base64Data
|
|
|
|
+ localStorage.removeItem('tow-win-draw-clock-img-data')
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|