dsy 2 місяців тому
батько
коміт
f5adc95673

+ 1 - 1
.env

@@ -11,4 +11,4 @@ VUE_APP_BookWebSI = '/GCLSBookWebSI/ServiceInterface'
 VUE_APP_EepServer = '/EEPServer/SI'
 
 #version
-VUE_APP_VERSION = '2026.06.26'
+VUE_APP_VERSION = '2026.06.28'

+ 2 - 0
.env.development

@@ -1,2 +1,4 @@
 # base api
 VUE_APP_EEP = '/eep'
+
+VUE_APP_EEP_PRODUCTION = '/production'

+ 2 - 8
packages/BookEep.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="common-preview">
     <div class="audit-content">
-      <div ref="previewMain" class="main-container" :style="{ paddingLeft: '0', paddingRight: '0' }">
+      <div ref="previewMain" class="main-container">
         <main :class="['preview-main', 'no-audit']" :style="computedCommonPreviewStyle">
           <div class="preview-left" :style="{ backgroundColor: background.background?.is_global ? '' : '#fff' }"></div>
           <CoursewarePreview
@@ -34,7 +34,6 @@ import CoursewarePreview from '@/views/book/courseware/preview/CoursewarePreview
 import { isTrue } from '@/utils/validate';
 import { buildCoursewareStyle } from '@/views/book/courseware/preview/common/utils/coursewareStyle';
 import { updateBaseURL } from '@/utils/http';
-import { getLocalStore } from '@/utils/auth';
 
 export default {
   name: 'BookEep',
@@ -250,7 +249,7 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
     position: relative;
     flex: 1;
     min-width: 1110px;
-    padding: 15px 0;
+    padding: 15px;
     overflow: auto;
     background-color: #ececec;
 
@@ -354,11 +353,6 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
   .audit-content {
     display: flex;
     min-width: calc($total-width);
-    height: calc(100vh - 166px);
-
-    &_org {
-      height: calc(100vh - 126px);
-    }
 
     .left-menu {
       display: flex;

+ 17 - 1
packages/index.js

@@ -1,5 +1,6 @@
 import Vue from 'vue';
 import '@/styles/font/font.css';
+import '@/styles/common.scss';
 
 import ElementUI from 'element-ui';
 import 'element-ui/lib/theme-chalk/index.css';
@@ -12,8 +13,11 @@ import 'mathjax/es5/tex-mml-chtml';
 import VueSignaturePad from 'vue-signature-pad';
 
 import BookEep from './BookEep.vue';
+import pkg from './package.json';
+import { setRuntimeServices } from '@/utils/runtime-services';
 
 const components = [BookEep];
+const version = pkg.version;
 
 Vue.use(ElementUI, {
   size: 'small',
@@ -21,10 +25,15 @@ Vue.use(ElementUI, {
 Vue.use(VueSignaturePad);
 
 // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
-const install = (VueInstance) => {
+const install = (VueInstance, options = {}) => {
   if (install.installed) return;
   install.installed = true;
 
+  setRuntimeServices({
+    router: options.router,
+    store: options.store,
+  });
+
   components.forEach((component) => {
     VueInstance.component(component.name || 'BookEep', component);
   });
@@ -35,7 +44,14 @@ if (typeof window !== 'undefined' && window.Vue) {
   install(window.Vue);
 }
 
+if (typeof window !== 'undefined') {
+  window.__EEP_UI_VERSION__ = version;
+}
+
 // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
 export default {
   install,
+  version,
 };
+
+export { version };

+ 1 - 1
packages/package.json

@@ -1,6 +1,6 @@
 {
   "name": "eep-ui",
-  "version": "0.0.6",
+  "version": "0.0.11",
   "main": "eep/eep-ui.umd.js",
   "style": "eep/eep-ui.css",
   "exports": {

+ 6 - 5
src/api/app.js

@@ -1,6 +1,6 @@
 import { http } from '@/utils/http';
-import store from '@/store';
 import { app } from '@/store/mutation-types';
+import { getRuntimeServices } from '@/utils/runtime-services';
 
 /**
  * @description 得到系统标志
@@ -39,6 +39,7 @@ export async function fileUpload(
   file,
   { handleUploadProgress, isGlobalprogress = false } = { isGlobalprogress: false },
 ) {
+  const { store } = getRuntimeServices();
   let formData = null;
   if (file instanceof FormData) {
     formData = file;
@@ -48,7 +49,7 @@ export async function fileUpload(
   }
 
   let onUploadProgress = handleUploadProgress || null;
-  if (isGlobalprogress) {
+  if (isGlobalprogress && store) {
     store.commit(`app/${app.SHOW_PROGRESS}`, true);
     onUploadProgress = ({ loaded, progress, total }) => {
       // 因为上传进度为 1 后,上传事件还会继续一段时间,所以这里将进度设置为 0.99
@@ -58,7 +59,7 @@ export async function fileUpload(
   }
 
   const controller = new AbortController();
-  store.commit(`app/${app.SET_UPLOAD_CONTROLLER}`, controller);
+  store?.commit(`app/${app.SET_UPLOAD_CONTROLLER}`, controller);
 
   try {
     const res = await http.postForm('/FileServer/WebFileUpload', formData, {
@@ -70,10 +71,10 @@ export async function fileUpload(
       onUploadProgress,
       timeout: 0,
     });
-    store.commit(`app/${app.SET_UPLOAD_INFO}`, { progress: 1 });
+    store?.commit(`app/${app.SET_UPLOAD_INFO}`, { progress: 1 });
     return res;
   } finally {
-    store.commit(`app/${app.SET_UPLOAD_CONTROLLER}`, null);
+    store?.commit(`app/${app.SET_UPLOAD_CONTROLLER}`, null);
   }
 }
 

+ 6 - 0
src/main.js

@@ -19,6 +19,7 @@ import 'mathjax/es5/tex-mml-chtml';
 import VueSignaturePad from 'vue-signature-pad';
 
 import { setupRouterGuard } from '@/router/guard';
+import { setRuntimeServices } from '@/utils/runtime-services';
 
 Vue.use(ElementUI, {
   size: 'small',
@@ -26,6 +27,11 @@ Vue.use(ElementUI, {
 
 Vue.use(VueSignaturePad);
 
+setRuntimeServices({
+  router,
+  store,
+});
+
 setupRouterGuard(router);
 
 Vue.config.productionTip = false;

+ 5 - 1
src/utils/auth.js

@@ -23,7 +23,7 @@ function setItemWithExpiry(key, value, expiryDays) {
  * @returns {any|null} 返回存储的值或null
  */
 function getItemWithExpiry(key) {
-  const itemStr = localStorage.getItem(key);
+  const itemStr = localStorage.getItem(key) || sessionStorage.getItem(key);
 
   if (!itemStr) {
     return null;
@@ -32,6 +32,10 @@ function getItemWithExpiry(key) {
     const item = JSON.parse(itemStr);
     const now = new Date();
 
+    if (!item || item.expiry === undefined || item.expiry === null) {
+      return JSON.parse(itemStr);
+    }
+
     if (now.getTime() > item.expiry) {
       localStorage.removeItem(key);
       return null;

+ 4 - 4
src/utils/http.js

@@ -1,8 +1,7 @@
 import axios from 'axios';
-import store from '@/store';
-import router from '@/router';
 
 import { getToken } from '@/utils/auth';
+import { getRuntimeServices } from '@/utils/runtime-services';
 import { Message } from 'element-ui';
 
 const service = axios.create({
@@ -55,8 +54,9 @@ service.interceptors.response.use(
         duration: 3 * 1000,
       });
 
-      store.dispatch('user/signOut');
-      router.push('/login');
+      const { store, router } = getRuntimeServices();
+      store?.dispatch('user/signOut');
+      router?.push('/login');
     }
 
     return res;

+ 20 - 0
src/utils/runtime-services.js

@@ -0,0 +1,20 @@
+let runtimeServices = {};
+
+export function setRuntimeServices(services = {}) {
+  runtimeServices = {
+    ...runtimeServices,
+    ...services,
+  };
+
+  if (typeof window !== 'undefined') {
+    window.__EEP_UI_RUNTIME_SERVICES__ = runtimeServices;
+  }
+}
+
+export function getRuntimeServices() {
+  if (typeof window !== 'undefined' && window.__EEP_UI_RUNTIME_SERVICES__) {
+    return window.__EEP_UI_RUNTIME_SERVICES__;
+  }
+
+  return runtimeServices;
+}

+ 1 - 0
src/views/book/courseware/create/components/CreateCanvas.vue

@@ -145,6 +145,7 @@ export default {
       getTitleList: () => this.title_list,
       getProjectResourcePopedom: () => this.projectResourcePopedom,
       moveComponentDragStart: this.dragStart,
+      getCoursewareId: () => this.courseware_id,
     };
   },
   props: {

+ 0 - 1
src/views/book/courseware/preview/components/fill/FillPreview.vue

@@ -111,7 +111,6 @@
       </div>
       <PreviewOperation
         :is-show-retry="isHasFill"
-        :is-show-answer="isHasFill"
         @showAnswerAnalysis="showAnswerAnalysis"
         @judgeCorrect="judgeCorrect"
         @retry="retry"

+ 10 - 1
vue.config.js

@@ -21,7 +21,8 @@ const port = process.env.port || 9564;
 
 const eepApiUrlList = {
   '': '',
-  '/eep': 'http://eep.helxsoft.cn/',
+  [process.env.VUE_APP_EEP]: 'http://eep.helxsoft.cn/',
+  [process.env.VUE_APP_EEP_PRODUCTION]: 'https://eep.utschool.cn/',
 };
 
 const proxy = {};
@@ -36,6 +37,14 @@ if (NODE_ENV === 'development') {
       [`^${process.env.VUE_APP_EEP}`]: '',
     },
   };
+
+  proxy[process.env.VUE_APP_EEP_PRODUCTION] = {
+    target: eepApiUrlList[process.env.VUE_APP_EEP_PRODUCTION],
+    changeOrigin: true,
+    pathRewrite: {
+      [`^${process.env.VUE_APP_EEP_PRODUCTION}`]: '',
+    },
+  };
 }
 
 module.exports = defineConfig({