Browse Source

修改app更新

master
李俊城 2 months ago
parent
commit
a546b26768
  1. 2
      src/manifest.json
  2. 96
      src/pages/login.vue

2
src/manifest.json

@ -4,7 +4,7 @@
"package" : "com.eam.uniapp", "package" : "com.eam.uniapp",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : 1,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

96
src/pages/login.vue

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

Loading…
Cancel
Save