366 lines
5.8 KiB
Vue
366 lines
5.8 KiB
Vue
<template>
|
|
<view>
|
|
<!-- 页面内容 -->
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
onLaunch: function() {
|
|
console.log('玩Android Material Design App Launch')
|
|
this.initApp()
|
|
},
|
|
onShow: function() {
|
|
console.log('App Show')
|
|
},
|
|
onHide: function() {
|
|
console.log('App Hide')
|
|
},
|
|
methods: {
|
|
initApp() {
|
|
// 设置状态栏样式
|
|
if (uni.getSystemInfoSync().platform === 'android') {
|
|
uni.setNavigationBarColor({
|
|
frontColor: '#ffffff',
|
|
backgroundColor: '#6200EE'
|
|
})
|
|
}
|
|
|
|
// 检查网络状态
|
|
this.checkNetwork()
|
|
},
|
|
|
|
checkNetwork() {
|
|
uni.getNetworkType({
|
|
success: (res) => {
|
|
console.log('网络类型:', res.networkType)
|
|
if (res.networkType === 'none') {
|
|
uni.showToast({
|
|
title: '网络连接不可用',
|
|
icon: 'none',
|
|
duration: 3000
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
/* Material Design 全局样式 */
|
|
|
|
/* 页面基础样式 */
|
|
page {
|
|
background-color: #F5F5F5;
|
|
font-family: 'Roboto', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
}
|
|
|
|
/* 卡片样式 - Material Design Elevation */
|
|
.card {
|
|
background: #FFFFFF;
|
|
border-radius: 12px;
|
|
padding: 16px;
|
|
margin: 8px 16px;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
.card:hover, .card:active {
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
/* 文字样式 */
|
|
.text-title {
|
|
font-size: 20px;
|
|
font-weight: 500;
|
|
color: #212121;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.text-subtitle {
|
|
font-size: 16px;
|
|
font-weight: 400;
|
|
color: #424242;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.text-body {
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
color: #616161;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.text-caption {
|
|
font-size: 12px;
|
|
font-weight: 400;
|
|
color: #9E9E9E;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
/* 按钮样式 */
|
|
.btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 36px;
|
|
padding: 0 16px;
|
|
border-radius: 18px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
cursor: pointer;
|
|
border: none;
|
|
outline: none;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: #6200EE;
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.btn-primary:active {
|
|
background-color: #3700B3;
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
.btn-outline {
|
|
background-color: transparent;
|
|
color: #6200EE;
|
|
border: 1px solid #6200EE;
|
|
}
|
|
|
|
.btn-outline:active {
|
|
background-color: rgba(98, 0, 238, 0.08);
|
|
}
|
|
|
|
/* 输入框样式 */
|
|
.input {
|
|
height: 48px;
|
|
padding: 0 12px;
|
|
border-radius: 4px;
|
|
border: 1px solid #E0E0E0;
|
|
font-size: 16px;
|
|
color: #212121;
|
|
background: #FFFFFF;
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
.input:focus {
|
|
border-color: #6200EE;
|
|
box-shadow: 0 0 0 2px rgba(98, 0, 238, 0.2);
|
|
}
|
|
|
|
/* 列表项样式 */
|
|
.list-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 16px;
|
|
background: #FFFFFF;
|
|
border-bottom: 1px solid #EEEEEE;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.list-item:active {
|
|
background-color: #F5F5F5;
|
|
}
|
|
|
|
.list-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
/* 加载状态 */
|
|
.loading {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 48px;
|
|
}
|
|
|
|
.loading-spinner {
|
|
width: 40px;
|
|
height: 40px;
|
|
border: 3px solid #E0E0E0;
|
|
border-top: 3px solid #6200EE;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* 空状态 */
|
|
.empty-state {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 64px 32px;
|
|
text-align: center;
|
|
}
|
|
|
|
.empty-icon {
|
|
font-size: 64px;
|
|
color: #BDBDBD;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.empty-text {
|
|
font-size: 16px;
|
|
color: #757575;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
/* 错误状态 */
|
|
.error-state {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 64px 32px;
|
|
text-align: center;
|
|
}
|
|
|
|
.error-icon {
|
|
font-size: 64px;
|
|
color: #F44336;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.error-text {
|
|
font-size: 16px;
|
|
color: #D32F2F;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
/* 分割线 */
|
|
.divider {
|
|
height: 1px;
|
|
background-color: #EEEEEE;
|
|
margin: 8px 0;
|
|
}
|
|
|
|
/* 阴影等级 */
|
|
.elevation-1 {
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
|
|
}
|
|
|
|
.elevation-2 {
|
|
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
|
|
}
|
|
|
|
.elevation-3 {
|
|
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
|
|
}
|
|
|
|
/* 响应式工具类 */
|
|
.flex {
|
|
display: flex;
|
|
}
|
|
|
|
.flex-column {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.flex-row {
|
|
flex-direction: row;
|
|
}
|
|
|
|
.items-center {
|
|
align-items: center;
|
|
}
|
|
|
|
.justify-center {
|
|
justify-content: center;
|
|
}
|
|
|
|
.justify-between {
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.flex-1 {
|
|
flex: 1;
|
|
}
|
|
|
|
.w-full {
|
|
width: 100%;
|
|
}
|
|
|
|
.h-full {
|
|
height: 100%;
|
|
}
|
|
|
|
.p-4 {
|
|
padding: 16px;
|
|
}
|
|
|
|
.m-4 {
|
|
margin: 16px;
|
|
}
|
|
|
|
.mt-4 {
|
|
margin-top: 16px;
|
|
}
|
|
|
|
.mb-4 {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.ml-4 {
|
|
margin-left: 16px;
|
|
}
|
|
|
|
.mr-4 {
|
|
margin-right: 16px;
|
|
}
|
|
|
|
/* 深色模式支持 */
|
|
@media (prefers-color-scheme: dark) {
|
|
page {
|
|
background-color: #121212;
|
|
}
|
|
|
|
.card {
|
|
background: #1E1E1E;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.text-title {
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.text-subtitle {
|
|
color: #E0E0E0;
|
|
}
|
|
|
|
.text-body {
|
|
color: #B0B0B0;
|
|
}
|
|
|
|
.list-item {
|
|
background: #1E1E1E;
|
|
border-bottom-color: #333333;
|
|
}
|
|
|
|
.list-item:active {
|
|
background-color: #2D2D2D;
|
|
}
|
|
|
|
.input {
|
|
background: #2D2D2D;
|
|
border-color: #424242;
|
|
color: #FFFFFF;
|
|
}
|
|
}
|
|
</style> |