| | |
| | | <!-- 企业登录 --> |
| | | <template> |
| | | <view class="companylogin"> |
| | | <u-navbar :autoBack="true" bgColor="transparent"> |
| | | <template slot="center"> |
| | | |
| | | </template> |
| | | </u-navbar> |
| | | <view class="image-box"> |
| | | <image src="https://picsum.photos/760/345" mode="aspectFit" ></image> |
| | | <image src="/static/policy/loginHeader.png" mode="widthFix" ></image> |
| | | </view> |
| | | <view class="content-box"> |
| | | <!-- <u-form label-width="60" labelAlign="right" > |
| | |
| | | <view style="margin-top: 56rpx;"> |
| | | <view class="per-button" @click="loging">登录</view> |
| | | </view> |
| | | <!-- v-if="form.userType == '02'" --> |
| | | <view @click="goRegister" class="company-register"> |
| | | <view @click="goRegister" class="company-register" v-if="form.userType == '02'"> |
| | | 企业注册 |
| | | </view> |
| | | <!-- <u--text text="企业注册" type="primary" @click="goRegister"></u--text> --> |
| | | </view> |
| | | <selectVue ref="selectVue" @select="select"></selectVue> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | // 00营商办,01执法,02企业 区分不同的登陆页面 |
| | | import { getCode, codeLogin, getInfo } from '@/api/auth.js' |
| | | import { getCode, codeLogin, getInfo, getCompanyList } from '@/api/auth.js' |
| | | import selectVue from '@/components/select.vue' |
| | | export default { |
| | | components: { |
| | | selectVue |
| | | }, |
| | | data() { |
| | | return { |
| | | tips: '获取验证码', |
| | |
| | | loginToken: '', |
| | | isSendCode: false, |
| | | countdownTime: 20, |
| | | timer: '' |
| | | timer: '', |
| | | sessionToken: "", |
| | | userInfo: {} |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | |
| | | title: '正在获取验证码' |
| | | }) |
| | | getCode({phone: this.form.phone }).then(val => { |
| | | this.startCountdown() |
| | | uni.hideLoading(); |
| | | uni.$u.toast('验证码已发送'); |
| | | if(val.data.code == 200) { |
| | | this.startCountdown() |
| | | uni.hideLoading(); |
| | | this.tips = `${this.countdownTime}s后重新获取` |
| | | uni.$u.toast('验证码已发送'); |
| | | } |
| | | }).catch(err => { |
| | | this.isSendCode = false |
| | | }) |
| | | } else { |
| | | uni.$u.toast('倒计时结束后再发送'); |
| | |
| | | }, 1000) |
| | | }, |
| | | loging() { |
| | | if(!this.form.phone){ |
| | | uni.showToast({ |
| | | title: '请输入手机号', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | if(!this.form.code){ |
| | | uni.showToast({ |
| | | title: '请输入验证码', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | codeLogin(this.form).then(val => { |
| | | if(val.data.token) { |
| | | this.loginToken = val.data.token |
| | |
| | | }, |
| | | getInfo() { |
| | | getInfo().then(val => { |
| | | console.log(val) |
| | | uni.setStorageSync('userInfo', val.data.data) |
| | | |
| | | if(this.form.userType == '02') { |
| | | uni.redirectTo({ |
| | | url:`/pages/companyIndex/companyIndex` |
| | | }) |
| | | } else if(this.form.userType == '01'){ |
| | | uni.redirectTo({ |
| | | url:`/policy/policyIndex/policyIndex` |
| | | // uni.setStorageSync('userInfo', val.data.data) |
| | | if(val.data.code === 200) { |
| | | this.userInfo = val.data.data |
| | | if(this.form.userType == '02') { |
| | | // 获取企业 |
| | | |
| | | this.getCompanyList(val.data.data.phonenumber) |
| | | } else if(this.form.userType == '01'){ |
| | | uni.setStorageSync('userInfo', val.data.data) |
| | | // uni.setStorageSync('sessionToken', this.loginToken) |
| | | uni.reLaunch({ |
| | | url:`/policy/policyIndex/policyIndex` |
| | | }) |
| | | } else { |
| | | uni.setStorageSync('userInfo', val.data.data) |
| | | // uni.setStorageSync('sessionToken', this.loginToken) |
| | | uni.reLaunch({ |
| | | url:`/policy/policyIndex/policyIndex` |
| | | }) |
| | | } |
| | | } else { |
| | | uni.removeStorageSync('sessionToken') |
| | | uni.showToast({ |
| | | title: val.data.msg, |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | |
| | | }).catch(err => { |
| | | uni.removeStorageSync('sessionToken') |
| | | }) |
| | | }, |
| | | goRegister() { |
| | | uni.navigateTo({ |
| | | url: `/pages/registerCompany/registerCompany` |
| | | }) |
| | | }, |
| | | getCompanyList(companyPhone) { |
| | | getCompanyList({companyPhone, companyStatus: 0, checkStatus: 2}).then(val => { |
| | | if(val.data.rows.length > 1){ |
| | | this.$refs.selectVue.open(val.data.rows) |
| | | } else { |
| | | uni.setStorageSync('userInfo', this.userInfo) |
| | | uni.reLaunch({ |
| | | url:`/qiye/qiyeIndex/qiyeIndex?id=${this.userInfo.deptId}` |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | select(event){ |
| | | uni.setStorageSync('userInfo', this.userInfo) |
| | | uni.reLaunch({ |
| | | url:`/qiye/qiyeIndex/qiyeIndex?id=${event}` |
| | | }) |
| | | } |
| | | } |
| | |
| | | border-radius: 40rpx 40rpx 0 0; |
| | | padding: 40rpx 32rpx; |
| | | position: relative; |
| | | top: -40rpx; |
| | | top: 80rpx; |
| | | background-color: white; |
| | | .form { |
| | | .form-item{ |
| | |
| | | background: #F0F8FF; |
| | | } |
| | | } |
| | | /deep/ .u-radio { |
| | | margin-bottom: 20rpx; |
| | | } |
| | | </style> |