ソースを参照

add admin page

bzkf3 2 年 前
コミット
55d685e308

+ 1 - 0
package.json

@@ -8,6 +8,7 @@
     "dev:t": "vite --port 5300",
     "dev:s1": "vite --port 5301",
     "dev:s2": "vite --port 5302",
+    "dev:a": "vite --port 5303",
     "build": "vite build",
     "preview": "vite preview",
     "check": "vue-tsc --noEmit",

+ 3 - 1
src/components/teacher-card/index.vue

@@ -16,8 +16,10 @@ function handleClickConsult() {
         <el-avatar :size="48" :src="d.dxp_user_avatar"></el-avatar>
         <div class="text-lg max-w-24 truncate">{{ d.dxp_user_realname }}</div>
       </div>
+      <slot>
+        <el-button type="primary" round @click="handleClickConsult">咨询</el-button>
+      </slot>
 
-      <el-button type="primary" round @click="handleClickConsult">咨询</el-button>
     </div>
     <div class="text-hex-5B9FF0">联系电话:{{ d.dxp_user_phone }}</div>
     <div class="line-clamp-2 overflow-ellipsis text-hex-00000041 h-10 leading-5">

+ 32 - 0
src/pages/admin/home.vue

@@ -0,0 +1,32 @@
+<script setup lang="ts">
+const imgSrc = (await request({
+  url: '/dyaw/xlfw_hbgl/index',
+  data: {
+    limit: 1
+  }
+})).data?.page_data?.[0]?.dxh_path
+const teacherList = (await request({
+  url: '/dyaw/xlfw_pbgl_pb/index',
+  data: {
+    dxpp_date: (new Date('2023-4-2')).getTime()
+  }
+})).data?.page_data
+
+</script>
+
+<template>
+  <div class="h-640px bg-hex-f2f2f295 flex justify-center">
+    <div class="w-1000px h-full overflow-hidden">
+      <img v-show="imgSrc" :src="imgSrc" class="w-full h-full max-h-640px object-contain">
+    </div>
+    <div
+      class="w-400px h-full overflow-y-auto flex flex-col items-center space-y-4 py-4 scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
+      <el-empty v-if="!teacherList?.length" description="今天暂无排班老师"></el-empty>
+      <teacher-card v-for="item in teacherList" class="flex-none" :d="item">
+        <el-tag :type="item.online ? 'success' : 'danger'" >
+          {{ item.online ? '在 线' : '离 线' }}
+        </el-tag>
+      </teacher-card>
+    </div>
+  </div>
+</template>

src/pages/studoc/studoc.vue → src/pages/teacher/studoc/studoc.vue


src/pages/studoc/studocAll.vue → src/pages/teacher/studoc/studocAll.vue


src/pages/studoc/studocSingle.vue → src/pages/teacher/studoc/studocSingle.vue


+ 3 - 0
src/router/index.ts

@@ -14,6 +14,9 @@ if (UserRole === 'student') {
 if (UserRole === 'teacher') {
   routes.unshift({ path: '/', redirect: { name: 'teacher_home' } })
 }
+if (UserRole === 'admin') {
+  routes.unshift({ path: '/', redirect: { name: 'admin_home' } })
+}
 console.log('routes :>> ', routes);
 
 const router = createRouter({

+ 10 - 0
src/router/routes/admin.ts

@@ -0,0 +1,10 @@
+export default {
+  path: '/admin',
+  children: [
+    {
+      path: 'home',
+      name: 'admin_home',
+      component: () => import('@/pages/admin/home.vue')
+    },
+  ]
+}

+ 2 - 2
src/router/routes/teacher.ts

@@ -20,12 +20,12 @@ export default {
     {
       path: 'studocSingle',
       name: 'archives_studocSingle',
-      component: () => import('@/pages/studoc/studocSingle.vue')
+      component: () => import('@/pages/teacher/studoc/studocSingle.vue')
     },
     {
       path: 'studocAll',
       name: 'archives_studocAll',
-      component: () => import('@/pages/studoc/studocAll.vue'),
+      component: () => import('@/pages/teacher/studoc/studocAll.vue'),
     },
 
   ]

File diff suppressed because it is too large
+ 2 - 1
src/store/user.store.ts


+ 1 - 1
src/store/user.ts

@@ -18,4 +18,4 @@ console.log('user :>> ', user);
 export default user
 
 const ROLE_MAP: { [key: string]: 'teacher' | 'student' } = { '72': 'teacher', '75': 'teacher', '76': 'student' }
-export const UserRole: 'teacher' | 'student' | 'other' = ROLE_MAP[user.user_role_id] ?? 'other'
+export const UserRole: 'teacher' | 'student' | 'admin' | 'other' = user.sm_info.sm_id === '739' ? 'admin' : (ROLE_MAP[user.user_role_id] ?? 'other')