fix: 修复登录状态判断及样式模糊问题

refactor: 优化代码格式和组件结构

feat: 添加点击登录跳转功能

style: 调整搜索框宽度和样式

chore: 更新API基础URL配置
This commit is contained in:
zzp 2025-08-20 13:30:34 +08:00
parent 21662afa47
commit 1ac4d39e91
9 changed files with 471 additions and 230 deletions

View File

@ -8,10 +8,9 @@ onLaunch(() => {
console.log("App Launch"); console.log("App Launch");
stores.initWxConfig(); stores.initWxConfig();
}); });
onShow(() => { }); onShow(() => {});
onHide(() => { onHide(() => {
console.log("App Hide"); console.log("App Hide");
uni.setStorageSync('homeTabIndex', null)
}); });
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -1,18 +1,34 @@
<template> <template>
<view class="news-rank-list"> <view class="news-rank-list">
<u-skeleton rows="5" title loading style="margin-bottom: 30rpx" v-if="loading"></u-skeleton> <u-skeleton
rows="5"
title
loading
style="margin-bottom: 30rpx"
v-if="loading"
></u-skeleton>
<view class="list" v-else> <view class="list" v-else>
<view v-for="(item, index) in rankListLocal" :key="index" class="news-item" @click="goDetail(item, 0)"> <view
v-for="(item, index) in rankListLocal"
:key="index"
class="news-item"
@click="goDetail(item, 0)"
>
<view class="rank-tag"> <view class="rank-tag">
<view v-if="index == 0" class="rank-text-top3"> <view v-if="index == 0" class="rank-text-top3">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_top_1.png" /> <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_top_1.png"
/>
</view> </view>
<view v-else-if="index == 1" class="rank-text-top3"> <view v-else-if="index == 1" class="rank-text-top3">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_top_2.png" /> <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_top_2.png"
/>
</view> </view>
<view v-else-if="index == 2" class="rank-text-top3"> <view v-else-if="index == 2" class="rank-text-top3">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_top_3.png" /> <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_top_3.png"
/>
</view> </view>
<text class="rank-text" v-else>{{ index + 1 }}</text> <text class="rank-text" v-else>{{ index + 1 }}</text>
</view> </view>
@ -21,15 +37,19 @@
<view class="news-content"> <view class="news-content">
<text style=""> <text style="">
<text class="news-title">{{ item.title.slice(0, 3) }}</text> <text class="news-title">{{ item.title.slice(0, 3) }}</text>
<text :class="['news-title', isLogin ? '' : 'mohu']">{{ item.title.slice(3, item.title.length <text :class="['news-title', isLogin ? '' : 'mohu']">{{
- 1) }}</text> item.title.slice(3, item.title.length - 1)
}}</text>
</text> </text>
<text :class="['news-desc', isLogin ? '' : 'mohu']">{{ item.summary }}</text> <text :class="['news-desc', isLogin ? '' : 'mohu']">{{
item.summary
}}</text>
<view :class="['news-meta', isLogin ? '' : 'mohu']"> <view :class="['news-meta', isLogin ? '' : 'mohu']">
<view
<view style="display: flex;justify-content: space-between;width: 100%;"> style="display: flex; justify-content: space-between; width: 100%"
<view style="display: flex;"> >
<view style="display: flex">
<text class="source">{{ item.source }}</text> <text class="source">{{ item.source }}</text>
<text class="time">{{ <text class="time">{{
dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss") dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss")
@ -37,27 +57,36 @@
</view> </view>
<view class="r_option"> <view class="r_option">
<image class="option_icon" <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png"></image> class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png"
></image>
<text class="option_text">{{ item.viewCount }}</text> <text class="option_text">{{ item.viewCount }}</text>
<image class="option_icon" <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/like_icon%402x.png"></image> class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/like_icon%402x.png"
></image>
<text class="option_text">{{ item.likeCount }}</text> <text class="option_text">{{ item.likeCount }}</text>
<image class="option_icon" <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png"></image> class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png"
></image>
<text class="option_text">{{ item.shareCount }}</text> <text class="option_text">{{ item.shareCount }}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="lock_view" v-if="!isLogin"> <view class="lock_view" v-if="!isLogin">
<image class="lock_icon" <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/lock_icon%402x.png"> class="lock_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/lock_icon%402x.png"
>
</image> </image>
<text class="lock_text">海外独家资讯内容<text style="color: #D13E3C">登录</text>后可查阅全文</text> <text class="lock_text"
>海外独家资讯内容<text style="color: #d13e3c">登录</text
>后可查阅全文</text
>
</view> </view>
</view> </view>
</view> </view>
@ -74,7 +103,7 @@ import { Session } from "@/utils/storage";
const isExp = ref(true); const isExp = ref(true);
const rankListLocal = ref([]); const rankListLocal = ref([]);
const loading = ref(true); const loading = ref(true);
const isLogin = ref(uni.getStorageSync('token')) const isLogin = ref(uni.getStorageSync("token"));
watch( watch(
() => isExp.value, () => isExp.value,
@ -110,16 +139,28 @@ watch(
let viewCount = 0; let viewCount = 0;
let favCount = 0; let favCount = 0;
if (item.likeCount) { if (item.likeCount) {
likeCount = item.likeCount > 10000 ? Number(item.likeCount / 10000).toFixed(1) + '万' : item.likeCount; likeCount =
item.likeCount > 10000
? Number(item.likeCount / 10000).toFixed(1) + "万"
: item.likeCount;
} }
if (item.shareCount) { if (item.shareCount) {
shareCount = item.shareCount > 10000 ? Number(item.shareCount / 10000).toFixed(1) + '万' : item.shareCount; shareCount =
item.shareCount > 10000
? Number(item.shareCount / 10000).toFixed(1) + "万"
: item.shareCount;
} }
if (item.viewCount) { if (item.viewCount) {
viewCount = item.viewCount > 10000 ? Number(item.viewCount / 10000).toFixed(1) + '万' : item.viewCount; viewCount =
item.viewCount > 10000
? Number(item.viewCount / 10000).toFixed(1) + "万"
: item.viewCount;
} }
if (item.favCount) { if (item.favCount) {
favCount = item.favCount > 10000 ? Number(item.favCount / 10000).toFixed(1) + '万' : item.viewCount; favCount =
item.favCount > 10000
? Number(item.favCount / 10000).toFixed(1) + "万"
: item.viewCount;
} }
rankListLocal.value.push({ rankListLocal.value.push({
@ -145,14 +186,19 @@ const props = defineProps({
const clickItem = ref({}); const clickItem = ref({});
function goDetail(item) { function goDetail(item) {
if (uni.getStorageSync("token")) {
clickItem.value = item; clickItem.value = item;
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.news_id}`, url: `/pages/detail/indexNewsInfo?id=${item.news_id}`,
}); });
} else {
LoginShow.value = true; // if (uni.getStorageSync("token")) {
} // clickItem.value = item;
// uni.navigateTo({
// url: `/pages/detail/indexNewsInfo?id=${item.news_id}`,
// });
// } else {
// }
} }
const LoginShow = ref(false); const LoginShow = ref(false);
@ -238,7 +284,7 @@ const handlePopupErrorCallback = () => {
font-family: AvantiBold; font-family: AvantiBold;
font-size: 24rpx; font-size: 24rpx;
color: #5A5A5A; color: #5a5a5a;
line-height: 26rpx; line-height: 26rpx;
text-align: left; text-align: left;
font-style: normal; font-style: normal;
@ -247,7 +293,6 @@ const handlePopupErrorCallback = () => {
text-align: center; text-align: center;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.news-content { .news-content {
@ -336,9 +381,8 @@ const handlePopupErrorCallback = () => {
filter: blur(7rpx); filter: blur(7rpx);
} }
.lock_view { .lock_view {
background: linear-gradient(180deg, rgba(248, 244, 238, 0) 0%, #F8F4EE 100%); background: linear-gradient(180deg, rgba(248, 244, 238, 0) 0%, #f8f4ee 100%);
border-radius: 20rpx; border-radius: 20rpx;
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
display: flex; display: flex;
@ -360,7 +404,7 @@ const handlePopupErrorCallback = () => {
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #7F6242; color: #7f6242;
line-height: 33rpx; line-height: 33rpx;
text-align: left; text-align: left;
font-style: normal; font-style: normal;

View File

@ -1,23 +1,48 @@
<template> <template>
<view class="list" v-if="data.length"> <view class="list" v-if="data.length">
<view class="listItem" v-for="item in props.data" :key="item.id" @click="handleClick(item)"> <view
class="listItem"
v-for="item in props.data"
:key="item.id"
@click="handleClick(item)"
>
<view class="listItemHeader"> <view class="listItemHeader">
<view class="ListItemImg" v-if="item.picture"> <view class="ListItemImg" v-if="item.picture">
<image :src="item.picture" class="ListItemImage" mode="widthFix" style="width: 204rpx" /> <image
<image class="ListItemBg" :src="item.picture" style="width: 100%; height: 100%" /> :src="item.picture"
class="ListItemImage"
mode="widthFix"
style="width: 204rpx"
/>
<image
class="ListItemBg"
:src="item.picture"
style="width: 100%; height: 100%"
/>
<view class="tag" v-if="item.newType !== 'search'">{{ <view class="tag" v-if="item.newType !== 'search'">{{
item.tag item.tag
}}</view> }}</view>
</view> </view>
<view class="listItemHeaderContent"> <view class="listItemHeaderContent">
<view :class="['listItemTitle', !item.summary && 'noAbstract']" v-html="item.title"> <view v-if="!isLogin">
<text :class="['listItemTitle']">{{ item.title.slice(0, 3) }}</text>
<text :class="['listItemTitle', isLogin ? '' : 'mohu']">
{{ item.title.slice(3, item.title.length - 1) }}
</text></view
>
<view v-else>
<view :class="['listItemTitle1']" v-html="item.title"> </view>
</view> </view>
<view
:class="['listItemAbstract', isLogin ? '' : 'mohu']"
<view class="listItemAbstract" v-if="item.newType !== 'search'">{{ v-if="item.newType !== 'search'"
item.summary v-html="item.summary"
}}</view> ></view>
<view class="listItemAbstract" v-else v-html="item.MarkInRedContent || item.abstract"></view> <view
:class="['listItemAbstract', isLogin ? '' : 'mohu']"
v-else
v-html="item.MarkInRedContent || item.abstract"
></view>
</view> </view>
</view> </view>
@ -25,25 +50,32 @@
<view class="tag">{{ item.tag }}</view> <view class="tag">{{ item.tag }}</view>
</view> --> </view> -->
<view class="listItemContent"> <view :class="['listItemContent', isLogin ? '' : 'mohu']">
<view style="display: flex;"> <view style="display: flex">
<view class="tag">{{ item.tag }}</view> <view class="tag">{{ item.tag }}</view>
<view class="listItemTime" style="margin-left: 10rpx;">{{ item.time }}</view> <view class="listItemTime" style="margin-left: 10rpx">{{
item.time
}}</view>
</view> </view>
<view class="r_option"> <view class="r_option">
<image class="option_icon" <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png"></image> class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png"
></image>
<text class="option_text">{{ item.readNums }}</text> <text class="option_text">{{ item.readNums }}</text>
<image class="option_icon" <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/like_icon%402x.png"></image> class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/like_icon%402x.png"
></image>
<text class="option_text">{{ item.likeNums }}</text> <text class="option_text">{{ item.likeNums }}</text>
<image class="option_icon" <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png"></image> class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png"
></image>
<text class="option_text">{{ item.shareNums }}</text> <text class="option_text">{{ item.shareNums }}</text>
</view> </view>
</view> </view>
@ -59,6 +91,7 @@ import { ref } from "vue";
import { onShow, onLoad } from "@dcloudio/uni-app"; import { onShow, onLoad } from "@dcloudio/uni-app";
const emit = defineEmits(["handleListJump", "onClick"]); const emit = defineEmits(["handleListJump", "onClick"]);
const isLogin = ref(uni.getStorageSync("token"));
const props = defineProps({ const props = defineProps({
// //
@ -82,7 +115,7 @@ const handleClick = (item: any) => {
.list { .list {
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
padding: 0 21rpx 30rpx 21rpx; padding: 0 40rpx 30rpx 40rpx;
border-radius: 10rpx; border-radius: 10rpx;
font-family: "SourceHanSansCN-Regular"; font-family: "SourceHanSansCN-Regular";
@ -133,12 +166,14 @@ const handleClick = (item: any) => {
} }
.listItemHeaderContent { .listItemHeaderContent {
width: 100%; // width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding-left: 0rpx; padding-left: 0rpx;
display: flex;
flex-direction: column;
.listItemTitle { .listItemTitle1 {
// font-size: 32rpx; font-size: 32rpx;
font-size: var(--h1-font-size); font-size: var(--h1-font-size);
color: #333; color: #333;
display: -webkit-box; display: -webkit-box;
@ -147,8 +182,28 @@ const handleClick = (item: any) => {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: normal; white-space: normal;
// font-weight: bold;
word-break: break-all; word-break: break-all;
font-family: PingFangSC, PingFang SC;
font-weight: bold;
font-size: 32rpx;
color: #192236;
line-height: 45rpx;
text-align: left;
font-style: normal;
}
.listItemTitle {
// font-size: 32rpx;
// font-size: var(--h1-font-size);
// color: #333;
// display: -webkit-box;
// -webkit-box-orient: vertical;
// -webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
word-break: break-all;
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32rpx;
@ -210,7 +265,7 @@ const handleClick = (item: any) => {
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #2D3849; color: #2d3849;
line-height: 33rpx; line-height: 33rpx;
text-align: left; text-align: left;
font-style: normal; font-style: normal;
@ -272,7 +327,6 @@ const handleClick = (item: any) => {
font-family: "SourceHanSansCN-Medium"; font-family: "SourceHanSansCN-Medium";
} }
.r_option { .r_option {
display: flex; display: flex;
align-items: center; align-items: center;
@ -294,4 +348,8 @@ const handleClick = (item: any) => {
font-style: normal; font-style: normal;
} }
} }
.mohu {
filter: blur(7rpx);
}
</style> </style>

View File

@ -1,35 +1,72 @@
<template> <template>
<view class="tabbar"> <view class="tabbar">
<view class="tabbar_item" @click="tabChange(0)"> <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" <image
class="tabbar_img" /> v-if="tabIndex == 1"
<image v-if="tabIndex == 0" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.png"
class="tabbar_img" /> class="tabbar_img"
<text class="tabbar_title" :style="{ color: tabIndex == 0 ? '#D13E3C' : '#757A80' }">海外资讯</text> />
<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>
<view class="tabbar_item" @click="tabChange(1)"> <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" <image
class="tabbar_img" /> v-if="tabIndex == 0"
<image v-if="tabIndex == 1" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
class="tabbar_img" /> class="tabbar_img"
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }">全部</text> />
</view> <image
</view> 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> </template>
<script setup> <script setup>
import { ref, onMounted, onUnmounted, reactive } from "vue"; import { ref, onMounted, watch, reactive } from "vue";
const emit = defineEmits(["tabChange"]); const emit = defineEmits(["tabChange"]);
const props = defineProps({
tabIndex: {
type: Number,
default: 0,
},
});
watch(
() => props.tabIndex,
(newValue, oldValue) => {
console.log("🚀 ~ newValue:", newValue);
if (newValue) {
tabIndex.value = newValue;
}
}
);
const tabIndex = ref(0); const tabIndex = ref(0);
function tabChange(index) { function tabChange(index) {
tabIndex.value = index; tabIndex.value = index;
emit("tabChange", index); emit("tabChange", index);
} }
onMounted(async () => { }); onMounted(async () => {});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,6 +1,6 @@
// const baseURL = "http://192.168.31.25:8060/api"; // const baseURL = "http://192.168.31.25:8060/api";
// export const baseUrl = "http://192.168.3.38:8040/apih5"; // export const baseUrl = "http://192.168.3.38:8040/apih5";
export const baseUrl = "http://123.60.79.143:8041/apih5"; export const baseUrl = "http://123.60.153.169:8040/apih5";
// export const baseUrl = "https://cankao.cs.com.cn/apih5"; // export const baseUrl = "https://cankao.cs.com.cn/apih5";
export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav"; export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav";

View File

@ -1,19 +1,38 @@
<template> <template>
<view class="container"> <view class="container">
<view :style="{ height: getNavHeight() + 'px', position: 'sticky', top: 0, background: '#fff', zIndex: '9999' }"> <view
:style="{
height: getNavHeight() + 'px',
position: 'sticky',
top: 0,
background: '#fff',
zIndex: '9999',
}"
>
</view> </view>
<!-- 导航栏 start --> <!-- 导航栏 start -->
<view class="custom-bav-bar" <view
:style="{ position: 'sticky', top: getNavHeight() + 'px', background: '#fff', zIndex: '9999' }"> class="custom-bav-bar"
:style="{
position: 'sticky',
top: getNavHeight() + 'px',
background: '#fff',
zIndex: '9999',
}"
>
<view class="left"> <view class="left">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/static/icon_left.png" class="back_icon" <image
@click="handleBack" /> src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/static/icon_left.png"
class="back_icon"
@click="handleBack"
/>
</view> </view>
<view class="center"> <view class="center">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/detail_logo.png" class="logo_icon" /> <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/detail_logo.png"
class="logo_icon"
/>
</view> </view>
</view> </view>
@ -30,20 +49,28 @@
/> --> /> -->
<!-- 底部栏 评论 / 收藏 --> <!-- 底部栏 评论 / 收藏 -->
<Comment v-if="isLogin" :data="data" @handleClickLike="handleClickLike" @handleClickStar="handleClickStar" /> <Comment
v-if="isLogin"
:data="data"
@handleClickLike="handleClickLike"
@handleClickStar="handleClickStar"
/>
<view class="login_unlock" v-if="!isLogin"> <view class="login_unlock" v-if="!isLogin">
<view class="r_image"> <view class="r_image">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/lock_banner%402x.png"></image> <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/lock_banner%402x.png"
></image>
<view class="image_text"> <view class="image_text">
<text class="image_text_title">登录解锁</text> <text class="image_text_title">登录解锁</text>
<text class="image_text_sub_title">海外独家资讯内容登录后可查阅全文</text> <text class="image_text_sub_title"
>海外独家资讯内容登录后可查阅全文</text
>
</view> </view>
</view> </view>
<view class="login_unlock_btn">立即登录</view> <view class="login_unlock_btn" @click="goLogin">立即登录</view>
</view> </view>
</view> </view>
</template> </template>
@ -62,20 +89,17 @@ import Column from "@/components/column/index.vue";
import Comment from "@/components/comment/indexMini.vue"; import Comment from "@/components/comment/indexMini.vue";
import { useShareStore } from "@/stores/shareStore"; import { useShareStore } from "@/stores/shareStore";
import { Session } from "@/utils/storage"; import { Session } from "@/utils/storage";
import { getNavHeight } from "@/utils/util" import { getNavHeight } from "@/utils/util";
const stores = useShareStore(); const stores = useShareStore();
const curPages = getCurrentPages(); const curPages = getCurrentPages();
const isLogin = ref<boolean>(uni.getStorageSync("token") ? true : false); const isLogin = ref<boolean>(uni.getStorageSync("token") ? true : false);
const data = ref<any>({}); const data = ref<any>({});
const newType = ref<any>(""); const newType = ref<any>("");
const columnList = ref<any>([]); const columnList = ref<any>([]);
const columnName = ref(""); const columnName = ref("");
onReachBottom(() => { onReachBottom(() => {
console.log("🚀 ~ onReachBottom ~ onReachBottom:"); console.log("🚀 ~ onReachBottom ~ onReachBottom:");
}); });
@ -93,7 +117,7 @@ onLoad(async (option: any) => {
if (res.code === 200) { if (res.code === 200) {
data.value = res.data; data.value = res.data;
res.data.content = res.data.content.replace(/\n{3,}/g, '\n'); res.data.content = res.data.content.replace(/\n{3,}/g, "\n");
columnName.value = res.data.columnName1; columnName.value = res.data.columnName1;
newList(res.data.columnId1); newList(res.data.columnId1);
@ -206,20 +230,26 @@ const jumpDetail = (item: any) => {
}); });
}; };
function goLogin() {
uni.navigateTo({
url: "/pages/login/indexMini",
});
}
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);
let { code } = await doShare({ let { code } = await doShare({
id: data.value.id id: data.value.id,
}) });
return { return {
title: data.value.title,// title: data.value.title, //
path: '/page/detail/indexNewsInfo?id=' + data.value.id,// path: "/page/detail/indexNewsInfo?id=" + data.value.id, //
imageUrl: 'https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_pic_1%402x.png',// imageUrl:
} "https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_pic_1%402x.png", //
};
}) });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -333,7 +363,7 @@ onShareAppMessage(async (res) => {
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: bold; font-weight: bold;
font-size: 30rpx; font-size: 30rpx;
color: #FFFFFF; color: #ffffff;
line-height: 42rpx; line-height: 42rpx;
text-shadow: 0px 2px 8px rgba(43, 51, 75, 0.35); text-shadow: 0px 2px 8px rgba(43, 51, 75, 0.35);
text-align: left; text-align: left;
@ -344,7 +374,7 @@ onShareAppMessage(async (res) => {
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #B5BED5; color: #b5bed5;
line-height: 33rpx; line-height: 33rpx;
text-shadow: 0px 2px 8px rgba(43, 51, 75, 0.35); text-shadow: 0px 2px 8px rgba(43, 51, 75, 0.35);
text-align: left; text-align: left;
@ -355,20 +385,19 @@ onShareAppMessage(async (res) => {
width: 78vw; width: 78vw;
height: 128rpx; height: 128rpx;
margin-bottom: 60rpx; margin-bottom: 60rpx;
} }
} }
.login_unlock_btn { .login_unlock_btn {
width: 100%; width: 80%;
height: 88rpx; height: 88rpx;
background: #D13E3C; background: #d13e3c;
border-radius: 44rpx; border-radius: 44rpx;
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: 500; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #ffffff;
line-height: 45rpx; line-height: 45rpx;
text-align: center; text-align: center;
font-style: normal; font-style: normal;

View File

@ -8,19 +8,29 @@
<!-- <view class="bottom_btn" @click="goIndex"> 立即进入 </view> --> <!-- <view class="bottom_btn" @click="goIndex"> 立即进入 </view> -->
<!-- 用户协议 --> <!-- 用户协议 -->
<view class="tips"> <view class="tips" @click="doChangeCheck">
<u-checkbox-group
<u-checkbox-group v-model="checked" placement="column" @change="checkboxChange"> v-model="checked"
placement="column"
activeColor="#e7303f"
@change="checkboxChange"
>
<u-checkbox class="checkbox" shape="circle"></u-checkbox> <u-checkbox class="checkbox" shape="circle"></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<text class="r_userAgreement">已阅读并同意<text class="userAgreement" <text class="r_userAgreement"
@click="goUserAgreement">江南农商银行隐私政策中证参考智能资讯小程序服务使用许可及服务协议</text>首次登录的手机号将自动注册</text> >已阅读并同意<text class="userAgreement" @click="goUserAgreement"
>江南农商银行隐私政策中证参考智能资讯小程序服务使用许可及服务协议</text
>首次登录的手机号将自动注册</text
>
</view> </view>
<button
<button v-if="checked && checked?.length > 0" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="checked && checked?.length > 0"
class="bottom_btn"> open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
class="bottom_btn"
>
<view> <view>
<text>立即进入</text> <text>立即进入</text>
</view> </view>
@ -49,14 +59,13 @@ import { doWxAuth } from "@/api/index";
import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app"; import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
import { useShareStore } from "@/stores/shareStore"; import { useShareStore } from "@/stores/shareStore";
const stores = useShareStore(); const stores = useShareStore();
const checked = ref([]) const checked = ref([]);
watch(checked, (newVal) => { watch(checked, (newVal) => {
console.log("🚀 ~ newVal:", newVal) console.log("🚀 ~ newVal:", newVal);
if (newVal) { if (newVal) {
} }
}) });
let timer = ref(); let timer = ref();
@ -141,20 +150,27 @@ onLoad((option) => {
// }, 2000) // }, 2000)
}); });
function doChangeCheck() {
if (checked.value && checked.value.length > 0) {
checked.value = [];
} else {
checked.value = [""];
}
}
// //
function needCheck() { function needCheck() {
uni.showToast({ uni.showToast({
title: "请先同意用户协议", title: "请先同意用户协议",
icon: 'none' icon: "none",
}) });
} }
function goUserAgreement() { function goUserAgreement() {
wx.openPrivacyContract({ wx.openPrivacyContract({
success: () => { }, // success: () => {}, //
fail: () => { }, // fail: () => {}, //
complete: () => { }, complete: () => {},
}); });
} }
@ -165,7 +181,7 @@ onUnload(() => {
onShow(() => { onShow(() => {
stores.initWxConfig(); stores.initWxConfig();
uni.setStorageSync('homeTabIndex', null) uni.setStorageSync("homeTabIndex", null);
}); });
</script> </script>
@ -232,7 +248,6 @@ onShow(() => {
display: flex; display: flex;
align-items: start; align-items: start;
:deep(.u-checkbox) { :deep(.u-checkbox) {
margin-top: 5rpx; margin-top: 5rpx;
} }

View File

@ -2,37 +2,54 @@
<!-- 顶部 banner 区域 --> <!-- 顶部 banner 区域 -->
<view class="all"> <view class="all">
<!-- <Navbar title="中证参考" :hasBack="false"></Navbar> --> <!-- <Navbar title="中证参考" :hasBack="false"></Navbar> -->
<image class="top_bk" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/top_bg.png"></image> <image
class="top_bk"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/top_bg.png"
></image>
<view :style="{ <view
:style="{
height: getNavHeight() + 'px', height: getNavHeight() + 'px',
backgroundColor: isScroll ? '#fff' : 'transparent', backgroundColor: isScroll ? '#fff' : 'transparent',
position: 'sticky', top: 0, position: 'sticky',
top: 0,
zIndex: '999999', zIndex: '999999',
}" v-if="tabIndex == 0"></view> }"
<view :style="{ v-if="tabIndex == 0"
></view>
<view
:style="{
height: getNavHeight() + 'px', height: getNavHeight() + 'px',
backgroundColor: '#fff', backgroundColor: '#fff',
position: 'sticky', top: 0, position: 'sticky',
top: 0,
zIndex: '999999', zIndex: '999999',
}"
}" v-else></view> v-else
></view>
<view class="content"> <view class="content">
<view
<view :style="{ :style="{
position: 'sticky', top: getNavHeight() + 'px', position: 'sticky',
top: getNavHeight() + 'px',
backgroundColor: isScroll ? '#fff' : 'transparent', backgroundColor: isScroll ? '#fff' : 'transparent',
zIndex: '9999' zIndex: '9999',
}" v-if="tabIndex == 0"> }"
v-if="tabIndex == 0"
>
<view class="r_sreach"> <view class="r_sreach">
<image class="logo_text" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/logo_text_icon.png"> <image
class="logo_text"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/logo_text_icon.png"
>
</image> </image>
<view class="sreach" @click="goSreach"> <view class="sreach" @click="goSreach">
<view class="sreach_icon"> <view class="sreach_icon">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_search_line.png"></image> <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_search_line.png"
></image>
</view> </view>
<view class="sreach_text"> <view class="sreach_text">
<text>搜索资讯</text> <text>搜索资讯</text>
@ -40,102 +57,98 @@
</view> </view>
</view> </view>
<view style="padding: 0 24rpx;margin-top: 30rpx;"> <view style="padding: 0 24rpx; margin-top: 30rpx">
<u-swiper :list="list1" @change="change" @click="click"></u-swiper> <u-swiper :list="list1" @change="change" @click="click"></u-swiper>
</view> </view>
<view style="padding-top: 30rpx;background-color: white;padding-bottom: 30rpx;"> <view
style="
padding-top: 30rpx;
background-color: white;
padding-bottom: 30rpx;
"
>
<Tabs></Tabs> <Tabs></Tabs>
</view> </view>
</view> </view>
<view style="margin-top: 30rpx;" v-if="tabIndex == 0"> <view style="margin-top: 30rpx" v-if="tabIndex == 0">
<RankListMini :newsList="newsList"></RankListMini> <RankListMini :newsList="newsList"></RankListMini>
</view> </view>
<MineMini v-if="tabIndex == 1" @logout="tabIndex = 0"></MineMini> <MineMini v-if="tabIndex == 1" @logout="tabIndex = 0"></MineMini>
</view> </view>
<Tabbar @tabChange="tabChange"></Tabbar> <Tabbar :tabIndex="tabIndex" @tabChange="tabChange"></Tabbar>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, defineAsyncComponent, reactive } from "vue"; import { ref, onMounted, defineAsyncComponent, reactive } from "vue";
import Tabbar from "@/components/mini/Tabbar.vue"; import Tabbar from "@/components/mini/Tabbar.vue";
import Navbar from '@/components/mini/Navbar.vue' import Navbar from "@/components/mini/Navbar.vue";
import RankListMini from "@/components/RankListMini.vue"; import RankListMini from "@/components/RankListMini.vue";
// const Mine = defineAsyncComponent(() => import("@/components/mine.vue")); // const Mine = defineAsyncComponent(() => import("@/components/mine.vue"));
import MineMini from "@/components/mineMini.vue"; import MineMini from "@/components/mineMini.vue";
import Tabs from "@/components/mini/Tabs.vue"; import Tabs from "@/components/mini/Tabs.vue";
import { import { getTopNews } from "@/api/newsInfo";
getTopNews,
} from "@/api/newsInfo";
import { onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app"; import { onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app";
import { getNavHeight } from "@/utils/util" import { getNavHeight } from "@/utils/util";
const list1 = reactive([ const list1 = reactive([
'https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/banner1.png', "https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/banner1.png",
'https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/banner1.png', "https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/banner1.png",
'https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/banner1.png', "https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/banner1.png",
]); ]);
const newsList = ref([]); const newsList = ref([]);
// //
async function getNewsList() { async function getNewsList() {
newsList.value = await getTopNews({}); newsList.value = await getTopNews({});
uni.stopPullDownRefresh() uni.stopPullDownRefresh();
} }
const tabIndex = ref(0); const tabIndex = ref(0);
function tabChange(index) { function tabChange(index) {
tabIndex.value = index; tabIndex.value = index;
uni.setStorageSync('homeTabIndex', index) uni.setStorageSync("homeTabIndex", index);
switch (index) { switch (index) {
case 0: case 0:
getNewsList() getNewsList();
break; break;
case 1: case 1:
break; break;
} }
} }
function goSreach() { function goSreach() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/sreachReq/index', url: "/pages/sreachReq/index",
}) });
} }
const isScroll = ref(false);
const isScroll = ref(false)
onPageScroll((val) => { onPageScroll((val) => {
if (val.scrollTop > 150) { if (val.scrollTop > 150) {
isScroll.value = true isScroll.value = true;
} else { } else {
isScroll.value = false isScroll.value = false;
} }
})
onShow(() => {
if (uni.getStorageSync('homeTabIndex') == 1) {
tabChange(1)
} else {
tabChange(0)
}
uni.setStorageSync('homeTabIndex', null)
})
onMounted(async () => {
getNewsList()
}); });
onShow(() => {
if (uni.getStorageSync("homeTabIndex") == 1) {
tabChange(1);
} else {
tabChange(0);
}
uni.setStorageSync("homeTabIndex", null);
});
onMounted(async () => {
getNewsList();
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,40 +1,76 @@
<template> <template>
<view class="sreachcss"> <view class="sreachcss">
<view :style="{ height: getNavHeight() + 'px', position: 'sticky', top: 0, background: '#fff', zIndex: '9999' }"> <view
:style="{
height: getNavHeight() + 'px',
position: 'sticky',
top: 0,
background: '#fff',
zIndex: '9999',
}"
>
</view> </view>
<!-- 导航栏 start --> <!-- 导航栏 start -->
<view class="custom-bav-bar" <view
:style="{ position: 'sticky', top: getNavHeight() + 'px', left: 0, background: '#fff', zIndex: '9999' }"> class="custom-bav-bar"
:style="{
position: 'sticky',
top: getNavHeight() + 'px',
left: 0,
background: '#fff',
zIndex: '9999',
}"
>
<view class="left"> <view class="left">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/static/icon_left.png" class="back_icon" <image
@click="handleBack" /> src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/static/icon_left.png"
class="back_icon"
@click="handleBack"
/>
</view> </view>
<view class="center"> <view class="center">
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/detail_logo.png" class="logo_icon" /> <image
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/detail_logo.png"
class="logo_icon"
/>
</view> </view>
</view> </view>
<!-- 搜索 start --> <!-- 搜索 start -->
<view class="sreach"> <view class="sreach">
<view style="width: 70vw; margin-left: 50rpx"> <view style="width: 75vw; margin-left: 50rpx">
<u-input v-model="keyWord" @change="handleChange" prefixIcon="search" style="flex: 1" placeholder="搜索快讯" <u-input
class="sreach_input" :border="false" /> v-model="keyWord"
@change="handleChange"
prefixIcon="search"
style="flex: 1"
placeholder="搜索快讯"
class="sreach_input"
:border="false"
/>
</view> </view>
<text class="serach_btn" @click="getData()">搜索</text> <text class="serach_btn" @click="getData()">搜索</text>
</view> </view>
<!-- 搜索 end --> <!-- 搜索 end -->
<List :data="screenList" @onClick="handleSwiperJump" v-if="screenList.length !== 0" /> <List
:data="screenList"
@onClick="handleSwiperJump"
v-if="screenList.length !== 0"
/>
<!-- 列表 end --> <!-- 列表 end -->
<!-- 加载更多的按钮 --> <!-- 加载更多的按钮 -->
<!-- <view class="onLoad-btn" @click="onload" v-if="finish === false && inputValue">加载更多</view> --> <!-- <view class="onLoad-btn" @click="onload" v-if="finish === false && inputValue">加载更多</view> -->
<view style="margin-top: 20vh"> <view style="margin-top: 20vh">
<u-empty v-if="screenList.length === 0" text="无搜索结果" width="157" height="50" <u-empty
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/nosearch_icon%E5%A4%87%E4%BB%BD%402x.png"></u-empty> v-if="screenList.length === 0"
text="无搜索结果"
width="157"
height="50"
icon="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/nosearch_icon%E5%A4%87%E4%BB%BD%402x.png"
></u-empty>
</view> </view>
<!-- <view v-if="finish && screenList.length > 0" class="noMore"> <!-- <view v-if="finish && screenList.length > 0" class="noMore">
@ -47,8 +83,11 @@
<Pay :show="payShow" @onClick="handleClose" @handleSub="handleSub" /> <Pay :show="payShow" @onClick="handleClose" @handleSub="handleSub" />
<!-- 登录弹框 --> <!-- 登录弹框 -->
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose" <LoginPopup
@handlePopupSuccessCallback="handlePopupSuccessCallback" /> :show="LoginShow"
@handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback"
/>
</view> </view>
</template> </template>
@ -63,7 +102,6 @@ import LoginPopup from "@/components/loginPopup/index.vue";
import Pay from "@/components/pay/index.vue"; import Pay from "@/components/pay/index.vue";
import { getNavHeight } from "@/utils/util"; import { getNavHeight } from "@/utils/util";
const articleList = ref([]); const articleList = ref([]);
const finish = ref(false); const finish = ref(false);
const screenList = ref([]); const screenList = ref([]);
@ -99,7 +137,6 @@ const handleSub = async () => {
item.needpay = false; item.needpay = false;
} }
return item; return item;
}); });
articleList.value = articleResult; articleList.value = articleResult;
@ -141,14 +178,23 @@ const handleShowPay = (type) => {
// //
const handleSwiperJump = (item: any) => { const handleSwiperJump = (item: any) => {
console.log("item ===>", item); console.log("item ===>", item);
if (item.needpay) { if (uni.getStorageSync("token")) {
//
handleShowPay(item.type);
} else {
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}&type=${item.type}`, url: `/pages/detail/indexNewsInfo?id=${item.id}&type=${item.type}`,
}); });
} else {
uni.navigateTo({
url: "/pages/login/index",
});
} }
// if (item.needpay) {
// //
// handleShowPay(item.type);
// } else {
// uni.navigateTo({
// url: `/pages/detail/indexNewsInfo?id=${item.id}&type=${item.type}`,
// });
// }
}; };
const handleChange = (val: string) => { const handleChange = (val: string) => {
@ -194,9 +240,11 @@ const getData = async () => {
`<text style="color: #E7303F">$&</text>` `<text style="color: #E7303F">$&</text>`
); );
item.title = item.title.replace(keyWord.value, '<span style="color: red;">' + keyWord.value + '</span>'); item.title = item.title.replace(
console.log("🚀 ~ getData ~ item.title :", item.title) keyWord.value,
'<span style="color: red;">' + keyWord.value + "</span>"
);
console.log("🚀 ~ getData ~ item.title :", item.title);
item.MarkInRedContent = item.MarkInRedContent =
item.contentText && item.contentText &&
@ -229,7 +277,7 @@ onShow(() => {
.sreachcss { .sreachcss {
min-height: 100vh; min-height: 100vh;
background-color: #ffffff; background-color: #ffffff;
padding: 0 30rpx; // padding: 0 30rpx;
.sreach { .sreach {
display: flex; display: flex;
@ -296,7 +344,6 @@ onShow(() => {
} }
} }
.custom-bav-bar { .custom-bav-bar {
width: 100%; width: 100%;
height: 88rpx; height: 88rpx;
@ -337,10 +384,9 @@ onShow(() => {
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32rpx;
color: #D13E3C; color: #d13e3c;
line-height: 45rpx; line-height: 45rpx;
text-align: right; text-align: right;
font-style: normal; font-style: normal;
flex: 1;
} }
</style> </style>