123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <style lang="less">
- page {
- width: 100%;
- height: 100%;
- }
- .login-box {
- box-sizing: border-box;
- width: 100%;
- height: 100%;
- }
- .login {
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0.2);
- image {
- position: relative;
- width: 384rpx;
- height: 144rpx;
- top: 336rpx;
- left: 50%;
- transform: translateX(-50%);
- }
- .bind-btn {
- position: fixed;
- bottom: 200rpx;
- left: 50%;
- transform: translateX(-50%);
- width: 548rpx;
- height: 100rpx;
- line-height: 100rpx;
- border-radius: 56rpx;
- background: rgba(61, 203, 204, 1);
- border: none;
- font-family: PingFang SC;
- font-size: 32rpx;
- font-weight: 400;
- letter-spacing: 0px;
- text-align: center;
- color: #fff;
- }
- }
- </style>
- <template>
- <div class="login-box">
- <page-top-bar title=""
- titleColor="#1B2129"></page-top-bar>
- <div class="login">
- <image src="{{h5StaticPath +'/page-bind-tenant/logo_title.png'}}" alt=""/>
- <button class="bind-btn"
- @click="goBindTenant">登录</button>
- </div>
- </div>
- </template>
- <script>
- import wepy from '@wepy/core';
- import { mapState } from '@wepy/x';
- import store from '@/store';
- import config from '@/config';
- import { wxLogin,checkLoginNew } from '@/service/user';
- wepy.page({
- store,
- data: {
- h5StaticPath: config.h5StaticPath,
- isActivated: 0
- },
- computed: {
- ...mapState({ token: state => state.user.token }),
- ...mapState({ isActivated: state => state.user.isActivated })
- },
- onLoad() {},
- onShow() {
- if (this.isActivated && this.isActivated == 1) {
- // this.goHome();
- checkLoginNew().then(res => {
- console.log(res);
- if (res.data && res.data.isActivated == 1) {
- this.goHome();
- } else {
- // wx.navigateTo({
- // url: '/pages/index'
- // });
- }
- });
- } else {
- this.checkTenantRegist();
- }
- },
- methods: {
- goBindTenant() {
- this.goAuth();
- },
- // 判断用户是否认证过
- checkTenantRegist() {
- wxLogin(1)
- .then(res => {
- this.isActivated = res.isActivated;
- let tokenInfo = {
- expireTime: res.expireTime,
- startTime: res.startTime,
- refreshTokenExpireTime: res.refreshTokenExpireTime,
- refreshToken: res.refreshToken
- };
- store.commit('setToken', res.token);
- store.commit('setActivated', res.isActivated);
- store.commit('setTokenInfo', tokenInfo);
- if (this.isActivated && this.isActivated == 1) {
- // 已经激活
- store.commit('setTokenInfo', res.tokenUser);
- this.goHome();
- } else if (this.isActivated == 0) {
- // 未激活
- // this.goAuth();
- } else {
- // 作废
- }
- })
- .catch(error => {});
- },
- goHome() {
- wx.navigateTo({
- url: '/packagesEnv/pages/home/index'
- });
- // wx.navigateTo({
- // url: '/pages/auth/index'
- // });
- },
- goAuth() {
- console.log('被点击了');
- wx.navigateTo({
- url: '/pages/auth/index'
- });
- }
- },
- created() {}
- });
- </script>
- <config>
- {
- navigationBarTitleText: '登录',
- navigationStyle:"custom",
- usingComponents: {
- 'page-top-bar': '~@/components/common/page-top-bar',
- },
- }
- </config>
|