2023-07-19 11:58:18 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="login">
|
|
|
|
|
<image class="bg-iamge" src="../../static/img/login/login_back_img.png"></image>
|
2023-07-20 16:32:30 +08:00
|
|
|
|
<!-- #ifdef APP-PLUS||H5 -->
|
|
|
|
|
<view style="height: var(--status-bar-height);"></view>
|
|
|
|
|
<!-- #endif -->
|
2023-07-19 11:58:18 +08:00
|
|
|
|
<view class="body">
|
|
|
|
|
<view class="title">欢迎进入里海供销平台!</view>
|
|
|
|
|
<view class="login-card">
|
|
|
|
|
<view class="top">
|
|
|
|
|
<view class="text item">
|
2023-07-19 18:51:31 +08:00
|
|
|
|
<u-tabs :list="[{name:'账号登录'},{name:'手机登录'}]" @click="changeTabs" lineColor="#3274F9"
|
|
|
|
|
itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;font-size: 32rpx;"></u-tabs>
|
2023-07-19 11:58:18 +08:00
|
|
|
|
</view>
|
|
|
|
|
<input v-if="current==0" class="mobile item" v-model="formData.account" placeholder="输入账号" />
|
2023-07-19 18:51:31 +08:00
|
|
|
|
<input v-if="current==0" class="mobile item" v-model="formData.password" placeholder="输入密码" password
|
|
|
|
|
type="safe-password" />
|
2023-07-19 11:58:18 +08:00
|
|
|
|
<input v-if="current==1" class="mobile item" v-model="formData.account" placeholder="输入手机号" />
|
|
|
|
|
<view v-if="current==1" class="code item">
|
2023-07-19 18:51:31 +08:00
|
|
|
|
<input placeholder="输入验证码" v-model="formData.code" />
|
2023-07-19 11:58:18 +08:00
|
|
|
|
<view class="get-code">获取验证码</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="btn">
|
|
|
|
|
<view>新用户注册</view>
|
|
|
|
|
<view>忘记密码?</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<button class="submit_btn" @click="login">登录</button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-07-20 13:48:26 +08:00
|
|
|
|
import { loginAccount, userInfo, test } from "@/api/oaUser.js"
|
2023-07-19 11:58:18 +08:00
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
current: 0,
|
|
|
|
|
formData: {
|
|
|
|
|
account: 'admin123',
|
|
|
|
|
password: 'qq123456',
|
|
|
|
|
code: '',
|
2023-07-19 18:51:31 +08:00
|
|
|
|
terminal: 6, //6是APP端
|
2023-07-19 11:58:18 +08:00
|
|
|
|
scene: 1
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-07-19 18:51:31 +08:00
|
|
|
|
changeTabs(e) {
|
2023-07-19 11:58:18 +08:00
|
|
|
|
this.current = e.index;
|
2023-07-19 18:51:31 +08:00
|
|
|
|
this.formData.scene = e.index + 1;
|
2023-07-19 11:58:18 +08:00
|
|
|
|
},
|
|
|
|
|
async login() {
|
|
|
|
|
let that = this;
|
|
|
|
|
// let res = await test();
|
|
|
|
|
// console.log(res);
|
|
|
|
|
let res = await loginAccount(that.formData);
|
|
|
|
|
this.$store.commit('SET_USERINFO', {
|
2023-07-20 13:48:26 +08:00
|
|
|
|
user: data,
|
2023-07-19 11:58:18 +08:00
|
|
|
|
token: res.data.token
|
|
|
|
|
})
|
2023-07-20 13:48:26 +08:00
|
|
|
|
let { data } = await userInfo();
|
|
|
|
|
this.$store.commit('setUserInfo', data);
|
2023-07-19 11:58:18 +08:00
|
|
|
|
uni.switchTab({
|
2023-07-19 18:51:31 +08:00
|
|
|
|
url: '/pages/oaHome/oaHome'
|
2023-07-19 11:58:18 +08:00
|
|
|
|
})
|
|
|
|
|
// uni.request({
|
|
|
|
|
// url: 'https://worker-task.lihaink.cn/api/login/account',
|
|
|
|
|
// method: 'POST',
|
|
|
|
|
// data: {
|
|
|
|
|
// account: 'admin123',
|
|
|
|
|
// terminal: '3',
|
|
|
|
|
// scene: '1',
|
|
|
|
|
// password: 'qq123456'
|
|
|
|
|
// },
|
|
|
|
|
// success: (res) => {
|
|
|
|
|
// console.log(res);
|
|
|
|
|
// this.res = res.data.m
|
|
|
|
|
// }
|
|
|
|
|
// })
|
2023-07-19 18:51:31 +08:00
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
initTerminal() {
|
|
|
|
|
// #ifndef APP-PLUS
|
|
|
|
|
this.formData.terminal = 6;
|
|
|
|
|
// #endif
|
|
|
|
|
uni.getSystemInfo({
|
|
|
|
|
success: (res) => {
|
|
|
|
|
const platform = res.platform.toLowerCase();
|
|
|
|
|
if (platform === 'ios') {
|
|
|
|
|
this.formData.terminal = 5;
|
|
|
|
|
} else if (platform === 'windows') {
|
|
|
|
|
this.formData.terminal = 4;
|
|
|
|
|
} else if (platform === 'mac') {
|
|
|
|
|
this.formData.terminal = 4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
this.formData.terminal = 3;
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
this.formData.terminal = 1;
|
|
|
|
|
// #endif
|
2023-07-19 11:58:18 +08:00
|
|
|
|
}
|
2023-07-19 18:51:31 +08:00
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.initTerminal();
|
2023-07-19 11:58:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.login {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
position: relative;
|
|
|
|
|
/* #ifdef H5 */
|
|
|
|
|
background-image: url('../../static/img/login/login_back_img.png');
|
|
|
|
|
|
|
|
|
|
/* #endif */
|
|
|
|
|
.bg-iamge {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
position: absolute;
|
|
|
|
|
z-index: -99;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.body {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
.title {
|
|
|
|
|
width: 694rpx;
|
|
|
|
|
height: 74rpx;
|
|
|
|
|
margin-top: 200rpx;
|
|
|
|
|
margin-bottom: 51rpx;
|
|
|
|
|
font-size: 53rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
line-height: 68rpx;
|
|
|
|
|
-webkit-background-clip: text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-card {
|
|
|
|
|
width: 694rpx;
|
|
|
|
|
height: 643rpx;
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
border-radius: 21rpx 21rpx 21rpx 21rpx;
|
|
|
|
|
opacity: 1;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 38.5rpx 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.top {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-evenly;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
.item {
|
|
|
|
|
margin-bottom: 35rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.text {
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: rgba(0, 0, 0, 0.8);
|
|
|
|
|
line-height: 35rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mobile,
|
|
|
|
|
.code {
|
|
|
|
|
width: 613rpx;
|
|
|
|
|
height: 112rpx;
|
|
|
|
|
background: #F5F5F5;
|
|
|
|
|
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
|
|
|
|
opacity: 1;
|
|
|
|
|
padding: 0 45.56rpx;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
color: #333;
|
|
|
|
|
line-height: 35rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.code {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
2023-07-19 18:51:31 +08:00
|
|
|
|
|
|
|
|
|
input {
|
2023-07-19 11:58:18 +08:00
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.get-code {
|
|
|
|
|
color: #3274F9;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-19 18:51:31 +08:00
|
|
|
|
|
|
|
|
|
.btn {
|
2023-07-19 11:58:18 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.submit_btn {
|
|
|
|
|
width: 613rpx;
|
|
|
|
|
height: 112rpx;
|
|
|
|
|
background: #3274F9;
|
|
|
|
|
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
|
|
|
|
opacity: 1;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 112rpx;
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
font-size: 35rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</style>
|