chore: 优化部分代码

This commit is contained in:
2024-04-29 22:18:39 +08:00
parent c0a5c2dffe
commit 70510894ef
9 changed files with 23 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ const BASE_URL = '/captcha'
/** @desc 获取图片验证码 */
export function getImageCaptcha() {
return http.get<Common.ImageCaptchaResp>(`${BASE_URL}/img`)
return http.get<Common.ImageCaptchaResp>(`${BASE_URL}/image`)
}
/** @desc 获取短信验证码 */

View File

@@ -2,6 +2,7 @@
export interface ImageCaptchaResp {
uuid: string
img: string
expireTime: number
}
/** 仪表盘访问趋势类型 */

View File

@@ -17,7 +17,7 @@
</a-col>
<a-col :xs="24" :sm="24" :md="10" :lg="8" :xl="8" :xxl="6" style="margin: -8px -7px">
<a-row justify="end">
<SupportCard />
<SupportCard v-if="isDesktop" />
</a-row>
</a-col>
</a-row>
@@ -26,10 +26,12 @@
<script setup lang="ts">
import NowTime from './NowTime/index.vue'
import { useDevice } from '@/hooks'
import { useUserStore } from '@/stores'
import { goodTimeText } from '@/utils'
import SupportCard from './SupportCard.vue'
const { isDesktop } = useDevice()
const userStore = useUserStore()
</script>

View File

@@ -37,6 +37,7 @@
// import { getEmailCaptcha } from '@/apis'
import { Message, type FormInstance } from '@arco-design/web-vue'
import { useUserStore } from '@/stores'
import * as Regexp from '@/utils/regexp'
const formRef = ref<FormInstance>()
const form = reactive({
@@ -45,7 +46,10 @@ const form = reactive({
})
const rules: FormInstance['rules'] = {
email: [{ required: true, message: '请输入邮箱' }],
email: [
{ required: true, message: '请输入邮箱' },
{ match: Regexp.Email, message: '请输入正确的邮箱' }
],
captcha: [{ required: true, message: '请输入验证码' }]
}

View File

@@ -37,6 +37,7 @@
// import { getSmsCaptcha } from '@/apis'
import { Message, type FormInstance } from '@arco-design/web-vue'
import { useUserStore } from '@/stores'
import * as Regexp from '@/utils/regexp'
const formRef = ref<FormInstance>()
const form = reactive({
@@ -47,7 +48,7 @@ const form = reactive({
const rules: FormInstance['rules'] = {
phone: [
{ required: true, message: '请输入手机号' },
{ match: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' }
{ match: Regexp.Phone, message: '请输入正确的手机号' }
],
captcha: [{ required: true, message: '请输入验证码' }]
}

View File

@@ -20,10 +20,10 @@
// import { getSmsCaptcha, getEmailCaptcha, updateUserEmail, updateUserPhone } from '@/apis'
import { Message } from '@arco-design/web-vue'
// import { encryptByRsa } from '@/utils/encrypt'
import * as Regexp from '@/utils/regexp'
import { useUserStore } from '@/stores'
import { type Columns, GiForm } from '@/components/GiForm'
import { useForm } from '@/hooks'
import * as Regexp from '@/utils/regexp'
const verifyType = ref()
const title = computed(() => (verifyType.value === 'phone' ? '修改手机号' : '修改邮箱'))

View File

@@ -27,7 +27,7 @@
</div>
</section>
<footer>
<a-descriptions column="4" size="large">
<a-descriptions :column="4" size="large">
<a-descriptions-item :span="4">
<template #label> <icon-user /><span style="margin-left: 5px">用户名</span></template>
{{ userInfo.username }}

View File

@@ -77,9 +77,9 @@ const columns: TableInstanceColumns[] = [
align: 'center',
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize)
},
{ title: '标题', dataIndex: 'title', slotName: 'title', ellipsis: true, tooltip: true },
{ title: '类型', slotName: 'type', align: 'center', width: 130 },
{ title: '状态', slotName: 'status', align: 'center', width: 130 },
{ title: '标题', dataIndex: 'title', slotName: 'title', width: 200, ellipsis: true, tooltip: true },
{ title: '类型', slotName: 'type', align: 'center' },
{ title: '状态', slotName: 'status', align: 'center' },
{ title: '生效时间', dataIndex: 'effectiveTime', width: 180 },
{ title: '终止时间', dataIndex: 'terminateTime', width: 180 },
{ title: '创建人', dataIndex: 'createUserString', show: false, ellipsis: true, tooltip: true },

View File

@@ -49,10 +49,10 @@
</a-button>
</a-tooltip>
</template>
<template #nickname="{ record }">
<template #username="{ record }">
<GiCellAvatar
:avatar="getAvatar(record.avatar, record.gender)"
:name="record.nickname"
:name="record.username"
is-link
@click="onDetail(record)"
/>
@@ -123,14 +123,14 @@ const columns: TableInstanceColumns[] = [
fixed: !isMobile() ? 'left' : undefined
},
{
title: '昵称',
slotName: 'nickname',
width: 170,
title: '用户名',
slotName: 'username',
width: 140,
ellipsis: true,
tooltip: true,
fixed: !isMobile() ? 'left' : undefined
},
{ title: '用户名', dataIndex: 'username', width: 120, ellipsis: true, tooltip: true },
{ title: '昵称', dataIndex: 'nickname', width: 120, ellipsis: true, tooltip: true },
{ title: '状态', slotName: 'status', align: 'center' },
{ title: '性别', slotName: 'gender', align: 'center' },
{ title: '手机号', dataIndex: 'phone', width: 170, ellipsis: true, tooltip: true },