重构项目文件夹目录

This commit is contained in:
2026-06-15 15:53:55 +08:00
parent 8093e07190
commit 7cbe5b3de5
1098 changed files with 34 additions and 4441 deletions
@@ -0,0 +1,182 @@
/**
* Purpose: navigation supports navigation-bar.js by holding or executing the navigation page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const navigation = require('../../utils/navigation')
Component({
options: {
multipleSlots: true,
},
properties: {
extClass: {
type: String,
value: '',
},
title: {
type: String,
value: '',
},
background: {
type: String,
value: '',
},
color: {
type: String,
value: '',
},
back: {
type: Boolean,
value: true,
},
showBack: {
type: Boolean,
value: true,
},
isTabPage: {
type: Boolean,
value: false,
},
fallbackPath: {
type: String,
value: '/pages/home/index',
},
loading: {
type: Boolean,
value: false,
},
homeButton: {
type: Boolean,
value: false,
},
animated: {
type: Boolean,
value: true,
},
show: {
type: Boolean,
value: true,
observer(show) {
this._showChange(show)
},
},
delta: {
type: Number,
value: 1,
},
safeAreaMode: {
type: String,
value: 'solid',
},
},
observers: {
'back, showBack, isTabPage': function () {
this.updateResolvedBack()
},
},
/**
* Purpose: data supports navigation-bar.js by holding or executing the data page or API role.
* Usage: import, call, read, or update this page-data from the owning page/module while preserving the surrounding loading and permission flow.
*/
data: {
/**
* Purpose: displayStyle supports navigation-bar.js by holding or executing the display style page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
displayStyle: '',
/**
* Purpose: resolvedShowBack supports navigation-bar.js by holding or executing the resolved show back page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
resolvedShowBack: false,
},
/**
* Purpose: lifetimes supports navigation-bar.js by holding or executing the lifetimes page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
lifetimes: {
attached() {
const rect = wx.getMenuButtonBoundingClientRect()
const deviceInfo = (typeof wx.getDeviceInfo === 'function' ? wx.getDeviceInfo() : wx.getSystemInfoSync()) || {}
const windowInfo = (typeof wx.getWindowInfo === 'function' ? wx.getWindowInfo() : wx.getSystemInfoSync()) || {}
const platform = deviceInfo.platform
const isAndroid = platform === 'android'
const isDevtools = platform === 'devtools'
const safeArea = windowInfo.safeArea || {}
const top = safeArea.top || 0
const windowWidth = windowInfo.windowWidth || deviceInfo.windowWidth || 375
this.setData({
/**
* Purpose: ios supports navigation-bar.js by holding or executing the ios page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
ios: !isAndroid,
/**
* Purpose: innerPaddingRight supports navigation-bar.js by holding or executing the inner padding right page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
innerPaddingRight: `padding-right: ${windowWidth - rect.left}px`,
/**
* Purpose: leftWidth supports navigation-bar.js by holding or executing the left width page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
leftWidth: `width: ${windowWidth - rect.left}px`,
/**
* Purpose: safeAreaTop supports navigation-bar.js by holding or executing the safe area top page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${top}px); padding-top: ${top}px` : '',
})
this.updateResolvedBack()
},
},
/**
* Purpose: methods supports navigation-bar.js by holding or executing the methods page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
methods: {
updateResolvedBack() {
const resolvedShowBack = !this.data.isTabPage && Boolean(this.data.showBack && this.data.back)
this.setData({
resolvedShowBack,
})
},
_showChange(show) {
const animated = this.data.animated
let displayStyle = ''
if (animated) {
displayStyle = `opacity: ${show ? '1' : '0'};transition:opacity 0.3s;`
} else {
displayStyle = `display: ${show ? '' : 'none'}`
}
this.setData({
displayStyle,
})
},
back() {
const pages = getCurrentPages()
if (this.data.delta && pages.length > this.data.delta) {
wx.navigateBack({
/**
* Purpose: delta supports navigation-bar.js by holding or executing the delta page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
delta: this.data.delta,
})
return
}
navigation.goBack(this.data.fallbackPath || '/pages/home/index')
},
home() {
wx.switchTab({
/**
* Purpose: url supports navigation-bar.js by holding or executing the url page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
url: '/pages/home/index',
})
},
},
})
@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}
@@ -0,0 +1,56 @@
<view class="weui-navigation-bar {{extClass}} {{safeAreaMode === 'overlay' ? 'weui-navigation-bar--overlay' : ''}}">
<view
class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}"
style="color: {{color}}; background: {{background}}; {{displayStyle}}; {{innerPaddingRight}}; {{safeAreaTop}};"
>
<view class="weui-navigation-bar__left" style="{{leftWidth}};">
<block wx:if="{{resolvedShowBack || homeButton}}">
<view wx:if="{{resolvedShowBack}}" class="weui-navigation-bar__buttons">
<view
bindtap="back"
class="weui-navigation-bar__action"
hover-class="weui-navigation-bar__action--active"
hover-stay-time="80"
aria-role="button"
aria-label="返回"
>
<text class="weui-navigation-bar__arrow">‹</text>
<text class="weui-navigation-bar__label">返回</text>
</view>
</view>
<view wx:if="{{homeButton}}" class="weui-navigation-bar__buttons">
<view
bindtap="home"
class="weui-navigation-bar__action"
hover-class="weui-navigation-bar__action--active"
hover-stay-time="80"
aria-role="button"
aria-label="首页"
>
<text class="weui-navigation-bar__home-dot"></text>
<text class="weui-navigation-bar__label">首页</text>
</view>
</view>
</block>
<block wx:else>
<slot name="left"></slot>
</block>
</view>
<view class="weui-navigation-bar__center">
<view wx:if="{{loading}}" class="weui-navigation-bar__loading" aria-role="alert">
<view class="weui-loading" aria-role="img" aria-label="加载中"></view>
</view>
<block wx:if="{{title}}">
<text>{{title}}</text>
</block>
<block wx:else>
<slot name="center"></slot>
</block>
</view>
<view class="weui-navigation-bar__right">
<slot name="right"></slot>
</view>
</view>
</view>
@@ -0,0 +1,141 @@
.weui-navigation-bar {
--weui-FG-0: var(--theme-neutral);
--height: 44px;
--left: 20rpx;
color: var(--weui-FG-0);
position: relative;
z-index: 30;
}
.weui-navigation-bar .android {
--height: 48px;
}
.weui-navigation-bar--overlay {
position: sticky;
top: 0;
}
.weui-navigation-bar__inner {
position: relative;
z-index: 1;
height: calc(var(--height) + env(safe-area-inset-top));
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding-top: env(safe-area-inset-top);
width: 100%;
box-sizing: border-box;
color: var(--theme-neutral);
border-bottom: 1rpx solid var(--theme-border);
backdrop-filter: blur(20rpx);
}
.weui-navigation-bar__left,
.weui-navigation-bar__right {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
height: 100%;
box-sizing: border-box;
}
.weui-navigation-bar__left {
padding-left: var(--left);
}
.weui-navigation-bar__right {
justify-content: flex-end;
min-width: 120rpx;
padding-right: 24rpx;
}
.weui-navigation-bar__buttons {
display: flex;
align-items: center;
height: 100%;
}
.weui-navigation-bar__action {
display: inline-flex;
align-items: center;
gap: 10rpx;
min-height: 64rpx;
padding: 0 18rpx 0 8rpx;
border-radius: 999rpx;
background: rgba(255, 255, 255, 0.86);
border: 1rpx solid rgba(255, 255, 255, 0.94);
color: var(--theme-neutral);
box-shadow: 0 10rpx 28rpx rgba(74, 68, 63, 0.08);
}
.weui-navigation-bar__action--active {
opacity: 0.7;
}
.weui-navigation-bar__arrow {
font-size: 40rpx;
font-weight: 700;
line-height: 1;
}
.weui-navigation-bar__home-dot {
width: 20rpx;
height: 20rpx;
border-radius: 999rpx;
background: currentColor;
}
.weui-navigation-bar__label {
font-size: 24rpx;
font-weight: 700;
line-height: 1;
}
.weui-navigation-bar__center {
font-size: 17px;
text-align: center;
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
font-weight: 700;
flex: 1;
height: 100%;
min-width: 0;
}
.weui-navigation-bar__center text {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.weui-navigation-bar__loading {
margin-right: 8rpx;
display: flex;
align-items: center;
}
.weui-loading {
font-size: 16px;
width: 16px;
height: 16px;
display: block;
background: transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg'%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='rgba(96,96,96,0.3)'/%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='%23606060'/%3E%3Ccircle fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3C/g%3E%3C/svg%3E") no-repeat;
background-size: 100%;
animation: loading 1s linear infinite;
}
@keyframes loading {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}