10
src/App.vue
|
@ -484,7 +484,7 @@ textarea {
|
||||||
line-height: .42rem;
|
line-height: .42rem;
|
||||||
padding-top: .02rem;
|
padding-top: .02rem;
|
||||||
background-color: #d1d5ff;
|
background-color: #d1d5ff;
|
||||||
background-image: url(../assets/../assets/images/home/index/arrow-more.png);
|
background-image: url(./assets/images/home/index/arrow-more.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: 1.18rem center;
|
background-position: 1.18rem center;
|
||||||
background-size: .11rem .2rem;
|
background-size: .11rem .2rem;
|
||||||
|
@ -693,7 +693,7 @@ textarea {
|
||||||
display: block;
|
display: block;
|
||||||
width: .16rem;
|
width: .16rem;
|
||||||
height: .28rem;
|
height: .28rem;
|
||||||
background-image: url(../assets/images/home/expert/arrow-notice.png);
|
background-image: url(./assets/images/home/expert/arrow-notice.png);
|
||||||
background-size: .16rem .28rem;
|
background-size: .16rem .28rem;
|
||||||
}
|
}
|
||||||
.expert-receive-01{
|
.expert-receive-01{
|
||||||
|
@ -732,7 +732,7 @@ textarea {
|
||||||
.addr-select{
|
.addr-select{
|
||||||
width: 2.5rem;
|
width: 2.5rem;
|
||||||
height: .8rem;
|
height: .8rem;
|
||||||
background-image: url(../assets/images/home/expert/arrow-down.png);
|
background-image: url(./assets/images/home/expert/arrow-down.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: .22rem .12rem;
|
background-size: .22rem .12rem;
|
||||||
background-position: center right;
|
background-position: center right;
|
||||||
|
@ -1242,7 +1242,7 @@ textarea::-webkit-input-placeholder{
|
||||||
}
|
}
|
||||||
.ask-top{
|
.ask-top{
|
||||||
padding: .6rem 0 .55rem;
|
padding: .6rem 0 .55rem;
|
||||||
background-image: url(../assets/images/home/expert/expert-bg.png);
|
background-image: url(./assets/images/home/expert/expert-bg.png);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
border-radius: .1rem;
|
border-radius: .1rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -2260,7 +2260,7 @@ textarea::-webkit-input-placeholder{
|
||||||
padding: 0 .1rem;
|
padding: 0 .1rem;
|
||||||
border: .02rem solid #dedede;
|
border: .02rem solid #dedede;
|
||||||
border-radius: .04rem;
|
border-radius: .04rem;
|
||||||
background-image: url(../assets/images/home/expert/arrow-down.png);
|
background-image: url(./assets/images/home/expert/arrow-down.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: .22rem .12rem;
|
background-size: .22rem .12rem;
|
||||||
background-position: 3.1rem center;
|
background-position: 3.1rem center;
|
||||||
|
|
Before Width: | Height: | Size: 672 B After Width: | Height: | Size: 672 B |
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 611 B |
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 765 B |
Before Width: | Height: | Size: 435 B After Width: | Height: | Size: 435 B |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 856 B |
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 660 B |
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 636 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 509 B |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 157 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 323 KiB After Width: | Height: | Size: 323 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 456 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 220 KiB |
Before Width: | Height: | Size: 6.7 KiB |
27
src/main.js
|
@ -3,7 +3,32 @@ import axios from 'axios'
|
||||||
import VueAxios from 'vue-axios'
|
import VueAxios from 'vue-axios'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
Vue.config.productionTip = false
|
// Vue.config.productionTip = false
|
||||||
|
Vue.prototype.HOME = '/api'
|
||||||
|
|
||||||
|
|
||||||
|
axios.interceptors.request.use(config => {
|
||||||
|
console.log(config.url)
|
||||||
|
// config.headers.Authorization = "Basic c2FiZXI6c2FiZXJfc2VjcmV0"
|
||||||
|
// if (config.url!="/hysc/auth/token") {
|
||||||
|
// if (!localStorage.token) {
|
||||||
|
// router.replace('/');
|
||||||
|
// return config
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// config.headers.common['Blade-Auth'] =localStorage.token
|
||||||
|
|
||||||
|
// if (config.url!="/hysc/auth/token") {
|
||||||
|
// if (!localStorage.token) {
|
||||||
|
|
||||||
|
// router.replace('/');
|
||||||
|
// return config
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
return config
|
||||||
|
})
|
||||||
Vue.use(VueAxios, axios)
|
Vue.use(VueAxios, axios)
|
||||||
new Vue({
|
new Vue({
|
||||||
router,
|
router,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import VueRouter from 'vue-router'
|
import VueRouter from 'vue-router'
|
||||||
import login from '../views/login.vue'
|
import login from '../views/login.vue'
|
||||||
|
import verification from '../views/login/verification.vue'
|
||||||
|
|
||||||
Vue.use(VueRouter)
|
Vue.use(VueRouter)
|
||||||
|
|
||||||
|
@ -10,7 +11,11 @@ const routes = [
|
||||||
name: 'login',
|
name: 'login',
|
||||||
component: login
|
component: login
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/verification',
|
||||||
|
name: 'verification',
|
||||||
|
component: verification
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="login pull-content list-section">
|
<div class="login pull-content list-section">
|
||||||
<div class="login-txt">
|
<div class="login-txt">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<img src="../../assets/images/login/logo.png" alt="" />
|
<img src="../assets/images/login/logo.png" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="company">有谱志愿</div>
|
<div class="company">有谱志愿</div>
|
||||||
<div class="phone-number" v-if="mode == 1">
|
<div class="phone-number" v-if="mode == 1">
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
@click="isAgreement = !isAgreement"
|
@click="isAgreement = !isAgreement"
|
||||||
><img
|
><img
|
||||||
v-show="isAgreement"
|
v-show="isAgreement"
|
||||||
src="../../assets/images/login/yes.png"
|
src="../assets/images/login/yes.png"
|
||||||
alt=""
|
alt=""
|
||||||
/></span>
|
/></span>
|
||||||
<p>
|
<p>
|
||||||
|
@ -30,11 +30,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="login-btns">
|
<div class="login-btns">
|
||||||
<span @click="nailLogin()" v-if="mode == 0" class="nail-btn"
|
<span @click="nailLogin()" v-if="mode == 0" class="nail-btn"
|
||||||
><img src="../../assets/images/login/nail.png" />钉钉授权登录</span
|
><img src="../assets/images/login/nail.png" />钉钉授权登录</span
|
||||||
>
|
|
||||||
<span @click="phoneLogin(phoneNumber)" v-if="mode == 1"
|
|
||||||
>获取验证码</span
|
|
||||||
>
|
>
|
||||||
|
<span @click="phoneLogin()" v-if="mode == 1">获取验证码</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="login-mode">
|
<div class="login-mode">
|
||||||
|
@ -42,20 +40,18 @@
|
||||||
<ul class="mode-item">
|
<ul class="mode-item">
|
||||||
<li>
|
<li>
|
||||||
<span @click="changeMode(0)"
|
<span @click="changeMode(0)"
|
||||||
><img src="../../assets/images/login/nail.png"
|
><img src="../assets/images/login/nail.png"
|
||||||
/></span>
|
/></span>
|
||||||
<p :class="{ active: mode == 0 }">当前登录方式</p>
|
<p :class="{ active: mode == 0 }">当前登录方式</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span @click="changeMode(1)"
|
<span @click="changeMode(1)"
|
||||||
><img src="../../assets/images/login/phone.png"
|
><img src="../assets/images/login/phone.png"
|
||||||
/></span>
|
/></span>
|
||||||
<p :class="{ active: mode == 1 }">当前登录方式</p>
|
<p :class="{ active: mode == 1 }">当前登录方式</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- 阅读协议弹窗 -->
|
<!-- 阅读协议弹窗 -->
|
||||||
<div
|
<div
|
||||||
|
@ -77,14 +73,14 @@
|
||||||
></div>
|
></div>
|
||||||
<div class="nail-popup" v-show="openEmpower">
|
<div class="nail-popup" v-show="openEmpower">
|
||||||
<div class="nail-popup-title">
|
<div class="nail-popup-title">
|
||||||
<span><img src="../../assets/images/login/logo.png" alt="" /></span>
|
<span><img src="../assets/images/login/logo.png" alt="" /></span>
|
||||||
<p>有谱志愿</p>
|
<p>有谱志愿</p>
|
||||||
<em>申请</em>
|
<em>申请</em>
|
||||||
</div>
|
</div>
|
||||||
<p>获取您的钉钉昵称</p>
|
<p>获取您的钉钉昵称</p>
|
||||||
<div class="nick-name">
|
<div class="nick-name">
|
||||||
<span>钉钉昵称</span>
|
<span>钉钉昵称</span>
|
||||||
<p>张三<img src="../../assets/images/login/green-yes.png" alt="" /></p>
|
<p>张三<img src="../assets/images/login/green-yes.png" alt="" /></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="nail-popup-btns">
|
<div class="nail-popup-btns">
|
||||||
<span @click="isEmpower()">同意</span>
|
<span @click="isEmpower()">同意</span>
|
||||||
|
@ -98,7 +94,7 @@
|
||||||
@click="openPhoneTips = !openPhoneTips"
|
@click="openPhoneTips = !openPhoneTips"
|
||||||
></div>
|
></div>
|
||||||
<div class="my-confirm my-confirm2" v-show="openPhoneTips">
|
<div class="my-confirm my-confirm2" v-show="openPhoneTips">
|
||||||
<p>{{ tipsMsg }}</p>
|
<!-- <p>{{ tipsMsg }}</p> -->
|
||||||
<div class="confirm-btns">
|
<div class="confirm-btns">
|
||||||
<span @click="openPhoneTips = false">确认</span>
|
<span @click="openPhoneTips = false">确认</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -107,33 +103,26 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "login",
|
name: "login",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isScrollTop: false,
|
isScrollTop: false,
|
||||||
mode: 0, //登录方式
|
mode: 1, //登录方式
|
||||||
openAgreement: false, //阅读协议弹窗
|
openAgreement: false, //阅读协议弹窗
|
||||||
isAgreement: false, //阅读协议状态
|
isAgreement: false, //阅读协议状态
|
||||||
openEmpower: false, //钉钉授权状态
|
openEmpower: false, //钉钉授权状态
|
||||||
openPhoneTips: false, //验证手机号弹出框
|
openPhoneTips: false, //验证手机号弹出框
|
||||||
phoneNumber: "",
|
phoneNumber: "13608235524",
|
||||||
tipsMsg: "请填写手机号",
|
phone: "",
|
||||||
username: "",
|
|
||||||
password: "",
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.isScroll = true;
|
this.isScroll = true;
|
||||||
window.addEventListener("scroll", this.eventScrollTop);
|
window.addEventListener("scroll", this.eventScrollTop);
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {},
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
// 钉钉授权登录
|
// 钉钉授权登录
|
||||||
nailLogin() {
|
nailLogin() {
|
||||||
if (this.isAgreement) {
|
if (this.isAgreement) {
|
||||||
|
@ -143,32 +132,28 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 手机号登录
|
// 手机号登录
|
||||||
phoneLogin(number) {
|
phoneLogin() {
|
||||||
if (this.phoneNumber.match(/^\s*$/)) {
|
var reg_tel =
|
||||||
this.tipsMsg = "手机号不能为空";
|
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
||||||
this.openPhoneTips = true;
|
if (this.phoneNumber == "") {
|
||||||
|
alert("请填写您的手机号码!");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (
|
} else if (!reg_tel.test(this.phoneNumber)) {
|
||||||
!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(
|
alert("请正确填写您的手机号码!");
|
||||||
this.phoneNumber
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
this.tipsMsg = "请填写正确的手机号码";
|
|
||||||
this.openPhoneTips = true;
|
|
||||||
this.phoneNumber = "";
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
if (this.isAgreement) {
|
|
||||||
this.$router.push({
|
|
||||||
path: "/login/verification",
|
|
||||||
query: {
|
|
||||||
number: number,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.openAgreement = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.axios
|
||||||
|
.post(this.HOME+"/api/common/send-sms-captcha", {
|
||||||
|
phone:this.phoneNumber,
|
||||||
|
type: "login",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
this.$router("/")
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 同意钉钉授权
|
// 同意钉钉授权
|
||||||
|
|
|
@ -0,0 +1,151 @@
|
||||||
|
<template>
|
||||||
|
<div class="content">
|
||||||
|
<!-- 头部 -->
|
||||||
|
<div :class="{'header':true,'scroll white':isScrollTop,'white':true}">
|
||||||
|
<div class="back" @click="$router.go(-1)"><img src="../../assets/images/home/expert/back.png" alt=""></div>
|
||||||
|
<div class="header-title">手机验证码</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="verification pull-content list-section">
|
||||||
|
<div class="verification-txt">
|
||||||
|
<p>输入验证码</p>
|
||||||
|
<span>验证码已发送至 +86 {{phoneData}}</span>
|
||||||
|
<div class="result">
|
||||||
|
<div class="security-code-wrap">
|
||||||
|
<label for="code">
|
||||||
|
<ul class="security-code-container">
|
||||||
|
<li class="field-wrap" v-for="(item, index) in number" :key="index">
|
||||||
|
<i class="char-field">{{value[index] || placeholder}}</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</label>
|
||||||
|
<input ref="input" class="input-code" @keyup="handleInput($event)" v-model="value" id="code" name="code" type="tel" :maxlength="number" autocorrect="off" autocomplete="off" autocapitalize="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span v-show="!show">{{count}}秒后可重新获取验证码</span>
|
||||||
|
<div v-show="show" @click="getCode()" class="getCode">获取验证码</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "login-verification",
|
||||||
|
props: {
|
||||||
|
number: {
|
||||||
|
type: Number,
|
||||||
|
default: 4
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: '-'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isScrollTop: false,
|
||||||
|
phoneData: '', //手机号
|
||||||
|
verification: '', //验证码
|
||||||
|
value: '',
|
||||||
|
show: false, //显示获取验证码
|
||||||
|
count: '', //剩余时间
|
||||||
|
timer: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.isScroll = true;
|
||||||
|
window.addEventListener("scroll", this.eventScrollTop);
|
||||||
|
this.phoneData = this.$route.query.number;
|
||||||
|
const TIME_COUNT = 60;
|
||||||
|
if (!this.timer) {
|
||||||
|
this.count = TIME_COUNT;
|
||||||
|
this.show = false;
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
if (this.count > 0 && this.count <= TIME_COUNT) {
|
||||||
|
this.count--;
|
||||||
|
} else {
|
||||||
|
this.show = true;
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
hideKeyboard() {
|
||||||
|
// 输入完成隐藏键盘
|
||||||
|
document.activeElement.blur() // ios隐藏键盘
|
||||||
|
this.$refs.input.blur() // android隐藏键盘
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
this.$emit('input', this.value)
|
||||||
|
},
|
||||||
|
handleInput() {
|
||||||
|
this.$refs.input.value = this.value
|
||||||
|
if (this.value.length >= this.number) {
|
||||||
|
this.hideKeyboard()
|
||||||
|
}
|
||||||
|
this.handleSubmit()
|
||||||
|
},
|
||||||
|
// 倒计时60s
|
||||||
|
getCode(){
|
||||||
|
const TIME_COUNT = 60;
|
||||||
|
if (!this.timer) {
|
||||||
|
this.count = TIME_COUNT;
|
||||||
|
this.show = false;
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
if (this.count > 0 && this.count <= TIME_COUNT) {
|
||||||
|
this.count--;
|
||||||
|
} else {
|
||||||
|
this.show = true;
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 滚动改变样式
|
||||||
|
eventScrollTop() {
|
||||||
|
let scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
||||||
|
if (scrollTop >= 5) {
|
||||||
|
if (this.isScroll) {
|
||||||
|
this.isScroll = false;
|
||||||
|
this.isScrollTop = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!this.isScroll) {
|
||||||
|
this.isScroll = true;
|
||||||
|
this.isScrollTop = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
window.removeEventListener("scroll", this.eventScrollTop);
|
||||||
|
},
|
||||||
|
//keep-alive进入时触发
|
||||||
|
activated() {
|
||||||
|
this.isScroll = true;
|
||||||
|
window.addEventListener("scroll", this.eventScrollTop)
|
||||||
|
},
|
||||||
|
//keep-alive离开时触发
|
||||||
|
deactivated() {
|
||||||
|
window.removeEventListener("scroll", this.eventScrollTop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,22 @@
|
||||||
|
module.exports = {
|
||||||
|
devServer: {
|
||||||
|
proxy: {
|
||||||
|
|
||||||
|
'/api': {
|
||||||
|
target: 'https://ypzy.emingren.com', // 你请求的第三方接口
|
||||||
|
|
||||||
|
changeOrigin: true, // 在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
|
||||||
|
|
||||||
|
pathRewrite: { // 路径重写,
|
||||||
|
|
||||||
|
'^/api': '' // 替换target中的请求地址,也就是说以后你在请求http://api.douban.com/v2/XXXXX这个地址的时候直接写成/api即可。
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|