Compare commits
No commits in common. "master" and "1.0.2" have entirely different histories.
|
|
@ -6,8 +6,8 @@ on:
|
||||||
- develop
|
- develop
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: ${{ gitea.repository_owner }}/maketemplate.web
|
IMAGE_NAME: ${{ gitea.repository_owner }}/usercenter.web
|
||||||
PUBLISH_PATH: maketemplate.web
|
PUBLISH_PATH: usercenter.web
|
||||||
PUBLISH_HOST: 10.255.255.44
|
PUBLISH_HOST: 10.255.255.44
|
||||||
PUBLISH_PORT: 22
|
PUBLISH_PORT: 22
|
||||||
PUBLISH_REPLICAS: 1 #启动副本数量
|
PUBLISH_REPLICAS: 1 #启动副本数量
|
||||||
|
|
@ -16,17 +16,21 @@ jobs:
|
||||||
job1:
|
job1:
|
||||||
name: 编译发布
|
name: 编译发布
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
|
container:
|
||||||
|
image: node:16-bullseye
|
||||||
|
volumes:
|
||||||
|
#挂载缓存
|
||||||
|
- /opt/.runner/node_modules:/cache
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 下载源码
|
- name: 下载源码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 使用缓存
|
- name: 使用缓存
|
||||||
uses: actions/cache@master
|
uses: actions/cache@master
|
||||||
with:
|
with:
|
||||||
mount: |
|
mount: |
|
||||||
node_modules
|
node_modules
|
||||||
hash_files: |
|
|
||||||
package.json
|
|
||||||
|
|
||||||
- name: 编译项目
|
- name: 编译项目
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: ${{ gitea.repository_owner }}/maketemplate.web
|
IMAGE_NAME: ${{ gitea.repository_owner }}/usercenter.web
|
||||||
PUBLISH_PATH: maketemplate.web
|
PUBLISH_PATH: usercenter.web
|
||||||
PUBLISH_HOST: 10.255.255.74
|
PUBLISH_HOST: 10.255.255.74
|
||||||
PUBLISH_PORT: 10022
|
PUBLISH_PORT: 10022
|
||||||
PUBLISH_REPLICAS: 1 #启动副本数量
|
PUBLISH_REPLICAS: 1 #启动副本数量
|
||||||
|
|
@ -21,7 +21,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 下载源码
|
- name: 下载源码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 发布版本
|
- name: 发布版本
|
||||||
id: publish_version
|
id: publish_version
|
||||||
|
|
@ -33,15 +33,16 @@ jobs:
|
||||||
needs: release
|
needs: release
|
||||||
steps:
|
steps:
|
||||||
- name: 下载源码
|
- name: 下载源码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: 下载源码
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 使用缓存
|
- name: 使用缓存
|
||||||
uses: actions/cache@master
|
uses: actions/cache@master
|
||||||
with:
|
with:
|
||||||
mount: |
|
mount: |
|
||||||
node_modules
|
node_modules
|
||||||
hash_files: |
|
|
||||||
package.json
|
|
||||||
|
|
||||||
- name: 编译项目
|
- name: 编译项目
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ on:
|
||||||
- staging
|
- staging
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: ${{ gitea.repository_owner }}/maketemplate.web
|
IMAGE_NAME: ${{ gitea.repository_owner }}/usercenter.web
|
||||||
PUBLISH_PATH: maketemplate.web
|
PUBLISH_PATH: usercenter.web
|
||||||
PUBLISH_HOST: 10.255.255.3
|
PUBLISH_HOST: 10.255.255.3
|
||||||
PUBLISH_PORT: 22
|
PUBLISH_PORT: 22
|
||||||
PUBLISH_REPLICAS: 1 #启动副本数量
|
PUBLISH_REPLICAS: 1 #启动副本数量
|
||||||
|
|
@ -24,15 +24,13 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 下载源码
|
- name: 下载源码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 使用缓存
|
- name: 使用缓存
|
||||||
uses: actions/cache@master
|
uses: actions/cache@master
|
||||||
with:
|
with:
|
||||||
mount: |
|
mount: |
|
||||||
node_modules
|
node_modules
|
||||||
hash_files: |
|
|
||||||
package.json
|
|
||||||
|
|
||||||
- name: 编译项目
|
- name: 编译项目
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ on:
|
||||||
- published
|
- published
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: ${{ gitea.repository_owner }}/maketemplate.web
|
IMAGE_NAME: ${{ gitea.repository_owner }}/usercenter.web
|
||||||
PUBLISH_PATH: maketemplate.web
|
PUBLISH_PATH: usercenter.web
|
||||||
PUBLISH_HOST: 10.255.255.74
|
PUBLISH_HOST: 10.255.255.74
|
||||||
PUBLISH_PORT: 10022
|
PUBLISH_PORT: 10022
|
||||||
PUBLISH_REPLICAS: 1 #启动副本数量
|
PUBLISH_REPLICAS: 1 #启动副本数量
|
||||||
|
|
@ -16,18 +16,21 @@ jobs:
|
||||||
job1:
|
job1:
|
||||||
name: 编译发布
|
name: 编译发布
|
||||||
runs-on: linux
|
runs-on: linux
|
||||||
|
container:
|
||||||
|
image: node:16-bullseye
|
||||||
|
volumes:
|
||||||
|
#挂载缓存
|
||||||
|
- /opt/.runner/node_modules:/cache
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 下载源码
|
- name: 下载源码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 使用缓存
|
- name: 使用缓存
|
||||||
uses: actions/cache@master
|
uses: actions/cache@master
|
||||||
with:
|
with:
|
||||||
mount: |
|
mount: |
|
||||||
node_modules
|
node_modules
|
||||||
hash_files: |
|
|
||||||
package.json
|
|
||||||
|
|
||||||
- name: 编译项目
|
- name: 编译项目
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
usercenter-web:
|
usercenter-web:
|
||||||
image: ${REGISTRY:-harbor.w.23544.com:8843}/marking/maketemplate.web:${TAG:-latest}
|
image: ${REGISTRY:-harbor.w.23544.com:8843}/marking/usercenter.web:${TAG:-latest}
|
||||||
hostname: marking
|
hostname: marking
|
||||||
environment:
|
environment:
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
ports:
|
ports:
|
||||||
- 8898:80
|
- 4400:80
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
replicas: ${REPLICAS:-1}
|
replicas: ${REPLICAS:-1}
|
||||||
|
|
|
||||||
|
|
@ -2,37 +2,21 @@
|
||||||
<div>
|
<div>
|
||||||
<span>坐标:</span>
|
<span>坐标:</span>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" @click="changeFabricPosition(true, 'top')"
|
<el-button type="primary" @click="changeFabricPosition(true, 'top')">上移</el-button>
|
||||||
>上移</el-button
|
<el-button type="primary" @click="changeFabricPosition(false, 'top')">下移</el-button>
|
||||||
>
|
<el-button type="primary" @click="changeFabricPosition(true, 'left')">左移</el-button>
|
||||||
<el-button type="primary" @click="changeFabricPosition(false, 'top')"
|
<el-button type="primary" @click="changeFabricPosition(false, 'left')">右移</el-button>
|
||||||
>下移</el-button
|
|
||||||
>
|
|
||||||
<el-button type="primary" @click="changeFabricPosition(true, 'left')"
|
|
||||||
>左移</el-button
|
|
||||||
>
|
|
||||||
<el-button type="primary" @click="changeFabricPosition(false, 'left')"
|
|
||||||
>右移</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>宽度:</span>
|
<span>宽度:</span>
|
||||||
<el-input-number
|
<el-input-number v-model="fabricPosition.width" :min="1" @change="changeFabricPosition($event, 'width')"
|
||||||
v-model="fabricPosition.width"
|
:max="fabricPosition.imgDomWidth" />
|
||||||
:min="1"
|
|
||||||
@change="changeFabricPosition($event, 'width')"
|
|
||||||
:max="fabricPosition.imgDomWidth"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>高度:</span>
|
<span>高度:</span>
|
||||||
<el-input-number
|
<el-input-number v-model="fabricPosition.height" :min="1" @change="changeFabricPosition($event, 'height')"
|
||||||
v-model="fabricPosition.height"
|
:max="fabricPosition.imgDomHight" />
|
||||||
:min="1"
|
|
||||||
@change="changeFabricPosition($event, 'height')"
|
|
||||||
:max="fabricPosition.imgDomHight"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
@ -44,8 +28,8 @@ const fabricPosition = reactive<any>({
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
imgDomHight: 1,
|
imgDomHight: 1,
|
||||||
imgDomWidth: 1,
|
imgDomWidth: 1
|
||||||
});
|
})
|
||||||
|
|
||||||
const setSize = (data: any, imgDomWidth: number, imgDomHight: number): void => {
|
const setSize = (data: any, imgDomWidth: number, imgDomHight: number): void => {
|
||||||
fabricPosition.top = data.top;
|
fabricPosition.top = data.top;
|
||||||
|
|
@ -54,22 +38,23 @@ const setSize = (data: any, imgDomWidth: number, imgDomHight: number): void => {
|
||||||
fabricPosition.height = data.height;
|
fabricPosition.height = data.height;
|
||||||
fabricPosition.imgDomWidth = imgDomWidth;
|
fabricPosition.imgDomWidth = imgDomWidth;
|
||||||
fabricPosition.imgDomHight = imgDomHight;
|
fabricPosition.imgDomHight = imgDomHight;
|
||||||
};
|
}
|
||||||
|
|
||||||
const changeFabricPosition = (value: number | boolean, str: string): void => {
|
const changeFabricPosition = (value: number | boolean, str: string): void => {
|
||||||
if (typeof value === "boolean") {
|
if (typeof value === 'boolean') {
|
||||||
if (str === "top") {
|
if (str === 'top') {
|
||||||
props.change(value, str);
|
props.change(value ? fabricPosition.top-- : fabricPosition.top++, str)
|
||||||
} else {
|
} else {
|
||||||
props.change(value, str);
|
props.change(value ? fabricPosition.left-- : fabricPosition.left++, str)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
props.change(value, str);
|
props.change(value, str)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
setSize,
|
setSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div style="font-size: 20px; margin-bottom: 20px; font-weight: bold">
|
<div style="font-size: 20px; margin-bottom: 20px; font-weight: bold">
|
||||||
锁定模板后,仅可调整位置和大小,无法增删题目,请确认模板信息后操作:
|
锁定模板后,无法修改,请确认模板信息后操作:
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 70vh; overflow-y: auto">
|
<div style="height: 70vh; overflow-y: auto">
|
||||||
<el-collapse v-model="activeNames">
|
<el-collapse v-model="activeNames">
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<div v-if="item.key !== 'otherPoint'">
|
<div v-if="item.key !== 'otherPoint'">
|
||||||
<div v-if="item.data.length">
|
<div v-if="item.data.length">
|
||||||
<div v-for="row in item.data">
|
<div v-for="row in item.data">
|
||||||
{{ row.questionBefore }}-{{ row.questionAfter }}题 每题{{ row.score }}分
|
{{ row.questionBefore }}-{{ row.questionAfter }}题 总分{{ row.score }}分
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,7 @@
|
||||||
<img src="@/assets/image/icon1.png" alt="" v-if="item.index !== 5" />
|
<img src="@/assets/image/icon1.png" alt="" v-if="item.index !== 5" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="warp-nav-tab-delete" title="清空全部痕迹" @click="clearFabricGroup">
|
||||||
class="warp-nav-tab-delete"
|
|
||||||
title="清空全部痕迹"
|
|
||||||
@click="clearFabricGroup"
|
|
||||||
v-if="!isLockStatus"
|
|
||||||
>
|
|
||||||
<img src="@/assets/image/icon2.png" alt="" />
|
<img src="@/assets/image/icon2.png" alt="" />
|
||||||
<span>清空全部痕迹</span>
|
<span>清空全部痕迹</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -97,7 +92,6 @@
|
||||||
alt=""
|
alt=""
|
||||||
id="picture-img"
|
id="picture-img"
|
||||||
style="user-select: none"
|
style="user-select: none"
|
||||||
@load="canvasLoad"
|
|
||||||
/>
|
/>
|
||||||
<canvas id="picture"></canvas>
|
<canvas id="picture"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -151,7 +145,7 @@
|
||||||
}}
|
}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="每题分数" align="center">
|
<el-table-column label="得分" width="50px" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.customFrom.score }}
|
{{ scope.row.customFrom.score }}
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -173,8 +167,8 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
size="large"
|
size="large"
|
||||||
@click="btnClick('lock')"
|
@click="btnClick('lock')"
|
||||||
:disabled="isLockStatus || isLockDisabled"
|
:disabled="isLock"
|
||||||
>{{ isLockStatus ? "已锁定" : "锁 定" }}</el-button
|
>锁 定</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -242,7 +236,6 @@
|
||||||
<span>考号长度:</span>
|
<span>考号长度:</span>
|
||||||
<div>
|
<div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="isLockStatus"
|
|
||||||
:min="4"
|
:min="4"
|
||||||
:max="12"
|
:max="12"
|
||||||
v-model="drawerForm.examId.examIdLength"
|
v-model="drawerForm.examId.examIdLength"
|
||||||
|
|
@ -277,9 +270,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FabricSize
|
<FabricSize
|
||||||
:change="changeFabricPositionNumber"
|
:change="changeFabricPosition"
|
||||||
ref="FabricSizeRef"
|
ref="FabricSizeRef"
|
||||||
v-if="currentFabric"
|
v-if="ctx.getActiveObject()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-custom-style-body-footer">
|
<div class="drawer-custom-style-body-footer">
|
||||||
|
|
@ -317,10 +310,7 @@
|
||||||
<div>
|
<div>
|
||||||
<span>排列:</span>
|
<span>排列:</span>
|
||||||
<div>
|
<div>
|
||||||
<el-radio-group
|
<el-radio-group v-model="drawerForm.objective.range">
|
||||||
v-model="drawerForm.objective.range"
|
|
||||||
:disabled="isLockStatus"
|
|
||||||
>
|
|
||||||
<el-radio :value="0">横向</el-radio>
|
<el-radio :value="0">横向</el-radio>
|
||||||
<el-radio :value="1">竖向</el-radio>
|
<el-radio :value="1">竖向</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
|
@ -333,7 +323,7 @@
|
||||||
style="width: 164px"
|
style="width: 164px"
|
||||||
v-model="drawerForm.objective.optionNumber"
|
v-model="drawerForm.objective.optionNumber"
|
||||||
:min="2"
|
:min="2"
|
||||||
:disabled="drawerForm.objective.questionTypeValue === 2 || isLockStatus"
|
:disabled="drawerForm.objective.questionTypeValue === 2"
|
||||||
:step-strictly="true"
|
:step-strictly="true"
|
||||||
:max="24"
|
:max="24"
|
||||||
/>
|
/>
|
||||||
|
|
@ -343,7 +333,6 @@
|
||||||
<span>题量:</span>
|
<span>题量:</span>
|
||||||
<div>
|
<div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="isLockStatus"
|
|
||||||
style="width: 164px"
|
style="width: 164px"
|
||||||
v-model="drawerForm.objective.questionNumber"
|
v-model="drawerForm.objective.questionNumber"
|
||||||
:min="1"
|
:min="1"
|
||||||
|
|
@ -356,7 +345,6 @@
|
||||||
<span>题号:</span>
|
<span>题号:</span>
|
||||||
<div>
|
<div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="isLockStatus"
|
|
||||||
v-model="drawerForm.objective.questionBefore"
|
v-model="drawerForm.objective.questionBefore"
|
||||||
:min="1"
|
:min="1"
|
||||||
:controls="false"
|
:controls="false"
|
||||||
|
|
@ -373,10 +361,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>每题分数:</span>
|
<span>得分:</span>
|
||||||
<div>
|
<div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="isLockStatus"
|
|
||||||
style="width: 164px"
|
style="width: 164px"
|
||||||
v-model="drawerForm.objective.score"
|
v-model="drawerForm.objective.score"
|
||||||
:min="0"
|
:min="0"
|
||||||
|
|
@ -415,9 +402,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FabricSize
|
<FabricSize
|
||||||
:change="changeFabricPositionNumber"
|
:change="changeFabricPosition"
|
||||||
ref="FabricSizeRef"
|
ref="FabricSizeRef"
|
||||||
v-if="currentFabric"
|
v-if="ctx.getActiveObject()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-custom-style-body-footer">
|
<div class="drawer-custom-style-body-footer">
|
||||||
|
|
@ -462,7 +449,6 @@
|
||||||
<div>
|
<div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="drawerForm.subjective.questionBefore"
|
v-model="drawerForm.subjective.questionBefore"
|
||||||
:disabled="isLockStatus"
|
|
||||||
:min="1"
|
:min="1"
|
||||||
:controls="false"
|
:controls="false"
|
||||||
:step-strictly="true"
|
:step-strictly="true"
|
||||||
|
|
@ -475,7 +461,6 @@
|
||||||
——
|
——
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="drawerForm.subjective.questionAfter"
|
v-model="drawerForm.subjective.questionAfter"
|
||||||
:disabled="isLockStatus"
|
|
||||||
:min="1"
|
:min="1"
|
||||||
:controls="false"
|
:controls="false"
|
||||||
:step-strictly="true"
|
:step-strictly="true"
|
||||||
|
|
@ -484,11 +469,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>每题分数:</span>
|
<span>得分:</span>
|
||||||
<div>
|
<div>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="drawerForm.subjective.score"
|
v-model="drawerForm.subjective.score"
|
||||||
:disabled="isLockStatus"
|
|
||||||
style="width: 152px"
|
style="width: 152px"
|
||||||
:min="0"
|
:min="0"
|
||||||
:precision="1"
|
:precision="1"
|
||||||
|
|
@ -497,9 +481,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FabricSize
|
<FabricSize
|
||||||
:change="changeFabricPositionNumber"
|
:change="changeFabricPosition"
|
||||||
ref="FabricSizeRef"
|
ref="FabricSizeRef"
|
||||||
v-if="currentFabric"
|
v-if="ctx.getActiveObject()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-custom-style-body-footer">
|
<div class="drawer-custom-style-body-footer">
|
||||||
|
|
@ -732,9 +716,7 @@ const templateInfo = reactive<any>({
|
||||||
questionList: [],
|
questionList: [],
|
||||||
otherData: [],
|
otherData: [],
|
||||||
});
|
});
|
||||||
const isLockStatus = ref<boolean>(false);
|
const isLock = ref<boolean>(false);
|
||||||
const isLockDisabled = ref<boolean>(false);
|
|
||||||
const currentNavListIndex = ref<number>(3);
|
|
||||||
// 画布相关
|
// 画布相关
|
||||||
const ctx = ref<any>(null);
|
const ctx = ref<any>(null);
|
||||||
const fabricGroup = ref<any>(null);
|
const fabricGroup = ref<any>(null);
|
||||||
|
|
@ -744,13 +726,11 @@ const currentFabric = ref<any>(null);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
GetOcrDetail(router.currentRoute.value.query.mid as string).then((res: any) => {
|
GetOcrDetail(router.currentRoute.value.query.mid as string).then((res: any) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const { mainName, hasPosition, paperType, detail, isLock } = res.data;
|
templateInfo.name = res.data.mainName;
|
||||||
isLockStatus.value = isLock;
|
templateInfo.hasPosition = res.data.hasPosition;
|
||||||
templateInfo.name = mainName;
|
templateInfo.type = res.data.paperType === 1 ? "A3" : "A4";
|
||||||
templateInfo.hasPosition = hasPosition;
|
templateInfo.otherData = res.data.detail;
|
||||||
templateInfo.type = paperType === 1 ? "A3" : "A4";
|
res.data.detail.forEach((item: any, index: number) => {
|
||||||
templateInfo.otherData = detail.sort((a: any, b: any) => a.pageIndex - b.pageIndex);
|
|
||||||
templateInfo.otherData.forEach((item: any, index: number) => {
|
|
||||||
templateInfo.imgSrc.push(item.tempPicture64);
|
templateInfo.imgSrc.push(item.tempPicture64);
|
||||||
if (item.tempData) {
|
if (item.tempData) {
|
||||||
index === 0
|
index === 0
|
||||||
|
|
@ -758,46 +738,7 @@ onMounted(() => {
|
||||||
: (templateInfo.tailsList = JSON.parse(JSON.parse(item.tempData).tempData));
|
: (templateInfo.tailsList = JSON.parse(JSON.parse(item.tempData).tempData));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
nextTick(() => {
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => templateInfo,
|
|
||||||
(_new, _old) => {
|
|
||||||
if (!_new.headList[2].point.length && !_new.tailsList[2].point.length) {
|
|
||||||
isLockDisabled.value = true;
|
|
||||||
currentNavListIndex.value = 2;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!_new.headList[1].point.length && !_new.tailsList[1].point.length) {
|
|
||||||
isLockDisabled.value = true;
|
|
||||||
currentNavListIndex.value = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_new.hasPosition) {
|
|
||||||
if (_new.imgSrc.length === 2) {
|
|
||||||
if (_new.headList[0].point.length !== 4 || _new.tailsList[0].point.length !== 4) {
|
|
||||||
isLockDisabled.value = true;
|
|
||||||
currentNavListIndex.value = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (_new.headList[0].point.length !== 4) {
|
|
||||||
isLockDisabled.value = true;
|
|
||||||
currentNavListIndex.value = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isLockDisabled.value = false;
|
|
||||||
},
|
|
||||||
{ deep: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
// 图片加载完成
|
|
||||||
const canvasLoad = (): void => {
|
|
||||||
if (!ctx.value) {
|
|
||||||
initCanvas();
|
initCanvas();
|
||||||
navListIndex.value = templateInfo.hasPosition ? 0 : 1; //无定位点默认起始下标为1
|
navListIndex.value = templateInfo.hasPosition ? 0 : 1; //无定位点默认起始下标为1
|
||||||
if (!templateInfo.hasPosition) {
|
if (!templateInfo.hasPosition) {
|
||||||
|
|
@ -806,11 +747,39 @@ const canvasLoad = (): void => {
|
||||||
}
|
}
|
||||||
setQuestionList(); //回显试题
|
setQuestionList(); //回显试题
|
||||||
showFabricData(); //回显画布
|
showFabricData(); //回显画布
|
||||||
setStepClick(currentNavListIndex.value, false); //设置步骤
|
|
||||||
setNavTitle(); //设置导航栏文字
|
setNavTitle(); //设置导航栏文字
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
});
|
||||||
|
watch(
|
||||||
|
() => templateInfo,
|
||||||
|
(_new, _old) => {
|
||||||
|
if (!_new.headList[2].point.length && !_new.tailsList[2].point.length) {
|
||||||
|
isLock.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!_new.headList[1].point.length && !_new.tailsList[1].point.length) {
|
||||||
|
isLock.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_new.hasPosition) {
|
||||||
|
if (_new.imgSrc.length === 2) {
|
||||||
|
if (_new.headList[0].point.length !== 4 || _new.tailsList[0].point.length !== 4) {
|
||||||
|
isLock.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_new.headList[0].point.length !== 4) {
|
||||||
|
isLock.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isLock.value = false;
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
// 初始化画布并添加事件
|
// 初始化画布并添加事件
|
||||||
const initCanvas = (): void => {
|
const initCanvas = (): void => {
|
||||||
imgDom.value = document.getElementById("picture-img");
|
imgDom.value = document.getElementById("picture-img");
|
||||||
|
|
@ -819,10 +788,6 @@ const initCanvas = (): void => {
|
||||||
height: imgDom.value.clientHeight,
|
height: imgDom.value.clientHeight,
|
||||||
});
|
});
|
||||||
ctx.value.on("mouse:down", (e: any) => {
|
ctx.value.on("mouse:down", (e: any) => {
|
||||||
if (isLockStatus.value && !e.target) {
|
|
||||||
ElMessage.error("已锁定,无法新增!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const templateInfoItem = getTemplateInfo(true);
|
const templateInfoItem = getTemplateInfo(true);
|
||||||
if (templateInfoItem[0].point.length === 4) {
|
if (templateInfoItem[0].point.length === 4) {
|
||||||
if (isMoveOutView()) {
|
if (isMoveOutView()) {
|
||||||
|
|
@ -839,9 +804,6 @@ const initCanvas = (): void => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.target) {
|
|
||||||
setStepClick(e.target.get("fabricType"));
|
|
||||||
}
|
|
||||||
canvasMouseDown(e.e, e.target, e.subTargets);
|
canvasMouseDown(e.e, e.target, e.subTargets);
|
||||||
});
|
});
|
||||||
ctx.value.on("mouse:move", (e: any) => {
|
ctx.value.on("mouse:move", (e: any) => {
|
||||||
|
|
@ -930,15 +892,9 @@ const canvasMouseDown = (e: MouseEvent, target: any, subTargets: any): void => {
|
||||||
const itemTarget = target
|
const itemTarget = target
|
||||||
.getObjects()
|
.getObjects()
|
||||||
.find((i: any) => i.fabricId === row.fabricId);
|
.find((i: any) => i.fabricId === row.fabricId);
|
||||||
if (itemTarget && row.fabricId === itemTarget.fabricId) {
|
itemTarget && row.fabricId === itemTarget.fabricId
|
||||||
if (isLockStatus.value && itemTarget.get("text") === "删除") {
|
? itemTarget.set({ visible: true })
|
||||||
row.set({ visible: false });
|
: row.set({ visible: false });
|
||||||
} else {
|
|
||||||
itemTarget.set({ visible: true });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
row.set({ visible: false });
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
row.set({ visible: false });
|
row.set({ visible: false });
|
||||||
}
|
}
|
||||||
|
|
@ -1004,7 +960,7 @@ const canvasMouseUp = async (): Promise<void> => {
|
||||||
hasControls: false,
|
hasControls: false,
|
||||||
subTargetCheck: true,
|
subTargetCheck: true,
|
||||||
borderColor: "transparent",
|
borderColor: "transparent",
|
||||||
selectionBackgroundColor: "red",
|
selectionBackgroundColor: "transparent",
|
||||||
fabricType: navListIndex.value,
|
fabricType: navListIndex.value,
|
||||||
fabricId: cteatedNumber(),
|
fabricId: cteatedNumber(),
|
||||||
}).on("mousemove", (e: any) => {
|
}).on("mousemove", (e: any) => {
|
||||||
|
|
@ -1047,13 +1003,9 @@ const canvasMouseUp = async (): Promise<void> => {
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const rectTitle = ["右上角", "右下角"];
|
const rectTitle = ["右上角", "右下角"];
|
||||||
const rectFooterTitle = ["左下角", "右下角"];
|
|
||||||
if (rectTitle.includes(getCurrentText())) {
|
if (rectTitle.includes(getCurrentText())) {
|
||||||
res.data.x = res.data.x + res.data.width;
|
res.data.x = res.data.x + res.data.width;
|
||||||
}
|
}
|
||||||
if (rectFooterTitle.includes(getCurrentText())) {
|
|
||||||
res.data.y = res.data.y - res.data.height;
|
|
||||||
}
|
|
||||||
addFabric(
|
addFabric(
|
||||||
"rect",
|
"rect",
|
||||||
{ ...obj, title: getTextTitle(), rectPosition: res.data },
|
{ ...obj, title: getTextTitle(), rectPosition: res.data },
|
||||||
|
|
@ -1061,9 +1013,7 @@ const canvasMouseUp = async (): Promise<void> => {
|
||||||
left: rectTitle.includes(getCurrentText())
|
left: rectTitle.includes(getCurrentText())
|
||||||
? res.data.x - res.data.width
|
? res.data.x - res.data.width
|
||||||
: res.data.x,
|
: res.data.x,
|
||||||
top: rectFooterTitle.includes(getCurrentText())
|
top: res.data.y,
|
||||||
? res.data.y + res.data.height
|
|
||||||
: res.data.y,
|
|
||||||
width: res.data.width,
|
width: res.data.width,
|
||||||
height: res.data.height,
|
height: res.data.height,
|
||||||
stroke: "red",
|
stroke: "red",
|
||||||
|
|
@ -1144,18 +1094,14 @@ const createText = (
|
||||||
text: string,
|
text: string,
|
||||||
left: number,
|
left: number,
|
||||||
top: number,
|
top: number,
|
||||||
backgroundColor: string = "rgba(0,0,0,0.5)",
|
backgroundColor: string = "rgba(0,0,0,0.5)"
|
||||||
fill: string = "white",
|
|
||||||
fontSize: number = 16,
|
|
||||||
fontWeight: string = "normal"
|
|
||||||
): any => {
|
): any => {
|
||||||
return new fabric.Text(text, {
|
return new fabric.Text(text, {
|
||||||
left,
|
left,
|
||||||
top,
|
top,
|
||||||
fontSize,
|
fontSize: 16,
|
||||||
fill,
|
fill: "white",
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
fontWeight,
|
|
||||||
fabricId: cteatedNumber(),
|
fabricId: cteatedNumber(),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -1231,14 +1177,13 @@ const createFabric = (): any[] => {
|
||||||
case 1:
|
case 1:
|
||||||
case 5:
|
case 5:
|
||||||
return [titleText, deleteText];
|
return [titleText, deleteText];
|
||||||
case 3:
|
|
||||||
return [deleteText, editText];
|
|
||||||
default:
|
default:
|
||||||
return [titleText, deleteText, editText];
|
return [titleText, deleteText, editText];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 切换步骤
|
// 切换步骤
|
||||||
const setStepClick = (index: number, isElMessage: boolean = true): void => {
|
const setStepClick = (index: number): void => {
|
||||||
if (navListIndex.value === index) {
|
if (navListIndex.value === index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1277,7 +1222,7 @@ const setStepClick = (index: number, isElMessage: boolean = true): void => {
|
||||||
checkTemplateInfo(index);
|
checkTemplateInfo(index);
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
if (isElMessage) ElMessage.error(msg);
|
ElMessage.error(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (index === 1) {
|
if (index === 1) {
|
||||||
|
|
@ -1318,9 +1263,6 @@ const saveFabricData = (): void => {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: child.get("text"),
|
text: child.get("text"),
|
||||||
backgroundColor: child.get("backgroundColor"),
|
backgroundColor: child.get("backgroundColor"),
|
||||||
fill: child.get("fill"),
|
|
||||||
fontSize: child.get("fontSize"),
|
|
||||||
fontWeight: child.get("fontWeight"),
|
|
||||||
...childItem,
|
...childItem,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1486,7 +1428,7 @@ const isDisabledDraw = (): boolean => {
|
||||||
fabricItem.forEach((item: any) => {
|
fabricItem.forEach((item: any) => {
|
||||||
let row = item.getObjects().filter((obj: any) => obj.get("text") === "缺考");
|
let row = item.getObjects().filter((obj: any) => obj.get("text") === "缺考");
|
||||||
if (row) {
|
if (row) {
|
||||||
hasQueKao.push(...row);
|
hasQueKao.push(row);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
isDisabledDrawStatus = hasQueKao.length === 0;
|
isDisabledDrawStatus = hasQueKao.length === 0;
|
||||||
|
|
@ -1624,12 +1566,11 @@ const showFabricData = (): void => {
|
||||||
top: item.top,
|
top: item.top,
|
||||||
width: item.width,
|
width: item.width,
|
||||||
height: item.height,
|
height: item.height,
|
||||||
|
fontSize: 16,
|
||||||
|
fill: "white",
|
||||||
backgroundColor: item.backgroundColor,
|
backgroundColor: item.backgroundColor,
|
||||||
fill: item.fill || "white",
|
|
||||||
fontSize: item.fontSize || 16,
|
|
||||||
fabricId: cteatedNumber(),
|
fabricId: cteatedNumber(),
|
||||||
visible: !textFabricList.value.includes(item.text),
|
visible: !textFabricList.value.includes(item.text),
|
||||||
fontWeight: item.fontWeight || "normal",
|
|
||||||
}).on("mousedown", (e: any) => {
|
}).on("mousedown", (e: any) => {
|
||||||
if (textFabricList.value.includes(item.text)) {
|
if (textFabricList.value.includes(item.text)) {
|
||||||
addEventClick(e);
|
addEventClick(e);
|
||||||
|
|
@ -1647,7 +1588,7 @@ const showFabricData = (): void => {
|
||||||
hasControls: false,
|
hasControls: false,
|
||||||
subTargetCheck: true,
|
subTargetCheck: true,
|
||||||
borderColor: "transparent",
|
borderColor: "transparent",
|
||||||
selectionBackgroundColor: "rgba(255,0,0,0.5)",
|
selectionBackgroundColor: "transparent",
|
||||||
fabricType: item.fabricType,
|
fabricType: item.fabricType,
|
||||||
left: item.left,
|
left: item.left,
|
||||||
top: item.top,
|
top: item.top,
|
||||||
|
|
@ -1714,22 +1655,6 @@ const cteatedNumber = (): string => {
|
||||||
return `${Math.floor(Math.random() * 100000000)}+${+new Date()}`;
|
return `${Math.floor(Math.random() * 100000000)}+${+new Date()}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 修改尺寸数字
|
|
||||||
const changeFabricPositionNumber = (value: number | boolean, str: string): void => {
|
|
||||||
let number = 0;
|
|
||||||
if (typeof value === "boolean") {
|
|
||||||
number = JSON.parse(JSON.stringify(currentFabric.value.target.get(str)));
|
|
||||||
if (value) {
|
|
||||||
number--;
|
|
||||||
} else {
|
|
||||||
number++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
number = value;
|
|
||||||
}
|
|
||||||
changeFabricPosition(number, str);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 编辑尺寸
|
// 编辑尺寸
|
||||||
const changeFabricPosition = (value: number, str: string): void => {
|
const changeFabricPosition = (value: number, str: string): void => {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
@ -1790,8 +1715,7 @@ const changeFabricPosition = (value: number, str: string): void => {
|
||||||
maxRect.set("top", value / 2 - value);
|
maxRect.set("top", value / 2 - value);
|
||||||
currentFabric.value.target.set(str, value + textList[0].height * 2);
|
currentFabric.value.target.set(str, value + textList[0].height * 2);
|
||||||
}
|
}
|
||||||
let rectWidth = 0,
|
let rectWidth, rectHeight;
|
||||||
rectHeight = 0;
|
|
||||||
switch (navListIndex.value) {
|
switch (navListIndex.value) {
|
||||||
// 考号
|
// 考号
|
||||||
case 2:
|
case 2:
|
||||||
|
|
@ -1821,25 +1745,17 @@ const changeFabricPosition = (value: number, str: string): void => {
|
||||||
// 客观题
|
// 客观题
|
||||||
let questionNumber = currentFabric.value.target.customFrom.questionNumber;
|
let questionNumber = currentFabric.value.target.customFrom.questionNumber;
|
||||||
let optionNumber = currentFabric.value.target.customFrom.optionNumber;
|
let optionNumber = currentFabric.value.target.customFrom.optionNumber;
|
||||||
let range = currentFabric.value.target.customFrom.range;
|
rectWidth = maxRect.get("width") / optionNumber;
|
||||||
rectWidth = maxRect.get("width") / (range ? questionNumber : optionNumber);
|
rectHeight = maxRect.get("height") / questionNumber;
|
||||||
rectHeight = maxRect.get("height") / (range ? optionNumber : questionNumber);
|
|
||||||
changeTextPosition();
|
changeTextPosition();
|
||||||
deleteSmallRect();
|
deleteSmallRect();
|
||||||
for (let index = 0; index < optionNumber * questionNumber; index++) {
|
for (let index = 0; index < optionNumber * questionNumber; index++) {
|
||||||
currentFabric.value.target.add(
|
currentFabric.value.target.add(
|
||||||
new fabric.Rect({
|
new fabric.Rect({
|
||||||
left:
|
left: maxRect.get("left") + (index % optionNumber) * rectWidth,
|
||||||
maxRect.get("left") +
|
|
||||||
(index % (range ? questionNumber : optionNumber)) * rectWidth,
|
|
||||||
top:
|
top:
|
||||||
maxRect.get("top") +
|
maxRect.get("top") +
|
||||||
getOffsetTop(
|
getOffsetTop(optionNumber, questionNumber, index, rectHeight),
|
||||||
range ? questionNumber : optionNumber,
|
|
||||||
range ? optionNumber : questionNumber,
|
|
||||||
index,
|
|
||||||
rectHeight
|
|
||||||
),
|
|
||||||
stroke: "red",
|
stroke: "red",
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
fill: "transparent",
|
fill: "transparent",
|
||||||
|
|
@ -1849,35 +1765,6 @@ const changeFabricPosition = (value: number, str: string): void => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// 修改题号位置
|
|
||||||
const questionNumberList = currentFabric.value.target
|
|
||||||
.getObjects()
|
|
||||||
.filter(
|
|
||||||
(item: any) =>
|
|
||||||
item.get("type") === "text" &&
|
|
||||||
!textFabricList.value.includes(item.get("text"))
|
|
||||||
);
|
|
||||||
questionNumberList.forEach((item: any, index: number) => {
|
|
||||||
if (range) {
|
|
||||||
item.set({
|
|
||||||
left:
|
|
||||||
maxRect.get("left") +
|
|
||||||
rectWidth * index +
|
|
||||||
rectWidth / 2 -
|
|
||||||
(questionNumber + 1),
|
|
||||||
top: maxRect.get("top") + 4,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
item.set({
|
|
||||||
top:
|
|
||||||
maxRect.get("top") +
|
|
||||||
rectHeight * index +
|
|
||||||
rectHeight / 2 -
|
|
||||||
(questionNumber + 1),
|
|
||||||
left: maxRect.get("left") + 4,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// 主观题
|
// 主观题
|
||||||
|
|
@ -1999,7 +1886,7 @@ const changeFabricInfo = (bool: boolean): void => {
|
||||||
left: fabricItem.get("customFrom").left,
|
left: fabricItem.get("customFrom").left,
|
||||||
top: fabricItem.get("customFrom").top,
|
top: fabricItem.get("customFrom").top,
|
||||||
width: fabricItem.get("customFrom").width,
|
width: fabricItem.get("customFrom").width,
|
||||||
height: fabricItem.get("customFrom").height,
|
height: fabricItem.get("customFrom").top,
|
||||||
};
|
};
|
||||||
if (bool) {
|
if (bool) {
|
||||||
switch (navListIndex.value) {
|
switch (navListIndex.value) {
|
||||||
|
|
@ -2111,11 +1998,12 @@ const changeFabricInfo = (bool: boolean): void => {
|
||||||
case 3:
|
case 3:
|
||||||
// 客观题
|
// 客观题
|
||||||
// 生成小格子
|
// 生成小格子
|
||||||
function createdObjectiveRect(
|
function createdObjectiveRect(): void {
|
||||||
rect: any,
|
let rect = fabricItem
|
||||||
rectWidth: number,
|
.getObjects()
|
||||||
rectHeight: number
|
.find((row: any) => row.get("type") === "rect");
|
||||||
): void {
|
let rectWidth = rect.get("width") / drawerForm.objective.optionNumber;
|
||||||
|
let rectHeight = rect.get("height") / drawerForm.objective.questionNumber;
|
||||||
for (
|
for (
|
||||||
let index = 0;
|
let index = 0;
|
||||||
index <
|
index <
|
||||||
|
|
@ -2126,20 +2014,12 @@ const changeFabricInfo = (bool: boolean): void => {
|
||||||
new fabric.Rect({
|
new fabric.Rect({
|
||||||
left:
|
left:
|
||||||
rect.get("left") +
|
rect.get("left") +
|
||||||
(index %
|
(index % drawerForm.objective.optionNumber) * rectWidth,
|
||||||
(drawerForm.objective.range
|
|
||||||
? drawerForm.objective.questionNumber
|
|
||||||
: drawerForm.objective.optionNumber)) *
|
|
||||||
rectWidth,
|
|
||||||
top:
|
top:
|
||||||
rect.get("top") +
|
rect.get("top") +
|
||||||
getOffsetTop(
|
getOffsetTop(
|
||||||
drawerForm.objective.range
|
drawerForm.objective.optionNumber,
|
||||||
? drawerForm.objective.questionNumber
|
drawerForm.objective.questionNumber,
|
||||||
: drawerForm.objective.optionNumber,
|
|
||||||
drawerForm.objective.range
|
|
||||||
? drawerForm.objective.optionNumber
|
|
||||||
: drawerForm.objective.questionNumber,
|
|
||||||
index,
|
index,
|
||||||
rectHeight
|
rectHeight
|
||||||
),
|
),
|
||||||
|
|
@ -2157,21 +2037,11 @@ const changeFabricInfo = (bool: boolean): void => {
|
||||||
ElMessage.error("题目重复!");
|
ElMessage.error("题目重复!");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
let rect = fabricItem
|
deleteSmallRect();
|
||||||
.getObjects()
|
createdObjectiveRect();
|
||||||
.find((row: any) => row.get("type") === "rect");
|
textTitle.set({
|
||||||
let rectWidth =
|
text: `${drawerForm.objective.questionBefore}-${drawerForm.objective.questionAfter}`,
|
||||||
rect.get("width") /
|
});
|
||||||
(drawerForm.objective.range
|
|
||||||
? drawerForm.objective.questionNumber
|
|
||||||
: drawerForm.objective.optionNumber);
|
|
||||||
let rectHeight =
|
|
||||||
rect.get("height") /
|
|
||||||
(drawerForm.objective.range
|
|
||||||
? drawerForm.objective.optionNumber
|
|
||||||
: drawerForm.objective.questionNumber);
|
|
||||||
deleteSmallRect(navListIndex.value);
|
|
||||||
createdObjectiveRect(rect, rectWidth, rectHeight);
|
|
||||||
fabricItem.set({
|
fabricItem.set({
|
||||||
customFrom: {
|
customFrom: {
|
||||||
fabricAttribute: drawerForm.objective.questionTypeValue,
|
fabricAttribute: drawerForm.objective.questionTypeValue,
|
||||||
|
|
@ -2184,7 +2054,6 @@ const changeFabricInfo = (bool: boolean): void => {
|
||||||
...obj,
|
...obj,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
objectiveNumber(fabricItem, rect, rectWidth, rectHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -2288,72 +2157,8 @@ const getOffsetTop = (
|
||||||
return offsetTop * top;
|
return offsetTop * top;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 客观题生成题号
|
|
||||||
const objectiveNumber = (
|
|
||||||
fabricItem: any,
|
|
||||||
rect: any,
|
|
||||||
rectWidth: number,
|
|
||||||
rectHeight: number
|
|
||||||
): void => {
|
|
||||||
// 边距
|
|
||||||
const obj = {
|
|
||||||
fontSize: 12,
|
|
||||||
fill: "black",
|
|
||||||
fontWeight: "normal",
|
|
||||||
fabricId: cteatedNumber(),
|
|
||||||
backgroundColor: "transparent",
|
|
||||||
};
|
|
||||||
if (drawerForm.objective.range) {
|
|
||||||
// 竖向
|
|
||||||
for (let index = 0; index < drawerForm.objective.questionNumber; index++) {
|
|
||||||
let textNumber = 0 as any;
|
|
||||||
if (drawerForm.objective.questionBefore % 1 === 0) {
|
|
||||||
textNumber = drawerForm.objective.questionBefore++;
|
|
||||||
} else {
|
|
||||||
let before = drawerForm.objective.questionBefore.toString().split(".")[0] * 1;
|
|
||||||
let after = drawerForm.objective.questionBefore.toString().split(".")[1] * 1;
|
|
||||||
textNumber = `${before}.${after + index}`;
|
|
||||||
}
|
|
||||||
fabricItem.add(
|
|
||||||
new fabric.Text(`${textNumber}`, {
|
|
||||||
left:
|
|
||||||
rect.get("left") +
|
|
||||||
rectWidth * index +
|
|
||||||
rectWidth / 2 -
|
|
||||||
(drawerForm.objective.questionNumber + 1),
|
|
||||||
top: rect.get("top") + 4,
|
|
||||||
...obj,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 横向
|
|
||||||
for (let index = 0; index < drawerForm.objective.questionNumber; index++) {
|
|
||||||
let textNumber = 0 as any;
|
|
||||||
if (drawerForm.objective.questionBefore % 1 === 0) {
|
|
||||||
textNumber = drawerForm.objective.questionBefore++;
|
|
||||||
} else {
|
|
||||||
let before = drawerForm.objective.questionBefore.toString().split(".")[0] * 1;
|
|
||||||
let after = drawerForm.objective.questionBefore.toString().split(".")[1] * 1;
|
|
||||||
textNumber = `${before}.${after + index}`;
|
|
||||||
}
|
|
||||||
fabricItem.add(
|
|
||||||
new fabric.Text(`${textNumber}`, {
|
|
||||||
left: rect.get("left") + 4,
|
|
||||||
top:
|
|
||||||
rect.get("top") +
|
|
||||||
rectHeight * index +
|
|
||||||
rectHeight / 2 -
|
|
||||||
(drawerForm.objective.questionNumber + 1),
|
|
||||||
...obj,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 清空小矩形
|
// 清空小矩形
|
||||||
const deleteSmallRect = (index?: number): void => {
|
const deleteSmallRect = (): void => {
|
||||||
if (currentFabric.value) {
|
if (currentFabric.value) {
|
||||||
const maxRect = currentFabric.value.target
|
const maxRect = currentFabric.value.target
|
||||||
.getObjects()
|
.getObjects()
|
||||||
|
|
@ -2367,19 +2172,6 @@ const deleteSmallRect = (index?: number): void => {
|
||||||
item.get("type") === "rect" && item.get("fabricId") !== maxRect.get("fabricId")
|
item.get("type") === "rect" && item.get("fabricId") !== maxRect.get("fabricId")
|
||||||
);
|
);
|
||||||
currentFabric.value.target.remove(...deleteRectArr);
|
currentFabric.value.target.remove(...deleteRectArr);
|
||||||
switch (index) {
|
|
||||||
case 3:
|
|
||||||
// 客观题删除题号
|
|
||||||
const allDelText = currentFabric.value.target
|
|
||||||
.getObjects()
|
|
||||||
.filter(
|
|
||||||
(item: any) =>
|
|
||||||
item.get("type") === "text" &&
|
|
||||||
!textFabricList.value.includes(item.get("text"))
|
|
||||||
);
|
|
||||||
currentFabric.value.target.remove(...allDelText);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2534,10 +2326,6 @@ const isQuestionNumerRepeat = (): boolean => {
|
||||||
|
|
||||||
// 修改考试类型
|
// 修改考试类型
|
||||||
const changeExamType = (type: number): void => {
|
const changeExamType = (type: number): void => {
|
||||||
if (isLockStatus.value) {
|
|
||||||
ElMessage.error("已锁定,无法修改!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
drawerForm.examId.examType = type;
|
drawerForm.examId.examType = type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2578,10 +2366,6 @@ const changeQuestion = (e?: any): void => {
|
||||||
|
|
||||||
// 修改客观题题型
|
// 修改客观题题型
|
||||||
const changeObjectiveQuestionType = (item: { value: number; text: string }): void => {
|
const changeObjectiveQuestionType = (item: { value: number; text: string }): void => {
|
||||||
if (isLockStatus.value) {
|
|
||||||
ElMessage.error("已锁定,无法修改!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (navListIndex.value === 3) {
|
if (navListIndex.value === 3) {
|
||||||
drawerForm.objective.questionTypeValue = item.value;
|
drawerForm.objective.questionTypeValue = item.value;
|
||||||
drawerForm.objective.optionNumber =
|
drawerForm.objective.optionNumber =
|
||||||
|
|
@ -2906,40 +2690,16 @@ const changeData = (): any => {
|
||||||
item.from.subjectPoint =
|
item.from.subjectPoint =
|
||||||
item.tempData[1].point.length == 1 ? item.tempData[1].point[0].customFrom : {};
|
item.tempData[1].point.length == 1 ? item.tempData[1].point[0].customFrom : {};
|
||||||
item.from.examIDPoint = item.tempData[2].point.map((row: any) => {
|
item.from.examIDPoint = item.tempData[2].point.map((row: any) => {
|
||||||
return {
|
return row.customFrom;
|
||||||
...row.customFrom,
|
|
||||||
width: row.width,
|
|
||||||
height: row.height - 36.16,
|
|
||||||
top: row.top + 17,
|
|
||||||
left: row.left,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
item.from.objectiveQuestionsPoint = item.tempData[3].point.map((row: any) => {
|
item.from.objectiveQuestionsPoint = item.tempData[3].point.map((row: any) => {
|
||||||
return {
|
return row.customFrom;
|
||||||
...row.customFrom,
|
|
||||||
width: row.width,
|
|
||||||
height: row.height - 36.16,
|
|
||||||
top: row.top + 17,
|
|
||||||
left: row.left,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
item.from.subjectiveQuestionsPoint = item.tempData[4].point.map((row: any) => {
|
item.from.subjectiveQuestionsPoint = item.tempData[4].point.map((row: any) => {
|
||||||
return {
|
return row.customFrom;
|
||||||
...row.customFrom,
|
|
||||||
width: row.width,
|
|
||||||
height: row.height - 36.16,
|
|
||||||
top: row.top + 17,
|
|
||||||
left: row.left,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
item.from.otherPoint = item.tempData[5].point.map((row: any) => {
|
item.from.otherPoint = item.tempData[5].point.map((row: any) => {
|
||||||
return {
|
return row.customFrom;
|
||||||
...row.customFrom,
|
|
||||||
width: row.width,
|
|
||||||
height: row.height - 36.16 / 2,
|
|
||||||
top: row.top + 17,
|
|
||||||
left: row.left,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
divideByTwoProperties(
|
divideByTwoProperties(
|
||||||
item.from.subjectiveQuestionsPoint,
|
item.from.subjectiveQuestionsPoint,
|
||||||
|
|
@ -3204,19 +2964,14 @@ const save = async (isShow: boolean = false): Promise<void> => {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
@mixin isPageType($type) {
|
@mixin isPageType($number, $type) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
> #zoom-div {
|
> #zoom-div {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@if $type == "A3" {
|
width: calc(210mm * #{$number});
|
||||||
width: 1570px;
|
height: 297mm;
|
||||||
} @else {
|
|
||||||
width: 1200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
height: auto;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
transform-origin: left top;
|
transform-origin: left top;
|
||||||
|
|
@ -3264,11 +3019,11 @@ const save = async (isShow: boolean = false): Promise<void> => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.A4 {
|
.A4 {
|
||||||
@include isPageType("A4");
|
@include isPageType(1, "A4");
|
||||||
}
|
}
|
||||||
|
|
||||||
.A3 {
|
.A3 {
|
||||||
@include isPageType("A3");
|
@include isPageType(2, "A3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue