Commit dfe48e18 by 胡悦

修复bug

1 parent 5bc982a5
......@@ -20,6 +20,7 @@
"sha1": "^1.1.1",
"tslib": "^2.4.0",
"vant": "^3.5.3",
"vconsole": "^3.7.0",
"vue": "^3.2.25",
"vue-router": "^4.1.1",
"vuex": "^4.0.2"
......
......@@ -6,9 +6,10 @@ import App from './App.vue'
import SvgIcon from 'comps/SvgIcon/index.vue'
import 'lib-flexible/flexible'
import 'utils/rem'
// import "vant/lib/index.css"
import VConsole from 'vconsole'
import 'assets/styles/common.scss'
const app = createApp(App)
const vConsole = new VConsole()
import { components } from './libs/vant'
components.forEach(component => app.use(component));
app.component('svg-icon', SvgIcon)
......@@ -20,4 +21,3 @@ setupRouter(app)
router.isReady().then(() => {
app.mount('#app')
})
// createApp(App).component('svg-icon', SvgIcon).mount('#app')
......@@ -13,7 +13,6 @@ const router = createRouter({
})
router.beforeEach((to, from, next) => {
console.log(to)
document.title = to.meta.title || ''
/* 路由发生变化修改页面title */
// let title = util.getLocalStorage('wx_scrm_page_title') || ' '
......
......@@ -2,8 +2,8 @@
const isVehicleNumber = (vehicleNumber: string) => {
let result = false;
// if (vehicleNumber.length == 8) {
const express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[警京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{0,1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
result = express.test(vehicleNumber);
const reg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[警京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{0,1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
result = reg.test(vehicleNumber);
// }
return result;
}
......@@ -24,8 +24,17 @@ const isChinese = (text: string) => {
return result
}
// 数字校验
const isNumber = (n: string) => {
let result = false
const reg = /^[0-9]*$/
result = reg.test(n)
return result
}
export {
isVehicleNumber,
isTel,
isChinese
isChinese,
isNumber
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<div class="wrapper-content">
<div class="wrapper-integral">
<span>可用积分</span>
<span class="integral">{{data.integral}}</span>
<span class="integral">{{ data.integral }}</span>
<img class="coin-img" src="@/assets/images/coin.png" alt="" />
</div>
<div class="wrapper-userinfo">
......@@ -13,17 +13,15 @@
<div class="userinfo">
<div class="user-top">
<span class="username">{{ data.userInfo.name }}</span>
<img
v-if="data.userInfo.authStatus == 1"
class="auth"
src="@/assets/images/auth.png"
alt=""
/>
<!-- <img v-if="data.userInfo.authStatus == 1" class="auth" src="@/assets/images/auth.png" alt="" /> -->
<div class="auth-status" :class="data.userInfo.authStatus == 1 ? 'certified':'no-certified'">
<img v-if="data.userInfo.authStatus == 1" src="@/assets/images/certified.png" alt="">
<img v-else src="@/assets/images/no-certified.png" alt="">
<span :class="data.userInfo.authStatus == 1 ? 'certified-color':''">{{data.userInfo.authStatus == 1?'已':'未'}}认证</span>
</div>
</div>
<div>
<span class="user-mobile"
>{{ data.userInfo.mobile }}丨{{ data.userInfo.plateNo }}</span
>
<span class="user-mobile">{{ data.userInfo.mobile }}丨{{ data.userInfo.plateNo }}</span>
</div>
</div>
<div class="logout" @click="logout">退出登录</div>
......@@ -44,18 +42,9 @@
<div class="history-list-top">
<img class="top-img" src="@/assets/images/list-info.png" alt="" />
</div>
<div
class="van-list-box"
:style="{ height: data.innerHeight - (280 + 10 + 28 + 68) + 'px' }"
>
<van-list
finished-text="- 没有更多啦 -"
loading-text="加载中..."
v-model:loading="loading"
:finished="finished"
@load="onLoad"
:immediate-check="false"
>
<div class="van-list-box" :style="{ height: data.innerHeight - (280 + 10 + 28 + 68) + 'px' }">
<van-list finished-text="- 没有更多啦 -" loading-text="加载中..." v-model:loading="loading" :finished="finished"
@load="onLoad" :immediate-check="false">
<!-- 没有历史数据 -->
<template v-if="!list.length">
<div class="nodata">
......@@ -67,22 +56,16 @@
<template v-for="item in list" :key="item.id">
<div class="list-content">
<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">
{{ item.createdDate }}
</div>
</div>
<div class="list-content-right">
<div
v-if="item.recordType == 1"
class="list-content-right-increment"
>
<div v-if="item.recordType == 1" class="list-content-right-increment">
+{{ item.amount }}
</div>
<div
v-if="item.recordType == 2"
class="list-content-right-decrement"
>
<div v-if="item.recordType == 2" class="list-content-right-decrement">
-{{ item.amount }}
</div>
</div>
......@@ -131,7 +114,8 @@ const router = useRouter();
const data: {
innerHeight: number;
userInfo: UserInfo;
integral: number
integral: number,
recordStatus: any
} = reactive({
innerHeight: window.innerHeight, // 获取可视区高度
userInfo: {
......@@ -140,7 +124,11 @@ const data: {
plateNo: "",
authStatus: 0
},
integral: 0
integral: 0,
recordStatus: {
1: '系统赠送',
2: '积分兑换'
}
});
// 积分历史明细列表
const list = reactive<listStyle>([]);
......@@ -177,7 +165,7 @@ const getUserInfo = async () => {
};
// 查询可用积分
const getIntegral = async() => {
const getIntegral = async () => {
const res = await req('scrm.api.renewal.h5.integral.get')
console.log(res.amount, '-------')
data.integral = res.amount
......@@ -235,6 +223,7 @@ onBeforeMount(() => {
.van-list {
flex-direction: column;
}
.wrapper {
.login {
height: 291px;
......@@ -278,8 +267,7 @@ onBeforeMount(() => {
z-index: -1;
}
&-content {
}
&-content {}
&-history-list {
background-color: #fff;
......@@ -351,9 +339,11 @@ onBeforeMount(() => {
line-height: 38px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
&-increment {
color: #f37005;
}
&-decrement {
color: #333333;
}
......@@ -417,12 +407,9 @@ onBeforeMount(() => {
padding: 3px 5px 2px 14px;
background: linear-gradient(180deg, #ffffff 0%, #e2e2e2 100%);
border-radius: 12px 0px 0px 12px;
border-image: linear-gradient(
180deg,
border-image: linear-gradient(180deg,
rgba(247, 247, 247, 1),
rgba(209, 209, 209, 1)
)
1 1;
rgba(209, 209, 209, 1)) 1 1;
font-weight: 400;
color: #868686;
line-height: 17px;
......@@ -441,6 +428,35 @@ onBeforeMount(() => {
font-weight: 500;
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 {
font-size: 14px;
}
......@@ -454,7 +470,7 @@ onBeforeMount(() => {
display: flex;
justify-content: space-around;
font-size: 14px;
&-content {
width: 50%;
text-align: center;
......
......@@ -9,7 +9,7 @@
<van-field :size="userData.formSize" v-model="userData.userInfo.bankName" name="bankName" maxlength="20" label="开户银行" placeholder="请输入开户银行" clearable
: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
: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"
placeholder="请输入持卡人姓名" />
<div class="form-submit">
......@@ -24,7 +24,7 @@ import { ref, reactive, onBeforeMount } from 'vue'
import { useRouter } from 'vue-router'
import req from "../../utils/request"
import { Toast, Dialog } from 'vant'
import { isVehicleNumber, isTel, isChinese } from '../../utils/common'
import { isVehicleNumber, isTel, isChinese, isNumber } from '../../utils/common'
const userData = reactive({
formSize: 'large',
userInfo: {
......
......@@ -7,43 +7,20 @@
还没有账号,<span @click="register">立即注册</span>
</div>
<van-form class="login-form" @submit="onSubmit">
<van-field
v-model="userForm.plateNo"
name="plateNo"
placeholder="请输入爱车车牌"
:formatter="formatter"
maxlength="8"
clearable
:rules="[
<van-field v-model="userForm.plateNo" name="plateNo" placeholder="请输入爱车车牌" :formatter="formatter" maxlength="8"
clearable :rules="[
{ required: true, 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="[
{ required: true, message: '请输入手机号码' },
{ validator: isTel, message: '请输入正确的手机号' },
]"
/>
<van-field
v-model="userForm.captcha"
type="number"
name="captcha"
maxlength="4"
placeholder="请输入验证码"
clearable
:rules="[{ required: true, message: '请输入验证码' }]"
>
]" />
<van-field v-model="userForm.captcha" type="number" name="captcha" maxlength="4" placeholder="请输入验证码" clearable
:rules="[{ required: true, message: '请输入验证码' }]">
<template #button>
<span v-if="!time" class="code" @click="getCode(userForm.mobile)"
>获取验证码</span
>
<span v-if="!time" class="code" @click="getCode(userForm.mobile)">获取验证码</span>
<span class="gray-code" v-else>{{ time }}秒后重发</span>
</template>
</van-field>
......@@ -86,8 +63,9 @@ watch(time, (newVal) => {
/** 定义的方法 */
// 获取验证码
const getCode = async (value: string) => {
time.value = 60;
if (!value) return Toast('请先填写手机号')
if (timeout) clearInterval(timeout);
time.value = 60;
timeout = setInterval(() => {
time.value--;
}, 1000);
......@@ -104,6 +82,8 @@ const getCode = async (value: string) => {
Toast("验证码已发送");
} else {
Toast(message);
if (timeout) clearInterval(timeout);
time.value = 0
}
};
// 格式化车牌号
......
......@@ -28,7 +28,7 @@
</div>
<div class="form-item">
<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 class="form-item">
<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'
import { useRouter } from 'vue-router'
import req from "../../utils/request"
import { Toast } from 'vant'
import { isVehicleNumber, isTel, isChinese } from '../../utils/common'
import { isVehicleNumber, isTel, isChinese, isNumber } from '../../utils/common'
// 定义的变量
const router = useRouter()
const registerData = reactive({
......@@ -85,6 +85,7 @@ watch(time, (newVal) => {
/** 定义的方法 */
// 获取验证码
const getCode = async (value: string) => {
if (!value) return Toast('请先填写手机号')
time.value = 60
if (timeout) clearInterval(timeout)
timeout = setInterval(() => {
......@@ -100,6 +101,8 @@ const getCode = async (value: string) => {
Toast('验证码已发送')
} else {
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!