|
|
@ -9,22 +9,18 @@ |
|
|
|
<image src="../static/images/banner/logo-banner.png" mode="widthFix"></image> |
|
|
|
</view> |
|
|
|
<view class="box"> |
|
|
|
<view class="box-shadow"> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="box-shadow"> </view> |
|
|
|
<view class="logo-content"> |
|
|
|
<text class="title">您好,欢迎登录</text> |
|
|
|
</view> |
|
|
|
<view class="login-form-content"> |
|
|
|
<view class="input-item-label">登录账号</view> |
|
|
|
<view class="input-item flex align-center"> |
|
|
|
<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" |
|
|
|
style="height: 100%;" /> |
|
|
|
<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" style="height: 100%" /> |
|
|
|
</view> |
|
|
|
<view class="input-item-label">登录密码</view> |
|
|
|
<view class="input-item flex align-center"> |
|
|
|
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" |
|
|
|
style="height: 100%;" /> |
|
|
|
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" style="height: 100%" /> |
|
|
|
</view> |
|
|
|
<view class="action-btn"> |
|
|
|
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg">登录</button> |
|
|
@ -36,72 +32,95 @@ |
|
|
|
<text @click="handleUserAgrement" class="text-blue">《用户协议》</text> |
|
|
|
<text @click="handlePrivacy" class="text-blue">《隐私协议》</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="" style="text-align: center; margin-top: 20rpx; margin-bottom: 20rpx"> 版本: {{ version }} </view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import * as loginApi from "@/api/login" |
|
|
|
import { |
|
|
|
ref, |
|
|
|
getCurrentInstance |
|
|
|
} from 'vue' |
|
|
|
const { proxy } = getCurrentInstance() |
|
|
|
import { ref, getCurrentInstance } from 'vue' |
|
|
|
import { storeToRefs } from 'pinia' |
|
|
|
import { onLoad } from '@dcloudio/uni-app' |
|
|
|
import * as loginApi from '@/api/login' |
|
|
|
import { useCountStore } from '@/store' |
|
|
|
|
|
|
|
let loginForm = ref({ |
|
|
|
tenantName: "闻荫源码", |
|
|
|
username: "", |
|
|
|
password: "", |
|
|
|
captchaVerification: "", |
|
|
|
const { proxy } = getCurrentInstance() |
|
|
|
const version = ref() |
|
|
|
|
|
|
|
onLoad(() => { |
|
|
|
getAppVersion() |
|
|
|
}) |
|
|
|
|
|
|
|
const loginForm = ref({ |
|
|
|
tenantName: '闻荫源码', |
|
|
|
username: '', |
|
|
|
password: '', |
|
|
|
captchaVerification: '', |
|
|
|
rememberMe: false, |
|
|
|
code: '1', |
|
|
|
uuid: "APP", |
|
|
|
uuid: 'APP', |
|
|
|
cid: uni.getStorageSync('cid') |
|
|
|
}) |
|
|
|
console.log(import.meta.env) |
|
|
|
if (import.meta.env.VITE_USER_NODE_ENV == 'development') { |
|
|
|
loginForm.value = { |
|
|
|
tenantName: "闻荫源码", |
|
|
|
username: "admin", |
|
|
|
password: "123456", |
|
|
|
captchaVerification: "", |
|
|
|
tenantName: '闻荫源码', |
|
|
|
username: 'admin', |
|
|
|
password: '123456', |
|
|
|
captchaVerification: '', |
|
|
|
rememberMe: false, |
|
|
|
code: '1', |
|
|
|
uuid: "APP", |
|
|
|
uuid: 'APP', |
|
|
|
cid: uni.getStorageSync('cid') |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取自定义的store |
|
|
|
const store = useCountStore() |
|
|
|
async function handleLogin(params) { |
|
|
|
if (loginForm.value.username === "") { |
|
|
|
proxy.$modal.msgError("请输入您的账号") |
|
|
|
} else if (loginForm.value.password === "") { |
|
|
|
proxy.$modal.msgError("请输入您的密码") |
|
|
|
if (loginForm.value.username === '') { |
|
|
|
proxy.$modal.msgError('请输入您的账号') |
|
|
|
} else if (loginForm.value.password === '') { |
|
|
|
proxy.$modal.msgError('请输入您的密码') |
|
|
|
} else { |
|
|
|
await pwdLogin() |
|
|
|
} |
|
|
|
} |
|
|
|
async function pwdLogin() { |
|
|
|
proxy.$modal.loading("登录中,请耐心等待...") |
|
|
|
proxy.$modal.loading('登录中,请耐心等待...') |
|
|
|
// 执行登录 |
|
|
|
store.Login(loginForm.value).then(async (res) => { |
|
|
|
store |
|
|
|
.Login(loginForm.value) |
|
|
|
.then(async (res) => { |
|
|
|
proxy.$modal.closeLoading() |
|
|
|
await loginSuccess() |
|
|
|
}).catch(() => { }) |
|
|
|
}) |
|
|
|
.catch(() => {}) |
|
|
|
} |
|
|
|
// 登录成功后,处理函数 |
|
|
|
async function loginSuccess(result) { |
|
|
|
await store.GetPermissionInfo().then(res => { |
|
|
|
}).catch(() => {}) |
|
|
|
await store.GetInfo().then(res => { |
|
|
|
await store |
|
|
|
.GetPermissionInfo() |
|
|
|
.then((res) => {}) |
|
|
|
.catch(() => {}) |
|
|
|
await store |
|
|
|
.GetInfo() |
|
|
|
.then((res) => { |
|
|
|
proxy.$tab.reLaunch('/pages/index') |
|
|
|
}).catch(() => {}) |
|
|
|
}) |
|
|
|
.catch(() => {}) |
|
|
|
} |
|
|
|
|
|
|
|
function getAppVersion() { |
|
|
|
const systemInfo = uni.getSystemInfoSync() |
|
|
|
// #ifdef H5 |
|
|
|
version.value = systemInfo.appVersion |
|
|
|
console.log(systemInfo.appVersion, '版本号') |
|
|
|
// #endif |
|
|
|
|
|
|
|
// #ifdef APP-PLUS |
|
|
|
version.value = systemInfo.appWgtVersion |
|
|
|
// #endif |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
@ -120,7 +139,6 @@ |
|
|
|
.title { |
|
|
|
font-weight: bold; |
|
|
|
color: #000000; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -188,7 +206,7 @@ |
|
|
|
|
|
|
|
.input-item { |
|
|
|
margin: 20rpx auto 40rpx; |
|
|
|
border: 1px solid #E4E4E4; |
|
|
|
border: 1px solid #e4e4e4; |
|
|
|
padding: 0px 20rpx; |
|
|
|
height: 90rpx; |
|
|
|
|
|
|
@ -204,7 +222,6 @@ |
|
|
|
line-height: 40rpx; |
|
|
|
text-align: left; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.login-btn { |
|
|
@ -213,7 +230,6 @@ |
|
|
|
background: #409eff; |
|
|
|
color: white; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.xieyi { |
|
|
|