feat: 登录页面的调整以及配置文件调整

This commit is contained in:
2025-10-28 20:00:06 +08:00
parent a53df50140
commit bd47eefd8a
7 changed files with 61 additions and 121 deletions

View File

@@ -5,8 +5,7 @@
"name": "智念", "name": "智念",
"placeholder": "快告诉智念您在想什么~", "placeholder": "快告诉智念您在想什么~",
"loginDesc": "您好,欢迎来到智念科技", "loginDesc": "您好,欢迎来到智念科技",
"logo": "@/pages/login/images/dh.png", "logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
"subLogo": "@/pages/login/images/dhwq.png"
}, },
"duohua": { "duohua": {
"clientId": "2", "clientId": "2",
@@ -14,8 +13,7 @@
"name": "朵朵", "name": "朵朵",
"placeholder": "快告诉朵朵您在想什么~", "placeholder": "快告诉朵朵您在想什么~",
"loginDesc": "您好,欢迎来到朵花温泉", "loginDesc": "您好,欢迎来到朵花温泉",
"logo": "@/pages/login/images/dh.png", "logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
"subLogo": "@/pages/login/images/dhwq.png"
}, },
"tianmu": { "tianmu": {
"clientId": "4", "clientId": "4",
@@ -23,7 +21,6 @@
"name": "沐沐", "name": "沐沐",
"placeholder": "快告诉沐沐您在想什么~", "placeholder": "快告诉沐沐您在想什么~",
"loginDesc": "您好,欢迎来到天沐温泉", "loginDesc": "您好,欢迎来到天沐温泉",
"logo": "@/pages/login/images/tm.png", "logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png"
"subLogo": "@/pages/login/images/wsmm.png"
} }
} }

View File

@@ -21,8 +21,7 @@
"name": "智念", "name": "智念",
"placeholder": "快告诉智念您在想什么~", "placeholder": "快告诉智念您在想什么~",
"loginDesc": "您好,欢迎来到智念科技", "loginDesc": "您好,欢迎来到智念科技",
"logo": "@/pages/login/images/dh.png", "logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
"subLogo": "@/pages/login/images/dhwq.png"
}, },
"duohua": { "duohua": {
"clientId": "2", "clientId": "2",
@@ -30,8 +29,7 @@
"name": "朵花", "name": "朵花",
"placeholder": "快告诉朵朵您在想什么~", "placeholder": "快告诉朵朵您在想什么~",
"loginDesc": "您好,欢迎来到朵花温泉", "loginDesc": "您好,欢迎来到朵花温泉",
"logo": "@/pages/login/images/dh.png", "logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
"subLogo": "@/pages/login/images/dhwq.png"
}, },
"tianmu": { "tianmu": {
"clientId": "4", "clientId": "4",
@@ -39,8 +37,7 @@
"name": "天沐", "name": "天沐",
"placeholder": "快告诉沐沐您在想什么~", "placeholder": "快告诉沐沐您在想什么~",
"loginDesc": "您好,欢迎来到天沐温泉", "loginDesc": "您好,欢迎来到天沐温泉",
"logo": "@/pages/login/images/tm.png", "logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png"
"subLogo": "@/pages/login/images/wsmm.png"
} }
} }
``` ```
@@ -98,6 +95,7 @@ node scripts/update-appid.js tianmu
- 保持 JSON 格式化 - 保持 JSON 格式化
3. **src/constant/base.js** 3. **src/constant/base.js**
- 更新 `getCurrentConfig()` 函数返回的客户端配置 - 更新 `getCurrentConfig()` 函数返回的客户端配置
4. **client-configs.json** 4. **client-configs.json**
@@ -156,6 +154,7 @@ A: 可以使用版本控制系统恢复,或者再次运行脚本切换到其
**Q: 如何添加新的客户端配置?** **Q: 如何添加新的客户端配置?**
A: 在 `client-configs.json` 中添加新的客户端配置: A: 在 `client-configs.json` 中添加新的客户端配置:
```json ```json
"new_client": { "new_client": {
"clientId": "客户端ID", "clientId": "客户端ID",
@@ -164,9 +163,9 @@ A: 在 `client-configs.json` 中添加新的客户端配置:
"placeholder": "输入框占位符文本", "placeholder": "输入框占位符文本",
"loginDesc": "登录页面描述文本", "loginDesc": "登录页面描述文本",
"logo": "@/pages/login/images/logo.png", "logo": "@/pages/login/images/logo.png",
"subLogo": "@/pages/login/images/sublogo.png"
} }
``` ```
`src/constant/base.js` 会自动读取并处理新配置,无需手动修改。 `src/constant/base.js` 会自动读取并处理新配置,无需手动修改。
**Q: 脚本提示"读取配置文件失败"怎么办?** **Q: 脚本提示"读取配置文件失败"怎么办?**

View File

@@ -1,6 +1,7 @@
.checkbox-wrapper { .checkbox-wrapper {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
.checkbox-icon { .checkbox-icon {
margin-right: 6px; margin-right: 6px;

View File

@@ -1,43 +1,15 @@
import DH from "@/pages/login/images/dh.png";
import DHWQ from "@/pages/login/images/dhwq.png";
import TM from "@/pages/login/images/tm.png";
import WSMM from "@/pages/login/images/wsmm.png";
/** /**
* 客户端配置管理模块 * 客户端配置管理模块
* *
* 功能说明: * 功能说明:
* 所有配置从根目录的 client-configs.json 文件中读取 * 所有配置从根目录的 client-configs.json 文件中读取
* 图片通过映射函数将路径转换为实际导入的模块
*/ */
// 直接导入配置文件 // 直接导入配置文件
import rawConfigs from '../../client-configs.json' with { type: 'json' }; import rawConfigs from '../../client-configs.json' with { type: 'json' };
// 图片路径映射表
const imageMap = {
'@/pages/login/images/dh.png': DH,
'@/pages/login/images/dhwq.png': DHWQ,
'@/pages/login/images/tm.png': TM,
'@/pages/login/images/wsmm.png': WSMM,
};
// 处理配置中的图片路径
const processConfigs = (configs) => {
const processed = {};
for (const [key, config] of Object.entries(configs)) {
processed[key] = {
...config,
logo: imageMap[config.logo] || config.logo,
subLogo: imageMap[config.subLogo] || config.subLogo,
};
}
return processed;
};
// 所有用户端的配置 - 处理后的配置 // 所有用户端的配置 - 处理后的配置
export const CLIENT_CONFIGS = processConfigs(rawConfigs); export const CLIENT_CONFIGS = rawConfigs;
// 获取当前用户端配置 // 获取当前用户端配置
export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian; export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian;

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="login-wrapper" :style="{ backgroundImage: `url(${loginBg})` }"> <view class="login-wrapper bg-liner">
<!-- 返回按钮 --> <!-- 返回按钮 -->
<view class="back-btn" @click="goBack"> <view class="back-btn" @click="goBack">
<uni-icons fontFamily="znicons" size="24" color="#333"> <uni-icons fontFamily="znicons" size="24" color="#333">
@@ -10,11 +10,27 @@
<!-- 头部内容 --> <!-- 头部内容 -->
<view class="login-header"> <view class="login-header">
<!-- 卡通形象 --> <!-- 卡通形象 -->
<image class="login-avatar" :src="logo" mode="widthFix"></image> <image class="w-full h-full" :src="logo" mode="widthFix" />
<image class="login-title" :src="subLogo" mode="widthFix"></image> </view>
<!-- 描述 --> <!-- 协议勾选 -->
<view class="login-desc">{{ loginDesc }}</view> <view class="login-agreement flex flex-items-center">
<CheckBox v-model="isAgree">
<text class="font-size-12 color-525866">我已阅读并同意</text>
<text
class="font-size-12 color-2D91FF ml-4 mr-4"
@click.stop="handleAgreeClick('service')"
>服务协议</text
>
<text class="font-size-12 color-525866"></text>
<text
class="font-size-12 color-2D91FF ml-4 mr-4"
@click.stop="handleAgreeClick('privacy')"
>隐私协议</text
>
<text class="font-size-12 color-525866">\n</text>
<text class="font-size-12 color-525866 ml-30">授权与账号关联操作</text>
</CheckBox>
</view> </view>
<!-- 按钮区域 --> <!-- 按钮区域 -->
@@ -27,6 +43,7 @@
type="primary" type="primary"
@click="handleAgreeAndGetPhone" @click="handleAgreeAndGetPhone"
> >
<uni-icons type="weixin" size="20" color="#fff"></uni-icons>
微信一键登录 微信一键登录
</button> </button>
@@ -37,6 +54,7 @@
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber" @getphonenumber="getPhoneNumber"
> >
<uni-icons type="weixin" size="20" color="#fff"></uni-icons>
微信一键登录 微信一键登录
</button> </button>
@@ -46,28 +64,11 @@
type="primary" type="primary"
@click="handleLogin" @click="handleLogin"
> >
<uni-icons type="weixin" size="20" color="#fff"></uni-icons>
微信一键登录 微信一键登录
</button> </button>
</view> </view>
<!-- 协议勾选 -->
<view class="login-agreement">
<CheckBox v-model="isAgree">
<text class="login-agreement-text">阅读并同意</text>
<text
class="login-agreement-link"
@click.stop="handleAgreeClick('service')"
>服务协议</text
>
<text class="login-agreement-text"></text>
<text
class="login-agreement-link"
@click.stop="handleAgreeClick('privacy')"
>隐私协议</text
>
</CheckBox>
</view>
<AgreePopup <AgreePopup
ref="agreePopup" ref="agreePopup"
:visible="visible" :visible="visible"
@@ -84,7 +85,6 @@ import {
getPrivacyAgreement, getPrivacyAgreement,
} from "@/request/api/LoginApi"; } from "@/request/api/LoginApi";
import { onLogin, goBack } from "@/hooks/useGoLogin"; import { onLogin, goBack } from "@/hooks/useGoLogin";
import loginBg from "./images/bg.png";
import CheckBox from "@/components/CheckBox/index.vue"; import CheckBox from "@/components/CheckBox/index.vue";
import AgreePopup from "./components/AgreePopup/index.vue"; import AgreePopup from "./components/AgreePopup/index.vue";
import { zniconsMap } from "@/static/fonts/znicons.js"; import { zniconsMap } from "@/static/fonts/znicons.js";
@@ -99,8 +99,6 @@ const privacyAgreement = ref("");
// 协议类型 // 协议类型
const AgreeType = ref("service"); const AgreeType = ref("service");
const logo = computed(() => getCurrentConfig().logo); const logo = computed(() => getCurrentConfig().logo);
const subLogo = computed(() => getCurrentConfig().subLogo);
const loginDesc = computed(() => getCurrentConfig().loginDesc);
// 同意隐私协议并获取手机号 // 同意隐私协议并获取手机号
const handleAgreeAndGetPhone = () => { const handleAgreeAndGetPhone = () => {

View File

@@ -4,11 +4,8 @@
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
height: 100vh; height: 100vh;
padding-top: 168px; padding-top: 100px;
position: relative; position: relative;
background-position: 0 0;
background-size: 100% 100%;
background-repeat: no-repeat;
.back-btn { .back-btn {
position: absolute; position: absolute;
@@ -23,52 +20,24 @@
} }
.login-header { .login-header {
text-align: center; margin-top: 40px;
max-height: 223px; width: 200px;
height: 200px;
.login-avatar {
width: 150px;
display: block;
}
.login-title {
width: 137px;
height: 32px;
margin: 6px auto;
}
.login-desc {
font-size: $uni-font-size-sm;
color: #1e4c69;
line-height: 24px;
}
} }
.login-btn-area { .login-btn-area {
margin-top: 46px; margin-top: 20px;
width: 297px; width: 304px;
.login-btn { .login-btn {
background: linear-gradient(246deg, #22a7ff 0%, #2567ff 100%); background: #2d91ff;
width: 100%; width: 100%;
border-radius: $uni-border-radius-50px; border-radius: 10px;
} }
} }
.login-agreement { .login-agreement {
margin-top: 20px; margin-top: 80px;
display: flex; width: 304px;
align-items: center;
.login-agreement-text {
font-size: $uni-font-size-base;
color: #666;
}
.login-agreement-link {
font-size: $uni-font-size-base;
color: #007aff;
margin: 0 5px;
}
} }
} }

View File

@@ -106,3 +106,7 @@
.ml-24 { .ml-24 {
margin-left: 24px; margin-left: 24px;
} }
.ml-30 {
margin-left: 30px;
}