fix: record page
This commit is contained in:
@@ -66,3 +66,10 @@ export const getRandomGreeting = async () => {
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const getTipsList = async () => {
|
||||
return request({
|
||||
url: `/api/blessing/tips/list`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 新春提示栏 -->
|
||||
<view class="notice-bar">
|
||||
<view v-if="noticeList && noticeList.length > 0" class="notice-bar">
|
||||
<view class="notice-left">
|
||||
<text class="notice-tag">新品</text>
|
||||
<swiper
|
||||
class="notice-swiper"
|
||||
vertical
|
||||
@@ -32,6 +31,7 @@
|
||||
class="notice-swiper-item"
|
||||
@tap="onNoticeTap(tip)"
|
||||
>
|
||||
<text v-if="tip.tag" class="notice-tag">{{ getTagText(tip.tag) }}</text>
|
||||
<text class="notice-text">{{ tip.text }}</text>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
@@ -135,7 +135,7 @@ import {
|
||||
onShow,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import { getRecommendList, getRandomGreeting } from "@/api/system";
|
||||
import { getRecommendList, getRandomGreeting, getTipsList } from "@/api/system";
|
||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||
|
||||
const countdownText = ref("");
|
||||
@@ -177,6 +177,7 @@ const dailyGreeting = ref("");
|
||||
|
||||
onShow(() => {
|
||||
updateCountdown();
|
||||
getIndexTips();
|
||||
const date = new Date();
|
||||
todayDate.value = `${date.getMonth() + 1}月${date.getDate()}日`;
|
||||
});
|
||||
@@ -216,6 +217,12 @@ onShareTimeline(() => {
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
const getIndexTips = async () => {
|
||||
const res = await getTipsList();
|
||||
noticeList.value = res || [];
|
||||
};
|
||||
|
||||
const getRandomGreetingText = async () => {
|
||||
const content = await getRandomGreeting();
|
||||
dailyGreeting.value =
|
||||
@@ -229,27 +236,21 @@ const useGreeting = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const noticeList = ref([
|
||||
{
|
||||
text: "新春祝福上新品了,点击查看",
|
||||
url: "https://mp.weixin.qq.com/s/mK438jWsYzsccJ2dDJG15A",
|
||||
},
|
||||
{
|
||||
text: "新春祝福上新品了3,点击查看",
|
||||
url: "https://mp.weixin.qq.com/s/mK438jWsYzsccJ2dDJG15A",
|
||||
},
|
||||
{
|
||||
text: "新春祝福上新品了3,点击查看",
|
||||
url: "https://mp.weixin.qq.com/s/mK438jWsYzsccJ2dDJG15A",
|
||||
},
|
||||
]);
|
||||
const noticeList = ref([]);
|
||||
|
||||
const onNoticeTap = (tip) => {
|
||||
if (!tip.url) return;
|
||||
|
||||
if (tip.type === "path") {
|
||||
uni.navigateTo({ url: tip.url });
|
||||
} else if (tip.type === "switchTab") {
|
||||
uni.switchTab({ url: tip.url });
|
||||
} else {
|
||||
// 默认跳转 webview (公众号文章)
|
||||
uni.navigateTo({
|
||||
url: "/pages/webview/index?url=" + encodeURIComponent(tip.url),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const features = ref([
|
||||
@@ -322,7 +323,7 @@ const fetchRecommendList = async (isRefresh = false) => {
|
||||
const getTagText = (tag) => {
|
||||
const map = {
|
||||
hot: "热门",
|
||||
new: "新款",
|
||||
new: "新品",
|
||||
featured: "精选",
|
||||
hot2: "爆款",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user