Commit 00cb376a0e0454e80e12b56e2f56ffd5b19ca541
Merge branch 'sqy_dev' into 'main'
'fix:重置密码,修复各种各样问题' See merge request huang/yun-teng-iot-front!152
Showing
17 changed files
with
89 additions
and
126 deletions
| @@ -8,14 +8,14 @@ VITE_PUBLIC_PATH = / | @@ -8,14 +8,14 @@ VITE_PUBLIC_PATH = / | ||
| 8 | # Please note that no line breaks | 8 | # Please note that no line breaks |
| 9 | 9 | ||
| 10 | # 本地 | 10 | # 本地 |
| 11 | -# VITE_PROXY = [["/api","http://192.168.10.108:8080/api"]] | 11 | +# VITE_PROXY = [["/api","http://192.168.10.113:8080/api"]] |
| 12 | 12 | ||
| 13 | # 线上 | 13 | # 线上 |
| 14 | # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | 14 | # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] |
| 15 | VITE_PROXY = [["/api","http://47.99.141.212:8080/api"]] | 15 | VITE_PROXY = [["/api","http://47.99.141.212:8080/api"]] |
| 16 | 16 | ||
| 17 | # 实时数据的ws地址 | 17 | # 实时数据的ws地址 |
| 18 | -VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | 18 | +VITE_WEB_SOCKET = ws://47.99.141.212:8080/api/ws/plugins/telemetry?token= |
| 19 | 19 | ||
| 20 | # Delete console | 20 | # Delete console |
| 21 | VITE_DROP_CONSOLE = true | 21 | VITE_DROP_CONSOLE = true |
| @@ -8,7 +8,7 @@ import { | @@ -8,7 +8,7 @@ import { | ||
| 8 | SmsLoginParams, | 8 | SmsLoginParams, |
| 9 | } from './model/userModel'; | 9 | } from './model/userModel'; |
| 10 | 10 | ||
| 11 | -import { ErrorMessageMode } from '/#/axios'; | 11 | +import type { ErrorMessageMode } from '/#/axios'; |
| 12 | 12 | ||
| 13 | enum Api { | 13 | enum Api { |
| 14 | Login = '/auth/login', | 14 | Login = '/auth/login', |
| @@ -19,6 +19,8 @@ enum Api { | @@ -19,6 +19,8 @@ enum Api { | ||
| 19 | GetPermCode = '/role/me/permissions', | 19 | GetPermCode = '/role/me/permissions', |
| 20 | RefreshToken = '/auth/token', | 20 | RefreshToken = '/auth/token', |
| 21 | SendLoginSmsCode = '/noauth/sendLoginSmsCode/', | 21 | SendLoginSmsCode = '/noauth/sendLoginSmsCode/', |
| 22 | + ResetCode = '/noauth/resetCode/', | ||
| 23 | + ResetPassword = '/noauth/reset/', | ||
| 22 | } | 24 | } |
| 23 | 25 | ||
| 24 | /** | 26 | /** |
| @@ -78,9 +80,17 @@ export function smsCodeLoginApi(params: SmsLoginParams, mode: ErrorMessageMode = | @@ -78,9 +80,17 @@ export function smsCodeLoginApi(params: SmsLoginParams, mode: ErrorMessageMode = | ||
| 78 | ); | 80 | ); |
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | -export function forgetPasswordApi(params) { | 83 | +// 密码重置验证码 |
| 84 | +export function passwordResetCode(mobile) { | ||
| 82 | return defHttp.post({ | 85 | return defHttp.post({ |
| 83 | - url: '', | ||
| 84 | - params, | 86 | + url: Api.ResetCode + mobile, |
| 87 | + }); | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +// 重置密码 | ||
| 91 | +export function forgetPasswordApi(data) { | ||
| 92 | + return defHttp.post({ | ||
| 93 | + url: Api.ResetPassword + data.phoneNumber, | ||
| 94 | + data, | ||
| 85 | }); | 95 | }); |
| 86 | } | 96 | } |
| @@ -45,6 +45,7 @@ | @@ -45,6 +45,7 @@ | ||
| 45 | const lockStore = useLockStore(); | 45 | const lockStore = useLockStore(); |
| 46 | 46 | ||
| 47 | const getRealName = computed(() => userStore.getUserInfo?.realName); | 47 | const getRealName = computed(() => userStore.getUserInfo?.realName); |
| 48 | + console.log(getRealName); | ||
| 48 | const [register, { closeModal }] = useModalInner(); | 49 | const [register, { closeModal }] = useModalInner(); |
| 49 | 50 | ||
| 50 | const [registerForm, { validateFields, resetFields }] = useForm({ | 51 | const [registerForm, { validateFields, resetFields }] = useForm({ |
| @@ -95,7 +96,7 @@ | @@ -95,7 +96,7 @@ | ||
| 95 | &__entry { | 96 | &__entry { |
| 96 | position: relative; | 97 | position: relative; |
| 97 | //height: 240px; | 98 | //height: 240px; |
| 98 | - padding: 130px 30px 30px 30px; | 99 | + padding: 130px 30px 30px; |
| 99 | border-radius: 10px; | 100 | border-radius: 10px; |
| 100 | } | 101 | } |
| 101 | 102 | ||
| @@ -105,7 +106,6 @@ | @@ -105,7 +106,6 @@ | ||
| 105 | left: calc(50% - 45px); | 106 | left: calc(50% - 45px); |
| 106 | width: auto; | 107 | width: auto; |
| 107 | text-align: center; | 108 | text-align: center; |
| 108 | - | ||
| 109 | &-img { | 109 | &-img { |
| 110 | width: 70px; | 110 | width: 70px; |
| 111 | border-radius: 50%; | 111 | border-radius: 50%; |
| @@ -113,6 +113,9 @@ | @@ -113,6 +113,9 @@ | ||
| 113 | 113 | ||
| 114 | &-name { | 114 | &-name { |
| 115 | margin-top: 5px; | 115 | margin-top: 5px; |
| 116 | + display: flex; | ||
| 117 | + width: 100%; | ||
| 118 | + // margin-left: -15px; | ||
| 116 | } | 119 | } |
| 117 | } | 120 | } |
| 118 | 121 |
| @@ -85,6 +85,7 @@ | @@ -85,6 +85,7 @@ | ||
| 85 | import { getAuthCache } from '/@/utils/auth'; | 85 | import { getAuthCache } from '/@/utils/auth'; |
| 86 | import { Upload } from 'ant-design-vue'; | 86 | import { Upload } from 'ant-design-vue'; |
| 87 | import { PlusOutlined } from '@ant-design/icons-vue'; | 87 | import { PlusOutlined } from '@ant-design/icons-vue'; |
| 88 | + import { useUserStore } from '/@/store/modules/user'; | ||
| 88 | import type { FileItem } from '/@/components/Upload/src/typing'; | 89 | import type { FileItem } from '/@/components/Upload/src/typing'; |
| 89 | 90 | ||
| 90 | const schema: DescItem[] = [ | 91 | const schema: DescItem[] = [ |
| @@ -126,6 +127,7 @@ | @@ -126,6 +127,7 @@ | ||
| 126 | const getBackendV: any = ref({}); | 127 | const getBackendV: any = ref({}); |
| 127 | const getData: any = ref({}); | 128 | const getData: any = ref({}); |
| 128 | const updataPersonlData: any = ref({}); | 129 | const updataPersonlData: any = ref({}); |
| 130 | + const userStore = useUserStore(); | ||
| 129 | // const getUpdateUserInfo: any = ref({}); | 131 | // const getUpdateUserInfo: any = ref({}); |
| 130 | const [registerDesc] = useDescription({ | 132 | const [registerDesc] = useDescription({ |
| 131 | title: '个人详情', | 133 | title: '个人详情', |
| @@ -209,6 +211,8 @@ | @@ -209,6 +211,8 @@ | ||
| 209 | getPersonalValue.value.username = getBackendV.value.username; | 211 | getPersonalValue.value.username = getBackendV.value.username; |
| 210 | getPersonalValue.value.avatar = peresonalPic.value; | 212 | getPersonalValue.value.avatar = peresonalPic.value; |
| 211 | getData.value = await personalPut(getPersonalValue.value); | 213 | getData.value = await personalPut(getPersonalValue.value); |
| 214 | + console.log(getData.value.realName); | ||
| 215 | + userStore.setUserInfo(getData.value); | ||
| 212 | updatePersonalData.value = getData.value; | 216 | updatePersonalData.value = getData.value; |
| 213 | createMessage.success('修改成功'); | 217 | createMessage.success('修改成功'); |
| 214 | const setUpdateUserInfo = JSON.stringify(getData.value); | 218 | const setUpdateUserInfo = JSON.stringify(getData.value); |
| @@ -56,7 +56,7 @@ export default { | @@ -56,7 +56,7 @@ export default { | ||
| 56 | alert: '锁屏密码错误', | 56 | alert: '锁屏密码错误', |
| 57 | backToLogin: '返回登录', | 57 | backToLogin: '返回登录', |
| 58 | entry: '进入系统', | 58 | entry: '进入系统', |
| 59 | - placeholder: '请输入锁屏密码或者用户密码', | 59 | + placeholder: '请输入锁屏密码或者重新登录', |
| 60 | }, | 60 | }, |
| 61 | login: { | 61 | login: { |
| 62 | backSignIn: '返回', | 62 | backSignIn: '返回', |
| @@ -31,29 +31,10 @@ export const useLockStore = defineStore({ | @@ -31,29 +31,10 @@ export const useLockStore = defineStore({ | ||
| 31 | }, | 31 | }, |
| 32 | // Unlock | 32 | // Unlock |
| 33 | async unLock(password?: string) { | 33 | async unLock(password?: string) { |
| 34 | - const userStore = useUserStore(); | ||
| 35 | if (this.lockInfo?.pwd === password) { | 34 | if (this.lockInfo?.pwd === password) { |
| 36 | this.resetLockInfo(); | 35 | this.resetLockInfo(); |
| 37 | return true; | 36 | return true; |
| 38 | } | 37 | } |
| 39 | - const tryLogin = async () => { | ||
| 40 | - try { | ||
| 41 | - const username = userStore.getUserInfo?.username; | ||
| 42 | - const res = await userStore.login({ | ||
| 43 | - username, | ||
| 44 | - password: password!, | ||
| 45 | - goHome: false, | ||
| 46 | - mode: 'none', | ||
| 47 | - }); | ||
| 48 | - if (res) { | ||
| 49 | - this.resetLockInfo(); | ||
| 50 | - } | ||
| 51 | - return res; | ||
| 52 | - } catch (error) { | ||
| 53 | - return false; | ||
| 54 | - } | ||
| 55 | - }; | ||
| 56 | - return await tryLogin(); | ||
| 57 | }, | 38 | }, |
| 58 | }, | 39 | }, |
| 59 | }); | 40 | }); |
| @@ -4,13 +4,7 @@ import { defineStore } from 'pinia'; | @@ -4,13 +4,7 @@ import { defineStore } from 'pinia'; | ||
| 4 | import { store } from '/@/store'; | 4 | import { store } from '/@/store'; |
| 5 | import { RoleEnum } from '/@/enums/roleEnum'; | 5 | import { RoleEnum } from '/@/enums/roleEnum'; |
| 6 | import { PageEnum } from '/@/enums/pageEnum'; | 6 | import { PageEnum } from '/@/enums/pageEnum'; |
| 7 | -import { | ||
| 8 | - JWT_TOKEN_KEY, | ||
| 9 | - REFRESH_TOKEN_KEY, | ||
| 10 | - ROLES_KEY, | ||
| 11 | - TOKEN_KEY, | ||
| 12 | - USER_INFO_KEY, | ||
| 13 | -} from '/@/enums/cacheEnum'; | 7 | +import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, ROLES_KEY, USER_INFO_KEY } from '/@/enums/cacheEnum'; |
| 14 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; | 8 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; |
| 15 | import { | 9 | import { |
| 16 | LoginParams, | 10 | LoginParams, |
| @@ -71,7 +71,7 @@ export const formSchema: FormSchema[] = [ | @@ -71,7 +71,7 @@ export const formSchema: FormSchema[] = [ | ||
| 71 | component: 'Input', | 71 | component: 'Input', |
| 72 | componentProps: { | 72 | componentProps: { |
| 73 | placeholder: '请输入联系人姓名', | 73 | placeholder: '请输入联系人姓名', |
| 74 | - maxLength: 255, | 74 | + maxLength: 30, |
| 75 | }, | 75 | }, |
| 76 | }, | 76 | }, |
| 77 | { | 77 | { |
| @@ -6,11 +6,6 @@ import { numberRule } from '/@/utils/rules'; | @@ -6,11 +6,6 @@ import { numberRule } from '/@/utils/rules'; | ||
| 6 | 6 | ||
| 7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
| 8 | { | 8 | { |
| 9 | - title: '创建时间', | ||
| 10 | - dataIndex: 'createTime', | ||
| 11 | - width: 150, | ||
| 12 | - }, | ||
| 13 | - { | ||
| 14 | title: '名称', | 9 | title: '名称', |
| 15 | dataIndex: 'name', | 10 | dataIndex: 'name', |
| 16 | width: 150, | 11 | width: 150, |
| @@ -26,10 +21,21 @@ export const columns: BasicColumn[] = [ | @@ -26,10 +21,21 @@ export const columns: BasicColumn[] = [ | ||
| 26 | width: 100, | 21 | width: 100, |
| 27 | }, | 22 | }, |
| 28 | { | 23 | { |
| 24 | + title: '默认配置', | ||
| 25 | + dataIndex: 'default', | ||
| 26 | + width: 100, | ||
| 27 | + format: (text) => (text ? '是' : '否'), | ||
| 28 | + }, | ||
| 29 | + { | ||
| 29 | title: '描述', | 30 | title: '描述', |
| 30 | dataIndex: 'description', | 31 | dataIndex: 'description', |
| 31 | width: 150, | 32 | width: 150, |
| 32 | }, | 33 | }, |
| 34 | + { | ||
| 35 | + title: '创建时间', | ||
| 36 | + dataIndex: 'createTime', | ||
| 37 | + width: 150, | ||
| 38 | + }, | ||
| 33 | ]; | 39 | ]; |
| 34 | 40 | ||
| 35 | export const searchFormSchema: FormSchema[] = [ | 41 | export const searchFormSchema: FormSchema[] = [ |
| @@ -22,6 +22,9 @@ | @@ -22,6 +22,9 @@ | ||
| 22 | label: '设置为默认', | 22 | label: '设置为默认', |
| 23 | icon: 'ant-design:profile-outlined', | 23 | icon: 'ant-design:profile-outlined', |
| 24 | onClick: handleSetDefault.bind(null, record), | 24 | onClick: handleSetDefault.bind(null, record), |
| 25 | + ifShow: () => { | ||
| 26 | + return record.default === false; | ||
| 27 | + }, | ||
| 25 | }, | 28 | }, |
| 26 | { | 29 | { |
| 27 | label: '详情', | 30 | label: '详情', |
| @@ -102,7 +105,7 @@ | @@ -102,7 +105,7 @@ | ||
| 102 | bordered: true, | 105 | bordered: true, |
| 103 | showIndexColumn: false, | 106 | showIndexColumn: false, |
| 104 | actionColumn: { | 107 | actionColumn: { |
| 105 | - width: 200, | 108 | + width: 250, |
| 106 | title: '操作', | 109 | title: '操作', |
| 107 | dataIndex: 'action', | 110 | dataIndex: 'action', |
| 108 | slots: { customRender: 'action' }, | 111 | slots: { customRender: 'action' }, |
| @@ -33,14 +33,6 @@ export const columns: BasicColumn[] = [ | @@ -33,14 +33,6 @@ export const columns: BasicColumn[] = [ | ||
| 33 | width: 200, | 33 | width: 200, |
| 34 | }, | 34 | }, |
| 35 | { | 35 | { |
| 36 | - title: '内容', | ||
| 37 | - dataIndex: 'content', | ||
| 38 | - width: 120, | ||
| 39 | - format: (text: string, record: Recordable) => { | ||
| 40 | - return !record.content ? '' : record.content.slice(3, record.content.length - 4); | ||
| 41 | - }, | ||
| 42 | - }, | ||
| 43 | - { | ||
| 44 | title: '发送者', | 36 | title: '发送者', |
| 45 | dataIndex: 'senderName', | 37 | dataIndex: 'senderName', |
| 46 | width: 200, | 38 | width: 200, |
| @@ -5,23 +5,7 @@ | @@ -5,23 +5,7 @@ | ||
| 5 | > | 5 | > |
| 6 | <div | 6 | <div |
| 7 | :class="`${prefixCls}__unlock`" | 7 | :class="`${prefixCls}__unlock`" |
| 8 | - class=" | ||
| 9 | - absolute | ||
| 10 | - top-0 | ||
| 11 | - left-1/2 | ||
| 12 | - flex | ||
| 13 | - pt-5 | ||
| 14 | - h-16 | ||
| 15 | - items-center | ||
| 16 | - justify-center | ||
| 17 | - sm:text-md | ||
| 18 | - xl:text-xl | ||
| 19 | - text-white | ||
| 20 | - flex-col | ||
| 21 | - cursor-pointer | ||
| 22 | - transform | ||
| 23 | - translate-x-1/2 | ||
| 24 | - " | 8 | + class="absolute top-0 left-1/2 flex pt-5 h-16 items-center justify-center sm:text-md xl:text-xl text-white flex-col cursor-pointer transform translate-x-1/2" |
| 25 | @click="handleShowForm(false)" | 9 | @click="handleShowForm(false)" |
| 26 | v-show="showDate" | 10 | v-show="showDate" |
| 27 | > | 11 | > |
| @@ -140,7 +124,7 @@ | @@ -140,7 +124,7 @@ | ||
| 140 | } | 124 | } |
| 141 | 125 | ||
| 142 | function goLogin() { | 126 | function goLogin() { |
| 143 | - userStore.logout(); | 127 | + userStore.logout(true); |
| 144 | lockStore.resetLockInfo(); | 128 | lockStore.resetLockInfo(); |
| 145 | } | 129 | } |
| 146 | 130 |
| @@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
| 40 | import { CountdownInput } from '/@/components/CountDown'; | 40 | import { CountdownInput } from '/@/components/CountDown'; |
| 41 | import { useI18n } from '/@/hooks/web/useI18n'; | 41 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 42 | import { useLoginState, useFormRules, LoginStateEnum } from './useLogin'; | 42 | import { useLoginState, useFormRules, LoginStateEnum } from './useLogin'; |
| 43 | - import { forgetPasswordApi } from '/@/api/sys/user'; | 43 | + import { passwordResetCode, forgetPasswordApi } from '/@/api/sys/user'; |
| 44 | const FormItem = Form.Item; | 44 | const FormItem = Form.Item; |
| 45 | const { t } = useI18n(); | 45 | const { t } = useI18n(); |
| 46 | const { handleBackLogin, getLoginState, setLoginState } = useLoginState(); | 46 | const { handleBackLogin, getLoginState, setLoginState } = useLoginState(); |
| @@ -58,22 +58,39 @@ | @@ -58,22 +58,39 @@ | ||
| 58 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.RESET_PASSWORD); | 58 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.RESET_PASSWORD); |
| 59 | 59 | ||
| 60 | async function handleReset() { | 60 | async function handleReset() { |
| 61 | - setLoginState(LoginStateEnum.LOGIN); | ||
| 62 | const form = unref(formRef); | 61 | const form = unref(formRef); |
| 63 | if (!form) return; | 62 | if (!form) return; |
| 63 | + const value = await form.validate(); | ||
| 64 | + if (!value) return; | ||
| 65 | + const { mobile, password, sms } = value; | ||
| 66 | + try { | ||
| 67 | + loading.value = true; | ||
| 68 | + await forgetPasswordApi({ | ||
| 69 | + phoneNumber: mobile, | ||
| 70 | + userId: sms, | ||
| 71 | + password, | ||
| 72 | + }); | ||
| 73 | + } catch (e) { | ||
| 74 | + return; | ||
| 75 | + } finally { | ||
| 76 | + loading.value = false; | ||
| 77 | + } | ||
| 78 | + message.success('密码重置成功'); | ||
| 64 | await form.resetFields(); | 79 | await form.resetFields(); |
| 80 | + setLoginState(LoginStateEnum.LOGIN); | ||
| 65 | } | 81 | } |
| 66 | 82 | ||
| 67 | async function sendLoginSms() { | 83 | async function sendLoginSms() { |
| 68 | const reg = | 84 | const reg = |
| 69 | /^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/; | 85 | /^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/; |
| 70 | if (reg.test(formData.mobile)) { | 86 | if (reg.test(formData.mobile)) { |
| 71 | - const sendRes = await forgetPasswordApi(formData.mobile); | ||
| 72 | - if (!sendRes) { | ||
| 73 | - message.error('发送失败'); | ||
| 74 | - return false; | 87 | + const sendRes = await passwordResetCode(formData.mobile); |
| 88 | + console.log(sendRes); | ||
| 89 | + if (sendRes === '') { | ||
| 90 | + console.log('发送成功了'); | ||
| 91 | + return true; | ||
| 75 | } | 92 | } |
| 76 | - return true; | 93 | + return false; |
| 77 | } else { | 94 | } else { |
| 78 | message.error('请输入正确手机号码'); | 95 | message.error('请输入正确手机号码'); |
| 79 | } | 96 | } |
| @@ -60,10 +60,16 @@ | @@ -60,10 +60,16 @@ | ||
| 60 | </ACol> | 60 | </ACol> |
| 61 | </ARow> | 61 | </ARow> |
| 62 | </Form> | 62 | </Form> |
| 63 | + <Modal v-model:visible="visible" :footer="null" centered> | ||
| 64 | + <template #title> | ||
| 65 | + <CloseCircleFilled class="modal-icon-error" /><span class="ml-2">错误提示</span> | ||
| 66 | + </template> | ||
| 67 | + <span class="ml-2" style="color: red">用户名或密码不正确</span> | ||
| 68 | + </Modal> | ||
| 63 | </template> | 69 | </template> |
| 64 | <script lang="ts" setup> | 70 | <script lang="ts" setup> |
| 65 | import { reactive, ref, unref, computed } from 'vue'; | 71 | import { reactive, ref, unref, computed } from 'vue'; |
| 66 | - import { Checkbox, Form, Input, Row, Col, Button } from 'ant-design-vue'; | 72 | + import { Checkbox, Form, Input, Row, Col, Button, Modal } from 'ant-design-vue'; |
| 67 | import LoginFormTitle from './LoginFormTitle.vue'; | 73 | import LoginFormTitle from './LoginFormTitle.vue'; |
| 68 | 74 | ||
| 69 | import { useI18n } from '/@/hooks/web/useI18n'; | 75 | import { useI18n } from '/@/hooks/web/useI18n'; |
| @@ -74,6 +80,7 @@ | @@ -74,6 +80,7 @@ | ||
| 74 | import { useDesign } from '/@/hooks/web/useDesign'; | 80 | import { useDesign } from '/@/hooks/web/useDesign'; |
| 75 | import { getPlatForm } from '/@/api/oem/index'; | 81 | import { getPlatForm } from '/@/api/oem/index'; |
| 76 | import { createLocalStorage } from '/@/utils/cache/index'; | 82 | import { createLocalStorage } from '/@/utils/cache/index'; |
| 83 | + import { CloseCircleFilled } from '@ant-design/icons-vue'; | ||
| 77 | 84 | ||
| 78 | const ACol = Col; | 85 | const ACol = Col; |
| 79 | const ARow = Row; | 86 | const ARow = Row; |
| @@ -87,7 +94,7 @@ | @@ -87,7 +94,7 @@ | ||
| 87 | const { setLoginState, getLoginState } = useLoginState(); | 94 | const { setLoginState, getLoginState } = useLoginState(); |
| 88 | const { getFormRules } = useFormRules(); | 95 | const { getFormRules } = useFormRules(); |
| 89 | const storage = createLocalStorage(); | 96 | const storage = createLocalStorage(); |
| 90 | - | 97 | + const visible = ref(false); |
| 91 | const formRef = ref(); | 98 | const formRef = ref(); |
| 92 | const loading = ref(false); | 99 | const loading = ref(false); |
| 93 | const rememberMe = ref(false); | 100 | const rememberMe = ref(false); |
| @@ -100,6 +107,7 @@ | @@ -100,6 +107,7 @@ | ||
| 100 | const { validForm } = useFormValid(formRef); | 107 | const { validForm } = useFormValid(formRef); |
| 101 | 108 | ||
| 102 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); | 109 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
| 110 | + | ||
| 103 | async function handleLogin() { | 111 | async function handleLogin() { |
| 104 | const data = await validForm(); | 112 | const data = await validForm(); |
| 105 | if (!data) return; | 113 | if (!data) return; |
| @@ -113,7 +121,7 @@ | @@ -113,7 +121,7 @@ | ||
| 113 | const userInfo = await userStore.login({ | 121 | const userInfo = await userStore.login({ |
| 114 | password: data.password, | 122 | password: data.password, |
| 115 | username: data.account, | 123 | username: data.account, |
| 116 | - mode: 'none', //不要默认的错误提示 | 124 | + mode: 'modal', //不要默认的错误提示 |
| 117 | }); | 125 | }); |
| 118 | if (userInfo) { | 126 | if (userInfo) { |
| 119 | notification.success({ | 127 | notification.success({ |
| @@ -132,12 +140,8 @@ | @@ -132,12 +140,8 @@ | ||
| 132 | link.href = res.icon ?? '/favicon.ico'; | 140 | link.href = res.icon ?? '/favicon.ico'; |
| 133 | document.getElementsByTagName('head')[0].appendChild(link); | 141 | document.getElementsByTagName('head')[0].appendChild(link); |
| 134 | } | 142 | } |
| 135 | - } catch (error) { | ||
| 136 | - createErrorModal({ | ||
| 137 | - title: t('sys.api.errorTip'), | ||
| 138 | - content: (error as unknown as Error).message || t('sys.api.networkExceptionMsg'), | ||
| 139 | - getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, | ||
| 140 | - }); | 143 | + } catch (error: any) { |
| 144 | + visible.value = true; | ||
| 141 | } finally { | 145 | } finally { |
| 142 | loading.value = false; | 146 | loading.value = false; |
| 143 | } | 147 | } |
| @@ -78,6 +78,7 @@ | @@ -78,6 +78,7 @@ | ||
| 78 | async function handleLogin() { | 78 | async function handleLogin() { |
| 79 | const data = await validForm(); | 79 | const data = await validForm(); |
| 80 | if (!data) return; | 80 | if (!data) return; |
| 81 | + | ||
| 81 | const userInfo = await userStore.smsCodelogin( | 82 | const userInfo = await userStore.smsCodelogin( |
| 82 | toRaw({ | 83 | toRaw({ |
| 83 | phoneNumber: data.phoneNumber, | 84 | phoneNumber: data.phoneNumber, |
| @@ -10,23 +10,11 @@ export const schemas: FormSchema[] = [ | @@ -10,23 +10,11 @@ export const schemas: FormSchema[] = [ | ||
| 10 | colProps: { | 10 | colProps: { |
| 11 | span: 24, | 11 | span: 24, |
| 12 | }, | 12 | }, |
| 13 | + required: true, | ||
| 13 | componentProps: { | 14 | componentProps: { |
| 14 | maxLength: 100, | 15 | maxLength: 100, |
| 15 | placeholder: '请输入公司名称', | 16 | placeholder: '请输入公司名称', |
| 16 | }, | 17 | }, |
| 17 | - dynamicRules: () => { | ||
| 18 | - return [ | ||
| 19 | - { | ||
| 20 | - required: false, | ||
| 21 | - validator: (_, value) => { | ||
| 22 | - if (String(value).length > 100) { | ||
| 23 | - return Promise.reject('字数不超过100个字'); | ||
| 24 | - } | ||
| 25 | - return Promise.resolve(); | ||
| 26 | - }, | ||
| 27 | - }, | ||
| 28 | - ]; | ||
| 29 | - }, | ||
| 30 | }, | 18 | }, |
| 31 | { | 19 | { |
| 32 | field: 'abbreviation', | 20 | field: 'abbreviation', |
| @@ -148,23 +136,11 @@ export const schemas: FormSchema[] = [ | @@ -148,23 +136,11 @@ export const schemas: FormSchema[] = [ | ||
| 148 | colProps: { | 136 | colProps: { |
| 149 | span: 24, | 137 | span: 24, |
| 150 | }, | 138 | }, |
| 139 | + required: true, | ||
| 151 | componentProps: { | 140 | componentProps: { |
| 152 | maxLength: 100, | 141 | maxLength: 100, |
| 153 | placeholder: '请输入详细地址', | 142 | placeholder: '请输入详细地址', |
| 154 | }, | 143 | }, |
| 155 | - dynamicRules: () => { | ||
| 156 | - return [ | ||
| 157 | - { | ||
| 158 | - required: false, | ||
| 159 | - validator: (_, value) => { | ||
| 160 | - if (String(value).length > 100) { | ||
| 161 | - return Promise.reject('字数不超过100个字'); | ||
| 162 | - } | ||
| 163 | - return Promise.resolve(); | ||
| 164 | - }, | ||
| 165 | - }, | ||
| 166 | - ]; | ||
| 167 | - }, | ||
| 168 | }, | 144 | }, |
| 169 | 145 | ||
| 170 | { | 146 | { |
| @@ -174,23 +150,11 @@ export const schemas: FormSchema[] = [ | @@ -174,23 +150,11 @@ export const schemas: FormSchema[] = [ | ||
| 174 | colProps: { | 150 | colProps: { |
| 175 | span: 24, | 151 | span: 24, |
| 176 | }, | 152 | }, |
| 153 | + required: true, | ||
| 177 | componentProps: { | 154 | componentProps: { |
| 178 | maxLength: 25, | 155 | maxLength: 25, |
| 179 | placeholder: '请输入联系人', | 156 | placeholder: '请输入联系人', |
| 180 | }, | 157 | }, |
| 181 | - dynamicRules: () => { | ||
| 182 | - return [ | ||
| 183 | - { | ||
| 184 | - required: false, | ||
| 185 | - validator: (_, value) => { | ||
| 186 | - if (String(value).length > 25) { | ||
| 187 | - return Promise.reject('字数不超过25个字'); | ||
| 188 | - } | ||
| 189 | - return Promise.resolve(); | ||
| 190 | - }, | ||
| 191 | - }, | ||
| 192 | - ]; | ||
| 193 | - }, | ||
| 194 | }, | 158 | }, |
| 195 | { | 159 | { |
| 196 | field: 'tel', | 160 | field: 'tel', |
| @@ -3,15 +3,15 @@ | @@ -3,15 +3,15 @@ | ||
| 3 | <Card class="tab-card" :bordered="false"> | 3 | <Card class="tab-card" :bordered="false"> |
| 4 | <Tabs v-model:activeKey="activeKey" tab-position="left"> | 4 | <Tabs v-model:activeKey="activeKey" tab-position="left"> |
| 5 | <Tabs.TabPane key="企业信息" tab="企业信息" /> | 5 | <Tabs.TabPane key="企业信息" tab="企业信息" /> |
| 6 | - <Tabs.TabPane key="平台定制" tab="平台定制" /> | ||
| 7 | - <Tabs.TabPane key="APP定制" tab="APP定制" /> | 6 | + <Tabs.TabPane key="平台信息" tab="平台信息" /> |
| 7 | + <Tabs.TabPane key="APP信息" tab="APP信息" /> | ||
| 8 | </Tabs> | 8 | </Tabs> |
| 9 | </Card> | 9 | </Card> |
| 10 | 10 | ||
| 11 | <div style="width: 100%"> | 11 | <div style="width: 100%"> |
| 12 | <Card class="card" :title="activeKey" :bordered="false" :bodyStyle="{ display: 'none' }" /> | 12 | <Card class="card" :title="activeKey" :bordered="false" :bodyStyle="{ display: 'none' }" /> |
| 13 | <EnterpriseInfo v-if="activeKey === '企业信息'" /> | 13 | <EnterpriseInfo v-if="activeKey === '企业信息'" /> |
| 14 | - <CVIDraw v-else-if="activeKey === '平台定制'" /> | 14 | + <CVIDraw v-else-if="activeKey === '平台信息'" /> |
| 15 | <AppDraw v-else /> | 15 | <AppDraw v-else /> |
| 16 | </div> | 16 | </div> |
| 17 | </div> | 17 | </div> |