add banbanmini

This commit is contained in:
HycJack
2026-03-24 13:15:03 +08:00
parent 42567b7605
commit 0d0f995dc2
59 changed files with 26319 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
import { View, Text, Button } from '@tarojs/components'
import { useEffect } from 'react'
import Taro from '@tarojs/taro'
import './index.scss'
export default function Login() {
useEffect(() => {
// 检查是否已登录
const isLoggedIn = Taro.getStorageSync('isLoggedIn')
if (isLoggedIn) {
// 已登录,跳转到首页
Taro.reLaunch({ url: '/pages/device/index' })
}
}, [])
const handleLogin = () => {
Taro.showLoading({ title: '登录中...' })
// 调用微信登录
Taro.login({
success: (loginRes) => {
console.log('微信登录成功:', loginRes)
// 模拟后端验证 - 实际项目中需要将code发送到服务器
// 这里假设登录成功
Taro.setStorageSync('isLoggedIn', true)
Taro.setStorageSync('userInfo', {
nickName: '微信家长',
avatarUrl: '',
isAdmin: true,
openid: loginRes.code
})
Taro.hideLoading()
// 登录成功后跳转到首页
Taro.reLaunch({ url: '/pages/device/index' })
},
fail: (err) => {
Taro.hideLoading()
console.error('微信登录失败:', err)
Taro.showToast({
title: '登录失败,请重试',
icon: 'none'
})
}
})
}
return (
<View className='login-page'>
<View className='login-header'>
<View className='logo'>
<Text className='logo-icon'>🤖</Text>
</View>
<Text className='title'></Text>
<Text className='subtitle'></Text>
</View>
<View className='login-content'>
<View className='features'>
<View className='feature-item'>
<Text className='feature-icon'>💬</Text>
<Text className='feature-text'>AI </Text>
</View>
<View className='feature-item'>
<Text className='feature-icon'>📍</Text>
<Text className='feature-text'></Text>
</View>
<View className='feature-item'>
<Text className='feature-icon'>🔋</Text>
<Text className='feature-text'></Text>
</View>
</View>
<View className='login-btn-wrapper'>
<Button
className='login-btn'
openType='getUserInfo'
onGetUserInfo={handleLogin}
>
<Text className='btn-icon'>🌐</Text>
<Text className='btn-text'></Text>
</Button>
</View>
<Text className='agreement'>
</Text>
</View>
</View>
)
}