Compare commits

..

2 Commits

21455
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -76,10 +76,11 @@
"@dcloudio/uni-cli-shared": "3.0.0-4020320240708001", "@dcloudio/uni-cli-shared": "3.0.0-4020320240708001",
"@dcloudio/uni-stacktracey": "3.0.0-4020320240708001", "@dcloudio/uni-stacktracey": "3.0.0-4020320240708001",
"@dcloudio/vite-plugin-uni": "3.0.0-4020320240708001", "@dcloudio/vite-plugin-uni": "3.0.0-4020320240708001",
"@types/node": "18.19.130",
"@vue/runtime-core": "^3.4.23", "@vue/runtime-core": "^3.4.23",
"@vue/tsconfig": "^0.1.3", "@vue/tsconfig": "^0.1.3",
"less": "^4.2.0", "less": "^4.2.0",
"sass": "^1.77.7", "sass": "1.56.1",
"sass-loader": "^10.1.1", "sass-loader": "^10.1.1",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"vite": "5.2.8", "vite": "5.2.8",

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

@ -34,7 +34,10 @@ const i18n = createI18n({
locale: getSavedLocale(), locale: getSavedLocale(),
fallbackLocale: DEFAULT_LOCALE, fallbackLocale: DEFAULT_LOCALE,
globalInjection: true, globalInjection: true,
messages messages,
missingWarn: false,
fallbackWarn: false,
missing: (locale, key) => key
}) })
const literalMap = { const literalMap = {
@ -81,6 +84,15 @@ const literalMap = {
} }
function applyTabBarLanguage() { function applyTabBarLanguage() {
try {
const pages = getCurrentPages()
if (!pages || pages.length === 0) return
const currentPage = pages[pages.length - 1]
if (!currentPage) return
const route = currentPage.route || ''
const tabBarPages = ['pages/index', 'pages/report', 'pages/work', 'pages/mine']
if (!tabBarPages.includes(route)) return
const labels = [ const labels = [
i18n.global.t('tab.home'), i18n.global.t('tab.home'),
i18n.global.t('tab.report'), i18n.global.t('tab.report'),
@ -88,14 +100,13 @@ function applyTabBarLanguage() {
i18n.global.t('tab.mine') i18n.global.t('tab.mine')
] ]
labels.forEach((text, index) => { labels.forEach((text, index) => {
try {
uni.setTabBarItem({ uni.setTabBarItem({
index, index,
text text
}) })
})
} catch (e) { } catch (e) {
} }
})
} }
export function getCurrentLocale() { export function getCurrentLocale() {
@ -106,9 +117,6 @@ export function setLocale(locale) {
const nextLocale = normalizeLocale(locale) const nextLocale = normalizeLocale(locale)
i18n.global.locale.value = nextLocale i18n.global.locale.value = nextLocale
uni.setStorageSync(LOCALE_STORAGE_KEY, nextLocale) uni.setStorageSync(LOCALE_STORAGE_KEY, nextLocale)
if (typeof uni.setLocale === 'function') {
uni.setLocale(nextLocale)
}
applyTabBarLanguage() applyTabBarLanguage()
uni.$emit(LOCALE_CHANGE_EVENT, nextLocale) uni.$emit(LOCALE_CHANGE_EVENT, nextLocale)
return nextLocale return nextLocale

@ -1,45 +1,60 @@
<template> <template>
<view class="normal-login-container"> <view class="scroll-container">
<view class="logo-content align-center justify-center flex"> <view class="login-container">
<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
</image> <!-- Logo区域 -->
<text class="title">数字化智能中控平台</text> <view class="logo-section">
<view class="logo-wrapper">
<image :src="globalConfig.appInfo.logo" mode="aspectFit" class="logo-img"></image>
</view>
</view> </view>
<view class="login-form-content"> <!-- 顶部装饰背景 -->
<view class="input-item flex align-center"> <view class="background-decoration">
<view class="iconfont icon-user icon"></view> <view class="wave-bg"></view>
<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
</view> </view>
<view class="input-item flex align-center">
<view class="iconfont icon-password icon"></view> <view class="login-content">
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" /> <!-- 欢迎文案 -->
<view class="welcome-section">
<text class="welcome-title">欢迎来到必硕数字化平台</text>
<text class="welcome-subtitle">登录以实现您的需求</text>
</view>
<!-- 登录表单 -->
<view class="form-section">
<!-- 账号输入 -->
<up-input v-model="loginForm.username" placeholder="请输入账号" :maxlength="30" border="bottom" clearable
class="form-input" />
<!-- 密码输入 -->
<up-input v-model="loginForm.password" type="password" placeholder="请输入密码" :maxlength="20" border="bottom"
clearable class="form-input password-input" />
<!-- 忘记密码 -->
<view class="forgot-password">
<text class="forgot-link">忘记密码</text>
</view> </view>
<view v-if="captchaEnabled" class="input-item flex align-center" style="width: 60%;margin: 0px;">
<view class="iconfont icon-code icon"></view> <!-- 登录按钮 -->
<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" /> <view class="login-btn-wrapper">
<view class="login-code"> <button @click="handleLogin" class="login-btn">登录</button>
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
</view> </view>
</view> </view>
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import modal from '@/plugins/modal' import modal from '@/plugins/modal'
import { getCodeImg } from '@/api/login' import { getCodeImg } from '@/api/login'
import { ref } from "vue"; import { ref } from "vue";
import config from '@/config.js' import config from '@/config.js'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { getWxCode } from '@/utils/geek';
import { wxLogin } from '@/api/oauth';
import { setToken } from '@/utils/auth';
const userStore = useUserStore() const userStore = useUserStore()
const codeUrl = ref(""); const codeUrl = ref("");
const captchaEnabled = ref(false); // const captchaEnabled = ref(false);
const globalConfig = ref(config); const globalConfig = ref(config);
const loginForm = ref({ const loginForm = ref({
@ -52,7 +67,6 @@ const loginForm = ref({
uuid: '' uuid: ''
}); });
//
function getCode() { function getCode() {
getCodeImg().then(res => { getCodeImg().then(res => {
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled
@ -62,7 +76,7 @@ function getCode() {
} }
}) })
} }
// getCode();
async function handleLogin() { async function handleLogin() {
if (loginForm.value.username === "") { if (loginForm.value.username === "") {
modal.msgError("请输入您的账号") modal.msgError("请输入您的账号")
@ -74,8 +88,8 @@ async function handleLogin() {
modal.loading("登录中,请耐心等待...") modal.loading("登录中,请耐心等待...")
pwdLogin() pwdLogin()
} }
}; }
//
async function pwdLogin() { async function pwdLogin() {
userStore.login(loginForm.value).then(() => { userStore.login(loginForm.value).then(() => {
modal.closeLoading() modal.closeLoading()
@ -86,90 +100,146 @@ async function pwdLogin() {
getCode() getCode()
} }
}) })
}; }
function loginSuccess(result) { function loginSuccess(result) {
//
userStore.getInfo().then(res => { userStore.getInfo().then(res => {
uni.switchTab({ uni.switchTab({
url: '/pages/index' url: '/pages/index'
}); });
}) })
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: #ffffff; background-color: #ffffff;
min-height: 100vh;
} }
.normal-login-container { .scroll-container {
height: 100%;
width: 100%; width: 100%;
overflow: auto;
.logo-content { .login-container {
width: 100%; width: 100%;
font-size: 21px; min-height: 100vh;
text-align: center; position: relative;
padding-top: 15%; box-sizing: border-box;
padding: 0 50rpx;
image { /* 顶部装饰背景 */
border-radius: 4px; .background-decoration {
position: absolute;
top: 20rpx;
left: -9.2%;
right: -9.2%;
width: 118.4%;
height: 400rpx;
overflow: hidden;
.wave-bg {
width: 100%;
height: 100%;
background-image: url(@/assets/img/backgroundshadow1.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
} }
.title { /* Logo区域 */
margin-left: 10px; .logo-section {
padding-top: 40rpx;
display: flex;
justify-content: center;
.logo-wrapper {
width: 160rpx;
height: 160rpx;
background: #ffffff;
border-radius: 40rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.08);
display: flex;
align-items: center;
justify-content: center;
.logo-img {
width: 80rpx;
height: 80rpx;
}
} }
} }
.login-form-content { /* 登录内容区 */
text-align: center; .login-content {
margin: 20px auto; position: relative;
margin-top: 15%; top: 110rpx;
width: 80%;
.input-item { /* 欢迎文案 */
margin: 20px auto; .welcome-section {
background-color: #f5f6f7; text-align: left;
height: 45px; margin-top: 10rpx;
border-radius: 20px;
.icon { .welcome-title {
font-size: 38rpx; font-size: 44rpx;
margin-left: 10px; font-weight: 600;
color: #999; color: #333333;
display: block;
} }
.input { .welcome-subtitle {
width: 100%; font-size: 28rpx;
font-size: 14px; color: #999999;
line-height: 20px; margin-top: 16rpx;
text-align: left; display: block;
padding-left: 15px;
} }
} }
.login-btn { /* 表单区域 */
margin-top: 40px; .form-section {
height: 45px; margin-top: 80rpx;
.form-input {
margin-bottom: 32rpx;
&.password-input {
margin-bottom: 24rpx;
} }
}
/* 忘记密码 */
.forgot-password {
text-align: right;
margin-bottom: 48rpx;
.xieyi { .forgot-link {
color: #333; font-size: 26rpx;
margin-top: 20px; color: #666666;
}
} }
.login-code { /* 登录按钮 */
height: 38px; .login-btn-wrapper {
float: right; margin-bottom: 60rpx;
.login-code-img { .login-btn {
height: 38px; width: 100%;
position: absolute; height: 88rpx;
margin-left: 10px; background: linear-gradient(135deg, #1a3a5c 0%, #2d5a87 100%);
width: 200rpx; border-radius: 20rpx;
font-size: 30rpx;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
border: none;
&:active {
opacity: 0.9;
}
}
}
} }
} }
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save