li.shaoyi il y a 2 ans
Parent
commit
b583ca41ac

+ 2 - 3
src/business/bank/index.ts

@@ -1,12 +1,11 @@
 import { reactive, shallowRef, computed } from 'vue'
-import { useAccountStore, useUserStore, useLoginStore } from '@/stores'
+import { useAccountStore, useUserStore } from '@/stores'
 import { t2bBankWithdraw, queryBankAccountSign, t2bBankDeposit, queryCusBankSignBank, t2bBankSign, t2bBankCancelSign, accountFundInfoReq } from '@/services/api/bank'
 import { SignStatus } from '@/constants/bank'
 import { decryptAES } from '@/services/websocket/package/crypto'
 import moment from "moment"
 
 const accountStore = useAccountStore()
-const loginStore = useLoginStore()
 
 // 提现请求
 export function useDoWithdraw() {
@@ -142,7 +141,7 @@ export function useDoBankSign() {
     /// 判断是否有签约信息 有就做修改
     queryBankAccountSign().then((res) => {
         console.log(res.data)
-        bankInfo.value = res.data.filter(obj=> {
+        bankInfo.value = res.data.filter(obj => {
             return ![SignStatus.Rescinded].includes(obj.signstatus)
         })[0]
         if (bankInfo.value) {

+ 1 - 1
src/packages/pc/views/auth/components/layout/index.vue

@@ -29,7 +29,7 @@ defineProps({
   },
 })
 
-const year = new Date().getFullYear()
+//const year = new Date().getFullYear()
 </script>
 
 <style lang="less">

+ 79 - 79
src/packages/pc/views/auth/forget/index.vue

@@ -1,54 +1,46 @@
 <template>
-    <el-form ref="formRef" :model="formData" :rules="formRules" @submit="formSubmit">
+    <el-form ref="formRef" :model="formData" :rules="formRules">
         <el-form-item prop="mobile">
-            <el-input name="mobile" placeholder="请输入手机号码" type="tel" v-model="formData.mobile" :rules="formRules.mobile"></el-input>
+            <el-input placeholder="请输入手机号码" type="number" v-model="formData.mobile" :rules="formRules.mobile" />
         </el-form-item>
         <el-form-item prop="vcode">
-            <el-input name="vcode" placeholder="请输入短信验证码" type="digit" v-model="formData.vcode" :rules="formRules.vcode">
+            <el-input placeholder="请输入短信验证码" type="number" v-model="formData.vcode" :rules="formRules.vcode">
+                <template #append>
+                    <el-button size="small" type="primary" :disabled="isCountdown" @click="sendVerifyCode">
+                        <span v-if="isCountdown">重新发送({{ seconds }})</span>
+                        <span v-else>获取验证码</span>
+                    </el-button>
+                </template>
             </el-input>
-            <el-button size="small" type="primary" :disabled="isCountdown" @click="sendVerifyCode">
-                <span v-if="isCountdown">重新发送({{ currentTime.seconds }})</span>
-                <span v-else>获取验证码</span>
-            </el-button>
         </el-form-item>
         <el-form-item prop="password">
-            <el-input name="password" placeholder="请输入新密码" type="password" v-model="formData.password" :rules="formRules.password"></el-input>
+            <el-input placeholder="请输入新密码" type="password" v-model="formData.password" :rules="formRules.password" />
         </el-form-item>
         <el-form-item prop="confirmpassword">
-            <el-input name="confirmpassword" placeholder="请输入确认密码" type="password" v-model="formData.confirmpassword" :rules="formRules.confirmpassword"></el-input>
+            <el-input placeholder="请输入确认密码" type="password" v-model="formData.confirmpassword"
+                :rules="formRules.confirmpassword" />
         </el-form-item>
         <el-form-item>
-            <el-button class="submit" type="primary" @click="formSubmit">重置密码</el-button>
-            <el-button class="cancel" type="primary" @click="$emit('close')" plain>取消</el-button>
+            <el-button type="primary" @click="formSubmit">重置密码</el-button>
+            <el-button @click="$emit('close')" style="margin-left: auto;">返回</el-button>
         </el-form-item>
     </el-form>
 </template>
 
 <script lang="ts" setup>
-import { reactive, ref, computed } from 'vue'
-import { useCountDown } from '@vant/use'
+import { reactive, ref } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { getEncryptMobile } from '@/filters'
 import { validateRules } from '@/constants/regex'
 import { queryLoginId } from '@/services/api/account'
 import { resetPassword, sendResetVerifyCode } from '@/services/api/common'
 import cryptojs from 'crypto-js'
-import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import service from '@/services'
 
 const formRef = ref<FormInstance>()
+const seconds = ref(60) //倒计时剩余时间
 const isCountdown = ref(false) // 是否正在倒计时
 
-// 倒计时函数
-const countdown = useCountDown({
-    time: 60 * 1000,
-    onFinish: () => {
-        countdown.reset()
-        isCountdown.value = false
-    }
-})
-
-// 倒计时剩余时间
-const currentTime = computed(() => countdown.current.value)
-
 // 表单数据
 const formData = reactive<Model.ResetPasswordReq & { confirmpassword: string }>({
     logincode: '',
@@ -62,92 +54,100 @@ const formData = reactive<Model.ResetPasswordReq & { confirmpassword: string }>(
 const formRules: FormRules = {
     mobile: [{
         required: true,
-        message: '请输入手机号码',
         validator: (rule, value, callback) => {
-            if (validateRules.phone.validate(value)) {
+            if (value && validateRules.phone.validate(value)) {
                 callback()
             }
-            callback(new Error(validateRules.phone.message)) 
+            callback(new Error(validateRules.phone.message))
         }
     }],
     password: [{
         required: true,
-        message: '请输入新密码',
         validator: (rule, value, callback) => {
             if (validateRules.password.validate(value)) {
                 callback()
             }
-            callback(new Error(validateRules.phone.message)) 
+            callback(new Error('密码必须是任意两种字符组合,长度最少6位'))
         }
     }],
     vcode: [{
         required: true,
         message: '请输入短信验证码',
-        validator: (rule, value, callback) => {
-            if (formData.mobile != '') {
-                callback()
-            }
-            callback(new Error('请输入手机号码')) 
-        }
     }],
     confirmpassword: [{
         required: true,
-        message: '请输入确认密码',
         validator: (rule, value, callback) => {
             if (formData.password === value) {
                 callback()
             }
-            callback(new Error('新密码和确认密码不一致')) 
+            callback(new Error('新密码和确认密码不一致'))
         }
     }],
 }
 
 // 发送手机验证码
 const sendVerifyCode = () => {
-    // formRef.value?.validate('mobile').then(() => {
-        sendResetVerifyCode({
-            data: {
-                mobile: getEncryptMobile(formData.mobile),
-                businessType: 1
-            }
-        }).then(() => {
-            isCountdown.value = true
-            countdown.start()
-        }).catch(() => {
-            ElMessage.error('发送失败')
-        })
-    // })
+    formRef.value?.validateField('mobile', (valid) => {
+        if (valid) {
+            service.onReady().then(() => {
+                sendResetVerifyCode({
+                    data: {
+                        mobile: getEncryptMobile(formData.mobile),
+                        businessType: 1
+                    }
+                }).then(() => {
+                    isCountdown.value = true
+                    // 开始倒计时
+                    const countDown = window.setInterval(() => {
+                        seconds.value--
+                        if (seconds.value <= 0) {
+                            clearInterval(countDown)
+                            isCountdown.value = false
+                        }
+                    }, 1000)
+                }).catch(() => {
+                    ElMessage.error('发送失败')
+                })
+            }).catch((err) => {
+                ElMessage.error(err)
+            })
+        }
+    })
 }
 
 const formSubmit = () => {
-    queryLoginId({
-        data: {
-            username: formData.mobile
-        }
-    }).then((res) => {
-        const { mobile, password, vcode } = formData
-        const logincode = res.data
-        const encryptedData = cryptojs.SHA256(logincode + password).toString()
-        const encryptedHex = cryptojs.enc.Hex.parse(encryptedData).toString().toLocaleLowerCase()
+    formRef.value?.validate(async (valid) => {
+        if (valid) {
+            queryLoginId({
+                data: {
+                    username: formData.mobile
+                }
+            }).then((res) => {
+                const { mobile, password, vcode } = formData
+                const logincode = res.data
+                const encryptedData = cryptojs.SHA256(logincode + password).toString()
+                const encryptedHex = cryptojs.enc.Hex.parse(encryptedData).toString().toLocaleLowerCase()
 
-        resetPassword({
-            data: {
-                logincode,
-                mobile: getEncryptMobile(mobile),
-                password: encryptedHex,
-                vcode,
-            }
-        }).then((res) => {
-            if (res.code === '0') {
-                ElMessage.success('密码重置成功,请重新登录。')
-            } else {
-                ElMessage.error(res.message)
-            }
-        }).catch((err) => {
-            ElMessage.error(err)
-        })
-    }).catch((err) => {
-        ElMessage.error(err)
+                resetPassword({
+                    data: {
+                        logincode,
+                        mobile: getEncryptMobile(mobile),
+                        password: encryptedHex,
+                        vcode,
+                    }
+                }).then((res) => {
+                    if (res.code === '0') {
+                        ElMessage.success('密码重置成功,请重新登录。')
+                    } else {
+                        ElMessage.error(res.message)
+                    }
+                }).catch((err) => {
+                    ElMessage.error(err)
+                })
+            }).catch((err) => {
+                ElMessage.error(err)
+            })
+        }
     })
 }
 </script>

+ 7 - 1
src/packages/pc/views/auth/login/index.less

@@ -1 +1,7 @@
-.user-login {}
+.user-login {
+    .text-link {
+        color: #666;
+        cursor: pointer;
+        margin-left: auto;
+    }
+}

+ 2 - 7
src/packages/pc/views/auth/login/index.vue

@@ -10,7 +10,7 @@
       </el-form-item>
       <el-form-item>
         <el-checkbox label="false" v-model="remember">记住账号</el-checkbox>
-        <span @click="goToFrogetPwd">忘记密码?</span>
+        <span class="text-link" @click="islogin = false">忘记密码?</span>
       </el-form-item>
       <el-form-item>
         <el-button class="submit" type="primary" :loading="loading" @click="formSubmit">
@@ -19,7 +19,7 @@
         </el-button>
       </el-form-item>
     </el-form>
-    <Forget @close="islogin=true" v-else></Forget>
+    <Forget @close="islogin = true" v-else></Forget>
   </sign-layout>
 </template>
 
@@ -51,11 +51,6 @@ const formRules: FormRules = {
   ]
 }
 
-/// 忘记密码
-const goToFrogetPwd = () => {
-  islogin.value = false
-}
-
 const formSubmit = () => {
   formRef.value?.validate(async (valid) => {
     if (valid) {

+ 1 - 2
src/packages/pc/views/market/trade/goods/detail/components/order/delisting/index.vue

@@ -9,7 +9,7 @@
                 <span>{{ selectedRow.orderprice }}</span>
             </el-form-item>
             <el-form-item label="剩余数量">
-                <span>{{ selectedRow.orderqty }}{{ getGoodsUnitName(quote?.goodunitid) }}</span>
+                <span>{{ selectedRow.orderqty }}</span>
             </el-form-item>
             <el-form-item prop="OrderQty" label="摘牌数量">
                 <div class="g-qty-group">
@@ -47,7 +47,6 @@
 <script lang="ts" setup>
 import { shallowRef, PropType, computed } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
-import { getGoodsUnitName } from '@/constants/unit'
 import { EBuildType, EDelistingType, EListingSelectType, EOrderOperateType, EPriceMode, EValidType } from '@/constants/client'
 import { BuyOrSell } from '@/constants/order'
 import { useRequest } from '@/hooks/request'

+ 1 - 1
src/packages/pc/views/market/trade/spot/order/delisting/index.vue

@@ -9,7 +9,7 @@
                 <span>{{ quoteDetail.fixedprice }}</span>
             </el-form-item>
             <el-form-item label="剩余数量">
-                <span>{{ quoteDetail.orderqty + quoteDetail.enumdicname }}</span>
+                <span>{{ quoteDetail.orderqty }}</span>
             </el-form-item>
             <el-form-item label="可用数量" v-if="quoteDetail.buyorsell === BuyOrSell.Buy">
                 <span>{{ holdLB?.enableqty ?? 0 }}</span>