Merge branch 'dev' into 'master'

uniapp【修复】:首页弹框广告点击跳转

See merge request jianweie/coreshoppro!107
This commit is contained in:
花城
2024-12-17 02:08:21 +00:00
2 changed files with 121 additions and 93 deletions

View File

@@ -1,75 +1,87 @@
export enum WidgetCodeEnum { export enum WidgetCodeEnum {
/** 图片 */ /** 图片 */
imgSingle = 'imgSingle', imgSingle = 'imgSingle',
/** 服务商品 */ /** 服务商品 */
service = 'service', service = 'service',
/** 图片轮播 */ /** 图片轮播 */
imgSlide = 'imgSlide', imgSlide = 'imgSlide',
/** 公告 */ /** 公告 */
notice = 'notice', notice = 'notice',
/** 优惠券 */ /** 优惠券 */
coupon = 'coupon', coupon = 'coupon',
/** 拼团 */ /** 拼团 */
pinTuan = 'pinTuan', pinTuan = 'pinTuan',
/** 搜索 */ /** 搜索 */
search = 'search', search = 'search',
/** 宫格自定义导航 */ /** 宫格自定义导航 */
navBar = 'navBar', navBar = 'navBar',
/** 商品选项卡 */ /** 商品选项卡 */
goodTabBar = 'goodTabBar', goodTabBar = 'goodTabBar',
/** 文章 */ /** 文章 */
article = 'article', article = 'article',
/** 文章分类 */ /** 文章分类 */
articleClassify = 'articleClassify', articleClassify = 'articleClassify',
/** 视频 */ /** 视频 */
video = 'video', video = 'video',
/** 商品 */ /** 商品 */
goods = 'goods', goods = 'goods',
/** 浏览记录 */ /** 浏览记录 */
record = 'record', record = 'record',
/** 空格 */ /** 空格 */
blank = 'blank', blank = 'blank',
/** 多行文本输入区 */ /** 多行文本输入区 */
textarea = 'textarea', textarea = 'textarea',
/** 图片集 */ /** 图片集 */
imgWindow = 'imgWindow', imgWindow = 'imgWindow',
/** 文本内容 */ /** 文本内容 */
content = 'content', content = 'content',
/** 团购 */ /** 团购 */
groupPurchase = 'groupPurchase', groupPurchase = 'groupPurchase',
/** 秒杀 */ /** 秒杀 */
seckill = 'seckill', seckill = 'seckill',
/** 弹窗广告 */ /** 弹窗广告 */
adpop = 'adpop', adpop = 'adpop',
} }
/** nav页面导航类型 */ /** nav页面导航类型 */
export enum NavLinkEnum { export enum NavLinkEnum {
/** URL链接 */ /** URL链接 */
urlLink = 1, urlLink = 1,
/** 商品 */ /** 商品 */
shop = 2, shop = 2,
/** 文章 */ /** 文章 */
article = 3, article = 3,
/** 文章分类 */ /** 文章分类 */
articleCategory = 4, articleCategory = 4,
/** 智能表单 */ /** 智能表单 */
intelligentForms = 5, intelligentForms = 5,
/** 商品分类 */ /** 商品分类 */
shopCategory = 6, shopCategory = 6,
/** 跳转小程序 */ /** 跳转小程序 */
wxMiNiProgram = 7, wxMiNiProgram = 7,
}; };
/** 底部导航栏 */ /** 底部导航栏 */
export enum RouteSwitchTabEnum { export enum RouteSwitchTabEnum {
/** 首页 */ /** 首页 */
home = 'home', home = 'home',
/** 商品分类 */ /** 商品分类 */
classify = 'classify', classify = 'classify',
/** 购物车 */ /** 购物车 */
cart = 'cart', cart = 'cart',
/** 个人中心 */ /** 个人中心 */
member = 'member', member = 'member',
}
/** 底部导航栏页面路由 */
export enum RouteSwitchNameEnum {
/** 首页 */
home = '/pages/home/home',
/** 商品分类 */
classify = '/pages/classify/classify',
/** 购物车 */
cart = '/pages/cart/cart',
/** 个人中心 */
member = '/pages/member/member',
} }

View File

@@ -1,39 +1,55 @@
<template> <template>
<view class="adpop-box" v-if="state.show"> <view class="adpop-box" v-if="state.show">
<view class="img-box"> <view class="img-box">
<image class="img" :src="shopConfigStore.config.indexPopupWindowImageUrl" mode="widthFix"></image> <image class="img" @click="handleJumpPopupUrl" :src="shopConfigStore.config.indexPopupWindowImageUrl"
<view class="btn" @click="hanldeCloseAdpop"> mode="widthFix"></image>
<image class="icon" :src="handleStaticResources('/static/images/icon/icon-close.png')"></image> <view class="btn" @click="hanldeCloseAdpop">
</view> <image class="icon" :src="handleStaticResources('/static/images/icon/icon-close.png')"></image>
</view> </view>
</view> </view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, onMounted } from 'vue'; import { reactive, onMounted } from 'vue';
import type { ShopConfigStoreType } from '@/core/models'; import type { ShopConfigStoreType } from '@/core/models';
import { useShopConfigStore } from '@/core/store'; import { useShopConfigStore } from '@/core/store';
import { ShowPopupWindowEnum } from '@/core/enum'; import { ShowPopupWindowEnum, RouteSwitchNameEnum } from '@/core/enum';
import { handleStaticResources } from '@/core/utils'; import { handleStaticResources, handleRouteNavigateTo } from '@/core/utils';
// 获取项目配置
const shopConfigStore : ShopConfigStoreType = useShopConfigStore();
// 获取项目配置 const state = reactive<{
const shopConfigStore : ShopConfigStoreType = useShopConfigStore(); show : boolean,
}>({
show: false,
})
const state = reactive<{ const hanldeCloseAdpop = () => {
show : boolean, state.show = !state.show;
}>({ }
show: false,
})
const hanldeCloseAdpop = () => { onMounted(() => {
state.show = !state.show; if (shopConfigStore.config.showIndexPopupWindow === ShowPopupWindowEnum.yes) {
} state.show = true;
}
})
onMounted(() => { const handleJumpPopupUrl = () => {
if (shopConfigStore.config.showIndexPopupWindow === ShowPopupWindowEnum.yes) { if(!shopConfigStore.config.indexPopupWindowHrefUrl){
state.show = true; return ;
} }
})
if (shopConfigStore.config.indexPopupWindowHrefUrl === RouteSwitchNameEnum.home ||
shopConfigStore.config.indexPopupWindowHrefUrl === RouteSwitchNameEnum.classify ||
shopConfigStore.config.indexPopupWindowHrefUrl === RouteSwitchNameEnum.cart ||
shopConfigStore.config.indexPopupWindowHrefUrl === RouteSwitchNameEnum.member) {
uni.switchTab({ url: shopConfigStore.config.indexPopupWindowHrefUrl });
return;
}
handleRouteNavigateTo(shopConfigStore.config.indexPopupWindowHrefUrl)
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import './home-adpop.scss'; @import './home-adpop.scss';
</style> </style>