|
|
@@ -26,15 +26,14 @@
|
|
|
</select>
|
|
|
</li>
|
|
|
<li style="height:60px;">
|
|
|
- <span class="qy-biaoti">公司地址</span>
|
|
|
- <div class="addbiaoqian">
|
|
|
- <v-distpicker @province= 'qyprovince'
|
|
|
- @city= 'qycity'
|
|
|
- @area= 'qyarea'
|
|
|
- >
|
|
|
- </v-distpicker>
|
|
|
- <input ref="address" class="qy-xiangxi" type="text" placeholder="输入企业详细地址">
|
|
|
+ <span class="qy-biaoti left">公司地址</span>
|
|
|
+ <div class="addbiaoqian" style="float: left;margin: 0;">
|
|
|
+ <!-- <v-distpicker @province= 'qyprovince' @city= 'qycity' @area= 'qyarea'></v-distpicker> -->
|
|
|
+ <v-distpicker @selected= 'selected'></v-distpicker>
|
|
|
+ <input ref="address" @change="address" class="qy-xiangxi" type="text" placeholder="输入企业详细地址">
|
|
|
+
|
|
|
</div>
|
|
|
+ <span ref="ress" style="color:red;margin-top: 40px;display: inline-block;"></span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
@@ -73,7 +72,12 @@ import VDistpicker from 'v-distpicker'
|
|
|
area:'',//区
|
|
|
qymingzi: false,//企业名是否注册
|
|
|
Email: '',
|
|
|
- mytoken: JSON.parse(localStorage.getItem('app-state-session'))//本地储存的用户信息
|
|
|
+ mytoken: JSON.parse(localStorage.getItem('app-state-session')),//本地储存的用户信息
|
|
|
+ // reg: new RegExp("[`~!@#$^&*()=+-|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]"),
|
|
|
+ reg: new RegExp(/[\@\#\$\%\&\*!\¥]/),
|
|
|
+ isaddress: false,//公司地址验证
|
|
|
+ isname: false,//姓名验证
|
|
|
+ isspaceName: false,//公司名验证
|
|
|
}
|
|
|
},
|
|
|
components:{
|
|
|
@@ -90,42 +94,68 @@ import VDistpicker from 'v-distpicker'
|
|
|
},
|
|
|
//测试企业名称
|
|
|
spaceName(){
|
|
|
- let qyname = this.$refs.qyname.value;//公司名字
|
|
|
+ let qyname = this.$refs.qyname.value.replace(/\s+/g, "");//公司名字过滤空格
|
|
|
if(qyname == ''){
|
|
|
this.$refs.qyno.innerHTML = '企业名不能为空';
|
|
|
} else {
|
|
|
- this.$refs.qyno.innerHTML = '';
|
|
|
- let token = this.mytoken.token;
|
|
|
- this.$ajax({
|
|
|
- url: this.$url.api+"/api/account/accountCenter/checkSpaceName"+`?spaceName=${qyname}`,
|
|
|
- method :'get',
|
|
|
- headers: {
|
|
|
- "Authorization":token
|
|
|
- }
|
|
|
- })
|
|
|
- .then(res=>{
|
|
|
- if (res.data.data.success) {
|
|
|
- this.qymingzi = true;
|
|
|
- } else {
|
|
|
- this.$refs.qyno.innerHTML = '企业已注册';
|
|
|
- this.qymingzi = false
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(err=>{
|
|
|
- console.log("请求错误",err);
|
|
|
- })
|
|
|
+ if (this.reg.test(qyname)) {
|
|
|
+ this.$refs.qyno.innerHTML = '包含非法字符';
|
|
|
+ this.isspaceName = false;
|
|
|
+ } else {
|
|
|
+ this.$refs.qyno.innerHTML = '';
|
|
|
+ this.isspaceName = true;
|
|
|
+ let token = this.mytoken.token;
|
|
|
+ this.$ajax({
|
|
|
+ url: this.$url.api+"/api/account/accountCenter/checkSpaceName"+`?spaceName=${qyname}`,
|
|
|
+ method :'get',
|
|
|
+ headers: {
|
|
|
+ "Authorization":token
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(res=>{
|
|
|
+ if (res.data.data.success) {
|
|
|
+ this.qymingzi = true;
|
|
|
+ } else {
|
|
|
+ this.$refs.qyno.innerHTML = '企业已注册';
|
|
|
+ this.qymingzi = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err=>{
|
|
|
+ // console.log("请求错误",err);
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
//验证个人姓名
|
|
|
yzusername(){
|
|
|
- let name = this.$refs.name.value;//个人姓名
|
|
|
+ let name = this.$refs.name.value.replace(/\s+/g, "");//姓名过滤空格
|
|
|
if (name == '') {
|
|
|
this.$refs.usname.innerHTML = '姓名不能为空'
|
|
|
} else {
|
|
|
- this.$refs.usname.innerHTML = ''
|
|
|
+ if (this.reg.test(name)) {
|
|
|
+ this.$refs.usname.innerHTML = '包含非法字符'
|
|
|
+ this.isname = false
|
|
|
+ } else {
|
|
|
+ this.$refs.usname.innerHTML = ''
|
|
|
+ this.isname = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //验证公司详细地址
|
|
|
+ address(){
|
|
|
+ let address = this.$refs.address.value.replace(/\s+/g, "");//过滤空格
|
|
|
+ if (address == '') {
|
|
|
+ this.$refs.ress.innerHTML = '地址不能为空'
|
|
|
+ } else {
|
|
|
+ if (this.reg.test(address)) {
|
|
|
+ this.$refs.ress.innerHTML = '包含非法字符'
|
|
|
+ this.isaddress = false
|
|
|
+ } else {
|
|
|
+ this.$refs.ress.innerHTML = ''
|
|
|
+ this.isaddress = true
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
email(){
|
|
|
let reg = new RegExp("^[a-z0-9A-Z]+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-z]{2,}$");
|
|
|
let email = this.$refs.email.value;//邮箱
|
|
|
@@ -134,14 +164,13 @@ import VDistpicker from 'v-distpicker'
|
|
|
} else {
|
|
|
this.Email = ''
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
//保存
|
|
|
Preservation(){
|
|
|
- let qyname = this.$refs.qyname.value;//公司名字
|
|
|
+ let qyname = this.$refs.qyname.value.replace(/\s+/g, "");//公司名字
|
|
|
let qyindustry = this.$refs.qyindustry.value;//所属行业
|
|
|
- let address = this.province+this.city+this.area+this.$refs.address.value;//公司详细地址
|
|
|
- let name = this.$refs.name.value;//个人姓名
|
|
|
+ let address = this.province+this.city+this.area+this.$refs.address.value.replace(/\s+/g, "");//公司详细地址
|
|
|
+ let name = this.$refs.name.value.replace(/\s+/g, "");//个人姓名
|
|
|
let email = this.$refs.email.value;//邮箱
|
|
|
let mytoken = JSON.parse(localStorage.getItem('app-state-session'));
|
|
|
let token = String(mytoken.token);
|
|
|
@@ -149,7 +178,7 @@ import VDistpicker from 'v-distpicker'
|
|
|
let mobile = mytoken.account.mobile;//手机号
|
|
|
let company = {'name':qyname,'address':address};
|
|
|
let account = {'realname':name,'email':email,'mobile':mobile, 'uu':uu}
|
|
|
- if (name != '' && qyname != '' && this.qymingzi) {
|
|
|
+ if (name != '' && qyname != '' && this.qymingzi && this.isaddress && this.isname && this.isspaceName) {
|
|
|
this.$ajax({
|
|
|
url: this.$url.api+"/api/account/accountCenter/companyAccount/save",//http://192.168.253.31:8560
|
|
|
method: 'post',
|
|
|
@@ -163,19 +192,18 @@ import VDistpicker from 'v-distpicker'
|
|
|
}
|
|
|
})
|
|
|
.then(res=>{
|
|
|
- console.log("请求成功",res)
|
|
|
+ // console.log("请求成功",res)
|
|
|
document.documentElement.scrollTop = 0;
|
|
|
- // this.$router.push({name:'company', params:{company:company,account:account}});
|
|
|
this.$router.push({name:'company'})
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
- console.log("请求失败",err)
|
|
|
+ // console.log("请求失败",err)
|
|
|
})
|
|
|
} else {
|
|
|
- this.$refs.tjtishi.innerHTML = '企业名称或姓名不能为空'
|
|
|
+ this.$refs.tjtishi.innerHTML = '企业名称或姓名不能为空或包含有非法字符'
|
|
|
setTimeout(() => {
|
|
|
this.$refs.tjtishi.innerHTML = ''
|
|
|
- }, 2000);
|
|
|
+ }, 3000);
|
|
|
}
|
|
|
|
|
|
},
|