Commit dfe48e18 by 胡悦

修复bug

1 parent 5bc982a5
...@@ -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
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="wrapper-content"> <div class="wrapper-content">
<div class="wrapper-integral"> <div class="wrapper-integral">
<span>可用积分</span> <span>可用积分</span>
<span class="integral">{{data.integral}}</span> <span class="integral">{{ data.integral }}</span>
<img class="coin-img" src="@/assets/images/coin.png" alt="" /> <img class="coin-img" src="@/assets/images/coin.png" alt="" />
</div> </div>
<div class="wrapper-userinfo"> <div class="wrapper-userinfo">
...@@ -13,17 +13,15 @@ ...@@ -13,17 +13,15 @@
<div class="userinfo"> <div class="userinfo">
<div class="user-top"> <div class="user-top">
<span class="username">{{ data.userInfo.name }}</span> <span class="username">{{ data.userInfo.name }}</span>
<img <!-- <img v-if="data.userInfo.authStatus == 1" class="auth" src="@/assets/images/auth.png" alt="" /> -->
v-if="data.userInfo.authStatus == 1" <div class="auth-status" :class="data.userInfo.authStatus == 1 ? 'certified':'no-certified'">
class="auth" <img v-if="data.userInfo.authStatus == 1" src="@/assets/images/certified.png" alt="">
src="@/assets/images/auth.png" <img v-else src="@/assets/images/no-certified.png" alt="">
alt="" <span :class="data.userInfo.authStatus == 1 ? 'certified-color':''">{{data.userInfo.authStatus == 1?'已':'未'}}认证</span>
/> </div>
</div> </div>
<div> <div>
<span class="user-mobile" <span class="user-mobile">{{ data.userInfo.mobile }}丨{{ data.userInfo.plateNo }}</span>
>{{ data.userInfo.mobile }}丨{{ data.userInfo.plateNo }}</span
>
</div> </div>
</div> </div>
<div class="logout" @click="logout">退出登录</div> <div class="logout" @click="logout">退出登录</div>
...@@ -44,18 +42,9 @@ ...@@ -44,18 +42,9 @@
<div class="history-list-top"> <div class="history-list-top">
<img class="top-img" src="@/assets/images/list-info.png" alt="" /> <img class="top-img" src="@/assets/images/list-info.png" alt="" />
</div> </div>
<div <div class="van-list-box" :style="{ height: data.innerHeight - (280 + 10 + 28 + 68) + 'px' }">
class="van-list-box" <van-list finished-text="- 没有更多啦 -" loading-text="加载中..." v-model:loading="loading" :finished="finished"
:style="{ height: data.innerHeight - (280 + 10 + 28 + 68) + 'px' }" @load="onLoad" :immediate-check="false">
>
<van-list
finished-text="- 没有更多啦 -"
loading-text="加载中..."
v-model:loading="loading"
:finished="finished"
@load="onLoad"
:immediate-check="false"
>
<!-- 没有历史数据 --> <!-- 没有历史数据 -->
<template v-if="!list.length"> <template v-if="!list.length">
<div class="nodata"> <div class="nodata">
...@@ -67,22 +56,16 @@ ...@@ -67,22 +56,16 @@
<template v-for="item in list" :key="item.id"> <template v-for="item in list" :key="item.id">
<div class="list-content"> <div class="list-content">
<div class="list-content-left"> <div class="list-content-left">
<div class="list-content-left-top">{{ item.name }}</div> <div class="list-content-left-top">{{ data.recordStatus[item.recordType] }}</div>
<div class="list-content-left-bottom"> <div class="list-content-left-bottom">
{{ item.createdDate }} {{ item.createdDate }}
</div> </div>
</div> </div>
<div class="list-content-right"> <div class="list-content-right">
<div <div v-if="item.recordType == 1" class="list-content-right-increment">
v-if="item.recordType == 1"
class="list-content-right-increment"
>
+{{ item.amount }} +{{ item.amount }}
</div> </div>
<div <div v-if="item.recordType == 2" class="list-content-right-decrement">
v-if="item.recordType == 2"
class="list-content-right-decrement"
>
-{{ item.amount }} -{{ item.amount }}
</div> </div>
</div> </div>
...@@ -131,7 +114,8 @@ const router = useRouter(); ...@@ -131,7 +114,8 @@ const router = useRouter();
const data: { const data: {
innerHeight: number; innerHeight: number;
userInfo: UserInfo; userInfo: UserInfo;
integral: number integral: number,
recordStatus: any
} = reactive({ } = reactive({
innerHeight: window.innerHeight, // 获取可视区高度 innerHeight: window.innerHeight, // 获取可视区高度
userInfo: { userInfo: {
...@@ -140,7 +124,11 @@ const data: { ...@@ -140,7 +124,11 @@ const data: {
plateNo: "", plateNo: "",
authStatus: 0 authStatus: 0
}, },
integral: 0 integral: 0,
recordStatus: {
1: '系统赠送',
2: '积分兑换'
}
}); });
// 积分历史明细列表 // 积分历史明细列表
const list = reactive<listStyle>([]); const list = reactive<listStyle>([]);
...@@ -177,7 +165,7 @@ const getUserInfo = async () => { ...@@ -177,7 +165,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, '-------') console.log(res.amount, '-------')
data.integral = res.amount data.integral = res.amount
...@@ -235,6 +223,7 @@ onBeforeMount(() => { ...@@ -235,6 +223,7 @@ onBeforeMount(() => {
.van-list { .van-list {
flex-direction: column; flex-direction: column;
} }
.wrapper { .wrapper {
.login { .login {
height: 291px; height: 291px;
...@@ -278,8 +267,7 @@ onBeforeMount(() => { ...@@ -278,8 +267,7 @@ onBeforeMount(() => {
z-index: -1; z-index: -1;
} }
&-content { &-content {}
}
&-history-list { &-history-list {
background-color: #fff; background-color: #fff;
...@@ -351,9 +339,11 @@ onBeforeMount(() => { ...@@ -351,9 +339,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;
} }
...@@ -417,12 +407,9 @@ onBeforeMount(() => { ...@@ -417,12 +407,9 @@ onBeforeMount(() => {
padding: 3px 5px 2px 14px; padding: 3px 5px 2px 14px;
background: linear-gradient(180deg, #ffffff 0%, #e2e2e2 100%); background: linear-gradient(180deg, #ffffff 0%, #e2e2e2 100%);
border-radius: 12px 0px 0px 12px; border-radius: 12px 0px 0px 12px;
border-image: linear-gradient( border-image: linear-gradient(180deg,
180deg,
rgba(247, 247, 247, 1), rgba(247, 247, 247, 1),
rgba(209, 209, 209, 1) rgba(209, 209, 209, 1)) 1 1;
)
1 1;
font-weight: 400; font-weight: 400;
color: #868686; color: #868686;
line-height: 17px; line-height: 17px;
...@@ -441,6 +428,35 @@ onBeforeMount(() => { ...@@ -441,6 +428,35 @@ onBeforeMount(() => {
font-weight: 500; font-weight: 500;
margin-right: 4px; margin-right: 4px;
} }
.auth-status {
display: inline-flex;
align-items: center;
padding: 0 5px;
// width: 48px;
height: 16px;
border-radius: 8px;
color: #868686;
img {
width: 12px;
height: 12px;
margin-right: 1px;
}
span {
font-size: 8px;
line-height: 12px;
}
.certified-color {
color: #F7712B;
}
}
.no-certified {
background-color: #F2F2F2;
}
.certified {
background-color: #FFEBE0;
}
.user-mobile { .user-mobile {
font-size: 14px; font-size: 14px;
} }
...@@ -454,7 +470,7 @@ onBeforeMount(() => { ...@@ -454,7 +470,7 @@ onBeforeMount(() => {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
font-size: 14px; font-size: 14px;
&-content { &-content {
width: 50%; width: 50%;
text-align: center; text-align: center;
......
...@@ -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!