Commit 51ef1251 authored by 王炽's avatar 王炽

Merge branch 'dev' of http://gitlab2.dui88.com/fh/20250528_FHQ1 into dev

parents 5fe80fcc c85fa219
......@@ -8,10 +8,10 @@ import {InvitationInfo, CodeResponse} from "@/activities/1015/types";
* @returns
*/
export function fetchPageConfig() {
//return api.get('/c/front/content', {type: 'act915',version: '1'})
return Promise.resolve({
/*return Promise.resolve({
data: homeConfig(),
})
})*/
return api.get('/c/front/content', {type: 'act1015',version: '1'})
}
/**
......
......@@ -132,6 +132,7 @@ const updatePageConfig = async () => {
try {
loading.value = true
const response = await fetchPageConfig()
//console.log('获取到的配置数据:', JSON.stringify(response.data, null, 2))
if (response && response.data) {
pageConfig.value = response.data
......@@ -204,7 +205,7 @@ const onGetPhoneNumber = async (e) => {
console.warn('授权后重新获取用户信息')
}, {
wxLoginBusinessDTO: {
activityUserInvite1015Code: incomingCode
activityUserInvite915Code: incomingCode
}
})
} catch (error) {
......
......@@ -6,7 +6,7 @@ const pageName = '1015专题活动页面'
export function homeConfig(){
return {
"background": {
image: getCdnUrl('home/bg.png'),
image: getCdnUrl('home/bg.jpg'),
style: {
backgroundPosition: {y: "calc(4937rpx + 845rpx)"}
}
......@@ -390,23 +390,9 @@ export function homeConfig(){
}
},
],
"lottery": {
"image": "act1015Page/v3/act1015PageLotteryBanner.png",
"link": {"type": 1, "url": "/activity0915/lottery/lottery"}
},
"invite": {
"image": "act1015Page/v3/act1015PageInviteConBg.png",
"link": {"type": 1, "url": "/pages/invite/invite"},
"inviteConStatusNo1Img": "act1015Page/v3/act1015PageInviteConStatusNo.png",
"inviteConStatusYes2Img": "act1015Page/v3/act1015PageInviteConStatusYes.png",
"inviteConStatusYes1Img": "act1015Page/v3/act1015PageInviteConStatusYes.png",
"inviteConStatusNo2Img": "act1015Page/v3/act1015PageInviteConStatusNo.png"
}
}
}
//console.log('page-config:', JSON.stringify(act1015Config, null, 2))
// 获取图片URL的工具函数
export const getImageUrl = (imagePath) => {
return imagePath
......
{
"background": {
"image": "https://course.feihe.com/momclub-picture/activity/1015/v1/home/bg.jpg",
"style": {
"backgroundPosition": {
"y": "calc(4937rpx + 845rpx)"
}
}
},
"shareConfig": {
"title": "星妈会超级品牌周来啦!北纬47°六水香大米上新!",
"path": "/activities/1015/home",
"imageUrl": "https://course.feihe.com/momclub-picture/activity/1015/v1/share-image.png"
},
"components": [
{
"type": "image-swiper",
"properties": {
"autoplay": true,
"interval": 3000,
"duration": 500,
"circular": true,
"indicatorDots": true,
"items": [
{
"image": "https://course.feihe.com/momclub-picture/activity/1015/v1/home/banner-0.png",
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "banner头图",
"componentContent": "北纬47 °",
"logExposure": true
}
},
{
"image": "https://course.feihe.com/momclub-picture/activity/1015/v1/home/banner-1.png",
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "banner头图",
"componentContent": "国际大米节金奖",
"logExposure": true
},
"link": {
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=643246351932056828&skuId=643246351932056829&entrySource=xmh_wechatmp_activity_1015ppz",
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
}
}
}
]
},
"style": {
"height": "845rpx"
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 35,
"y": 915,
"width": 685,
"height": 245
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "商品banner",
"componentContent": "商品banner",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=720448018529899563&skuId=720448018529899564&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 50,
"y": 2095,
"width": 320,
"height": 390
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "品牌宣传1",
"componentContent": "商品名称1",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=643246351932056828&skuId=643246351932056829&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 380,
"y": 2095,
"width": 320,
"height": 390
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "品牌宣传1",
"componentContent": "商品名称2",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=643245114369684591&skuId=643245114369684592&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 50,
"y": 3405,
"width": 320,
"height": 390
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "品牌宣传2",
"componentContent": "商品名称1",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=368848644886521333&skuId=368848644886521334&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 380,
"y": 3405,
"width": 320,
"height": 390
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "品牌宣传2",
"componentContent": "商品名称2",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=367056951412568222&skuId=367056951412568223&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "invite-task",
"properties": {
"area": {
"x": 35,
"y": 3865,
"width": 685,
"height": 195
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "邀请得好礼",
"componentContent": "立即邀请",
"logExposure": true,
"logClick": true
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 35,
"y": 4080,
"width": 685,
"height": 245
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "中部抽奖banner",
"componentContent": "中部抽奖banner",
"logExposure": true,
"logClick": true
},
"link": {
"type": 1,
"url": "/activities/1015/lottery/index"
},
"needLogin": true
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 50,
"y": 4405,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品1",
"componentContent": "商品1",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=643243579803297229&skuId=643243579803297230&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 270,
"y": 4405,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品1",
"componentContent": "商品2",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=367070126091559975&skuId=367070126091559976&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 490,
"y": 4405,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品1",
"componentContent": "商品3",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=367072891644670759&skuId=367072891644670760&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 50,
"y": 4705,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品1",
"componentContent": "商品4",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=649435440113431085&skuId=649435440113431086&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 270,
"y": 4705,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品1",
"componentContent": "商品5",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=662389781175669644&skuId=662389781175669645&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 490,
"y": 4705,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品1",
"componentContent": "商品6",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=759248536249386165&skuId=759248536249386166&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 50,
"y": 5110,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品2",
"componentContent": "商品1",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=399302177175705120&skuId=399302177175705121&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 270,
"y": 5110,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品2",
"componentContent": "商品2",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=650599779914081413&skuId=650599779914081414&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 490,
"y": 5110,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品2",
"componentContent": "商品3",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=667527760599458548&skuId=667527760599458549&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 50,
"y": 5410,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品2",
"componentContent": "商品4",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=548984197069284758&skuId=548984197069284759&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 270,
"y": 5410,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品2",
"componentContent": "商品5",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=792232869316748776&skuId=792232869316748777&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
},
{
"type": "click-area",
"properties": {
"area": {
"x": 490,
"y": 5410,
"width": 200,
"height": 285
},
"mdConfig": {
"pageName": "1015专题活动页面",
"componentName": "6组商品2",
"componentContent": "商品6",
"logExposure": true,
"logClick": true
},
"link": {
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"type": 2,
"url": "subPackages/shopMainProcess/product/index?productId=704050114989893289&skuId=704050114989893290&entrySource=xmh_wechatmp_activity_1015ppz"
}
}
}
]
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ const {
// 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.230.108:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
// const baseUrl = "https://momclub-test.feihe.com/pmall";//测试环境2
let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
// const baseUrl = "https://feihe.m.duibatest.com.cn/pmall"
......
......@@ -2,7 +2,7 @@
<web-view :src="src" @message="onMessage"/>
</template>
<script setup>
<script setup lang="ts">
import {ref, watch, nextTick} from "vue";
import {onLoad, onShow, onShareAppMessage, onShareTimeline} from "@dcloudio/uni-app";
import {useGlobalStore} from "../../stores/global";
......@@ -13,12 +13,12 @@ const userStore = useUserStore();
const globalStore = useGlobalStore()
function getRegistered() {
return userStore.userInfo?.memberId !== "not_login"
return !!(userStore.userInfo && userStore.userInfo?.memberId !== "not_login")
}
const pageOptions = ref({})
const src = ref("");
const registered = ref(false)
const src = ref("")
const registered = ref(undefined)
const urlMap = {
//'main': 'http://192.168.0.5:8001/#/page',
......@@ -27,8 +27,57 @@ const urlMap = {
const shareData = ref(null)
onShow(() => {
const handleBack = () => {
try {
uni.navigateBack({
delta: 1,
fail: () => {
// 如果返回失败,跳转到首页
uni.redirectTo({
url: '/pages/index/index'
})
}
})
} catch (error) {
console.log('返回失败:', error)
uni.redirectTo({
url: '/pages/index/index'
})
}
}
async function ensureAutoLogin() {
if (!globalStore.cuk) {
await userStore.normalAutoLogin()
}
}
onShow(async () => {
const oldVal = registered.value
await ensureAutoLogin()
await userStore.loadUserInfo()
registered.value = getRegistered()
if (oldVal === undefined) {
if (pageOptions.value.needLogin && !registered.value) {
jump({
type: JumpType.INNER,
url: '/pages/activity/register',
})
}
} else {
if (registered.value === false) {
uni.showToast({
title: "授权失败,即将返回",
icon: "none",
});
setTimeout(() => {
handleBack()
}, 1000)
}
}
})
function joinUrlAndQs(url, qs) {
......@@ -38,12 +87,11 @@ function joinUrlAndQs(url, qs) {
}
watch(() => registered.value, (newVal, oldVal) => {
if (newVal !== oldVal) {
const oldSrc = src.value
if (!pageOptions.value.needLogin || newVal) {
src.value = ''
nextTick(() => {
src.value = joinUrlAndQs(oldSrc, 'registered=' + newVal)
initOk(newVal)
})
}
})
......@@ -76,7 +124,7 @@ function initOk() {
.join('&')
url = joinUrlAndQs(url, paramStr)
if(options.params){
if (options.params) {
url = joinUrlAndQs(url, decodeURIComponent(options.params))
}
......@@ -92,20 +140,6 @@ onLoad(async (options) => {
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
await userStore.normalAutoLogin()
await userStore.loadUserInfo()
registered.value = getRegistered()
if(options.needLogin && !registered.value) {
jump({
type: JumpType.INNER,
url: '/pages/activity/register',
})
}else{
initOk()
}
});
function onMessage(e) {
......@@ -153,15 +187,9 @@ onShareAppMessage((options) => {
return shareHook()
})
onShareTimeline((options) => {
console.log('分享到朋友圈数据:', shareData.value)
return shareHook()
})
</script>
<script>
<script lang="ts">
/*export default {
onShareAppMessage() {
return this.shareHook()
......
......@@ -9,7 +9,7 @@ const pages = [
{value: '/mini/#/page/home/index?page_source=3', alias: '路演活动'},
]
const mpPage = 'pages/activity/index'
const mpPage = '/pages/activity/index'
function joinUrlAndQs(url, qs) {
return qs
......@@ -19,7 +19,7 @@ function joinUrlAndQs(url, qs) {
for (const page of pages) {
for (const host of hosts) {
const url = joinUrlAndQs(mpPage, `url=${encodeURIComponent(host.value + page.value)}`)
const url = joinUrlAndQs(mpPage, `needLogin=1&url=${encodeURIComponent(host.value + page.value)}`)
console.log(`${page.alias}-${host.alias}: ${url}`)
}
}
// 导入全局store
import { useGlobalStore } from "../stores/global";
// 跳转类型枚举
export const JumpType = {
INNER: 1, // 内部小程序页面跳转
......@@ -15,11 +18,40 @@ export const JumpType = {
export function jump({ type, url, extra = {} }) {
switch (type) {
case JumpType.INNER:
// 内部小程序页面跳转
uni.navigateTo({
url,
...extra,
});
try {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route;
if (url.indexOf('pages/index/index') >= 0 && currentPath.indexOf('pages/index/index') >= 0) {
// 获取全局store
const globalStore = useGlobalStore();
if (url.indexOf('home') >= 0) {
globalStore.setCurTabIndex(0);
} else if (url.indexOf('brand') >= 0) {
globalStore.setCurTabIndex(1);
} else if (url.indexOf('integral') >= 0) {
globalStore.setCurTabIndex(2);
} else if (url.indexOf('my') >= 0) {
globalStore.setCurTabIndex(3);
}
} else {
// 内部小程序页面跳转
uni.navigateTo({
url,
...extra,
});
}
} catch (error) {
console.error('跳转处理错误:', error);
// 出错时默认执行内部跳转
uni.navigateTo({
url,
...extra,
});
}
break;
case JumpType.MINI:
// 跳转到其他小程序页面
......@@ -36,11 +68,11 @@ export function jump({ type, url, extra = {} }) {
console.log("jumpParams:", jumpParams);
if(extra.embedded || jumpParams.appId === 'wx4205ec55b793245e'){ // 星妈优选的小程序都为半屏拉起
console.log('半屏拉起', jumpParams)
if (extra.embedded || jumpParams.appId === 'wx4205ec55b793245e') { // 星妈优选的小程序都为半屏拉起
console.log('半屏拉起', jumpParams)
uni.openEmbeddedMiniProgram(jumpParams);
}else{
console.log('直接跳转', jumpParams)
} else {
console.log('直接跳转', jumpParams)
uni.navigateToMiniProgram(jumpParams);
}
break;
......@@ -60,11 +92,11 @@ export function jump({ type, url, extra = {} }) {
}
}
export function formatDate(timestamp){
export function formatDate(timestamp) {
const date = new Date(timestamp);
if (isNaN(date.getTime())) {
console.error('无效的时间戳:', timestamp);
return '';
console.error('无效的时间戳:', timestamp);
return '';
}
const year = date.getFullYear()
......@@ -136,7 +168,7 @@ export function hideLoading() {
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String}
*/
const dateFormatter = (date, format = "yyyy/MM/dd") => {
const dateFormatter = (date, format = "yyyy/MM/dd") => {
if (!date) return "-";
date = new Date(
typeof date === "string" && isNaN(date)
......@@ -169,5 +201,5 @@ export function hideLoading() {
return format;
};
export {
dateFormatter
dateFormatter
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment