feat: 实现导航栏高度计算及多页面适配
refactor: 优化请求拦截器处理逻辑 style: 更新Tabbar组件样式及图标资源 feat(rank): 添加排行榜前三名特殊样式图标 fix(detail): 修复GET请求参数处理问题 feat(home): 新增首页顶部背景及搜索区域 refactor(util): 移除无用代码并添加日志调试 fix(api): 修正行业和概念标签请求参数格式 feat(minihome): 实现首页轮播图及样式调整
This commit is contained in:
parent
126f48d883
commit
1ba80c041c
|
|
@ -1,4 +1,4 @@
|
||||||
import request from "@/utils";
|
import request from "@/utils/index";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文章详情
|
* 获取文章详情
|
||||||
|
|
@ -33,10 +33,11 @@ export const fetchArticleFavorate = (data: any) => {
|
||||||
|
|
||||||
// 热门行业
|
// 热门行业
|
||||||
export const getListByTagIndustry = (data: any) => {
|
export const getListByTagIndustry = (data: any) => {
|
||||||
return request.get(`/news/list/industry?name=${data.name}`);
|
console.log("🚀 ~ getListByTagIndustry ~ data:", data)
|
||||||
|
return request.get("/news/list/industry", { name: data.name });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 概念标签
|
// 概念标签
|
||||||
export const getListByTag = (data: any) => {
|
export const getListByTag = (data: any) => {
|
||||||
return request.get(`/news/list/tag?name=${data.name}`);
|
return request.get("/news/list/tag", { name: data.name });
|
||||||
};
|
};
|
||||||
|
|
@ -4,7 +4,16 @@
|
||||||
<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">
|
||||||
<text class="rank-text">{{ index + 1 }}</text>
|
<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" />
|
||||||
|
</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" />
|
||||||
|
</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" />
|
||||||
|
</view>
|
||||||
|
<text class="rank-text" v-else>{{ index + 1 }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- :style="{ filter: Session.get('token') ? '' : 'blur(5px)' }" -->
|
<!-- :style="{ filter: Session.get('token') ? '' : 'blur(5px)' }" -->
|
||||||
|
|
@ -18,9 +27,9 @@
|
||||||
dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss")
|
dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss")
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="score">
|
<!-- <text class="score">
|
||||||
<text v-if="index < 3">资讯评分:</text>
|
<text v-if="index < 3">资讯评分:</text>
|
||||||
{{ item.news_score }}</text>
|
{{ item.news_score }}</text> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -33,8 +42,8 @@
|
||||||
<img src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/down_icon.png" class="exp_up" v-else />
|
<img src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/down_icon.png" class="exp_up" v-else />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
|
<!-- <LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
|
||||||
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" />
|
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" /> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -159,7 +168,7 @@ const handlePopupErrorCallback = () => {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
|
||||||
img {
|
image {
|
||||||
width: 33rpx;
|
width: 33rpx;
|
||||||
height: 41rpx;
|
height: 41rpx;
|
||||||
margin-top: -10rpx;
|
margin-top: -10rpx;
|
||||||
|
|
@ -167,11 +176,30 @@ const handlePopupErrorCallback = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.rank-text {
|
.rank-text {
|
||||||
font-family: PingFangSC, PingFang SC;
|
// font-family: PingFangSC, PingFang SC;
|
||||||
font-weight: bold;
|
// font-weight: bold;
|
||||||
font-size: 28rpx;
|
// font-size: 28rpx;
|
||||||
color: #e98254;
|
// color: #e98254;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
|
||||||
margin-top: -20rpx;
|
margin-top: -20rpx;
|
||||||
|
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
font-family: AvantiBold;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #5A5A5A;
|
||||||
|
line-height: 26rpx;
|
||||||
|
text-align: left;
|
||||||
|
font-style: normal;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
text-align: center;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.news-content {
|
.news-content {
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,14 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="padding: 35rpx;">
|
<view style="padding: 35rpx;">
|
||||||
<text class="articleDes" :class="props?.data?.needpay && 'needpay'" style="white-space: pre-wrap;"
|
|
||||||
|
<!-- <text class="articleDes" :class="props?.data?.needpay && 'needpay'" style="white-space: pre-wrap;"
|
||||||
v-html="props.data.content">
|
v-html="props.data.content">
|
||||||
</text>
|
</text> -->
|
||||||
|
|
||||||
|
<rich-text class="articleDes" :class="props?.data?.needpay && 'needpay'" style="white-space: pre-wrap;"
|
||||||
|
v-html="props.data.content"></rich-text>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <view
|
<!-- <view
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="mine">
|
<view class="mine">
|
||||||
|
<PageHeaderView title="个人中心"></PageHeaderView>
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<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>
|
||||||
|
|
@ -92,6 +93,8 @@ 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 PageHeaderView from "@/components/PageHeaderView.vue";
|
||||||
|
|
||||||
const stores = useShareStore();
|
const stores = useShareStore();
|
||||||
const curPages = getCurrentPages();
|
const curPages = getCurrentPages();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,22 @@
|
||||||
<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"
|
<image v-if="tabIndex == 1"
|
||||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/home_icon_normal.png"
|
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_normal.pngg"
|
||||||
class="tabbar_img" />
|
class="tabbar_img" />
|
||||||
<image v-if="tabIndex == 0"
|
<image v-if="tabIndex == 0"
|
||||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/home_icon_press.png"
|
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/home_icon_pre.png"
|
||||||
class="tabbar_img" />
|
class="tabbar_img" />
|
||||||
<text class="tabbar_title" :style="{ color: tabIndex == 0 ? '#3F80FA' : '#666666' }">首页</text>
|
<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"
|
<image v-if="tabIndex == 0"
|
||||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/all_icon_normal.png"
|
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
|
||||||
class="tabbar_img" />
|
class="tabbar_img" />
|
||||||
<image v-if="tabIndex == 1"
|
<image v-if="tabIndex == 1"
|
||||||
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/all_icon_press.png" class="tabbar_img" />
|
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
|
||||||
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#3F80FA' : '#666666' }">全部</text>
|
class="tabbar_img" />
|
||||||
|
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }">全部</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -38,12 +39,15 @@ onMounted(async () => { });
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.tabbar {
|
.tabbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
width: 100vw;
|
||||||
height: 150rpx;
|
height: 150rpx;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
box-shadow: 0 -2rpx 10rpx rgba(128, 128, 128, 0.2);
|
box-shadow: 0 -2rpx 10rpx rgba(128, 128, 128, 0.2);
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
z-index: 9999999;
|
||||||
|
|
||||||
.tabbar_item {
|
.tabbar_item {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<u-tabs :list="list1" :activeStyle="{
|
<!-- <u-tabs :list="list1" :activeStyle="{
|
||||||
color: '#303133',
|
color: '#AF201E',
|
||||||
fontWeight: 'bold',
|
|
||||||
transform: 'scale(1.05)',
|
transform: 'scale(1.05)',
|
||||||
fontSize: '24rpx'
|
fontSize: '24rpx'
|
||||||
}" :inactiveStyle="{
|
}" :inactiveStyle="{
|
||||||
|
|
@ -12,7 +11,15 @@
|
||||||
}" :itemStyle="{
|
}" :itemStyle="{
|
||||||
width: '27.5vw',
|
width: '27.5vw',
|
||||||
height: '70rpx',
|
height: '70rpx',
|
||||||
}" @click="click"></u-tabs>
|
}" lineColor="#AF201E" v-model="tabIndex" :current="0" @change="tabChange"></u-tabs> -->
|
||||||
|
|
||||||
|
<view v-for="(item, index) in list1" :key="index" :class="['tab_item', tabIndex == index ? 'active' : '']"
|
||||||
|
@click="tabChange({ index: index, name: item.name })">
|
||||||
|
|
||||||
|
<text>{{ item.name }}</text>
|
||||||
|
<view class="line" v-if="tabIndex == index"></view>
|
||||||
|
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -28,13 +35,65 @@ const list1 = reactive([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const tabIndex = ref(0);
|
const tabIndex = ref(0);
|
||||||
function tabChange(index) {
|
function tabChange(item) {
|
||||||
tabIndex.value = index;
|
console.log("🚀 ~ tabChange ~ item:", item)
|
||||||
emit("tabChange", index);
|
tabIndex.value = 0;
|
||||||
|
|
||||||
|
if (item.index == 1) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/realtimeInfo/rankDetail?type=0'
|
||||||
|
})
|
||||||
|
} else if (item.index == 2) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/realtimeInfo/rankDetail?type=1'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit("tabChange", item.index);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => { });
|
onMounted(async () => { });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss">
|
||||||
|
.tabs {
|
||||||
|
background-color: white;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.tab_item {
|
||||||
|
font-family: PingFangSC, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #6B727A;
|
||||||
|
line-height: 40rpx;
|
||||||
|
text-align: left;
|
||||||
|
font-style: normal;
|
||||||
|
|
||||||
|
width: 33vw;
|
||||||
|
height: 50rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
font-family: PingFangSC, PingFang SC;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #AF201E;
|
||||||
|
line-height: 42rpx;
|
||||||
|
text-align: left;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 5rpx;
|
||||||
|
background: #AF201E;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// 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 = "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";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,11 @@
|
||||||
"pages": [
|
"pages": [
|
||||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||||
{
|
{
|
||||||
"path": "pages/minihome/index"
|
"path": "pages/minihome/index",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"enablePullDownRefresh": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/realtimeInfo/index"
|
"path": "pages/realtimeInfo/index"
|
||||||
|
|
@ -18,6 +22,9 @@
|
||||||
{
|
{
|
||||||
"path": "pages/login/index"
|
"path": "pages/login/index"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/realtimeInfo/rankDetail"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/home/index",
|
"path": "pages/home/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|
@ -52,9 +59,6 @@
|
||||||
{
|
{
|
||||||
"path": "pages/worldlyAffairs/index"
|
"path": "pages/worldlyAffairs/index"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/realtimeInfo/rankDetail"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/realtimeInfo/home"
|
"path": "pages/realtimeInfo/home"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
|
<view :style="{ height: getNavHeight() + 'px' }"></view>
|
||||||
|
|
||||||
<!-- 导航栏 start -->
|
<!-- 导航栏 start -->
|
||||||
<view class="custom-bav-bar">
|
<view class="custom-bav-bar">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
|
|
@ -47,6 +49,9 @@ import Column from "@/components/column/index.vue";
|
||||||
import Comment from "@/components/comment/index.vue";
|
import Comment from "@/components/comment/index.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"
|
||||||
|
|
||||||
|
|
||||||
const stores = useShareStore();
|
const stores = useShareStore();
|
||||||
const curPages = getCurrentPages();
|
const curPages = getCurrentPages();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,46 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 顶部 banner 区域 -->
|
<!-- 顶部 banner 区域 -->
|
||||||
<view class="all">
|
<view class="all">
|
||||||
<Navbar title="中证参考" :hasBack="false"></Navbar>
|
<!-- <Navbar title="中证参考" :hasBack="false"></Navbar> -->
|
||||||
<Tabs @tabChange="tabChange"></Tabs>
|
<image class="top_bk" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/top_bg.png"></image>
|
||||||
|
|
||||||
<RankListMini v-if="tabIndex == 0" :newsList="newsList"></RankListMini>
|
<view :style="{ height: getNavHeight() + 'px' }" v-if="tabIndex == 0"></view>
|
||||||
|
<view
|
||||||
|
:style="{ height: getNavHeight() + 'px', backgroundColor: '#fff', position: 'sticky', top: 0, zIndex: '999999' }"
|
||||||
|
v-else></view>
|
||||||
|
|
||||||
|
<view class="content">
|
||||||
|
|
||||||
|
<view :style="{ position: 'sticky', top: getNavHeight() + 'px' }" 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>
|
||||||
|
|
||||||
|
<view class="sreach">
|
||||||
|
<view class="sreach_icon">
|
||||||
|
<image src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/icon_search_line.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="sreach_text">
|
||||||
|
<text>搜索资讯</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="padding: 0 24rpx;margin-top: 30rpx;">
|
||||||
|
<u-swiper :list="list1" @change="change" @click="click"></u-swiper>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="margin-top: 30rpx;">
|
||||||
|
<Tabs></Tabs>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="margin-top: 30rpx;" v-if="tabIndex == 0">
|
||||||
|
<RankListMini :newsList="newsList"></RankListMini>
|
||||||
|
</view>
|
||||||
<MineMini v-if="tabIndex == 1"></MineMini>
|
<MineMini v-if="tabIndex == 1"></MineMini>
|
||||||
|
</view>
|
||||||
|
|
||||||
<Tabbar @tabChange="tabChange"></Tabbar>
|
<Tabbar @tabChange="tabChange"></Tabbar>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -18,32 +53,106 @@ 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,
|
getTopNews,
|
||||||
} from "@/api/newsInfo";
|
} from "@/api/newsInfo";
|
||||||
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
|
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',
|
||||||
|
]);
|
||||||
|
|
||||||
const newsList = ref([]);
|
const newsList = ref([]);
|
||||||
// 概念标签贴标
|
// 概念标签贴标
|
||||||
async function getNewsList() {
|
async function getNewsList() {
|
||||||
newsList.value = await getTopNews({});
|
newsList.value = await getTopNews({});
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabIndex = ref(0);
|
const tabIndex = ref(0);
|
||||||
function tabChange(index) {
|
function tabChange(index) {
|
||||||
|
|
||||||
tabIndex.value = index;
|
tabIndex.value = index;
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
getNewsList()
|
getNewsList()
|
||||||
break;
|
break;
|
||||||
|
case 1:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
tabChange(0)
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
getNewsList()
|
getNewsList()
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss">
|
||||||
|
.top_bk {
|
||||||
|
width: 100%;
|
||||||
|
height: 300rpx;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 99999;
|
||||||
|
|
||||||
|
.r_sreach {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo_text {
|
||||||
|
width: 88rpx;
|
||||||
|
height: 45rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sreach {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0rpx 30rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
width: 47vw;
|
||||||
|
height: 68rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sreach_icon {
|
||||||
|
margin-right: 10rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 35rpx;
|
||||||
|
height: 35rpx;
|
||||||
|
margin-top: 5rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sreach_text {
|
||||||
|
font-family: PingFangSC, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
line-height: 33rpx;
|
||||||
|
text-align: left;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="all">
|
<view class="all">
|
||||||
<PageHeaderView
|
|
||||||
:title="type == 0 ? '热门行业池Top10' : '风口概念池Top10'"
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
></PageHeaderView>
|
<view :style="{ height: getNavHeight() + 'px' }"></view>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
|
<PageHeaderView :title="type == 0 ? '热门行业池Top10' : '风口概念池Top10'"></PageHeaderView>
|
||||||
|
|
||||||
<!-- 类目标签 start -->
|
<!-- 类目标签 start -->
|
||||||
<view class="page_content">
|
<view class="page_content">
|
||||||
<view class="tag_list">
|
<view class="tag_list">
|
||||||
<view
|
<view :class="['tag_item', clickTagIndex == index ? tagClickedClass : '']" class="tag_item"
|
||||||
:class="['tag_item', clickTagIndex == index ? tagClickedClass : '']"
|
v-for="(item, index) in tagList" :key="index" @click="clickTag(index)">
|
||||||
class="tag_item"
|
|
||||||
v-for="(item, index) in tagList"
|
|
||||||
:key="index"
|
|
||||||
@click="clickTag(index)"
|
|
||||||
>
|
|
||||||
{{ item.content }}
|
{{ item.content }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -22,12 +20,7 @@
|
||||||
|
|
||||||
<!-- 列表 start -->
|
<!-- 列表 start -->
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view
|
<view v-for="(item, index) in list" :key="index" class="news-item" @click="goDetail(item)">
|
||||||
v-for="(item, index) in list"
|
|
||||||
:key="index"
|
|
||||||
class="news-item"
|
|
||||||
@click="goDetail(item)"
|
|
||||||
>
|
|
||||||
<view class="news-content">
|
<view class="news-content">
|
||||||
<text class="news-title">{{ item.title }}</text>
|
<text class="news-title">{{ item.title }}</text>
|
||||||
<text class="news-desc">{{ item.summary }}</text>
|
<text class="news-desc">{{ item.summary }}</text>
|
||||||
|
|
@ -58,17 +51,19 @@ import {
|
||||||
import { getListByTag, getListByTagIndustry } from "@/api/detail";
|
import { getListByTag, getListByTagIndustry } from "@/api/detail";
|
||||||
|
|
||||||
import dayjs from "dayjs/esm/index";
|
import dayjs from "dayjs/esm/index";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import { getNavHeight } from "@/utils/util"
|
||||||
|
|
||||||
const props = defineProps({
|
// const props = defineProps({
|
||||||
type: {
|
// type: {
|
||||||
type: String,
|
// type: String,
|
||||||
default: () => 0,
|
// default: () => 0,
|
||||||
},
|
// },
|
||||||
index: {
|
// index: {
|
||||||
type: String,
|
// type: String,
|
||||||
default: () => 0,
|
// default: () => 0,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
const clickTagIndex = ref(0);
|
const clickTagIndex = ref(0);
|
||||||
|
|
||||||
|
|
@ -109,6 +104,7 @@ async function getTopConcept_dFn() {
|
||||||
topConceptList.value = await getTopConcept_d({});
|
topConceptList.value = await getTopConcept_d({});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const list = ref([]);
|
const list = ref([]);
|
||||||
async function getListByTagFn() {
|
async function getListByTagFn() {
|
||||||
let id = 0;
|
let id = 0;
|
||||||
|
|
@ -118,6 +114,8 @@ async function getListByTagFn() {
|
||||||
} else {
|
} else {
|
||||||
id = topConceptList.value[clickTagIndex.value].content;
|
id = topConceptList.value[clickTagIndex.value].content;
|
||||||
}
|
}
|
||||||
|
console.log("🚀 ~ getListByTagFn ~ id:", id)
|
||||||
|
|
||||||
uni.showLoading();
|
uni.showLoading();
|
||||||
if (props.type == 1) {
|
if (props.type == 1) {
|
||||||
// id = 1125;
|
// id = 1125;
|
||||||
|
|
@ -145,8 +143,14 @@ function goDetail(item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const tagClickedClass = ref("");
|
const tagClickedClass = ref("");
|
||||||
onMounted(async () => {
|
|
||||||
if (props.type && props.type == 0) {
|
const props = reactive({
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
onLoad(async (e) => {
|
||||||
|
props.type = e.type
|
||||||
|
if (e.type && e.type == 0) {
|
||||||
// 热门行业池
|
// 热门行业池
|
||||||
tagClickedClass.value = "tag_item_act_blue";
|
tagClickedClass.value = "tag_item_act_blue";
|
||||||
// 热门行业top10
|
// 热门行业top10
|
||||||
|
|
@ -160,11 +164,15 @@ onMounted(async () => {
|
||||||
tagList.value = topConceptList.value;
|
tagList.value = topConceptList.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.index) {
|
if (e.index) {
|
||||||
clickTagIndex.value = props.index;
|
clickTagIndex.value = props.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
getListByTagFn();
|
getListByTagFn();
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -254,11 +262,16 @@ onMounted(async () => {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
|
||||||
display: -webkit-box; /* 设置为WebKit内核的弹性盒子模型 */
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical; /* 垂直排列 */
|
/* 设置为WebKit内核的弹性盒子模型 */
|
||||||
-webkit-line-clamp: 2; /* 限制显示三行 */
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden; /* 隐藏超出范围的内容 */
|
/* 垂直排列 */
|
||||||
text-overflow: ellipsis; /* 使用省略号 */
|
-webkit-line-clamp: 2;
|
||||||
|
/* 限制显示三行 */
|
||||||
|
overflow: hidden;
|
||||||
|
/* 隐藏超出范围的内容 */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* 使用省略号 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.news-meta {
|
.news-meta {
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,13 @@ Request.interceptors.request((request: any) => {
|
||||||
request.header["content-type"] = request.header.contentType;
|
request.header["content-type"] = request.header.contentType;
|
||||||
delete request.header.contentType;
|
delete request.header.contentType;
|
||||||
}
|
}
|
||||||
if (request.method === "GET") {
|
// if (request.method === "GET") {
|
||||||
request.data = qs.stringify(request.data);
|
// request.data = qs.stringify(request.data);
|
||||||
request.url = request.url + "?" + request.data;
|
console.log("🚀 ~ request.data:", request.data)
|
||||||
}
|
// request.url = request.url + "?" + request.data;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class requestClass {
|
||||||
// 拦截器
|
// 拦截器
|
||||||
interceptors = {
|
interceptors = {
|
||||||
request: (func: Fn) => {
|
request: (func: Fn) => {
|
||||||
|
console.log("🚀 ~ requestClass ~ func:", func)
|
||||||
if (func) {
|
if (func) {
|
||||||
requestClass[requestBefore] = func;
|
requestClass[requestBefore] = func;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -55,7 +56,14 @@ class requestClass {
|
||||||
options.url = requestClass[isCompleteURL](options.url)
|
options.url = requestClass[isCompleteURL](options.url)
|
||||||
? options.url
|
? options.url
|
||||||
: options.baseURL + options.url;
|
: options.baseURL + options.url;
|
||||||
|
|
||||||
|
// 新增:如果是GET请求且data为空对象,则删除data
|
||||||
|
if (options.method === 'GET' && options.data && Object.keys(options.data).length === 0) {
|
||||||
|
delete options.data;
|
||||||
|
} else {
|
||||||
options.data = options.data;
|
options.data = options.data;
|
||||||
|
}
|
||||||
|
|
||||||
options.header = { ...options.header, ...this[config].header };
|
options.header = { ...options.header, ...this[config].header };
|
||||||
options.method = options.method || this[config].method;
|
options.method = options.method || this[config].method;
|
||||||
|
|
||||||
|
|
@ -69,17 +77,6 @@ class requestClass {
|
||||||
reject(requestClass[requestAfter](err));
|
reject(requestClass[requestAfter](err));
|
||||||
};
|
};
|
||||||
uni.request(options);
|
uni.request(options);
|
||||||
// 中断请求实现方法
|
|
||||||
// let obj: any = {}
|
|
||||||
// obj[request.url] = uni.request(options)
|
|
||||||
// abortRequest() {
|
|
||||||
// for (const key in obj) {
|
|
||||||
// if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
||||||
// const element = obj[key];
|
|
||||||
// element.abort()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,3 +82,14 @@ export const jumpUrl = (url) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export function getNavHeight() {
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
console.log(systemInfo);
|
||||||
|
const statusBarHeight = systemInfo.statusBarHeight; // 状态栏高度
|
||||||
|
const navigationBarHeight = systemInfo.platform === 'android' ? statusBarHeight + 48 : statusBarHeight + 44; // 通常安卓底部有48px的导航栏,iOS是44px
|
||||||
|
console.log('状态栏高度:', statusBarHeight);
|
||||||
|
console.log('导航栏高度:', navigationBarHeight);
|
||||||
|
|
||||||
|
return statusBarHeight
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue