| | |
| | | <template>
|
| | | <view class="main_app">
|
| | | <image class="login_bg" src="@/static/login_bg@2x.png" mode="widthFix" />
|
| | | <image class="login_bg" src="@/static/staff/shenfen_bg@2x.png" mode="widthFix" />
|
| | | <view class="h1">安泰物流智慧园区</view>
|
| | | <view class="placeholder6 place">请选择您的身份</view>
|
| | | <view class="item" @click="userAuth(1)">
|
| | |
| | |
|
| | | <script>
|
| | | import {
|
| | | wxAuthorizea, |
| | | wxAuthorizea,
|
| | | getUserInfo
|
| | | } from '@/api'
|
| | | import {
|
| | |
| | | export default {
|
| | | data() {
|
| | | return {
|
| | | code: '091RVIkl2SZXDe4WySll2pAL8D1RVIkb'
|
| | | code: ''
|
| | | }
|
| | | },
|
| | | onLoad() {
|
| | | onShow() {
|
| | | var that = this
|
| | | let url = window.location.href
|
| | | let url = 'https://atwl.ahzyssl.com/zhyq_h5/#/'
|
| | | let code = ''
|
| | | if (url.indexOf('code=') !== -1) {
|
| | | if (window.location.href.indexOf('code=') !== -1 || this.code) {
|
| | |
|
| | | } else { |
| | | return
|
| | | let url = window.location.href
|
| | | } else {
|
| | | // let url = window.location.href
|
| | | const appID = 'wx173e6caf5abc718a'
|
| | | let uri = encodeURIComponent(url)
|
| | | let authURL =
|
| | |
| | | let url = window.location.href
|
| | | let code = ''
|
| | | if (url.indexOf('code=') !== -1 || this.code) {
|
| | | // const query = url.split('?')
|
| | | // for (const q of query) {
|
| | | // if (q.indexOf('code=') !== -1) {
|
| | | // let statusIndex = q.indexOf('&state') - 1
|
| | | // code = q.substring(q.indexOf('code=') + 5, statusIndex)
|
| | | // }
|
| | | // }
|
| | | const query = url.split('?')
|
| | | for (const q of query) {
|
| | | if (q.indexOf('code=') !== -1) {
|
| | | let statusIndex = q.indexOf('&state')
|
| | | code = q.substring(q.indexOf('code=') + 5, statusIndex)
|
| | | }
|
| | | }
|
| | | wxAuthorizea({
|
| | | code: code || this.code,
|
| | | source: source
|
| | |
| | | that.$store.commit('setOpenId', res.data.openid)
|
| | | if (res.data.member) {
|
| | | that.$store.commit('setMember', res.data.member)
|
| | | } |
| | | if (res.data.token) { |
| | | that.$store.commit('setToken', res.data.token) |
| | | getUserInfo().then(ress => { |
| | | that.$store.commit('setUserInfo', ress.data) |
| | | }) |
| | | }
|
| | | let flag = res.data.member && res.data.member.id
|
| | | setTimeout(() => { |
| | | if (source == 0) { |
| | | this.driverLogin(flag) |
| | | } else if (source == 2) { |
| | | this.staffLogin(flag) |
| | | } else { |
| | | this.jump('/pages/index/index') |
| | | } |
| | | setTimeout(() => {
|
| | | if (source == 0) {
|
| | | if (res.data.token) {
|
| | | that.$store.commit('setToken', res.data.token)
|
| | | getUserInfo().then(ress => {
|
| | | that.$store.commit('setDriverInfo', ress.data)
|
| | | })
|
| | | }
|
| | | this.driverLogin(flag)
|
| | | } else if (source == 2) {
|
| | | if (res.data.token) {
|
| | | that.$store.commit('setToken', res.data.token)
|
| | | getUserInfo().then(ress => {
|
| | | that.$store.commit('setUserInfo', ress.data)
|
| | | })
|
| | | }
|
| | | this.staffLogin(flag)
|
| | | } else {
|
| | | this.jump('/pages/index/index')
|
| | | }
|
| | | }, 300)
|
| | | }
|
| | | })
|
| | | }
|
| | | // }
|
| | | // 刷新token
|
| | | // setTimeout(() => {
|
| | | // refreshToken().then(res => {
|
| | | // if (res.code && res.code === 200) {
|
| | | // this.$store.commit('setToken', res.data)
|
| | | // }
|
| | | // })
|
| | | // }, 3000)
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | <style lang="scss">
|
| | | .main_app {
|
| | | width: 100vw; |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | width: 100vw;
|
| | | box-sizing: border-box;
|
| | | overflow: hidden;
|
| | | margin: 0;
|
| | | height: 100vh;
|
| | | padding-top: 80rpx;
|
| | |
| | |
|
| | | .login_bg {
|
| | | position: absolute;
|
| | | top: 0; |
| | | top: 0;
|
| | | left: 0;
|
| | | width: 100%;
|
| | | z-index: -1;
|