feat: 点底部 tab 的“AI店铺”时没开通就不跳转并提示
This commit is contained in:
+2
-1
@@ -11,4 +11,5 @@
|
||||
- 首页`会员优选`分类点击购买直接跳转到购买页、支付完成返回首页
|
||||
- 我的社员ui重构
|
||||
- 粉色卡默认false所有页面统一调整
|
||||
- 选品广场结算返回到我的店铺页
|
||||
- 选品广场结算返回到我的店铺页
|
||||
- 点底部 tab 的“AI店铺”时没开通就不跳转并提示
|
||||
@@ -31,6 +31,7 @@
|
||||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import * as AiApi from '@/sheep/api/ai/index';
|
||||
|
||||
const props = defineProps({
|
||||
path: {
|
||||
@@ -120,13 +121,56 @@
|
||||
return isActive(item) ? item.selectedIconPath : item.iconPath;
|
||||
};
|
||||
|
||||
const onTap = (item) => {
|
||||
const aiShopStatus = ref({
|
||||
value: null,
|
||||
checkedAt: 0,
|
||||
});
|
||||
|
||||
const ensureAiShopOpened = async () => {
|
||||
const now = Date.now();
|
||||
if (aiShopStatus.value.value !== null && now - aiShopStatus.value.checkedAt < 60 * 1000) {
|
||||
return Boolean(aiShopStatus.value.value);
|
||||
}
|
||||
const res = await AiApi.checkShopStatus({});
|
||||
if (res?.code !== 0) {
|
||||
throw new Error('checkShopStatus_failed');
|
||||
}
|
||||
const opened = Boolean(res?.data);
|
||||
aiShopStatus.value = {
|
||||
value: opened ? 1 : 0,
|
||||
checkedAt: now,
|
||||
};
|
||||
return opened;
|
||||
};
|
||||
|
||||
const onTap = async (item) => {
|
||||
if (item.isMid) {
|
||||
hideNativeTabBar();
|
||||
uni.navigateTo({ url: item.pagePath });
|
||||
return;
|
||||
}
|
||||
if (isActive(item)) return;
|
||||
|
||||
if (normalizePath(item.pagePath) === '/pages/index/aiStore') {
|
||||
try {
|
||||
const opened = await ensureAiShopOpened();
|
||||
if (!opened) {
|
||||
uni.showToast({
|
||||
title: '您尚未开通AI店铺,无法查看购物车。请先开通AI店铺后再进行购买。',
|
||||
icon: 'none',
|
||||
duration: 2500,
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
uni.showToast({
|
||||
title: '系统繁忙,请稍后重试',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hideNativeTabBar();
|
||||
uni.switchTab({
|
||||
url: item.pagePath,
|
||||
|
||||
+14
-4
@@ -41,7 +41,11 @@
|
||||
</view>
|
||||
<view class="notice-card" v-if="mesArr.length && index === 0">
|
||||
<view class="notice-marquee-viewport">
|
||||
<view class="notice-marquee-track" :class="{ 'is-scroll': mesArr.length > 1 }">
|
||||
<view
|
||||
class="notice-marquee-track"
|
||||
:class="{ 'is-scroll': mesArr.length > 1 }"
|
||||
:style="mesArr.length > 1 ? { '--marquee-duration': marqueeDuration } : {}"
|
||||
>
|
||||
<view class="notice-marquee-content">
|
||||
<view
|
||||
v-for="(line, i) in mesArr"
|
||||
@@ -164,7 +168,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import card_pages from '@/components/card_pages/card_pages';
|
||||
@@ -187,6 +191,11 @@
|
||||
const selectedTimeId = ref(null);
|
||||
const navName = ref('');
|
||||
const mesArr = ref([]);
|
||||
const marqueeDuration = computed(() => {
|
||||
const n = Array.isArray(mesArr.value) ? mesArr.value.length : 0;
|
||||
const seconds = Math.max(14, n * 2);
|
||||
return `${seconds}s`;
|
||||
});
|
||||
|
||||
function changeTimeRound(e) {
|
||||
navName.value = e.name;
|
||||
@@ -462,7 +471,8 @@
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
flex: 1;
|
||||
// flex: 1;
|
||||
width: 300rpx;
|
||||
font-size: 22rpx;
|
||||
color: #111111;
|
||||
line-height: 50rpx;
|
||||
@@ -482,7 +492,7 @@
|
||||
transform: translateX(0);
|
||||
will-change: transform;
|
||||
&.is-scroll {
|
||||
animation: notice-marquee-move 16s linear infinite;
|
||||
animation: notice-marquee-move var(--marquee-duration, 16s) linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user