提交 aa92edf3 authored 作者: huaxinzhu's avatar huaxinzhu

设置

上级 1ba01a00
...@@ -9,18 +9,28 @@ export function changeTelphone(data) { ...@@ -9,18 +9,28 @@ export function changeTelphone(data) {
}) })
} }
// 设置登录密码
export function changeLoginPassword(data) {
return request({
url: '/local/seller/setPass',
method: 'post',
data: data
})
}
// 设置支付密码
export function changePayPassword(data) {
return request({
url: '/local/seller/setPayPass',
method: 'post',
data: data
})
}
// 获取验证码
export function getTelphoneCode(id) {
// 获取手机验证码
export function getTelphoneCode(query) {
return request({ return request({
url: '/local/seller/sendCodeMobile', url: '/local/seller/sendCodeMobile?mobile=' + id,
method: 'get', method: 'get'
params: query
}) })
} }
...@@ -34,16 +34,16 @@ ...@@ -34,16 +34,16 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<!--修改账号 对话框--> <!--修改 账号 对话框-->
<el-dialog title="修改登录账号" :visible.sync="isAccount" width="50%"> <el-dialog title="修改登录账号" :visible.sync="isAccount" width="50%">
<el-form :model="accountForm" :rules="accountRules" ref="accountForm" label-width="200px" size="small"> <el-form :model="accountForm" :rules="accountRules" ref="accountForm" label-width="200px" size="small">
<el-form-item label="登录密码:" prop="loginpsd"> <el-form-item label="登录密码:" prop="password">
<el-input v-model="accountForm.loginpsd" placeholder="请输入登录密码" style="width: 300px"></el-input> <el-input v-model="accountForm.password" placeholder="请输入登录密码" style="width: 300px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="新手机号:" prop="newTelphone"> <el-form-item label="新手机号:" prop="mobile">
<el-input v-model="accountForm.newTelphone" placeholder="请输入新的手机号码" <el-input v-model="accountForm.mobile" placeholder="请输入新的手机号码"
style="width: 300px;margin-right:20px;"></el-input> style="width: 300px;margin-right:20px;"></el-input>
<el-button type="primary" icon="el-icon-edit" @click="getAccountCode()" v-if="isAccountCode">获取验证码</el-button> <el-button type="primary" icon="el-icon-edit" @click="getAccountCode()" v-if="isAccountCode">获取验证码</el-button>
<el-button type="info" style="width: 109px" :disabled="true" v-if="!isAccountCode">倒计时 {{ accountCountDown }} <el-button type="info" style="width: 109px" :disabled="true" v-if="!isAccountCode">倒计时 {{ accountCountDown }}
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item label="短信验证码:" prop="verification"> <el-form-item label="短信验证码:" prop="code">
<el-input v-model="accountForm.verification" placeholder="请输入短信验证码" style="width: 300px"></el-input> <el-input v-model="accountForm.code" placeholder="请输入短信验证码" style="width: 300px"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -64,23 +64,22 @@ ...@@ -64,23 +64,22 @@
<el-dialog title="修改登录密码" :visible.sync="isLogin" width="50%"> <el-dialog title="修改登录密码" :visible.sync="isLogin" width="50%">
<el-form :model="loginForm" :rules="loginRules" ref="loginForm" label-width="200px" size="small"> <el-form :model="loginForm" :rules="loginRules" ref="loginForm" label-width="200px" size="small">
<el-form-item label="新密码:" prop="newLoginpsd"> <el-form-item label="新密码:" prop="password">
<el-input v-model="loginForm.newLoginpsd" plackeholder="请输入新密码" style="width: 300px" show-password></el-input> <el-input v-model="loginForm.password" plackeholder="请输入新密码" style="width: 300px" show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认新密码:" prop="newLoginpsdCheck"> <el-form-item label="确认新密码:" prop="password2">
<el-input v-model="loginForm.newLoginpsdCheck" plackeholder="请输入新密码" style="width: 300px" <el-input v-model="loginForm.password2" plackeholder="请输入新密码" style="width: 300px"
show-password></el-input> show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item label="短信验证码:" prop="loginVerificationCode"> <el-form-item label="短信验证码:" prop="code">
<el-input v-model="loginForm.loginVerificationCode" placeholder="请输入手机158****8888的验证码" <el-input v-model="loginForm.code" :placeholder="showMobilePlaceholder"
style="width: 300px;margin-right:20px;"></el-input> style="width: 300px;margin-right:20px;"></el-input>
<el-button type="primary" icon="el-icon-edit" @click="getLoginCode()" v-if="isLoginCode">获取验证码</el-button> <el-button type="primary" icon="el-icon-edit" @click="getLoginCode()" v-if="isLoginCode">获取验证码</el-button>
<el-button type="info" style="width: 109px" :disabled="true" v-if="!isLoginCode">倒计时 {{ loginCountDown }} S <el-button type="info" style="width: 109px" :disabled="true" v-if="!isLoginCode">倒计时 {{ loginCountDown }} S
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -92,17 +91,17 @@ ...@@ -92,17 +91,17 @@
<el-dialog title="修改支付密码" :visible.sync="isPay" width="50%"> <el-dialog title="修改支付密码" :visible.sync="isPay" width="50%">
<el-form :model="payForm" :rules="payRules" ref="payForm" label-width="200px" size="small"> <el-form :model="payForm" :rules="payRules" ref="payForm" label-width="200px" size="small">
<el-form-item label="新密码:" prop="newPaypsd"> <el-form-item label="新密码:" prop="password">
<el-input v-model="payForm.newPaypsd" plackeholder="请输入新密码" style="width: 300px" show-password></el-input> <el-input v-model="payForm.password" plackeholder="请输入新密码" style="width: 300px" show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认新密码:" prop="newPaypsdCheck"> <el-form-item label="确认新密码:" prop="password2">
<el-input v-model="payForm.newPaypsdCheck" plackeholder="请输入新密码" style="width: 300px" <el-input v-model="payForm.password2" plackeholder="请输入新密码" style="width: 300px"
show-password></el-input> show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item label="短信验证码:" prop="payVerificationCode"> <el-form-item label="短信验证码:" prop="code">
<el-input v-model="payForm.payVerificationCode" placeholder="请输入手机158****8888的验证码" <el-input v-model="payForm.code" :placeholder="showMobilePlaceholder"
style="width: 300px;margin-right:20px;"></el-input> style="width: 300px;margin-right:20px;"></el-input>
<el-button type="primary" icon="el-icon-edit" @click="getPayCode()" v-if="isPayCode">获取验证码</el-button> <el-button type="primary" icon="el-icon-edit" @click="getPayCode()" v-if="isPayCode">获取验证码</el-button>
<el-button type="info" style="width: 109px" :disabled="true" v-if="!isPayCode">倒计时 {{payCountDown}} S <el-button type="info" style="width: 109px" :disabled="true" v-if="!isPayCode">倒计时 {{payCountDown}} S
...@@ -113,14 +112,14 @@ ...@@ -113,14 +112,14 @@
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="cancel('payForm')">取 消</el-button> <el-button @click="cancel('payForm')">取 消</el-button>
<el-button type="primary" @click="submitPay">确 定</el-button> <el-button type="primary" @click="submitPay('payForm')">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {changeTelphone, getTelphoneCode} from '@/api/module/settings' import {changeTelphone, getTelphoneCode,changeLoginPassword,changePayPassword } from '@/api/module/settings'
export default { export default {
name: "Setpsd", name: "Setpsd",
...@@ -151,7 +150,7 @@ ...@@ -151,7 +150,7 @@
let checkNewPsdAgain = (rule, value, callback) => { let checkNewPsdAgain = (rule, value, callback) => {
if (value === '') { if (value === '') {
callback(new Error('密码不能为空')); callback(new Error('密码不能为空'));
} else if (value !== this.loginForm.newLoginpsd) { } else if (value !== this.loginForm.password) {
callback(new Error('两次密码不一致,请检查后重新输入')); callback(new Error('两次密码不一致,请检查后重新输入'));
} else { } else {
callback(); callback();
...@@ -163,7 +162,7 @@ ...@@ -163,7 +162,7 @@
if (value === '') { if (value === '') {
callback(new Error('密码不能为空')); callback(new Error('密码不能为空'));
} else if (!reg.test(value)) { } else if (!reg.test(value)) {
callback(new Error('密码位8位数字')); callback(new Error('密码位6位数字'));
} else { } else {
callback(); callback();
} }
...@@ -172,7 +171,7 @@ ...@@ -172,7 +171,7 @@
let checkPayPsdAgain = (rule, value, callback) => { let checkPayPsdAgain = (rule, value, callback) => {
if (value === '') { if (value === '') {
callback(new Error('密码不能为空')); callback(new Error('密码不能为空'));
} else if (value !== this.payForm.newPaypsd) { } else if (value !== this.payForm.password) {
callback(new Error('两次密码不一致,请检查后重新输入')); callback(new Error('两次密码不一致,请检查后重新输入'));
} else { } else {
callback(); callback();
...@@ -188,45 +187,49 @@ ...@@ -188,45 +187,49 @@
accountCountDown: '', accountCountDown: '',
loginCountDown: '', loginCountDown: '',
payCountDown: '', payCountDown: '',
showMobilePlaceholder: '',
setForm: { setForm: {
name: '', name: '',
loginpsd: '******', loginpsd: '******',
paypsd: '******' paypsd: '******'
}, },
accountForm: { accountForm: {
loginpsd: '', password: '',
newTelphone: '', mobile: '',
verification: '' code: ''
}, },
accountRules: { accountRules: {
loginpsd: [{required: true, message: '登录密码不能为空', trigger: 'blur'}], password: [{required: true, message: '登录密码不能为空', trigger: 'blur'}],
newTelphone: [{required: true, validator: checkTel, trigger: 'blur'}], mobile: [{required: true, validator: checkTel, trigger: 'blur'}],
verification: [{required: true, message: '验证码不能为空', trigger: 'blur'}], code: [{required: true, message: '验证码不能为空', trigger: 'blur'}],
}, },
loginForm: { loginForm: {
newLoginpsd: '', password: '',
newLoginpsdCheck: '', password2: '',
loginVerificationCode: '' code: ''
}, },
loginRules: { loginRules: {
newLoginpsd: [{required: true, validator: checkNewPsd, trigger: 'blur'}], password: [{required: true, validator: checkNewPsd, trigger: 'blur'}],
newLoginpsdCheck: [{required: true, validator: checkNewPsdAgain, trigger: 'blur'}], password2: [{required: true, validator: checkNewPsdAgain, trigger: 'blur'}],
loginVerificationCode: [{required: true, message: '验证码不能为空', trigger: 'blur'}] code: [{required: true, message: '验证码不能为空', trigger: 'blur'}]
}, },
payForm: { payForm: {
newPaypsd: '', password: '',
newPaypsdCheck: '', password2: '',
payVerificationCode: '', code: '',
}, },
payRules: { payRules: {
newPaypsd: [{required: true, validator: checkPayPsd, trigger: 'blur'}], password: [{required: true, validator: checkPayPsd, trigger: 'blur'}],
newPaypsdCheck: [{required: true, validator: checkPayPsdAgain, trigger: 'blur'}], password2: [{required: true, validator: checkPayPsdAgain, trigger: 'blur'}],
payVerificationCode: [{required: true, message: '验证码不能为空', trigger: 'blur'}], code: [{required: true, message: '验证码不能为空', trigger: 'blur'}],
} }
} }
}, },
mounted() { mounted() {
this.setForm.name = this.$store.state.user.name; this.setForm.name = this.$store.state.user.name;
console.log(333,this.setForm.name);
let repStr = this.setForm.name.substring(3,7);
this.showMobilePlaceholder = '请输入' + this.setForm.name.replace(repStr, '****') + '的验证码';
}, },
methods: { methods: {
// 修改 账号 // 修改 账号
...@@ -241,17 +244,17 @@ ...@@ -241,17 +244,17 @@
editPay() { editPay() {
this.isPay = true; this.isPay = true;
}, },
// 获取验证码 // 修改账号 获取验证码
getAccountCode() { getAccountCode() {
// 先校验 // 先校验
if (this.accountForm.loginpsd === '') { if (this.accountForm.password === '') {
this.$refs.accountForm.validateField('loginpsd'); this.$refs.accountForm.validateField('password');
return; return;
} }
// //
const telphoneReg = /^1[3456789]\d{9}$/; const telphoneReg = /^1[3456789]\d{9}$/;
if (!telphoneReg.test(this.accountForm.newTelphone)) { if (!telphoneReg.test(this.accountForm.mobile)) {
this.$refs.accountForm.validateField('newTelphone'); this.$refs.accountForm.validateField('mobile');
return; return;
} }
const TIME_COUNT = 60; const TIME_COUNT = 60;
...@@ -269,17 +272,26 @@ ...@@ -269,17 +272,26 @@
} }
}, 1000) }, 1000)
} }
// 获取验证码
getTelphoneCode(this.accountForm.mobile).then(res => {
if(res.code === 1) {
this.$message({type:"success",message: '验证码发送成功'});
}else {
this.$message({type:"error",message: '验证码发送失败'});
}
});
}, },
// 修改登录密码的 获取校验码 loginCountDown // 修改登录密码的 获取校验码 loginCountDown
getLoginCode() { getLoginCode() {
let loginpsdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/; let loginpsdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/;
if (this.loginForm.newLoginpsd === '' || !loginpsdReg.test(this.loginForm.newLoginpsd)) { if (this.loginForm.password === '' || !loginpsdReg.test(this.loginForm.password)) {
this.$refs.loginForm.validateField('newLoginpsd'); this.$refs.loginForm.validateField('password');
return; return;
} }
if (this.loginForm.newLoginpsdCheck === '' || this.loginForm.newLoginpsdCheck !== this.loginForm.newLoginpsd) { if (this.loginForm.password2 === '' || this.loginForm.password2 !== this.loginForm.password) {
this.$refs.loginForm.validateField('newLoginpsdCheck'); this.$refs.loginForm.validateField('password2');
return; return;
} }
...@@ -297,17 +309,24 @@ ...@@ -297,17 +309,24 @@
} }
}, 1000) }, 1000)
} }
getTelphoneCode(this.setForm.name).then(res => {
if(res.code === 1) {
this.$message({type:"success",message: '验证码发送成功'});
}else {
this.$message({type:"error",message: '验证码发送失败'});
}
});
}, },
// 修改支付密码,获取手机验证码 // 修改支付密码,获取手机验证码
getPayCode() { getPayCode() {
let paypsdReg = /^[0-9]{6}$/; let paypsdReg = /^[0-9]{6}$/;
if (this.payForm.newPaypsd === '' || !paypsdReg.test(this.payForm.newPaypsd)) { if (this.payForm.password === '' || !paypsdReg.test(this.payForm.password)) {
this.$refs.payForm.validateField('newPaypsd'); this.$refs.payForm.validateField('password');
return; return;
} }
if (this.payForm.newPaypsdCheck === '' || this.payForm.newPaypsdCheck !== this.payForm.newPaypsd) { if (this.payForm.password2 === '' || this.payForm.password2 !== this.payForm.password) {
this.$refs.payForm.validateField('newPaypsdCheck'); this.$refs.payForm.validateField('password2');
return; return;
} }
...@@ -325,32 +344,69 @@ ...@@ -325,32 +344,69 @@
} }
}, 1000) }, 1000)
} }
// 获取手机验证码 getTelphoneCode(this.setForm.name).then(res => {
// getTelphoneCode(this.loginForm).then(res => { if(res.code === 1) {
// this.$message({type:"success",message: '验证码发送成功'});
// }); }else {
this.$message({type:"error",message: '验证码发送失败'});
}
});
}, },
// 平台登录账号 确定 // 平台登录账号修改 提交
submitAccount(formName) { submitAccount(formName) {
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
// 接口
changeTelphone(this.accountForm).then(res => { changeTelphone(this.accountForm).then(res => {
console.log('修改手机号返回结果', res); if(res.code === 1) {
this.$message({type:"success",message: '登录账号修改成功,需重新登录'});
// 修改成功,则强制退出,重新登录
this.$store.dispatch('LogOut').then(() => {
var ssa = window.location.host
setTimeout(function (){
if(ssa =='localhost:1024'){
window.location.href='http://sso.jxhh.com/logout?redirect=http://'+ssa+'/login'
}else{
window.location.href='http://sso.jxhh.com/logout?redirect=http://'+ssa+'/login'
}
}, 1000)
})
}else {
let msg = res.msg || '修改失败';
this.$message({type:"error",message: msg});
}
this.clearAccountCodeDown();
this.isAccount = false;
}); });
this.clearAccountCodeDown();
this.isAccount = false;
} }
}); });
}, },
// 登录密码 确定 // 登录密码 确定
submitLogin(formName) { submitLogin(formName) {
console.log(378,this.loginForm);
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
changeLoginPassword(this.loginForm).then(res=> {
this.clearAccountCodeDown(); if(res.code === 1) {
this.isLogin = false; this.$message({type:"success",message: '登录密码修改成功,需重新登录'});
// 修改成功,则强制退出,重新登录
this.$store.dispatch('LogOut').then(() => {
var ssa = window.location.host
setTimeout(function (){
if(ssa =='localhost:1024'){
window.location.href='http://sso.jxhh.com/logout?redirect=http://'+ssa+'/login'
}else{
window.location.href='http://sso.jxhh.com/logout?redirect=http://'+ssa+'/login'
}
}, 1000)
})
}else {
let msg = res.msg || '修改失败';
this.$message({type:"error",message: msg});
}
this.clearAccountCodeDown();
this.isLogin = false;
});
} }
}); });
}, },
...@@ -358,8 +414,16 @@ ...@@ -358,8 +414,16 @@
submitPay(formName) { submitPay(formName) {
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
changePayPassword(this.payForm).then(res => {
this.isPay = false; if(res.code === 1) {
this.$message({type:"success",message: '支付密码修改成功'});
}else {
let msg = res.msg || '修改失败';
this.$message({type:"error",message: msg});
}
this.clearAccountCodeDown();
this.isPay = false;
});
} }
}); });
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论