feat(minihome): 添加token和userType参数到搜索页面跳转链接

refactor(articleList): 简化列表项布局并优化时间显示格式
fix(config): 切换baseUrl为本地开发环境
feat(sreachReq): 实现微信小程序跳转并添加用户参数处理
This commit is contained in:
34701892@qq.com 2026-01-14 16:26:00 +08:00
parent ac2515b6c6
commit 12310a191d
4 changed files with 48 additions and 49 deletions

View File

@ -1,27 +1,11 @@
<template> <template>
<view class="list" v-if="data.length"> <view class="list" v-if="data.length">
<view <view class="listItem" v-for="item in props.data" :key="item.id" @click="handleClick(item)">
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 <image :src="item.picture" class="ListItemImage" mode="widthFix" style="width: 204rpx" />
:src="item.picture" <image class="ListItemBg" :src="item.picture" style="width: 100%; height: 100%" />
class="ListItemImage" <view class="tag" v-if="item.newType !== 'search'">{{ item.tag }}</view>
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>
<view class="listItemHeaderContent"> <view class="listItemHeaderContent">
<view v-if="!isLogin"> <view v-if="!isLogin">
@ -38,11 +22,7 @@
v-if="item.newType !== 'search'" v-if="item.newType !== 'search'"
v-html="item.summary" v-html="item.summary"
></view> ></view>
<view <view :class="['listItemAbstract', isLogin ? '' : 'mohu']" v-else v-html="item.summary"></view>
:class="['listItemAbstract', isLogin ? '' : 'mohu']"
v-else
v-html="item.MarkInRedContent || item.abstract"
></view>
</view> </view>
</view> </view>
@ -51,14 +31,16 @@
</view> --> </view> -->
<view :class="['listItemContent', isLogin ? '' : 'mohu']"> <view :class="['listItemContent', isLogin ? '' : 'mohu']">
<view style="display: flex"> <view style="display: flex; align-items: center">
<view class="tag">{{ item.tag }}</view> <!-- <view class="tag">{{ item.tag }}</view> -->
<view class="listItemTime" style="margin-left: 10rpx">{{ <view class="tag">中国证券报</view>
item.time <!-- <view class="tag" style="margin-left: 10rpx; margin-top: 1px">{{ item.time }}</view> -->
<view class="tag" style="margin-left: 10rpx; margin-top: 1px">{{
dayjs(item.time).format("YYYY-MM-DD HH:MM:ss")
}}</view> }}</view>
</view> </view>
<view class="r_option"> <!-- <view class="r_option">
<image <image
class="option_icon" class="option_icon"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/eye_icon%402x.png"
@ -76,7 +58,7 @@
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/share_icon%402x.png"
></image> ></image>
<text class="option_text">{{ item.shareNums }}</text> <text class="option_text">{{ item.shareNums }}</text>
</view> </view> -->
</view> </view>
<!-- <view class="listItemFooter" v-if="item.needpay"></view> --> <!-- <view class="listItemFooter" v-if="item.needpay"></view> -->
@ -89,6 +71,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { onShow, onLoad } from "@dcloudio/uni-app"; import { onShow, onLoad } from "@dcloudio/uni-app";
import dayjs from "dayjs/esm/index";
const emit = defineEmits(["handleListJump", "onClick"]); const emit = defineEmits(["handleListJump", "onClick"]);
const isLogin = ref(uni.getStorageSync("token")); const isLogin = ref(uni.getStorageSync("token"));
@ -150,7 +133,8 @@ const handleClick = (item: any) => {
filter: blur(30rpx); filter: blur(30rpx);
} }
.tag { .tag,
.listItemTime {
position: absolute; position: absolute;
right: 0; right: 0;
bottom: 0; bottom: 0;

View File

@ -1,7 +1,7 @@
// const baseUrl = "http://192.168.31.25:8060/api"; // const baseUrl = "http://192.168.31.25:8060/api";
// export const baseUrl = "http://127.0.0.1:8040/apih5"; export const baseUrl = "http://127.0.0.1:8040/apih5";
// export const baseUrl = "http://123.60.153.169:8042/apih5"; // export const baseUrl = "http://123.60.153.169:8042/apih5";
export const baseUrl = "https://cankao.cs.com.cn/mini"; // export const baseUrl = "https://cankao.cs.com.cn/mini";
export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav"; export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav";
// export const baseUrlDataV = "http://123.60.153.169:9995/zzck_datav"; // export const baseUrlDataV = "http://123.60.153.169:9995/zzck_datav";

View File

@ -144,7 +144,7 @@ function tabChange(index) {
function goSreach() { function goSreach() {
if (uni.getStorageSync("token")) { if (uni.getStorageSync("token")) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/sreachReq/index", url: "/pages/sreachReq/index?phone=" + uni.getStorageSync("token") + "&userType=" + userParams.value.userType,
}); });
} else { } else {
uni.navigateTo({ uni.navigateTo({

View File

@ -173,26 +173,35 @@ const handleShowPay = (type) => {
} }
}; };
import wx from "weixin-js-sdk";
// //
const handleSwiperJump = (item: any) => { const handleSwiperJump = (item: any) => {
console.log("item ===>", item); console.log("item ===>", item);
if (uni.getStorageSync("token")) { // if (uni.getStorageSync("token")) {
uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.id}&type=${item.type}`,
});
} else {
uni.navigateTo({
url: "/pages/login/indexMini",
});
}
// if (item.needpay) {
// //
// 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/indexMini",
// });
// } // }
let shareUrl =
"https://cankao.cs.com.cn/jnh/#/pages/detail/indexNewsInfo?id=" +
// "http://localhost:8881/jnh/#/pages/detail/indexNewsInfo?id=" +
item.news_id +
"&phone=" +
uni.getStorageSync("token") +
"&userType=" +
userParams.value.userType;
wx.miniProgram.navigateTo({
url: "/pages/webView/index?url=" + encodeURIComponent(shareUrl),
success: (res) => {
console.log("🚀 调用小程序跳转navigateTo:", res);
},
});
}; };
const handleChange = (val: string) => { const handleChange = (val: string) => {
@ -216,9 +225,15 @@ onLoad((e) => {
handleChange(keyWord.value); handleChange(keyWord.value);
}); });
const onload = () => { const userParams = ref({});
const onload = (option) => {
page.value++; page.value++;
getData(); getData();
userParams.value = option;
if (userParams.value.phone) {
uni.setStorageSync("token", userParams.value.phone);
}
}; };
const getData = async () => { const getData = async () => {