Commit 25087038 by 严立

1.增加登录验证码

2.增加输入屏蔽脚本攻击
3.调整支付方式
parent 953814e5
...@@ -78,6 +78,11 @@ let output = { ...@@ -78,6 +78,11 @@ let output = {
return { state: true, response: funcResultData.data} return { state: true, response: funcResultData.data}
break break
// 请求正常直接返回 data 内容
case 400:
return { state: false, response: { message: funcResultData.msg, data: funcResultData.data }}
break
// 请求异常返回 msg 错误提示 // 请求异常返回 msg 错误提示
default: default:
return { state: false, response: { message: funcResultData.msg }} return { state: false, response: { message: funcResultData.msg }}
......
...@@ -66,8 +66,6 @@ let output = { ...@@ -66,8 +66,6 @@ let output = {
} }
} }
} }
}).catch((funcError) => {
console.log('catch', funcError)
}) })
return funcPromise return funcPromise
} }
...@@ -95,7 +93,9 @@ let output = { ...@@ -95,7 +93,9 @@ let output = {
if (funcInterceptorsResponse.state) { if (funcInterceptorsResponse.state) {
funcResolve(funcInterceptorsResponse.response) funcResolve(funcInterceptorsResponse.response)
} else { } else {
console.log('funcReject')
iVue.$message.error(funcInterceptorsResponse.response.message) iVue.$message.error(funcInterceptorsResponse.response.message)
funcReject(funcInterceptorsResponse.response)
} }
} else { } else {
let funcInterceptorsResponse = iInterceptors.response(funcConfigure, funcXMLHttpRequest.responseText) let funcInterceptorsResponse = iInterceptors.response(funcConfigure, funcXMLHttpRequest.responseText)
...@@ -106,8 +106,6 @@ let output = { ...@@ -106,8 +106,6 @@ let output = {
} }
} }
} }
}).catch((funcError) => {
console.log('catch', funcError)
}) })
return funcPromise return funcPromise
} }
......
...@@ -114,13 +114,17 @@ ...@@ -114,13 +114,17 @@
</div> </div>
<el-dialog title="请选择支付方式" :visible.sync="winDialog" :lock-scroll="false" width="600px" :close-on-click-modal="false" @close="onCloseDialog()"> <el-dialog title="请选择支付方式" :visible.sync="winDialog" :lock-scroll="false" width="600px" :close-on-click-modal="false" @close="onCloseDialog()">
<div class="pay row con-b align-s"> <div class="pay row con-c align-s">
<el-radio v-model="payway" class="pay-way row align-c" :class="payway === '1' ? 'pay-way-active' : ''" label="1" @change="onChangeRadio"> <!-- <el-radio v-model="payway" class="pay-way row align-c" :class="payway === '1' ? 'pay-way-active' : ''" label="1" @change="onChangeRadio">
<img src="../../assets/pay00.png" alt=""> <img src="../../assets/pay00.png" alt="">
</el-radio> </el-radio>
<el-radio v-model="payway" class="pay-way row align-c" :class="payway === '2' ? 'pay-way-active' : ''" label="0" @change="onChangeRadio"> <el-radio v-model="payway" class="pay-way row align-c" :class="payway === '2' ? 'pay-way-active' : ''" label="0" @change="onChangeRadio">
<img src="../../assets/pay01.png" alt=""> <img src="../../assets/pay01.png" alt="">
</el-radio> </el-radio> -->
<div class="pay-way row align-c">
<img src="../../assets/pay01.png" alt="">
</div>
</div> </div>
<div class="pay-code row con-c"> <div class="pay-code row con-c">
<img :src="'data:image/png;base64,' + payCode[Number(payway)]" alt=""> <img :src="'data:image/png;base64,' + payCode[Number(payway)]" alt="">
...@@ -160,7 +164,7 @@ ...@@ -160,7 +164,7 @@
background: '#F2F2F2' background: '#F2F2F2'
}, },
payway: '1', // 0 - 支付宝, 1 - 微信 payway: '0', // 0 - 支付宝, 1 - 微信
payId: [], payId: [],
payCode: [], payCode: [],
payNumber: [], // 订单号 payNumber: [], // 订单号
...@@ -375,7 +379,7 @@ ...@@ -375,7 +379,7 @@
.pay { .pay {
.pay-way { .pay-way {
margin: 0 10px 20px 10px; margin: 0 10px 20px 10px;
padding: 0 0 0 20px; // padding: 0 0 0 20px;
border: 1px #e5e5e5 solid; border: 1px #e5e5e5 solid;
} }
.pay-way-active { .pay-way-active {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div> <div>
<el-form ref="form" :model="form" :rules="rule" label-width="180px"> <el-form ref="form" :model="form" :rules="rule" label-width="180px">
<el-form-item label="您遇到的问题或建议:" prop="question"> <el-form-item label="您遇到的问题或建议:" prop="question">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 10 }" maxlength="1000" show-word-limit v-model="form.question"></el-input> <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 10 }" maxlength="1000" show-word-limit v-model="form.question"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="怎么称呼您:" prop="name"> <el-form-item label="怎么称呼您:" prop="name">
<el-input v-model="form.name" maxlength="20"></el-input> <el-input v-model="form.name" maxlength="20"></el-input>
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
<el-form-item label="怎么联系您:" prop="contact"> <el-form-item label="怎么联系您:" prop="contact">
<el-input v-model="form.contact" maxlength="50"></el-input> <el-input v-model="form.contact" maxlength="50"></el-input>
</el-form-item> </el-form-item>
<el-form-item class="form-item-code" prop="code" label="验证码:">
<el-input v-model="form.code" maxlength="4" placeholder="请输入验证码"></el-input>
<button @click.prevent="onImageCode"><img :src="imageCodeData" alt=""></button>
</el-form-item>
<el-form-item class="row con-c"> <el-form-item class="row con-c">
<el-button class="dialog-button" type="primary" @click="onSubmit()">提交</el-button> <el-button class="dialog-button" type="primary" @click="onSubmit()">提交</el-button>
</el-form-item> </el-form-item>
...@@ -48,6 +52,7 @@ ...@@ -48,6 +52,7 @@
data: function () { data: function () {
return { return {
imageCodeData: '',
form: {}, form: {},
// 表单验证 // 表单验证
rule: { rule: {
...@@ -62,12 +67,16 @@ ...@@ -62,12 +67,16 @@
contact: [ contact: [
{ required: true, message: '请输入您的联系方式', trigger: 'blur' }, { required: true, message: '请输入您的联系方式', trigger: 'blur' },
], ],
code: [
{ required: true, message: '请输入验证码', trigger: 'blur' }
],
}, },
} }
}, },
created: function () { created: function () {
this.reset() this.reset()
this.onImageCode()
}, },
methods: { methods: {
...@@ -76,23 +85,52 @@ ...@@ -76,23 +85,52 @@
question: '', question: '',
name: '', name: '',
contact: '', contact: '',
code: '',
} }
}, },
onImageCode: function () {
iRequest.request(iHost.base + 'bid/common/getImgCode', {}, 'json', 'post')
.then((funcResponse) => {
this.imageCodeData = funcResponse.img
})
.catch((funcError) => {
this.$message.error(funcError.message)
})
},
onSubmit: function () { onSubmit: function () {
// 过滤攻击脚本
let funcRegular = /<script.*>([\s\S]*?)<\/script>/gi
let funcKeys = Object.keys(this.form)
for (let i = 0, l = funcKeys.length; i < l; i++) {
let funcValue = this.form[funcKeys[i]].replace(funcRegular, '')
this.form[funcKeys[i]] = funcValue
}
this.$refs.form.validate(funcValid => { this.$refs.form.validate(funcValid => {
if (funcValid) { if (funcValid) {
let funcParam = { iRequest.request(iHost.base + 'bid/common/validateImgCode', { 'imgCode': this.form.code }, 'json', 'get')
'consultContent': this.form.question,
'consultant': this.form.name,
'contactWay': this.form.contact
}
iRequest.request(iHost.base + 'bid/zConsult/saveConsult', funcParam, 'json', 'post')
.then((funcResponse) => { .then((funcResponse) => {
this.$message({ message: '问题已提交,请等待回复', type: 'success' }) let funcParam = {
this.reset() 'consultContent': this.form.question,
'consultant': this.form.name,
'contactWay': this.form.contact,
'vCode': this.form.code
}
iRequest.request(iHost.base + 'bid/zConsult/saveConsult', funcParam, 'json', 'post')
.then((funcResponse) => {
this.$message({ message: '问题已提交,请等待回复', type: 'success' })
this.onImageCode()
this.reset()
})
.catch((funcError) => {
this.onImageCode()
this.$message.error(funcError.message)
})
}) })
.catch((funcError) => { .catch((funcError) => {
this.$message.error(funcError.message) this.$message.error(funcError.message)
this.onImageCode()
}) })
} }
}) })
...@@ -154,6 +192,34 @@ ...@@ -154,6 +192,34 @@
color: @colorWhite !important; color: @colorWhite !important;
background: @colorBlue !important; background: @colorBlue !important;
} }
.form-item-code {
> div {
display: flex;
flex-direction: row;
.el-input {
display: inline-block;
width: 310px;
}
button {
display: inline-block;
width: 180px;
height: 40px;
margin-left: 10px;
padding: 0;
border: none;
color: @colorWhite;
background: @colorBlue;
img {
width: 180px;
height: 40px;
}
}
}
}
} }
} }
} }
......
...@@ -674,6 +674,17 @@ ...@@ -674,6 +674,17 @@
}, },
onNext: function () { onNext: function () {
// 过滤攻击脚本
let funcRegular = /<script.*>([\s\S]*?)<\/script>/gi
let funcKeys = Object.keys(this.formRegister)
for (let i = 0, l = funcKeys.length; i < l; i++) {
if (Object.prototype.toString.call(this.formRegister[funcKeys[i]]) === '[object String]') {
let funcValue = this.formRegister[funcKeys[i]].replace(funcRegular, '')
console.log(funcValue)
this.formRegister[funcKeys[i]] = funcValue
}
}
switch (this.state) { switch (this.state) {
// 基础信息 // 基础信息
case 1: case 1:
......
...@@ -733,6 +733,17 @@ ...@@ -733,6 +733,17 @@
* @returns * @returns
*/ */
onNext: function () { onNext: function () {
// 过滤攻击脚本
let funcRegular = /<script.*>([\s\S]*?)<\/script>/gi
let funcKeys = Object.keys(this.formRegister)
for (let i = 0, l = funcKeys.length; i < l; i++) {
if (Object.prototype.toString.call(this.formRegister[funcKeys[i]]) === '[object String]') {
let funcValue = this.formRegister[funcKeys[i]].replace(funcRegular, '')
console.log(funcValue)
this.formRegister[funcKeys[i]] = funcValue
}
}
switch (this.state) { switch (this.state) {
case 1: case 1:
// 测试数据 // 测试数据
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<!-- 登录信息 --> <!-- 登录信息 -->
<div class="row con-c align-s"> <div class="row con-c align-s">
<div class="currency-sign-in-form col con-s"> <div class="currency-sign-in-form col con-b">
<div> <div>
<span>{{statusText}}</span> <span>{{statusText}}</span>
</div> </div>
...@@ -20,12 +20,16 @@ ...@@ -20,12 +20,16 @@
<el-form-item prop="password"> <el-form-item prop="password">
<el-input v-model="info.password" show-password maxlength="20" placeholder="密码"></el-input> <el-input v-model="info.password" show-password maxlength="20" placeholder="密码"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-show="showImageCode" class="form-item-code" prop="code">
<el-input v-model="info.code" maxlength="4" placeholder="请输入验证码"></el-input>
<button @click.prevent=""><img :src="imageCodeData" alt=""></button>
</el-form-item>
<div class="row con-b align-c"> <div class="row con-b align-c">
<!-- <el-checkbox v-model="isRecordPassword" @change="onCheckboxChange">记住密码</el-checkbox> --> <!-- <el-checkbox v-model="isRecordPassword" @change="onCheckboxChange">记住密码</el-checkbox> -->
<span></span> <span></span>
<span class="currency-sign-in-forget global-cursor" @click="onForget()">忘记密码?</span> <span class="currency-sign-in-forget global-cursor" @click="onForget()">忘记密码?</span>
</div> </div>
<el-form-item> <el-form-item class="submit">
<button class="global-cursor" @click.prevent="onSignInSubmit()">登录</button> <button class="global-cursor" @click.prevent="onSignInSubmit()">登录</button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -62,7 +66,10 @@ ...@@ -62,7 +66,10 @@
'password': '', // 记录密码 'password': '', // 记录密码
'register': '', // 审核状态 'register': '', // 审核状态
'identity': '', // 登录身份 'identity': '', // 登录身份
'code': ''
}, },
imageCodeData: '',
showImageCode: false,
// 表单验证 // 表单验证
rule: { rule: {
...@@ -79,7 +86,6 @@ ...@@ -79,7 +86,6 @@
created: function () { created: function () {
this.reset() this.reset()
this.init() this.init()
// this.loadSignInInfo()
}, },
methods: { methods: {
...@@ -120,7 +126,10 @@ ...@@ -120,7 +126,10 @@
'password': '', // 记录密码 'password': '', // 记录密码
'register': '', // 审核状态 'register': '', // 审核状态
'identity': '', // 登录身份 'identity': '', // 登录身份
'code': ''
} }
this.imageCodeData = ''
this.showImageCode = false
}, },
/** /**
...@@ -233,6 +242,7 @@ ...@@ -233,6 +242,7 @@
'loginName': this.info.phone, 'loginName': this.info.phone,
'password': this.info.password, 'password': this.info.password,
'userType': this.info.identity, 'userType': this.info.identity,
'vCode': this.info.code
} }
iRequest.request(iHost.base + 'bid/zLogin/login', funcParam, 'json', 'post', { isToken: false }) iRequest.request(iHost.base + 'bid/zLogin/login', funcParam, 'json', 'post', { isToken: false })
.then((funcResponse) => { .then((funcResponse) => {
...@@ -243,7 +253,10 @@ ...@@ -243,7 +253,10 @@
this.queryUserInfo() this.queryUserInfo()
}) })
.catch((funcError) => { .catch((funcError) => {
this.$message.error(funcError.message) if (funcError.data) {
this.showImageCode = true
this.imageCodeData = funcError.data.imgCode
}
}) })
} }
}) })
...@@ -297,15 +310,43 @@ ...@@ -297,15 +310,43 @@
.currency-sign-in-form { .currency-sign-in-form {
width: 428px; width: 428px;
height: 360px; height: 380px;
margin-top: 30px; margin-top: 20px;
padding: 30px 26px; padding: 20px 26px;
background:rgba(255, 255, 255, 1); background:rgba(255, 255, 255, 1);
box-shadow: 0px 0px 45px 0px rgba(41, 41, 41, 0.1); box-shadow: 0px 0px 45px 0px rgba(41, 41, 41, 0.1);
border-radius: 15px; border-radius: 15px;
.form-item-code {
> div {
display: flex;
flex-direction: row;
.el-input {
display: inline-block;
width: 182px;
}
button {
display: inline-block;
width: 180px;
height: 40px;
margin-left: 10px;
padding: 0;
border: none;
color: @colorWhite;
background: @colorBlue;
img {
width: 180px;
height: 40px;
}
}
}
}
> div:nth-child(1) { > div:nth-child(1) {
margin-bottom: 22px; margin-bottom: 10px;
span { span {
color: @colorBlue; color: @colorBlue;
...@@ -324,10 +365,10 @@ ...@@ -324,10 +365,10 @@
} }
} }
button { .submit button {
width: 376px; width: 376px;
height: 50px; height: 50px;
margin-top: 30px; margin-top: 10px;
border: none; border: none;
border-radius: 25px; border-radius: 25px;
font-size: @fontSize02; font-size: @fontSize02;
...@@ -344,8 +385,6 @@ ...@@ -344,8 +385,6 @@
} }
> div:nth-child(3) { > div:nth-child(3) {
margin-bottom: 32px;
span:nth-child(1) { span:nth-child(1) {
color: @colorGrey60; color: @colorGrey60;
font-size: @fontSize01; font-size: @fontSize01;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment