浏览代码

perf(env配置文件): 更新配置文件

fxs 2 月之前
父节点
当前提交
a30d953f76

+ 1 - 1
.env.production

@@ -1,3 +1,3 @@
 VITE_APP_ENV=production
-VITE_API_BASE='http://192.168.1.139:8001'
+VITE_API_BASE='http://investtest.ichunhao.cn'
 VITE_CRYPTO_KEY='prod_secret_FFFFFF'

+ 0 - 5
components.d.ts

@@ -19,8 +19,6 @@ declare module 'vue' {
     ElCol: typeof import('element-plus/es')['ElCol']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
-    ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
-    ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
     ElDialog: typeof import('element-plus/es')['ElDialog']
     ElDivider: typeof import('element-plus/es')['ElDivider']
     ElDrawer: typeof import('element-plus/es')['ElDrawer']
@@ -53,16 +51,13 @@ declare module 'vue' {
     IconIcBaselineVisibility: typeof import('~icons/ic/baseline-visibility')['default']
     IconIcBaselineVisibilityOff: typeof import('~icons/ic/baseline-visibility-off')['default']
     IconMdiPassword: typeof import('~icons/mdi/password')['default']
-    Menu: typeof import('./src/components/navigation/Menu.vue')['default']
     MenuTable: typeof import('./src/components/promotion/MenuTable.vue')['default']
     MyButton: typeof import('./src/components/form/MyButton.vue')['default']
     MyInput: typeof import('./src/components/form/MyInput.vue')['default']
-    PromotionTable: typeof import('./src/components/table/PromotionTable.vue')['default']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
     SideMenu: typeof import('./src/components/navigation/SideMenu.vue')['default']
     StatisticCard: typeof import('./src/components/statisticCard/StatisticCard.vue')['default']
-    Table: typeof import('./src/components/table/Table.vue')['default']
     TableQueryForm: typeof import('./src/components/table/TableQueryForm.vue')['default']
     TagSelect: typeof import('./src/components/Material/TagSelect.vue')['default']
     TimeLineChart: typeof import('./src/components/echarts/TimeLineChart.vue')['default']

+ 2 - 2
package.json

@@ -6,9 +6,9 @@
   "scripts": {
     "dev": "vite --host 0.0.0.0",
     "test": "vite --mode test",
-    "build:test": "vite build --mode test",
+    "build:dev": "vite build --mode development",
     "build:prod": "vite build --mode production",
-    "preview": "vite preview",
+    "preview": "vite preview --host 0.0.0.0",
     "build-only": "vite build",
     "type-check": "vue-tsc --build --force",
     "lint": "eslint . --fix",

+ 7 - 12
src/components/table/FilterTable.vue

@@ -218,6 +218,7 @@ const excludeFields = computed<Array<string>>(() => {
 const paginationTableData = computed<Array<TableData>>(() => {
   // let curPage = paginationConfig.curPage
   // return cacheTableData[curPage - 1]
+
   return tableData.slice(0, paginationConfig.curPageSize)
 })
 
@@ -262,7 +263,7 @@ const tableSizeChange = (_size: number) => {
 /**
  * @description: 表格页数改变
  */
-const tablePageChange = (page: number) => {
+const tablePageChange = (_page: number) => {
   if (props.remotePagination) {
     queryTable()
     // if (!cacheTableData[page - 1]) {
@@ -292,6 +293,7 @@ const applyCustomIndicator = (
 ) => {
   if (!schemeName) schemeName = '默认'
   schemeActive.value = schemeName
+
   tableFieldsInfo.splice(0, tableFieldsInfo.length, ...newTableFieldsInfo)
 
   emits('updateCustomIndicator', indicatorFields, tableFieldsInfo, schemeName)
@@ -323,6 +325,7 @@ const updateIndicatorScheme = () => {
     })
     initIndicatorFields(indicatorFields, props.tableFields, defaultActiveNav)
     // console.log(indicatorFields)
+    console.log('滞销了')
     initTableFields(tableFieldsInfo, props.sortedTableFields, indicatorFields)
   })
 }
@@ -392,7 +395,6 @@ const sortChange = (data: { column: any; prop: string; order: any }) => {
 watch(
   () => props.tableData,
   newData => {
-    console.log('更新变更')
     tableData.splice(0, tableData.length, ...newData)
 
     setCacheTableData(
@@ -419,16 +421,6 @@ watch(
   },
 )
 
-// watch(
-//   () => props.tableFields,
-//   () => {
-//     updateIndicatorScheme()
-//   },
-//   {
-//     deep: true,
-//   },
-// )
-
 const watchActiveMenu = watch(
   () => props.activeMenu,
   () => {
@@ -741,6 +733,9 @@ defineExpose({
                     </template>
                   </el-image>
                 </div>
+                <div v-if="item.formatter">
+                  {{ item.formatter(scope.row) }}
+                </div>
               </template>
             </el-table-column>
           </template>

+ 1 - 0
src/hooks/Material/useMaterial.ts

@@ -51,6 +51,7 @@ export function useMaterial() {
       ElMessage.error('获取标签失败')
       return []
     }
+    if (!res.data) return []
     return res.data
   }
 

+ 1 - 0
src/types/Tables/table.ts

@@ -46,6 +46,7 @@ interface BaseFieldInfo {
   sort: boolean // 是否需要排序
   type: TableFieldType // 字段类型,默认为默认类型
   customPopoverFunc?: Function // 自定义的popover渲染函数
+  formatter?: (val: any) => any // 格式化函数
 }
 
 // 选择框的选项

+ 4 - 0
src/utils/userInfo/UserInfo.ts

@@ -19,6 +19,10 @@ const saveUserInfo = (value: UserInfo) => {
 const getUserInfo = (): UserInfo | null => {
   const userInfo = localStorage.getItem(USER_INFO_KEY)
   if (!userInfo) return null
+  const decryptedInfo = CryptoJS.AES.decrypt(userInfo, SECRET_KEY).toString(
+    CryptoJS.enc.Utf8,
+  )
+  if (!decryptedInfo) return null
   return JSON.parse(
     CryptoJS.AES.decrypt(userInfo, SECRET_KEY).toString(CryptoJS.enc.Utf8),
   ) as UserInfo

+ 12 - 5
src/views/Manage/IdentityManage.vue

@@ -11,7 +11,7 @@ import axiosInstance from '@/utils/axios/axiosInstance.ts'
 import { ManageAPI } from '@/config/API.ts'
 import type { ResponseInfo } from '@/types/axios.ts'
 import {
-  identityFields,
+  getIdentityFields,
   identityFilter,
 } from '@/views/Manage/tableConfig/IdentityTableConfig.ts'
 import { Plus } from '@element-plus/icons-vue'
@@ -23,10 +23,20 @@ interface IdentityDialogForm {
   identityId: number
 }
 
+// 权限信息
+const permissionInfo = ref<Record<string, string>>()
+
+/**
+ * 计算属性来实时更新表格字段信息
+ */
+const identityFields = computed(() => {
+  return getIdentityFields(permissionInfo)
+})
+
 const tableInfo = reactive<BaseTableInfo>({
   identity: {
     data: [],
-    fields: identityFields,
+    fields: identityFields.value,
     tableSortedFields: [],
     filters: identityFilter,
     fixedFields: [],
@@ -46,9 +56,6 @@ const activeMenu = ref('identity')
 // 保存的表格名
 const saveTableName = '身份管理'
 
-// 权限信息
-const permissionInfo = ref<Record<string, string>>()
-
 /**
  * @description: 保存的文件名
  * @return {*}

+ 2 - 2
src/views/Manage/LogListView.vue

@@ -24,7 +24,7 @@ import {
 } from '@/utils/filterInfo/FilterInfo.ts'
 
 const tableInfo = reactive<BaseTableInfo>({
-  permission: {
+  logList: {
     data: [],
     fields: logFields,
     tableSortedFields: [],
@@ -41,7 +41,7 @@ const paginationConfig = reactive<TablePaginationProps>({
 // 自定义指标保存的方案
 const customIndicatorScheme = ref<Array<CustomIndicatorScheme>>([])
 
-const activeMenu = ref('permission')
+const activeMenu = ref('logList')
 
 const updateTableData = async () => {
   const params = tableRef.value?.getTableReqParams() as any

+ 67 - 50
src/views/Manage/tableConfig/IdentityTableConfig.ts

@@ -18,54 +18,71 @@ const identityFilter = reactive<FilterInfo>({
   },
 })
 
-const identityFields: Array<BaseFieldItem<BaseFieldInfo>> = [
-  {
-    label: '日志字段',
-    name: 'log',
-    value: [],
-    children: [
-      {
-        label: '记录ID',
-        name: 'id',
-        state: false, // 通常不需要显示主键
-        fixed: true,
-        sort: false,
-        type: TableFieldType.Default,
-      },
-      {
-        label: '身份名称',
-        name: 'identityName',
-        state: true,
-        fixed: true,
-        sort: false,
-        type: TableFieldType.Default,
-      },
-      {
-        label: '创建时间',
-        name: 'createdAt',
-        state: true,
-        fixed: false,
-        sort: false,
-        type: TableFieldType.Default,
-      },
-      {
-        label: '更新时间',
-        name: 'updatedAt',
-        state: true,
-        fixed: false,
-        sort: false,
-        type: TableFieldType.Default,
-      },
-      {
-        label: '权限列表',
-        name: 'permissions',
-        state: true,
-        fixed: false,
-        sort: false,
-        type: TableFieldType.Default,
-      },
-    ],
-  },
-]
+/**
+ * 用函数返回,实现传参
+ * @param permissionInfo 权限信息
+ */
+const getIdentityFields = (
+  permissionInfo: any,
+): Array<BaseFieldItem<BaseFieldInfo>> => {
+  return [
+    {
+      label: '日志字段',
+      name: 'log',
+      value: [],
+      children: [
+        {
+          label: '记录ID',
+          name: 'id',
+          state: false, // 通常不需要显示主键
+          fixed: true,
+          sort: false,
+          type: TableFieldType.Default,
+        },
+        {
+          label: '身份名称',
+          name: 'identityName',
+          state: true,
+          fixed: true,
+          sort: false,
+          type: TableFieldType.Default,
+        },
+        {
+          label: '创建时间',
+          name: 'createdAt',
+          state: true,
+          fixed: false,
+          sort: false,
+          type: TableFieldType.Default,
+        },
+        {
+          label: '更新时间',
+          name: 'updatedAt',
+          state: true,
+          fixed: false,
+          sort: false,
+          type: TableFieldType.Default,
+        },
+        {
+          label: '权限列表',
+          name: 'permissions',
+          state: true,
+          fixed: false,
+          sort: false,
+          type: TableFieldType.Default,
+          formatter: (val: any) => {
+            const permission = val['permissions'] as string[]
+            if (!permissionInfo.value) return val
+            return permission
+              .map(item => {
+                return permissionInfo.value[item]
+              })
+              .join(',')
+          },
+        },
+      ],
+    },
+  ]
+}
 
-export { identityFilter, identityFields }
+export { identityFilter, getIdentityFields }

+ 1 - 1
src/views/Manage/tableConfig/logTableConfig.ts

@@ -84,7 +84,7 @@ const logFields: Array<BaseFieldItem<BaseFieldInfo>> = [
         label: '记录ID',
         name: 'id',
         state: false, // 通常不需要显示主键
-        fixed: false,
+        fixed: true,
         sort: false,
         type: TableFieldType.Default,
       },

+ 2 - 2
src/views/Material/DrawerTagsView/DrawerBaseInfo.vue

@@ -6,7 +6,7 @@ const imgFieldName = {
   id: 'ID',
   name: '图片名称',
   gid: '游戏ID',
-  pid: '游戏父级ID',
+  pid: '项目ID',
   wx_id: '微信资源ID',
   image_width: '图片宽度',
   image_height: '图片高度',
@@ -23,7 +23,7 @@ const videoFieldName = {
   id: 'ID',
   name: '视频名称',
   gid: '游戏ID',
-  pid: '游戏父级ID',
+  pid: '项目ID',
   wx_id: '微信资源ID',
   video_type: '视频类型',
   resolution: '分辨率',

+ 2 - 1
src/views/Material/FilmLibrary.vue

@@ -142,6 +142,7 @@ const updateGameInfo = async () => {
  */
 const updateTagsOptions = async () => {
   const tags = await getAllTags()
+
   const options = tags.map(item => {
     return {
       label: item.name,
@@ -174,7 +175,6 @@ const updateTableData = async () => {
   } else {
     data.splice(0, data.length, ...result.data.list)
   }
-  console.log(data)
 }
 
 const updateResolution = async () => {
@@ -349,6 +349,7 @@ onMounted(async () => {
         <template #operationBtnContainer="{ selectedInfo }">
           <div>
             <el-button
+              type="danger"
               :disabled="selectedInfo.length <= 0"
               @click="delRow(selectedInfo)"
               >删除

+ 1 - 1
src/views/Material/UploadAsset.vue

@@ -54,7 +54,7 @@ const uploadForm = reactive<UploadAssetForm>({
 const rules = reactive<FormRules<UploadAssetForm>>({
   name: [
     { required: true, message: '请输入创意名', trigger: 'blur' },
-    { min: 3, max: 5, message: '3-5个字符', trigger: 'blur' },
+    { min: 1, max: 255, message: '3-5个字符', trigger: 'blur' },
   ],
   tags: [
     { required: true, message: '请选择标签', trigger: 'change' },

+ 15 - 1
src/views/Material/config/FimLibraryConfig.ts

@@ -58,7 +58,7 @@ const videoFilterInfo = reactive<FilterInfo>({
     clearable: true,
     options: [
       { label: '横屏', value: '1' },
-      { label: '竖屏', value: '0' },
+      { label: '竖屏', value: '2' },
     ],
   },
 })
@@ -146,6 +146,14 @@ const imgFields: Array<BaseFieldItem<BaseFieldInfo>> = [
         fixed: false,
         sort: false,
         type: TableFieldType.Default,
+        formatter: (val: any) => {
+          console.log('执行')
+          console.log(val)
+          if (!val || val['pid'] === '') {
+            return '默认'
+          }
+          return val['pid']
+        },
       },
       {
         label: '预览图片',
@@ -228,6 +236,12 @@ const videoFields: Array<BaseFieldItem<BaseFieldInfo>> = [
         fixed: false,
         sort: false,
         type: TableFieldType.Default,
+        formatter: (val: any) => {
+          if (!val || val['pid'] === '') {
+            return '默认'
+          }
+          return val['pid']
+        },
       },
       {
         label: '预览视频',

文件差异内容过多而无法显示
+ 0 - 0
stats.html


+ 2 - 0
vite.config.ts

@@ -89,6 +89,7 @@ const DEFAULT_OPTIONS = {
 
 export default defineConfig(({ mode }) => {
   return {
+    base: '/',
     server: {
       port: 5174,
     },
@@ -105,6 +106,7 @@ export default defineConfig(({ mode }) => {
       },
     },
     esbuild: {
+      // console,debugger
       drop: mode === 'production' ? ['console', 'debugger'] : [],
     },
     plugins: [

部分文件因为文件数量过多而无法显示