Commit d0ebefea by 匡雅琴

Merge branch 'huy_v2.8.1' of http://192.168.3.233:8090/h5/vite-integral into huy_v2.8.1

2 parents f35c2b89 dfe48e18
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"sha1": "^1.1.1", "sha1": "^1.1.1",
"tslib": "^2.4.0", "tslib": "^2.4.0",
"vant": "^3.5.3", "vant": "^3.5.3",
"vconsole": "^3.7.0",
"vue": "^3.2.25", "vue": "^3.2.25",
"vue-router": "^4.1.1", "vue-router": "^4.1.1",
"vuex": "^4.0.2" "vuex": "^4.0.2"
......
...@@ -6,9 +6,10 @@ import App from './App.vue' ...@@ -6,9 +6,10 @@ import App from './App.vue'
import SvgIcon from 'comps/SvgIcon/index.vue' import SvgIcon from 'comps/SvgIcon/index.vue'
import 'lib-flexible/flexible' import 'lib-flexible/flexible'
import 'utils/rem' import 'utils/rem'
// import "vant/lib/index.css" import VConsole from 'vconsole'
import 'assets/styles/common.scss' import 'assets/styles/common.scss'
const app = createApp(App) const app = createApp(App)
const vConsole = new VConsole()
import { components } from './libs/vant' import { components } from './libs/vant'
components.forEach(component => app.use(component)); components.forEach(component => app.use(component));
app.component('svg-icon', SvgIcon) app.component('svg-icon', SvgIcon)
...@@ -20,4 +21,3 @@ setupRouter(app) ...@@ -20,4 +21,3 @@ setupRouter(app)
router.isReady().then(() => { router.isReady().then(() => {
app.mount('#app') app.mount('#app')
}) })
// createApp(App).component('svg-icon', SvgIcon).mount('#app')
...@@ -13,7 +13,6 @@ const router = createRouter({ ...@@ -13,7 +13,6 @@ const router = createRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log(to)
document.title = to.meta.title || '' document.title = to.meta.title || ''
/* 路由发生变化修改页面title */ /* 路由发生变化修改页面title */
// let title = util.getLocalStorage('wx_scrm_page_title') || ' ' // let title = util.getLocalStorage('wx_scrm_page_title') || ' '
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
const isVehicleNumber = (vehicleNumber: string) => { const isVehicleNumber = (vehicleNumber: string) => {
let result = false; let result = false;
// if (vehicleNumber.length == 8) { // if (vehicleNumber.length == 8) {
const express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[警京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{0,1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/; const reg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[警京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{0,1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
result = express.test(vehicleNumber); result = reg.test(vehicleNumber);
// } // }
return result; return result;
} }
...@@ -24,8 +24,17 @@ const isChinese = (text: string) => { ...@@ -24,8 +24,17 @@ const isChinese = (text: string) => {
return result return result
} }
// 数字校验
const isNumber = (n: string) => {
let result = false
const reg = /^[0-9]*$/
result = reg.test(n)
return result
}
export { export {
isVehicleNumber, isVehicleNumber,
isTel, isTel,
isChinese isChinese,
isNumber
} }
\ No newline at end of file \ No newline at end of file
...@@ -177,6 +177,7 @@ const getUserInfo = async () => { ...@@ -177,6 +177,7 @@ const getUserInfo = async () => {
// 查询可用积分 // 查询可用积分
const getIntegral = async () => { const getIntegral = async () => {
const res = await req("scrm.api.renewal.h5.integral.get"); const res = await req("scrm.api.renewal.h5.integral.get");
console.log(res.amount, "-------");
data.integral = res.amount; data.integral = res.amount;
}; };
...@@ -231,6 +232,7 @@ onBeforeMount(() => { ...@@ -231,6 +232,7 @@ onBeforeMount(() => {
.van-list { .van-list {
flex-direction: column; flex-direction: column;
} }
.wrapper { .wrapper {
.login { .login {
height: 291px; height: 291px;
...@@ -347,9 +349,11 @@ onBeforeMount(() => { ...@@ -347,9 +349,11 @@ onBeforeMount(() => {
line-height: 38px; line-height: 38px;
font-family: PingFangSC-Semibold, PingFang SC; font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600; font-weight: 600;
&-increment { &-increment {
color: #f37005; color: #f37005;
} }
&-decrement { &-decrement {
color: #333333; color: #333333;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<van-field :size="userData.formSize" v-model="userData.userInfo.bankName" name="bankName" maxlength="20" label="开户银行" placeholder="请输入开户银行" clearable <van-field :size="userData.formSize" v-model="userData.userInfo.bankName" name="bankName" maxlength="20" label="开户银行" placeholder="请输入开户银行" clearable
:rules="[{ required: true, message: '请输入开户银行' }, { validator: isChinese, message: '仅支持输入中文' }]" /> :rules="[{ required: true, message: '请输入开户银行' }, { validator: isChinese, message: '仅支持输入中文' }]" />
<van-field :size="userData.formSize" v-model="userData.userInfo.bankNo" name="bankNo" type="number" maxlength="20" label="银行卡号" placeholder="请输入银行卡号" clearable <van-field :size="userData.formSize" v-model="userData.userInfo.bankNo" name="bankNo" type="number" maxlength="20" label="银行卡号" placeholder="请输入银行卡号" clearable
:rules="[{ required: true, message: '请输入银行卡号' }]" /> :rules="[{ required: true, message: '请输入银行卡号' }, {validator: isNumber, message: '仅支持输入数字'}]" />
<van-field :size="userData.formSize" v-model="userData.userInfo.name" name="name" label="持卡人姓名" :disabled="true" <van-field :size="userData.formSize" v-model="userData.userInfo.name" name="name" label="持卡人姓名" :disabled="true"
placeholder="请输入持卡人姓名" /> placeholder="请输入持卡人姓名" />
<div class="form-submit"> <div class="form-submit">
...@@ -24,7 +24,7 @@ import { ref, reactive, onBeforeMount } from 'vue' ...@@ -24,7 +24,7 @@ import { ref, reactive, onBeforeMount } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import req from "../../utils/request" import req from "../../utils/request"
import { Toast, Dialog } from 'vant' import { Toast, Dialog } from 'vant'
import { isVehicleNumber, isTel, isChinese } from '../../utils/common' import { isVehicleNumber, isTel, isChinese, isNumber } from '../../utils/common'
const userData = reactive({ const userData = reactive({
formSize: 'large', formSize: 'large',
userInfo: { userInfo: {
......
...@@ -7,43 +7,20 @@ ...@@ -7,43 +7,20 @@
还没有账号,<span @click="register">立即注册</span> 还没有账号,<span @click="register">立即注册</span>
</div> </div>
<van-form class="login-form" @submit="onSubmit"> <van-form class="login-form" @submit="onSubmit">
<van-field <van-field v-model="userForm.plateNo" name="plateNo" placeholder="请输入爱车车牌" :formatter="formatter" maxlength="8"
v-model="userForm.plateNo" clearable :rules="[
name="plateNo"
placeholder="请输入爱车车牌"
:formatter="formatter"
maxlength="8"
clearable
:rules="[
{ required: true, message: '请输入爱车车牌' }, { required: true, message: '请输入爱车车牌' },
{ validator: isVehicleNumber, message: '请输入正确的车牌' }, { validator: isVehicleNumber, message: '请输入正确的车牌' },
]" ]" />
/> <van-field v-model="userForm.mobile" type="number" name="mobile" placeholder="请输入手机号码" maxlength="11" clearable
<van-field
v-model="userForm.mobile"
type="number"
name="mobile"
placeholder="请输入手机号码"
maxlength="11"
clearable
:rules="[ :rules="[
{ required: true, message: '请输入手机号码' }, { required: true, message: '请输入手机号码' },
{ validator: isTel, message: '请输入正确的手机号' }, { validator: isTel, message: '请输入正确的手机号' },
]" ]" />
/> <van-field v-model="userForm.captcha" type="number" name="captcha" maxlength="4" placeholder="请输入验证码" clearable
<van-field :rules="[{ required: true, message: '请输入验证码' }]">
v-model="userForm.captcha"
type="number"
name="captcha"
maxlength="4"
placeholder="请输入验证码"
clearable
:rules="[{ required: true, message: '请输入验证码' }]"
>
<template #button> <template #button>
<span v-if="!time" class="code" @click="getCode(userForm.mobile)" <span v-if="!time" class="code" @click="getCode(userForm.mobile)">获取验证码</span>
>获取验证码</span
>
<span class="gray-code" v-else>{{ time }}秒后重发</span> <span class="gray-code" v-else>{{ time }}秒后重发</span>
</template> </template>
</van-field> </van-field>
...@@ -86,8 +63,9 @@ watch(time, (newVal) => { ...@@ -86,8 +63,9 @@ watch(time, (newVal) => {
/** 定义的方法 */ /** 定义的方法 */
// 获取验证码 // 获取验证码
const getCode = async (value: string) => { const getCode = async (value: string) => {
time.value = 60; if (!value) return Toast('请先填写手机号')
if (timeout) clearInterval(timeout); if (timeout) clearInterval(timeout);
time.value = 60;
timeout = setInterval(() => { timeout = setInterval(() => {
time.value--; time.value--;
}, 1000); }, 1000);
...@@ -104,6 +82,8 @@ const getCode = async (value: string) => { ...@@ -104,6 +82,8 @@ const getCode = async (value: string) => {
Toast("验证码已发送"); Toast("验证码已发送");
} else { } else {
Toast(message); Toast(message);
if (timeout) clearInterval(timeout);
time.value = 0
} }
}; };
// 格式化车牌号 // 格式化车牌号
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</div> </div>
<div class="form-item"> <div class="form-item">
<van-field :size="registerData.formSize" v-model="registerData.register.bankNo" name="bankNo" type="number" maxlength="20" label="银行卡号" clearable <van-field :size="registerData.formSize" v-model="registerData.register.bankNo" name="bankNo" type="number" maxlength="20" label="银行卡号" clearable
placeholder="请输入银行卡号" :rules="[{ required: true, message: '请输入银行卡号' }]" /> placeholder="请输入银行卡号" :rules="[{ required: true, message: '请输入银行卡号' },{validator: isNumber, message: '仅支持输入数字'}]" />
</div> </div>
<div class="form-item"> <div class="form-item">
<van-field :size="registerData.formSize" v-model="registerData.register.name" name="name" label="持卡人姓名" :disabled="true" <van-field :size="registerData.formSize" v-model="registerData.register.name" name="name" label="持卡人姓名" :disabled="true"
...@@ -47,7 +47,7 @@ import { ref, reactive, watch } from 'vue' ...@@ -47,7 +47,7 @@ import { ref, reactive, watch } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import req from "../../utils/request" import req from "../../utils/request"
import { Toast } from 'vant' import { Toast } from 'vant'
import { isVehicleNumber, isTel, isChinese } from '../../utils/common' import { isVehicleNumber, isTel, isChinese, isNumber } from '../../utils/common'
// 定义的变量 // 定义的变量
const router = useRouter() const router = useRouter()
const registerData = reactive({ const registerData = reactive({
...@@ -85,6 +85,7 @@ watch(time, (newVal) => { ...@@ -85,6 +85,7 @@ watch(time, (newVal) => {
/** 定义的方法 */ /** 定义的方法 */
// 获取验证码 // 获取验证码
const getCode = async (value: string) => { const getCode = async (value: string) => {
if (!value) return Toast('请先填写手机号')
time.value = 60 time.value = 60
if (timeout) clearInterval(timeout) if (timeout) clearInterval(timeout)
timeout = setInterval(() => { timeout = setInterval(() => {
...@@ -100,6 +101,8 @@ const getCode = async (value: string) => { ...@@ -100,6 +101,8 @@ const getCode = async (value: string) => {
Toast('验证码已发送') Toast('验证码已发送')
} else { } else {
Toast(message) Toast(message)
if (timeout) clearInterval(timeout);
time.value = 0
} }
} }
// 提交注册 // 提交注册
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!