diff --git a/.env.development b/.env.development index 705b440..da0a3b9 100644 --- a/.env.development +++ b/.env.development @@ -2,10 +2,10 @@ ENV = development # 本地环境接口地址 -# VITE_API_URL = http://123.60.153.169:8040/apih5 +VITE_API_URL = http://123.60.153.169:8040/apih5 # VITE_API_URL = http://4155gf93ll13.vicp.fun/apih5 # VITE_API_URL = http://123.60.79.143:8041/apih5 # VITE_API_URL =http://192.168.0.135:8040/apih5 -VITE_API_URL = https://cankao.cs.com.cn/apih5 +# VITE_API_URL = https://cankao.cs.com.cn/apih5 VITE_API_DATAV_URL = https://cankao.cs.com.cn/zzck_datav \ No newline at end of file diff --git a/src/api/detail.ts b/src/api/detail.ts index 5ec65ed..eba5de1 100644 --- a/src/api/detail.ts +++ b/src/api/detail.ts @@ -39,4 +39,9 @@ export const getListByTagIndustry = (data: any) => { // 概念标签 export const getListByTag = (data: any) => { return request.get(`/news/list/tag?name=${data.name}`); +}; + +// 拓展阅读新闻 +export const getListByNewsExtend = (news_id: string) => { + return request.get(`/news/detail/${news_id}/furtherReadings`); }; \ No newline at end of file diff --git a/src/components/article/indexNewsInfo.vue b/src/components/article/indexNewsInfo.vue index f936a35..b2c2ff2 100644 --- a/src/components/article/indexNewsInfo.vue +++ b/src/components/article/indexNewsInfo.vue @@ -1,9 +1,9 @@ @@ -177,9 +172,10 @@ import { onShareTimeline, } from "@dcloudio/uni-app"; import articleMock from "@/mock/article.js"; -import LoginPopup from "@/components/loginPopup/index.vue"; +import LoginDialog from "@/components/loginPopup/index.vue"; import { Session } from "@/utils/storage"; import zhaiyaoImg from "../../assets/zixun/zhaiyao_icon.png"; +import { useUserStore } from "@/stores/user"; const isLogin = ref(Session.get("token")); const props = defineProps({ @@ -187,6 +183,10 @@ const props = defineProps({ type: Object, default: () => {}, }, + extendData: { + type: Array, + default: () => [], + }, }); const tagList1 = ref([ { @@ -199,16 +199,28 @@ const tagList1 = ref([ name: "医药生物-医疗服务", }, ]); -const LoginShow = ref(false); -// 关闭弹框 -const handlePopupClose = () => { - LoginShow.value = false; - isLogin.value = Session.get("token"); + +const userStore = useUserStore(); + +// 登录弹框 +const LoginShow = ref(true); + +// 显示弹框 +const handleShowLogin = () => { + LoginShow.value = true; }; -// 登录成功回调 -const handlePopupSuccessCallback = () => { - isLogin.value = Session.get("token"); - console.log("🚀 ~ handlePopupSuccessCallback ~ isLogin.value:", isLogin.value); + +// 关闭弹框 +const handleLoginCancel = () => { + LoginShow.value = false; +}; +// 登录成功之后的回调 +const handleLoginSuccess = () => { + LoginShow.value = false; +}; +// 登录失败之后的回调 +const handleLoginError = () => { + console.log("登录失败"); }; const tagList2 = ref([ @@ -234,7 +246,7 @@ onLoad((option) => { type.value = option?.type || "list"; intoType.value = option?.intoType || null; - if (!isLogin.value) { + if (!userStore.isLogin) { LoginShow.value = true; } }); @@ -293,6 +305,18 @@ const handleSub = () => { show.value = false; }; + +// 拓展阅读跳转新闻详情 +const goNewsDetail = (item: any) => { + uni.navigateTo({ + url: `/pages/detail/indexNewsInfo?id=${item.id}`, + }); +}; + +// 拓展阅读更多 +const getMoreExtendNews = (item: any) => { + console.log("output >>>>> 更多"); +}; diff --git a/src/components/loginPopup/index.vue b/src/components/loginPopup/index.vue index 2fc2a43..1a78855 100644 --- a/src/components/loginPopup/index.vue +++ b/src/components/loginPopup/index.vue @@ -1,32 +1,57 @@ diff --git a/src/pages/realtimeInfo/components/LoginDialog/index.vue b/src/components/loginPopup/indexV1.vue similarity index 69% rename from src/pages/realtimeInfo/components/LoginDialog/index.vue rename to src/components/loginPopup/indexV1.vue index d2d0883..2fc2a43 100644 --- a/src/pages/realtimeInfo/components/LoginDialog/index.vue +++ b/src/components/loginPopup/indexV1.vue @@ -1,54 +1,27 @@ @@ -32,7 +36,7 @@ import { onMounted, ref } from "vue"; import { onLoad, onShow } from "@dcloudio/uni-app"; import { onReachBottom } from "@dcloudio/uni-app"; -import { fetchArticleDetail, fetchArticleLike, fetchArticleFavorate } from "@/api/detail"; +import { fetchArticleDetail, fetchArticleLike, fetchArticleFavorate, getListByNewsExtend } from "@/api/detail"; import { getNewsList } from "@/api"; import Article from "@/components/article/indexNewsInfo.vue"; import Column from "@/components/column/index.vue"; @@ -51,26 +55,6 @@ onReachBottom(() => { console.log("🚀 ~ onReachBottom ~ onReachBottom:"); }); -onLoad(async (option: any) => { - uni.pageScrollTo({ - scrollTop: 0, - }); - newType.value = option.type || 14; - const res = await fetchArticleDetail({ - id: option.id, - }); - - if (res.code === 200) { - data.value = res.data; - - res.data.content = res.data.content.replace(/\n{3,}/g, "\n"); - - columnName.value = res.data.columnName1; - newList(res.data.columnId1); - wxShare(); - } -}); - const newList = async (columnId: number) => { const res = await getNewsList({ type: 99, @@ -123,7 +107,9 @@ const handleClickLike = async () => { }); if (res.code === 200) { data.value.isLike = data.value.isLike ? 0 : 1; - data.value.likeNums = data.value.isLike ? data.value.likeNums + 1 : data.value.likeNums - 1; + data.value.likeNums = data.value.isLike + ? data.value.likeNums + 1 + : data.value.likeNums - 1; } }; @@ -135,7 +121,9 @@ const handleClickStar = async () => { }); if (res.code === 200) { data.value.isFav = data.value.isFav ? 0 : 1; - data.value.favNums = data.value.isFav ? data.value.favNums + 1 : data.value.favNums - 1; + data.value.favNums = data.value.isFav + ? data.value.favNums + 1 + : data.value.favNums - 1; } }; @@ -146,7 +134,7 @@ const wxShare = () => { JSON.stringify({ id: data.value.id, type: newType.value, - }) + }), ); link += `?path=${path}&query=${query}`; // console.log("🚀 ~ WXconfig ~ link:", link); @@ -195,7 +183,29 @@ const jumpAll = () => { const { aplus_queue } = window; -onMounted(() => { +// 跳转详情 +const jumpDetail = (item: any) => { + // console.log(item) + uni.navigateTo({ + url: `/pages/detail/index?id=${item.id}`, + }); +}; + + + +// 新闻id +const news_id = ref('') +const extendList = ref([]) // 扩展列表 +const getExtendList = ()=> { + + getListByNewsExtend(news_id.value).then((res: any) => { + console.log('output >>>>> res',res); + + }); +} + +onLoad(async (option: any) => { + news_id.value = option.id aplus_queue.push({ action: "aplus.sendPV", arguments: [{ is_auto: false }], // 此处上报的数据暂时在后台没有展示 @@ -212,15 +222,27 @@ onMounted(() => { }, ], }); -}); - -// 跳转详情 -const jumpDetail = (item: any) => { - // console.log(item) - uni.navigateTo({ - url: `/pages/detail/index?id=${item.id}`, + uni.pageScrollTo({ + scrollTop: 0, }); -}; + newType.value = option.type || 14; + const res = await fetchArticleDetail({ + id: option.id, + }); + + // 获取拓展阅读 + getExtendList(); + + if (res.code === 200) { + data.value = res.data; + + res.data.content = res.data.content.replace(/\n{3,}/g, "\n"); + + columnName.value = res.data.columnName1; + newList(res.data.columnId1); + wxShare(); + } +});