feat(uniapp): 创建 gym-manage-uniapp 移动端项目脚手架

This commit is contained in:
张翔
2026-04-17 18:41:10 +08:00
parent b48ae84344
commit 40709a0b2b
7 changed files with 212 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
const BASE_URL = 'http://localhost:8080/api'
export const request = (options) => {
return new Promise((resolve, reject) => {
uni.request({
url: BASE_URL + options.url,
method: options.method || 'GET',
data: options.data || {},
header: {
'Content-Type': 'application/json',
...options.header
},
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data)
} else {
reject(res)
}
},
fail: (err) => {
reject(err)
}
})
})
}
export default {
request
}
@@ -0,0 +1,40 @@
<template>
<view class="container">
<text class="title">健身房管理系统</text>
<text class="subtitle">欢迎使用 UniApp 移动端</text>
</view>
</template>
<script>
export default {
data() {
return {
title: '健身房管理系统'
}
},
onLoad() {
console.log('Index page loaded')
}
}
</script>
<style>
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
}
.title {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
}
.subtitle {
font-size: 16px;
color: #666;
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import { createPinia } from 'pinia'
const pinia = createPinia()
export default pinia
+27
View File
@@ -0,0 +1,27 @@
import { defineStore } from 'pinia'
export const useUserStore = defineStore('user', {
state: () => ({
token: '',
userInfo: null
}),
getters: {
isLoggedIn: (state) => !!state.token
},
actions: {
setToken(token) {
this.token = token
},
setUserInfo(userInfo) {
this.userInfo = userInfo
},
logout() {
this.token = ''
this.userInfo = null
}
}
})