refactor: 项目架构清理 — 删除调试页面/冗余store/H5降级代码/无用文件

This commit is contained in:
jacobxu666
2026-06-14 23:10:37 +08:00
parent 4019d312a6
commit 332808648d
27 changed files with 182 additions and 966 deletions
+1 -107
View File
@@ -7,36 +7,12 @@
</view>
<view class="login-area">
<!-- #ifdef MP-WEIXIN -->
<button class="btn-wx-login"
open-type="getPhoneNumber"
@getphonenumber="handleGetPhoneNumber"
:disabled="loading">
{{ loading ? '登录中...' : '微信一键登录' }}
</button>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="h5-tip">
<text>请在微信小程序中使用本应用</text>
</view>
<view class="form" v-if="showFallback">
<view class="form-item">
<text class="label">账号</text>
<input class="input" v-model="form.username" placeholder="请输入账号" />
</view>
<view class="form-item">
<text class="label">密码</text>
<input class="input" v-model="form.password" placeholder="请输入密码" password />
</view>
<button class="btn-fallback" @click="handleFallbackLogin" :disabled="loading">
{{ loading ? '登录中...' : '账号密码登录' }}
</button>
</view>
<button class="btn-toggle" v-if="!showFallback" @click="showFallback = true">
使用账号密码登录
</button>
<!-- #endif -->
</view>
<view class="agreement">
@@ -49,18 +25,12 @@
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { ref } from 'vue'
import { useUserStore } from '../../store/user'
import { showToast } from '../../utils'
const userStore = useUserStore()
const loading = ref(false)
const showFallback = ref(false)
const form = reactive({
username: '',
password: ''
})
/** 微信手机号授权回调 → 登录 */
async function handleGetPhoneNumber(e: any) {
@@ -104,26 +74,6 @@ async function handleGetPhoneNumber(e: any) {
loading.value = false
}
}
/** 账号密码登录(降级方案 / H5 用) */
async function handleFallbackLogin() {
if (!form.username || !form.password) {
showToast('请输入账号和密码')
return
}
loading.value = true
try {
await userStore.login({ username: form.username, password: form.password })
showToast('登录成功', 'success')
setTimeout(() => {
uni.switchTab({ url: '/pages/index/index' })
}, 1000)
} catch (err: any) {
console.error('登录失败:', err)
} finally {
loading.value = false
}
}
</script>
<style scoped>
@@ -181,62 +131,6 @@ async function handleFallbackLogin() {
background: #9ED6B5;
}
.form {
margin-top: 40rpx;
}
.form-item {
margin-bottom: 30rpx;
}
.label {
display: block;
font-size: 28rpx;
color: #333;
margin-bottom: 12rpx;
}
.input {
width: 100%;
height: 80rpx;
padding: 0 24rpx;
background: #f5f5f5;
border-radius: 12rpx;
font-size: 28rpx;
box-sizing: border-box;
}
.btn-fallback {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background: #4A90D9;
color: #fff;
border-radius: 44rpx;
font-size: 30rpx;
margin-top: 20rpx;
border: none;
}
.btn-toggle {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background: transparent;
color: #4A90D9;
border: 2rpx solid #4A90D9;
border-radius: 44rpx;
font-size: 30rpx;
margin-top: 30rpx;
}
.h5-tip {
text-align: center;
padding: 40rpx;
color: #999;
font-size: 28rpx;
}
.agreement {
display: flex;
justify-content: center;