fix: record page
This commit is contained in:
@@ -66,3 +66,10 @@ export const getRandomGreeting = async () => {
|
|||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getTipsList = async () => {
|
||||||
|
return request({
|
||||||
|
url: `/api/blessing/tips/list`,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -15,9 +15,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 新春提示栏 -->
|
<!-- 新春提示栏 -->
|
||||||
<view class="notice-bar">
|
<view v-if="noticeList && noticeList.length > 0" class="notice-bar">
|
||||||
<view class="notice-left">
|
<view class="notice-left">
|
||||||
<text class="notice-tag">新品</text>
|
|
||||||
<swiper
|
<swiper
|
||||||
class="notice-swiper"
|
class="notice-swiper"
|
||||||
vertical
|
vertical
|
||||||
@@ -32,6 +31,7 @@
|
|||||||
class="notice-swiper-item"
|
class="notice-swiper-item"
|
||||||
@tap="onNoticeTap(tip)"
|
@tap="onNoticeTap(tip)"
|
||||||
>
|
>
|
||||||
|
<text v-if="tip.tag" class="notice-tag">{{ getTagText(tip.tag) }}</text>
|
||||||
<text class="notice-text">{{ tip.text }}</text>
|
<text class="notice-text">{{ tip.text }}</text>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
@@ -135,7 +135,7 @@ import {
|
|||||||
onShow,
|
onShow,
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import { getBavBarHeight } from "@/utils/system";
|
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";
|
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||||
|
|
||||||
const countdownText = ref("");
|
const countdownText = ref("");
|
||||||
@@ -177,6 +177,7 @@ const dailyGreeting = ref("");
|
|||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
updateCountdown();
|
updateCountdown();
|
||||||
|
getIndexTips();
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
todayDate.value = `${date.getMonth() + 1}月${date.getDate()}日`;
|
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 getRandomGreetingText = async () => {
|
||||||
const content = await getRandomGreeting();
|
const content = await getRandomGreeting();
|
||||||
dailyGreeting.value =
|
dailyGreeting.value =
|
||||||
@@ -229,27 +236,21 @@ const useGreeting = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const noticeList = ref([
|
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 onNoticeTap = (tip) => {
|
const onNoticeTap = (tip) => {
|
||||||
if (!tip.url) return;
|
if (!tip.url) return;
|
||||||
|
|
||||||
uni.navigateTo({
|
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),
|
url: "/pages/webview/index?url=" + encodeURIComponent(tip.url),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const features = ref([
|
const features = ref([
|
||||||
@@ -322,7 +323,7 @@ const fetchRecommendList = async (isRefresh = false) => {
|
|||||||
const getTagText = (tag) => {
|
const getTagText = (tag) => {
|
||||||
const map = {
|
const map = {
|
||||||
hot: "热门",
|
hot: "热门",
|
||||||
new: "新款",
|
new: "新品",
|
||||||
featured: "精选",
|
featured: "精选",
|
||||||
hot2: "爆款",
|
hot2: "爆款",
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user