From cc610ef597a4b600b4c48c80026f3a99be171f3b Mon Sep 17 00:00:00 2001 From: yuanhao <yuanhao_2024> Date: 星期一, 19 五月 2025 18:03:48 +0800 Subject: [PATCH] fix: scss跟背景图 --- pages/companyLogin/companyLogin.vue | 111 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 90 insertions(+), 21 deletions(-) diff --git a/pages/companyLogin/companyLogin.vue b/pages/companyLogin/companyLogin.vue index 3188d7d..9249231 100644 --- a/pages/companyLogin/companyLogin.vue +++ b/pages/companyLogin/companyLogin.vue @@ -1,8 +1,13 @@ <!-- 浼佷笟鐧诲綍 --> <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" > @@ -33,7 +38,7 @@ </view> <view class="form-input set-flex set-flex-content-between"> <input type="number" v-model="form.code" placeholder="璇疯緭鍏ラ獙璇佺爜"/> - <view @click="getCode"> + <view > <text class="driver"></text> <text class="getcode">{{tips}}</text> </view> @@ -43,31 +48,37 @@ <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: '鑾峰彇楠岃瘉鐮�', form: { phone: '', - code: '', + code: '666666', userType: '01' }, loginToken: '', isSendCode: false, countdownTime: 20, - timer: '' + timer: '', + sessionToken: "", + userInfo: {} } }, onLoad(options) { @@ -103,9 +114,14 @@ title: '姝e湪鑾峰彇楠岃瘉鐮�' }) 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('鍊掕鏃剁粨鏉熷悗鍐嶅彂閫�'); @@ -129,6 +145,20 @@ }, 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 @@ -139,23 +169,59 @@ }, 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}` }) } } @@ -178,7 +244,7 @@ border-radius: 40rpx 40rpx 0 0; padding: 40rpx 32rpx; position: relative; - top: -40rpx; + top: 80rpx; background-color: white; .form { .form-item{ @@ -224,4 +290,7 @@ background: #F0F8FF; } } + ::v-deep .u-radio { + margin-bottom: 20rpx; + } </style> \ No newline at end of file -- Gitblit v1.9.1