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"; ...@@ -8,10 +8,10 @@ import {InvitationInfo, CodeResponse} from "@/activities/1015/types";
* @returns * @returns
*/ */
export function fetchPageConfig() { export function fetchPageConfig() {
//return api.get('/c/front/content', {type: 'act915',version: '1'}) /*return Promise.resolve({
return Promise.resolve({
data: homeConfig(), data: homeConfig(),
}) })*/
return api.get('/c/front/content', {type: 'act1015',version: '1'})
} }
/** /**
......
...@@ -132,6 +132,7 @@ const updatePageConfig = async () => { ...@@ -132,6 +132,7 @@ const updatePageConfig = async () => {
try { try {
loading.value = true loading.value = true
const response = await fetchPageConfig() const response = await fetchPageConfig()
//console.log('获取到的配置数据:', JSON.stringify(response.data, null, 2))
if (response && response.data) { if (response && response.data) {
pageConfig.value = response.data pageConfig.value = response.data
...@@ -204,7 +205,7 @@ const onGetPhoneNumber = async (e) => { ...@@ -204,7 +205,7 @@ const onGetPhoneNumber = async (e) => {
console.warn('授权后重新获取用户信息') console.warn('授权后重新获取用户信息')
}, { }, {
wxLoginBusinessDTO: { wxLoginBusinessDTO: {
activityUserInvite1015Code: incomingCode activityUserInvite915Code: incomingCode
} }
}) })
} catch (error) { } catch (error) {
......
...@@ -6,7 +6,7 @@ const pageName = '1015专题活动页面' ...@@ -6,7 +6,7 @@ const pageName = '1015专题活动页面'
export function homeConfig(){ export function homeConfig(){
return { return {
"background": { "background": {
image: getCdnUrl('home/bg.png'), image: getCdnUrl('home/bg.jpg'),
style: { style: {
backgroundPosition: {y: "calc(4937rpx + 845rpx)"} backgroundPosition: {y: "calc(4937rpx + 845rpx)"}
} }
...@@ -390,23 +390,9 @@ export function homeConfig(){ ...@@ -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的工具函数 // 获取图片URL的工具函数
export const getImageUrl = (imagePath) => { export const getImageUrl = (imagePath) => {
return imagePath return imagePath
......
This diff is collapsed.
...@@ -17,6 +17,7 @@ const { ...@@ -17,6 +17,7 @@ const {
// 通常可以吧 baseUrl 单独放在一个 js 文件了 // 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.230.108:7777/pmall"; // const baseUrl = "http://172.16.230.108:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/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";//生产环境 let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock // const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
// const baseUrl = "https://feihe.m.duibatest.com.cn/pmall" // const baseUrl = "https://feihe.m.duibatest.com.cn/pmall"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<web-view :src="src" @message="onMessage"/> <web-view :src="src" @message="onMessage"/>
</template> </template>
<script setup> <script setup lang="ts">
import {ref, watch, nextTick} from "vue"; import {ref, watch, nextTick} from "vue";
import {onLoad, onShow, onShareAppMessage, onShareTimeline} from "@dcloudio/uni-app"; import {onLoad, onShow, onShareAppMessage, onShareTimeline} from "@dcloudio/uni-app";
import {useGlobalStore} from "../../stores/global"; import {useGlobalStore} from "../../stores/global";
...@@ -13,12 +13,12 @@ const userStore = useUserStore(); ...@@ -13,12 +13,12 @@ const userStore = useUserStore();
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
function getRegistered() { function getRegistered() {
return userStore.userInfo?.memberId !== "not_login" return !!(userStore.userInfo && userStore.userInfo?.memberId !== "not_login")
} }
const pageOptions = ref({}) const pageOptions = ref({})
const src = ref(""); const src = ref("")
const registered = ref(false) const registered = ref(undefined)
const urlMap = { const urlMap = {
//'main': 'http://192.168.0.5:8001/#/page', //'main': 'http://192.168.0.5:8001/#/page',
...@@ -27,8 +27,57 @@ const urlMap = { ...@@ -27,8 +27,57 @@ const urlMap = {
const shareData = ref(null) 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() 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) { function joinUrlAndQs(url, qs) {
...@@ -38,12 +87,11 @@ function joinUrlAndQs(url, qs) { ...@@ -38,12 +87,11 @@ function joinUrlAndQs(url, qs) {
} }
watch(() => registered.value, (newVal, oldVal) => { watch(() => registered.value, (newVal, oldVal) => {
if (newVal !== oldVal) { if (!pageOptions.value.needLogin || newVal) {
const oldSrc = src.value
src.value = '' src.value = ''
nextTick(() => { nextTick(() => {
src.value = joinUrlAndQs(oldSrc, 'registered=' + newVal) initOk(newVal)
}) })
} }
}) })
...@@ -76,7 +124,7 @@ function initOk() { ...@@ -76,7 +124,7 @@ function initOk() {
.join('&') .join('&')
url = joinUrlAndQs(url, paramStr) url = joinUrlAndQs(url, paramStr)
if(options.params){ if (options.params) {
url = joinUrlAndQs(url, decodeURIComponent(options.params)) url = joinUrlAndQs(url, decodeURIComponent(options.params))
} }
...@@ -92,20 +140,6 @@ onLoad(async (options) => { ...@@ -92,20 +140,6 @@ onLoad(async (options) => {
withShareTicket: true, withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'] 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) { function onMessage(e) {
...@@ -153,15 +187,9 @@ onShareAppMessage((options) => { ...@@ -153,15 +187,9 @@ onShareAppMessage((options) => {
return shareHook() return shareHook()
}) })
onShareTimeline((options) => {
console.log('分享到朋友圈数据:', shareData.value)
return shareHook()
})
</script> </script>
<script> <script lang="ts">
/*export default { /*export default {
onShareAppMessage() { onShareAppMessage() {
return this.shareHook() return this.shareHook()
......
...@@ -9,7 +9,7 @@ const pages = [ ...@@ -9,7 +9,7 @@ const pages = [
{value: '/mini/#/page/home/index?page_source=3', alias: '路演活动'}, {value: '/mini/#/page/home/index?page_source=3', alias: '路演活动'},
] ]
const mpPage = 'pages/activity/index' const mpPage = '/pages/activity/index'
function joinUrlAndQs(url, qs) { function joinUrlAndQs(url, qs) {
return qs return qs
...@@ -19,7 +19,7 @@ function joinUrlAndQs(url, qs) { ...@@ -19,7 +19,7 @@ function joinUrlAndQs(url, qs) {
for (const page of pages) { for (const page of pages) {
for (const host of hosts) { 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}`) console.log(`${page.alias}-${host.alias}: ${url}`)
} }
} }
// 导入全局store
import { useGlobalStore } from "../stores/global";
// 跳转类型枚举 // 跳转类型枚举
export const JumpType = { export const JumpType = {
INNER: 1, // 内部小程序页面跳转 INNER: 1, // 内部小程序页面跳转
...@@ -15,11 +18,40 @@ export const JumpType = { ...@@ -15,11 +18,40 @@ export const JumpType = {
export function jump({ type, url, extra = {} }) { export function jump({ type, url, extra = {} }) {
switch (type) { switch (type) {
case JumpType.INNER: case JumpType.INNER:
// 内部小程序页面跳转 try {
uni.navigateTo({
url, const pages = getCurrentPages();
...extra, 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; break;
case JumpType.MINI: case JumpType.MINI:
// 跳转到其他小程序页面 // 跳转到其他小程序页面
...@@ -36,11 +68,11 @@ export function jump({ type, url, extra = {} }) { ...@@ -36,11 +68,11 @@ export function jump({ type, url, extra = {} }) {
console.log("jumpParams:", jumpParams); console.log("jumpParams:", jumpParams);
if(extra.embedded || jumpParams.appId === 'wx4205ec55b793245e'){ // 星妈优选的小程序都为半屏拉起 if (extra.embedded || jumpParams.appId === 'wx4205ec55b793245e') { // 星妈优选的小程序都为半屏拉起
console.log('半屏拉起', jumpParams) console.log('半屏拉起', jumpParams)
uni.openEmbeddedMiniProgram(jumpParams); uni.openEmbeddedMiniProgram(jumpParams);
}else{ } else {
console.log('直接跳转', jumpParams) console.log('直接跳转', jumpParams)
uni.navigateToMiniProgram(jumpParams); uni.navigateToMiniProgram(jumpParams);
} }
break; break;
...@@ -60,11 +92,11 @@ export function jump({ type, url, extra = {} }) { ...@@ -60,11 +92,11 @@ export function jump({ type, url, extra = {} }) {
} }
} }
export function formatDate(timestamp){ export function formatDate(timestamp) {
const date = new Date(timestamp); const date = new Date(timestamp);
if (isNaN(date.getTime())) { if (isNaN(date.getTime())) {
console.error('无效的时间戳:', timestamp); console.error('无效的时间戳:', timestamp);
return ''; return '';
} }
const year = date.getFullYear() const year = date.getFullYear()
...@@ -136,7 +168,7 @@ export function hideLoading() { ...@@ -136,7 +168,7 @@ export function hideLoading() {
* @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss' * @param format 字符串,需要的格式例如:'yyyy/MM/dd hh:mm:ss'
* @returns {String} * @returns {String}
*/ */
const dateFormatter = (date, format = "yyyy/MM/dd") => { const dateFormatter = (date, format = "yyyy/MM/dd") => {
if (!date) return "-"; if (!date) return "-";
date = new Date( date = new Date(
typeof date === "string" && isNaN(date) typeof date === "string" && isNaN(date)
...@@ -169,5 +201,5 @@ export function hideLoading() { ...@@ -169,5 +201,5 @@ export function hideLoading() {
return format; return format;
}; };
export { 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