diff --git a/.env.lt b/.env.lt
new file mode 100644
index 0000000..79007b1
--- /dev/null
+++ b/.env.lt
@@ -0,0 +1,19 @@
+# 页面标题
+VITE_APP_TITLE = 文枢课堂
+
+# 生产环境配置
+VITE_APP_ENV = 'production'
+
+# AIx融合数字管理系统/生产环境
+VITE_APP_BASE_API = 'https://prev.ysaix.com:7868/prod-api'
+
+VITE_APP_DOMAIN = 'prev.ysaix.com'
+
+VITE_APP_UPLOAD_API = 'https://prev.ysaix.com:7868/prod-api'
+
+# 是否在打包时开启压缩,支持 gzip 和 brotli
+VITE_BUILD_COMPRESS = gzip
+
+VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/'
+
+VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
diff --git a/.env.production b/.env.production
index 3998cfc..8640aa3 100644
--- a/.env.production
+++ b/.env.production
@@ -1,5 +1,5 @@
# 页面标题
-VITE_APP_TITLE = AIx数字平台
+VITE_APP_TITLE = AIX智慧课堂
# 生产环境配置
VITE_APP_ENV = 'production'
diff --git a/electron-builder-lt.yml b/electron-builder-lt.yml
new file mode 100644
index 0000000..f8e0b9a
--- /dev/null
+++ b/electron-builder-lt.yml
@@ -0,0 +1,54 @@
+appId: com.electron.app
+productName: 文枢课堂
+directories:
+ output: dist
+ buildResources: build
+win:
+ executableName: 文枢课堂
+ icon: resources/logo2.ico
+files:
+ - '!**/.vscode/*'
+ - '!src/*'
+ - '!electron.vite.config.{js,ts,mjs,cjs}'
+ - '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
+ - '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
+asarUnpack:
+ - resources/**
+nsis:
+ oneClick: false
+ allowToChangeInstallationDirectory: true
+ artifactName: ${name}-${version}-setup.${ext}
+ shortcutName: ${productName}
+ uninstallDisplayName: ${productName}
+ createDesktopShortcut: always
+mac:
+ entitlementsInherit: build/entitlements.mac.plist
+ extendInfo:
+ - NSCameraUsageDescription: Application requests access to the device's camera.
+ - NSMicrophoneUsageDescription: Application requests access to the device's microphone.
+ - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
+ - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
+ notarize: false
+dmg:
+ artifactName: ${name}-${version}.${ext}
+linux:
+ target:
+ - AppImage
+ - snap
+ - deb
+ maintainer: electronjs.org
+ category: Utility
+appImage:
+ artifactName: ${name}-${version}.${ext}
+npmRebuild: false
+publish:
+ provider: generic
+ url: https://prev.ysaix.com:7868/src/assets/smarttalk/
+electronDownload:
+ mirror: https://npmmirror.com/mirrors/electron/
+# 额外依赖打包到输出目录
+extraFiles:
+ - from: ./node_modules/im_electron_sdk/lib/
+ to: ./resources
+ filter:
+ - '**/*'
diff --git a/electron.vite.config.mjs b/electron.vite.config.mjs
index d5d6421..cc1eedc 100644
--- a/electron.vite.config.mjs
+++ b/electron.vite.config.mjs
@@ -3,7 +3,14 @@ import path from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from "vite-plugin-windicss"
-
+/*import electron from 'vite-plugin-electron'
+plugins: [electron({
+ main: {
+ builderOptions: {
+ asar: false
+ }
+ }
+})],*/
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()]
diff --git a/package.json b/package.json
index b7c1f41..825ea85 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "aix-win",
- "version": "1.2.3",
- "description": "An Electron application with Vue",
+ "version": "2.0.6",
+ "description": "",
"main": "./out/main/index.js",
"author": "example.com",
"homepage": "https://electron-vite.org",
@@ -16,6 +16,7 @@
"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:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml",
"build:mac": "npm run build && electron-builder --mac",
"build:linux": "npm run build && electron-builder --linux"
},
@@ -45,10 +46,12 @@
"jsencrypt": "^3.3.2",
"jsondiffpatch": "0.6.0",
"lodash": "^4.17.21",
+ "node-addon-api": "^8.1.0",
"pdfjs-dist": "4.4.168",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"spark-md5": "^3.0.2",
+ "vite-plugin-electron": "^0.28.8",
"vue-qr": "^4.0.9",
"vue-router": "^4.4.0",
"xgplayer": "^3.0.19",
diff --git a/src/main/index.js b/src/main/index.js
index ac96916..49433ec 100644
--- a/src/main/index.js
+++ b/src/main/index.js
@@ -21,6 +21,27 @@ File({ app, shell, BrowserWindow, ipcMain })
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
let mainWindow, loginWindow
+const additionalData = {myKey:'ys_axi_smarttalk'}
+const gotTheLock = app.requestSingleInstanceLock(additionalData)
+
+if(!gotTheLock){
+ app.quit()
+}else{
+ app.on('second-instance',(event,commandLine,workingDirectory,additionalData)=>{
+ //输入从第二个实例中接收到的数据
+ console.log(additionalData)
+ //有人试图运行第二个实例,我们应该关注我们的窗口
+ if(mainWindow){
+ if(mainWindow.isMinimized()) mainWindow.restore()
+ mainWindow.focus()
+ }
+ if(loginWindow){
+ if(loginWindow.isMinimized()) loginWindow.restore()
+ loginWindow.focus()
+ }
+ })
+}
+
//登录窗口
function createLoginWindow() {
if (loginWindow) return
@@ -53,7 +74,7 @@ function createLoginWindow() {
updateInit(loginWindow)
}
- loginWindow.webContents.openDevTools()
+ // loginWindow.webContents.openDevTools()
loginWindow.once('ready-to-show', () => {
loginWindow.show()
})
@@ -101,7 +122,7 @@ function createMainWindow() {
shell.openExternal(details.url)
return { action: 'deny' }
})
- mainWindow.webContents.openDevTools()
+ // mainWindow.webContents.openDevTools()
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue
index adc0fe3..f701bda 100644
--- a/src/renderer/src/components/choose-textbook/index.vue
+++ b/src/renderer/src/components/choose-textbook/index.vue
@@ -2,12 +2,12 @@
- {{ curBookName }}
+ {{ curBook.data.itemtitle }}
-
{{ node.label }}
@@ -28,9 +28,9 @@
-
-
+
@@ -43,166 +43,86 @@
diff --git a/src/renderer/src/components/move-file/index.vue b/src/renderer/src/components/move-file/index.vue
index f2fec19..6689e4a 100644
--- a/src/renderer/src/components/move-file/index.vue
+++ b/src/renderer/src/components/move-file/index.vue
@@ -137,7 +137,7 @@ const getSubjectContent = async () => {
}
const getSubject = async () => {
- subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
+
if (localStorage.getItem('subjectList')) {
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
diff --git a/src/renderer/src/hooks/useGetClassWork.js b/src/renderer/src/hooks/useGetClassWork.js
index 7aa313a..2d7c654 100644
--- a/src/renderer/src/hooks/useGetClassWork.js
+++ b/src/renderer/src/hooks/useGetClassWork.js
@@ -102,8 +102,9 @@ const getTreeData = () => {
levelFirstId = curNode.id
levelSecondId = ''
}
+ let bookeId = curBookId
// 头部 教材分析、作业设计:打开外部链接需要当前章节ID
- localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
+ localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId, bookeId}))
// const data = {
// textBook: {
diff --git a/src/renderer/src/hooks/useGetSubject.js b/src/renderer/src/hooks/useGetSubject.js
new file mode 100644
index 0000000..e164e3e
--- /dev/null
+++ b/src/renderer/src/hooks/useGetSubject.js
@@ -0,0 +1,82 @@
+import { ref } from 'vue'
+import useUserStore from '@/store/modules/user'
+import { listEvaluation } from '@/api/subject'
+
+export const useGetSubject = async () =>{
+
+ // user store
+ const userStore = useUserStore()
+ const { edustage, edusubject, userId } = userStore.user
+ const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
+ // 章节List
+ const unitList = ref([])
+ // 教材List
+ let subjectList = null
+ // 单元章节树结构
+ let treeData = null
+
+
+ // 根据 学科 + 学段 获取所有单元章节
+ const getSubjectUnit = async () =>{
+ let strUnit = localStorage.getItem('unitList')
+ if(strUnit){
+ unitList.value = JSON.parse(strUnit)
+ }
+ else{
+ const unitParams = {
+ edusubject,
+ edustage,
+ itemgroup: 'textbook',
+ orderby: 'orderidx asc',
+ pageSize: 10000
+ }
+ const { rows } = await listEvaluation(unitParams)
+ unitList.value = rows
+ localStorage.setItem('unitList', JSON.stringify(rows))
+ }
+
+ await getSubject()
+ }
+
+ // 获取 学科 + 学段 获取教材
+ const getSubject = async () =>{
+
+ let strSubject = localStorage.getItem('subjectList')
+ if(strSubject){
+ subjectList = JSON.parse(strSubject)
+ }
+ else{
+ const subjectParams = {
+ itemkey: "version",
+ edusubject,
+ edustage,
+ pageSize: 10000,
+ orderby: 'orderidx asc'
+ }
+ const { rows } = await listEvaluation(subjectParams)
+ subjectList = rows
+ localStorage.setItem('subjectList', JSON.stringify(rows))
+ }
+
+ // 默认选中第一个教材
+ if(subjectList && subjectList.length){
+ treeData = getTreeData(subjectList[0].id)
+ }
+ }
+
+ // 单元章节数据转为“树”结构
+ const getTreeData = (bookId) =>{
+ // 根据当前教材的id 查找出对应的章节
+ let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
+ data.forEach( item => {
+ item.children = unitList.value.filter( item2 => item2.parentid == item.id && item2.level == 2)
+ })
+ return data
+
+ }
+
+ await getSubjectUnit()
+
+ return { subjectList, treeData, getTreeData }
+
+}
\ No newline at end of file
diff --git a/src/renderer/src/layout/components/Header.vue b/src/renderer/src/layout/components/Header.vue
index e9b53c6..cba3b47 100644
--- a/src/renderer/src/layout/components/Header.vue
+++ b/src/renderer/src/layout/components/Header.vue
@@ -3,7 +3,7 @@
- AIX智慧课堂
+ {{homeTitle}}
@@ -37,7 +37,7 @@
{{ userStore.user.nickName }}
-
{{ userStore.user.deptName }}
+
{{ userStore.user.edusubject }}
@@ -52,6 +52,7 @@
+ {{ userStore.user.deptName }}
@@ -72,7 +73,8 @@ import { updateUserInfo } from '@/api/system/user'
import outLink from '@/utils/linkConfig'
import logoIco from '@/assets/images/logo.png'
import { listEvaluation } from '@/api/classManage/index'
-
+import { clearBookInfo } from '@/utils/ruoyi'
+let homeTitle = ref(import.meta.env.VITE_APP_TITLE)
const { ipcRenderer } = window.electron || {}
const userStore = useUserStore()
const router = useRouter()
@@ -190,6 +192,7 @@ function setLayout() {
}
// 切换学科
const changeSubject = async (command) =>{
+ clearBookInfo()
const { userId, userName, phonenumber, plainpwd } = userStore.user
const data = {
userId,
@@ -200,8 +203,6 @@ const changeSubject = async (command) =>{
await updateUserInfo(data)
await userStore.login({username: phonenumber, password: plainpwd})
await userStore.getInfo()
- localStorage.removeItem('subjectList')
- localStorage.removeItem('evaluationList')
router.go()
}
@@ -331,7 +332,7 @@ onMounted(() => {
justify-content: space-around;
.user-depname {
- margin-right: 5px;
+ margin-right: 0;
}
.user-subject {
@@ -351,8 +352,8 @@ onMounted(() => {
align-items: center;
.user-avatar {
- width: 35px;
- height: 35px;
+ width: 45px;
+ height: 45px;
border-radius: 10px;
margin-right: 10px;
}
diff --git a/src/renderer/src/plugins/shareStore.js b/src/renderer/src/plugins/shareStore.js
index caa5e52..0db8119 100644
--- a/src/renderer/src/plugins/shareStore.js
+++ b/src/renderer/src/plugins/shareStore.js
@@ -61,7 +61,7 @@ function stateSyncWatch(storeName, newState) {
// console.log('state-change-diffData', diffData)
try {
for(const key in diffData) {
- const value = diffData[key]
+ const value = diffData[key] || null
const newValue = {} // 重新组装pinia需要的数据 {a:{b:1}} 这种
const keyArr = key.split('.') || []
keyArr.reduce((o,c,i)=>{o[c] = i === keyArr.length-1 ? value : {};return o[c]}, newValue)
@@ -172,6 +172,8 @@ const getObjValue = (obj, key) => {
const findDifferences = (obj1, obj2) => {
const differences = {};
function compareObjects(o1, o2, path = '') {
+ if (o1 == null) return
+ if (o2 == null) return
for (const key in o1) {
if (o1.hasOwnProperty(key)) {
const newPath = path ? `${path}.${key}` : key;
diff --git a/src/renderer/src/utils/ruoyi.js b/src/renderer/src/utils/ruoyi.js
index e51b433..8d7971e 100644
--- a/src/renderer/src/utils/ruoyi.js
+++ b/src/renderer/src/utils/ruoyi.js
@@ -257,3 +257,17 @@ export const getFileName = (filename) => {
if(!filename) return
return filename.replace(/\.[^/.]+$/, "");
}
+
+// 清除当前选中的教材 章节 相关信息
+export const clearBookInfo = () =>{
+ //当前选中的教材
+ localStorage.removeItem('curBook')
+ // 当前选中的节点
+ localStorage.removeItem('curNode')
+ // 所有章节单元数据
+ localStorage.removeItem('unitList')
+ // 所有教材数据
+ localStorage.removeItem('subjectList')
+ // 展开的节点
+ localStorage.removeItem('defaultExpandedKeys')
+}
\ No newline at end of file
diff --git a/src/renderer/src/views/classManage/basicGroup.vue b/src/renderer/src/views/classManage/basicGroup.vue
index 148553a..879385a 100644
--- a/src/renderer/src/views/classManage/basicGroup.vue
+++ b/src/renderer/src/views/classManage/basicGroup.vue
@@ -1,10 +1,10 @@
-
-
-
-
-
+
+
+
可用分组
diff --git a/src/renderer/src/views/classManage/index.vue b/src/renderer/src/views/classManage/index.vue
index 8ef42c2..c3c25c7 100644
--- a/src/renderer/src/views/classManage/index.vue
+++ b/src/renderer/src/views/classManage/index.vue
@@ -186,7 +186,8 @@
])
//选择的班级
const classids = ref('')
-
+ // 未加入的班级
+ const classesNotAMemberOf = ref([])
// 获取班级信息
const getClassInfo = () => {
classList.value = []
@@ -199,13 +200,13 @@
});
listClassmain({entpid: userStore.deptId, status: 'open', pageSize: 100}).then(response => {
//清除已有的班级
- let arr = [...response.rows]
+ classesNotAMemberOf.value = [...response.rows]
classList.value.forEach(item => {
- const currentIndex = arr.findIndex(items => items.id === item.id)
- if(currentIndex) arr.splice(currentIndex, 1)
+ const currentIndex = classesNotAMemberOf.value.findIndex(items => items.id === item.id)
+ if(currentIndex) classesNotAMemberOf.value.splice(currentIndex, 1)
})
//这里获取组装所有班级
- gradeTree.value = groupByCondition(arr, item => item.agekey);
+ gradeTree.value = groupByCondition(classesNotAMemberOf.value, item => item.agekey);
})
}
//将所有班级筛选成二级的数组
@@ -301,7 +302,7 @@
addClasses({classIds:classids.value.join(','),userId:userStore.userId}).then(res => {
if (res.code === 200) {
dialogVisible.value = false
- ElMessage({
+ ElMessage({x
message: res.msg,
type: 'success',
})
diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue
index 2fa0b79..725a1a8 100644
--- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue
+++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue
@@ -302,7 +302,7 @@ const entpCourseWorkTypeList = ref([
{value: 5, label: "主观题"},
{value: 6, label: "复合题"},
]); // 习题查询条件 - 题型
-
+
const entpCourseWorkGroupList = ref([{
Key: -1,
Value: '不限',
@@ -380,7 +380,7 @@ const queryForm = reactive({
sectionName: props.bookobj.coursetitle,
edusubject: userStore.edusubject,
edustage: userStore.edustage,
- //
+ //
// 题类
worktype: entpCourseWorkQueryParams.worktype.label,
workTypeId: entpCourseWorkQueryParams.worktype.value,
@@ -886,8 +886,8 @@ watch(() => props.bookobj.levelSecondId, (newVal) => {
overflow: hidden;
}
-
+
}
-
+
}
diff --git a/src/renderer/src/views/desktop/container/work-trend.vue b/src/renderer/src/views/desktop/container/work-trend.vue
index c162f82..2a0e70a 100644
--- a/src/renderer/src/views/desktop/container/work-trend.vue
+++ b/src/renderer/src/views/desktop/container/work-trend.vue
@@ -2,9 +2,9 @@
工作动态
-
+
diff --git a/src/renderer/src/views/desktop/index.vue b/src/renderer/src/views/desktop/index.vue
index d516334..d04e7b4 100644
--- a/src/renderer/src/views/desktop/index.vue
+++ b/src/renderer/src/views/desktop/index.vue
@@ -168,10 +168,11 @@ const clickMenu = ({isOuter, path, disabled}) =>{
let fullPath = configObj.fullPath + path
if(path == '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask' || path == '/teaching/classtaskassign?titleName=作业布置'){
// 头部 教材分析打开外部链接需要当前章节ID
- const { levelFirstId, levelSecondId } = JSON.parse(localStorage.getItem('unitId'))
+ const { levelFirstId, levelSecondId, bookeId } = JSON.parse(localStorage.getItem('unitId'))
let unitId = levelSecondId ? levelSecondId : levelFirstId
- fullPath = fullPath + `&unitId=${unitId}`
+
+ fullPath = fullPath + `&unitId=${unitId}&bookeId=${bookeId}`
console.log(fullPath)
}
diff --git a/src/renderer/src/views/login/components/Register.vue b/src/renderer/src/views/login/components/Register.vue
index f61a870..24d0d93 100644
--- a/src/renderer/src/views/login/components/Register.vue
+++ b/src/renderer/src/views/login/components/Register.vue
@@ -7,7 +7,7 @@
:before-close="handleClose"
>
-
+
-
+
@@ -60,7 +62,7 @@
{{ item.name }}:
-
+
@@ -72,6 +74,7 @@
+ 上一步
立即注册
@@ -104,7 +107,7 @@
-->
-
+
diff --git a/src/renderer/src/views/tool/components/lesson.vue b/src/renderer/src/views/tool/components/lesson.vue
index 75241ae..a111467 100644
--- a/src/renderer/src/views/tool/components/lesson.vue
+++ b/src/renderer/src/views/tool/components/lesson.vue
@@ -38,7 +38,7 @@ const curBookId = ref('')
const evaluationList = ref([])
const getTreeData = () => {
- evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
+ evaluationList.value = JSON.parse(localStorage.getItem('unitList'))
//上册
/**
diff --git a/src/renderer/src/views/tool/sphere.vue b/src/renderer/src/views/tool/sphere.vue
index a2f69a9..f46966e 100644
--- a/src/renderer/src/views/tool/sphere.vue
+++ b/src/renderer/src/views/tool/sphere.vue
@@ -16,8 +16,7 @@