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