Commit 47bc21a2 by 冷斌

fix bug

parent 26584006
...@@ -29,190 +29,186 @@ ...@@ -29,190 +29,186 @@
<div class="scimgBox"> <div class="scimgBox">
<div class="imgItem" @click="addImg('front_view')"> <div class="imgItem" @click="addImg('front_view')">
<div class="imgItem" @click="addImg('front_view')" v-model="form.front_view"> <img :src="form.front_view ? form.front_view : upload_image"
<img :src="form.front_view ? form.front_view : upload_image" :class="[form.front_view ? 'zhengjz' : 'addTipsimg']">
:class="[form.front_view ? 'zhengjz' : 'addTipsimg']"> <div v-show="form.front_view ? false : true" class="addTips_wz">上传证件人像面</div>
<div v-show="form.front_view ? false : true" class="addTips_wz">上传证件人像面</div> </div>
</div> <div class="imgItem" @click="addImg('back_view')">
<div class="imgItem" @click="addImg('back_view')"> <img :src="form.back_view ? form.back_view : upload_image"
<div class="imgItem" @click="addImg('back_view')" v-model="form.back_view"> :class="[form.back_view ? 'zhengjz' : 'addTipsimg']">
<img :src="form.back_view ? form.back_view : upload_image" <div v-show="form.back_view ? false : true" class="addTips_wz">上传证件国徽面</div>
:class="[form.back_view ? 'zhengjz' : 'addTipsimg']"> </div>
<div v-show="form.back_view ? false : true" class="addTips_wz">上传证件国徽面</div> <div class="imgItem" @click="addImg('handset_view')">
</div> <img :src="form.handset_view ? form.handset_view : upload_image"
<div class="imgItem" @click="addImg('handset_view')"> :class="[form.handset_view ? 'zhengjz' : 'addTipsimg']">
<div class="imgItem" @click="addImg('handset_view')" v-model="form.handset_view"> <div v-show="form.handset_view ? false : true" class="addTips_wz">手持证件照</div>
<img :src="form.handset_view ? form.handset_view : upload_image" </div>
:class="[form.handset_view ? 'zhengjz' : 'addTipsimg']"> <input id="file" name="image" type="file" v-show="false" class="upload" accept="image/*" @change="upload"/>
<div v-show="form.handset_view ? false : true" class="addTips_wz">手持证件照</div> <input id="file2" name="image" type="file" v-show="false" class="upload" accept="image/*" @change="upload"/>
</div> <input id="file3" name="image" type="file" v-show="false" class="upload" accept="image/*" @change="upload"/>
<input id="file" name="image" type="file" v-show="false" class="upload" accept="image/*" @change="upload"/> </div>
<input id="file2" name="image" type="file" v-show="false" class="upload" accept="image/*" @change="upload"/>
<input id="file3" name="image" type="file" v-show="false" class="upload" accept="image/*" @change="upload"/>
</div>
<!-- 按钮 --> <!-- 按钮 -->
<div class="btnBox"> <div class="btnBox">
<button type="button" :class="[isSubmit ? 'btnOne' : 'btnTwo']" @click="submit" :disabled="isSubmit">申请认证 <button type="button" :class="[isSubmit ? 'btnOne' : 'btnTwo']" @click="submit" :disabled="isSubmit">申请认证
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
var uid = '{$uid}'; var uid = '{$uid}';
var token = '{$token}'; var token = '{$token}';
var vm = new Vue({ var vm = new Vue({
el: '#app', el: '#app',
data: { data: {
//数据集 //数据集
form: { form: {
uid: uid, uid: uid,
token: token, token: token,
real_name: '', real_name: '',
cer_no: '', cer_no: '',
mobile: '', mobile: '',
front_view: '', front_view: '',
back_view: '', back_view: '',
handset_view: '' handset_view: ''
}, },
uploadName: '', uploadName: '',
isSubmit: true, isSubmit: true,
upload_image: '__PUBLIC__/appapi/img/add_r@2x.png', upload_image: '__PUBLIC__/appapi/img/add_r@2x.png',
}, },
methods: { methods: {
//事件 //事件
checkSubmit: function () { checkSubmit: function () {
let status = false; let status = false;
for (let i in this.form) { for (let i in this.form) {
if (this.form[i] === '') { if (this.form[i] === '') {
status = true; status = true;
break; break;
} }
} }
this.isSubmit = status; this.isSubmit = status;
}, },
checkName: function () { checkName: function () {
if (this.form.real_name === '') { if (this.form.real_name === '') {
layer.msg("真实姓名不能为空"); layer.msg("真实姓名不能为空");
return; return;
} }
var reg_realName = /^(?=.*\d.*\b)/; var reg_realName = /^(?=.*\d.*\b)/;
if (reg_realName.test(this.form.real_name)) { if (reg_realName.test(this.form.real_name)) {
layer.msg("请正确填写真实姓名"); layer.msg("请正确填写真实姓名");
return; return;
} }
this.checkSubmit(); this.checkSubmit();
}, },
checkNo: function () { checkNo: function () {
if (this.form.cer_no === '') { if (this.form.cer_no === '') {
layer.msg("身份证号不能为空"); layer.msg("身份证号不能为空");
return; return;
} }
var reg_identity = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/; var reg_identity = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
if (!reg_identity.test(this.form.cer_no)) { if (!reg_identity.test(this.form.cer_no)) {
layer.msg("请正确填写身份证号"); layer.msg("请正确填写身份证号");
return; return;
} }
this.checkSubmit(); this.checkSubmit();
}, },
checkMobile: function () { checkMobile: function () {
if (this.form.mobile === '') { if (this.form.mobile === '') {
layer.msg("手机号码不能为空"); layer.msg("手机号码不能为空");
return; return;
} }
var reg_phone = /^(\d{5}|\d{6}|\d{7}|\d{8}|\d{9}|\d{10}|\d{11}|\d{12}|\d{13}|\d{14}|\d{15}|\d{16}|\d{17}|\d{18}|\d{19}|\d{20}|\d{21})$/; var reg_phone = /^(\d{5}|\d{6}|\d{7}|\d{8}|\d{9}|\d{10}|\d{11}|\d{12}|\d{13}|\d{14}|\d{15}|\d{16}|\d{17}|\d{18}|\d{19}|\d{20}|\d{21})$/;
if (!reg_phone.test(this.form.mobile)) { if (!reg_phone.test(this.form.mobile)) {
layer.msg("请正确输入手机号码"); layer.msg("请正确输入手机号码");
return; return;
} }
this.checkSubmit(); this.checkSubmit();
}, },
addImg: function (name) { addImg: function (name) {
this.uploadName = name; this.uploadName = name;
if (this.uploadName === 'front_view') { if (this.uploadName === 'front_view') {
$("#file").click(); $("#file").click();
} }
if (this.uploadName === 'back_view') { if (this.uploadName === 'back_view') {
$("#file2").click(); $("#file2").click();
} }
if (this.uploadName === 'handset_view') { if (this.uploadName === 'handset_view') {
$("#file3").click(); $("#file3").click();
} }
}, },
upload: function () { upload: function () {
let _this = this; let _this = this;
let saveName, id = ''; let saveName, id = '';
if (_this.uploadName === 'front_view') { if (_this.uploadName === 'front_view') {
id = 'file'; id = 'file';
saveName = 'auth_' + uid + '_1'; saveName = 'auth_' + uid + '_1';
} }
if (_this.uploadName === 'back_view') { if (_this.uploadName === 'back_view') {
id = 'file2'; id = 'file2';
saveName = 'auth_' + uid + '_2'; saveName = 'auth_' + uid + '_2';
} }
if (_this.uploadName === 'handset_view') { if (_this.uploadName === 'handset_view') {
id = 'file3'; id = 'file3';
saveName = 'auth_' + uid + '_3'; saveName = 'auth_' + uid + '_3';
} }
var loadingIndex = layer.load(2); var loadingIndex = layer.load(2);
$.ajaxFileUpload({ $.ajaxFileUpload({
url: './index.php?g=Appapi&m=Auth&a=upload', url: './index.php?g=Appapi&m=Auth&a=upload',
secureuri: false, secureuri: false,
fileElementId: id, fileElementId: id,
data: {saveName: saveName}, data: {saveName: saveName},
dataType: 'html', dataType: 'html',
success: function (data) { success: function (data) {
data = data.replace(/<[^>]+>/g, ""); data = data.replace(/<[^>]+>/g, "");
var str = JSON.parse(data); var str = JSON.parse(data);
if (_this.uploadName === 'front_view') { if (_this.uploadName === 'front_view') {
_this.form.front_view = str.data.url; _this.form.front_view = str.data.url;
}
if (_this.uploadName === 'back_view') {
_this.form.back_view = str.data.url;
}
if (_this.uploadName === 'handset_view') {
_this.form.handset_view = str.data.url;
}
_this.checkSubmit();
layer.close(loadingIndex);
},
error: function (data) {
layer.msg("上传失败");
console.log(data);
}
});
},
submit: function () {
let data = this.form;
$.ajax({url:"./index.php?g=Appapi&m=Auth&a=authsave",
dataType:"json",
data: data,
type:"POST",
success:function(data){
//console.log(data);
if(data.ret==200){
window.location.href="./index.php?g=Appapi&m=Auth&a=success&uid="+uid;
}else{
layer.msg(data.msg);
}
},
error:function(e){
layer.msg(e.msg);
}
})
} }
if (_this.uploadName === 'back_view') {
_this.form.back_view = str.data.url;
}
if (_this.uploadName === 'handset_view') {
_this.form.handset_view = str.data.url;
}
_this.checkSubmit();
layer.close(loadingIndex);
}, },
watch: { error: function (data) {
//数据监测函数 layer.msg("上传失败");
}, console.log(data);
created: function () {
//加载触发函数
} }
}); });
</script> },
submit: function () {
let data = this.form;
$.ajax({url:"./index.php?g=Appapi&m=Auth&a=authsave",
dataType:"json",
data: data,
type:"POST",
success:function(data){
//console.log(data);
if(data.ret==200){
window.location.href="./index.php?g=Appapi&m=Auth&a=success&uid="+uid;
}else{
layer.msg(data.msg);
}
},
error:function(e){
layer.msg(e.msg);
}
})
}
},
watch: {
//数据监测函数
},
created: function () {
//加载触发函数
}
});
</script>
</body> </body>
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 to comment