u
This commit is contained in:
1 parent
59d3be2299
commit
33ab76f73e
13 files changed
+172
-374
No files matched your search
@@ -39,13 +39,6 @@ export default function Share() {
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
<AModal
|
||||
title="确认退出当前账号?"
|
||||
isOpen={showExitModal}
|
||||
onCancel={() => setShowExitModal(false)}
|
||||
onClose={() => setShowExitModal(false)}
|
||||
onConfirm={exitLogin}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -1,10 +1,17 @@
|
||||
import type { SpaceUser, UserSpace } from '@/types/space/spaceUser'
|
||||
import * as Clipboard from 'expo-clipboard'
|
||||
import { useState } from 'react'
|
||||
import { FlatList, Pressable, TouchableOpacity, View } from 'react-native'
|
||||
import { FlatList, TouchableHighlight, TouchableOpacity, View } from 'react-native'
|
||||
import {
|
||||
Menu,
|
||||
MenuOption,
|
||||
MenuOptions,
|
||||
MenuTrigger,
|
||||
renderers,
|
||||
} from 'react-native-popup-menu'
|
||||
import QRCode from 'react-native-qrcode-svg'
|
||||
|
||||
import { AButton, ADivider, LucideIcon } from '@/components/common/ao'
|
||||
import { AModal } from '@/components/common/ao/index'
|
||||
import {
|
||||
Accordion,
|
||||
AccordionContent,
|
||||
@@ -23,9 +30,9 @@ import { Badge, BadgeText } from '@/components/ui/badge'
|
||||
import { Heading } from '@/components/ui/heading'
|
||||
import { HStack } from '@/components/ui/hstack'
|
||||
import { ChevronDownIcon, ChevronUpIcon } from '@/components/ui/icon'
|
||||
import { Menu, MenuItem, MenuItemLabel } from '@/components/ui/menu'
|
||||
import { Text } from '@/components/ui/text'
|
||||
import { VStack } from '@/components/ui/vstack'
|
||||
import { exitSpaceApi } from '@/request/api/space/spaceUser'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { formatRelativeTime } from '@/utils/time'
|
||||
import { toast } from '@/utils/toast'
|
||||
@@ -41,6 +48,17 @@ export default function SpaceInvite({
|
||||
}: SpaceInviteProps) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 踢出 退出 解散
|
||||
const [modal, setModal] = useState<{
|
||||
open: boolean
|
||||
title: string
|
||||
type: 'exit' | 'remove' | 'dissolve'
|
||||
}>({
|
||||
open: false,
|
||||
title: '',
|
||||
type: 'dissolve',
|
||||
})
|
||||
,
|
||||
const [accordion, setAccordion] = useState(['a'])
|
||||
|
||||
async function copyInviteCode() {
|
||||
@@ -51,6 +69,10 @@ export default function SpaceInvite({
|
||||
})
|
||||
}
|
||||
|
||||
function exitSpace() {
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<View className="px-4 flex-1">
|
||||
<Accordion
|
||||
@@ -143,53 +165,83 @@ export default function SpaceInvite({
|
||||
<VStack>
|
||||
<HStack space="sm">
|
||||
<Heading size="sm">{item.username}</Heading>
|
||||
{[0, 1].includes(item.space_role) && (
|
||||
{item.space_role === 0 && (
|
||||
<Badge size="sm" variant="solid" action="muted">
|
||||
<BadgeText>
|
||||
{item.space_role === 0 ? '创建者' : '管理员'}
|
||||
</BadgeText>
|
||||
<BadgeText>创建者</BadgeText>
|
||||
</Badge>
|
||||
)}
|
||||
|
||||
{
|
||||
(userStore.userInfo?.id === item.user_id) && (
|
||||
<Badge size="sm" variant="solid" action='info'>
|
||||
userStore.userInfo?.id === item.user_id && (
|
||||
<Badge size="sm" variant="solid" action="info">
|
||||
<BadgeText>
|
||||
我
|
||||
</BadgeText>
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
|
||||
</HStack>
|
||||
<Text size="sm" className="mt-1">{formatRelativeTime(item.active_time)}</Text>
|
||||
</VStack>
|
||||
|
||||
<View className="ml-auto">
|
||||
<Menu
|
||||
placement="top"
|
||||
offset={5}
|
||||
trigger={triggerProps => (
|
||||
<Pressable
|
||||
{...triggerProps}
|
||||
style={{
|
||||
padding: 8,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
{userSpace?.role === 0 && (
|
||||
<View className="ml-auto">
|
||||
<Menu
|
||||
renderer={renderers.Popover}
|
||||
rendererProps={{
|
||||
placement: 'bottom',
|
||||
preferredPlacement: 'bottom',
|
||||
anchorStyle: { backgroundColor: 'transparent' },
|
||||
closeAnimationDuration: 0,
|
||||
}}
|
||||
>
|
||||
<MenuTrigger>
|
||||
<View className="w-12 items-center justify-center h-10">
|
||||
<LucideIcon icon="Menu" size={20} clickable={false} />
|
||||
</View>
|
||||
</MenuTrigger>
|
||||
<MenuOptions
|
||||
customStyles={{
|
||||
optionsContainer: {
|
||||
backgroundColor: 'white',
|
||||
minWidth: 160,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<LucideIcon icon="EllipsisVertical" size={20} clickable={false} />
|
||||
</Pressable>
|
||||
)}
|
||||
>
|
||||
<MenuItem key="Add account" textValue="Add account">
|
||||
<MenuItemLabel size="sm">添加为管理员</MenuItemLabel>
|
||||
</MenuItem>
|
||||
<MenuItem key="Community" textValue="Community">
|
||||
<MenuItemLabel size="sm">移出空间</MenuItemLabel>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</View>
|
||||
<MenuOption
|
||||
customStyles={{
|
||||
OptionTouchableComponent: TouchableHighlight,
|
||||
optionTouchable: {
|
||||
underlayColor: '#f0f0f0',
|
||||
activeOpacity: 0.7,
|
||||
},
|
||||
}}
|
||||
onSelect={() => {
|
||||
}}
|
||||
>
|
||||
<View className="flex flex-row items-center h-10 px-2">
|
||||
<Text className="text-lg">授予管理员</Text>
|
||||
</View>
|
||||
</MenuOption>
|
||||
<MenuOption
|
||||
customStyles={{
|
||||
OptionTouchableComponent: TouchableHighlight,
|
||||
optionTouchable: {
|
||||
underlayColor: '#f0f0f0',
|
||||
activeOpacity: 0.7,
|
||||
},
|
||||
}}
|
||||
onSelect={() => {
|
||||
}}
|
||||
>
|
||||
<View className="flex flex-row items-center h-10 px-2">
|
||||
<Text className="text-lg">踢出空间</Text>
|
||||
</View>
|
||||
</MenuOption>
|
||||
</MenuOptions>
|
||||
</Menu>
|
||||
</View>
|
||||
)}
|
||||
|
||||
</HStack>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
@@ -197,6 +249,14 @@ export default function SpaceInvite({
|
||||
</View>
|
||||
<AButton size="sm" className="mb-8 mt-4">退出该空间</AButton>
|
||||
</View>
|
||||
|
||||
<AModal
|
||||
title="确认退出当前账号?"
|
||||
isOpen={showExitModal}
|
||||
onCancel={() => setShowExitModal(false)}
|
||||
onClose={() => setShowExitModal(false)}
|
||||
onConfirm={exitLogin}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export default function CustomHeader(props: CustomHeaderProps) {
|
||||
{...screenProps}
|
||||
options={{
|
||||
...screenProps?.options,
|
||||
headerShown: false,
|
||||
headerShown: true,
|
||||
header: () => (
|
||||
<SafeAreaView
|
||||
className={`${className}`}
|
||||
|
||||
@@ -31,8 +31,8 @@ function isWhiteListed(url: string) {
|
||||
}
|
||||
|
||||
const alovaInstance = createAlova({
|
||||
// baseURL: 'http://192.168.5.6:8086/app',
|
||||
baseURL: 'http://192.168.1.136:8086/app',
|
||||
baseURL: 'http://192.168.5.6:8086/app',
|
||||
// baseURL: 'http://192.168.1.136:8086/app',
|
||||
requestAdapter: axiosRequestAdapter(),
|
||||
timeout: 5000,
|
||||
cacheFor: null,
|
||||
|
||||
@@ -49,17 +49,6 @@ export interface RemoveSpaceUserResult {
|
||||
|
||||
}
|
||||
|
||||
// 更新用户权限
|
||||
export interface UpdateSpaceUserRoleParams {
|
||||
space_id: number
|
||||
user_id: number
|
||||
role: number
|
||||
}
|
||||
|
||||
export interface UpdateSpaceUserRoleResult {
|
||||
|
||||
}
|
||||
|
||||
// 加入空间
|
||||
export interface JoinSpaceParams {
|
||||
invite_code: string
|
||||
|
||||
Reference in new issue
Block a user