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");
stores.initWxConfig();
});
onShow(() => { });
onShow(() => {});
onHide(() => {
console.log("App Hide");
uni.setStorageSync('homeTabIndex', null)
});
</script>
<style lang="scss">

View File

@ -1,18 +1,34 @@
<template>
<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 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 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 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 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>
<text class="rank-text" v-else>{{ index + 1 }}</text>
</view>
@ -21,15 +37,19 @@
<view class="news-content">
<text style="">
<text class="news-title">{{ item.title.slice(0, 3) }}</text>
<text :class="['news-title', isLogin ? '' : 'mohu']">{{ item.title.slice(3, item.title.length
- 1) }}</text>
<text :class="['news-title', isLogin ? '' : 'mohu']">{{
item.title.slice(3, item.title.length - 1)
}}</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 style="display: flex;justify-content: space-between;width: 100%;">
<view style="display: flex;">
<view
style="display: flex; justify-content: space-between; width: 100%"
>
<view style="display: flex">
<text class="source">{{ item.source }}</text>
<text class="time">{{
dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss")
@ -37,27 +57,36 @@
</view>
<view class="r_option">
<image class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png"></image>
<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>
<image class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/like_icon%402x.png"></image>
<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>
<image class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png"></image>
<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>
</view>
</view>
</view>
<view class="lock_view" v-if="!isLogin">
<image class="lock_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/lock_icon%402x.png">
<image
class="lock_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/lock_icon%402x.png"
>
</image>
<text class="lock_text">海外独家资讯内容<text style="color: #D13E3C">登录</text>后可查阅全文</text>
<text class="lock_text"
>海外独家资讯内容<text style="color: #d13e3c">登录</text
>后可查阅全文</text
>
</view>
</view>
</view>
@ -74,7 +103,7 @@ import { Session } from "@/utils/storage";
const isExp = ref(true);
const rankListLocal = ref([]);
const loading = ref(true);
const isLogin = ref(uni.getStorageSync('token'))
const isLogin = ref(uni.getStorageSync("token"));
watch(
() => isExp.value,
@ -110,16 +139,28 @@ watch(
let viewCount = 0;
let favCount = 0;
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) {
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) {
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) {
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({
@ -145,14 +186,19 @@ const props = defineProps({
const clickItem = ref({});
function goDetail(item) {
if (uni.getStorageSync("token")) {
clickItem.value = item;
uni.navigateTo({
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);
@ -238,7 +284,7 @@ const handlePopupErrorCallback = () => {
font-family: AvantiBold;
font-size: 24rpx;
color: #5A5A5A;
color: #5a5a5a;
line-height: 26rpx;
text-align: left;
font-style: normal;
@ -247,7 +293,6 @@ const handlePopupErrorCallback = () => {
text-align: center;
justify-content: center;
align-items: center;
}
.news-content {
@ -336,9 +381,8 @@ const handlePopupErrorCallback = () => {
filter: blur(7rpx);
}
.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;
padding: 10rpx 20rpx;
display: flex;
@ -360,7 +404,7 @@ const handlePopupErrorCallback = () => {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 24rpx;
color: #7F6242;
color: #7f6242;
line-height: 33rpx;
text-align: left;
font-style: normal;

View File

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

View File

@ -1,35 +1,72 @@
<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.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>
<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>
<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>
import { ref, onMounted, onUnmounted, reactive } from "vue";
import { ref, onMounted, watch, reactive } from "vue";
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);
function tabChange(index) {
tabIndex.value = index;
emit("tabChange", index);
}
onMounted(async () => { });
onMounted(async () => {});
</script>
<style scoped lang="scss">

View File

@ -1,6 +1,6 @@
// const baseURL = "http://192.168.31.25:8060/api";
// 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 baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav";

View File

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

View File

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

View File

@ -2,37 +2,54 @@
<!-- 顶部 banner 区域 -->
<view class="all">
<!-- <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',
backgroundColor: isScroll ? '#fff' : 'transparent',
position: 'sticky', top: 0,
position: 'sticky',
top: 0,
zIndex: '999999',
}" v-if="tabIndex == 0"></view>
<view :style="{
}"
v-if="tabIndex == 0"
></view>
<view
:style="{
height: getNavHeight() + 'px',
backgroundColor: '#fff',
position: 'sticky', top: 0,
position: 'sticky',
top: 0,
zIndex: '999999',
}" v-else></view>
}"
v-else
></view>
<view class="content">
<view :style="{
position: 'sticky', top: getNavHeight() + 'px',
<view
:style="{
position: 'sticky',
top: getNavHeight() + 'px',
backgroundColor: isScroll ? '#fff' : 'transparent',
zIndex: '9999'
}" v-if="tabIndex == 0">
zIndex: '9999',
}"
v-if="tabIndex == 0"
>
<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>
<view class="sreach" @click="goSreach">
<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 class="sreach_text">
<text>搜索资讯</text>
@ -40,102 +57,98 @@
</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>
</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>
</view>
</view>
<view style="margin-top: 30rpx;" v-if="tabIndex == 0">
<view style="margin-top: 30rpx" v-if="tabIndex == 0">
<RankListMini :newsList="newsList"></RankListMini>
</view>
<MineMini v-if="tabIndex == 1" @logout="tabIndex = 0"></MineMini>
</view>
<Tabbar @tabChange="tabChange"></Tabbar>
<Tabbar :tabIndex="tabIndex" @tabChange="tabChange"></Tabbar>
</view>
</template>
<script setup>
import { ref, onMounted, defineAsyncComponent, reactive } from "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";
// const Mine = defineAsyncComponent(() => import("@/components/mine.vue"));
import MineMini from "@/components/mineMini.vue";
import Tabs from "@/components/mini/Tabs.vue";
import {
getTopNews,
} from "@/api/newsInfo";
import { getTopNews } from "@/api/newsInfo";
import { onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app";
import { getNavHeight } from "@/utils/util"
import { getNavHeight } from "@/utils/util";
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([]);
//
async function getNewsList() {
newsList.value = await getTopNews({});
uni.stopPullDownRefresh()
uni.stopPullDownRefresh();
}
const tabIndex = ref(0);
function tabChange(index) {
tabIndex.value = index;
uni.setStorageSync('homeTabIndex', index)
uni.setStorageSync("homeTabIndex", index);
switch (index) {
case 0:
getNewsList()
getNewsList();
break;
case 1:
break;
}
}
function goSreach() {
uni.navigateTo({
url: '/pages/sreachReq/index',
})
url: "/pages/sreachReq/index",
});
}
const isScroll = ref(false)
const isScroll = ref(false);
onPageScroll((val) => {
if (val.scrollTop > 150) {
isScroll.value = true
isScroll.value = true;
} 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>
<style scoped lang="scss">

View File

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