feat(login): 添加迷你登录页面并更新相关组件

- 新增迷你登录页面 indexMini.vue
- 更新 Tabbar.vue 组件样式和图片路径
- 修改 mineMini.vue 组件跳转逻辑至迷你登录页
This commit is contained in:
zzp 2025-08-17 11:08:27 +08:00
parent 1ba80c041c
commit b3cd7aff28
4 changed files with 290 additions and 82 deletions

View File

@ -3,12 +3,13 @@
<PageHeaderView title="个人中心"></PageHeaderView>
<!-- 用户信息 -->
<view class="userContainer">
<u-avatar src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/avatar.png" size="60"></u-avatar>
<u-avatar
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/avatar.png"
size="60"
></u-avatar>
<view class="userData">
<text class="phone">{{
!isLoginStatus
? "未登录用户"
: maskPhoneNumber()
!isLoginStatus ? "未登录用户" : maskPhoneNumber()
}}</text>
<!-- <view class="setUserData">
编辑我的个人资料
@ -34,30 +35,53 @@
<!-- 其他功能区 -->
<view class="otherContainer" v-if="isLoginStatus">
<u-cell-group :border="false">
<u-cell title="已订阅栏目" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/vip.png" isLink
:iconStyle="{ width: '46rpx', height: '32rpx', marginRight: '14rpx' }" :titleStyle="{
<u-cell
title="已订阅栏目"
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/vip.png"
isLink
:iconStyle="{ width: '46rpx', height: '32rpx', marginRight: '14rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(-1)">
}"
@click="handleClick(-1)"
>
</u-cell>
<u-cell title="我的收藏" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/star.png" isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
<u-cell
title="我的收藏"
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/star.png"
isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(0)">
}"
@click="handleClick(0)"
>
</u-cell>
<u-cell title="我喜欢的" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/like.png" isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
<u-cell
title="我喜欢的"
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/like.png"
isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(1)">
}"
@click="handleClick(1)"
>
</u-cell>
<!-- title="浏览记录" :icon="time" :border="false" -->
<u-cell icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png" isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
<u-cell
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png"
isLink
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
:titleStyle="{
fontSize: '32rpx',
color: '#333333',
}" @click="handleClick(2)">
}"
@click="handleClick(2)"
>
<template #title>
<view class="recordText">
<text style="font-size: 32rpx">浏览记录</text>
@ -82,8 +106,12 @@
</view>
<!-- 登录弹框 -->
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" />
<LoginPopup
:show="LoginShow"
@handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback"
@handlePopupErrorCallback="handlePopupErrorCallback"
/>
</view>
</template>
@ -103,26 +131,23 @@ const isLoginStatus = ref(false);
const LoginShow = ref(false);
onMounted(() => {
console.log("🚀 ~ uni.getStorageSync('token'):", uni.getStorageSync('token'))
console.log("🚀 ~ uni.getStorageSync('token'):", uni.getStorageSync("token"));
if (uni.getStorageSync('token')) {
if (uni.getStorageSync("token")) {
isLoginStatus.value = true;
}
});
// *
const maskPhoneNumber = (phoneNumber: string) => {
if (!phoneNumber && uni.getStorageSync('userPhone')) {
phoneNumber = uni.getStorageSync('userPhone')
if (!phoneNumber && uni.getStorageSync("userPhone")) {
phoneNumber = uni.getStorageSync("userPhone");
}
if (phoneNumber) {
return phoneNumber.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
} else {
return "未登录用户";
}
};
//
@ -146,7 +171,10 @@ const loginBtnStatus = () => {
// 退
loginOut();
} else {
LoginShow.value = true;
// LoginShow.value = true;
uni.navigateTo({
url: "/pages/login/indexMini",
});
}
};

View File

@ -1,25 +1,41 @@
<template>
<view class="tabbar">
<view class="tabbar_item" @click="tabChange(0)">
<image v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.pngg"
class="tabbar_img" />
<image v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 0 ? '#D13E3C' : '#757A80' }">海外资讯</text>
</view>
<view class="tabbar_item" @click="tabChange(1)">
<image v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }">全部</text>
</view>
<view class="tabbar">
<view class="tabbar_item" @click="tabChange(0)">
<image
v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.png"
class="tabbar_img"
/>
<image
v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png"
class="tabbar_img"
/>
<text
class="tabbar_title"
:style="{ color: tabIndex == 0 ? '#D13E3C' : '#757A80' }"
>海外资讯</text
>
</view>
<view class="tabbar_item" @click="tabChange(1)">
<image
v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
class="tabbar_img"
/>
<image
v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
class="tabbar_img"
/>
<text
class="tabbar_title"
:style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }"
>全部</text
>
</view>
</view>
</template>
<script setup>
@ -28,50 +44,49 @@ const emit = defineEmits(["tabChange"]);
const tabIndex = ref(0);
function tabChange(index) {
tabIndex.value = index;
emit("tabChange", index);
tabIndex.value = index;
emit("tabChange", index);
}
onMounted(async () => { });
onMounted(async () => {});
</script>
<style scoped lang="scss">
.tabbar {
display: flex;
width: 100vw;
height: 150rpx;
position: fixed;
bottom: 0;
left: 0;
box-shadow: 0 -2rpx 10rpx rgba(128, 128, 128, 0.2);
width: 100vw;
background-color: white;
z-index: 9999999;
.tabbar_item {
width: 50%;
display: flex;
width: 100vw;
height: 150rpx;
position: fixed;
bottom: 0;
left: 0;
box-shadow: 0 -2rpx 10rpx rgba(128, 128, 128, 0.2);
width: 100vw;
background-color: white;
z-index: 9999999;
flex-direction: column;
align-items: center;
margin-top: 30rpx;
}
.tabbar_item {
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 30rpx;
}
.tabbar_img {
width: 44rpx;
height: 44rpx;
}
.tabbar_img {
width: 44rpx;
height: 44rpx;
}
.tabbar_title {
display: flex;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 20rpx;
color: #666666;
line-height: 28rpx;
text-align: left;
font-style: normal;
margin-top: 5rpx;
}
.tabbar_title {
display: flex;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 20rpx;
color: #666666;
line-height: 28rpx;
text-align: left;
font-style: normal;
margin-top: 5rpx;
}
}
</style>

View File

@ -22,6 +22,9 @@
{
"path": "pages/login/index"
},
{
"path": "pages/login/indexMini"
},
{
"path": "pages/realtimeInfo/rankDetail"
},

View File

@ -0,0 +1,162 @@
<template>
<view class="loginContainer">
<!-- prompt -->
<!-- <view class="prompt"></view> -->
<!-- logo -->
<view class="logo"></view>
<view class="bottom_btn" @click="goIndex"> 立即进入 </view>
<!-- 用户协议 -->
<view class="tips">
<u-checkbox class="checkbox" shape="circle"></u-checkbox>
<text class="r_userAgreement"
>已阅读并同意<text class="userAgreement"
>江南农商银行隐私政策中证参考智能资讯小程序服务使用许可及服务协议</text
>首次登录的手机号将自动注册</text
>
</view>
</view>
</template>
<script setup lang="ts">
import { onMounted, ref, reactive, watch, nextTick, onActivated } from "vue";
import {
onLaunch,
onShow,
onLoad,
onShareAppMessage,
onShareTimeline,
onUnload,
} from "@dcloudio/uni-app";
import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
import { useShareStore } from "@/stores/shareStore";
const stores = useShareStore();
let timer = ref();
function goIndex() {
const subStatus = {
overseas: false, //
domestic: false, //
chinaSecurities: false, //
};
uni.setStorageSync("subStatus", subStatus);
//
uni.removeStorageSync("tabValue");
uni.removeStorageSync("colTypeValue");
uni.navigateTo({
url: "/pages/home/index",
});
}
onShareAppMessage((res) => {
return {};
});
// onReachBottom(() => {
// console.log("🚀 ~ onReachBottom ~ onReachBottom:");
// });
//
onLoad((option) => {
// timer.value = setTimeout(() => {
// uni.navigateTo({
// url: "/pages/home/index",
// });
// }, 2000)
});
//
onUnload(() => {
clearTimeout(timer.value);
});
onShow(() => {
stores.initWxConfig();
});
</script>
<style lang="scss" scoped>
.loginContainer {
height: 100vh;
overflow-y: auto;
background-image: url(https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/log_bg.png);
background-size: cover;
position: relative;
box-sizing: border-box;
padding: 176rpx 0;
.prompt {
width: 80rpx;
height: 596rpx;
position: absolute;
left: 50%;
top: 0;
margin-top: 176rpx;
transform: translateX(-50%);
background-image: url(https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/new_logo.png);
background-size: contain;
}
.logo {
width: 292rpx;
height: 68rpx;
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
margin-bottom: 176rpx;
background-image: url(https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/logo.png);
background-size: cover;
}
}
.bottom_btn {
width: 360rpx;
height: 80rpx;
background: linear-gradient(to right, #fc5c69, #e7303f);
border-radius: 100rpx;
position: fixed;
bottom: 270rpx;
left: 50%;
transform: translate(-50%, 0);
box-shadow: 0 0 10rpx rgba($color: #000000, $alpha: 0.1);
display: flex;
color: white;
font-size: 32rpx;
text-align: center;
justify-content: center;
align-items: center;
}
.tips {
width: 87vw;
position: fixed;
bottom: 370rpx;
left: 50%;
transform: translate(-50%, 0);
display: flex;
align-items: start;
.checkbox {
}
:deep(.u-checkbox) {
margin-top: 5rpx;
}
.r_userAgreement {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #192236;
line-height: 40rpx;
text-align: left;
font-style: normal;
}
.userAgreement {
color: #5978b2;
}
}
</style>