u
This commit is contained in:
1 parent
1903861354
commit
1b1a54f7dd
35 files changed
+1185
-535
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { useEvent } from 'expo'
|
||||
import ExpoQQ from 'expo-qq'
|
||||
// import ExpoQQ from 'expo-qq'
|
||||
import { useRouter } from 'expo-router'
|
||||
import ExpoWeChat from 'expo-wechat'
|
||||
// import ExpoWeChat from 'expo-wechat'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Image, Text, View } from 'react-native'
|
||||
import { AButton, ACheckbox } from '@/components/common/ao'
|
||||
@@ -25,174 +25,174 @@ export default function Auth() {
|
||||
const userStore = useUserStore()
|
||||
const appStore = useAppStore()
|
||||
|
||||
const onLoginFinished = useEvent(ExpoQQ, 'onLoginFinished')
|
||||
const onGetUserInfo = useEvent(ExpoQQ, 'onGetUserInfo')
|
||||
const authResult = useEvent(ExpoWeChat, 'onAuthResult')
|
||||
// const onLoginFinished = useEvent(ExpoQQ, 'onLoginFinished')
|
||||
// const onGetUserInfo = useEvent(ExpoQQ, 'onGetUserInfo')
|
||||
// const authResult = useEvent(ExpoWeChat, 'onAuthResult')
|
||||
|
||||
async function onQQLogin() {
|
||||
setLoading(true)
|
||||
setForm(val => ({
|
||||
...val,
|
||||
type: 1,
|
||||
}))
|
||||
await ExpoQQ.login(['get_user_info'])
|
||||
}
|
||||
|
||||
async function onWeChatLogin() {
|
||||
setLoading(true)
|
||||
|
||||
// 检查微信是否安装
|
||||
const isInstalled = await ExpoWeChat.isWXAppInstalled()
|
||||
if (!isInstalled) {
|
||||
toast.show({
|
||||
title: onLoginFinished?.errorMessage || '请先安装微信',
|
||||
})
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
setForm(val => ({
|
||||
...val,
|
||||
type: 0,
|
||||
}))
|
||||
|
||||
ExpoWeChat.sendAuthRequest('snsapi_userinfo', 'state123')
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
ExpoQQ.init('102826474', '')
|
||||
ExpoWeChat.registerApp('wxdab3e21a1f7e392f', '')
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!onLoginFinished) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!onLoginFinished.success) {
|
||||
toast.show({
|
||||
title: onLoginFinished?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权',
|
||||
})
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
const fetchUserInfo = async () => {
|
||||
try {
|
||||
const tokenInfo = await ExpoQQ.getLoginTokenInfo()
|
||||
if (!tokenInfo.openId) {
|
||||
toast.show({
|
||||
title: tokenInfo?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权',
|
||||
})
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
setForm(val => ({
|
||||
...val,
|
||||
openid: String(tokenInfo.openId),
|
||||
}))
|
||||
|
||||
await ExpoQQ.sendGetUserInfoReq()
|
||||
}
|
||||
catch (e) {
|
||||
console.error('QQ 登录未完成', e)
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
fetchUserInfo()
|
||||
}, [onLoginFinished])
|
||||
|
||||
// QQ登录
|
||||
useEffect(() => {
|
||||
const handleLogin = async () => {
|
||||
if (!onGetUserInfo)
|
||||
return
|
||||
|
||||
try {
|
||||
const loginRes = await loginQqApi({
|
||||
openid: form.openid,
|
||||
nickname: onGetUserInfo.nickname || '',
|
||||
avatar: onGetUserInfo.figureurlQq_2 || onGetUserInfo.figureurl_2,
|
||||
})
|
||||
|
||||
if (loginRes.isSuccess) {
|
||||
userStore.setUserInfo({
|
||||
token: loginRes.data.token,
|
||||
id: loginRes.data.userId,
|
||||
nickname: loginRes.data.nickname,
|
||||
avatar: loginRes.data.avatar,
|
||||
})
|
||||
|
||||
router.push('/auth/space')
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error('登录接口出错', err)
|
||||
}
|
||||
finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
handleLogin()
|
||||
}, [onGetUserInfo])
|
||||
|
||||
// 微信登录
|
||||
useEffect(() => {
|
||||
if (!authResult)
|
||||
return
|
||||
|
||||
const handleLogin = async () => {
|
||||
if (authResult.errorCode === 0) {
|
||||
try {
|
||||
const loginRes = await loginWxApi({
|
||||
code: authResult.code,
|
||||
})
|
||||
|
||||
if (loginRes.isSuccess) {
|
||||
userStore.setUserInfo({
|
||||
token: loginRes.data.token,
|
||||
id: loginRes.data.userId,
|
||||
nickname: loginRes.data.nickname,
|
||||
avatar: loginRes.data.avatar,
|
||||
})
|
||||
|
||||
router.push('/')
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error('登录接口出错', err)
|
||||
}
|
||||
finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log('授权失败:', authResult.errorMessage)
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
handleLogin()
|
||||
}, [authResult])
|
||||
|
||||
// function testLogin() {
|
||||
// // eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo3NjY3ODU5ODIxNjUwNjEsImlhdCI6MTc2OTM0ODI0Nn0.17ZNaHD3HSLM8dVn_JQK-gvsG9MKj47IRYV9D4xZkzs
|
||||
|
||||
// userStore.setUserInfo({
|
||||
// token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo3NzgxMTUwMzIxMDA5MzMsImlhdCI6MTc3MjExMDQ5N30.Ab7_YNwftJigktnPt8f-FwwcLeS45CkrH0jT2jLjRtA',
|
||||
// id: 778115032100933,
|
||||
// nickname: 'Zhang',
|
||||
// avatar: 'http://thirdqq.qlogo.cn/ek_qqapp/AQHVialeUibE42oV8RvTTVZ4tyRlPYeJrUibWTwtCPfV68E4rSzn9cw00GkXQ3QDTiawwhjoqQb7/100',
|
||||
// })
|
||||
|
||||
// appStore.init()
|
||||
|
||||
// router.push('/')
|
||||
// async function onQQLogin() {
|
||||
// setLoading(true)
|
||||
// setForm(val => ({
|
||||
// ...val,
|
||||
// type: 1,
|
||||
// }))
|
||||
// await ExpoQQ.login(['get_user_info'])
|
||||
// }
|
||||
|
||||
// async function onWeChatLogin() {
|
||||
// setLoading(true)
|
||||
|
||||
// // 检查微信是否安装
|
||||
// const isInstalled = await ExpoWeChat.isWXAppInstalled()
|
||||
// if (!isInstalled) {
|
||||
// toast.show({
|
||||
// title: onLoginFinished?.errorMessage || '请先安装微信',
|
||||
// })
|
||||
// setLoading(false)
|
||||
// return
|
||||
// }
|
||||
|
||||
// setForm(val => ({
|
||||
// ...val,
|
||||
// type: 0,
|
||||
// }))
|
||||
|
||||
// ExpoWeChat.sendAuthRequest('snsapi_userinfo', 'state123')
|
||||
// }
|
||||
|
||||
// useEffect(() => {
|
||||
// ExpoQQ.init('102826474', '')
|
||||
// ExpoWeChat.registerApp('wxdab3e21a1f7e392f', '')
|
||||
// }, [])
|
||||
|
||||
// useEffect(() => {
|
||||
// if (!onLoginFinished) {
|
||||
// return
|
||||
// }
|
||||
|
||||
// if (!onLoginFinished.success) {
|
||||
// toast.show({
|
||||
// title: onLoginFinished?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权',
|
||||
// })
|
||||
// setLoading(false)
|
||||
// return
|
||||
// }
|
||||
|
||||
// const fetchUserInfo = async () => {
|
||||
// try {
|
||||
// const tokenInfo = await ExpoQQ.getLoginTokenInfo()
|
||||
// if (!tokenInfo.openId) {
|
||||
// toast.show({
|
||||
// title: tokenInfo?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权',
|
||||
// })
|
||||
// setLoading(false)
|
||||
// return
|
||||
// }
|
||||
|
||||
// setForm(val => ({
|
||||
// ...val,
|
||||
// openid: String(tokenInfo.openId),
|
||||
// }))
|
||||
|
||||
// await ExpoQQ.sendGetUserInfoReq()
|
||||
// }
|
||||
// catch (e) {
|
||||
// console.error('QQ 登录未完成', e)
|
||||
// setLoading(false)
|
||||
// }
|
||||
// }
|
||||
|
||||
// fetchUserInfo()
|
||||
// }, [onLoginFinished])
|
||||
|
||||
// // QQ登录
|
||||
// useEffect(() => {
|
||||
// const handleLogin = async () => {
|
||||
// if (!onGetUserInfo)
|
||||
// return
|
||||
|
||||
// try {
|
||||
// const loginRes = await loginQqApi({
|
||||
// openid: form.openid,
|
||||
// nickname: onGetUserInfo.nickname || '',
|
||||
// avatar: onGetUserInfo.figureurlQq_2 || onGetUserInfo.figureurl_2,
|
||||
// })
|
||||
|
||||
// if (loginRes.isSuccess) {
|
||||
// userStore.setUserInfo({
|
||||
// token: loginRes.data.token,
|
||||
// id: loginRes.data.userId,
|
||||
// nickname: loginRes.data.nickname,
|
||||
// avatar: loginRes.data.avatar,
|
||||
// })
|
||||
|
||||
// router.push('/auth/space')
|
||||
// }
|
||||
// }
|
||||
// catch (err) {
|
||||
// console.error('登录接口出错', err)
|
||||
// }
|
||||
// finally {
|
||||
// setLoading(false)
|
||||
// }
|
||||
// }
|
||||
|
||||
// handleLogin()
|
||||
// }, [onGetUserInfo])
|
||||
|
||||
// // 微信登录
|
||||
// useEffect(() => {
|
||||
// if (!authResult)
|
||||
// return
|
||||
|
||||
// const handleLogin = async () => {
|
||||
// if (authResult.errorCode === 0) {
|
||||
// try {
|
||||
// const loginRes = await loginWxApi({
|
||||
// code: authResult.code,
|
||||
// })
|
||||
|
||||
// if (loginRes.isSuccess) {
|
||||
// userStore.setUserInfo({
|
||||
// token: loginRes.data.token,
|
||||
// id: loginRes.data.userId,
|
||||
// nickname: loginRes.data.nickname,
|
||||
// avatar: loginRes.data.avatar,
|
||||
// })
|
||||
|
||||
// router.push('/')
|
||||
// }
|
||||
// }
|
||||
// catch (err) {
|
||||
// console.error('登录接口出错', err)
|
||||
// }
|
||||
// finally {
|
||||
// setLoading(false)
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// console.log('授权失败:', authResult.errorMessage)
|
||||
// setLoading(false)
|
||||
// }
|
||||
// }
|
||||
|
||||
// handleLogin()
|
||||
// }, [authResult])
|
||||
|
||||
function testLogin() {
|
||||
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo3NjY3ODU5ODIxNjUwNjEsImlhdCI6MTc2OTM0ODI0Nn0.17ZNaHD3HSLM8dVn_JQK-gvsG9MKj47IRYV9D4xZkzs
|
||||
|
||||
userStore.setUserInfo({
|
||||
token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo3NzgxMTUwMzIxMDA5MzMsImlhdCI6MTc3MjExMDQ5N30.Ab7_YNwftJigktnPt8f-FwwcLeS45CkrH0jT2jLjRtA',
|
||||
id: 778115032100933,
|
||||
nickname: 'Zhang',
|
||||
avatar: 'http://thirdqq.qlogo.cn/ek_qqapp/AQHVialeUibE42oV8RvTTVZ4tyRlPYeJrUibWTwtCPfV68E4rSzn9cw00GkXQ3QDTiawwhjoqQb7/100',
|
||||
})
|
||||
|
||||
appStore.init()
|
||||
|
||||
router.push('/')
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="flex-1 bg-white px-6 justify-center">
|
||||
<CustomHeader
|
||||
@@ -210,7 +210,7 @@ export default function Auth() {
|
||||
</View>
|
||||
|
||||
<View className="flex flex-col gap-4">
|
||||
<AButton
|
||||
{/* <AButton
|
||||
leftIcon={
|
||||
<IconWeixin color="#fff" />
|
||||
}
|
||||
@@ -229,7 +229,7 @@ export default function Auth() {
|
||||
onPress={onQQLogin}
|
||||
>
|
||||
QQ
|
||||
</AButton>
|
||||
</AButton> */}
|
||||
|
||||
<AButton
|
||||
variant="outline"
|
||||
@@ -237,7 +237,7 @@ export default function Auth() {
|
||||
<IconQq />
|
||||
}
|
||||
loading={loading}
|
||||
// onPress={testLogin}
|
||||
onPress={testLogin}
|
||||
>
|
||||
模拟登录
|
||||
</AButton>
|
||||
|
||||
@@ -1,61 +1,278 @@
|
||||
import { Text, View } from 'react-native'
|
||||
import { AButton, LucideIcon } from '@/components/common/ao'
|
||||
import type { Space } from '@/types/space/space'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { Pressable, Text, View } from 'react-native'
|
||||
import Animated, { useAnimatedRef } from 'react-native-reanimated'
|
||||
import Sortable from 'react-native-sortables'
|
||||
import { toast } from 'sonner-native'
|
||||
import { AButton, ADivider, AInput, LucideIcon } from '@/components/common/ao'
|
||||
import { AModal } from '@/components/common/ao/index'
|
||||
import EmptyState from '@/components/common/EmptyStatus'
|
||||
import CustomHeader from '@/components/custom/Header'
|
||||
|
||||
// name renshu
|
||||
import { Badge, BadgeText } from '@/components/ui/badge'
|
||||
import { createSpaceApi } from '@/request/api/space/space'
|
||||
|
||||
export default function AuthSpace() {
|
||||
return (
|
||||
<View className="flex-1">
|
||||
<CustomHeader title="空间列表" />
|
||||
<View className="flex-1 px-4 pt-2 pb-8">
|
||||
<View>
|
||||
<Text className="text-lg font-semibold">你的空间</Text>
|
||||
<Text className="text-sm text-gray-600">选择要进入的空间</Text>
|
||||
</View>
|
||||
const scrollableRef = useAnimatedRef<Animated.ScrollView>()
|
||||
|
||||
<View className="flex-1 my-4">
|
||||
{/* <View className="items-center justify-center">
|
||||
<EmptyState title="暂无空间" description="请选择 创建 或 加入 空间" />
|
||||
</View> */}
|
||||
const [selectedId, setSelectedId] = useState<number | null>(null)
|
||||
|
||||
// 新建
|
||||
const [createOpen, setCreateOpen] = useState(false)
|
||||
const [createForm, setCreateForm] = useState({
|
||||
name: '',
|
||||
})
|
||||
|
||||
const spaces: Space[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'A 的空间',
|
||||
role: 1,
|
||||
member_count: 8,
|
||||
is_default: 1,
|
||||
sort_number: 1,
|
||||
user_name: '张三',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'B 的空间',
|
||||
role: 2,
|
||||
member_count: 5,
|
||||
is_default: 0,
|
||||
sort_number: 2,
|
||||
user_name: '李四',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'C 的空间',
|
||||
role: 3,
|
||||
member_count: 12,
|
||||
is_default: 0,
|
||||
sort_number: 3,
|
||||
user_name: '王五',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'D 的空间',
|
||||
role: 2,
|
||||
member_count: 6,
|
||||
is_default: 0,
|
||||
sort_number: 4,
|
||||
user_name: '赵六',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'E 的空间',
|
||||
role: 1,
|
||||
member_count: 3,
|
||||
is_default: 0,
|
||||
sort_number: 5,
|
||||
user_name: '钱七',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: 'F 的空间',
|
||||
role: 2,
|
||||
member_count: 9,
|
||||
is_default: 0,
|
||||
sort_number: 6,
|
||||
user_name: '孙八',
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: 'G 的空间',
|
||||
role: 3,
|
||||
member_count: 4,
|
||||
is_default: 0,
|
||||
sort_number: 7,
|
||||
user_name: '周九',
|
||||
},
|
||||
]
|
||||
|
||||
const renderItem = useCallback(
|
||||
({ item }: { item: Space }) => (
|
||||
<Pressable
|
||||
key={item.id}
|
||||
onPress={() => setSelectedId(item.id)}
|
||||
className={`rounded-md flex-row items-center justify-between px-4 py-3 border
|
||||
${item.id === selectedId ? 'border-gray-700' : 'border-gray-300'}`}
|
||||
>
|
||||
<View className="flex-row items-center">
|
||||
<Sortable.Handle>
|
||||
<LucideIcon
|
||||
icon="Grip"
|
||||
size={20}
|
||||
className="mr-4"
|
||||
/>
|
||||
</Sortable.Handle>
|
||||
<View>
|
||||
<View className="rounded-lg p-3 flex flex-row items-center justify-between bg-gray-100">
|
||||
<View className="flex-row items-center">
|
||||
<View className="mr-4">
|
||||
<LucideIcon
|
||||
icon="Grip"
|
||||
size={20}
|
||||
color="#666"
|
||||
/>
|
||||
</View>
|
||||
<View className="flex-row items-center gap-2">
|
||||
<Text
|
||||
className="font-semibold text-gray-900"
|
||||
>
|
||||
{item.name}
|
||||
</Text>
|
||||
|
||||
<View className="">
|
||||
<View>
|
||||
<Text className="font-semibold">A 的空间</Text>
|
||||
</View>
|
||||
<Text className="text-sm text-gray-500 mt-1">张三 · 8 名成员</Text>
|
||||
</View>
|
||||
<Badge size="sm" variant="solid" action="muted">
|
||||
<BadgeText>创建者</BadgeText>
|
||||
</Badge>
|
||||
|
||||
<Badge size="sm" variant="solid" action="info">
|
||||
<BadgeText>默认</BadgeText>
|
||||
</Badge>
|
||||
</View>
|
||||
|
||||
<View className="flex-row items-center gap-3 mt-2">
|
||||
<View className="flex-row gap-1">
|
||||
<LucideIcon icon="UserRound" size={12} />
|
||||
<Text
|
||||
className={`text-xs `}
|
||||
>
|
||||
用户A
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View>
|
||||
<LucideIcon
|
||||
icon="Bolt"
|
||||
size={20}
|
||||
color="#aaa"
|
||||
style={{ padding: 6 }}
|
||||
/>
|
||||
<View className="flex-row gap-1">
|
||||
<LucideIcon icon="UsersRound" size={12} />
|
||||
<Text
|
||||
className={`text-xs `}
|
||||
>
|
||||
0
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className="flex gap-3">
|
||||
<AButton>创建新空间</AButton>
|
||||
<AButton variant="outline">加入其他空间</AButton>
|
||||
<LucideIcon
|
||||
icon="Bolt"
|
||||
size={20}
|
||||
className="p-1"
|
||||
/>
|
||||
</Pressable>
|
||||
),
|
||||
[],
|
||||
)
|
||||
|
||||
return (
|
||||
<View className="flex-1 bg-white">
|
||||
{/* Header */}
|
||||
<CustomHeader title="空间列表" />
|
||||
|
||||
<View className="flex-1 px-4">
|
||||
|
||||
<View className="">
|
||||
<Text className="text-sm text-gray-500 mb-2">
|
||||
选择或创建空间
|
||||
</Text>
|
||||
<View className="flex-row gap-3">
|
||||
<AButton
|
||||
className="flex-1 rounded-full"
|
||||
size="sm"
|
||||
leftIcon={<LucideIcon icon="Plus" color="#fff" />}
|
||||
onPress={() => setCreateOpen(true)}
|
||||
>
|
||||
创建新空间
|
||||
</AButton>
|
||||
<AButton
|
||||
variant="outline"
|
||||
className="flex-1 rounded-full"
|
||||
size="sm"
|
||||
leftIcon={<LucideIcon icon="HousePlus" />}
|
||||
>
|
||||
加入其他空间
|
||||
</AButton>
|
||||
</View>
|
||||
</View>
|
||||
<ADivider text="我的空间" className="py-2" />
|
||||
|
||||
<Animated.ScrollView
|
||||
className="flex-1"
|
||||
ref={scrollableRef}
|
||||
>
|
||||
{spaces.length === 0
|
||||
? (
|
||||
<View className="flex-1 items-center justify-center mt-12">
|
||||
<EmptyState
|
||||
title="暂无空间"
|
||||
description="请选择 创建 或 加入 空间"
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
: (
|
||||
<Sortable.Grid
|
||||
scrollableRef={scrollableRef}
|
||||
activeItemScale={1}
|
||||
columns={1}
|
||||
data={spaces}
|
||||
overDrag="vertical"
|
||||
renderItem={renderItem}
|
||||
rowGap={10}
|
||||
highlight-next-line
|
||||
customHandle
|
||||
autoScrollActivationOffset={200}
|
||||
/>
|
||||
)}
|
||||
</Animated.ScrollView>
|
||||
|
||||
<View className="py-2">
|
||||
<AButton size="sm" leftIcon={<LucideIcon icon="CircleArrowRight" color="#fff" />}>进入空间</AButton>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<AModal
|
||||
title="创建新空间"
|
||||
showCloseIcon
|
||||
body={
|
||||
(
|
||||
<View className="gap-2">
|
||||
<Text>空间名称</Text>
|
||||
<AInput
|
||||
className="flex-1"
|
||||
value={createForm.name}
|
||||
onChangeText={(val) => {
|
||||
setCreateForm(prev => ({
|
||||
...prev,
|
||||
name: val,
|
||||
}))
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
isOpen={createOpen}
|
||||
onCancel={() => {
|
||||
setCreateOpen(false)
|
||||
setCreateForm({
|
||||
name: '',
|
||||
})
|
||||
}}
|
||||
onClose={() => {
|
||||
setCreateOpen(false)
|
||||
setCreateForm({
|
||||
name: '',
|
||||
})
|
||||
}}
|
||||
onConfirm={async () => {
|
||||
if (!createForm.name) {
|
||||
toast.warning('请输入空间名称')
|
||||
return
|
||||
}
|
||||
await createSpaceApi({
|
||||
name: createForm.name,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
if (res.isSuccess) {
|
||||
toast.success('创建成功')
|
||||
setCreateOpen(false)
|
||||
setCreateForm({
|
||||
name: '',
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}}
|
||||
>
|
||||
</AModal>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user