feat: 更新用户界面和导航逻辑
- 修改Tabbar标签文本从"全部"到"我的" - 移除首页tab索引的本地存储 - 更新未登录时的跳转链接到mini登录页 - 为详情页添加分享到朋友圈功能 - 优化用户中心组件格式和隐私协议入口 - 添加导航前检查登录状态逻辑
This commit is contained in:
parent
e35509eda8
commit
21f418ff6f
|
|
@ -187,9 +187,15 @@ const props = defineProps({
|
||||||
const clickItem = ref({});
|
const clickItem = ref({});
|
||||||
function goDetail(item) {
|
function goDetail(item) {
|
||||||
clickItem.value = item;
|
clickItem.value = item;
|
||||||
|
if (uni.getStorageSync("token")) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/detail/indexNewsInfo?id=${item.news_id}`,
|
url: `/pages/detail/indexNewsInfo?id=${item.news_id}`,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/login/indexMini",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// if (uni.getStorageSync("token")) {
|
// if (uni.getStorageSync("token")) {
|
||||||
// clickItem.value = item;
|
// clickItem.value = item;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,10 @@
|
||||||
<view class="mine">
|
<view class="mine">
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<view class="userContainer">
|
<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">
|
<view class="userData">
|
||||||
<text class="phone">{{
|
<text class="phone">{{
|
||||||
!isLoginStatus
|
!isLoginStatus
|
||||||
|
|
@ -33,30 +36,53 @@
|
||||||
<!-- 其他功能区 -->
|
<!-- 其他功能区 -->
|
||||||
<view class="otherContainer" v-if="isLoginStatus">
|
<view class="otherContainer" v-if="isLoginStatus">
|
||||||
<u-cell-group :border="false">
|
<u-cell-group :border="false">
|
||||||
<u-cell title="已订阅栏目" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/vip.png" isLink
|
<u-cell
|
||||||
:iconStyle="{ width: '46rpx', height: '32rpx', marginRight: '14rpx' }" :titleStyle="{
|
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',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(-1)">
|
}"
|
||||||
|
@click="handleClick(-1)"
|
||||||
|
>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<u-cell title="我的收藏" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/star.png" isLink
|
<u-cell
|
||||||
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
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',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(0)">
|
}"
|
||||||
|
@click="handleClick(0)"
|
||||||
|
>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<u-cell title="我喜欢的" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/like.png" isLink
|
<u-cell
|
||||||
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
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',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(1)">
|
}"
|
||||||
|
@click="handleClick(1)"
|
||||||
|
>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<!-- title="浏览记录" :icon="time" :border="false" -->
|
<!-- title="浏览记录" :icon="time" :border="false" -->
|
||||||
<u-cell icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png" isLink
|
<u-cell
|
||||||
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png"
|
||||||
|
isLink
|
||||||
|
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
|
||||||
|
:titleStyle="{
|
||||||
fontSize: '32rpx',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(2)">
|
}"
|
||||||
|
@click="handleClick(2)"
|
||||||
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<view class="recordText">
|
<view class="recordText">
|
||||||
<text style="font-size: 32rpx">浏览记录</text>
|
<text style="font-size: 32rpx">浏览记录</text>
|
||||||
|
|
@ -64,8 +90,6 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
|
|
||||||
|
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -83,8 +107,12 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 登录弹框 -->
|
<!-- 登录弹框 -->
|
||||||
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
|
<LoginPopup
|
||||||
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" />
|
:show="LoginShow"
|
||||||
|
@handlePopupClose="handlePopupClose"
|
||||||
|
@handlePopupSuccessCallback="handlePopupSuccessCallback"
|
||||||
|
@handlePopupErrorCallback="handlePopupErrorCallback"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -151,7 +179,6 @@ const loginOut = () => {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: "/pages/login/index",
|
url: "/pages/login/index",
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (val: number) => {
|
const handleClick = (val: number) => {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
<Navbar title="中证参考" :hasBack="false"></Navbar>
|
<Navbar title="中证参考" :hasBack="false"></Navbar>
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<view class="userContainer">
|
<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">
|
<view class="userData">
|
||||||
<text class="phone">{{
|
<text class="phone">{{
|
||||||
!isLoginStatus ? "未登录用户" : maskPhoneNumber()
|
!isLoginStatus ? "未登录用户" : maskPhoneNumber()
|
||||||
|
|
@ -38,24 +41,41 @@
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(-1)">
|
}" @click="handleClick(-1)">
|
||||||
</u-cell> -->
|
</u-cell> -->
|
||||||
<u-cell title="我的收藏" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/star.png" isLink
|
<u-cell
|
||||||
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
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',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(0)">
|
}"
|
||||||
|
@click="handleClick(0)"
|
||||||
|
>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<u-cell title="我喜欢的" icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/like.png" isLink
|
<u-cell
|
||||||
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
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',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(1)">
|
}"
|
||||||
|
@click="handleClick(1)"
|
||||||
|
>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<!-- title="浏览记录" :icon="time" :border="false" -->
|
<!-- title="浏览记录" :icon="time" :border="false" -->
|
||||||
<u-cell icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png" isLink
|
<u-cell
|
||||||
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/time.png"
|
||||||
|
isLink
|
||||||
|
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
|
||||||
|
:titleStyle="{
|
||||||
fontSize: '32rpx',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(2)">
|
}"
|
||||||
|
@click="handleClick(2)"
|
||||||
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<view class="recordText">
|
<view class="recordText">
|
||||||
<text style="font-size: 32rpx">浏览记录</text>
|
<text style="font-size: 32rpx">浏览记录</text>
|
||||||
|
|
@ -63,13 +83,17 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<u-cell title="隐私协议"
|
<u-cell
|
||||||
|
title="隐私协议"
|
||||||
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE%E5%92%8C%E7%94%A8%E6%88%B7%E5%8D%8F%E8%AE%AEicon.png"
|
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE%E5%92%8C%E7%94%A8%E6%88%B7%E5%8D%8F%E8%AE%AEicon.png"
|
||||||
isLink :iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }" :titleStyle="{
|
isLink
|
||||||
|
:iconStyle="{ width: '40rpx', height: '40rpx', marginRight: '20rpx' }"
|
||||||
|
:titleStyle="{
|
||||||
fontSize: '32rpx',
|
fontSize: '32rpx',
|
||||||
color: '#333333',
|
color: '#333333',
|
||||||
}" @click="handleClick(3)">
|
}"
|
||||||
|
@click="handleClick(3)"
|
||||||
|
>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -88,8 +112,12 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 登录弹框 -->
|
<!-- 登录弹框 -->
|
||||||
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
|
<LoginPopup
|
||||||
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" />
|
:show="LoginShow"
|
||||||
|
@handlePopupClose="handlePopupClose"
|
||||||
|
@handlePopupSuccessCallback="handlePopupSuccessCallback"
|
||||||
|
@handlePopupErrorCallback="handlePopupErrorCallback"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -99,9 +127,9 @@ import { onPullDownRefresh, onShow } from "@dcloudio/uni-app";
|
||||||
import { Session } from "@/utils/storage";
|
import { Session } from "@/utils/storage";
|
||||||
import LoginPopup from "@/components/loginPopup/index.vue";
|
import LoginPopup from "@/components/loginPopup/index.vue";
|
||||||
import { useShareStore } from "@/stores/shareStore";
|
import { useShareStore } from "@/stores/shareStore";
|
||||||
import Navbar from '@/components/mini/Navbar.vue'
|
import Navbar from "@/components/mini/Navbar.vue";
|
||||||
|
|
||||||
const emit = defineEmits(['logout'])
|
const emit = defineEmits(["logout"]);
|
||||||
|
|
||||||
const stores = useShareStore();
|
const stores = useShareStore();
|
||||||
const curPages = getCurrentPages();
|
const curPages = getCurrentPages();
|
||||||
|
|
@ -161,11 +189,12 @@ const loginBtnStatus = () => {
|
||||||
|
|
||||||
// 退出登录,回到登录页面
|
// 退出登录,回到登录页面
|
||||||
const loginOut = () => {
|
const loginOut = () => {
|
||||||
uni.clearStorageSync()
|
uni.clearStorageSync();
|
||||||
emit("logout")
|
emit("logout");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (val: number) => {
|
const handleClick = (val: number) => {
|
||||||
|
uni.setStorageSync("homeTabIndex", 1);
|
||||||
if (val === -1) {
|
if (val === -1) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/subscribed/index",
|
url: "/pages/subscribed/index",
|
||||||
|
|
@ -176,8 +205,7 @@ const handleClick = (val: number) => {
|
||||||
fail: () => {}, // 打开失败
|
fail: () => {}, // 打开失败
|
||||||
complete: () => {},
|
complete: () => {},
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/bookmark/index?tabs=${val}`,
|
url: `/pages/bookmark/index?tabs=${val}`,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
<text
|
<text
|
||||||
class="tabbar_title"
|
class="tabbar_title"
|
||||||
:style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }"
|
:style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }"
|
||||||
>全部
|
>我的
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,12 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { onLoad, onShareAppMessage, onShow } from "@dcloudio/uni-app";
|
import {
|
||||||
|
onLoad,
|
||||||
|
onShareAppMessage,
|
||||||
|
onShareTimeline,
|
||||||
|
onShow,
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
import { onReachBottom } from "@dcloudio/uni-app";
|
import { onReachBottom } from "@dcloudio/uni-app";
|
||||||
import {
|
import {
|
||||||
fetchArticleDetail,
|
fetchArticleDetail,
|
||||||
|
|
@ -235,7 +240,17 @@ function goLogin() {
|
||||||
url: "/pages/login/indexMini",
|
url: "/pages/login/indexMini",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onShareTimeline(async (res) => {
|
||||||
|
let { code } = await doShare({
|
||||||
|
id: data.value.id,
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
title: data.value.title, //标题
|
||||||
|
path: "/page/detail/indexNewsInfo?id=" + data.value.id, //可以指定动态路径
|
||||||
|
imageUrl:
|
||||||
|
"https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_pic_1%402x.png", //分享图
|
||||||
|
};
|
||||||
|
});
|
||||||
onShareAppMessage(async (res) => {
|
onShareAppMessage(async (res) => {
|
||||||
console.log("🚀 ~ res:", res);
|
console.log("🚀 ~ res:", res);
|
||||||
console.log("🚀 ~ data.value:", data.value);
|
console.log("🚀 ~ data.value:", data.value);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ async function getNewsList() {
|
||||||
const tabIndex = ref(0);
|
const tabIndex = ref(0);
|
||||||
function tabChange(index) {
|
function tabChange(index) {
|
||||||
tabIndex.value = index;
|
tabIndex.value = index;
|
||||||
uni.setStorageSync("homeTabIndex", index);
|
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,15 @@ async function getListByTagFn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function goDetail(item) {
|
function goDetail(item) {
|
||||||
|
if (uni.getStorageSync("token")) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/detail/indexNewsInfo?id=" + item.id,
|
url: "/pages/detail/indexNewsInfo?id=" + item.id,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/login/indexMini",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tagClickedClass = ref("");
|
const tagClickedClass = ref("");
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ const handleSwiperJump = (item: any) => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/login/index",
|
url: "/pages/login/indexMini",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// if (item.needpay) {
|
// if (item.needpay) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue