fix: 🐛 修复 eslint 警告问题

This commit is contained in:
Ray.Hao
2025-04-04 23:50:18 +08:00
parent c1efba0a0a
commit 41c874092e
18 changed files with 372 additions and 274 deletions

View File

@@ -3,4 +3,4 @@
dist
public
node_modules
auto-imports.d.ts

View File

@@ -17,13 +17,24 @@ const autoImportConfig = JSON.parse(fs.readFileSync(".eslintrc-auto-import.json"
/** @type {import('eslint').Linter.Config[]} */
export default [
// 指定检查文件和忽略文件
// 忽略指定文件
{
ignores: [
"node_modules/**",
"dist/**",
"unpackage/**",
"public/**",
"static/**",
"**/u-charts/**",
"**/qiun-**/**",
"**/auto-imports.d.ts",
"src/types/auto-imports.d.ts",
],
},
// 检查文件的配置
{
files: ["**/*.{js,mjs,cjs,ts,vue}"],
ignores: ["**/*.d.ts"],
},
// 全局配置
{
languageOptions: {
globals: {
...globals.browser,
@@ -35,6 +46,8 @@ export default [
ResponseData: "readonly", // 统一响应数据类型
PageResult: "readonly", // 分页结果数据类型
PageQuery: "readonly", // 分页查询数据类型
OptionType: "readonly", // 选项类型
getCurrentPages: "readonly", // uni-app 全局 API
},
},
},
@@ -51,6 +64,8 @@ export default [
ignoreRestSiblings: true, // 忽略解构赋值中同级未使用变量的警告
},
],
"no-prototype-builtins": "off", // 允许直接调用Object.prototype方法
"no-constant-binary-expression": "warn", // 将常量二元表达式警告降为警告级别
},
},
// JavaScript 配置
@@ -93,4 +108,22 @@ export default [
"vue/multi-word-component-names": "off", // 允许单个单词组件名
},
},
// 单独针对第三方组件的处理
{
files: ["**/qiun-data-charts.vue", "**/qiun-data-charts/**/*.vue", "**/u-charts/**"],
linterOptions: {
noInlineConfig: false,
reportUnusedDisableDirectives: false,
},
rules: {
// 禁用所有规则
...Object.fromEntries(
Object.keys(pluginVue.configs["vue3-recommended"].rules || {}).map((key) => [key, "off"])
),
"no-unused-vars": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
];

View File

@@ -26,7 +26,7 @@
"build:app-ios": "uni build -p app-ios",
"build:app-harmony": "uni build -p app-harmony",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5": "uni build --mode production",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
@@ -41,7 +41,7 @@
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit",
"lint:eslint": "eslint --fix ./src",
"lint:eslint": "eslint \"src/**/*.{vue,ts}\" --fix",
"lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,css,scss,vue,html,md}\"",
"lint:stylelint": "stylelint \"**/*.{css,scss,vue,html}\" --fix",
"lint:lint-staged": "lint-staged",

63
pnpm-lock.yaml generated
View File

@@ -50,18 +50,15 @@ dependencies:
'@dcloudio/uni-quickapp-webview':
specifier: 3.0.0-4020420240722002
version: 3.0.0-4020420240722002(postcss@8.4.49)(vue@3.5.13)
'@qiun/uni-ucharts':
specifier: 2.5.0-20230101
version: 2.5.0-20230101
pinia:
specifier: ^2.2.2
version: 2.2.6(typescript@4.9.5)(vue@3.5.13)
vue:
specifier: ^3.4.21
specifier: ^3.5.13
version: 3.5.13(typescript@4.9.5)
wot-design-uni:
specifier: ^1.3.11
version: 1.3.14(vue@3.5.13)
specifier: ^1.4.0
version: 1.8.0(vue@3.5.13)
devDependencies:
'@commitlint/cli':
@@ -131,11 +128,11 @@ devDependencies:
specifier: ^3.3.3
version: 3.3.3
sass:
specifier: 1.79.3
version: 1.79.3
specifier: 1.78.0
version: 1.78.0
sass-loader:
specifier: ^16.0.2
version: 16.0.3(sass@1.79.3)
version: 16.0.3(sass@1.78.0)
stylelint:
specifier: ^16.9.0
version: 16.10.0(typescript@4.9.5)
@@ -174,7 +171,7 @@ devDependencies:
version: 0.18.5
vite:
specifier: 5.2.8
version: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
version: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
vue-eslint-parser:
specifier: ^9.4.3
version: 9.4.3(eslint@9.15.0)
@@ -2269,7 +2266,7 @@ packages:
picocolors: 1.1.1
terser: 5.36.0
unplugin-auto-import: 0.16.7
vite: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
transitivePeerDependencies:
- '@nuxt/kit'
- '@vueuse/core'
@@ -3528,10 +3525,6 @@ packages:
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
dev: true
/@qiun/uni-ucharts@2.5.0-20230101:
resolution: {integrity: sha512-qpgzAUgrShgKNn0uMoN54n6/MkFeQQpK2gur0Fzokn8oTIMCVjTfnt8C2UhD20pPlm6MFxwkWF+bsJ3qd4QMvg==}
dev: false
/@rollup/pluginutils@5.1.3:
resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==}
engines: {node: '>=14.0.0'}
@@ -3926,7 +3919,7 @@ packages:
'@unocss/core': 0.62.4
'@unocss/reset': 0.62.4
'@unocss/vite': 0.62.4(vite@5.2.8)
vite: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
transitivePeerDependencies:
- rollup
- supports-color
@@ -4112,7 +4105,7 @@ packages:
chokidar: 3.6.0
magic-string: 0.30.13
tinyglobby: 0.2.10
vite: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
transitivePeerDependencies:
- rollup
- supports-color
@@ -4134,7 +4127,7 @@ packages:
regenerator-runtime: 0.14.1
systemjs: 6.15.1
terser: 5.36.0
vite: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
transitivePeerDependencies:
- supports-color
dev: true
@@ -4149,7 +4142,7 @@ packages:
'@babel/core': 7.26.0
'@babel/plugin-transform-typescript': 7.25.9(@babel/core@7.26.0)
'@vue/babel-plugin-jsx': 1.2.5(@babel/core@7.26.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
vue: 3.5.13(typescript@4.9.5)
transitivePeerDependencies:
- supports-color
@@ -4162,7 +4155,7 @@ packages:
vite: ^5.0.0
vue: ^3.2.25
dependencies:
vite: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
vue: 3.5.13(typescript@4.9.5)
/@volar/language-core@1.11.1:
@@ -4906,12 +4899,6 @@ packages:
optionalDependencies:
fsevents: 2.3.3
/chokidar@4.0.1:
resolution: {integrity: sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==}
engines: {node: '>= 14.16.0'}
dependencies:
readdirp: 4.0.2
/ci-info@3.9.0:
resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==}
engines: {node: '>=8'}
@@ -8446,10 +8433,6 @@ packages:
dependencies:
picomatch: 2.3.1
/readdirp@4.0.2:
resolution: {integrity: sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==}
engines: {node: '>= 14.16.0'}
/regenerate-unicode-properties@10.2.0:
resolution: {integrity: sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==}
engines: {node: '>=4'}
@@ -8640,7 +8623,7 @@ packages:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
dev: true
/sass-loader@16.0.3(sass@1.79.3):
/sass-loader@16.0.3(sass@1.78.0):
resolution: {integrity: sha512-gosNorT1RCkuCMyihv6FBRR7BMV06oKRAs+l4UMp1mlcVg9rWN6KMmUj3igjQwmYys4mDP3etEYJgiHRbgHCHA==}
engines: {node: '>= 18.12.0'}
peerDependencies:
@@ -8662,15 +8645,15 @@ packages:
optional: true
dependencies:
neo-async: 2.6.2
sass: 1.79.3
sass: 1.78.0
dev: true
/sass@1.79.3:
resolution: {integrity: sha512-m7dZxh0W9EZ3cw50Me5GOuYm/tVAJAn91SUnohLRo9cXBixGUOdvmryN+dXpwR831bhoY3Zv7rEFt85PUwTmzA==}
/sass@1.78.0:
resolution: {integrity: sha512-AaIqGSrjo5lA2Yg7RvFZrlXDBCp3nV4XP73GrLGvdRWWwk+8H3l0SDvq/5bA4eF+0RFPLuWUk3E+P1U/YqnpsQ==}
engines: {node: '>=14.0.0'}
hasBin: true
dependencies:
chokidar: 4.0.1
chokidar: 3.6.0
immutable: 4.3.7
source-map-js: 1.2.1
@@ -9465,7 +9448,7 @@ packages:
'@unocss/transformer-directives': 0.62.4
'@unocss/transformer-variant-group': 0.62.4
'@unocss/vite': 0.62.4(vite@5.2.8)
vite: 5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0)
vite: 5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0)
transitivePeerDependencies:
- postcss
- rollup
@@ -9615,7 +9598,7 @@ packages:
engines: {node: '>= 0.8'}
dev: true
/vite@5.2.8(@types/node@22.9.1)(sass@1.79.3)(terser@5.36.0):
/vite@5.2.8(@types/node@22.9.1)(sass@1.78.0)(terser@5.36.0):
resolution: {integrity: sha512-OyZR+c1CE8yeHw5V5t59aXsUPPVTHMDjEZz8MgguLL/Q7NblxhZUlTu9xSPqlsUO/y+X7dlU05jdhvyycD55DA==}
engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true
@@ -9647,7 +9630,7 @@ packages:
esbuild: 0.20.2
postcss: 8.4.49
rollup: 4.27.3
sass: 1.79.3
sass: 1.78.0
terser: 5.36.0
optionalDependencies:
fsevents: 2.3.3
@@ -9811,8 +9794,8 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/wot-design-uni@1.3.14(vue@3.5.13):
resolution: {integrity: sha512-njqhMpVVHPWjiQdnuUkAFvCrJKv28RraSU6BiAW1soHw7BA6L3b7UJ0mdUMxsjT+A2hCk2YN8RsLKC03wDV9zw==}
/wot-design-uni@1.8.0(vue@3.5.13):
resolution: {integrity: sha512-JSfOVGtvBnXVnaf8/2Fsh/aMkZPoFFt6t8wBRhpDaEPoOndTHBR68Ro+ctP3JKgyVATHaYc4v63TJca55SV1Iw==}
engines: {HBuilderX: ^3.8.7}
peerDependencies:
vue: '>=3.2.47'

View File

@@ -1,16 +1,20 @@
import request from "@/utils/request";
const DICT_BASE_URL = "/api/v1/dict";
const DICT_BASE_URL = "/api/v1/dicts";
const DictAPI = {
//---------------------------------------------------
// 字典相关接口
//---------------------------------------------------
/**
* 获取字典分页列表
* 字典分页列表
*
* @param queryParams 查询参数
* @returns 字典分页结果
*/
getPage(queryParams: DictPageQuery) {
return request<DictPageVO[]>({
return request<PageResult<DictPageVO[]>>({
url: `${DICT_BASE_URL}/page`,
method: "GET",
data: queryParams,
@@ -18,7 +22,7 @@ const DictAPI = {
},
/**
* 获取字典表单数据
* 字典表单数据
*
* @param id 字典ID
* @returns 字典表单数据
@@ -35,7 +39,7 @@ const DictAPI = {
*
* @param data 字典表单数据
*/
add(data: DictForm) {
create(data: DictForm) {
return request({
url: `${DICT_BASE_URL}`,
method: "POST",
@@ -65,21 +69,81 @@ const DictAPI = {
deleteByIds(ids: string) {
return request({
url: `${DICT_BASE_URL}/${ids}`,
method: "delete",
method: "DELETE",
});
},
//---------------------------------------------------
// 字典项相关接口
//---------------------------------------------------
/**
* 获取字典分页列表
*
* @param queryParams 查询参数
* @returns 字典分页结果
*/
getDictItemPage(dictCode: string, queryParams: DictItemPageQuery) {
return request<PageResult<DictItemPageVO[]>>({
url: `${DICT_BASE_URL}/${dictCode}/items/page`,
method: "GET",
data: queryParams,
});
},
/**
* 获取字典列表
*
* @returns 字典列表
* 获取字典列表
*/
getList() {
return request<DictVO[]>({
url: `${DICT_BASE_URL}/list`,
getDictItems(dictCode: string) {
return request<DictItemOption[]>({
url: `${DICT_BASE_URL}/${dictCode}/items`,
method: "GET",
});
},
/**
* 新增字典项
*/
createDictItem(dictCode: string, data: DictItemForm) {
return request({
url: `${DICT_BASE_URL}/${dictCode}/items`,
method: "POST",
data: data,
});
},
/**
* 获取字典项表单数据
*
* @param id 字典项ID
* @returns 字典项表单数据
*/
getDictItemFormData(dictCode: string, id: number) {
return request<DictItemForm>({
url: `${DICT_BASE_URL}/${dictCode}/items/${id}/form`,
method: "GET",
});
},
/**
* 修改字典项
*/
updateDictItem(dictCode: string, id: number, data: DictItemForm) {
return request({
url: `${DICT_BASE_URL}/${dictCode}/items/${id}`,
method: "PUT",
data: data,
});
},
/**
* 删除字典项
*/
deleteDictItems(dictCode: string, ids: string) {
return request({
url: `${DICT_BASE_URL}/${dictCode}/items/${ids}`,
method: "DELETE",
});
},
};
export default DictAPI;
@@ -148,27 +212,85 @@ export interface DictForm {
}
/**
* 字典数据项分页VO
*
* @description 字典数据分页对象
* 字典查询参
*/
export interface DictVO {
/** 字典名称 */
name: string;
export interface DictItemPageQuery extends PageQuery {
/** 关键字(字典数据值/标签) */
keywords?: string;
/** 字典编码 */
dictCode: string;
/** 字典数据集合 */
dictDataList: DictData[];
dictCode?: string;
}
/**
* 字典数据
*
* @description 字典数据
* 字典分页对象
*/
export interface DictData {
export interface DictItemPageVO {
/**
* 字典ID
*/
id: number;
/**
* 字典编码
*/
dictCode: string;
/**
* 字典数据值
*/
value: string;
/**
* 字典数据标签
*/
label: string;
/**
* 状态1:启用0:禁用)
*/
status: number;
/**
* 字典排序
*/
sort?: number;
}
/**
* 字典
*/
export interface DictItemForm {
/**
* 字典ID
*/
id?: number;
/**
* 字典编码
*/
dictCode?: string;
/**
* 字典数据值
*/
value?: string;
/**
* 字典数据标签
*/
label?: string;
/**
* 状态1:启用0:禁用)
*/
status?: number;
/**
* 字典排序
*/
sort?: number;
/**
* 标签类型
*/
tagType?: "success" | "warning" | "info" | "primary" | "danger" | undefined;
}
/**
* 字典项下拉选项
*/
export interface DictItemOption {
/** 字典数据值 */
value: string;

View File

@@ -683,10 +683,13 @@ export default defineComponent({
let newChildren = [...(item.originItem?.children || []), ...(apiRes || [])];
const newChildrenObj = {};
newChildren = newChildren.reduce((total, next) => {
newChildrenObj[next[fieldMap.value]]
? ""
: (newChildrenObj[next[fieldMap.value]] = true && total.push(next));
return total;
if (newChildrenObj[next[fieldMap.value]]) {
return total;
} else {
newChildrenObj[next[fieldMap.value]] = true;
total.push(next);
return total;
}
}, []);
item.originItem.children = newChildren || null;

View File

@@ -10,18 +10,18 @@ export const isCheckedStatus = 2;
* @param originData 拷贝对象
* @author crlang(https://crlang.com)
*/
export function deepClone(originData) {
export function deepClone(originData: any): any {
const type = Object.prototype.toString.call(originData);
let data;
let data: any;
if (type === "[object Array]") {
data = [];
for (let i = 0; i < originData.length; i++) {
data.push(deepClone(originData[i]));
}
} else if (type === "[object Object]") {
data = {};
data = {} as Record<string, any>;
for (const prop in originData) {
if (originData.hasOwnProperty(prop)) {
if (Object.prototype.hasOwnProperty.call(originData, prop)) {
// 非继承属性
data[prop] = deepClone(originData[prop]);
}
@@ -34,11 +34,13 @@ export function deepClone(originData) {
/**
* 获取所有指定的节点
* @param type
* @param value
* @param list 列表
* @param type 类型
* @param value 值
* @param packDisabledkey 是否包含禁用节点
* @author crlang(https://crlang.com)
*/
export function getAllNodes(list, type, value, packDisabledkey = true) {
export function getAllNodes(list: any[], type: string, value: any, packDisabledkey = true): any[] {
if (!list || list.length === 0) {
return [];
}
@@ -58,16 +60,23 @@ export function getAllNodes(list, type, value, packDisabledkey = true) {
/**
* 获取所有指定的key值
* @param type
* @param value
* @param list 列表
* @param type 类型
* @param value 值
* @param packDisabledkey 是否包含禁用节点
* @author crlang(https://crlang.com)
*/
export function getAllNodeKeys(list, type, value, packDisabledkey = true) {
export function getAllNodeKeys(
list: any[],
type: string,
value: any,
packDisabledkey = true
): string[] | null {
if (!list || list.length === 0) {
return null;
}
const res = [];
const res: string[] = [];
for (let i = 0; i < list.length; i++) {
const item = list[i];
if (item[type] === value) {
@@ -82,69 +91,63 @@ export function getAllNodeKeys(list, type, value, packDisabledkey = true) {
/**
* 错误输出
*
* @param msg
* @param msg 错误消息
* @param args 附加参数
*/
export function logError(msg, ...args) {
export function logError(msg: string, ...args: any[]): void {
console.error(`DaTree: ${msg}`, ...args);
}
const toString = Object.prototype.toString;
export function is(val, type) {
export function is(val: any, type: string): boolean {
return toString.call(val) === `[object ${type}]`;
}
/**
* 是否对象(Object)
* @param val
* @param val
*/
export function isObject(val) {
export function isObject(val: any): boolean {
return val !== null && is(val, "Object");
}
/**
* 是否数字(Number)
* @param val
* @param val
*/
export function isNumber(val) {
export function isNumber(val: any): boolean {
return is(val, "Number");
}
/**
* 是否字符串(String)
* @param val
* @param val
*/
export function isString(val) {
export function isString(val: any): boolean {
return is(val, "String");
}
/**
* 是否函数方法(Function)
* @param val
* @param val
*/
export function isFunction(val) {
export function isFunction(val: any): boolean {
return typeof val === "function";
}
/**
* 是否布尔(Boolean)
* @param val
* @param val
*/
export function isBoolean(val) {
export function isBoolean(val: any): boolean {
return is(val, "Boolean");
}
/**
* 是否数组(Array)
* @param val
* @param val
*/
export function isArray(val) {
export function isArray(val: any): boolean {
return val && Array.isArray(val);
}

View File

@@ -68,8 +68,8 @@
<!-- #ifdef MP-ALIPAY -->
<block v-if="ontouch">
<canvas
:id="cid"
v-show="showchart"
:id="cid"
:canvasId="cid"
:width="cWidth * pixel"
:height="cHeight * pixel"
@@ -846,7 +846,7 @@ export default {
let cid = this.cid;
if (this.echarts !== true && cfu.option[cid] && cfu.option[cid].context) {
const ctx = cfu.option[cid].context;
if (typeof ctx === "object" && !!!cfu.option[cid].update) {
if (typeof ctx === "object" && !cfu.option[cid].update) {
ctx.clearRect(0, 0, this.cWidth * this.pixel, this.cHeight * this.pixel);
ctx.draw();
}

View File

@@ -57,7 +57,6 @@
<script lang="ts" setup>
import { type LoginFormData } from "@/api/auth";
import { useUserStore } from "@/store/modules/user";
import { useDictStore } from "@/store/modules/dict";
const loginFormRef = ref();
const loginFormData = ref<LoginFormData>({
@@ -66,7 +65,6 @@ const loginFormData = ref<LoginFormData>({
});
const userStore = useUserStore();
const dictStore = useDictStore();
// 登录处理
const handleLogin = () => {
@@ -75,23 +73,14 @@ const handleLogin = () => {
try {
await userStore.login(loginFormData.value);
await userStore.getInfo();
await dictStore.loadDictionaries();
uni.showToast({ title: "登录成功", icon: "success" });
// 检查是否有上一页
const pages = getCurrentPages();
console.log("pages", pages.length);
if (pages.length > 1) {
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
setTimeout(() => {
uni.reLaunch({
url: "/pages/index/index",
});
}, 1500);
}
setTimeout(() => {
uni.reLaunch({
url: "/pages/index/index",
});
}, 1500);
} catch (error: any) {
console.log("登录失败", error.message);
}

View File

@@ -125,7 +125,7 @@ const handleSubmit = async () => {
setTimeout(() => {
uni.navigateBack();
}, 1500);
} catch (error) {
} catch {
toast.error("提交失败,请重试");
} finally {
submitting.value = false;

View File

@@ -95,7 +95,7 @@ const handleQuestionFeedback = () => {
uni.navigateTo({ url: "/pages/mine/feedback/index" });
};
// 建设中
const handleItemclick = (item: any) => {
const handleItemclick = () => {
toast.show("建设中...");
};
</script>

View File

@@ -63,12 +63,7 @@
</view>
</template>
<script setup lang="ts">
import UserAPI, {
type UserProfileVO,
UserProfileForm,
MobileBindingForm,
EmailBindingForm,
} from "@/api/system/user";
import UserAPI, { type UserProfileVO, UserProfileForm } from "@/api/system/user";
import FileAPI, { type FileInfo } from "@/api/file";
const originalSrc = ref<string>(""); //选取的原图路径

View File

@@ -126,7 +126,7 @@ const handleClearCache = async () => {
title: "清理成功",
icon: "success",
});
} catch (error) {
} catch {
uni.showToast({
title: "清理失败",
icon: "error",

View File

@@ -101,7 +101,7 @@ const getNetworkType = async () => {
? `${(navigator as any).connection.effectiveType || "未知"}`
: "不支持";
// #endif
} catch (error) {
} catch {
networkType.value = "获取失败";
signalStrength.value = "获取失败";
}
@@ -143,13 +143,13 @@ const startTest = async () => {
try {
const startTime = Date.now();
// #ifdef H5
const res = await uni.request({
await uni.request({
url: "/api/v1/auth/captcha",
timeout: 5000,
});
// #endif
// #ifndef H5
const resOther = await request({
await request({
url: "/api/v1/auth/captcha",
timeout: 5000,
});
@@ -159,7 +159,7 @@ const startTest = async () => {
pingResult.value.delay = delay;
pingResult.value.status = delay < 300 ? "正常" : "较慢";
} catch (error) {
} catch {
pingResult.value.delay = "--";
pingResult.value.status = "连接失败";
} finally {

View File

@@ -153,7 +153,7 @@ async function submitForm() {
loading.value = true;
try {
if (formRef.value) {
formRef.value!.validate().then(async ({ valid, errors }) => {
formRef.value!.validate().then(async ({ valid }) => {
if (valid) {
if (form.value.id) {
await ConfigAPI.update(form.value.id, form.value);
@@ -170,7 +170,7 @@ async function submitForm() {
}
});
}
} catch (error) {
} catch {
uni.showToast({ title: "操作失败", icon: "error" });
loading.value = false;
} finally {

View File

@@ -119,7 +119,7 @@ function loadmore() {
total.value = data.total;
queryParams.pageNum++;
})
.catch((e) => {
.catch(() => {
pageData.value = [];
})
.finally(() => {

View File

@@ -128,38 +128,23 @@ const formatDate = (date: Date | undefined): string => {
return date ? date.toString() : "-";
};
const getLevelType = (level: string | number | undefined): string => {
if (!level) return "-";
const levelMap: Record<string, string> = {
L: "低",
M: "中",
H: "高",
};
return levelMap[level] || "未知";
};
// 加载更多
const loadMore = async () => {
if (loadState.value === "loading") return;
loadState.value = "loading";
try {
const { list, total: totalCount } = await NoticeAPI.getPage(queryParams.value);
const { list, total: totalCount } = await NoticeAPI.getPage(queryParams.value);
if (queryParams.value.pageNum === 1) {
dataList.value = list;
} else {
dataList.value = [...dataList.value, ...list];
}
total.value = totalCount;
queryParams.value.pageNum++;
loadState.value = dataList.value.length >= total.value ? "finished" : "loading";
} catch (error) {
loadState.value = "error";
uni.showToast({ title: "加载失败", icon: "none" });
if (queryParams.value.pageNum === 1) {
dataList.value = list;
} else {
dataList.value = [...dataList.value, ...list];
}
total.value = totalCount;
queryParams.value.pageNum++;
loadState.value = dataList.value.length >= total.value ? "finished" : "loading";
};
// 查看详情
@@ -207,7 +192,7 @@ const handleDelete = (notice: NoticePageVO) => {
queryParams.value.pageNum = 1;
loadMore();
} catch (error) {
uni.showToast({ title: "删除失败", icon: "none" });
uni.showToast({ title: "删除失败" + error, icon: "none" });
}
}
},
@@ -228,7 +213,7 @@ const handlePublish = (notice: NoticePageVO) => {
queryParams.value.pageNum = 1;
loadMore();
} catch (error) {
uni.showToast({ title: "发布失败", icon: "none" });
uni.showToast({ title: "发布失败" + error, icon: "none" });
}
}
},
@@ -253,7 +238,7 @@ const handleRevoke = (notice: NoticePageVO) => {
loadMore();
} catch (error) {
uni.showToast({
title: "撤回失败",
title: "撤回失败" + error,
icon: "error",
});
}

View File

@@ -6,110 +6,95 @@
// biome-ignore lint: disable
export {}
declare global {
const EffectScope: (typeof import("vue"))["EffectScope"];
const computed: (typeof import("vue"))["computed"];
const createApp: (typeof import("vue"))["createApp"];
const customRef: (typeof import("vue"))["customRef"];
const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"];
const defineComponent: (typeof import("vue"))["defineComponent"];
const effectScope: (typeof import("vue"))["effectScope"];
const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"];
const getCurrentScope: (typeof import("vue"))["getCurrentScope"];
const h: (typeof import("vue"))["h"];
const inject: (typeof import("vue"))["inject"];
const isProxy: (typeof import("vue"))["isProxy"];
const isReactive: (typeof import("vue"))["isReactive"];
const isReadonly: (typeof import("vue"))["isReadonly"];
const isRef: (typeof import("vue"))["isRef"];
const markRaw: (typeof import("vue"))["markRaw"];
const nextTick: (typeof import("vue"))["nextTick"];
const onActivated: (typeof import("vue"))["onActivated"];
const onAddToFavorites: (typeof import("@dcloudio/uni-app"))["onAddToFavorites"];
const onBackPress: (typeof import("@dcloudio/uni-app"))["onBackPress"];
const onBeforeMount: (typeof import("vue"))["onBeforeMount"];
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"];
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"];
const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"];
const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"];
const onDeactivated: (typeof import("vue"))["onDeactivated"];
const onError: (typeof import("@dcloudio/uni-app"))["onError"];
const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"];
const onHide: (typeof import("@dcloudio/uni-app"))["onHide"];
const onLaunch: (typeof import("@dcloudio/uni-app"))["onLaunch"];
const onLoad: (typeof import("@dcloudio/uni-app"))["onLoad"];
const onMounted: (typeof import("vue"))["onMounted"];
const onNavigationBarButtonTap: (typeof import("@dcloudio/uni-app"))["onNavigationBarButtonTap"];
const onNavigationBarSearchInputChanged: (typeof import("@dcloudio/uni-app"))["onNavigationBarSearchInputChanged"];
const onNavigationBarSearchInputClicked: (typeof import("@dcloudio/uni-app"))["onNavigationBarSearchInputClicked"];
const onNavigationBarSearchInputConfirmed: (typeof import("@dcloudio/uni-app"))["onNavigationBarSearchInputConfirmed"];
const onNavigationBarSearchInputFocusChanged: (typeof import("@dcloudio/uni-app"))["onNavigationBarSearchInputFocusChanged"];
const onPageNotFound: (typeof import("@dcloudio/uni-app"))["onPageNotFound"];
const onPageScroll: (typeof import("@dcloudio/uni-app"))["onPageScroll"];
const onPullDownRefresh: (typeof import("@dcloudio/uni-app"))["onPullDownRefresh"];
const onReachBottom: (typeof import("@dcloudio/uni-app"))["onReachBottom"];
const onReady: (typeof import("@dcloudio/uni-app"))["onReady"];
const onRenderTracked: (typeof import("vue"))["onRenderTracked"];
const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"];
const onResize: (typeof import("@dcloudio/uni-app"))["onResize"];
const onScopeDispose: (typeof import("vue"))["onScopeDispose"];
const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"];
const onShareAppMessage: (typeof import("@dcloudio/uni-app"))["onShareAppMessage"];
const onShareTimeline: (typeof import("@dcloudio/uni-app"))["onShareTimeline"];
const onShow: (typeof import("@dcloudio/uni-app"))["onShow"];
const onTabItemTap: (typeof import("@dcloudio/uni-app"))["onTabItemTap"];
const onThemeChange: (typeof import("@dcloudio/uni-app"))["onThemeChange"];
const onUnhandledRejection: (typeof import("@dcloudio/uni-app"))["onUnhandledRejection"];
const onUnload: (typeof import("@dcloudio/uni-app"))["onUnload"];
const onUnmounted: (typeof import("vue"))["onUnmounted"];
const onUpdated: (typeof import("vue"))["onUpdated"];
const onWatcherCleanup: (typeof import("vue"))["onWatcherCleanup"];
const provide: (typeof import("vue"))["provide"];
const reactive: (typeof import("vue"))["reactive"];
const readonly: (typeof import("vue"))["readonly"];
const ref: (typeof import("vue"))["ref"];
const resolveComponent: (typeof import("vue"))["resolveComponent"];
const shallowReactive: (typeof import("vue"))["shallowReactive"];
const shallowReadonly: (typeof import("vue"))["shallowReadonly"];
const shallowRef: (typeof import("vue"))["shallowRef"];
const toRaw: (typeof import("vue"))["toRaw"];
const toRef: (typeof import("vue"))["toRef"];
const toRefs: (typeof import("vue"))["toRefs"];
const toValue: (typeof import("vue"))["toValue"];
const triggerRef: (typeof import("vue"))["triggerRef"];
const unref: (typeof import("vue"))["unref"];
const useAttrs: (typeof import("vue"))["useAttrs"];
const useCssModule: (typeof import("vue"))["useCssModule"];
const useCssVars: (typeof import("vue"))["useCssVars"];
const useId: (typeof import("vue"))["useId"];
const useLink: (typeof import("vue-router"))["useLink"];
const useModel: (typeof import("vue"))["useModel"];
const useRoute: (typeof import("vue-router"))["useRoute"];
const useRouter: (typeof import("vue-router"))["useRouter"];
const useSlots: (typeof import("vue"))["useSlots"];
const useTemplateRef: (typeof import("vue"))["useTemplateRef"];
const watch: (typeof import("vue"))["watch"];
const watchEffect: (typeof import("vue"))["watchEffect"];
const watchPostEffect: (typeof import("vue"))["watchPostEffect"];
const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"];
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onAddToFavorites: typeof import('@dcloudio/uni-app')['onAddToFavorites']
const onBackPress: typeof import('@dcloudio/uni-app')['onBackPress']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"]
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"]
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onError: typeof import('@dcloudio/uni-app')['onError']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onHide: typeof import('@dcloudio/uni-app')['onHide']
const onLaunch: typeof import('@dcloudio/uni-app')['onLaunch']
const onLoad: typeof import('@dcloudio/uni-app')['onLoad']
const onMounted: typeof import('vue')['onMounted']
const onNavigationBarButtonTap: typeof import('@dcloudio/uni-app')['onNavigationBarButtonTap']
const onNavigationBarSearchInputChanged: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputChanged']
const onNavigationBarSearchInputClicked: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputClicked']
const onNavigationBarSearchInputConfirmed: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputConfirmed']
const onNavigationBarSearchInputFocusChanged: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputFocusChanged']
const onPageNotFound: typeof import('@dcloudio/uni-app')['onPageNotFound']
const onPageScroll: typeof import('@dcloudio/uni-app')['onPageScroll']
const onPullDownRefresh: typeof import('@dcloudio/uni-app')['onPullDownRefresh']
const onReachBottom: typeof import('@dcloudio/uni-app')['onReachBottom']
const onReady: typeof import('@dcloudio/uni-app')['onReady']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onResize: typeof import('@dcloudio/uni-app')['onResize']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage']
const onShareTimeline: typeof import('@dcloudio/uni-app')['onShareTimeline']
const onShow: typeof import('@dcloudio/uni-app')['onShow']
const onTabItemTap: typeof import('@dcloudio/uni-app')['onTabItemTap']
const onThemeChange: typeof import('@dcloudio/uni-app')['onThemeChange']
const onUnhandledRejection: typeof import('@dcloudio/uni-app')['onUnhandledRejection']
const onUnload: typeof import('@dcloudio/uni-app')['onUnload']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useId: typeof import('vue')['useId']
const useLink: (typeof import("vue-router"))["useLink"]
const useModel: typeof import('vue')['useModel']
const useRoute: (typeof import("vue-router"))["useRoute"]
const useRouter: (typeof import("vue-router"))["useRouter"]
const useSlots: typeof import('vue')['useSlots']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type {
Component,
ComponentPublicInstance,
ComputedRef,
DirectiveBinding,
ExtractDefaultPropTypes,
ExtractPropTypes,
ExtractPublicPropTypes,
InjectionKey,
PropType,
Ref,
MaybeRef,
MaybeRefOrGetter,
VNode,
WritableComputedRef,
} from "vue";
import("vue");
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}