| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="login-content plr60"> |
| | | <view class="login-bg"> |
| | | <image src="@/static/login_bg@2x.png" mode="aspectFill" class="bg-img"></image> |
| | | <image src="@/static/logo@2x.png" mode="aspectFill" class="login-log img180"></image> |
| | | <view class="tc title">DMäºå·¥å</view> |
| | | </view> |
| | | <view class="bg_w rd8 ptb30 pl40 bbox com-input flex input-height"> |
| | | <image src="@/static/login_ic_code@2x.png" mode="" class="img40 mr25"></image> |
| | | <u--input placeholder="ä¼ä¸ä»£ç " border="none" v-model="form.companyId"></u--input> |
| | | </view> |
| | | <view class="bg_w rd8 ptb30 pl40 bbox mt40 flex input-height"> |
| | | <image src="@/static/login_ic_phone@2x.png" mode="" class="img40 mr25"></image> |
| | | <u--input placeholder="ææºå·" border="none" v-model="form.username"></u--input> |
| | | </view> |
| | | <view class="bg_w rd8 ptb30 pl40 bbox mt40 flex input-height"> |
| | | <image src="@/static/login_ic_password@2x.png" mode="" class="img40 mr25"></image> |
| | | <u--input placeholder="å¯ç " border="none" password v-model="form.password"></u--input> |
| | | </view> |
| | | <view class="login-btn mt80" @click="loginAction">ç«å³ç»å½</view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { wxLogin, wxAccountLogin, getUserInfo, wxProgramLogin } from '@/util/api/index.js'; |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: { |
| | | openid: '', |
| | | unionid: '', |
| | | companyId: '', |
| | | username: '', |
| | | password: '' |
| | | } |
| | | }; |
| | | }, |
| | | onLoad() { |
| | | var that = this |
| | | uni.login({ |
| | | provider: 'weixin', |
| | | success: function (loginRes) { |
| | | wxProgramLogin({ code: loginRes.code }) |
| | | .then(async (res) => { |
| | | if (res.code === 200) { |
| | | // å
ç»å½ï¼ç´æ¥è·³é¦é¡µ |
| | | if (res.data.loginStatus == 0) { |
| | | that.$store.commit('SETSESSION', res.data.session) |
| | | let info = await getUserInfo() |
| | | if (info.code === 200) { |
| | | await that.$store.commit('setEntrance', 'WX') |
| | | await that.$store.commit('SETUSERINFO', info.data) |
| | | await that.$store.dispatch('getMenuList', 2) |
| | | uni.switchTab({ |
| | | url: '/pages/workbench/workbench' |
| | | }); |
| | | } |
| | | } else { |
| | | that.form.openid = res.data.openid |
| | | that.form.unionid = res.data.unionid |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | methods: { |
| | | async loginAction() { |
| | | if (!this.form.companyId) return uni.showToast({ title: 'ä¼ä¸ä»£ç ä¸è½ä¸ºç©º', icon:"error", duration: 2000 }); |
| | | if (!this.form.username) return uni.showToast({ title: 'ææºå·ä¸è½ä¸ºç©º', icon:"error", duration: 2000 }); |
| | | if (!this.form.password) return uni.showToast({ title: 'å¯ç ä¸è½ä¸ºç©º', icon:"error", duration: 2000 }); |
| | | let res = await wxAccountLogin(this.form) |
| | | if (res.code === 200) { |
| | | await this.$store.commit('SETSESSION', res.data) |
| | | let user = await getUserInfo({}) |
| | | if (user.code === 200) { |
| | | await this.$store.commit('SETUSERINFO', user.data) |
| | | await this.$store.dispatch('getMenuList', 2) |
| | | uni.switchTab({ |
| | | url: '/pages/workbench/workbench' |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .login-content { |
| | | height: 100vh; |
| | | background: #FFFFFF linear-gradient(180deg, rgba(66,117,252,0.2) 0%, rgba(66,117,252,0) 100%); |
| | | .login-bg { |
| | | position: relative; |
| | | height: 812rpx; |
| | | .bg-img { |
| | | position: absolute; |
| | | z-index: 1; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | .login-log { |
| | | margin: 356rpx auto 0 auto ; |
| | | left: 0; |
| | | right: 0; |
| | | position: absolute; |
| | | } |
| | | .title { |
| | | position: absolute; |
| | | margin-top: 576rpx; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 60rpx; |
| | | font-size: 44rpx; |
| | | font-weight: 600; |
| | | color: #333333; |
| | | line-height: 60rpx; |
| | | } |
| | | } |
| | | .input-height { |
| | | height: 100rpx; |
| | | } |
| | | .com-input { |
| | | margin-top: -60px; |
| | | position: relative; |
| | | z-index: 2; |
| | | } |
| | | .login-btn { |
| | | height: 98rpx; |
| | | background: #4275FC; |
| | | box-shadow: 0rpx 12rpx 24rpx 0rpx rgba(66,117,252,0.2); |
| | | border-radius: 8rpx; |
| | | text-align: center; |
| | | font-size: 32rpx; |
| | | font-weight: 500; |
| | | color: #FFFFFF; |
| | | line-height: 98rpx; |
| | | } |
| | | } |
| | | </style> |