提交新的移动端框架

This commit is contained in:
zlwu committed 2025-08-07 13:19:12 +08:00
1 parent 134f711349
commit 9bda3717fe
75 files changed
+5283 -9011

No files matched your search

+16 -16
View File
@@ -45,36 +45,36 @@ export default {
<style lang="scss" scoped>
.card {
background: $uni-bg-color;
border-radius: $uni-border-radius-lg;
box-shadow: $uni-shadow;
transition: $uni-transition;
background: #ffffff;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
overflow: hidden;
margin: $uni-spacing-col-lg;
margin: 16px 0;
&:hover {
box-shadow: $uni-shadow-hover;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
}
}
.card-header {
padding: $uni-spacing-col-lg $uni-spacing-row-xl;
border-bottom: 1px solid $uni-border-color;
padding: 16px 20px;
border-bottom: 1px solid #f0f0f0;
display: flex;
align-items: center;
justify-content: space-between;
}
.card-title {
font-size: $uni-font-size-lg;
font-size: 16px;
font-weight: 600;
color: $uni-text-color;
color: #333333;
margin: 0;
}
.card-content {
padding: $uni-spacing-col-xl;
padding: 20px;
&.no-padding {
padding: 0;
@@ -82,22 +82,22 @@ export default {
}
.card-footer {
padding: $uni-spacing-col-lg $uni-spacing-row-xl;
border-top: 1px solid $uni-border-color;
padding: 12px 20px;
border-top: 1px solid #f0f0f0;
background: rgba(0, 0, 0, 0.02);
}
/* 响应式设计 */
@media (max-width: 375px) {
.card {
margin: $uni-spacing-col-base;
margin: 12px 0;
}
.card-header,
.card-content,
.card-footer {
padding-left: $uni-spacing-row-lg;
padding-right: $uni-spacing-row-lg;
padding-left: 16px;
padding-right: 16px;
}
}
</style>
+7 -6
View File
@@ -1,5 +1,5 @@
<template>
<view class="grid-layout" :class="gridClass">
<view class="grid-layout" :class="gridClass" :style="{ '--grid-gap': gap }">
<slot></slot>
</view>
</template>
@@ -15,7 +15,7 @@ export default {
},
gap: {
type: String,
default: '12px',
default: '16px',
},
},
computed: {
@@ -29,7 +29,7 @@ export default {
<style lang="scss" scoped>
.grid-layout {
display: grid;
gap: v-bind(gap);
gap: 16px !important;
width: 100%;
}
@@ -49,15 +49,15 @@ export default {
@media (max-width: 375px) {
.grid-4 {
grid-template-columns: repeat(3, 1fr);
gap: 8px;
gap: 12px;
}
.grid-3 {
gap: 8px;
gap: 12px;
}
.grid-2 {
gap: 8px;
gap: 12px;
}
}
@@ -65,6 +65,7 @@ export default {
.grid-4,
.grid-3 {
grid-template-columns: 1fr 1fr;
gap: 10px;
}
}
</style>
-176
View File
@@ -1,176 +0,0 @@
<template>
<view class="navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="navbar-content">
<text class="navbar-title">{{ title }}</text>
<view class="navbar-actions">
<slot name="actions">
<view
v-if="showRefresh"
class="btn-icon refresh-btn touchable"
@click="handleRefresh"
:aria-label="refreshLabel"
>
<text class="icon">🔄</text>
</view>
<view
v-if="showSearch"
class="btn-icon touchable"
@click="handleSearch"
:aria-label="searchLabel"
>
<text class="icon">🔍</text>
</view>
<view
v-if="showSettings"
class="btn-icon touchable"
@click="handleSettings"
:aria-label="settingsLabel"
>
<text class="icon">⚙️</text>
</view>
</slot>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'NavBar',
props: {
title: {
type: String,
default: '智慧校园',
},
showRefresh: {
type: Boolean,
default: false,
},
showSearch: {
type: Boolean,
default: false,
},
showSettings: {
type: Boolean,
default: false,
},
refreshLabel: {
type: String,
default: '刷新',
},
searchLabel: {
type: String,
default: '搜索',
},
settingsLabel: {
type: String,
default: '设置',
},
},
data() {
return {
statusBarHeight: 20,
};
},
mounted() {
// 获取状态栏高度
const systemInfo = uni.getSystemInfoSync();
this.statusBarHeight = systemInfo.statusBarHeight || 20;
},
methods: {
handleRefresh() {
this.$emit('refresh');
// 触觉反馈
uni.vibrateShort();
},
handleSearch() {
this.$emit('search');
uni.vibrateShort();
},
handleSettings() {
this.$emit('settings');
uni.vibrateShort();
},
},
};
</script>
<style lang="scss" scoped>
.navbar {
background: linear-gradient(135deg, $uni-color-primary, $uni-color-primary-dark);
color: $uni-text-color-inverse;
padding-bottom: 16px;
position: sticky;
top: 0;
z-index: 100;
box-shadow: $uni-shadow;
}
.navbar-content {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 $uni-spacing-row-lg;
min-height: 44px;
}
.navbar-title {
font-size: $uni-font-size-xl;
font-weight: 600;
color: $uni-text-color-inverse;
}
.navbar-actions {
display: flex;
gap: $uni-spacing-row-base;
}
.btn-icon {
background: rgba(255, 255, 255, 0.2);
border-radius: $uni-border-radius-circle;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
transition: $uni-transition;
&:hover {
background: rgba(255, 255, 255, 0.3);
transform: scale(1.1);
}
.icon {
font-size: 18px;
color: $uni-text-color-inverse;
}
}
/* 动画效果 */
.refresh-btn {
animation: none;
&:active {
animation: spin 0.6s ease-in-out;
}
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* 无障碍支持 */
.btn-icon[aria-label] {
position: relative;
&:focus {
outline: 2px solid rgba(255, 255, 255, 0.5);
outline-offset: 2px;
}
}
</style>
+90 -80
View File
@@ -46,24 +46,24 @@ export default {
<style lang="scss" scoped>
.service-item {
background: $uni-bg-color;
border-radius: $uni-border-radius-lg;
padding: $uni-spacing-col-xl;
background: #ffffff;
border-radius: 12px;
padding: 9px 16px;
text-align: center;
box-shadow: $uni-shadow;
transition: $uni-transition;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
cursor: pointer;
border: 1px solid transparent;
position: relative;
&:hover {
transform: translateY(-3px);
box-shadow: $uni-shadow-hover;
border-color: $uni-color-primary;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
border-color: #007aff;
}
&:focus {
outline: 2px solid $uni-color-primary;
outline: 2px solid #007aff;
outline-offset: 2px;
}
}
@@ -71,133 +71,143 @@ export default {
.service-icon {
width: 48px;
height: 48px;
background: $uni-color-primary-light;
border-radius: $uni-border-radius-circle;
background: rgba(0, 122, 255, 0.1);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto $uni-spacing-col-base;
color: $uni-color-primary;
transition: $uni-transition;
margin: 0 auto 12px;
color: #007aff;
transition: all 0.3s ease;
.icon {
font-size: 24px;
}
// 支持u-icon组件
// 支持u-icon组件 - uview-plus图标
:deep(.u-icon) {
font-size: 24px !important;
color: inherit !important;
width: 24px;
height: 24px;
line-height: 1;
}
// 支持uview内置图标
:deep(.uview-icon) {
font-size: 24px !important;
color: inherit !important;
}
// 支持iconfont图标
.iconfont {
// 支持普通文本图标
.text-icon {
width: 24px;
height: 24px;
font-size: 24px;
color: inherit;
filter: brightness(0) saturate(100%) invert(49%) sepia(98%) saturate(3332%)
hue-rotate(196deg) brightness(104%) contrast(101%);
line-height: 1;
display: flex;
align-items: center;
justify-content: center;
}
}
.service-item:hover .service-icon {
background: $uni-color-primary;
color: $uni-text-color-inverse;
background: rgba(0, 122, 255, 0.2);
transform: scale(1.1);
.iconfont {
filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg)
brightness(100%) contrast(100%);
}
}
.service-title {
font-size: $uni-font-size-base;
font-size: 14px;
font-weight: 500;
color: $uni-text-color;
color: #333333;
display: block;
margin-top: 8px;
word-break: break-all;
line-height: 1.4;
}
.service-badge {
position: absolute;
top: -4px;
right: -4px;
background: #ff4757;
border-radius: $uni-border-radius-lg;
top: -6px;
right: -6px;
background: #ff3b30;
border-radius: 12px;
min-width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
.badge-text {
color: $uni-text-color-inverse;
font-size: 11px;
font-weight: 500;
padding: 0 6px;
}
padding: 0 6px;
box-shadow: 0 2px 4px rgba(255, 59, 48, 0.3);
}
/* 网格布局支持 */
.grid-2 .service-item {
flex: 1;
}
.grid-3 .service-item {
flex: 1;
}
.grid-4 .service-item {
flex: 1;
}
/* 动画效果 */
.service-item {
animation: fadeInUp 0.6s ease-out backwards;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
.badge-text {
color: #ffffff;
font-size: 11px;
font-weight: 600;
line-height: 1;
white-space: nowrap;
}
/* 响应式设计 */
@media (max-width: 375px) {
.service-item {
padding: $uni-spacing-col-lg;
padding: 20px 12px;
}
.service-icon {
width: 40px;
height: 40px;
margin-bottom: 8px;
.icon {
font-size: 20px;
}
// 响应式u-icon支持
.icon,
:deep(.u-icon) {
font-size: 20px !important;
}
// 响应式iconfont支持
.iconfont {
width: 20px;
height: 20px;
font-size: 20px;
}
}
.service-title {
font-size: $uni-font-size-sm;
font-size: 13px;
}
}
/* 小屏幕设备适配 */
@media (max-width: 320px) {
.service-item {
padding: 16px 8px;
}
.service-icon {
width: 36px;
height: 36px;
.icon,
:deep(.u-icon) {
font-size: 18px !important;
}
}
.service-title {
font-size: 12px;
margin-top: 6px;
}
}
/* 活跃状态动画 */
.service-item:active {
transform: scale(0.95);
transition: transform 0.1s ease;
}
/* 无障碍访问增强 */
@media (prefers-reduced-motion: reduce) {
.service-item,
.service-icon {
transition: none;
}
.service-item:hover {
transform: none;
}
}
</style>
-174
View File
@@ -1,174 +0,0 @@
<template>
<view class="stat-card touchable" @click="handleClick">
<text class="stat-number">{{ number }}</text>
<text class="stat-label">{{ label }}</text>
<view v-if="trend" class="stat-trend" :class="trendClass">
<text class="trend-icon">{{ trendIcon }}</text>
<text class="trend-text">{{ trend }}</text>
</view>
</view>
</template>
<script>
export default {
name: 'StatCard',
props: {
number: {
type: [String, Number],
required: true,
},
label: {
type: String,
required: true,
},
trend: {
type: String,
default: '',
},
trendType: {
type: String,
default: 'neutral', // 'up', 'down', 'neutral'
validator: (value) => ['up', 'down', 'neutral'].includes(value),
},
},
computed: {
trendClass() {
return `trend-${this.trendType}`;
},
trendIcon() {
switch (this.trendType) {
case 'up':
return '↗️';
case 'down':
return '↘️';
default:
return '➖';
}
},
},
methods: {
handleClick() {
this.$emit('click', { number: this.number, label: this.label });
uni.vibrateShort();
},
},
};
</script>
<style lang="scss" scoped>
.stat-card {
background: $uni-bg-color;
border-radius: $uni-border-radius-lg;
padding: $uni-spacing-col-xl;
text-align: center;
box-shadow: $uni-shadow;
transition: $uni-transition;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
&:hover {
transform: translateY(-2px);
box-shadow: $uni-shadow-hover;
}
}
.stat-number {
font-size: 24px;
font-weight: 700;
color: $uni-color-primary;
margin-bottom: $uni-spacing-col-sm;
line-height: 1.2;
}
.stat-label {
font-size: $uni-font-size-sm;
color: $uni-text-color-secondary;
line-height: 1.4;
margin: 0;
}
.stat-trend {
display: flex;
align-items: center;
gap: 4px;
margin-top: $uni-spacing-col-sm;
font-size: $uni-font-size-sm;
&.trend-up {
color: $uni-color-success;
}
&.trend-down {
color: $uni-color-error;
}
&.trend-neutral {
color: $uni-text-color-grey;
}
}
.trend-icon {
font-size: 12px;
}
.trend-text {
font-size: 11px;
font-weight: 500;
}
/* 动画效果 */
.stat-card {
animation: bounceIn 0.6s ease-out backwards;
}
@keyframes bounceIn {
0% {
opacity: 0;
transform: scale(0.3);
}
50% {
opacity: 1;
transform: scale(1.05);
}
70% {
transform: scale(0.9);
}
100% {
opacity: 1;
transform: scale(1);
}
}
/* 数字计数动画 */
.stat-number {
animation: countUp 1s ease-out;
}
@keyframes countUp {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 响应式设计 */
@media (max-width: 375px) {
.stat-card {
padding: $uni-spacing-col-lg;
}
.stat-number {
font-size: 20px;
}
.stat-label {
font-size: 11px;
}
}
</style>
+108
View File
@@ -0,0 +1,108 @@
<template>
<view class="tree-node">
<view class="tree-item" :class="{ active: selectedId === node.id }" @click="handleSelect">
<view class="tree-item-content">
<view class="tree-item-left">
<u-icon
v-if="node.children && node.children.length > 0"
:name="expanded ? 'arrow-down' : 'arrow-right'"
size="16"
color="#666"
@click.stop="toggleExpand"
style="margin-right: 8px"
></u-icon>
<text class="tree-item-text">{{ node.label }}</text>
</view>
</view>
</view>
<!-- 子节点 -->
<view v-if="expanded && node.children && node.children.length > 0" class="tree-children">
<tree-node
v-for="child in node.children"
:key="child.id"
:node="child"
:selected-id="selectedId"
@select="handleChildSelect"
></tree-node>
</view>
</view>
</template>
<script>
export default {
name: 'TreeNode',
props: {
node: {
type: Object,
required: true,
},
selectedId: {
type: String,
default: '',
},
},
data() {
return {
expanded: false,
};
},
methods: {
handleSelect() {
this.$emit('select', this.node);
},
handleChildSelect(node) {
this.$emit('select', node);
},
toggleExpand() {
this.expanded = !this.expanded;
},
},
};
</script>
<style scoped>
.tree-node {
width: 100%;
}
.tree-item {
padding: 12px 16px;
border-bottom: 1px solid #f0f0f0;
transition: background-color 0.2s;
}
.tree-item:active {
background-color: #f5f5f5;
}
.tree-item.active {
background-color: #e6f7ff;
border-left: 3px solid #007aff;
}
.tree-item-content {
display: flex;
align-items: center;
justify-content: space-between;
}
.tree-item-left {
display: flex;
align-items: center;
flex: 1;
}
.tree-item-text {
font-size: 14px;
color: #333;
flex: 1;
}
.tree-children {
padding-left: 20px;
background-color: #fafafa;
}
</style>