Commit 26584006 by 冷斌

fix bug

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