图片路径转码
replaceStr(str
) {
str
= str
.replace(/%3A/g, ":");
str
= str
.replace(/%2F/g, "/");
str
= str
.replace(/%3F/g, "?");
str
= str
.replace(/%3D/g, "=");
str
= str
.replace(/%26/g, "&");
str
= str
.replace(/%2B/g, "+");
str
= str
.replace(/%20/g, " ");
str
= str
.replace(/%23/g, "#");
return str
;
}
获取当前时间
getTime(){
var date
= new Date();
var seperator1
= "-";
var seperator2
= ":";
var year
= date
.getFullYear();
var month
= date
.getMonth() + 1;
var strDate
= date
.getDate();
var minute
= date
.getMinutes();
var hour
= date
.getHours();
var second
= date
.getSeconds();
if (month
>= 1 && month
<= 9) {
month
= "0" + month
;
}
if (strDate
>= 0 && strDate
<= 9) {
strDate
= "0" + strDate
;
}
if (hour
>= 0 && hour
<= 9) {
hour
= "0" + hour
;
}
if (minute
>= 0 && minute
<= 9) {
minute
= "0" + minute
;
}
if (second
>= 0 && second
<= 9) {
second
= "0" + second
;
}
var currentdate
= month
+ seperator1
+ strDate
+ " " +hour
+ seperator2
+ minute
;
this.time
=currentdate
return currentdate
;
}
返回url指定参数
GetUrlParam(name
) {
var reg
= new RegExp("(^|&)" + name
+ "=([^&]*)(&|$)");
var r
= window
.location
.search
.substr(1).match(reg
);
if (r
!= null) return unescape(r
[2]);
return null;
}
//短信验证60s
count
: '',
timer
: null,
codeShow
:true,
getCode(){
const TIME_COUNT = 60;
if (!this.timer
) {
this.count
= TIME_COUNT;
this.codeShow
= false;
this.timer
= setInterval(() => {
if (this.count
> 0 && this.count
<= TIME_COUNT) {
this.count
--;
} else {
this.codeShow
= true;
clearInterval(this.timer
);
this.timer
= null;
}
}, 1000)
}
},
sendyz(){
this.tel
= this.$refs
.tel
.value
;
const reg
= /^1([38]\d|5[0-35-9]|7[3678])\d{8}$/;
if (this.tel
== '' || this.tel
<= 10 || !reg
.test(this.tel
)) {
this.hint
= '请填写正确手机号'
} else {
this.getCode();
this.hint
=''
this.$axios({
method
: '',
url
: '',
params
: {sjh
:this.tel
}
}).then((res
) => {console
.log(res
);})
.catch(err
=> {console
.log(err
)})
}
}
转载请注明原文地址: https://lol.8miu.com/read-33202.html