feat(article): 添加access参数支持H5入口判断

添加access属性用于区分H5和其他入口,H5入口需要判断账号是否为正式或试用类型
This commit is contained in:
傅光孟 2026-02-25 17:36:53 +08:00
parent ee1c73babe
commit 627d0b006a
13 changed files with 58 additions and 27 deletions

View File

@ -6,9 +6,9 @@
<view class="name" :class="{ mohu: isMask }"> <view class="name" :class="{ mohu: isMask }">
<text class="text">来源:</text> <text class="text">来源:</text>
<text class="text" v-if="intoType === 'etf'">中国证券报</text> <text class="text" v-if="intoType === 'etf'">中国证券报</text>
<text class="text" v-else>{{ <text class="text" v-else>
props.data.tag ? props.data.tag : "中国证券报" {{ props.data.tag ? props.data.tag : "中国证券报" }}
}}</text> </text>
</view> </view>
<!-- <view class="name" v-if="props.data.editor"> <!-- <view class="name" v-if="props.data.editor">
@ -199,6 +199,10 @@ const props = defineProps({
type: Array, type: Array,
default: () => [], default: () => [],
}, },
access: {
type: String,
default: () => "",
},
}); });
const tagList1 = ref([ const tagList1 = ref([
{ {
@ -215,7 +219,11 @@ const tagList1 = ref([
const userStore = useUserStore(); const userStore = useUserStore();
// | // |
const isMask = computed(() => { const isMask = computed(() => {
return !userStore.isLogin || !userStore.isUserType; return !userStore.isLogin || !isUserType.value;
});
// h5h5|
const isUserType = computed(() => {
return props.access === "h5" ? userStore.isUserType : true;
}); });
// //
@ -324,9 +332,15 @@ const handleSub = () => {
// //
const goNewsDetail = (item: any) => { const goNewsDetail = (item: any) => {
if (props.access === "h5") {
uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
});
} else {
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}`,
}); });
}
}; };
// //

View File

@ -120,7 +120,7 @@ function goDetail(item: any) {
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} }

View File

@ -14,6 +14,7 @@
<Article <Article
:data="data" :data="data"
:furtherReadData="furtherReadData" :furtherReadData="furtherReadData"
:access="access"
@getFurtherReadData="getFurtherReadData" @getFurtherReadData="getFurtherReadData"
/> />
@ -213,7 +214,13 @@ const getFurtherReadData = () => {
}); });
}; };
// h5h5|
const access = ref("");
onLoad(async (option: any) => { onLoad(async (option: any) => {
// h5h5|
access.value = option.access || '';
news_id.value = option.id; news_id.value = option.id;
aplus_queue.push({ aplus_queue.push({
action: "aplus.sendPV", action: "aplus.sendPV",

View File

@ -148,7 +148,7 @@ function goDetail(item: any) {
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} }

View File

@ -120,7 +120,7 @@ function goDetail(item: any) {
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} }

View File

@ -112,7 +112,7 @@ function goDetail(item: any) {
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} }

View File

@ -51,7 +51,7 @@ const userStore = useUserStore();
function goDetail(item: any) { function goDetail(item: any) {
if (userStore.isLogin) { if (userStore.isLogin) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} else { } else {
emit("onShow"); emit("onShow");

View File

@ -70,7 +70,7 @@ function goDetail(item: any) {
} }
if (!item.id) return; if (!item.id) return;
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} }

View File

@ -75,7 +75,7 @@ function goDetail(item: any) {
} }
if (!item.id) return; if (!item.id) return;
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} }

View File

@ -51,9 +51,11 @@ import TodayNewsView from "./components/TodayNewsView/index.vue";
import FooterView from "./components/FooterView/index.vue"; import FooterView from "./components/FooterView/index.vue";
import LoginDialog from "@/pages/realtimeInfo/components/LoginPopup/index.vue"; import LoginDialog from "@/pages/realtimeInfo/components/LoginPopup/index.vue";
import { useUserStore } from "@/stores/user"; import { useUserStore } from "@/stores/user";
import { Session } from "@/utils/storage";
const userStore = useUserStore(); const userStore = useUserStore();
// //
const LoginShow = ref(false); const LoginShow = ref(false);
@ -76,6 +78,12 @@ const handleLoginError = () => {
}; };
onMounted(async () => { onMounted(async () => {
console.log('output >>>>> Session.get("userInfos")',Session.get("userInfos"));
if(!Session.get("userInfos")) {
Session.clear()
}
if (!userStore.isLogin) { if (!userStore.isLogin) {
handleShowLogin(); handleShowLogin();
} }

View File

@ -92,11 +92,11 @@
v-show="selectKeys.includes(news.id)" v-show="selectKeys.includes(news.id)"
:class="['events-list', { mask: isMask }]" :class="['events-list', { mask: isMask }]"
> >
<view <template
class="events-item" v-for="(further, index) in news.furtherReadings"
v-for="further in news.furtherReadings"
:key="further.id" :key="further.id"
> >
<view class="events-item" v-if="index < 3">
<view class="events-item-line"></view> <view class="events-item-line"></view>
<view class="events-item-content"> <view class="events-item-content">
<view class="events-content-date">{{ further.timeStr }}</view> <view class="events-content-date">{{ further.timeStr }}</view>
@ -105,6 +105,7 @@
</view> </view>
</view> </view>
</view> </view>
</template>
</view> </view>
</view> </view>
</view> </view>
@ -198,7 +199,7 @@ function goDetail(item: any) {
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&access=h5`,
}); });
} }
@ -217,6 +218,7 @@ const getList = async () => {
keyword: keyword.value, keyword: keyword.value,
page: pages.page, page: pages.page,
size: pages.size, size: pages.size,
start: 3,
}); });
loading.value = false; loading.value = false;
if (result.code === 200) { if (result.code === 200) {

View File

@ -250,7 +250,7 @@ async function getNewsList() {
function goDetail(item: any) { function goDetail(item: any) {
if (userStore.isLogin) { if (userStore.isLogin) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.news_id}`, url: `/pages/detail/indexNewsInfo?id=${item.news_id}&access=h5`,
}); });
} else { } else {
handleShowLogin(); handleShowLogin();

View File

@ -53,10 +53,10 @@ const storeSetup = () => {
// 试用 | 正式 // 试用 | 正式
const isUserType = computed(() => { const isUserType = computed(() => {
// 0:测试 1:正式 判断账号类型 // 0:测试 1:正式 判断账号类型
// return getUserInfos().accountType === 1 ? true : false; return getUserInfos()?.accountType === 1 ? true : false;
// 为了兼容之前的版本,暂时不区分账号类型,先放开正式账号和测试账号的限制 // 为了兼容之前的版本,暂时不区分账号类型,先放开正式账号和测试账号的限制
return true; // return true;
}); });
// 登录 // 登录