mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-10-17 04:57:15 +08:00
refactor: 调整 eslint.config.js,优化代码格式
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
<template>
|
||||
<a-modal v-model:visible="visible" :title="title" :mask-closable="false" :esc-to-close="false"
|
||||
:width="width >= 500 ? 500 : '100%'" draggable @before-ok="save" @ok="saveAfter" @close="reset">
|
||||
<a-modal
|
||||
v-model:visible="visible" :title="title" :mask-closable="false" :esc-to-close="false"
|
||||
:width="width >= 500 ? 500 : '100%'" draggable @before-ok="save" @ok="saveAfter" @close="reset"
|
||||
>
|
||||
<GiForm ref="formRef" v-model="form" :options="options" :columns="columns">
|
||||
<template #captcha>
|
||||
<a-input v-model="form.captcha" placeholder="请输入验证码" :max-length="6" allow-clear style="flex: 1 1" />
|
||||
<a-button class="captcha-btn" :loading="captchaLoading" :disabled="captchaDisable" size="large"
|
||||
@click="onCaptcha">
|
||||
<a-button
|
||||
class="captcha-btn" :loading="captchaLoading" :disabled="captchaDisable" size="large"
|
||||
@click="onCaptcha"
|
||||
>
|
||||
{{ captchaBtnName }}
|
||||
</a-button>
|
||||
</template>
|
||||
</GiForm>
|
||||
<Verify ref="VerifyRef" :captcha-type="captchaType" :mode="captchaMode"
|
||||
:img-size="{ width: '330px', height: '155px' }" @success="getCaptcha" />
|
||||
<Verify
|
||||
ref="VerifyRef" :captcha-type="captchaType" :mode="captchaMode"
|
||||
:img-size="{ width: '330px', height: '155px' }" @success="getCaptcha"
|
||||
/>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
@@ -34,13 +40,13 @@ const userInfo = computed(() => userStore.userInfo)
|
||||
|
||||
const verifyType = ref()
|
||||
const title = computed(
|
||||
() => `修改${verifyType.value === 'phone' ? '手机号' : verifyType.value === 'email' ? '邮箱' : '密码'}`
|
||||
() => `修改${verifyType.value === 'phone' ? '手机号' : verifyType.value === 'email' ? '邮箱' : '密码'}`,
|
||||
)
|
||||
const formRef = ref<InstanceType<typeof GiForm>>()
|
||||
|
||||
const options: Options = {
|
||||
form: { size: 'large' },
|
||||
btns: { hide: true }
|
||||
btns: { hide: true },
|
||||
}
|
||||
|
||||
const { form, resetForm } = useForm({
|
||||
@@ -49,7 +55,7 @@ const { form, resetForm } = useForm({
|
||||
captcha: '',
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
rePassword: ''
|
||||
rePassword: '',
|
||||
})
|
||||
|
||||
const columns: Columns = reactive([
|
||||
@@ -59,11 +65,11 @@ const columns: Columns = reactive([
|
||||
type: 'input',
|
||||
rules: [
|
||||
{ required: true, message: '请输入手机号' },
|
||||
{ match: Regexp.Phone, message: '请输入正确的手机号' }
|
||||
{ match: Regexp.Phone, message: '请输入正确的手机号' },
|
||||
],
|
||||
hide: () => {
|
||||
return verifyType.value !== 'phone'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '邮箱',
|
||||
@@ -71,11 +77,11 @@ const columns: Columns = reactive([
|
||||
type: 'input',
|
||||
rules: [
|
||||
{ required: true, message: '请输入邮箱' },
|
||||
{ match: Regexp.Email, message: '请输入正确的邮箱' }
|
||||
{ match: Regexp.Email, message: '请输入正确的邮箱' },
|
||||
],
|
||||
hide: () => {
|
||||
return verifyType.value !== 'email'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '验证码',
|
||||
@@ -84,7 +90,7 @@ const columns: Columns = reactive([
|
||||
rules: [{ required: true, message: '请输入验证码' }],
|
||||
hide: () => {
|
||||
return !['phone', 'email'].includes(verifyType.value)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '当前密码',
|
||||
@@ -93,7 +99,7 @@ const columns: Columns = reactive([
|
||||
rules: [{ required: true, message: '请输入当前密码' }],
|
||||
hide: () => {
|
||||
return !userInfo.value.pwdResetTime
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '新密码',
|
||||
@@ -108,19 +114,19 @@ const columns: Columns = reactive([
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
hide: () => {
|
||||
return verifyType.value !== 'password'
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '确认新密码',
|
||||
field: 'rePassword',
|
||||
type: 'input-password',
|
||||
props: {
|
||||
placeholder: '请再次输入新密码'
|
||||
placeholder: '请再次输入新密码',
|
||||
},
|
||||
rules: [
|
||||
{ required: true, message: '请再次输入新密码' },
|
||||
@@ -131,13 +137,13 @@ const columns: Columns = reactive([
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
hide: () => {
|
||||
return verifyType.value !== 'password'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
const VerifyRef = ref<InstanceType<any>>()
|
||||
@@ -210,14 +216,14 @@ const save = async () => {
|
||||
await updateUserPhone({
|
||||
phone: form.phone,
|
||||
captcha: form.captcha,
|
||||
oldPassword: encryptByRsa(form.oldPassword) as string
|
||||
oldPassword: encryptByRsa(form.oldPassword) as string,
|
||||
})
|
||||
Message.success('修改成功')
|
||||
} else if (verifyType.value === 'email') {
|
||||
await updateUserEmail({
|
||||
email: form.email,
|
||||
captcha: form.captcha,
|
||||
oldPassword: encryptByRsa(form.oldPassword) as string
|
||||
oldPassword: encryptByRsa(form.oldPassword) as string,
|
||||
})
|
||||
Message.success('修改成功')
|
||||
} else if (verifyType.value === 'password') {
|
||||
@@ -231,7 +237,7 @@ const save = async () => {
|
||||
}
|
||||
await updateUserPassword({
|
||||
oldPassword: encryptByRsa(form.oldPassword) || '',
|
||||
newPassword: encryptByRsa(form.newPassword) || ''
|
||||
newPassword: encryptByRsa(form.newPassword) || '',
|
||||
})
|
||||
}
|
||||
return true
|
||||
@@ -252,7 +258,7 @@ const saveAfter = async () => {
|
||||
const userStore = useUserStore()
|
||||
await userStore.logoutCallBack()
|
||||
await router.replace('/login')
|
||||
}
|
||||
},
|
||||
})
|
||||
} else {
|
||||
// 修改成功后,重新获取用户信息
|
||||
|
@@ -72,7 +72,7 @@ defineOptions({ name: 'SystemMessage' })
|
||||
const { message_type } = useDict('message_type')
|
||||
|
||||
const queryForm = reactive<MessageQuery>({
|
||||
sort: ['createTime,desc']
|
||||
sort: ['createTime,desc'],
|
||||
})
|
||||
|
||||
const {
|
||||
@@ -83,7 +83,7 @@ const {
|
||||
select,
|
||||
selectAll,
|
||||
search,
|
||||
handleDelete
|
||||
handleDelete,
|
||||
} = useTable((page) => listMessage({ ...queryForm, ...page }), { immediate: true })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
@@ -91,12 +91,12 @@ const columns: TableInstanceColumns[] = [
|
||||
title: '序号',
|
||||
width: 66,
|
||||
align: 'center',
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize)
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize),
|
||||
},
|
||||
{ title: '标题', dataIndex: 'title', slotName: 'title', ellipsis: true, tooltip: true },
|
||||
{ title: '状态', dataIndex: 'isRead', slotName: 'isRead', align: 'center', width: 80 },
|
||||
{ title: '时间', dataIndex: 'createTime', width: 180 },
|
||||
{ title: '类型', dataIndex: 'type', slotName: 'type', width: 180, ellipsis: true, tooltip: true }
|
||||
{ title: '类型', dataIndex: 'type', slotName: 'type', width: 180, ellipsis: true, tooltip: true },
|
||||
]
|
||||
|
||||
// 重置
|
||||
@@ -136,7 +136,7 @@ const onReadAll = async () => {
|
||||
await readMessage([])
|
||||
Message.success('操作成功')
|
||||
search()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
@@ -110,7 +110,7 @@ const userInfo = computed(() => userStore.userInfo)
|
||||
const avatar = {
|
||||
uid: '-2',
|
||||
name: 'avatar.png',
|
||||
url: userInfo.value.avatar
|
||||
url: userInfo.value.avatar,
|
||||
}
|
||||
const avatarList = ref<FileItem[]>([avatar])
|
||||
const fileRef = ref(reactive({ name: 'avatar.png' }))
|
||||
@@ -125,7 +125,7 @@ const options: cropperOptions = reactive({
|
||||
centerBox: true,
|
||||
canMove: true,
|
||||
outputSize: 1,
|
||||
outputType: 'png'
|
||||
outputType: 'png',
|
||||
})
|
||||
const visible = ref(false)
|
||||
// 打开裁剪框
|
||||
@@ -157,7 +157,7 @@ const handleRealTime = (data: any) => {
|
||||
overflow: 'hidden',
|
||||
margin: '0',
|
||||
zoom: 100 / data.h,
|
||||
borderRadius: '50%'
|
||||
borderRadius: '50%',
|
||||
}
|
||||
previews.value = data
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ const { width } = useWindowSize()
|
||||
|
||||
const options: Options = {
|
||||
form: { size: 'large' },
|
||||
btns: { hide: true }
|
||||
btns: { hide: true },
|
||||
}
|
||||
|
||||
const columns: Columns = reactive([
|
||||
@@ -33,7 +33,7 @@ const columns: Columns = reactive([
|
||||
label: '昵称',
|
||||
field: 'nickname',
|
||||
type: 'input',
|
||||
rules: [{ required: true, message: '请输入昵称' }]
|
||||
rules: [{ required: true, message: '请输入昵称' }],
|
||||
},
|
||||
{
|
||||
label: '性别',
|
||||
@@ -42,17 +42,17 @@ const columns: Columns = reactive([
|
||||
options: [
|
||||
{ label: '男', value: 1 },
|
||||
{ label: '女', value: 2 },
|
||||
{ label: '未知', value: 0, disabled: true }
|
||||
{ label: '未知', value: 0, disabled: true },
|
||||
],
|
||||
rules: [{ required: true, message: '请选择性别' }]
|
||||
}
|
||||
rules: [{ required: true, message: '请选择性别' }],
|
||||
},
|
||||
])
|
||||
|
||||
const userStore = useUserStore()
|
||||
const userInfo = computed(() => userStore.userInfo)
|
||||
const { form, resetForm } = useForm({
|
||||
nickname: userInfo.value.nickname,
|
||||
gender: userInfo.value.gender
|
||||
gender: userInfo.value.gender,
|
||||
})
|
||||
|
||||
const formRef = ref<InstanceType<typeof GiForm>>()
|
||||
|
@@ -52,7 +52,7 @@ modeList.value = [
|
||||
type: 'phone',
|
||||
jumpMode: 'modal',
|
||||
status: !!userInfo.value.phone,
|
||||
statusString: userInfo.value.phone ? '已绑定' : '未绑定'
|
||||
statusString: userInfo.value.phone ? '已绑定' : '未绑定',
|
||||
},
|
||||
{
|
||||
title: '安全邮箱',
|
||||
@@ -62,7 +62,7 @@ modeList.value = [
|
||||
type: 'email',
|
||||
jumpMode: 'modal',
|
||||
status: !!userInfo.value.email,
|
||||
statusString: userInfo.value.email ? '已绑定' : '未绑定'
|
||||
statusString: userInfo.value.email ? '已绑定' : '未绑定',
|
||||
},
|
||||
{
|
||||
title: '登录密码',
|
||||
@@ -71,8 +71,8 @@ modeList.value = [
|
||||
type: 'password',
|
||||
jumpMode: 'modal',
|
||||
status: !!userInfo.value.pwdResetTime,
|
||||
statusString: userInfo.value.pwdResetTime ? '已设置' : '未设置'
|
||||
}
|
||||
statusString: userInfo.value.pwdResetTime ? '已设置' : '未设置',
|
||||
},
|
||||
]
|
||||
|
||||
const verifyModelRef = ref<InstanceType<typeof VerifyModel>>()
|
||||
|
@@ -63,7 +63,7 @@ const initData = () => {
|
||||
subtitle: `${socialList.value.includes('GITEE') ? '' : '绑定后,'}可通过 Gitee 进行登录`,
|
||||
jumpMode: 'link',
|
||||
type: 'gitee',
|
||||
status: socialList.value.includes('GITEE')
|
||||
status: socialList.value.includes('GITEE'),
|
||||
},
|
||||
{
|
||||
title: '绑定 GitHub',
|
||||
@@ -71,8 +71,8 @@ const initData = () => {
|
||||
subtitle: `${socialList.value.includes('GITHUB') ? '' : '绑定后,'}可通过 GitHub 进行登录`,
|
||||
type: 'github',
|
||||
jumpMode: 'link',
|
||||
status: socialList.value.includes('GITHUB')
|
||||
}
|
||||
status: socialList.value.includes('GITHUB'),
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user