框架更新

This commit is contained in:
2024-08-02 23:22:38 +08:00
parent 0cda1968e8
commit ff46808425
214 changed files with 6171 additions and 15881 deletions
+41
View File
@@ -0,0 +1,41 @@
<template>
<u-sticky zIndex="99999">
<u-navbar fixed :auto-back="false" :bgColor="bgColor" :status-bar-bg-color="bgColor" placeholder :title="title"
:title-style="{color: 'white'}" auto-back left-icon-color="white" @leftClick="leftClick">
<template slot="left">
<u-icon :name="currentPages.length > 1 ? 'arrow-left' : 'home'" size="20" color="white" v-if="showBack"/>
</template>
</u-navbar>
</u-sticky>
</template>
<script>
import {LINEAR} from "@/config/color";
export default {
name: "HeaderItem",
props: {
title: String,
showBack: {
type: Boolean,
default: true
}
},
data() {
return {
bgColor: LINEAR,
currentPages: []
}
},
methods: {
leftClick() {
console.log(this.currentPages)
if (this.currentPages.length === 1) uni.switchTab({url: '/pages/index/index'})
// else uni.navigateBack()
}
},
mounted() {
this.currentPages = getCurrentPages()
}
}
</script>
+59
View File
@@ -0,0 +1,59 @@
<template>
<view class="layout">
<slot />
</view>
</template>
<script>
import * as MpApi from "@/api/cms/mpPages";
import * as MenuIcons from '@/api/menu-icons';
import {useMpStore} from "@/store/modules/mp";
const mpStore = useMpStore();
export default {
name: 'Layout',
components: {MenuIcons},
emits: ['done'],
data() {
return {
index: 0,
// 配置信息
config: {},
tabBar: null,
ads: [],
};
},
created() {
this.reload()
},
methods: {
async reload(){
console.log('reloeddd')
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
this.config = info.config
// 底部导航栏
this.tabBar = info.tabBar
// 加载当前页面
this.getPageByPath()
},
getPageByPath(){
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const { route } = currentPage;
console.log(route)
this.index = this.tabBar.findIndex(d => d.path === `/${route}`)
MpApi.pageMpPages({
path: `/${route}`,
SceneType: 'showMpMenus'
}).then(res => {
this.$emit('done',res.list[0])
})
},
openUrl(url){
uni.switchTab({url})
}
},
}
</script>