Răsfoiți Sursa

产品管理调整页面

王飞 1 an în urmă
părinte
comite
ce65532928

+ 2 - 2
src/api/login/index.ts

@@ -9,8 +9,8 @@ export const loginApi = (data: UserType): Promise<IResponse<UserType>> => {
   return request.post({ url: '/api/login/login', data, headersType: 'application/json' })
 }
 
-export const loginOutApi = (): Promise<IResponse> => {
-  return request.get({ url: '/user/loginOut' })
+export const loginOutApi = (userId: string): Promise<IResponse> => {
+  return request.get({ url: `/api/login/logout/${userId}` })
 }
 
 export const getUserListApi = ({ params }: AxiosConfig) => {

+ 10 - 7
src/components/UserInfo/src/UserInfo.vue

@@ -11,6 +11,7 @@ import LockDialog from './components/LockDialog.vue'
 import { ref, computed } from 'vue'
 import LockPage from './components/LockPage.vue'
 import { useLockStore } from '@/store/modules/lock'
+import { useAppStore } from '@/store/modules/app'
 
 const lockStore = useLockStore()
 
@@ -21,13 +22,13 @@ const tagsViewStore = useTagsViewStore()
 const { getPrefixCls } = useDesign()
 
 const prefixCls = getPrefixCls('user-info')
-
+const appStore = useAppStore()
 const { t } = useI18n()
 
-const { clear } = useStorage()
+const { clear, getStorage } = useStorage()
 
 const { replace } = useRouter()
-
+const userInfo = ref(getStorage(appStore.userInfo))
 const loginOut = () => {
   ElMessageBox.confirm(t('common.loginOutMessage'), t('common.reminder'), {
     confirmButtonText: t('common.ok'),
@@ -35,7 +36,7 @@ const loginOut = () => {
     type: 'warning'
   })
     .then(async () => {
-      const res = await loginOutApi().catch(() => {})
+      const res = await loginOutApi(userInfo.value.id).catch(() => {})
       if (res) {
         clear()
         tagsViewStore.delAllViews()
@@ -61,12 +62,14 @@ const lockScreen = () => {
 <template>
   <ElDropdown class="custom-hover" :class="prefixCls" trigger="click">
     <div class="flex items-center">
-      <img
+      <!-- <img
         src="@/assets/imgs/avatar.jpg"
         alt=""
         class="w-[calc(var(--logo-height)-25px)] rounded-[50%]"
-      />
-      <span class="<lg:hidden text-14px pl-[5px] text-[var(--top-header-text-color)]">Archer</span>
+      /> -->
+      <span class="<lg:hidden text-14px pl-[5px] text-[var(--top-header-text-color)]">{{
+        userInfo.name
+      }}</span>
     </div>
     <template #dropdown>
       <ElDropdownMenu>

+ 3 - 1
src/main.ts

@@ -14,7 +14,7 @@ import { setupStore } from '@/store'
 import { setupGlobCom } from '@/components'
 
 // 引入element-plus
-import { setupElementPlus } from '@/plugins/elementPlus'
+import { setupElementPlus, setupElementPlusIcon } from '@/plugins/elementPlus'
 
 // 引入全局样式
 import '@/styles/index.less'
@@ -50,6 +50,8 @@ const setupAll = async () => {
 
   setupPermission(app)
 
+  setupElementPlusIcon(app)
+
   app.mount('#app')
 }
 

+ 7 - 0
src/plugins/elementPlus/index.ts

@@ -2,6 +2,7 @@ import type { App } from 'vue'
 
 // 需要全局引入一些组件,如ElScrollbar,不然一些下拉项样式有问题
 import { ElLoading, ElScrollbar } from 'element-plus'
+import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 
 const plugins = [ElLoading]
 
@@ -16,3 +17,9 @@ export const setupElementPlus = (app: App<Element>) => {
     app.component(component.name, component)
   })
 }
+
+export const setupElementPlusIcon = (app: App<Element>) => {
+  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
+    app.component(key, component)
+  }
+}

+ 2 - 12
src/router/index.ts

@@ -10,7 +10,7 @@ export const constantRouterMap: AppRouteRecordRaw[] = [
   {
     path: '/',
     component: Layout,
-    redirect: '/dashboard/analysis',
+    redirect: '/dashboard/workplace',
     name: 'Root',
     meta: {
       hidden: true
@@ -59,7 +59,7 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
   {
     path: '/dashboard',
     component: Layout,
-    redirect: '/dashboard/analysis',
+    redirect: '/dashboard/workplace',
     name: 'Dashboard',
     meta: {
       title: t('router.dashboard'),
@@ -67,16 +67,6 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
       alwaysShow: true
     },
     children: [
-      {
-        path: 'analysis',
-        component: () => import('@/views/Dashboard/Analysis.vue'),
-        name: 'Analysis',
-        meta: {
-          title: t('router.analysis'),
-          noCache: true,
-          affix: true
-        }
-      },
       {
         path: 'workplace',
         component: () => import('@/views/Dashboard/Workplace.vue'),

+ 1 - 1
src/views/Authorization/User/User.vue

@@ -25,7 +25,7 @@ const { tableRegister, tableState, tableMethods } = useTable({
     })
     return {
       list: res.data.list || [],
-      total: res.data.totalCount || 0
+      total: Number(res.data.totalCount)
     }
   },
   fetchDelApi: async () => {

+ 4 - 2
src/views/Manage/File/FilePage.vue

@@ -46,7 +46,7 @@ const { tableRegister, tableState, tableMethods } = useTable({
     })
     return {
       list: res.data.list,
-      total: res.data.totalCount
+      total: Number(res.data.totalCount)
     }
   },
   fetchDelApi: async () => {
@@ -257,7 +257,9 @@ const crudSchemas: CrudSchema[] = [
               <ElTooltip content="复制链接">
                 <ElButton text icon={copyIcon} onClick={() => onCopy(data.row)} />
               </ElTooltip>
-              <ElButton icon={DeleteIcon} text type="danger" onClick={() => delData(data.row)} />
+              <ElTooltip content="删除">
+                <ElButton text icon={DeleteIcon} type="danger" onClick={() => delData(data.row)} />
+              </ElTooltip>
             </ElButtonGroup>
           )
         }

+ 19 - 14
src/views/Manage/Product/ProductPage.vue

@@ -2,7 +2,7 @@
 import { ContentWrap } from '@/components/ContentWrap'
 import { Search } from '@/components/Search'
 import { useI18n } from '@/hooks/web/useI18n'
-import { ElButton } from 'element-plus'
+import { ElButton, ElButtonGroup, ElTooltip } from 'element-plus'
 import { Table } from '@/components/Table'
 import { getTableListApi, delTableListApi } from '@/api/manage/product'
 import { useTable } from '@/hooks/web/useTable'
@@ -14,6 +14,7 @@ import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
 import { TableSetting } from '@/components/TableSetting'
 import { usePageStore } from '@/store/modules/page'
 import { set } from 'lodash-es'
+import { useIcon } from '@/hooks/web/useIcon'
 
 defineOptions({
   name: 'ProductPage'
@@ -21,6 +22,10 @@ defineOptions({
 
 const { push } = useRouter()
 
+const EditIcon = useIcon({ icon: 'ep:edit' })
+const DetailIcon = useIcon({ icon: 'ep:document' })
+const DeleteIcon = useIcon({ icon: 'ep:delete' })
+
 const id = ref<string>('')
 
 const searchParams = ref({})
@@ -39,7 +44,7 @@ const { tableRegister, tableState, tableMethods } = useTable({
     })
     return {
       list: res.data.list,
-      total: res.data.total
+      total: Number(res.data.totalCount)
     }
   },
   fetchDelApi: async () => {
@@ -157,7 +162,7 @@ const crudSchemas: CrudSchema[] = [
   },
   {
     field: 'action',
-    width: '260px',
+    width: '160px',
     label: t('tableDemo.action'),
     search: {
       hidden: true
@@ -173,17 +178,17 @@ const crudSchemas: CrudSchema[] = [
       slots: {
         default: (data: any) => {
           return (
-            <>
-              <ElButton type="primary" onClick={() => action(data.row, 'edit')}>
-                {t('exampleDemo.edit')}
-              </ElButton>
-              <ElButton type="success" onClick={() => action(data.row, 'detail')}>
-                {t('exampleDemo.detail')}
-              </ElButton>
-              <ElButton type="danger" onClick={() => delData(data.row)}>
-                {t('exampleDemo.del')}
-              </ElButton>
-            </>
+            <ElButtonGroup>
+              <ElTooltip content="编辑">
+                <ElButton text icon={EditIcon} onClick={() => action(data.row, 'edit')} />
+              </ElTooltip>
+              <ElTooltip content="详情">
+                <ElButton text icon={DetailIcon} onClick={() => action(data.row, 'detail')} />
+              </ElTooltip>
+              <ElTooltip content="删除">
+                <ElButton text icon={DeleteIcon} type="danger" onClick={() => delData(data.row)} />
+              </ElTooltip>
+            </ElButtonGroup>
           )
         }
       }

+ 3 - 3
src/views/hooks/useTagsView.vue

@@ -11,7 +11,7 @@ const { closeAll, closeLeft, closeRight, closeOther, closeCurrent, refreshPage,
 
 const closeAllTabs = () => {
   closeAll(() => {
-    push('/dashboard/analysis')
+    push('/dashboard/workplace')
   })
 }
 
@@ -33,7 +33,7 @@ const refresh = () => {
 
 const closeCurrentTab = () => {
   closeCurrent(undefined, () => {
-    push('/dashboard/analysis')
+    push('/dashboard/workplace')
   })
 }
 
@@ -42,7 +42,7 @@ const setTabTitle = () => {
 }
 
 const setAnalysisTitle = () => {
-  setTitle(`分析页-${new Date().getTime().toString()}`, '/dashboard/analysis')
+  setTitle(`分析页-${new Date().getTime().toString()}`, '/dashboard/workplace')
 }
 </script>