This commit is contained in:
zdg 2025-01-08 16:49:11 +08:00
commit b286dbcce2
9 changed files with 215 additions and 82 deletions

View File

@ -1,6 +1,8 @@
# 页面标题
VITE_APP_TITLE = 文枢课堂
VITE_APP_ID = 'aix-win-ws'
# 生产环境配置
VITE_APP_ENV = 'production'

View File

@ -1,5 +1,7 @@
# 页面标题
VITE_APP_TITLE = 文枢课堂
VITE_APP_TITLE = 永川中小学AI教学系统
VITE_APP_ID = 'aix-win-ws-yc'
# 生产环境配置
VITE_APP_ENV = 'production'

View File

@ -1,6 +1,8 @@
# 页面标题
VITE_APP_TITLE = 实训教学
VITE_APP_ID = 'aix-win-ws-yc2'
# 生产环境配置
VITE_APP_ENV = 'production'

View File

@ -17,7 +17,7 @@ asarUnpack:
nsis:
oneClick: false
allowToChangeInstallationDirectory: true
artifactName: ${name}-yc-${version}-setup.${ext}
artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always

View File

@ -17,7 +17,7 @@ asarUnpack:
nsis:
oneClick: false
allowToChangeInstallationDirectory: true
artifactName: ${name}-ycsx-${version}-setup.${ext}
artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always

View File

@ -10,14 +10,13 @@
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
"start": "electron-vite preview",
"dev": "electron-vite dev",
"build": "electron-vite build",
"postinstall": "electron-builder install-app-deps",
"build:unpack": "npm run build && electron-builder --dir",
"build:dev": "npm run build && electron-builder --win --config ./electron-builder-test.yml",
"build:test": "electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
"build:prod": "electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
"build:yc": "electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
"build:yc2": "electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
"build:test": "node updatePackageJsonName.js && electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
"build": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
"build:yc": "node updatePackageJsonName.js && electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
"build:yc2": "node updatePackageJsonName.js && electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
"build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml",
"build:mac": "electron-vite build --mode production && electron-builder --mac --config ./electron-builder-prod.yml",
"build:linux": "npm run build && electron-builder --linux"

View File

@ -407,11 +407,52 @@ export const dataSetJson = {
"教材-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
"教材-高中-地理": "270516829fd111efb13c0242ac140006",
"教材-高中-政治": "a2f0b247b85d11ef84290242ac140005",
"考试-小学-语文": "570f7ed2cc9d11ef9e070242ac140002",
"考试-小学-数学": "983270b8cc9d11efbbd80242ac140002",
"考试-小学-英语": "d5f80e4ccc9d11ef96fa0242ac140002",
"课标-小学-科学": "935cfec8bf6a11ef98950242ac140006",
"课标-小学-数学": "3c4e298fbf7911ef8e8b0242ac140002",
"课标-小学-语文": "f76f1aa5bf7111ef90c80242ac140002",
"课标-小学-道德": "8da87869cbd711ef92280242ac140002",
"课标-小学-英语": "dc963316cbd811ef8d820242ac140002",
"课标-小学-劳动": "fc047d81cbdc11efa1740242ac140002",
"教材-小学-科学": "935cfec8bf6a11ef98950242ac140006",
"教材-小学-数学": "3c4e298fbf7911ef8e8b0242ac140002",
"教材-小学-语文": "f76f1aa5bf7111ef90c80242ac140002",
"教材-小学-道德": "8da87869cbd711ef92280242ac140002",
"教材-小学-英语": "dc963316cbd811ef8d820242ac140002",
"教材-小学-劳动": "fc047d81cbdc11efa1740242ac140002",
"教材-初中-道德与法治": "df9f3ccccbdd11ef9e550242ac140002",
"教材-初中-语文": "3770ad18cbde11efadaa0242ac140002",
"教材-初中-数学": "8cc0a799cbde11ef8b440242ac140002",
"教材-初中-英语": "07b58ca2cbdf11efaa180242ac140002",
"教材-初中-物理": "86f2c018cbf211ef9d6a0242ac140002",
"教材-初中-化学": "c7b34790cbf211ef92350242ac140002",
"教材-初中-生物": "083ac3edcbf311efaad30242ac140002",
"教材-初中-地理": "7ee584e1cbf311efbd270242ac140002",
"教材-初中-历史": "8ae07971cbf411ef81e70242ac140002",
"教材-初中-信息技术": "ca476233cbf411efa9860242ac140002",
"课标-初中-道德与法治": "df9f3ccccbdd11ef9e550242ac140002",
"课标-初中-语文": "3770ad18cbde11efadaa0242ac140002",
"课标-初中-数学": "8cc0a799cbde11ef8b440242ac140002",
"课标-初中-英语": "07b58ca2cbdf11efaa180242ac140002",
"课标-初中-物理": "86f2c018cbf211ef9d6a0242ac140002",
"课标-初中-化学": "c7b34790cbf211ef92350242ac140002",
"课标-初中-生物": "083ac3edcbf311efaad30242ac140002",
"课标-初中-地理": "7ee584e1cbf311efbd270242ac140002",
"课标-初中-历史": "8ae07971cbf411ef81e70242ac140002",
"课标-初中-信息技术": "ca476233cbf411efa9860242ac140002",
"考试-初中-语文": "6be6d201cc0111ef89100242ac140002",
"考试-初中-数学": "d764b539cc0111ef8f1b0242ac140002",
"考试-初中-英语": "3477cff7cc9911efbfa50242ac140002",
"考试-初中-政治": "7ac981d8cc9a11efa5dc0242ac140002",
"考试-初中-历史": "c058a33acc9a11efb7f00242ac140002",
"考试-初中-地理": "5548224ecc9b11efa76d0242ac140002",
"考试-初中-生物": "206c5fd3cc9c11ef990f0242ac140002",
"考试-初中-物理": "93039442cc9c11ef89b10242ac140002",
"考试-初中-化学": "f8d78002cc9c11efbbf60242ac140002",
"鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm"
}

View File

@ -1,36 +1,74 @@
<template>
<div>
<div style="display: flex;align-items: center;" v-if="!showSelect">
<div style="display: flex; align-items: center;">
<div style="margin-left: 15px">
<span class="el-dropdown-link">
<el-button class="custom-button" type="default" round>{{ userStore.edustage }}
</el-button>
<el-button class="custom-button" type="default" round>{{ eduStage || userStore.edustage }}</el-button>
</span>
</div>
<div style="margin-left: 15px">
<span class="el-dropdown-link">
<el-button class="custom-button" type="default" round>{{ userStore.edusubject }}
</el-button>
<el-button class="custom-button" type="default" round>{{ eduSubject || userStore.edusubject }}</el-button>
</span>
</div>
<el-text type="primary" style="margin-left: 10px;cursor:pointer" @click="handleUserEduSubject()">修改</el-text>
<el-text
type="primary"
style="margin-left: 10px; cursor: pointer;"
@click="handleUserEduSubject"
v-popover="popoverRef"
ref="buttonRef"
>修改</el-text>
</div>
<div class="m-4" v-else>
<el-cascader v-model="cascaderValue" :options="options" @change="handleChange" />
<!-- 级联选择框 -->
<el-popover
ref="popoverRef"
:virtual-ref="buttonRef"
trigger="click"
title="修改学科学段"
virtual-triggering
placement="right"
width="300px"
>
<div class="sidebar">
<div class="nav-level-one">
<template v-for="(item,index) in options" :key="index">
<div :class="[currentIndex===index?'active':'','nav-item']" @click="handleUserEduStage(item.label,index)">
<span class="nav-text">{{ item.label }}</span>
<el-icon class="icon"><ArrowRight /></el-icon>
</div>
</template>
</div>
<div class="nav-level-two">
<el-scrollbar height="180">
<template v-for="(item,index) in cascadeOptions" :key="index">
<div class="nav-item" @click="handleChange(item)">
<span class="nav-text">{{ item.label }}</span>
</div>
</template>
</el-scrollbar>
</div>
</div>
</el-popover>
</div>
</template>
<script setup>
import useUserStore from '@/store/modules/user'
import { onMounted,ref } from 'vue';
import { onMounted, ref, unref } from 'vue';
import { listEvaluation } from '@/api/subject/index'
import { sessionStore } from '@/utils/store'
import { ArrowRight } from '@element-plus/icons-vue'
const userStore = useUserStore().user
const subjectList = ref([])
//
const showSelect = ref(false)
const cascaderValue = ref([])
const buttonRef = ref()
const popoverRef = ref()
//
const currentIndex = ref(0)
//
const eduStage = ref('')
const eduSubject = ref('')
//
const options = ref([
{
@ -54,77 +92,64 @@ const options = ref([
children: [],
},
])
//
const cascadeOptions = ref([]);
//
const getSubject = () => {
//
if(!userStore.subject) return
if (!userStore.subject) return;
listEvaluation({ itemkey: 'subject', pageSize: 500 }).then((res) => {
const arr = userStore.subject.split(',')
subjectList.value = res.rows.filter(item => arr.includes(String(item.id))).map(items => items)
console.log(subjectList,'subjectList');
if(subjectList.value.length === 0) return
// optionslabelsubjectListedustagechilren
options.value.forEach(item => {
subjectList.value.forEach(items => {
if(item.label === items.edustage){
item.children.push({
value: items.id,
label: items.edusubject
})
const arr = userStore.subject.split(',');
subjectList.value = res.rows.filter(item => arr.includes(String(item.id)));
if (subjectList.value.length === 0) return;
options.value.forEach(option => {
option.children = subjectList.value
.filter(items => items.edustage === option.label)
.map(item => ({ value: item.id, label: item.edusubject }));
});
//
const cIndex = options.value.findIndex(item => item.label === userStore.edustage);
cascadeOptions.value = [...options.value[cIndex].children]
currentIndex.value = cIndex
});
}
})
})
})
}
//
const handleUserEduStage = () => {
// userStore.edustage = item
// sessionStore.set('edustageSelf',item)
// if(item === ''){
// //
// userStore.edusubject = ''
// sessionStore.set('edusubjectSelf','')
// }
// else if(item === '' && userStore.edusubject === ""){
// //
// userStore.edusubject = ''
// sessionStore.set('edusubjectSelf','')
// }
// else if(item != '' && userStore.edusubject === ""){
// //
// userStore.edusubject = ''
// sessionStore.set('edusubjectSelf','')
// }
const handleUserEduStage = (stage,index) => {
const currentData = options.value.find(item => item.label === stage);
cascadeOptions.value = [...currentData.children]
currentIndex.value = index
}
//
const handleUserEduSubject = () => {
showSelect.value = true
cascaderValue.value = []
unref(popoverRef).popperRef?.delayHide?.();
}
const handleChange = (value) => {
const id = value[1];
userStore.edusubject = subjectList.value.find(item => item.id === id).edusubject
userStore.edustage = value[0]
sessionStore.set('edustageSelf',userStore.edustage)
if(userStore.edustage === '高中' && userStore.edusubject === "道德与法治"){
//
userStore.edusubject = '政治'
sessionStore.set('edusubjectSelf','政治')
}
else if(userStore.edustage != '高中' && userStore.edusubject === "政治"){
//
userStore.edusubject = '道德与法治'
sessionStore.set('edusubjectSelf','道德与法治')
const handleChange = (item) => {
const id = item.value
const current = subjectList.value.find(item => item.id === id);
if (current) {
eduSubject.value = item.label;
eduStage.value = current.edustage;
sessionStore.set('edustageSelf', eduStage.value);
if (eduStage.value === '高中' && eduSubject.value === "道德与法治") {
eduSubject.value = '政治';
sessionStore.set('edusubjectSelf', '政治');
} else if (eduStage.value !== '高中' && eduSubject.value === "政治") {
eduSubject.value = '道德与法治';
sessionStore.set('edusubjectSelf', '道德与法治');
} else {
sessionStore.set('edusubjectSelf',userStore.edusubject)
sessionStore.set('edusubjectSelf', eduSubject.value);
}
showSelect.value = false
}
}
onMounted(() => {
getSubject()
getSubject();
})
</script>
<style scoped>
.custom-button {
width: auto;
@ -133,10 +158,58 @@ onMounted(() => {
outline-offset: none;
padding: 0 24px;
}
.custom-button i {
margin-left: 8px; /* 调整图标与文字之间的间距 */
}
.sidebar {
width: 100%;
padding: 5px;
display: flex;
justify-content: space-between;
}
.nav-level-one,.nav-level-two {
margin-bottom: 20px;
width: 120px;
}
.nav-level-two .nav-item{
text-align: center;
}
.nav-item {
display: flex;
align-items: center;
margin-bottom: 10px;
padding: 8px 10px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.nav-item:hover {
background-color: rgb(245, 247, 250);
}
.nav-text {
flex: 1;
font-size: 14px;
color: #333;
}
.nav-arrow {
font-size: 12px;
margin-left: auto;
}
.nav-level-one.nav-item:first-child.nav-text {
color: blue;
}
.active .nav-text{
font-weight: bold;
color:rgb(64, 158, 255)
}
.active .icon{
font-weight: bold;
color:rgb(64, 158, 255)
}
</style>

14
updatePackageJsonName.js Normal file
View File

@ -0,0 +1,14 @@
const fs = require('fs');
const path = require('path');
const { env } = require('process');
// 读取当前的package.json文件
const packageJsonPath = path.join(__dirname, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
console.log(env)
let res = env.npm_lifecycle_event.replace("build", "").replace(":", "");
res = res?"-" + res:"";
packageJson.name = "aix-win-ws" + res
// 将修改后的内容写回package.json文件
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));