mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:13:26 +08:00
uniapp【优化】: 优化自定义页面
This commit is contained in:
@@ -31,7 +31,8 @@
|
||||
"pages-config/subpackage-storeMap.json",
|
||||
"pages-config/subpackage-distribution.json",
|
||||
"pages-config/subpackage-agency.json",
|
||||
"pages-config/subpackage-merchant.json"
|
||||
"pages-config/subpackage-merchant.json",
|
||||
"pages-config/subpackage-custom.json"
|
||||
],
|
||||
|
||||
"preloadRule": "pages-config/preloadRule.json",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"subPackages": [{
|
||||
"root": "pages/subpackage/custom",
|
||||
"pages": [{
|
||||
"path": "custom",
|
||||
"style": {
|
||||
"navigationBarTitleText": "自定义首页",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}]
|
||||
}]
|
||||
}
|
||||
@@ -785,10 +785,30 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}]
|
||||
},{
|
||||
"root": "pages/subpackage/custom",
|
||||
"pages": [{
|
||||
"path": "custom",
|
||||
"style": {
|
||||
"navigationBarTitleText": "自定义首页",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}]
|
||||
}],
|
||||
"preloadRule": {
|
||||
"pages/member/member": {
|
||||
"network": "all",
|
||||
"packages": ["pages/subpackage/member"]
|
||||
}
|
||||
},
|
||||
"condition" : { //模式配置,仅开发期间生效
|
||||
"current": 0, //当前激活的模式(list 的索引项)
|
||||
"list": [
|
||||
{
|
||||
"name": "", //模式名称
|
||||
"path": "", //启动页面,必选
|
||||
"query": "" //启动参数,在页面的onLoad函数里面得到
|
||||
}
|
||||
]
|
||||
}}
|
||||
@@ -1,13 +1,16 @@
|
||||
<template>
|
||||
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="layout-home-page page-bg">
|
||||
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
|
||||
<uv-navbar :bg-color="state.isScrollTop ? handleStaticResources('/static/images/home-bg.jpg') : 'rgba(0,0,0,0)'"
|
||||
<uv-navbar
|
||||
:bg-color="state.isScrollTop ? handleStaticResources('/static/images/home-bg.jpg') : 'rgba(0,0,0,0)'"
|
||||
imgMode="aspectFill">
|
||||
<template #left>
|
||||
<view class="search-box">
|
||||
<image class="logo" :src="handleStaticResources('/static/images/home-logo.png')"></image>
|
||||
<uv-input shape="circle" placeholder="请输入关键词" prefixIcon="search"
|
||||
:customStyle="{ 'background-color': '#fff' }" prefixIconStyle="font-size: 22px;color: #909399">
|
||||
:customStyle="{ 'background-color': '#fff' }"
|
||||
prefixIconStyle="font-size: 22px;color: #909399">
|
||||
<template #suffix>
|
||||
<view class="search-tit">搜索</view>
|
||||
</template>
|
||||
@@ -16,7 +19,7 @@
|
||||
</template>
|
||||
</uv-navbar>
|
||||
|
||||
<view class="content-box p-25" :style="{ 'padding-top': `${statusBarHeight + 10}px` }">
|
||||
<view class="content-box p-25">
|
||||
<CustomPage :coreshopData="state.coreshopData"></CustomPage>
|
||||
</view>
|
||||
|
||||
@@ -25,22 +28,19 @@
|
||||
|
||||
<!-- 弹框广告 -->
|
||||
<HomeAdpop></HomeAdpop>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onPageScroll, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { onShow,onPageScroll, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import { queryPageConfig, queryUserInfo } from '@/core/api';
|
||||
import type { Response, PageConfigType, PageConfigItemsType, UserInfoType } from '@/core/models';
|
||||
import CustomPage from '@/pages/components/custom-page/index.vue';
|
||||
import HomeAdpop from '@/pages/components/custom-page/components/home-adpop/home-adpop.vue';
|
||||
import { handleStaticResources, getDefaultShareData, getShareUrl } from '@/core/utils';
|
||||
import { useSystemInfo } from '@/core/hooks';
|
||||
import { UserToken, shareUrl } from '@/core/consts';
|
||||
import { UserToken, shareUrl,onHomePageShow } from '@/core/consts';
|
||||
import { useUserInfoStore } from '@/core/store';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
code : string;
|
||||
}
|
||||
|
||||
/** 获取自定义导航栏高度 */
|
||||
const { statusBarHeight } = useSystemInfo();
|
||||
/** 获取 用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
@@ -63,12 +61,13 @@
|
||||
shareUrl: "",
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
/** 触发自定义onshow事件,让后代组件监听页面是都进入 */
|
||||
uni.$emit(onHomePageShow);
|
||||
})
|
||||
|
||||
onPageScroll((e : any) => {
|
||||
if (e.scrollTop > 10) {
|
||||
state.isScrollTop = true;
|
||||
} else {
|
||||
state.isScrollTop = false;
|
||||
}
|
||||
state.isScrollTop = e.scrollTop > 10;
|
||||
})
|
||||
|
||||
onLoad(async (query : QueryParams) => {
|
||||
|
||||
Reference in New Issue
Block a user