Ly 1 month ago
commit 54f2a33f09
  1. 1
      .gitignore
  2. 1225
      package-lock.json
  3. 4
      package.json
  4. 23
      pnpm-lock.yaml
  5. 38
      src/api/index.ts
  6. 25
      src/api/user.ts
  7. BIN
      src/assets/images/idea.png
  8. 438
      src/layout/loginPage.vue
  9. 7
      src/main.ts
  10. 9
      src/permissions.ts
  11. 7
      src/router/index.ts
  12. 43
      src/store/modules/setting.ts
  13. 23
      src/store/modules/user.ts
  14. 12
      src/utils/index.ts
  15. 16
      src/utils/setStep.ts
  16. 77
      src/views/compiler/index.vue
  17. 35
      src/views/designRoute/components/wenBenYu.vue
  18. 10
      src/views/designRoute/components/wenBenYu2.vue
  19. 63
      src/views/designRoute/index.vue
  20. 8
      src/views/program/components/yibiao.vue
  21. 269
      src/views/program/index.vue
  22. 2
      tsconfig.json

1
.gitignore vendored

@ -9,6 +9,7 @@ lerna-debug.log*
pnpm-lock.yaml pnpm-lock.yaml
node_modules node_modules
dist dist
package-lock.json
dist-ssr dist-ssr
*.local *.local

1225
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -19,10 +19,12 @@
"@antv/x6-plugin-transform": "^2.1.8", "@antv/x6-plugin-transform": "^2.1.8",
"@antv/x6-vue-shape": "^2.1.2", "@antv/x6-vue-shape": "^2.1.2",
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@highlightjs/vue-plugin": "^2.1.0",
"@kjgl77/datav-vue3": "^1.7.3", "@kjgl77/datav-vue3": "^1.7.3",
"axios": "^1.7.2", "axios": "^1.7.2",
"echarts": "^5.6.0", "echarts": "^5.6.0",
"element-plus": "^2.9.5", "element-plus": "^2.9.5",
"highlight.js": "^11.11.1",
"insert-css": "^2.0.0", "insert-css": "^2.0.0",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"pinia": "^2.1.7", "pinia": "^2.1.7",
@ -41,6 +43,8 @@
"postcss-scss": "^4.0.9", "postcss-scss": "^4.0.9",
"px2rem-loader": "^0.1.9", "px2rem-loader": "^0.1.9",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"unplugin-auto-import": "^19.1.1",
"unplugin-vue-components": "^28.4.1",
"vite": "^5.3.1", "vite": "^5.3.1",
"vue-tsc": "^2.0.21" "vue-tsc": "^2.0.21"
} }

@ -38,6 +38,9 @@ importers:
'@element-plus/icons-vue': '@element-plus/icons-vue':
specifier: ^2.3.1 specifier: ^2.3.1
version: 2.3.1(vue@3.4.29(typescript@5.2.2)) version: 2.3.1(vue@3.4.29(typescript@5.2.2))
'@highlightjs/vue-plugin':
specifier: ^2.1.0
version: 2.1.0(highlight.js@11.11.1)(vue@3.4.29(typescript@5.2.2))
'@kjgl77/datav-vue3': '@kjgl77/datav-vue3':
specifier: ^1.7.3 specifier: ^1.7.3
version: 1.7.3(vue@3.4.29(typescript@5.2.2)) version: 1.7.3(vue@3.4.29(typescript@5.2.2))
@ -50,6 +53,9 @@ importers:
element-plus: element-plus:
specifier: ^2.9.5 specifier: ^2.9.5
version: 2.9.5(vue@3.4.29(typescript@5.2.2)) version: 2.9.5(vue@3.4.29(typescript@5.2.2))
highlight.js:
specifier: ^11.11.1
version: 11.11.1
insert-css: insert-css:
specifier: ^2.0.0 specifier: ^2.0.0
version: 2.0.0 version: 2.0.0
@ -344,6 +350,12 @@ packages:
'@floating-ui/utils@0.2.9': '@floating-ui/utils@0.2.9':
resolution: {integrity: sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==} resolution: {integrity: sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==}
'@highlightjs/vue-plugin@2.1.0':
resolution: {integrity: sha512-E+bmk4ncca+hBEYRV2a+1aIzIV0VSY/e5ArjpuSN9IO7wBJrzUE2u4ESCwrbQD7sAy+jWQjkV5qCCWgc+pu7CQ==}
peerDependencies:
highlight.js: ^11.0.1
vue: ^3
'@jiaminghi/bezier-curve@0.0.9': '@jiaminghi/bezier-curve@0.0.9':
resolution: {integrity: sha512-u9xJPOEl6Dri2E9FfmJoGxYQY7vYJkURNX04Vj64tdi535tPrpkuf9Sm0lNr3QTKdHQh0DdNRsaa62FLQNQEEw==} resolution: {integrity: sha512-u9xJPOEl6Dri2E9FfmJoGxYQY7vYJkURNX04Vj64tdi535tPrpkuf9Sm0lNr3QTKdHQh0DdNRsaa62FLQNQEEw==}
@ -772,6 +784,10 @@ packages:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true hasBin: true
highlight.js@11.11.1:
resolution: {integrity: sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==}
engines: {node: '>=12.0.0'}
htmlparser2@8.0.2: htmlparser2@8.0.2:
resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==} resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}
@ -1362,6 +1378,11 @@ snapshots:
'@floating-ui/utils@0.2.9': {} '@floating-ui/utils@0.2.9': {}
'@highlightjs/vue-plugin@2.1.0(highlight.js@11.11.1)(vue@3.4.29(typescript@5.2.2))':
dependencies:
highlight.js: 11.11.1
vue: 3.4.29(typescript@5.2.2)
'@jiaminghi/bezier-curve@0.0.9': '@jiaminghi/bezier-curve@0.0.9':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
@ -1847,6 +1868,8 @@ snapshots:
he@1.2.0: {} he@1.2.0: {}
highlight.js@11.11.1: {}
htmlparser2@8.0.2: htmlparser2@8.0.2:
dependencies: dependencies:
domelementtype: 2.3.0 domelementtype: 2.3.0

@ -1,17 +1,41 @@
import request from '@/utils/request' import request from "@/utils/request";
export const login = (data: any) => { export const login = (data: any) => {
return request({ return request({
url: '/sys/login', url: "/sys/login",
method: 'post', method: "post",
data data,
});
};
export const getCode = (time: any) => {
return request({
url: "/sys/randomImage/" + time,
});
};
// 获取用户信息
export const getUserInfo = () => {
return request({
url: "/sys/user/getUserInfo",
method: "get",
});
};
// 实验步骤
export const setStep = (params: any) => {
return request({
url: "/experimentrecords/xnExperimentRecords/check",
method: "get",
params
}) })
} }
export const getCode = (time: any) => { // 获取步骤id
export const getStepId = () => {
return request({ return request({
url: '/sys/randomImage/' + time, url: "/experimentrecords/xnExperimentRecords/getProcedureList",
method: "get",
}) })
} }
//试题表 //试题表
export const subTestapi = () => { export const subTestapi = () => {
return request({ return request({

@ -0,0 +1,25 @@
import request from '@/utils/request'
export const getCode = (time: any) => {
return request({
url: '/sys/randomImage/' + time,
})
}
// 获取院系列表
export const getFaculties = (params: any) => {
return request({
url: '/sys/sysDepart/stu',
params,
})
}
// 注册
export const sturegister = (data: any) => {
return request({
url: '/sys/user/stuRegister',
method: 'POST',
data,
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

@ -6,68 +6,146 @@
<div class="main-content"> <div class="main-content">
<el-row style="display: flex; justify-content: center"> <el-row style="display: flex; justify-content: center">
<el-col> <el-col>
<el-form <el-form :rules="rules" :model="formModel" ref="formRef" size="large" autocomplete="off" v-if="isRegister">
:rules="rules" <el-form-item prop="username" class="custom-form-item">
:model="formModel" <div style="display: flex; align-items: center; color: pink">
ref="formRef" <div class="left" style="display: flex; align-items: center;width: 90px;">
size="large" <div style="padding-right: 10px; color: #1084c1">
autocomplete="off" <el-icon class="bold-icon">
v-if="isRegister" <User />
> </el-icon>
<el-form-item prop="username"> </div>
<el-input <div style="padding-right: 10px; color: #2592a1">用户账号</div>
v-model="formModel.username" </div>
:prefix-icon="User" <div class="right">
placeholder="请输入账号" <el-input v-model="formModel.username" style="border-color: #20bec8;"
></el-input> placeholder="请输入用户账号"></el-input>
</el-form-item> </div>
<el-form-item prop="studentNumb"> </div>
<el-input
v-model="formModel.studentNumb"
:prefix-icon="Avatar"
placeholder="请输入学号"
></el-input>
</el-form-item>
<el-form-item prop="name">
<el-input
v-model="formModel.name"
:prefix-icon="Stamp"
placeholder="请输入姓名"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <div style="display: flex; align-items: center;">
v-model="formModel.password" <div class="left" style="display: flex; align-items: center ;width: 90px;">
:prefix-icon="Lock" <div style="padding-right: 10px; color: #1084c1">
type="password" <el-icon class="bold-icon">
placeholder="请输入密码" <Lock />
></el-input> </el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">用户密码</div>
</div>
<div class="right">
<el-input type="password" v-model="formModel.password" style="border-color: #20bec8"
placeholder="请输入密码" show-password></el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item prop="repassword"> <el-form-item prop="repassword">
<el-input <div style="display: flex; align-items: center;">
v-model="formModel.repassword" <div class="left" style="display: flex; align-items: center ;width: 90px;">
:prefix-icon="Lock" <div style="padding-right: 10px; color: #1084c1">
type="password" <el-icon class="bold-icon">
placeholder="请输入再次密码" <Lock />
></el-input> </el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">确认密码</div>
</div>
<div class="right">
<el-input type="password" v-model="formModel.repassword" style="border-color: #20bec8"
placeholder="请再次输入密码" show-password></el-input>
</div>
</div>
</el-form-item>
<el-form-item prop="name" class="custom-form-item">
<div style="display: flex; align-items: center; color: pink">
<div class="left" style="display: flex; align-items: center;width: 90px;">
<div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon">
<Stamp />
</el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">姓名</div>
</div>
<div class="right">
<el-input v-model="formModel.name" style="border-color: #20bec8;" placeholder="请输入姓名"></el-input>
</div>
</div>
</el-form-item>
<el-form-item prop="clssid">
<div style="display: flex; align-items: center;">
<div class="left" style="display: flex; align-items: center ;width: 90px;">
<div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon">
<Avatar />
</el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">班级</div>
</div>
<div class="right">
<el-cascader placeholder="请选择所属班级" :props="props" style="width: 142%; height: 0.2344rem"
v-model="formModel.clssid" @change="handleChange" />
</div>
</div>
</el-form-item>
<!-- <el-cascader :props="props" style="width: 100%; height: 0.2344rem" v-model="formModel.clssid" /> -->
<el-form-item prop="studentNumb">
<div style="display: flex; align-items: center;">
<div class="left" style="display: flex; align-items: center ;width: 90px;">
<div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon">
<Avatar />
</el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">学号</div>
</div>
<div class="right">
<el-input v-model="formModel.studentNumb" style="border-color: #20bec8"
placeholder="请输入学号"></el-input>
</div>
</div>
</el-form-item>
<el-form-item prop="mobile">
<div style="display: flex; align-items: center;">
<div class="left" style="display: flex; align-items: center ;width: 90px;">
<div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon">
<Iphone />
</el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">手机号</div>
</div>
<div class="right">
<el-input v-model="formModel.mobile" style="border-color: #20bec8" placeholder="请输入手机号"></el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <div style="display: flex; align-items: center;">
style="color: #3ad7e2; background-color: #0e2e5e; width: 150px" <div class="left" style="display: flex; align-items: center ;width: 90px;">
class="button" <div style="padding-right: 10px; color: #1084c1">
type="primary" <el-icon class="bold-icon">
auto-insert-space <Grid />
@click="register" </el-icon>
> </div>
<div style="padding-right: 10px; color: #2592a1">验证码</div>
</div>
<div class="right">
<div class="captcha">
<el-input v-model="formModel.captcha" style="height: 0.2344rem" maxlength="4" />
<div class="code" @click="getcodeinfo">
<img :src="codeUrl" alt="" srcset="" />
</div>
</div>
</div>
</div>
</el-form-item>
<el-form-item style="margin-bottom: -30px;">
<el-button style="color: #3ad7e2; background-color: #0e2e5e; width: 165px" class="button" type="primary"
auto-insert-space @click="register">
注册 注册
</el-button> </el-button>
<el-button <el-button style="color: #3ad7e2; background-color: #0e2e5e; width: 165px" class="button" type="primary"
style="color: #3ad7e2; background-color: #0e2e5e; width: 150px" auto-insert-space @click="toLogin">
class="button"
type="primary"
auto-insert-space
@click="isRegister = false"
>
返回到登录页 返回到登录页
</el-button> </el-button>
</el-form-item> </el-form-item>
@ -78,77 +156,87 @@
</el-link> </el-link>
</el-form-item> --> </el-form-item> -->
</el-form> </el-form>
<el-form <el-form :model="formModel" :rules="rules" ref="formRef" size="large" autocomplete="off" v-else
:model="formModel" class="custom-form">
:rules="rules" <el-form-item prop="username" class="custom-form-item">
ref="formRef"
size="large"
autocomplete="off"
v-else
class="custom-form"
>
<el-form-item prop="username">
<div style="display: flex; align-items: center; color: pink"> <div style="display: flex; align-items: center; color: pink">
<div class="left" style="display: flex; align-items: center"> <div class="left" style="display: flex; align-items: center;width: 90px;">
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<user /> <User />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">用户名</div> <div style="padding-right: 10px; color: #2592a1">用户名</div>
</div> </div>
<div class="right"> <div class="right">
<el-input <el-input v-model="formModel.username" style="border-color: #20bec8;" placeholder="请输入用户名"></el-input>
v-model="formModel.username"
style="border-color: #20bec8; background-color: pink"
placeholder="请输入用户名"
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="学号" prop="studentNumb"> <el-form-item prop="studentNumb">
<el-input <div style="display: flex; align-items: center;">
v-model="formModel.studentNumb" <div class="left" style="display: flex; align-items: center ;width: 90px;">
:prefix-icon="Avatar" <div style="padding-right: 10px; color: #1084c1">
placeholder="请输入学号" <el-icon class="bold-icon">
></el-input> <Avatar />
</el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">学号</div>
</div>
<div class="right">
<el-input v-model="formModel.studentNumb" style="border-color: #20bec8"
placeholder="请输入学号"></el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item prop="password">
<el-input <div style="display: flex; align-items: center;">
name="password" <div class="left" style="display: flex; align-items: center ;width: 90px;">
:prefix-icon="Lock" <div style="padding-right: 10px; color: #1084c1">
type="password" <el-icon class="bold-icon">
placeholder="请输入密码" <Lock />
v-model="formModel.password" </el-icon>
></el-input> </div>
<div style="padding-right: 10px; color: #2592a1">密码</div>
</div>
<div class="right">
<el-input type="password" v-model="formModel.password" style="border-color: #20bec8"
placeholder="请输入密码"></el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item label="验证码"> <el-form-item>
<div style="display: flex; align-items: center;">
<div class="left" style="display: flex; align-items: center ;width: 90px;">
<div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon">
<Grid />
</el-icon>
</div>
<div style="padding-right: 10px; color: #2592a1">验证码</div>
</div>
<div class="right">
<div class="captcha"> <div class="captcha">
<el-input <el-input v-model="formModel.captcha" style="height: 0.2344rem" maxlength="4" />
v-model="formModel.captcha"
style="height: 0.2344rem"
maxlength="4"
/>
<div class="code" @click="getcodeinfo"> <div class="code" @click="getcodeinfo">
<img :src="codeUrl" alt="" srcset="" /> <img :src="codeUrl" alt="" srcset="" />
</div> </div>
</div> </div>
</div>
</div>
</el-form-item> </el-form-item>
<!-- <el-form-item label="验证码">
<div class="captcha">
<el-input v-model="formModel.captcha" style="height: 0.2344rem" maxlength="4" />
<div class="code" @click="getcodeinfo">
<img :src="codeUrl" alt="" srcset="" />
</div>
</div>
</el-form-item> -->
<el-form-item> <el-form-item>
<el-button <el-button class="hexagon-button" type="primary" auto-insert-space @click="login">登录</el-button>
class="hexagon-button" <el-button class="hexagon-button" type="primary" auto-insert-space @click="toRegister">去注册</el-button>
type="primary"
auto-insert-space
@click="login"
>登录</el-button
>
<el-button
class="hexagon-button"
type="primary"
auto-insert-space
@click="isRegister = true"
>去注册</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
@ -161,11 +249,12 @@
<script setup lang="ts"> <script setup lang="ts">
// import { ref } from "vue" // import { ref } from "vue"
// import { onMounted, reactive, ref, toRefs, watch } from "vue"; // import { onMounted, reactive, ref, toRefs, watch } from "vue";
import { ElMessage, ElMessageBox } from 'element-plus'
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
import { User, Lock, Avatar, Stamp } from "@element-plus/icons-vue"; import { User, Lock, Avatar, Stamp, Grid, Iphone } from "@element-plus/icons-vue";
import { ref } from "vue"; import { ref } from "vue";
import userStore from "@/store/modules/user"; import userStore from "@/store/modules/user";
import { getCode } from "@/api"; import { getCode, sturegister, getFaculties } from '@/api/user'
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
const router = useRouter() const router = useRouter()
const setting = settingStore(); const setting = settingStore();
@ -176,12 +265,48 @@ const isRegister = ref(false);
const formRef = ref(); const formRef = ref();
const formModel = ref({ const formModel = ref({
username: "", username: "",
studentNumb: "",
name: "",
password: "", password: "",
repassword: "", repassword: "",
name: "",
clssid: '',
studentNumb: "",
mobile: '',
captcha: "", captcha: "",
}); });
const FacultiesList = ref([])
const getFacultiesList = async (data: any) => {
const res: any = await getFaculties(data)
console.log(res, 'res11')
FacultiesList.value = res.result
}
const deepValues = ref([])
//
const props = {
lazy: true,
checkStrictly: true,
emitPath: false,
async lazyLoad(node: any, resolve: any) {
console.log(node);
deepValues.value = node.pathValues
await getFacultiesList({
primaryType: node.level + 1,
pid: node.value,
})
const nodes = FacultiesList.value.map((item: any) => ({
value: item.id,
label: item.name,
}))
resolve(nodes)
},
}
const handleChange = (e: any) => {
console.log(e);
formModel.value.clssid = e
}
// //
const rules = { const rules = {
username: [ username: [
@ -198,7 +323,7 @@ const rules = {
{ {
min: 5, min: 5,
max: 11, max: 11,
message: "学号长度最小五位最大十位", message: "学号长度最小五位最大十位",
trigger: ["change", "blur"], trigger: ["change", "blur"],
}, },
], ],
@ -231,10 +356,64 @@ const rules = {
trigger: "blur", trigger: "blur",
}, },
], ],
clssid: [
{ required: true, message: "请选择所属班级", trigger: "blur" },
],
mobile: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{
pattern: /^1[3-9]\d{9}$/,
message: "手机号格式不正确",
trigger: ["change", "blur"],
},
]
}; };
const register = async () => { const register = async () => {
await formRef.value.validate(); await formRef.value.validate();
console.log("开始注册i请求"); console.log("开始注册请求");
let data = {
clssid: formModel.value.clssid,
mobile: formModel.value.mobile,
captcha: formModel.value.captcha,
checkKey: 1629428467008,
password: formModel.value.password,
username: formModel.value.username,
realname: formModel.value.name,
workno: formModel.value.studentNumb,
depid: deepValues.value.slice(0, 2).join(',')
};
try {
const res: any = await sturegister(data)
formModel.value = {
username: "",
password: "",
repassword: "",
name: "",
clssid: '',
studentNumb: "",
mobile: '',
captcha: "",
}
ElMessage.success(`注册成功`)
isRegister.value = false
} catch (error) {
console.log(error);
getcodeinfo()
}
// getcodeinfo()
// console.log(11111);
// ElMessage.warning(res.message)
// console.log(res)
}; };
const codeUrl = ref(""); const codeUrl = ref("");
const getcodeinfo = async () => { const getcodeinfo = async () => {
@ -258,11 +437,19 @@ const login = async () => {
username: formModel.value.username, username: formModel.value.username,
}; };
const res = await user.logIn(data); const res = await user.logIn(data);
if(res){ if (res) {
router.push('/') router.push('/')
} }
}; };
const toRegister = () => {
isRegister.value = true
getcodeinfo();
}
const toLogin = () => {
isRegister.value = false
getcodeinfo();
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -299,11 +486,14 @@ const login = async () => {
margin: 0; margin: 0;
background: url("../assets/images/login.png") no-repeat; background: url("../assets/images/login.png") no-repeat;
background-position: center; background-position: center;
background-size: 50% auto;
} }
.captcha { .captcha {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
.code { .code {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -315,11 +505,13 @@ const login = async () => {
// background-color: pink; // background-color: pink;
display: flex; display: flex;
align-items: center; align-items: center;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
}} }
}
} }
.hexagon-button { .hexagon-button {
@ -337,17 +529,17 @@ const login = async () => {
font-size: 18px; font-size: 18px;
} }
// .custom-form .el-form-item__label { // .el-form-item__label {
// color: #409eff; // color: #0e2e5e;
// /* */
// font-size: 14px;
// font-weight: bold;
// } // }
// .bold-icon svg { // .el-form-item__error {
// stroke-width: 9; // left: 80px;
// /* */
// } // }
.el-form-item__label { .el-input {
color: #0e2e5e; width: 300px;
}
:deep(.el-form-item__error) {
left: 110px;
} }
</style> </style>

@ -7,7 +7,14 @@ import 'element-plus/dist/index.css'; // 引入 Element Plus 的样式文件
import '@/utils/rem.js' import '@/utils/rem.js'
import DataVVue3 from '@kjgl77/datav-vue3' import DataVVue3 from '@kjgl77/datav-vue3'
import pinia from '@/store/index' import pinia from '@/store/index'
//引入依赖和语言
import 'highlight.js/styles/stackoverflow-light.css'
// import hljs from "highlight.js/lib/core";
// import hljsVuePlugin from "@highlightjs/vue-plugin";
// import java from "highlight.js/lib/languages/java";
const app = createApp(App) const app = createApp(App)
// hljs.registerLanguage("java", java);
// app.use(hljsVuePlugin);
app.use(ElementPlus) app.use(ElementPlus)
app.use(pinia) app.use(pinia)
app.use(DataVVue3) app.use(DataVVue3)

@ -14,7 +14,16 @@ router.beforeEach((to: any, from: any, next: any) => {
} else { } else {
const token = getToken(); const token = getToken();
if (token) { if (token) {
console.log(store.userInfo);
if (store.userInfo) {
next(); next();
} else {
store.getUserInfo().then(() => {
next();
});
}
// next();
} else { } else {
next("/login"); next("/login");
} }

@ -19,7 +19,12 @@ const routerList: any = [
path: "program", path: "program",
name: "Program", name: "Program",
component: () => import("@/views/program/index.vue"), component: () => import("@/views/program/index.vue"),
} },
{
path: "compiler",
name: "Compiler",
component: () => import("@/views/compiler/index.vue"),
},
], ],
}, },
{ {

@ -16,6 +16,11 @@ const settingStore = defineStore("settingStore", {
sdsz: 0, // 湿度数值 sdsz: 0, // 湿度数值
falg: false, falg: false,
timer: null, timer: null,
experimentPreservation: false, // 是否设计好实验
saveRoute: false, // 是否保存路由
stepIds: null,
wenduCode: null,
shiduCode:null
}; };
}, },
actions: { actions: {
@ -27,7 +32,7 @@ const settingStore = defineStore("settingStore", {
this.qw = value; this.qw = value;
}, },
setValue(value: number, name: string) { setValue(value: number | boolean, name: string) {
this[name] = value; this[name] = value;
}, },
openHeating() { openHeating() {
@ -46,7 +51,7 @@ const settingStore = defineStore("settingStore", {
} }
}, },
calculateTemperature() { calculateTemperature() {
this.qw <= 0 ? this.qw=1 : this.qw; this.qw <= 0 ? (this.qw = 1) : this.qw;
const a = (100000 * this.zl * this.srmj) / this.jrgl; const a = (100000 * this.zl * this.srmj) / this.jrgl;
let time = 0; let time = 0;
let currentTemp = this.qw; let currentTemp = this.qw;
@ -61,6 +66,40 @@ const settingStore = defineStore("settingStore", {
clearInterval(interval); clearInterval(interval);
} }
time += 1; // 每秒增加 1s
}, 1000);
},
simulateHeatingAndHumidifying() {
// 计算时间常数
const a = (100000 * this.zl * this.srmj) / this.jrgl;
const b = (10000 * this.jsmj) / this.jsgl;
let time = 0;
let currentTemp = this.qw;
let currentHumidity = this.cssd;
const interval = setInterval(() => {
// 计算温度
currentTemp = (1 - Math.exp(-time / a)) * 100 + this.qw;
if (currentTemp > 100) currentTemp = 100;
// 计算湿度
currentHumidity = (1 - Math.exp(-time / b)) * 100 + this.cssd;
if (currentHumidity > 100) currentHumidity = 100;
console.log(
`时间: ${time}s, 温度: ${currentTemp.toFixed(
2
)}°C, 湿度: ${currentHumidity}%RH`
);
this.qw = currentTemp >= 100 ? 100 : currentTemp;
this.cssd = currentHumidity >= 100 ? 100 : Number(currentHumidity.toFixed(2));
// 停止加热 & 加湿
if (currentTemp >= 100 && currentHumidity >= 100) {
console.log("温度和湿度均达到上限,停止模拟!");
clearInterval(interval);
}
time += 1; // 每秒增加 1s time += 1; // 每秒增加 1s
}, 1000); }, 1000);
}, },

@ -1,30 +1,37 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { getToken,setToken } from "@/utils/auth"; import { getToken, setToken } from "@/utils/auth";
import { login } from "@/api"; import { login, getUserInfo } from "@/api";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
const userStore = defineStore("userStore", { const userStore = defineStore("userStore", {
state: () => ({ state: () => ({
token: getToken(), token: getToken(),
userInfo: {}, userInfo: null,
}), }),
actions: { actions: {
async logIn(form: any) { async logIn(form: any) {
console.log(form); console.log(form);
const res: any = await login(form); const res: any = await login(form);
// if(res.code === 500) return ElMessage.error(res.msg) // if(res.code === 500) return ElMessage.error(res.msg)
if(res.code !== 200) { if (res.code !== 200) {
ElMessage.error(res.msg) ElMessage.error(res.msg);
return false return false;
} }
this.token = res.result.token; this.token = res.result.token;
this.userInfo = res.result.userInfo; this.userInfo = res.result.userInfo;
setToken(this.token); setToken(this.token);
console.log(res); console.log(res);
return true return true;
}, },
clearStatus() { clearStatus() {
this.token = ""; this.token = "";
this.userInfo = {}; this.userInfo = null;
},
async getUserInfo() {
const res:any = await getUserInfo();
this.userInfo = res.result.userInfo;
console.log(res);
// this.userInfo = res.result;
}, },
}, },
}); });

@ -0,0 +1,12 @@
// 格式化时间 年月日时分秒
export function formatDate(date: any) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
console.log(`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`);
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}

@ -0,0 +1,16 @@
import { setStep, getStepId } from "../api/index";
import settingStore from "../store/modules/setting";
import pinia from "@/store";
const useStore = settingStore(pinia);
export const setStepEvent = async (step: number, controlsSt: string) => {
let id: any = null;
if (!useStore.stepIds) {
const data: any = await getStepId();
useStore.stepIds = data.result.map((item: any) => item.id);
id = useStore.stepIds[step - 1];
// return id;
await setStep({ id, controlsSt });
} else {
await setStep({ id: useStore.stepIds[step - 1], controlsSt });
}
};

@ -0,0 +1,77 @@
<template>
<div class="container">
<div class="main">
<!-- <pre><code ref="editor" class="edit-text html" contenteditable="true" @input="highlightCode">console.log('Hello, World!');</code></pre> -->
<div class="edit-text" contenteditable="true" spellcheck="false">
<!-- <highlightjs ref="editor" :language="language" :code="code" v-model="code" contenteditable="true" @input="highlightCode"></highlightjs> -->
oisafkahsdkjfhasdf sdfhkjsahfdlkjas \n /n sldhfkajshfd salkdhflkasf asfasdf
</div>
</div>
<div class="setting">
<el-button>保存</el-button>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import hljs from "highlight.js/lib/core";
const editor = ref(null);
const code = ref('console.log("Hello, World!");');
const highlightCode = () => {
const codeBlock = editor.value;
console.log(codeBlock);
if (codeBlock) {
hljs.highlightElement(code);
}
};
onMounted(() => {
// highlightCode();
});
</script>
<style scoped>
.container {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
margin-top: 100px;
/* position: relative; */
}
.main {
width: 1442px;
height: 753px;
background-color: pink;
background: url("../../assets/images/idea.png") no-repeat;
background-size: contain;
background-position: center center;
position: relative;
}
.edit-text {
position: absolute;
left: 410px;
top: 60px;
width: 700px;
height: 670px;
background-color: #1e1e1e;
color: #fff;
font-family: "Courier New", monospace;
padding: 10px;
border-radius: 5px;
overflow: auto;
outline: none;
line-height: 30px;
}
.setting{
position: absolute;
top: 20px;
right: 100px;
}
</style>

@ -6,12 +6,31 @@
<div class="W">W</div> <div class="W">W</div>
<div class="t">t</div> <div class="t">t</div>
<div class="T">T</div> <div class="T">T</div>
<textarea type="textarea" style="width: 100%;height: 100%;border: none;font-size: 14px;line-height: 30px;" /> <textarea
type="textarea"
@change="wenduCodeChange"
style="
width: 100%;
height: 100%;
border: none;
font-size: 14px;
line-height: 30px;
"
/>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, computed, nextTick, watch, onMounted } from "vue"; import { ref } from "vue";
import settingStore from "@/store/modules/setting";
const useSettingStore = settingStore();
const value = ref("");
let code = "float a;a=1000000*M*S/W;T+(1-exp(-t/a))*100+T0;if(T>=100){T=100;}";
const wenduCodeChange = (e) => {
//
useSettingStore.wenduCode = e.target.value.replace(/\n/g, "");
// console.log(e.target.value.replace(/\n/g, '') === code);
};
</script> </script>
<style scoped> <style scoped>
@ -27,7 +46,6 @@ import { ref, computed, nextTick, watch, onMounted } from "vue";
left: -25px; left: -25px;
border: 1px solid #ccc; border: 1px solid #ccc;
color: #fff; color: #fff;
} }
.M { .M {
position: absolute; position: absolute;
@ -35,7 +53,6 @@ import { ref, computed, nextTick, watch, onMounted } from "vue";
left: -25px; left: -25px;
border: 1px solid #ccc; border: 1px solid #ccc;
color: #fff; color: #fff;
} }
.S { .S {
position: absolute; position: absolute;
@ -43,30 +60,26 @@ import { ref, computed, nextTick, watch, onMounted } from "vue";
left: -17px; left: -17px;
border: 1px solid #ccc; border: 1px solid #ccc;
color: #fff; color: #fff;
} }
.W{ .W {
position: absolute; position: absolute;
top: 180px; top: 180px;
left: -17px; left: -17px;
border: 1px solid #ccc; border: 1px solid #ccc;
color: #fff; color: #fff;
} }
.t{ .t {
position: absolute; position: absolute;
top: 240px; top: 240px;
left: -17px; left: -17px;
border: 1px solid #ccc; border: 1px solid #ccc;
color: #fff; color: #fff;
} }
.T{ .T {
position: absolute; position: absolute;
top: 50%; top: 50%;
right: -17px; right: -17px;
border: 1px solid #ccc; border: 1px solid #ccc;
color: #fff; color: #fff;
} }
</style> </style>

@ -6,12 +6,18 @@
<!-- <div class="W">W</div> --> <!-- <div class="W">W</div> -->
<div class="t">t1</div> <div class="t">t1</div>
<div class="T">R</div> <div class="T">R</div>
<textarea type="textarea" style="width: 100%;height: 100%;border: none;font-size: 14px;line-height: 30px;" /> <textarea type="textarea" @change="wenduCodeChange" style="width: 100%;height: 100%;border: none;font-size: 14px;line-height: 30px;" />
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, computed, nextTick, watch, onMounted } from "vue"; import { ref } from "vue";
import settingStore from "@/store/modules/setting";
const useSettingStore = settingStore();
const value = ref("");
const wenduCodeChange = (e) => {
useSettingStore.shiduCode = e.target.value.replace(/\n/g, "");
}
</script> </script>
<style scoped> <style scoped>

@ -69,8 +69,13 @@ import shiduValueSetting from "./components/shiduValueSetting.vue";
import setzijie from "./components/setzijie.vue"; import setzijie from "./components/setzijie.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import tipView from "@/assets/images/guanxitu.png"; import tipView from "@/assets/images/guanxitu.png";
import { useRouter } from "vue-router";
import useSettingStore from "@/store/modules/setting";
import { setStepEvent } from "@/utils/setStep";
import { formatDate } from "@/utils";
let graph = null; let graph = null;
const router = useRouter();
const settingStore = useSettingStore();
// //
const portConfig = { const portConfig = {
top: { top: {
@ -170,7 +175,7 @@ onMounted(() => {
return false; return false;
} }
return true; return true;
} },
}, },
highlighting: { highlighting: {
magnetAdsorbed: { magnetAdsorbed: {
@ -326,7 +331,7 @@ onMounted(() => {
// 1 // 1
graph.addNode({ graph.addNode({
shape: "custom-vue-node-wenBenYu", shape: "custom-vue-node-wenBenYu",
id:'32', id: "32",
width: 210, width: 210,
height: 300, height: 300,
x: 320, x: 320,
@ -366,7 +371,7 @@ onMounted(() => {
// 2 // 2
graph.addNode({ graph.addNode({
shape: "custom-vue-node-wenBenYu2", shape: "custom-vue-node-wenBenYu2",
id:'33', id: "33",
width: 210, width: 210,
height: 300, height: 300,
x: 400, x: 400,
@ -799,7 +804,7 @@ onMounted(() => {
edge: edge.toJSON(), // toJSON port edge: edge.toJSON(), // toJSON port
}; };
saveToLocalStorage(data); saveToLocalStorage(data);
}) });
// 线 // 线
graph.on("edge:removed", ({ edge }) => { graph.on("edge:removed", ({ edge }) => {
@ -810,11 +815,11 @@ onMounted(() => {
saveToLocalStorage(data); saveToLocalStorage(data);
}); });
setTimeout(() => { setTimeout(() => {
restoreGraph() restoreGraph();
}, 1000); }, 1000);
graph.on('edge:added', ({ edge }) => { graph.on("edge:added", ({ edge }) => {
console.log('新增连线数据:', edge.toJSON()); console.log("新增连线数据:", edge.toJSON());
}) });
// const nodes = graph.getNodes(); // const nodes = graph.getNodes();
// console.log(nodes); // console.log(nodes);
// const data = graph.toJSON(); // const data = graph.toJSON();
@ -830,16 +835,44 @@ const onUndo = () => {
const onRedo = () => { const onRedo = () => {
graph.redo(); graph.redo();
}; };
const wenduCode = "float a;a=1000000*M*S/W;T+(1-exp(-t/a))*100+T0;if(T>=100){T=100;}";
const shiduCode = "float b;a=10000*S0/W1;R+(1-exp(-t1/b))*100+R0;if(R>=100){R=100;}";
const onSave = () => { const onSave = () => {
if (standardData.length !== formatEdges().length) setStepEvent(3, formatDate(new Date()));
// console.log(removeDuplicateEdges(formatEdges()), standardData);
// return
if (standardData.length !== removeDuplicateEdges(formatEdges()).length)
return ElMessage.error("请完善数据"); return ElMessage.error("请完善数据");
validateRelationships(standardData, formatEdges()); validateRelationships(standardData, formatEdges());
if(settingStore.wenduCode != wenduCode){
return ElMessage.error("温度代码编写错误");
}
if(settingStore.shiduCode != shiduCode){
return ElMessage.error("湿度代码编写错误");
}
ElMessage.success("保存成功"); ElMessage.success("保存成功");
settingStore.setValue( true,'saveRoute');
router.push('/program')
// const data = graph.toJSON(); // const data = graph.toJSON();
// console.log(data); // console.log(data);
// const edges = graph.getEdges(); // const edges = graph.getEdges();
// console.log(formatEdges()); // console.log(formatEdges());
}; };
function removeDuplicateEdges(edges) {
const seen = new Set();
return edges.filter(edge => {
// source target
const key = edge.source < edge.target
? `${edge.source}-${edge.target}`
: `${edge.target}-${edge.source}`;
if (seen.has(key)) {
return false;
}
seen.add(key);
return true;
});
}
const formatEdges = () => { const formatEdges = () => {
const edges = graph.getEdges(); const edges = graph.getEdges();
// console.log(edges); // console.log(edges);
@ -1083,13 +1116,13 @@ function restoreGraph() {
// //
operations operations
.filter(op => op.type === 'add' && op.node) .filter((op) => op.type === "add" && op.node)
.forEach(op => graph.addNode(op.node)); .forEach((op) => graph.addNode(op.node));
// 线 // 线
operations operations
.filter(op => op.type === 'add' && op.edge) .filter((op) => op.type === "add" && op.edge)
.forEach(op => { .forEach((op) => {
const edgeData = op.edge; const edgeData = op.edge;
// port port ID // port port ID
@ -1099,7 +1132,7 @@ function restoreGraph() {
graph.addEdge(edgeData); graph.addEdge(edgeData);
}); });
} }
const SESSION_KEY = 'graph_operations1'; const SESSION_KEY = "graph_operations1";
function saveToLocalStorage(data) { function saveToLocalStorage(data) {
const operations = JSON.parse(localStorage.getItem(SESSION_KEY)) || []; const operations = JSON.parse(localStorage.getItem(SESSION_KEY)) || [];

@ -9,7 +9,7 @@ import { onMounted, watch } from "vue";
import * as echarts from "echarts"; import * as echarts from "echarts";
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
const useSettingStore = settingStore(); const useSettingStore = settingStore();
var value = useSettingStore.cssd * 100; var value = useSettingStore.cssd;
var myChart = null; var myChart = null;
const initChart = () => { const initChart = () => {
const option = { const option = {
@ -187,7 +187,7 @@ const initChart = () => {
fontSize: 20, fontSize: 20,
distance: -70, distance: -70,
formatter: function (params) { formatter: function (params) {
var value = params.toFixed(0); var value = params;
if (value == 0.0) { if (value == 0.0) {
return "0"; return "0";
@ -235,7 +235,7 @@ const initChart = () => {
}, },
detail: { detail: {
formatter: function (params) { formatter: function (params) {
return params / 100; return params ;
}, },
fontSize: 30, fontSize: 30,
color: "#fff", color: "#fff",
@ -261,7 +261,7 @@ onMounted(() => {
watch( watch(
() => useSettingStore.cssd, () => useSettingStore.cssd,
(newValue) => { (newValue) => {
value=newValue * 100 value=newValue
setTimeout(() => { setTimeout(() => {
initChart(); initChart();
}, 100); }, 100);

@ -43,7 +43,9 @@
<el-button @click="onUndo">撤回</el-button> <el-button @click="onUndo">撤回</el-button>
<el-button @click="onRedo">恢复</el-button> <el-button @click="onRedo">恢复</el-button>
<el-button @click="clearLocalStorage">清除缓存</el-button> <el-button @click="clearLocalStorage">清除缓存</el-button>
<el-button @click="onSave">运行</el-button> <el-button @click="onSave">{{
useSettingStore.experimentPreservation ? "运行" : "保存"
}}</el-button>
<el-button @click="onTip">提示</el-button> <el-button @click="onTip">提示</el-button>
</div> </div>
<div class="tip-view"> <div class="tip-view">
@ -80,8 +82,11 @@ import settingStore from "@/store/modules/setting";
import Yibiao from "./components/yibiao.vue"; import Yibiao from "./components/yibiao.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import tipView from "@/assets/images/chengxv.png"; import tipView from "@/assets/images/chengxv.png";
import { useRouter } from "vue-router";
import { setStepEvent } from "@/utils/setStep";
import { formatDate } from "@/utils";
const useSettingStore = settingStore(); const useSettingStore = settingStore();
const router = useRouter();
// console.log(useSettingStore.qw); // console.log(useSettingStore.qw);
// //
@ -189,14 +194,20 @@ onMounted(() => {
// //
graph.on("node:click", ({ cell }: any) => { graph.on("node:click", ({ cell }: any) => {
// console.log(cell.store.previous.name); // console.log(cell.store.previous.name);
// console.log(cell); console.log(cell);
if (!useSettingStore.saveRoute) {
ElMessage({
message: "请先完成配置",
type: "warning",
});
return;
}
if ( if (
cell.shape === "deom" || cell.shape === "deom" ||
cell.shape === "yibiao" || cell.shape === "yibiao" ||
cell.shape === "rect" || cell.shape === "rect" ||
cell.store.previous.name === "wdsz" || cell.shape === "custom-text-wdsz" ||
cell.store.previous.name === "sdsz" cell.shape === "custom-text-sdsz"
) )
return; return;
// if (cell.store.previous.name === "qw") { // if (cell.store.previous.name === "qw") {
@ -220,7 +231,7 @@ onMounted(() => {
// ]); // ]);
}); });
graph.on("node:added", ({ node }:any) => { graph.on("node:added", ({ node }: any) => {
const data = { const data = {
type: "add", type: "add",
node: node.toJSON(), node: node.toJSON(),
@ -229,7 +240,7 @@ onMounted(() => {
saveToLocalStorage(data); saveToLocalStorage(data);
}); });
graph.on("node:removed", ({ node }:any) => { graph.on("node:removed", ({ node }: any) => {
const data = { const data = {
type: "remove", type: "remove",
id: node.id, id: node.id,
@ -1057,7 +1068,40 @@ const saveNodeData = () => {
if (falg.value) { if (falg.value) {
const value = Number(selectedNodeData.value.label); const value = Number(selectedNodeData.value.label);
// useSettingStore.setqw(value); // useSettingStore.setqw(value);
useSettingStore.setValue(value, selectedNodeData.value.name); console.log(value, selectedNodeData.value.name);
switch (node.shape) {
case "custom-text":
useSettingStore.setValue(parseInt(node.label), "qw"); //
break;
case "custom-text-zl":
useSettingStore.setValue(parseInt(node.label), "zl"); //
break;
case "custom-text-srmj":
useSettingStore.setValue(parseInt(node.label), "srmj"); //
break;
case "custom-text-jrgl":
useSettingStore.setValue(parseInt(node.label), "jrgl"); //
break;
case "custom-text-jrmj":
useSettingStore.setValue(parseInt(node.label), "jrmj"); //
break;
case "custom-text-prot":
useSettingStore.setValue(node.label, "port"); //
break;
case "custom-text-IP":
useSettingStore.setValue(node.label, "ip"); // IP
break;
case "custom-text-cssd":
useSettingStore.setValue(parseInt(node.label), "cssd"); // 湿
break;
case "custom-text-jsgl":
useSettingStore.setValue(parseInt(node.label), "jsgl"); // 湿
break;
case "custom-text-jsmj":
useSettingStore.setValue(parseInt(node.label), "jsmj"); // 湿
break;
}
// useSettingStore.setValue(value, selectedNodeData.value.name);
graph.getNodes().forEach((node: any) => { graph.getNodes().forEach((node: any) => {
// console.log(node.label); // console.log(node.label);
@ -1140,31 +1184,164 @@ const onRedo = () => {
}; };
const sdsz = ref<any>(null); const sdsz = ref<any>(null);
const onSave = () => { const onSave = () => {
// console.log(graph.toJSON()); if (
!hasExactNames(graph.getNodes(), [
"custom-text",
"custom-text-zl",
"custom-text-srmj",
"custom-text-jrgl",
"custom-text-wdsz",
"custom-text-IP",
"custom-text-prot",
"custom-text-cssd",
"custom-text-jsgl",
"custom-text-jsmj",
"custom-text-sdsz",
])
) {
return ElMessage({
type: "warning",
message: "请填写完整信息",
});
}
if (!useSettingStore.experimentPreservation) {
useSettingStore.setValue(true, "experimentPreservation");
router.push("/designRoute");
return;
}
graph.toJSON().cells.forEach((item: any) => { graph.toJSON().cells.forEach((item: any) => {
console.log(item);
switch (item.shape) { switch (item.shape) {
case "custom-text": case "custom-text":
useSettingStore.setValue(parseInt(item.attrs.text.text),item.name, ); // console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写初始温度信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break; break;
case "custom-text-zl": case "custom-text-zl":
useSettingStore.setValue(parseInt(item.attrs.text.text),item.name, ); // console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写质量信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break; break;
case "custom-text-srmj": case "custom-text-srmj":
useSettingStore.setValue(parseInt(item.attrs.text.text),item.name, ); // console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写散热面积信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break; break;
case "custom-text-jrgl": case "custom-text-jrgl":
useSettingStore.setValue(parseInt(item.attrs.text.text),item.name, ); if (!parseInt(item.attrs.text.text)) {
break; ElMessage({
case "custom-text-prot": type: "warning",
useSettingStore.setValue(parseInt(item.attrs.text.text),item.name, ); message: "请请填写加热功率信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break; break;
// case "custom-text-prot":
// useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
// break;
case "custom-text-cssd": case "custom-text-cssd":
useSettingStore.setValue(parseInt(item.attrs.text.text),item.name, ); // console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写初始湿度信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break;
case "custom-text-jsgl":
// console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写加湿功率信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break;
case "custom-text-jsmj":
// console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写加湿面积信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break;
case "custom-text-IP":
// console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写ip设置信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break;
case "custom-text-prot":
// console.log(parseInt(item.attrs.text.text));
if (!parseInt(item.attrs.text.text)) {
ElMessage({
type: "warning",
message: "请请填写设定温度信息",
});
return;
}
useSettingStore.setValue(parseInt(item.attrs.text.text), item.name);
break; break;
} }
}); });
if (useSettingStore.experimentPreservation) {
const arr = [
useSettingStore.qw,
useSettingStore.zl,
useSettingStore.srmj,
useSettingStore.jrgl,
useSettingStore.port,
useSettingStore.cssd,
useSettingStore.jsmj,
useSettingStore.jsgl,
useSettingStore.ip,
];
console.log(
arr,
arr.every((item) => item !== 0 && item !== "")
);
//
if (!arr.every((item) => item !== 0 && item !== "")) {
return ElMessage({
type: "warning",
message: "请完善配置信息",
});
}
// console.log(graph.toJSON());
// return; // return;
clearLocalStorage(); clearLocalStorage();
const data = graph.toJSON().cells.map((item: any) => { const data = graph.toJSON().cells.map((item: any) => {
@ -1176,25 +1353,6 @@ const onSave = () => {
console.log(data); console.log(data);
localStorage.setItem(SESSION_KEY, JSON.stringify(data)); localStorage.setItem(SESSION_KEY, JSON.stringify(data));
if (
!hasExactNames(graph.getNodes(), [
"custom-text",
"custom-text-zl",
"custom-text-srmj",
"custom-text-jrgl",
"custom-text-wdsz",
"custom-text-IP",
"custom-text-prot",
"custom-text-cssd",
"custom-text-jsgl",
"custom-text-jsmj",
"custom-text-sdsz",
])
) {
return ElMessage({
type: "warning",
message: "请填写完整信息",
});
} }
csedNode.value = graph csedNode.value = graph
.getNodes() .getNodes()
@ -1205,7 +1363,10 @@ const onSave = () => {
console.log(csedNode.value); console.log(csedNode.value);
sdsz.value.label = useSettingStore.cssd; sdsz.value.label = useSettingStore.cssd;
// useSettingStore.openHeating(); // useSettingStore.openHeating();
useSettingStore.calculateTemperature(); // useSettingStore.calculateTemperature();
useSettingStore.simulateHeatingAndHumidifying();
setStepEvent(4, formatDate(new Date()));
// const data = graph.toJSON(); // const data = graph.toJSON();
// console.log(data); // console.log(data);
// const edges = graph.getEdges(); // const edges = graph.getEdges();
@ -1213,15 +1374,19 @@ const onSave = () => {
}; };
function hasExactNames(arr: any, names: any) { function hasExactNames(arr: any, names: any) {
// name // name
const nameList = arr.map((obj:any) => obj.shape); const nameList = arr.map((obj: any) => obj.shape);
console.log( console.log(
nameList, nameList,
names, names,
names.every((name:any) => nameList.filter((n:any) => n === name).length === 1) names.every(
(name: any) => nameList.filter((n: any) => n === name).length === 1
)
); );
// names nameList // names nameList
return names.every((name:any) => nameList.filter((n:any) => n === name).length === 1); return names.every(
(name: any) => nameList.filter((n: any) => n === name).length === 1
);
} }
watch( watch(
() => useSettingStore.qw, () => useSettingStore.qw,
@ -1234,10 +1399,22 @@ watch(
} }
} }
); );
watch(
() => useSettingStore.cssd,
(newValue: number) => {
console.log(newValue, "newValue");
console.log(sdsz.value, "sdsz.value");
if (sdsz.value) {
sdsz.value.label = newValue;
}
}
);
const SESSION_KEY = "graph_operations"; const SESSION_KEY = "graph_operations";
function saveToLocalStorage(data:any) { function saveToLocalStorage(data: any) {
const operations = JSON.parse(localStorage.getItem(SESSION_KEY) as string) || []; const operations =
JSON.parse(localStorage.getItem(SESSION_KEY) as string) || [];
operations.push(data); operations.push(data);
localStorage.setItem(SESSION_KEY, JSON.stringify(operations)); localStorage.setItem(SESSION_KEY, JSON.stringify(operations));
} }
@ -1253,7 +1430,7 @@ function clearLocalStorage() {
function restoreGraph() { function restoreGraph() {
const operations = loadFromLocalStorage(); const operations = loadFromLocalStorage();
operations.forEach((op:any) => { operations.forEach((op: any) => {
if (op.type === "add") { if (op.type === "add") {
graph.addNode(op.node); graph.addNode(op.node);
} else if (op.type === "remove") { } else if (op.type === "remove") {

@ -7,7 +7,7 @@
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "node",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,

Loading…
Cancel
Save