From ee998d76985146af4f78d5eabe4e31500cb35980 Mon Sep 17 00:00:00 2001
From: TM <923727421@qq.com>
Date: Tue, 15 Dec 2020 14:47:28 +0800
Subject: [PATCH] 修改bug
---
pages/hbfqPage/orderInfo/orderInfo.axml | 2
pages/businessData/businessData.axml | 4
pages/shskPage/orderInfo/orderInfo.js | 3
pages/shskPage/orderInfo/orderInfo.axml | 4
utils/validator.js | 207 +++++++++++++++++++++++++++++
pages/forgetPassword/forgetPassword.axml | 10
pages/index/index.js | 60 ++++++++
pages/businessData/businessData.js | 6
pages/forgetPassword/forgetPassword.js | 15 ++
pages/hbfqPage/orderInfo/orderInfo.js | 49 +++++-
pages/index/index.axml | 6
11 files changed, 341 insertions(+), 25 deletions(-)
diff --git a/pages/businessData/businessData.axml b/pages/businessData/businessData.axml
index 61716c0..7b48f43 100644
--- a/pages/businessData/businessData.axml
+++ b/pages/businessData/businessData.axml
@@ -4,7 +4,7 @@
<tab-content key="{{index}}" tabId="{{index}}" activeTab="{{activeTab2}}" a:if="{{index === 0}}">
<view class="tab-item">
<view class="search-box">
- <search-bar value="{{value}}" borderColor="#EDEDF2" onSubmit="searchMation" onInput="onhandInput" focus="{{false}}" maxLength="{{20}}" showCancelButton="{{false}}" placeholder="请输入用户名称" />
+ <search-bar value="{{value}}" onClear="onClear" borderColor="#EDEDF2" onSubmit="searchMation" onInput="onhandInput" focus="{{false}}" maxLength="{{20}}" showCancelButton="{{false}}" placeholder="请输入用户名称" />
<view class="filer">
<text class="iconfont iconshaixuan" style="font-size:20px"></text>
<text class="filer-tit" onTap="showFilter">筛选</text>
@@ -73,7 +73,7 @@
<tab-content key="{{index}}" tabId="{{index}}" activeTab="{{activeTab2}}" a:elif="{{index === 1}}">
<view class="tab-item">
<view class="search-box">
- <search-bar value="{{value}}" borderColor="#EDEDF2" onSubmit="searchMation" onInput="onhandInput" focus="{{false}}" maxLength="{{20}}" showCancelButton="{{false}}" placeholder="请输入用户名称" />
+ <search-bar value="{{value}}" onClear="onClear" borderColor="#EDEDF2" onSubmit="searchMation" onInput="onhandInput" focus="{{false}}" maxLength="{{20}}" showCancelButton="{{false}}" placeholder="请输入用户名称" />
<view class="filer">
<text class="iconfont iconshaixuan" style="font-size:20px"></text>
<text class="filer-tit" onTap="showFilter">筛选</text>
diff --git a/pages/businessData/businessData.js b/pages/businessData/businessData.js
index 47dec63..a1bf07c 100644
--- a/pages/businessData/businessData.js
+++ b/pages/businessData/businessData.js
@@ -69,6 +69,7 @@
url: '/sib/xcx/order/hbListInit',
queryObj: { prodType: 200015 },
value: '',
+ list: [],
isgoOut:false,
})
},
@@ -104,6 +105,11 @@
value: value
})
},
+ onClear(){
+ this.setData({
+ value:''
+ })
+ },
// 搜索框事件
searchMation(value) {
console.log(value)
diff --git a/pages/forgetPassword/forgetPassword.axml b/pages/forgetPassword/forgetPassword.axml
index e2221ad..4a4ddf8 100644
--- a/pages/forgetPassword/forgetPassword.axml
+++ b/pages/forgetPassword/forgetPassword.axml
@@ -1,13 +1,13 @@
<view>
<view class="forgetpass-view">
- <input-item type="number" labelCls="phone-label label" className="phone-ipt" maxlength="11" data-code="{{1}}" onInput="oninput" placeholder="请输入手机号" clear="{{true}}">
+ <input-item type="number" labelCls="phone-label label" className="phone-ipt" maxlength="11" data-code="{{1}}" onInput="oninput" placeholder="请输入手机号">
</input-item>
- <verify-code maxlength="4" last="{{false}}" label="{{''}}" inputCls="code-ipt" labelCls="code-label" countDown="{{60}}" initActive="{{false}}" onSend="onSend" onInput="inputVerCode" value="{{info.verCode}}">
+ <verify-code maxlength="6" last="{{false}}" a:if="{{info.mblNo && info.mblNo.length == 11}}" label="{{''}}" inputCls="code-ipt" labelCls="code-label" countDown="{{60}}" initActive="{{false}}" onSend="onSend" onInput="inputVerCode" value="{{info.verCode}}">
</verify-code>
- <input-item type="text" labelCls="password-label label" className="password-ipt" maxlength="12" data-code="{{2}}" onInput="oninput" password="{{true}}" placeholder="请输入新密码" clear="{{true}}">
+ <input-item type="text" labelCls="password-label label" className="password-ipt" maxlength="12" data-code="{{2}}" onInput="oninput" password="{{true}}" placeholder="请输入新密码">
</input-item>
- <input-item type="text" labelCls="respassword-label label" className="password-ipt" maxlength="12" data-code="{{3}}" onInput="oninput" password="{{true}}" placeholder="请再次输入密码" clear="{{true}}">
+ <input-item type="text" labelCls="respassword-label label" className="password-ipt" maxlength="12" data-code="{{3}}" onInput="oninput" password="{{true}}" placeholder="请再次输入密码">
</input-item>
</view>
- <button type="primary" onTap="save" class="login-btn" style="{{background:userStyle.gradientColor}}">提交并登录</button>
+ <button type="primary" onTap="save" class="login-btn" style="{{background:userStyle.gradientColor}}">前往登录</button>
</view>
\ No newline at end of file
diff --git a/pages/forgetPassword/forgetPassword.js b/pages/forgetPassword/forgetPassword.js
index 17c41b4..1c9b612 100644
--- a/pages/forgetPassword/forgetPassword.js
+++ b/pages/forgetPassword/forgetPassword.js
@@ -1,5 +1,6 @@
let $api = require('../../utils/ajaxFn.js')
let md5 = require('../../utils/md5.js')
+let validator = require('../../utils/validator')
Page({
data: {
userStyle:{},//用户样式
@@ -65,6 +66,13 @@
})
return
}
+ if(!validator.checkPhone(this.data.info.mblNo)){
+ my.showToast({
+ content: '请输入正确的电话号码',
+ duration: 2000
+ })
+ return
+ }
if(!this.data.info.verCode){
my.showToast({
content: '请输入验证码',
@@ -79,6 +87,13 @@
})
return
}
+ if(!validator.checkPassword(this.data.info.newPwd)){
+ my.showToast({
+ content: '密码为8-16数字字母组合',
+ duration: 2000
+ })
+ return
+ }
if(this.data.info.newPwd != this.data.newPwdTwo){
my.showToast({
content: '两次密码不一致请确认',
diff --git a/pages/hbfqPage/orderInfo/orderInfo.axml b/pages/hbfqPage/orderInfo/orderInfo.axml
index db05c98..a4cc9b8 100644
--- a/pages/hbfqPage/orderInfo/orderInfo.axml
+++ b/pages/hbfqPage/orderInfo/orderInfo.axml
@@ -4,7 +4,7 @@
</view>
<view class="fenqi-info-view">
<text class="title">分期信息</text>
- <input-item labelCls="label-class" value="{{info.amt}}" data-code="{{1}}" onInput="confirm" inputCls="ipt-class" placeholder="请输入分期本金">分期本金</input-item>
+ <input-item labelCls="label-class" value="{{info.amt}}" type="digit" data-code="{{1}}" onInput="confirm" inputCls="ipt-class" placeholder="请输入分期本金">分期本金</input-item>
<input-item labelCls="label-class" value="{{info.goodsName}}" data-code="{{2}}" onInput="confirm" inputCls="ipt-class" placeholder="请输入商品名称">商品名称</input-item>
<picker title="选择付息方式" onChange="bindObjPickerChangeProd" value="{{arrIndex}}" range="{{prodsList}}" range-key="name">
<view>
diff --git a/pages/hbfqPage/orderInfo/orderInfo.js b/pages/hbfqPage/orderInfo/orderInfo.js
index 7510ba0..662e490 100644
--- a/pages/hbfqPage/orderInfo/orderInfo.js
+++ b/pages/hbfqPage/orderInfo/orderInfo.js
@@ -11,12 +11,12 @@
verName: '',
info: {
prodId: '',
- amt:'',
- goodsName:'',
- term:'',
- zfbVersion:'',
- userName:'',
- userMblNo:''
+ amt: '',
+ goodsName: '',
+ term: '',
+ zfbVersion: '',
+ userName: '',
+ userMblNo: ''
},
amtList: [
{ name: '商家到账', number: 0 },
@@ -91,23 +91,40 @@
this.setData({
info: { ...this.data.info, ...obj }
})
+ console.log(this.data.info)
if (code == 1) {
if (!this.data.info.amt || !this.data.info.prodId || !this.data.info.term || !this.data.info.zfbVersion) {
this.setData({
isBoss: false
+ })
+ } else {
+ this.setData({
+ isBoss: true
})
}
if (this.data.isBoss) {
this.orderhbTrial()
}
}
-
},
bindObjPickerChangeProd(e) {
-
this.setData({
prodName: this.data.prodsList[e.detail.value].name,
- 'info.prodId': this.data.prodsList[e.detail.value].code
+ 'info.prodId': this.data.prodsList[e.detail.value].code,
+ 'info.term': '',
+ 'info.zfbVersion': '',
+ termName: '',
+ zfbVersionName: '',
+ amtList: [
+ { name: '商家到账', number: 0 },
+ { name: '客户还款总额', number: 0 },
+ { name: '客户月还款额', number: 0 }
+ ],
+ rateList: [
+ { name: '智享服务费率', rate: 0 },
+ { name: '花呗利率', rate: 0 },
+ { name: '支付利率', rate: 0 }
+ ]
})
this.getList({ prodId: this.data.info.prodId })
console.log(this.data.info.amt, this.data.info.prodId, this.data.info.term, this.data.info.zfbVersion)
@@ -146,7 +163,19 @@
bindObjPickerChangeVer(e) {
this.setData({
zfbVersionName: this.data.zfbVersionsList[e.detail.value].name,
- 'info.zfbVersion': this.data.zfbVersionsList[e.detail.value].code
+ 'info.zfbVersion': this.data.zfbVersionsList[e.detail.value].code,
+ 'info.term': '',
+ termName: '',
+ amtList: [
+ { name: '商家到账', number: 0 },
+ { name: '客户还款总额', number: 0 },
+ { name: '客户月还款额', number: 0 }
+ ],
+ rateList: [
+ { name: '智享服务费率', rate: 0 },
+ { name: '花呗利率', rate: 0 },
+ { name: '支付利率', rate: 0 }
+ ]
})
console.log(this.data.info.amt, this.data.info.prodId, this.data.info.term, this.data.info.zfbVersion)
this.getList({ prodId: this.data.info.prodId, zfbVersion: this.data.info.zfbVersion })
diff --git a/pages/index/index.axml b/pages/index/index.axml
index 1cb2249..a4426a0 100644
--- a/pages/index/index.axml
+++ b/pages/index/index.axml
@@ -5,11 +5,11 @@
<text class="modeText">{{modeText}}</text>
</view>
<view class="login-info-view">
- <input-item type="number" onInput="setUserNo" value="{{userNo}}" labelCls="phone-label" className="phone-ipt" maxlength="11" placeholder="请输入手机号" clear="{{true}}">
+ <input-item type="number" onInput="setUserNo" value="{{userNo}}" labelCls="phone-label" className="phone-ipt" maxlength="11" placeholder="请输入手机号" clear="{{false}}">
</input-item>
- <input-item a:if="{{!showCode}}" onInput="setPassword" value="{{password}}" type="text" labelCls="password-label" className="password-ipt" maxlength="12" password="{{true}}" placeholder="请输入密码" clear="{{true}}">
+ <input-item a:if="{{!showCode}}" onInput="setPassword" value="{{password}}" type="text" labelCls="password-label" className="password-ipt" maxlength="12" password="{{true}}" placeholder="请输入密码" clear="{{false}}">
</input-item>
- <verify-code a:if="{{showCode}}" label="{{''}}" inputCls="code-ipt" labelCls="code-label" maxlength="4" countDown="{{60}}" initActive="{{false}}" onSend="onSend" onInput="inputVerCode" value="{{verCode}}">
+ <verify-code a:if="{{showCode && userNo && userNo.length == 11}}" label="{{''}}" inputCls="code-ipt" labelCls="code-label" maxlength="4" countDown="{{60}}" initActive="{{false}}" onSend="onSend" onInput="inputVerCode" value="{{verCode}}">
</verify-code>
</view>
<button type="primary" class="login-btn" style="{{background:userStyle.gradientColor}}" onTap="login">登录</button>
diff --git a/pages/index/index.js b/pages/index/index.js
index 108106d..a922582 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -1,8 +1,10 @@
let md5 = require('../../utils/md5.js');
let $api = require('../../utils/ajaxFn.js');
+let validator = require('../../utils/validator.js')
const app = getApp()
Page({
data: {
+ txt:'请输入手机号',
password:'',
userNo:'',
verCode:'',
@@ -68,11 +70,53 @@
obj.password = md5.hex_md5(this.data.userNo+this.data.password)
obj.userNo = this.data.userNo
obj.zfbUserId = app.userId
+ if(!obj.userNo){
+ my.showToast({
+ content:'请输入手机号',
+ duration:2000
+ });
+ return
+ }
+ if(!validator.checkPhone(obj.userNo)){
+ my.showToast({
+ content:'请输入正确手机号',
+ duration:2000
+ });
+ return
+ }
+ if(!this.data.password){
+ my.showToast({
+ content:'请输入密码',
+ duration:2000
+ });
+ return
+ }
}else{
url = '/sib/xcx/login/loginByCode'
obj.mblNo = this.data.userNo
obj.verCode = this.data.verCode
obj.zfbUserId = app.userId
+ if(!obj.mblNo){
+ my.showToast({
+ content:'请输入手机号',
+ duration:3000
+ });
+ return
+ }
+ if(!validator.checkPhone(obj.mblNo)){
+ my.showToast({
+ content:'请输入正确手机号',
+ duration:2000
+ });
+ return
+ }
+ if(!obj.verCode){
+ my.showToast({
+ content:'请输入验证码',
+ duration:2000
+ });
+ return
+ }
}
$api.ajax(
url,
@@ -126,6 +170,15 @@
this.setData({
userNo:e.detail.value
})
+ if(this.data.userNo&&this.data.userNo.length == 11){
+ this.setData({
+ txt:'获取验证码'
+ })
+ }else{
+ this.setData({
+ txt:'请输入手机号'
+ })
+ }
},
setPassword(e){
this.setData({
@@ -146,6 +199,13 @@
});
return
}
+ // if(!validator.checkPhone(this.data.userNo)){
+ // my.showToast({
+ // content:'请输入正确手机号',
+ // duration:2000
+ // });
+ // return
+ // }
$api.ajax(
'/sib/user/sendMsg',
'POST',
diff --git a/pages/shskPage/orderInfo/orderInfo.axml b/pages/shskPage/orderInfo/orderInfo.axml
index 3c9b1f2..ef912d3 100644
--- a/pages/shskPage/orderInfo/orderInfo.axml
+++ b/pages/shskPage/orderInfo/orderInfo.axml
@@ -4,8 +4,8 @@
</view>
<view class="fenqi-info-view">
<text class="title">分期信息</text>
- <input-item labelCls="label-class" onInput="confirm" data-code="{{1}}" type="number" inputCls="ipt-class" placeholder="请输入商品金额">商品金额</input-item>
- <input-item labelCls="label-class" onInput="confirm" data-code="{{2}}" last="{{true}}" inputCls="ipt-class" placeholder="请输入商品名称">商品名称</input-item>
+ <input-item labelCls="label-class" onInput="confirm" data-code="{{1}}" last="{{true}}" type="digit" inputCls="ipt-class" placeholder="请输入商品金额">商品金额</input-item>
+ <!-- <input-item labelCls="label-class" onInput="confirm" data-code="{{2}}" last="{{true}}" inputCls="ipt-class" placeholder="请输入商品名称">商品名称</input-item> -->
</view>
<!-- <view class="user-info-view">
<text class="title">用户信息</text>
diff --git a/pages/shskPage/orderInfo/orderInfo.js b/pages/shskPage/orderInfo/orderInfo.js
index a69e142..67da88b 100644
--- a/pages/shskPage/orderInfo/orderInfo.js
+++ b/pages/shskPage/orderInfo/orderInfo.js
@@ -3,8 +3,7 @@
data: {
userStyle: {},
info: {
- payAmt: '',
- goodsName:''
+ payAmt: ''
},
amtList: [
{ name: '商家到账', number: 0 },
diff --git a/utils/validator.js b/utils/validator.js
new file mode 100644
index 0000000..8db1577
--- /dev/null
+++ b/utils/validator.js
@@ -0,0 +1,207 @@
+/**
+ * TANGIMING 2018-3-9
+ * 这是一个用于存放正则表达式和一些验证方法的插件
+ * 除了存放了目前常用的正则之外,还根据这些正则封装了对应的验证方法
+ */
+
+export default {
+ // 金额格式化
+ formatMoney(str = 0) {
+ str = str + '';
+ let newStr = '';
+ let count = 0;
+ if (str.indexOf('.') === -1) {
+ for (let i = str.length - 1; i >= 0; i--) {
+ if (count % 3 === 0 && count !== 0) {
+ newStr = str.charAt(i) + ',' + newStr;
+ } else {
+ newStr = str.charAt(i) + newStr;
+ }
+ count++;
+ }
+ str = newStr + '.00'; // 自动补小数点后两位
+ return str;
+ } else {
+ for (let i = str.indexOf('.') - 1; i >= 0; i--) {
+ if (count % 3 === 0 && count !== 0) {
+ newStr = str.charAt(i) + ',' + newStr;
+ } else {
+ newStr = str.charAt(i) + newStr; // 逐个字符相接起来
+ }
+ count++;
+ }
+ str = newStr + (str + '00').substr((str + '00').indexOf('.'), 3);
+ return str;
+ }
+ },
+ // 身份证 中间用* 显示
+ cardIDHide(cardid) {
+ if (cardid) {
+ return cardid.replace(/^(.{6})(?:\d+)(.{4})$/, '$1****$2');
+ } else {
+ return '';
+ }
+ },
+ //手机号,中间四位*显示
+ formatPhone(phone) {
+ return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
+ },
+ // 电话号码格式
+ checkPhone(phone) {
+ let reg = /^1([35789][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/;
+ return reg.test(phone);
+ },
+ checkEmail(email) {
+ // 验证邮箱格式
+ let reg = /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/;
+ // let reg = /^[a-z\d]+(\.[a-z\d]+)*@([\da-z](-[\da-z])?)+(\.{1,2}[a-z]+)+$/;
+ return reg.test(email);
+ },
+ checkVerifyCode(code) {
+ // 验证验证码格式
+ let reg = /^\d{6}$/;
+ return reg.test(code);
+ },
+ checkDynamicCode(code) {
+ // 验证邀请码格式
+ let reg = /^[A-Za-z0-9]{4}$/;
+ return reg.test(code);
+ },
+ // password check
+ checkPassword(password) {
+ // 验证密码格式
+ let reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/;
+ return reg.test(password);
+ },
+ // name check
+ checkName(name) {
+ // 验证用户名格式
+ let reg = /^[\u4E00-\u9FA5]{2,10}$/;
+ return reg.test(name);
+ },
+ // 账户名称的正则表达式
+ checkUsername(name) {
+ let reg = /^[\u4e00-\u9fa50-9a-zA-Z]{4,16}$/;
+ return reg.test(name);
+ },
+ // 统一验证
+ checkCommonField(name) {
+ let reg = /^[\u4e00-\u9fa50-9a-zA-Z]{4,30}$/;
+ return reg.test(name);
+ },
+ isIdcard(val) {
+ let result = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(val);
+ return result;
+ },
+ checkValEmpty(str) {
+ // 验证是否为空
+ if (
+ str === undefined ||
+ str === null ||
+ str.length <= 0 ||
+ str === 'undefined'
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ // 验证佣金输入金额
+ checkCommission(commission) {
+ // 小于100且后面可以带4个小数点
+ let reg = /^100$|^(\d|[1-9]\d)(\.\d{1,4})*$/;
+ //一亿以内,保留四位小数
+ // /^([1-9]\d{0,7}|0)(\.\d{1,4})?$/
+ // 如果通过的话,那么判断小数点的前几位数字
+ return reg.test(commission);
+ },
+ // 验证渠道编号是否符合规则--4-8位以内数字+字母,区分大小写
+ checkChannelNo(channelNo) {
+ let reg = /^[\w\d]{4,8}$/;
+ return reg.test(channelNo);
+ },
+ //验证是否包含空格
+ checkSpace(val) {
+ let reg = /^\s+$/;
+ if (reg.test(val)) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ //将发送请求中的参数格式化,如果为空则转为null
+ formatReq(obj) {
+ for (let i in obj) {
+ let item = obj[i];
+ if (item === null) continue;
+ if (
+ item === undefined ||
+ item === '' ||
+ item === 'undefined' ||
+ item.length <= 0 ||
+ JSON.stringify(item) == '{}'
+ ) {
+ obj[i] = null;
+ }
+ }
+ return obj;
+ },
+ // 只能输入数字与小数点正则判断
+ checkIntegerAndDot(checkVal) {
+ let dotReg = /\./g;
+ let IntegerReg = /^[1-9]{1}\d{0,5}$/;
+ // 如果输入了多个点,直接不符合要求
+ if (checkVal.match(dotReg) && checkVal.match(dotReg).length > 1) {
+ return false;
+ // 输入了一个点
+ } else if (
+ checkVal.match(dotReg) &&
+ checkVal.match(dotReg).length === 1
+ ) {
+ // 开头与结尾都不能出现点,点的前面与后面必须是数字
+ let strLen = checkVal.length;
+ if (
+ checkVal.indexOf('.') === 0 ||
+ checkVal.indexOf('.') === strLen - 1
+ ) {
+ return false;
+ // 超过个数的限制的话
+ } else {
+ return strLen <= 6;
+ }
+ // 没有小数点的话,那么就是全部数字进行匹配
+ } else if (!checkVal.match(dotReg)) {
+ return IntegerReg.test(checkVal);
+ }
+ },
+ //银行卡验证
+ bankCard(iccid) {
+ let initCard = iccid;
+ var s1 = 0,
+ s2 = 0;
+ iccid = iccid.substring(0, iccid.length - 1);
+ var reverse = '';
+ for (var i = iccid.length; i > 0; i--) {
+ reverse += iccid.charAt(i - 1);
+ }
+ for (i = 0; i < reverse.length; i++) {
+ var digit = parseInt(reverse.charAt(i), 10);
+ if (i % 2 != 0) {
+ // this is for odd digits, they are 1-indexed in the
+ // algorithm
+ s1 += digit;
+ } else {
+ // add 2 * digit for 0-4, add 2 * digit - 9 for 5-9
+ s2 += 2 * digit;
+ if (digit >= 5) {
+ s2 -= 9;
+ }
+ }
+ }
+ var sum = 10 - ((s1 + s2) % 10);
+ if (sum === 10) {
+ sum = 0;
+ }
+ return iccid + sum == initCard;
+ }
+};
--
Gitblit v1.8.0