diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 8cf3f52..f33052a 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -19,7 +19,7 @@ export class useUserStore { storage: window.localStorage, // 保存的位置:看自己的业务情况选择,可以是localStorage,sessionstorage // 。。还有一些其他配置参数,例如数据过期时间等等,可以康康文档,像storage这种字段可以配置在全局配置里,详见文档 }).then( - action((persistStore) => { + action(() => { // persist 完成的回调,在这里可以执行一些拿到数据后需要执行的操作,如果在页面上要判断是否完成persist,使用 isHydrated // console.log(persistStore) }), diff --git a/src/types/user/user.d.ts b/src/types/user/user.d.ts index 7c373c9..acb5dc6 100644 --- a/src/types/user/user.d.ts +++ b/src/types/user/user.d.ts @@ -2,127 +2,127 @@ /* eslint-disable */ declare namespace API { - type ApiResponse = { - success?: boolean; - code?: number; - codeMessage?: string; - errorMessage?: Map; - showType?: ErrorShowType; - data: T - } - type CurrentUser = { - name?: string; - avatar?: string; - userid?: string; - email?: string; - signature?: string; - title?: string; - group?: string; - tags?: { key?: string; label?: string }[]; - notifyCount?: number; - unreadCount?: number; - country?: string; - access?: string; - geographic?: { - province?: { label?: string; key?: string }; - city?: { label?: string; key?: string }; - }; - address?: string; - phone?: string; - }; + // type ApiResponse = { + // success?: boolean; + // code?: number; + // codeMessage?: string; + // errorMessage?: Map; + // showType?: ErrorShowType; + // data: T + // } + // type CurrentUser = { + // name?: string; + // avatar?: string; + // userid?: string; + // email?: string; + // signature?: string; + // title?: string; + // group?: string; + // tags?: { key?: string; label?: string }[]; + // notifyCount?: number; + // unreadCount?: number; + // country?: string; + // access?: string; + // geographic?: { + // province?: { label?: string; key?: string }; + // city?: { label?: string; key?: string }; + // }; + // address?: string; + // phone?: string; + // }; + // + // type LoginResult = ResponseStructure & { + // data?: { + // token?: string; + // expireDateTime?: number; + // expire?: number; + // timeUnit?: any; + // } + // }; + // + // type PageParams = { + // pageNum?: number; + // pageSize?: number; + // }; - type LoginResult = ResponseStructure & { - data?: { - token?: string; - expireDateTime?: number; - expire?: number; - timeUnit?: any; - } - }; + // type RuleListItem = { + // key?: number; + // disabled?: boolean; + // href?: string; + // avatar?: string; + // name?: string; + // owner?: string; + // desc?: string; + // callNo?: number; + // status?: number; + // updatedAt?: string; + // createdAt?: string; + // progress?: number; + // }; - type PageParams = { - pageNum?: number; - pageSize?: number; - }; + // type RuleList = { + // data?: RuleListItem[]; + // /** 列表的内容总数 */ + // total?: number; + // success?: boolean; + // }; + // interface ResponseStructure { + // success?: boolean; + // code?: number; + // codeMessage?: string; + // errorMessage?: Map; + // showType?: ErrorShowType; + // } + // type + // FakeCaptcha = ResponseStructure & { + // data?: boolean, + // }; + // + // type PhonePasswordLoginParams = { + // clientId?: string; + // phone?: string; + // password?: string; + // code?: string; + // autoLogin?: boolean; + // }; + // + // type PhoneSmsCodeLoginParams = { + // clientId?: string; + // phone?: string; + // smsCode?: string; + // autoLogin?: boolean; + // }; + // + // type ErrorResponse = { + // /** 业务约定的错误码 */ + // errorCode: string; + // /** 业务上的错误信息 */ + // errorMessage?: Map; + // /** 业务上的请求是否成功 */ + // success?: boolean; + // }; + // + // type NoticeIconList = { + // data?: NoticeIconItem[]; + // /** 列表的内容总数 */ + // total?: number; + // success?: boolean; + // }; - type RuleListItem = { - key?: number; - disabled?: boolean; - href?: string; - avatar?: string; - name?: string; - owner?: string; - desc?: string; - callNo?: number; - status?: number; - updatedAt?: string; - createdAt?: string; - progress?: number; - }; + // type NoticeIconItemType = 'notification' | 'message' | 'event'; - type RuleList = { - data?: RuleListItem[]; - /** 列表的内容总数 */ - total?: number; - success?: boolean; - }; - interface ResponseStructure { - success?: boolean; - code?: number; - codeMessage?: string; - errorMessage?: Map; - showType?: ErrorShowType; - } - type - FakeCaptcha = ResponseStructure & { - data?: boolean, - }; - - type PhonePasswordLoginParams = { - clientId?: string; - phone?: string; - password?: string; - code?: string; - autoLogin?: boolean; - }; - - type PhoneSmsCodeLoginParams = { - clientId?: string; - phone?: string; - smsCode?: string; - autoLogin?: boolean; - }; - - type ErrorResponse = { - /** 业务约定的错误码 */ - errorCode: string; - /** 业务上的错误信息 */ - errorMessage?: Map; - /** 业务上的请求是否成功 */ - success?: boolean; - }; - - type NoticeIconList = { - data?: NoticeIconItem[]; - /** 列表的内容总数 */ - total?: number; - success?: boolean; - }; - - type NoticeIconItemType = 'notification' | 'message' | 'event'; - - type NoticeIconItem = { - id?: string; - extra?: string; - key?: string; - read?: boolean; - avatar?: string; - title?: string; - status?: string; - datetime?: string; - description?: string; - type?: NoticeIconItemType; - }; + // type NoticeIconItem = { + // id?: string; + // extra?: string; + // key?: string; + // read?: boolean; + // avatar?: string; + // title?: string; + // status?: string; + // datetime?: string; + // description?: string; + // type?: NoticeIconItemType; + // }; type GenerateMpRegCode = { data?: { @@ -134,21 +134,21 @@ declare namespace API { }; } - type GetClientId = { - data?: string; - } + // type GetClientId = { + // data?: string; + // } type GenerateBase64Code = { data?: string; } - type GetClientToken = { - data?: { - token?: string; - expireDateTime?: number; - expire?: number; - }; - } + // type GetClientToken = { + // data?: { + // token?: string; + // expireDateTime?: number; + // expire?: number; + // }; + // } type PhoneRegisterRequest = { clientId?: string; @@ -158,85 +158,85 @@ declare namespace API { smsCode?: number; } - type PhoneRegisterResponse = ResponseStructure & { - data?: number; - } - - type CustomValidate = { - validateStatus?: boolean; - msg?: string; - formValue?: any; - code?: number; - codeMessage?: string; - errors?: Map; - validateFields: ValidateFields; - } - - type ListAccountBookVo = ResponseStructure & { - data?: { - total?: number; - list?: ListAccountBookVoItem[] - } - } - type ListAccountBookVoItem = { - id: number; - companyName?: string; - valueAddedTaxCate?: string; - accountingStandard?: string; - startTime?: Date; - createTime?: Date; - enableVoucherVerify?: boolean; - disable?: boolean; - } - type GetAccountBookVo = { - id?: number; - companyName?: string; - unifiedSocialCreditCode?: string; - industryId?: number; - valueAddedTaxCate?: number; - enableVoucherVerify?: boolean; - startTime?: Date; - accountingStandard?: number; - enableFixedAssets?: boolean; - enableCapital?: boolean; - enablePsi?: boolean; - } - type DataDictionaryVo = { - dataCode?: string; - dataValue?: string; - } - - type ListTreeMenuVo = { - id?: number; - key?: string; - title?: any; - icon?: string; - checked?: boolean; - children?: ListTreeMenuVo[]; - level?: number; - }; - - type ListTreeSelectMenuVo = { - id?: number; - value?: string; - title?: any; - children?: ListTreeMenuVo[]; - } - - type ListRoleVo = { - id: number; - roleName?: string; - disable?: boolean; - } - - type ListSubject = { - id: number; - pid?: number; - valueAddedTaxCate?: string; - accountingStandard?: string; - startTime?: Date; - createTime?: Date; - enableVoucherVerify?: boolean; - disable?: boolean; - } + // type PhoneRegisterResponse = ResponseStructure & { + // data?: number; + // } + // + // type CustomValidate = { + // validateStatus?: boolean; + // msg?: string; + // formValue?: any; + // code?: number; + // codeMessage?: string; + // errors?: Map; + // validateFields: ValidateFields; + // } + // + // type ListAccountBookVo = ResponseStructure & { + // data?: { + // total?: number; + // list?: ListAccountBookVoItem[] + // } + // } + // type ListAccountBookVoItem = { + // id: number; + // companyName?: string; + // valueAddedTaxCate?: string; + // accountingStandard?: string; + // startTime?: Date; + // createTime?: Date; + // enableVoucherVerify?: boolean; + // disable?: boolean; + // } + // type GetAccountBookVo = { + // id?: number; + // companyName?: string; + // unifiedSocialCreditCode?: string; + // industryId?: number; + // valueAddedTaxCate?: number; + // enableVoucherVerify?: boolean; + // startTime?: Date; + // accountingStandard?: number; + // enableFixedAssets?: boolean; + // enableCapital?: boolean; + // enablePsi?: boolean; + // } + // type DataDictionaryVo = { + // dataCode?: string; + // dataValue?: string; + // } + // + // type ListTreeMenuVo = { + // id?: number; + // key?: string; + // title?: any; + // icon?: string; + // checked?: boolean; + // children?: ListTreeMenuVo[]; + // level?: number; + // }; + // + // type ListTreeSelectMenuVo = { + // id?: number; + // value?: string; + // title?: any; + // children?: ListTreeMenuVo[]; + // } + // + // type ListRoleVo = { + // id: number; + // roleName?: string; + // disable?: boolean; + // } + // + // type ListSubject = { + // id: number; + // pid?: number; + // valueAddedTaxCate?: string; + // accountingStandard?: string; + // startTime?: Date; + // createTime?: Date; + // enableVoucherVerify?: boolean; + // disable?: boolean; + // } } diff --git a/vite.config.ts b/vite.config.ts index c83959a..a81192d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -16,6 +16,7 @@ import autoprefixer from 'autoprefixer' export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()) return { + base: '/', plugins: [ react(), legacy({ @@ -91,26 +92,26 @@ export default defineConfig(({ mode }) => { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'], // 默认值,这些文件引入时不需要写后缀 }, css: { - modules: { - // 一般我们可以通过 generateScopedName 属性来对生成的类名进行自定义 - // 其中,name 表示当前文件名,local 表示类名 - generateScopedName: "[name]__[local]___[hash:base64:5]" - }, - postcss:{ - plugins:[ - postcssPresetEnv(), - autoprefixer({ // 自动添加前缀 - overrideBrowserslist: [ - "Android 4.1", - "iOS 7.1", - "Chrome > 31", - "ff > 31", - "ie >= 8" - ], - }) - - ] - }, + modules: { + // 一般我们可以通过 generateScopedName 属性来对生成的类名进行自定义 + // 其中,name 表示当前文件名,local 表示类名 + generateScopedName: '[name]__[local]___[hash:base64:5]', + }, + postcss: { + plugins: [ + postcssPresetEnv(), + autoprefixer({ + // 自动添加前缀 + overrideBrowserslist: [ + 'Android 4.1', + 'iOS 7.1', + 'Chrome > 31', + 'ff > 31', + 'ie >= 8', + ], + }), + ], + }, preprocessorOptions: { less: { javascriptEnabled: true, @@ -150,6 +151,11 @@ export default defineConfig(({ mode }) => { chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称 entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称 assetFileNames: '[ext]/[name]-[hash].[ext]', // 资源文件像 字体,图片等 + manualChunks(id) { + if (id.includes('node_modules')) { + return id.toString().split('node_modules/')[1].split('/')[0].toString() + } + }, }, }, },