fix: 修复分享路径错误并优化代码格式

修复indexNewsInfo.vue中分享路径的拼写错误(/page/改为/pages/)
在rankDetail.vue中添加返回功能
优化多个组件的代码格式和样式
This commit is contained in:
zzp 2025-08-28 11:32:34 +08:00
parent aada0e1c2c
commit 14fa72f32b
4 changed files with 49 additions and 21 deletions

View File

@ -1,10 +1,10 @@
<template> <template>
<view class="main"> <view class="main">
<text style="margin-left: 40rpx;margin-right: 40rpx;display: flex;"> <text style="margin-left: 40rpx; margin-right: 40rpx; display: flex">
<text class="title">{{ props.data.title?.slice(0, 3) }}</text> <text class="title">{{ props.data.title?.slice(0, 3) }}</text>
<text :class="['title', isLogin ? '' : 'mohu']">{{ props.data.title?.slice(3, <text :class="['title', isLogin ? '' : 'mohu']">{{
props.data.title.length props.data.title?.slice(3, props.data.title.length)
- 1) }}</text> }}</text>
</text> </text>
<view class="author"> <view class="author">
@ -22,17 +22,31 @@
<!-- 两个标签 start --> <!-- 两个标签 start -->
<view class="r_r_tags"> <view class="r_r_tags">
<view style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 95vw"> <view
style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 95vw"
>
<view class="r_tags"> <view class="r_tags">
<view class="tag" style="background-color: #fff9ec; color: #ffb100" <view
v-for="(item, index) in props.data.conceptLabels" :key="index">{{ item }}</view> class="tag"
style="background-color: #fff9ec; color: #ffb100"
v-for="(item, index) in props.data.conceptLabels"
:key="index"
>{{ item }}</view
>
</view> </view>
</view> </view>
<view style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 100vw"> <view
style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 100vw"
>
<view class="r_tags"> <view class="r_tags">
<view class="tag" style="background-color: #f5f8fe; color: #007aff" <view
v-for="(item, index) in props.data.industryLabels" :key="index">{{ item }}</view> class="tag"
style="background-color: #f5f8fe; color: #007aff"
v-for="(item, index) in props.data.industryLabels"
:key="index"
>{{ item }}</view
>
</view> </view>
</view> </view>
</view> </view>
@ -40,7 +54,6 @@
<!-- 摘要 --> <!-- 摘要 -->
<view :class="['desc', isLogin ? '' : 'mohu']" v-if="props.data.summary"> <view :class="['desc', isLogin ? '' : 'mohu']" v-if="props.data.summary">
<!-- <view class="bill_icon"></view> --> <!-- <view class="bill_icon"></view> -->
{{ props.data.summary }} {{ props.data.summary }}
</view> </view>
@ -54,8 +67,11 @@
v-html="props.data.content"> v-html="props.data.content">
</text> --> </text> -->
<rich-text :class="['articleDes', isLogin ? '' : 'mohu']" style="white-space: pre-wrap" <rich-text
v-html="props.data.content"></rich-text> :class="['articleDes', isLogin ? '' : 'mohu']"
style="white-space: pre-wrap"
v-html="props.data.content"
></rich-text>
</view> </view>
<!-- <view <!-- <view
@ -77,12 +93,12 @@ import {
onShareTimeline, onShareTimeline,
} from "@dcloudio/uni-app"; } from "@dcloudio/uni-app";
// import articleMock from "@/mock/article.js"; // import articleMock from "@/mock/article.js";
const isLogin = ref(uni.getStorageSync('token')) const isLogin = ref(uni.getStorageSync("token"));
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
const tagList1 = ref([ const tagList1 = ref([

View File

@ -246,7 +246,7 @@ onShareTimeline(async (res) => {
}); });
return { return {
title: data.value.title, // title: data.value.title, //
path: "/page/detail/indexNewsInfo?id=" + data.value.id, // path: "/pages/detail/indexNewsInfo?id=" + data.value.id, //
imageUrl: imageUrl:
"https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_pic_1%402x.png", // "https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_pic_1%402x.png", //
}; };
@ -260,7 +260,7 @@ onShareAppMessage(async (res) => {
}); });
return { return {
title: data.value.title, // title: data.value.title, //
path: "/page/detail/indexNewsInfo?id=" + data.value.id, // path: "/pages/detail/indexNewsInfo?id=" + data.value.id, //
imageUrl: imageUrl:
"https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_pic_1%402x.png", // "https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_pic_1%402x.png", //
}; };

View File

@ -255,6 +255,10 @@ function goSreach() {
} }
} }
function goBack() {
uni.navigateBack();
}
const tagClickedClass = ref(""); const tagClickedClass = ref("");
const props = reactive({}); const props = reactive({});

View File

@ -10,7 +10,12 @@
<!-- 列表区域 --> <!-- 列表区域 -->
<!-- @click="jump(item)" --> <!-- @click="jump(item)" -->
<view class="colListContainer"> <view class="colListContainer">
<view class="colListItem" v-for="item in data" :key="item.id" @click="jump(item)"> <view
class="colListItem"
v-for="item in data"
:key="item.id"
@click="jump(item)"
>
<view class="ItemLeft"> <view class="ItemLeft">
<view class="colName">{{ item.name }}</view> <view class="colName">{{ item.name }}</view>
<view class="colDesc">{{ item.desc }}</view> <view class="colDesc">{{ item.desc }}</view>
@ -38,7 +43,7 @@ const props = defineProps({
// //
data: { data: {
type: Object, type: Object,
default: () => { }, default: () => {},
}, },
}); });
@ -53,7 +58,9 @@ const formatData = (data: any) => {
if (data.indexOf(item.type) !== -1) { if (data.indexOf(item.type) !== -1) {
return { return {
...item, ...item,
validTime: formatTime(new Date().getTime() + 1000 * 60 * 60 * 24 * 30), validTime: formatTime(
new Date().getTime() + 1000 * 60 * 60 * 24 * 30
),
}; };
} }
}) })
@ -135,7 +142,8 @@ const colList = ref([
align-items: center; align-items: center;
position: relative; position: relative;
.flashBack {} .flashBack {
}
.title { .title {
font-size: var(--h1-font-size); font-size: var(--h1-font-size);