update 优化 代码中存在的警告

This commit is contained in:
疯狂的狮子Li 2023-11-30 11:13:29 +08:00
parent 5c701801db
commit e1023bb331
6 changed files with 15 additions and 10 deletions

View File

@ -2,7 +2,7 @@
<div class="relative" :style="{ width: width }"> <div class="relative" :style="{ width: width }">
<el-input v-model="modelValue" readonly @click="visible = !visible" placeholder="点击选择图标"> <el-input v-model="modelValue" readonly @click="visible = !visible" placeholder="点击选择图标">
<template #prepend> <template #prepend>
<svg-icon :icon-class="modelValue as string" /> <svg-icon :icon-class="modelValue" />
</template> </template>
</el-input> </el-input>

View File

@ -18,8 +18,8 @@
</template> </template>
<sidebar-item <sidebar-item
v-for="(child) in item.children as RouteOption[]" v-for="(child, index) in item.children"
:key="child.path" :key="child.path + index"
:is-nest="true" :is-nest="true"
:item="child" :item="child"
:base-path="resolvePath(child.path)" :base-path="resolvePath(child.path)"

View File

@ -63,6 +63,10 @@ export const useUserStore = defineStore('user', () => {
removeToken(); removeToken();
}; };
const setAvatar = (value: string) => {
avatar.value = value;
};
return { return {
userId, userId,
token, token,
@ -72,7 +76,8 @@ export const useUserStore = defineStore('user', () => {
permissions, permissions,
login, login,
getInfo, getInfo,
logout logout,
setAvatar
}; };
}); });

View File

@ -105,12 +105,12 @@ const registerRules: ElFormRules = {
const codeUrl = ref(""); const codeUrl = ref("");
const loading = ref(false); const loading = ref(false);
const captchaEnabled = ref(true); const captchaEnabled = ref(true);
const registerRef = ref(ElForm); const registerRef = ref<ElFormInstance>();
// //
const tenantList = ref<TenantVO[]>([]); const tenantList = ref<TenantVO[]>([]);
const handleRegister = () => { const handleRegister = () => {
registerRef.value.validate(async (valid: boolean) => { registerRef.value?.validate(async (valid: boolean) => {
if (valid) { if (valid) {
loading.value = true; loading.value = true;
const [err] = await to(register(registerForm.value)); const [err] = await to(register(registerForm.value));

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="user-info-head" @click="editCropper()"> <div class="user-info-head" @click="editCropper()">
<img :src="options.img as string" title="点击上传头像" class="img-circle img-lg" /> <img :src="options.img" title="点击上传头像" class="img-circle img-lg" />
<el-dialog :title="title" v-model="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog"> <el-dialog :title="title" v-model="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog">
<el-row> <el-row>
<el-col :xs="24" :md="12" :style="{ height: '350px' }"> <el-col :xs="24" :md="12" :style="{ height: '350px' }">
@ -140,7 +140,7 @@ const uploadImg = async () => {
const res = await uploadAvatar(formData); const res = await uploadAvatar(formData);
open.value = false; open.value = false;
options.img = res.data.imgUrl; options.img = res.data.imgUrl;
userStore.avatar = options.img as string userStore.setAvatar(options.img as string)
proxy?.$modal.msgSuccess("修改成功"); proxy?.$modal.msgSuccess("修改成功");
visible.value = false; visible.value = false;
}); });

View File

@ -97,8 +97,8 @@
<el-tabs v-model="preview.activeName"> <el-tabs v-model="preview.activeName">
<el-tab-pane <el-tab-pane
v-for="(value, key) in preview.data" v-for="(value, key) in preview.data"
:label="(key as any).substring((key as any).lastIndexOf('/') + 1, (key as any).indexOf('.vm'))" :label="key.substring(key.lastIndexOf('/') + 1, key.indexOf('.vm'))"
:name="(key as any).substring((key as any).lastIndexOf('/') + 1, (key as any).indexOf('.vm'))" :name="key.substring(key.lastIndexOf('/') + 1, key.indexOf('.vm'))"
:key="value" :key="value"
> >
<el-link :underline="false" icon="DocumentCopy" v-copyText="value" v-copyText:callback="copyTextSuccess" style="float:right"> <el-link :underline="false" icon="DocumentCopy" v-copyText="value" v-copyText:callback="copyTextSuccess" style="float:right">