项目正常启动

This commit is contained in:
comlibmb
2026-01-22 08:54:47 +08:00
parent 9eb05253d3
commit 75fad97d5d
28 changed files with 1621 additions and 887 deletions

View File

@@ -1,90 +1,82 @@
<template>
<view class="page-wrapper">
<scroll-view class="login-container" scroll-y="true" show-scrollbar="false">
<!-- Language switch button -->
<view class="language-switch">
<button class="language-btn" @click="toggleLanguage">
<view class="page">
<scroll-view class="scroll" scroll-y="true" show-scrollbar="false">
<view class="top-actions">
<button class="lang-btn" @click="toggleLanguage">
{{ currentLocale === 'zh-CN' ? 'EN' : '中' }}
</button>
</view>
<!-- Unified content container -->
<view class="content-wrapper">
<!-- Logo section -->
<view class="logo-section">
<text class="app-title">Trainning Monitor</text>
<view class="hero">
<view class="brand-row">
<view class="brand-mark"></view>
<view class="brand-text">
<text class="brand-name">Mall</text>
<text class="brand-slogan">正品保障 · 省心售后</text>
</view>
</view>
<view class="title-block">
<text class="page-title">{{ $t('user.login.title') }}</text>
<text class="page-subtitle">{{ $t('user.login.subtitle') }}</text>
</view>
</view>
<!-- Form container -->
<view class="form-container">
<form @submit="onSubmit">
<!-- Email input -->
<view class="input-group" :class="{ 'input-error': emailError }">
<text class="input-label">{{ $t('user.login.email') }}</text>
<input class="input-field" name="email" type="text" :value="email"
:placeholder="$t('user.login.email_placeholder')" @blur="validateEmail" />
<text v-if="emailError" class="error-text">{{ emailError }}</text>
</view>
<!-- Password input -->
<view class="input-group" :class="{ 'input-error': passwordError }">
<text class="input-label">{{ $t('user.login.password') }}</text>
<view class="password-input-container">
<input class="input-field" name="password" :type="showPassword ? 'text' : 'password'"
:value="password" :placeholder="$t('user.login.password_placeholder')"
@blur="validatePassword" />
<view class="password-toggle" @click="showPassword = !showPassword">
<text class="toggle-icon">{{ showPassword ? '👁' : '🙈' }}</text>
</view>
</view>
<text v-if="passwordError" class="error-text">{{ passwordError }}</text>
</view>
<!-- Additional options -->
<view class="options-row">
<view class="remember-me">
<checkbox value="rememberMe" color="#2196f3" />
<text class="remember-me-text">{{ $t('user.login.remember_me') }}</text>
</view>
<text class="forgot-password" @click="navigateToForgotPassword">
{{ $t('user.login.forgot_password') }}
</text>
</view>
<!-- Login button -->
<button form-type="submit" class="login-button" :disabled="isLoading" :loading="isLoading">
{{ $t('user.login.login_button') }}
</button>
<!-- General error message -->
<text v-if="generalError" class="general-error">{{ generalError }}</text>
</form>
<!-- Social login options -->
<view class="social-login">
<text class="social-login-text">{{ $t('user.login.or_login_with') }}</text>
<view class="social-buttons">
<button class="social-button wechat" @click="socialLogin('WeChat')">
<text class="social-icon">🟩</text>
</button>
<button class="social-button qq" @click="socialLogin('QQ')">
<text class="social-icon">🔵</text>
</button>
<button class="social-button sms" @click="socialLogin('SMS')">
<text class="social-icon">✉️</text>
</button>
<view class="card">
<form @submit="onSubmit">
<view class="field" :class="{ 'field-error': emailError }">
<text class="label">{{ $t('user.login.email') }}</text>
<view class="input-wrap">
<input class="input" name="email" type="text" :value="email" :placeholder="$t('user.login.email_placeholder')" @blur="validateEmail" />
</view>
<text v-if="emailError" class="support error">{{ emailError }}</text>
</view>
<!-- Register option -->
<view class="register-option">
<text class="register-text">{{ $t('user.login.no_account') }}</text>
<text class="register-link"
@click="navigateToRegister">{{ $t('user.login.register_now') }}</text>
<view class="field" :class="{ 'field-error': passwordError }">
<text class="label">{{ $t('user.login.password') }}</text>
<view class="input-wrap">
<input class="input" name="password" :type="showPassword ? 'text' : 'password'" :value="password" :placeholder="$t('user.login.password_placeholder')" @blur="validatePassword" />
<view class="suffix" @click="showPassword = !showPassword">
<text class="suffix-text">{{ showPassword ? '隐藏' : '显示' }}</text>
</view>
</view>
<text v-if="passwordError" class="support error">{{ passwordError }}</text>
</view>
<view class="row">
<view class="remember">
<checkbox value="rememberMe" color="#FF4D4F" />
<text class="remember-text">{{ $t('user.login.remember_me') }}</text>
</view>
<text class="link" @click="navigateToForgotPassword">{{ $t('user.login.forgot_password') }}</text>
</view>
<button form-type="submit" class="primary" :disabled="isLoading" :loading="isLoading">
{{ $t('user.login.login_button') }}
</button>
<text v-if="generalError" class="support error center">{{ generalError }}</text>
</form>
<view class="divider">
<view class="divider-line"></view>
<text class="divider-text">{{ $t('user.login.or_login_with') }}</text>
<view class="divider-line"></view>
</view>
<view class="social-row">
<button class="social wechat" @click="socialLogin('WeChat')"><text class="social-label">微信</text></button>
<button class="social qq" @click="socialLogin('QQ')"><text class="social-label">QQ</text></button>
<button class="social sms" @click="socialLogin('SMS')"><text class="social-label">短信</text></button>
</view>
<view class="footer">
<text class="footer-text">{{ $t('user.login.no_account') }}</text>
<text class="footer-link" @click="navigateToRegister">{{ $t('user.login.register_now') }}</text>
</view>
</view>
<view class="trust">
<text class="trust-text">登录即代表你同意用户协议与隐私政策</text>
</view>
</scroll-view>
</view>
@@ -117,6 +109,16 @@
// Try to restore saved email if "remember me" was selected
// this.tryRestoreEmail();
console.log('akkkk')
// 启动后若已登录,直接进入商城消费者端首页
try {
const sessionInfo = supa.getSession();
if (sessionInfo != null && sessionInfo.user != null) {
// 已登录 -> 直接进入 tabBar 首页
console.log('login onLoad: found session, go consumer/index')
uni.switchTab({ url: '/pages/mall/consumer/index' });
return;
}
} catch (e) {}
}, methods: {
toggleLanguage() {
@@ -197,16 +199,8 @@
if (profile==null) throw new Error(this.$t('user.login.profile_update_failed'));
// 登录成功提示
uni.showToast({ title: this.$t('user.login.login_success'), icon: 'success' });
// 跳转至运动页面
if(TABORPAGE)
{
uni.switchTab({ url: HOME_REDIRECT });
}
else{
uni.navigateTo({ url: HOME_REDIRECT });
}
// 跳转至商城消费者端首页(类似京东:默认消费者)
uni.switchTab({ url: '/pages/mall/consumer/index' });
return;
} else {
throw new Error(this.$t('user.login.login_failed'));
@@ -261,430 +255,269 @@
</script>
<style>
/* Page wrapper for full screen */
.page-wrapper {
width: 100%;
}
.login-container {
width: 100%;
background-image: linear-gradient(to bottom right, #f8f9fa, #e9ecef);
.page {
min-height: 100vh;
background: #f7f8fa;
}
/* Content wrapper - single scrollable container */
.content-wrapper {
width: 100%;
/* #ifdef APP-PLUS */
padding: 20rpx 15rpx;
min-height: 800rpx;
/* #endif */
/* #ifndef APP-PLUS */
padding: 30rpx 25rpx;
min-height: 1000rpx;
/* #endif */
.scroll {
min-height: 100vh;
background: radial-gradient(900rpx 700rpx at 20% 10%, rgba(255, 77, 79, 0.16), rgba(255, 77, 79, 0) 60%),
linear-gradient(180deg, #ffffff 0%, #f7f8fa 45%, #f7f8fa 100%);
}
.top-actions {
position: relative;
padding: 24rpx 24rpx 0;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
justify-content: flex-end;
}
/* Language switch button - adjusted for single container */
.language-switch {
position: absolute;
/* #ifdef APP-PLUS */
top: 30rpx;
right: 25rpx;
/* #endif */
/* #ifndef APP-PLUS */
top: 40rpx;
right: 35rpx;
/* #endif */
z-index: 100;
}
.language-btn {
/* #ifdef APP-PLUS */
width: 50rpx;
height: 50rpx;
border-radius: 25rpx;
font-size: 18rpx;
/* #endif */
/* #ifndef APP-PLUS */
width: 70rpx;
height: 70rpx;
border-radius: 35rpx;
font-size: 24rpx;
/* #endif */
background-color: rgba(33, 150, 243, 0.8);
color: #fff;
font-weight: normal;
border: 1rpx solid rgba(255, 255, 255, 0.3);
.lang-btn {
width: 76rpx;
height: 76rpx;
border-radius: 38rpx;
background: rgba(255, 255, 255, 0.9);
border: 1rpx solid rgba(0, 0, 0, 0.06);
color: #111;
font-size: 26rpx;
line-height: 76rpx;
text-align: center;
box-shadow: 0 3rpx 10rpx rgba(33, 150, 243, 0.3);
box-shadow: 0 10rpx 24rpx rgba(0, 0, 0, 0.06);
}
/* Logo section - very compact */
.logo-section {
.hero {
padding: 26rpx 24rpx 14rpx;
}
.brand-row {
display: flex;
align-items: center;
}
.brand-mark {
width: 72rpx;
height: 72rpx;
border-radius: 20rpx;
background: linear-gradient(135deg, #ff4d4f 0%, #ff8a65 100%);
box-shadow: 0 12rpx 26rpx rgba(255, 77, 79, 0.28);
}
.brand-text {
margin-left: 18rpx;
display: flex;
flex-direction: column;
align-items: center;
/* #ifdef APP-PLUS */
margin: 15rpx 0 20rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin: 25rpx 0 30rpx;
/* #endif */
}
.app-title {
/* #ifdef APP-PLUS */
font-size: 28rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 36rpx;
/* #endif */
font-weight: bold;
color: #2196f3;
.brand-name {
font-size: 40rpx;
font-weight: 700;
color: #111;
letter-spacing: 1rpx;
}
.brand-slogan {
margin-top: 6rpx;
font-size: 24rpx;
color: rgba(0, 0, 0, 0.55);
}
.title-block {
margin-top: 26rpx;
}
.page-title {
/* #ifdef APP-PLUS */
font-size: 32rpx;
margin-top: 8rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 48rpx;
margin-top: 15rpx;
/* #endif */
font-weight: bold;
color: #333;
font-size: 46rpx;
font-weight: 700;
color: #111;
}
.page-subtitle {
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-top: 4rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
margin-top: 8rpx;
/* #endif */
color: #666;
}
/* Form container - optimized for tablets */
.form-container {
width: 100%;
/* #ifdef APP-PLUS */
max-width: 620rpx;
padding: 18rpx;
margin: 0 auto;
/* #endif */
/* #ifndef APP-PLUS */
max-width: 560rpx;
padding: 32rpx;
margin: 0 auto;
/* #endif */
background-color: #ffffff;
border-radius: 12rpx;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.06);
box-sizing: border-box;
}
/* Input groups - more compact */
.input-group {
/* #ifdef APP-PLUS */
margin-bottom: 18rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-bottom: 25rpx;
/* #endif */
}
.input-label {
/* #ifdef APP-PLUS */
font-size: 20rpx;
margin-bottom: 6rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-top: 10rpx;
font-size: 26rpx;
margin-bottom: 8rpx;
/* #endif */
font-weight: normal;
color: #333;
color: rgba(0, 0, 0, 0.55);
}
.card {
margin: 18rpx 24rpx 0;
padding: 26rpx 22rpx;
background: rgba(255, 255, 255, 0.96);
border-radius: 20rpx;
border: 1rpx solid rgba(0, 0, 0, 0.06);
box-shadow: 0 16rpx 36rpx rgba(0, 0, 0, 0.06);
}
.field {
margin-bottom: 18rpx;
}
.label {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.78);
margin-bottom: 10rpx;
display: block;
}
.input-field {
width: 100%;
/* #ifdef APP-PLUS */
height: 60rpx;
padding: 0 20rpx;
font-size: 22rpx;
/* #endif */
/* #ifndef APP-PLUS */
height: 80rpx;
padding: 0 25rpx;
font-size: 26rpx;
/* #endif */
border-radius: 8rpx;
border: 2rpx solid #ddd;
background-color: #f9f9f9;
box-sizing: border-box;
}
.input-error .input-field {
border-color: #f44336;
}
.error-text {
/* #ifdef APP-PLUS */
font-size: 20rpx;
margin-top: 5rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
margin-top: 6rpx;
/* #endif */
color: #f44336;
}
/* Password input */
.password-input-container {
.input-wrap {
position: relative;
}
.password-toggle {
position: absolute;
/* #ifdef APP-PLUS */
right: 12rpx;
top: 16rpx;
/* #endif */
/* #ifndef APP-PLUS */
right: 18rpx;
top: 22rpx;
/* #endif */
z-index: 1;
}
.toggle-icon {
/* #ifdef APP-PLUS */
font-size: 20rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 26rpx;
/* #endif */
color: #666;
}
/* Options row - more compact */
.options-row {
display: flex;
justify-content: flex-start;
align-items: center;
flex-direction: row;
/* #ifdef APP-PLUS */
margin: 10rpx 0 18rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin: 15rpx 0 25rpx;
/* #endif */
background: #f6f7f9;
border: 2rpx solid rgba(0, 0, 0, 0.06);
border-radius: 14rpx;
padding: 0 14rpx;
}
.remember-me {
.field-error .input-wrap {
border-color: rgba(255, 77, 79, 0.55);
background: rgba(255, 77, 79, 0.06);
}
.input {
flex: 1;
height: 84rpx;
font-size: 28rpx;
color: #111;
padding: 0 6rpx;
}
.suffix {
height: 84rpx;
padding: 0 10rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
justify-content: center;
}
.remember-me-text {
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-left: 6rpx;
/* #endif */
/* #ifndef APP-PLUS */
.suffix-text {
font-size: 24rpx;
margin-left: 8rpx;
/* #endif */
color: #666;
color: rgba(0, 0, 0, 0.55);
}
.forgot-password {
/* #ifdef APP-PLUS */
font-size: 18rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
/* #endif */
color: #2196f3;
.support {
margin-top: 10rpx;
font-size: 22rpx;
color: rgba(0, 0, 0, 0.52);
}
/* Login button - more compact */
.login-button {
width: 100%;
/* #ifdef APP-PLUS */
height: 60rpx;
font-size: 24rpx;
margin: 12rpx 0;
border-radius: 30rpx;
/* #endif */
/* #ifndef APP-PLUS */
height: 80rpx;
font-size: 30rpx;
margin: 18rpx 0; border-radius: 40rpx;
/* #endif */
background-image: linear-gradient(to right, #2196f3, #03a9f4);
color: #fff;
font-weight: normal;
.error {
color: #ff4d4f;
}
.center {
text-align: center;
box-shadow: 0 8rpx 16rpx rgba(3, 169, 244, 0.2);
width: 100%;
display: block;
}
.login-button:disabled {
background: #ccc;
.row {
margin: 8rpx 0 18rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.remember {
display: flex;
align-items: center;
}
.remember-text {
margin-left: 8rpx;
font-size: 24rpx;
color: rgba(0, 0, 0, 0.6);
}
.link {
font-size: 24rpx;
color: #ff4d4f;
}
.primary {
width: 100%;
height: 92rpx;
border-radius: 18rpx;
background: linear-gradient(135deg, #ff4d4f 0%, #ff7a45 100%);
color: #fff;
font-size: 30rpx;
font-weight: 600;
box-shadow: 0 16rpx 32rpx rgba(255, 77, 79, 0.24);
}
.primary:disabled {
background: #d9d9d9;
box-shadow: none;
}
/* General error */
.general-error {
width: 100%;
text-align: center;
color: #f44336;
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-top: 10rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
margin-top: 15rpx;
/* #endif */
}
/* Social login - very compact */
.social-login {
/* #ifdef APP-PLUS */
margin-top: 15rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-top: 25rpx;
/* #endif */
.divider {
margin-top: 22rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 14rpx;
}
.social-login-text {
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-bottom: 10rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
margin-bottom: 15rpx;
/* #endif */
color: #666;
.divider-line {
flex: 1;
height: 1rpx;
background: rgba(0, 0, 0, 0.08);
}
.social-buttons {
.divider-text {
font-size: 22rpx;
color: rgba(0, 0, 0, 0.45);
}
.social-row {
margin-top: 18rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 16rpx;
}
.social {
flex: 1;
height: 76rpx;
border-radius: 14rpx;
background: #ffffff;
border: 1rpx solid rgba(0, 0, 0, 0.08);
box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.04);
display: flex;
align-items: center;
justify-content: center;
}
.social-buttons .social-button {
/* #ifdef APP-PLUS */
margin-left: 10rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-left: 12rpx;
/* #endif */
}
.social-buttons .social-button:first-child {
margin-left: 0;
.social-label {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.7);
}
.social-button {
/* #ifdef APP-PLUS */
width: 50rpx;
height: 50rpx;
border-radius: 25rpx;
/* #endif */
/* #ifndef APP-PLUS */
width: 70rpx;
height: 70rpx;
border-radius: 35rpx;
/* #endif */
.footer {
margin-top: 22rpx;
display: flex;
align-items: center;
justify-content: center;
}
.footer-text {
font-size: 24rpx;
color: rgba(0, 0, 0, 0.55);
}
.footer-link {
margin-left: 8rpx;
font-size: 24rpx;
color: #ff4d4f;
font-weight: 600;
}
.trust {
padding: 18rpx 24rpx 36rpx;
}
.trust-text {
font-size: 22rpx;
color: rgba(0, 0, 0, 0.4);
text-align: center;
}
.social-icon {
/* #ifdef APP-PLUS */
font-size: 24rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 32rpx;
/* #endif */
color: #fff;
}
.google {
background-color: #db4437;
}
.facebook {
background-color: #4267B2;
}
.apple {
background-color: #000;
}
.wechat {
background-color: #1aad19;
}
.qq {
background-color: #498ad5;
}
.sms {
background-color: #ffb300;
}
/* Register option - compact */
.register-option {
display: flex;
justify-content: center;
/* #ifdef APP-PLUS */
margin-top: 15rpx;
margin-bottom: 5rpx;
/* #endif */
/* #ifndef APP-PLUS */
margin-top: 25rpx;
margin-bottom: 10rpx;
/* #endif */
}
.register-text {
/* #ifdef APP-PLUS */
font-size: 18rpx;
margin-right: 4rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
margin-right: 6rpx;
/* #endif */
color: #666;
}
.register-link {
/* #ifdef APP-PLUS */
font-size: 18rpx;
/* #endif */
/* #ifndef APP-PLUS */
font-size: 24rpx;
/* #endif */
color: #2196f3;
font-weight: normal;
}
</style>