| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <template>
- <view class="login">
- </view>
- </template>
- <script>
- import {
- mapGetters,
- mapMutations
- } from 'vuex'
- import {
- currentPage,
- trottle,
- urlencode
- } from '@/utils/tools'
- import Cache from "@/utils/cache"
- import {
- BACK_URL,
- INVITE_CODE
- } from '@/config/cachekey'
- export default {
- data() {
- return {
- token: null,
- loginUrl: 'https://www.jucai.gov.cn/mobile/auth/login/company?redirect_url='
- };
- },
- async onLoad(option) {
- this.authLoginJucai();
- },
- onShow() {},
- onUnload() {
- },
- methods: {
- ...mapMutations(['login']),
- async authLoginJucai() {
- const {
- token
- } = this.$Route.query
- console.log('token: ' + token)
- if (token || this.appConfig.token) {
- // uni.showLoading({
- // title: '登录中...',
- // mask: true
- // });
- this.loginHandle(token || this.appConfig.token)
- } else {
- uni.showLoading({
- title: '仅对企业开放',
- mask: true,
- complete: () => {
- //延迟0.5s登录,提示用户信息
- setTimeout(() => {
- location.href = this.loginUrl + urlencode(location.href)
- }, 500)
- }
- });
- }
- },
- // 登录结果处理
- async loginHandle(token) {
- //保存token,获取用户
- this.login({
- token: token
- })
- uni.hideLoading()
- //跳转逻辑
- if (getCurrentPages().length > 1) {
- uni.navigateBack({
- success() {
- const {
- onLoad,
- options
- } = currentPage()
- onLoad && onLoad(options)
- }
- })
- } else if (Cache.get(BACK_URL)) {
- this.$Router.replace(Cache.get(BACK_URL))
- } else {
- this.$Router.pushTab('/pages/index/index')
- }
- Cache.remove(BACK_URL)
- },
- },
- computed: {
- ...mapGetters(['appConfig']),
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: #fff;
- text-align: center;
- padding: 0;
- .login {
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- .mpwx-login {
- min-height: 0;
- flex: 1;
- .avatar {
- display: inline-block;
- width: 120rpx;
- height: 120rpx;
- border-radius: 50%;
- border: 1px solid #eee;
- overflow: hidden;
- }
- .user-name {
- height: 40rpx;
- }
- .image {
- width: 50rpx;
- height: 50rpx;
- }
- .btn {
- background-color: #09BB07;
- width: 580rpx;
- margin: 80rpx auto 0;
- }
- }
- .acount-login {
- padding-top: 100rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- box-sizing: border-box;
- min-height: 0;
- flex: 1;
- .logo {
- height: 120rpx;
- margin-bottom: 50rpx;
- }
- .input {
- width: 670rpx;
- border-bottom: $-solid-border;
- margin-top: 30rpx;
- }
- .sms-btn {
- border: 1px solid $-color-primary;
- width: 176rpx;
- height: 60rpx;
- box-sizing: border-box;
- }
- .wx-login {
- margin-top: 60rpx;
- .image {
- margin-top: 40rpx;
- width: 80rpx;
- height: 80rpx;
- }
- }
- }
- }
- }
- .password-icon {
- width: 58rpx;
- height: 58rpx;
- overflow: hidden;
- margin-left: 20rpx;
- image {
- width: 100%;
- }
- }
- .agreement {
- position: fixed;
- bottom: 0px;
- width: 100%;
- padding: 30rpx 0;
- }
- .modify-container {
- padding: 40rpx 30rpx;
- width: 100%;
- border-radius: 30rpx;
- font-size: 28rpx;
- text-align: left;
- color: #333333;
- font-weight: bold;
- .title {
- padding: 26rpx 0rpx;
- }
- .btn {
- height: 80rpx;
- border-radius: 20rpx;
- margin: 60rpx 50rpx 0;
- }
- }
- </style>
|