提交 12dee97d authored 作者: 王鹏飞's avatar 王鹏飞
......@@ -12,6 +12,18 @@ module.exports = {
},
devServer: {
proxy: {
// '/api/passport': {
// target: 'https://passport.ezijing.com',
// pathRewrite: {
// '^/api/passport': '/' // 需要rewrite重写的
// }
// },
// '/usercenter': {
// target: 'https://api-usercenter.ezijing.com',
// pathRewrite: {
// '^/usercenter': '/' // 需要rewrite重写的
// }
// }
/* 多个代理 */
// '/api': {
// target: $GLOBAL.webConf.url,
......
......@@ -1045,14 +1045,6 @@
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
"dev": true
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz",
"integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==",
"requires": {
"babel-runtime": "6.26.0"
}
},
"atob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
......@@ -1361,7 +1353,8 @@
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg=="
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==",
"dev": true
},
"babel-helpers": {
"version": "6.24.1",
......@@ -1893,6 +1886,7 @@
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "2.6.11",
"regenerator-runtime": "0.11.1"
......@@ -3047,7 +3041,8 @@
"core-js": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg=="
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
"dev": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -3330,11 +3325,6 @@
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
"dev": true
},
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
},
"default-gateway": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz",
......@@ -3711,19 +3701,6 @@
"integrity": "sha512-81p6DZ/XmHDD7O0ITJMa7ESo9bSCfE+v3Fny3MIYR0y77xmhoriu2ShNOLXcPS4eowF6dkxw6d2QqxTkS3DjBg==",
"dev": true
},
"element-ui": {
"version": "2.13.2",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.13.2.tgz",
"integrity": "sha512-r761DRPssMPKDiJZWFlG+4e4vr0cRG/atKr3Eqr8Xi0tQMNbtmYU1QXvFnKiFPFFGkgJ6zS6ASkG+sellcoHlQ==",
"requires": {
"async-validator": "1.8.5",
"babel-helper-vue-jsx-merge-props": "2.0.3",
"deepmerge": "1.5.2",
"normalize-wheel": "1.0.1",
"resize-observer-polyfill": "1.5.1",
"throttle-debounce": "1.1.0"
}
},
"elliptic": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
......@@ -6945,11 +6922,6 @@
"sort-keys": "1.1.2"
}
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
......@@ -8061,7 +8033,8 @@
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
"dev": true
},
"regenerator-transform": {
"version": "0.14.4",
......@@ -8275,11 +8248,6 @@
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
},
"resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
......@@ -9655,11 +9623,6 @@
"thenify": "3.3.1"
}
},
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
"integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg=="
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
......
......@@ -6,6 +6,8 @@
<script>
export default {
mounted() {
},
methods: {
goExamResult(e) {
this.$router.replace({
......@@ -23,6 +25,7 @@ export default {
}
},
beforeDestroy() {
// this.$router.back()
window.localStorage.isBack = true
}
}
......
......@@ -2,7 +2,7 @@
<div class="code-login">
<van-form class="login-form" ref="form" v-on="$listeners">
<van-field v-model="ruleForm.account" name="account" label="手机号" placeholder="请输入手机号" />
<van-field v-model="ruleForm.password" name="password" label="验证码" placeholder="请输入验证码">
<van-field v-model="ruleForm.code" name="code" label="验证码" placeholder="请输入验证码">
<template slot="button">
<countdown-button @click.native="onSendCode" ref="countdown"></countdown-button>
</template>
......@@ -20,7 +20,7 @@ export default {
components: { CountdownButton },
data() {
return {
ruleForm: { account: '', password: '' }
ruleForm: { account: '', code: '' }
}
},
methods: {
......@@ -28,7 +28,7 @@ export default {
if (!this.ruleForm.account) {
this.$notify('请输手机号')
return false
} else if (!this.ruleForm.password) {
} else if (!this.ruleForm.code) {
this.$notify('请输入验证码')
return false
}
......
......@@ -6,24 +6,24 @@
</h1>
<div class="login-box">
<div class="login-hd">
<h2 class="login-title">登录</h2>
<h2 class="login-title">绑定</h2>
</div>
<div class="login-bd">
<div class="login-form">
<!-- 账号登录 -->
<account-login ref="form" @submit="onSubmit"></account-login>
<account-login ref="form" @submit="onSubmit" v-if="!this.isWechat"></account-login>
<!-- 验证码登录 -->
<!-- <code-login ref="form" @submit="onSubmit"></code-login> -->
<div class="login-button" @click="handleSubmit">立即登录</div>
<code-login ref="form" @submit="onSubmit" v-if="this.isWechat"></code-login>
<div class="login-button" @click="handleSubmit">立即绑定</div>
</div>
</div>
<div class="login-ft">
<!-- <div class="login-ft">
<ul>
<li @click="wechatLogin">
<img src="../../assets/images/login_wechat.png" alt="微信登录" />微信登录
</li>
</ul>
</div>
</div> -->
</div>
</div>
</template>
......@@ -40,8 +40,9 @@ export default {
const UA = navigator.userAgent.toLowerCase()
return {
ruleForm: {
type: 1,
type: 2,
account: '',
code: '',
password: '',
RememberMe: true,
service: 'https://h5.ezijing.com'
......@@ -68,7 +69,14 @@ export default {
},
// 提交
onSubmit(data) {
this.unionid ? this.bindWechat(data) : this.loginRequest(data)
if (this.isWechat) {
this.ruleForm.type = 2
this.bindWechat(data)
} else {
this.ruleForm.type = 1
this.loginRequest(data)
}
// !this.isWechat ? this.bindWechat(data) : this.loginRequest(data)
},
// 登录
loginRequest(data) {
......@@ -83,10 +91,11 @@ export default {
})
},
// 绑定微信并登录
bindWechat() {
const data = Object.assign({}, this.ruleForm, { unionid: this.unionid })
bindWechat(data) {
const params = Object.assign({}, this.ruleForm, data, { unionid: this.unionid })
console.log(params)
api
.bindWechat(data)
.bindWechat(params)
.then(response => {
this.loginSuccess(response)
})
......@@ -117,9 +126,10 @@ export default {
}
},
wechatLogin() {
if (this.$route.query.type) { return false }
const appId = 'wx451c01d40d090d7a'
// 回调地址
const redirectURI = `https://passport.ezijing.com/rest/wechat/oauth-callback?needCheck=false&identity=transport&redirectUrl=${window.location.origin}/login`
const redirectURI = `https://passport.ezijing.com/rest/wechat/oauth-callback?needCheck=false&identity=transport&redirectUrl=${this.redirectUrl}`
// 微信的地址
const wechatUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(
redirectURI
......@@ -134,14 +144,20 @@ export default {
)
}
},
async created() {
const isLogin = await this.$store.dispatch('checkLogin')
console.log(!this.checkWechatLogin(), '==============')
if (!isLogin) {
if (this.isWechat && !this.checkWechatLogin()) {
this.wechatLogin()
created() {
if (this.isWechat) {
if (this.checkWechatLogin()) {
this.redirectUrl = `${window.location.origin}/login?type=1`
} else {
if (!Cookies.get('TGC')) {
this.redirectUrl = `${window.location.origin}/login?type=1`
} else {
this.$router.push('/index')
return false
}
}
this.wechatLogin()
}
}
}
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论