刘洋 2 years ago
parent
commit
4f6d1c057e

+ 1 - 0
electron/main/main.ts

@@ -64,6 +64,7 @@ async function createWindow() {
 
   if (app.isPackaged) {
     mainWin.loadURL('http://cet-test.markingtool.cn')
+    // mainWin.loadURL('http://192.168.10.177:81')
   } else {
     installDevTool(VUEJS_DEVTOOLS)
     process.env.WEB_DEV_INDEX_URL && mainWin.loadURL(process.env.WEB_DEV_INDEX_URL)

+ 2 - 2
server.config.ts

@@ -3,9 +3,9 @@ import type { ServerOptions } from 'vite'
 const server: ServerOptions = {
   proxy: {
     '^/?(api|file)/': {
-      // target: 'http://192.168.10.41:8200',
+      target: 'http://192.168.10.41:8200',
       // target: 'http://192.168.10.107:8200',
-      target: 'http://cet-test.markingtool.cn',
+      // target: 'http://cet-test.markingtool.cn',
       // target: 'http://cet-dev.markingtool.cn:8200',
     },
   },

+ 6 - 0
src/App.vue

@@ -12,6 +12,12 @@ if (mainStore.loginInfo) {
   mainStore.getUserMarkConfig()
   mainLayoutStore.getRenderMenuList()
 }
+window.addEventListener('online', () => {
+  mainStore.setOnline(true)
+})
+window.addEventListener('offline', () => {
+  mainStore.setOnline(false)
+})
 </script>
 
 <template>

+ 11 - 0
src/assets/styles/element/custom.scss

@@ -211,6 +211,17 @@ button.el-button {
 }
 
 
+#app {
+  .el-table__body{
+    .el-table__row.current-row .el-table__cell{
+      background-color:#A1D6FF;
+    }
+    .el-table__row:not(.current-row,.el-table__row--striped) .el-table__cell{
+      background-color: #fff;
+    }
+  }
+}
+
 // .el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell,.el-table__body tr.el-table__row--striped.current-row td.el-table__cell,.el-table__body tr.current-row > td.el-table__cell{
 //   background-color: #A1D6FF;
 

+ 8 - 2
src/components/shared/MarkHeader.vue

@@ -46,7 +46,7 @@ import SvgIcon from '@/components/common/SvgIcon.vue'
 import ColorPicker from '@/components/common/ColorPicker.vue'
 import Message from '@/components/shared/message/Message.vue'
 import UserInfo from '@/components/shared/UserInfo.vue'
-import { ElIcon } from 'element-plus'
+import { ElIcon, ElMessage } from 'element-plus'
 import { Close } from '@element-plus/icons-vue'
 import { logout } from '@/utils/shared'
 import { sessionStorage } from '@/plugins/storage'
@@ -116,7 +116,7 @@ const buttons: HeaderButton[] = [
   { title: '查看样卷', type: 'example' },
   { title: '评分标准', type: 'standard' },
   { title: '删除当前专家卷', type: 'delete', smallTitle: '删除' },
-  { title: '设置专家卷', type: 'bookmark', smallTitle: '设' },
+  { title: '设置专家卷', type: 'bookmark', smallTitle: '设专家卷' },
 ]
 
 const refs = reactive<Partial<Record<ButtonType, Element>>>({
@@ -229,6 +229,12 @@ const emitEvent = (type: EventType, val?: string | number | boolean | number[])
     standardVisible.value = true
     return
   }
+  if (type === 'refresh') {
+    if (!mainStore.online) {
+      ElMessage.error('您的网络已断开,请检查网络')
+      return
+    }
+  }
   if (attrs['on' + type.replace(/^\S/, (s) => s.toUpperCase())]) {
     emits(type, val as any)
   }

+ 0 - 1
src/components/shared/message/Message.vue

@@ -88,7 +88,6 @@ const transContent = (content: any) => {
     .replace('&lt;', '<')
     .replace('&gt;', '>')
     .replace('&nbsp;', ' ')
-  // return content.replaceAll('<div>', ' ').replaceAll('<br>', ' ').replaceAll('<\/div>', '').replaceAll('<\/br>', '')
 }
 const MessageComponent = defineComponent({
   setup() {

+ 3 - 1
src/components/shared/message/MessageList.vue

@@ -13,7 +13,8 @@
             <div class="message-send-user">{{ message.sendUserName }}</div>
             <div class="m-l-auto message-send-time">{{ dayjs(message.sendTime).format('HH:mm') }}</div>
           </div>
-          <pre class="message-content" v-html="message.content"></pre>
+          <!-- <pre class="message-content" v-html="message.content"></pre> -->
+          <pre class="message-content">{{ transHtmlContent(message.content) }}</pre>
         </div>
       </template>
       <div v-else class="none-msg-box">
@@ -65,6 +66,7 @@ import useMainStore from '@/store/main'
 import uesFetch from '@/hooks/useFetch'
 import { setLastMsgs } from '@/hooks/useMessageLoop'
 import SvgIcon from '@/components/common/SvgIcon.vue'
+import { transHtmlContent } from '@/utils/common'
 import type { ExtractApiResponse } from '@/api/api'
 type MessageType = ExtractArrayValue<ExtractApiResponse<'getMessageList'>>
 const mainStore = useMainStore()

+ 0 - 1
src/hooks/useSetImgBg.ts

@@ -97,7 +97,6 @@ export const useSetImgBg = (option: Ref<SetImgBgOption>, frontColor?: Ref<string
         const img = new Image()
         img.src = image as string
         img.onload = async () => {
-          console.log('img onload')
           if (frontColor && setFrontColor) {
             // console.time()
             try {

+ 2 - 1
src/layout/main/LeftMenu.vue

@@ -77,7 +77,8 @@ const onHandle = () => {
     background-color: #333;
     .el-menu-item {
       color: #999;
-      &.is-active {
+      &.is-active,
+      .router-link-active {
         color: #fff;
       }
     }

+ 36 - 2
src/layout/main/MenuItem.vue

@@ -7,7 +7,35 @@
     :class="{ 'is-collapse': mainLayoutStore.collapse, 'active-index': currentIndex === menuInfo.index }"
     @click="$emit('handle')"
   >
-    <div class="flex items-center flex-1 menu-padding-left main-layout-sub-menu-title">
+    <component
+      :is="menuInfo.path ? 'router-link' : 'div'"
+      v-if="mainLayoutStore.collapse"
+      :to="menuInfo.path"
+      class="flex items-center collapse-icon"
+    >
+      <svg-icon v-if="menuInfo.icon" :name="menuInfo.icon" />
+    </component>
+
+    <template #title>
+      <div
+        v-if="!mainLayoutStore.collapse"
+        class="flex items-center flex-1 menu-padding-left main-layout-sub-menu-title"
+      >
+        <component
+          :is="menuInfo.path ? 'router-link' : 'div'"
+          :to="menuInfo.path"
+          class="flex items-center flex-1 menu-item"
+        >
+          <span class="icon">
+            <svg-icon v-if="menuInfo.icon" :name="menuInfo.icon" />
+          </span>
+          <span class="menu-label">{{ menuInfo.label }}</span>
+        </component>
+      </div>
+      <div v-else>{{ menuInfo.label }}</div>
+    </template>
+
+    <!-- <div class="flex items-center flex-1 menu-padding-left main-layout-sub-menu-title">
       <component
         :is="menuInfo.path ? 'router-link' : 'div'"
         :to="menuInfo.path"
@@ -18,7 +46,7 @@
         </span>
         <span v-if="!mainLayoutStore.collapse" class="menu-label">{{ menuInfo.label }}</span>
       </component>
-    </div>
+    </div> -->
   </el-menu-item>
   <el-sub-menu
     v-else
@@ -127,7 +155,13 @@ const checkActive = () => {
       text-align: center;
     }
   }
+  .collapse-icon {
+    color: #fff;
+  }
   &.active-index {
+    .collapse-icon {
+      color: $color--primary;
+    }
     > .main-layout-sub-menu-title,
     > .el-sub-menu__title > .main-layout-sub-menu-title {
       color: $color--primary;

+ 1 - 0
src/modules/analysis/group-monitoring-detail/index.vue

@@ -28,6 +28,7 @@
             background
             right
             hide-on-single-page
+            :pager-count="5"
           ></el-pagination>
         </div>
         <div class="flex-1 scroll-auto">

+ 8 - 1
src/modules/analysis/marker-statistics/index.vue

@@ -34,7 +34,14 @@
         <div class="flex-1 flex direction-column overflow-hidden m-l-base">
           <div class="fill-blank text-center p-t-base table-title">{{ query.markerName }}客观题给分分布</div>
           <div class="flex-1 overflow-hidden fill-blank m-b-base table-box">
-            <base-table size="small" height="100%" :columns="columns" :data="objectiveTableData"></base-table>
+            <base-table
+              size="small"
+              border
+              stripe
+              height="100%"
+              :columns="columns"
+              :data="objectiveTableData"
+            ></base-table>
           </div>
           <div class="flex-1 overflow-hidden radius-base fill-blank p-base chart-box">
             <vue-echarts class="full" :option="markerObjectiveChartsOption"></vue-echarts>

+ 3 - 2
src/modules/analysis/personnel-statistics/hooks/useStatisticsFilter.ts

@@ -3,6 +3,7 @@ import { omit } from 'lodash-es'
 import useForm from '@/hooks/useForm'
 import useOptions from '@/hooks/useOptions'
 import useVW from '@/hooks/useVW'
+import { getCurDayRange } from '@/utils/common'
 
 import type { EpFormItem, EpFormRows } from 'global-type'
 import type { ExtractApiParams } from '@/api/api'
@@ -23,12 +24,12 @@ const useStatisticsFilter = () => {
     'question',
     'group',
   ])
-
+  const curDayRange = getCurDayRange()
   const model = reactive<FormMode>({
     subjectCode: dataModel.subject || '',
     questionMainNumber: dataModel.question,
     markingGroupNumbers: dataModel.group,
-    time: [],
+    time: [curDayRange[0], curDayRange[1]],
     hasJudge: ['true'],
     expand: [],
   })

+ 1 - 0
src/modules/analysis/view-marked-detail/index.vue

@@ -49,6 +49,7 @@
             background
             right
             hide-on-single-page
+            :pager-count="5"
           ></el-pagination>
         </div>
         <div class="flex-1 scroll-auto">

+ 1 - 0
src/modules/marking/inquiry-result/index.vue

@@ -44,6 +44,7 @@
             background
             right
             hide-on-single-page
+            :pager-count="5"
           ></el-pagination>
         </div>
         <div class="flex-1 scroll-auto m-t-mini">

+ 0 - 1
src/modules/marking/mark/index.vue

@@ -344,7 +344,6 @@ const clearTaskView = () => {
 }
 const checkMarkStatus = async (): Promise<boolean> => {
   let myUserInfo: any = await useFetch('getMyUserInfo').fetch()
-  console.log('myUserInfo:', myUserInfo)
   const { markDayCount, markTotalCount } = myUserInfo
   let res: any = await getMarkStatus()
   if (!!markDayCount && res.personDayCount === markDayCount) {

+ 2 - 1
src/plugins/request/index.ts

@@ -63,6 +63,7 @@ request.interceptors.response.use(
     return response.data
   },
   async (error: AxiosError<any>) => {
+    console.log('resp error:', error)
     if (!error.config?.noToast && error?.code !== 'ERR_CANCELED') {
       if (error.isAxiosError) {
         if (
@@ -87,7 +88,7 @@ request.interceptors.response.use(
         }
         toastError(msg)
       } else {
-        toastError(error.message)
+        toastError(error.message === 'Network Error' ? '网络错误,服务器连接异常' : error.message)
       }
     }
     // if (error.response?.data) {

+ 6 - 0
src/store/main.ts

@@ -12,6 +12,7 @@ interface MainStoreState {
   myUserInfo?: ExtractApiResponse<'getMyUserInfo'>
   userMarkConfig: ExtractApiResponse<'getUserMarkConfig'>
   newMsgs: { newCount: number; messages: any[] }
+  online: boolean
 }
 
 interface MainStoreActions {
@@ -19,6 +20,7 @@ interface MainStoreActions {
   getUserMarkConfig: () => Promise<ExtractApiResponse<'getUserMarkConfig'> | undefined>
   setUserMarkConfig: (config: ExtractApiResponse<'getUserMarkConfig'>) => void
   setNewMsgs: (msgData: { newCount: number; messages: any[] }) => void
+  setOnline: (bool: boolean) => void
 }
 
 const useMainStore = defineStore<'main', MainStoreState, Record<string, any>, MainStoreActions>('main', {
@@ -39,9 +41,13 @@ const useMainStore = defineStore<'main', MainStoreState, Record<string, any>, Ma
       /** 用户配置信息 */
       userMarkConfig: {},
       newMsgs: { newCount: 0, messages: [] },
+      online: true,
     }
   },
   actions: {
+    setOnline(bool: boolean) {
+      this.online = !!bool
+    },
     setNewMsgs(msgData) {
       this.newMsgs = msgData
     },

+ 26 - 0
src/utils/common.ts

@@ -208,3 +208,29 @@ export const timeFormat = (time: number) => {
     return format
   }, '')
 }
+
+export const getCurDayRange = () => {
+  const date = new Date()
+  const tomorrow = new Date(date.getTime() + 1000 * 60 * 60 * 24)
+  const year = date.getFullYear()
+  const tomorrowYear = tomorrow.getFullYear()
+  let month: number | string = date.getMonth() + 1
+  let tomorrowMonth: number | string = tomorrow.getMonth() + 1
+  let day: number | string = date.getDate()
+  let tomorrowDay: number | string = tomorrow.getDate()
+  month < 10 && (month = '0' + month)
+  tomorrowMonth < 10 && (tomorrowMonth = '0' + tomorrowMonth)
+  day < 10 && (day = '0' + day)
+  tomorrowDay < 10 && (tomorrowDay = '0' + tomorrowDay)
+  return [`${year}${month}${day}000000`, `${tomorrowYear}${tomorrowMonth}${tomorrowDay}000000`]
+}
+
+export const transHtmlContent = (content: string) => {
+  return content
+    .replaceAll(/<[^>]+>/gim, ' ')
+    .replace('&quot;', '"')
+    .replace('&amp;', '&')
+    .replace('&lt;', '<')
+    .replace('&gt;', '>')
+    .replace('&nbsp;', ' ')
+}

+ 3 - 1
src/utils/shared.ts

@@ -25,8 +25,10 @@ export const logout = async (clear = true) => {
   }
   userLogout()
   Promise.resolve().then(() => {
+    console.log('Promise.resolve and will replace to login')
     sessionStorage.remove('LOGIN_RESULT')
-    router.replace({ name: 'Login' })
+    // router.replace({ name: 'Login' })
+    router.push({ name: 'Login' })
   })
 }