u
No files matched your search
@@ -3,9 +3,10 @@ package config
|
|||||||
import (
|
import (
|
||||||
"allapp/db"
|
"allapp/db"
|
||||||
"allapp/utils/redisx"
|
"allapp/utils/redisx"
|
||||||
|
"bytes"
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -83,50 +84,45 @@ func defaultConfig() *Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:embed resources/application.yaml
|
||||||
|
var defaultYaml []byte
|
||||||
|
|
||||||
|
//go:embed resources/application-dev.yaml
|
||||||
|
var devYaml []byte
|
||||||
|
|
||||||
|
//go:embed resources/application-build.yaml
|
||||||
|
var buildYaml []byte
|
||||||
|
|
||||||
func readConfigFile() error {
|
func readConfigFile() error {
|
||||||
// 配置文件的目录
|
conf = defaultConfig()
|
||||||
prefix := "resources"
|
env := GetEnv()
|
||||||
env := GetEnv() // 获取当前环境
|
|
||||||
|
|
||||||
// 设置默认值
|
|
||||||
conf = defaultConfig() // 先给默认结构体
|
|
||||||
|
|
||||||
// 默认配置文件
|
|
||||||
confFileRelPath := filepath.Join(prefix, "application.yaml")
|
|
||||||
|
|
||||||
// 创建 viper 实例
|
|
||||||
v := viper.New()
|
v := viper.New()
|
||||||
|
|
||||||
// 首先加载默认的 application.yaml
|
|
||||||
v.SetConfigFile(confFileRelPath)
|
|
||||||
v.SetConfigType("yaml")
|
v.SetConfigType("yaml")
|
||||||
|
|
||||||
// 读取默认配置文件
|
// 读取默认配置
|
||||||
if err := v.ReadInConfig(); err != nil {
|
if err := v.ReadConfig(bytes.NewReader(defaultYaml)); err != nil {
|
||||||
panic(err)
|
return fmt.Errorf("read default config failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据环境加载不同的配置文件
|
// 根据环境合并
|
||||||
switch env {
|
switch env {
|
||||||
case "dev":
|
|
||||||
v.SetConfigFile(filepath.Join(prefix, "application-dev.yaml"))
|
|
||||||
case "build":
|
case "build":
|
||||||
v.SetConfigFile(filepath.Join(prefix, "application-build.yaml"))
|
if err := v.MergeConfig(bytes.NewReader(buildYaml)); err != nil {
|
||||||
|
return fmt.Errorf("merge build config failed: %w", err)
|
||||||
|
}
|
||||||
|
default: // dev 或其他值都使用 dev
|
||||||
|
if err := v.MergeConfig(bytes.NewReader(devYaml)); err != nil {
|
||||||
|
return fmt.Errorf("merge dev config failed: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果需要,合并环境特定的配置文件
|
if err := v.Unmarshal(&conf); err != nil {
|
||||||
if err := v.MergeInConfig(); err != nil {
|
|
||||||
return fmt.Errorf("merge env config failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := v.Unmarshal(conf); err != nil {
|
|
||||||
return fmt.Errorf("unmarshal config failed: %w", err)
|
return fmt.Errorf("unmarshal config failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("✅️ 加载配置成功")
|
|
||||||
// 设置环境变量
|
|
||||||
conf.Env = env
|
conf.Env = env
|
||||||
|
fmt.Println("✅ 加载配置成功, 环境:", env)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
postgres:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 5432
|
||||||
|
user: postgres
|
||||||
|
password: zhang520..
|
||||||
|
dbname: app_online
|
||||||
|
timezone: Asia/Shanghai
|
||||||
|
max_open_conns: 10
|
||||||
|
max_idle_conns: 5
|
||||||
|
conn_max_lifetime: 30m
|
||||||
|
sll_mode: false
|
||||||
|
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
password: zhang520..
|
||||||
|
db: 0
|
||||||
@@ -110,3 +110,44 @@ create table finance_record
|
|||||||
update_by bigint not null,
|
update_by bigint not null,
|
||||||
update_time timestamp with time zone default now()
|
update_time timestamp with time zone default now()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
-- session
|
||||||
|
CREATE TABLE session (
|
||||||
|
id bigint not null primary key,
|
||||||
|
space_id bigint not null,
|
||||||
|
type smallint not null,
|
||||||
|
name varchar(255),
|
||||||
|
avatar varchar(255),
|
||||||
|
description text,
|
||||||
|
status smallint default 0,
|
||||||
|
create_time timestamp with time zone default now(),
|
||||||
|
update_time timestamp with time zone default now()
|
||||||
|
)
|
||||||
|
|
||||||
|
-- session_member
|
||||||
|
create table session_member
|
||||||
|
(
|
||||||
|
id bigint not null
|
||||||
|
primary key,
|
||||||
|
session_id bigint not null,
|
||||||
|
user_id bigint not null,
|
||||||
|
remark varchar(255),
|
||||||
|
is_top smallint default 0 not null,
|
||||||
|
unread_count integer default 0,
|
||||||
|
last_msg_id bigint,
|
||||||
|
status integer default 0,
|
||||||
|
create_time timestamp with time zone default now(),
|
||||||
|
update_time timestamp with time zone default now()
|
||||||
|
);
|
||||||
|
|
||||||
|
create table session_message
|
||||||
|
(
|
||||||
|
id bigint not null
|
||||||
|
primary key,
|
||||||
|
session_id bigint not null,
|
||||||
|
sender_id bigint not null,
|
||||||
|
content text not null,
|
||||||
|
content_type smallint default 0 not null,
|
||||||
|
create_time timestamp with time zone default now()
|
||||||
|
);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"expo": {
|
"expo": {
|
||||||
"name": "app",
|
"name": "AllApp",
|
||||||
"slug": "app",
|
"slug": "AllApp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/icon.png",
|
"icon": "./assets/icon.png",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 81 KiB |
@@ -15,6 +15,7 @@
|
|||||||
"@gluestack-ui/core": "^3.0.12",
|
"@gluestack-ui/core": "^3.0.12",
|
||||||
"@gluestack-ui/utils": "^3.0.11",
|
"@gluestack-ui/utils": "^3.0.11",
|
||||||
"@gluestack/ui-next-adapter": "^3.0.3",
|
"@gluestack/ui-next-adapter": "^3.0.3",
|
||||||
|
"@hiraku-ai/react-native-emoji-picker": "^1.2.4",
|
||||||
"@legendapp/list": "^2.0.19",
|
"@legendapp/list": "^2.0.19",
|
||||||
"@legendapp/motion": "2.4.0",
|
"@legendapp/motion": "2.4.0",
|
||||||
"@react-native-async-storage/async-storage": "2.2.0",
|
"@react-native-async-storage/async-storage": "2.2.0",
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ importers:
|
|||||||
'@gluestack/ui-next-adapter':
|
'@gluestack/ui-next-adapter':
|
||||||
specifier: ^3.0.3
|
specifier: ^3.0.3
|
||||||
version: 3.0.3
|
version: 3.0.3
|
||||||
|
'@hiraku-ai/react-native-emoji-picker':
|
||||||
|
specifier: ^1.2.4
|
||||||
|
version: 1.2.4(@react-native-async-storage/async-storage@2.2.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0)))(react-native-svg@15.12.1(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
||||||
'@legendapp/list':
|
'@legendapp/list':
|
||||||
specifier: ^2.0.19
|
specifier: ^2.0.19
|
||||||
version: 2.0.19(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
version: 2.0.19(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
||||||
@@ -1065,6 +1068,15 @@ packages:
|
|||||||
resolution: {integrity: sha512-KqddPNq5YsTa9f4GQL4DcSEwbbfBWMahR1blj37Z7oJYLwPHF6aAVn00ZaOHI75lE4eh9KjIWMbyJAJ2h0x5/A==}
|
resolution: {integrity: sha512-KqddPNq5YsTa9f4GQL4DcSEwbbfBWMahR1blj37Z7oJYLwPHF6aAVn00ZaOHI75lE4eh9KjIWMbyJAJ2h0x5/A==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
|
|
||||||
|
'@hiraku-ai/react-native-emoji-picker@1.2.4':
|
||||||
|
resolution: {integrity: sha512-JuTJKhQA4y19m0zRDL0gmK9/mz8xGtDVYVwE7LktCG8lgHH/Gs1Mu6CM1JeBp39sPgiEHimUx6EF7Cgfp9iYVw==}
|
||||||
|
engines: {node: '>=12.0.0'}
|
||||||
|
peerDependencies:
|
||||||
|
'@react-native-async-storage/async-storage': '>=1.0.0'
|
||||||
|
react: '>=16.0.0'
|
||||||
|
react-native: '>=0.60.0'
|
||||||
|
react-native-svg: '>=12.0.0'
|
||||||
|
|
||||||
'@humanfs/core@0.19.1':
|
'@humanfs/core@0.19.1':
|
||||||
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
|
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
|
||||||
engines: {node: '>=18.18.0'}
|
engines: {node: '>=18.18.0'}
|
||||||
@@ -7352,6 +7364,13 @@ snapshots:
|
|||||||
find-yarn-workspace-root: 2.0.0
|
find-yarn-workspace-root: 2.0.0
|
||||||
fs-extra: 11.3.2
|
fs-extra: 11.3.2
|
||||||
|
|
||||||
|
'@hiraku-ai/react-native-emoji-picker@1.2.4(@react-native-async-storage/async-storage@2.2.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0)))(react-native-svg@15.12.1(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)':
|
||||||
|
dependencies:
|
||||||
|
'@react-native-async-storage/async-storage': 2.2.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))
|
||||||
|
react: 19.1.0
|
||||||
|
react-native: 0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0)
|
||||||
|
react-native-svg: 15.12.1(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
|
||||||
|
|
||||||
'@humanfs/core@0.19.1': {}
|
'@humanfs/core@0.19.1': {}
|
||||||
|
|
||||||
'@humanfs/node@0.16.7':
|
'@humanfs/node@0.16.7':
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
import { useNavigation } from 'expo-router'
|
|
||||||
import React, { useState } from 'react'
|
|
||||||
import { Text, View } from 'react-native'
|
|
||||||
import { AButton, AModal } from '@/components/common/ao'
|
|
||||||
import AnimatedSwitch from '@/components/common/ao/Switch'
|
|
||||||
import { useSpaceStore } from '@/store/space'
|
|
||||||
|
|
||||||
export default function TestScreen() {
|
|
||||||
const [showDissolve, setShowDissolve] = useState(false)
|
|
||||||
const spaceStore = useSpaceStore()
|
|
||||||
const navigation = useNavigation()
|
|
||||||
|
|
||||||
console.log(navigation.getState()?.routeNames)
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
||||||
<AButton onPress={() => {
|
|
||||||
setShowDissolve(true)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{spaceStore.currentSpace?.space_id}
|
|
||||||
</AButton>
|
|
||||||
<AModal
|
|
||||||
title="提示"
|
|
||||||
body="确认解散该空间么?"
|
|
||||||
isOpen={showDissolve}
|
|
||||||
onClose={() => {
|
|
||||||
setShowDissolve(false)
|
|
||||||
}}
|
|
||||||
onCancel={() => {
|
|
||||||
setShowDissolve(false)
|
|
||||||
}}
|
|
||||||
onConfirm={() => {
|
|
||||||
setShowDissolve(false)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -28,7 +28,7 @@ export default function Index() {
|
|||||||
<AButton
|
<AButton
|
||||||
className="w-full"
|
className="w-full"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navStore.navigateTo('finance/index')
|
navStore.navigateTo('finance')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
开始使用
|
开始使用
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function User() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="mt-8 flex flex-col">
|
<View className="mt-8 flex flex-col">
|
||||||
<ListItem icon="Earth" text="共享空间" href="/system/share" />
|
{/* <ListItem icon="Earth" text="共享空间" href="/system/share" /> */}
|
||||||
<ListItem icon="Settings" text="设置"href="/system/settings" />
|
<ListItem icon="Settings" text="设置"href="/system/settings" />
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useEvent } from 'expo'
|
import { useEvent } from 'expo'
|
||||||
// import ExpoQQ from 'expo-qq'
|
import ExpoQQ from 'expo-qq'
|
||||||
import { useNavigation, useRouter } from 'expo-router'
|
import { useNavigation, useRouter } from 'expo-router'
|
||||||
// import ExpoWeChat from 'expo-wechat'
|
import ExpoWeChat from 'expo-wechat'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { Image, Text, View } from 'react-native'
|
import { Image, Text, View } from 'react-native'
|
||||||
import { toast } from 'sonner-native'
|
import { toast } from 'sonner-native'
|
||||||
@@ -28,153 +28,153 @@ export default function Auth() {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// const onLoginFinished = useEvent(ExpoQQ, 'onLoginFinished')
|
const onLoginFinished = useEvent(ExpoQQ, 'onLoginFinished')
|
||||||
// const onGetUserInfo = useEvent(ExpoQQ, 'onGetUserInfo')
|
const onGetUserInfo = useEvent(ExpoQQ, 'onGetUserInfo')
|
||||||
// const authResult = useEvent(ExpoWeChat, 'onAuthResult')
|
const authResult = useEvent(ExpoWeChat, 'onAuthResult')
|
||||||
|
|
||||||
// async function onQQLogin() {
|
async function onQQLogin() {
|
||||||
// setLoading(true)
|
setLoading(true)
|
||||||
// setForm(val => ({
|
setForm(val => ({
|
||||||
// ...val,
|
...val,
|
||||||
// type: 1,
|
type: 1,
|
||||||
// }))
|
}))
|
||||||
// await ExpoQQ.login(['get_user_info'])
|
await ExpoQQ.login(['get_user_info'])
|
||||||
// }
|
}
|
||||||
|
|
||||||
// async function onWeChatLogin() {
|
async function onWeChatLogin() {
|
||||||
// setLoading(true)
|
setLoading(true)
|
||||||
|
|
||||||
// // 检查微信是否安装
|
// 检查微信是否安装
|
||||||
// const isInstalled = await ExpoWeChat.isWXAppInstalled()
|
const isInstalled = await ExpoWeChat.isWXAppInstalled()
|
||||||
// if (!isInstalled) {
|
if (!isInstalled) {
|
||||||
// toast.warning(onLoginFinished?.errorMessage || '请先安装微信')
|
toast.warning(onLoginFinished?.errorMessage || '请先安装微信')
|
||||||
// setLoading(false)
|
setLoading(false)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// setForm(val => ({
|
setForm(val => ({
|
||||||
// ...val,
|
...val,
|
||||||
// type: 0,
|
type: 0,
|
||||||
// }))
|
}))
|
||||||
|
|
||||||
// ExpoWeChat.sendAuthRequest('snsapi_userinfo', 'state123')
|
ExpoWeChat.sendAuthRequest('snsapi_userinfo', 'state123')
|
||||||
// }
|
}
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// ExpoQQ.init('102826474', '')
|
ExpoQQ.init('102826474', '')
|
||||||
// ExpoWeChat.registerApp('wxdab3e21a1f7e392f', '')
|
ExpoWeChat.registerApp('wxdab3e21a1f7e392f', '')
|
||||||
// }, [])
|
}, [])
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// if (!onLoginFinished) {
|
if (!onLoginFinished) {
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (!onLoginFinished.success) {
|
if (!onLoginFinished.success) {
|
||||||
// toast.warning(onLoginFinished?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权')
|
toast.warning(onLoginFinished?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权')
|
||||||
// setLoading(false)
|
setLoading(false)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const fetchUserInfo = async () => {
|
const fetchUserInfo = async () => {
|
||||||
// try {
|
try {
|
||||||
// const tokenInfo = await ExpoQQ.getLoginTokenInfo()
|
const tokenInfo = await ExpoQQ.getLoginTokenInfo()
|
||||||
// if (!tokenInfo.openId) {
|
if (!tokenInfo.openId) {
|
||||||
// toast.warning(tokenInfo?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权')
|
toast.warning(tokenInfo?.errorMessage || '授权失败,请检查手机是否安装 QQ 或确认授权')
|
||||||
// setLoading(false)
|
setLoading(false)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// setForm(val => ({
|
setForm(val => ({
|
||||||
// ...val,
|
...val,
|
||||||
// openid: String(tokenInfo.openId),
|
openid: String(tokenInfo.openId),
|
||||||
// }))
|
}))
|
||||||
|
|
||||||
// await ExpoQQ.sendGetUserInfoReq()
|
await ExpoQQ.sendGetUserInfoReq()
|
||||||
// }
|
}
|
||||||
// catch (e) {
|
catch (e) {
|
||||||
// console.error('QQ 登录未完成', e)
|
console.error('QQ 登录未完成', e)
|
||||||
// setLoading(false)
|
setLoading(false)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// fetchUserInfo()
|
fetchUserInfo()
|
||||||
// }, [onLoginFinished])
|
}, [onLoginFinished])
|
||||||
|
|
||||||
// // QQ登录
|
// QQ登录
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
// if (!onGetUserInfo)
|
if (!onGetUserInfo)
|
||||||
// return
|
return
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// const loginRes = await loginQqApi({
|
const loginRes = await loginQqApi({
|
||||||
// openid: form.openid,
|
openid: form.openid,
|
||||||
// nickname: onGetUserInfo.nickname || '',
|
nickname: onGetUserInfo.nickname || '',
|
||||||
// avatar: onGetUserInfo.figureurlQq_2 || onGetUserInfo.figureurl_2,
|
avatar: onGetUserInfo.figureurlQq_2 || onGetUserInfo.figureurl_2,
|
||||||
// })
|
})
|
||||||
|
|
||||||
// console.log(loginRes)
|
console.log(loginRes)
|
||||||
|
|
||||||
// if (loginRes.isSuccess) {
|
if (loginRes.isSuccess) {
|
||||||
// userStore.setUserInfo({
|
userStore.setUserInfo({
|
||||||
// token: loginRes.data.token,
|
token: loginRes.data.token,
|
||||||
// id: loginRes.data.userId,
|
id: loginRes.data.userId,
|
||||||
// nickname: loginRes.data.nickname,
|
nickname: loginRes.data.nickname,
|
||||||
// avatar: loginRes.data.avatar,
|
avatar: loginRes.data.avatar,
|
||||||
// })
|
})
|
||||||
// await appStore.init()
|
await appStore.init()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// catch (err) {
|
catch (err) {
|
||||||
// console.error('登录接口出错', err)
|
console.error('登录接口出错', err)
|
||||||
// }
|
}
|
||||||
// finally {
|
finally {
|
||||||
// setLoading(false)
|
setLoading(false)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// handleLogin()
|
handleLogin()
|
||||||
// }, [onGetUserInfo])
|
}, [onGetUserInfo])
|
||||||
|
|
||||||
// // 微信登录
|
// 微信登录
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// if (!authResult)
|
if (!authResult)
|
||||||
// return
|
return
|
||||||
|
|
||||||
// const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
// if (authResult.errorCode === 0) {
|
if (authResult.errorCode === 0) {
|
||||||
// try {
|
try {
|
||||||
// const loginRes = await loginWxApi({
|
const loginRes = await loginWxApi({
|
||||||
// code: authResult.code,
|
code: authResult.code,
|
||||||
// })
|
})
|
||||||
|
|
||||||
// if (loginRes.isSuccess) {
|
if (loginRes.isSuccess) {
|
||||||
// userStore.setUserInfo({
|
userStore.setUserInfo({
|
||||||
// token: loginRes.data.token,
|
token: loginRes.data.token,
|
||||||
// id: loginRes.data.userId,
|
id: loginRes.data.userId,
|
||||||
// nickname: loginRes.data.nickname,
|
nickname: loginRes.data.nickname,
|
||||||
// avatar: loginRes.data.avatar,
|
avatar: loginRes.data.avatar,
|
||||||
// })
|
})
|
||||||
|
|
||||||
// await appStore.init()
|
await appStore.init()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// catch (err) {
|
catch (err) {
|
||||||
// console.error('登录接口出错', err)
|
console.error('登录接口出错', err)
|
||||||
// }
|
}
|
||||||
// finally {
|
finally {
|
||||||
// setLoading(false)
|
setLoading(false)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// else {
|
else {
|
||||||
// console.log('授权失败:', authResult.errorMessage)
|
console.log('授权失败:', authResult.errorMessage)
|
||||||
// setLoading(false)
|
setLoading(false)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// handleLogin()
|
handleLogin()
|
||||||
// }, [authResult])
|
}, [authResult])
|
||||||
|
|
||||||
async function testLogin() {
|
async function testLogin() {
|
||||||
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo3NjY3ODU5ODIxNjUwNjEsImlhdCI6MTc2OTM0ODI0Nn0.17ZNaHD3HSLM8dVn_JQK-gvsG9MKj47IRYV9D4xZkzs
|
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo3NjY3ODU5ODIxNjUwNjEsImlhdCI6MTc2OTM0ODI0Nn0.17ZNaHD3HSLM8dVn_JQK-gvsG9MKj47IRYV9D4xZkzs
|
||||||
@@ -216,7 +216,7 @@ export default function Auth() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="flex flex-col gap-4">
|
<View className="flex flex-col gap-4">
|
||||||
{/* <AButton
|
<AButton
|
||||||
leftIcon={
|
leftIcon={
|
||||||
<IconWeixin color="#fff" />
|
<IconWeixin color="#fff" />
|
||||||
}
|
}
|
||||||
@@ -235,20 +235,19 @@ export default function Auth() {
|
|||||||
onPress={onQQLogin}
|
onPress={onQQLogin}
|
||||||
>
|
>
|
||||||
QQ
|
QQ
|
||||||
</AButton> */}
|
|
||||||
|
|
||||||
<AButton
|
|
||||||
variant="outline"
|
|
||||||
leftIcon={
|
|
||||||
<IconQq />
|
|
||||||
}
|
|
||||||
loading={loading}
|
|
||||||
onPress={testLogin}
|
|
||||||
>
|
|
||||||
模拟登录
|
|
||||||
</AButton>
|
</AButton>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{/* <AButton
|
||||||
|
variant="outline"
|
||||||
|
leftIcon={
|
||||||
|
<IconQq />
|
||||||
|
}
|
||||||
|
onPress={testLogin}
|
||||||
|
>
|
||||||
|
QQ
|
||||||
|
</AButton> */}
|
||||||
|
|
||||||
<View className="mt-10 items-center flex flex-row justify-center">
|
<View className="mt-10 items-center flex flex-row justify-center">
|
||||||
<ACheckbox
|
<ACheckbox
|
||||||
checked={isAgree}
|
checked={isAgree}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
import React, { useState } from 'react'
|
||||||
|
import { Pressable, Text, View } from 'react-native'
|
||||||
|
import { KeyboardAvoidingView } from 'react-native-keyboard-controller'
|
||||||
|
import { AInput, LucideIcon } from '@/components/common/ao'
|
||||||
|
import CustomHeader from '@/components/custom/Header'
|
||||||
|
|
||||||
|
export default function TestScreen() {
|
||||||
|
const [value, setValue] = useState('')
|
||||||
|
const [height, setHeight] = useState(40)
|
||||||
|
|
||||||
|
const handleContentSizeChange = (event: any) => {
|
||||||
|
const newHeight = Math.min(100, Math.max(40, event.nativeEvent.contentSize.height))
|
||||||
|
setHeight(newHeight)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View className="flex-1 bg-white ">
|
||||||
|
<CustomHeader showHeader={false} />
|
||||||
|
|
||||||
|
<KeyboardAvoidingView
|
||||||
|
behavior="padding"
|
||||||
|
className="flex-1"
|
||||||
|
>
|
||||||
|
<View className="flex-row items-center justify-between h-14 px-3 border-b border-gray-100">
|
||||||
|
{/* 左侧 */}
|
||||||
|
<View className="flex-row items-center gap-2">
|
||||||
|
<Pressable className="w-10 h-10 items-center justify-center rounded-full">
|
||||||
|
<LucideIcon icon="ChevronLeft" size={28} color="#111827" />
|
||||||
|
</Pressable>
|
||||||
|
|
||||||
|
<Text className="text-base font-semibold text-gray-900">
|
||||||
|
聊天室
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 右侧 */}
|
||||||
|
<View className="flex-row items-center gap-3">
|
||||||
|
|
||||||
|
<Pressable className="w-9 h-9 items-center justify-center rounded-full bg-[#f9f9f9]">
|
||||||
|
<LucideIcon icon="TvMinimalPlay" size={18} color="#374151" />
|
||||||
|
</Pressable>
|
||||||
|
|
||||||
|
<Pressable className="w-9 h-9 items-center justify-center rounded-full bg-[#f9f9f9]">
|
||||||
|
<LucideIcon icon="Phone" size={18} color="#374151" />
|
||||||
|
</Pressable>
|
||||||
|
|
||||||
|
<Pressable className="w-9 h-9 items-center justify-center rounded-full bg-[#f9f9f9]">
|
||||||
|
<LucideIcon icon="Ellipsis" size={18} color="#374151" />
|
||||||
|
</Pressable>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View className="flex-1">
|
||||||
|
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View
|
||||||
|
className="m-4 flex-row px-3 items-center bg-[#f6f6f7] rounded-full"
|
||||||
|
>
|
||||||
|
<LucideIcon icon="Mic" size={24} />
|
||||||
|
|
||||||
|
<AInput
|
||||||
|
placeholder="请输入消息"
|
||||||
|
className="flex-1 py-2"
|
||||||
|
style={{
|
||||||
|
borderWidth: 0,
|
||||||
|
height,
|
||||||
|
}}
|
||||||
|
multiline={true}
|
||||||
|
onContentSizeChange={handleContentSizeChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LucideIcon icon="Smile" size={24} />
|
||||||
|
<LucideIcon icon="CirclePlus" size={24} className="ml-3" />
|
||||||
|
</View>
|
||||||
|
</KeyboardAvoidingView>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -17,6 +17,8 @@ export interface AInputProps extends Omit<TextInputProps, 'onChange'> {
|
|||||||
leftIcon?: ComponentType
|
leftIcon?: ComponentType
|
||||||
className?: string
|
className?: string
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
|
inputClassName?: string
|
||||||
|
inputStyle?: StyleProp<ViewStyle>
|
||||||
}
|
}
|
||||||
|
|
||||||
const AInput = forwardRef<React.ComponentRef<typeof InputField>, AInputProps>(
|
const AInput = forwardRef<React.ComponentRef<typeof InputField>, AInputProps>(
|
||||||
@@ -32,6 +34,8 @@ const AInput = forwardRef<React.ComponentRef<typeof InputField>, AInputProps>(
|
|||||||
leftIcon,
|
leftIcon,
|
||||||
className,
|
className,
|
||||||
style,
|
style,
|
||||||
|
inputClassName,
|
||||||
|
inputStyle,
|
||||||
...rest
|
...rest
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
const [showPassword, setShowPassword] = useState(false)
|
const [showPassword, setShowPassword] = useState(false)
|
||||||
@@ -56,6 +60,8 @@ const AInput = forwardRef<React.ComponentRef<typeof InputField>, AInputProps>(
|
|||||||
|
|
||||||
<InputField
|
<InputField
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
className={inputClassName}
|
||||||
|
style={inputStyle}
|
||||||
type={isPassword ? (showPassword ? 'text' : 'password') : 'text'}
|
type={isPassword ? (showPassword ? 'text' : 'password') : 'text'}
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function isWhiteListed(url: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const alovaInstance = createAlova({
|
const alovaInstance = createAlova({
|
||||||
baseURL: 'http://192.168.5.6:8086/app',
|
baseURL: 'https://www.oneao.cn/app',
|
||||||
// baseURL: 'http://192.168.1.137:8086/app',
|
// baseURL: 'http://192.168.1.137:8086/app',
|
||||||
requestAdapter: axiosRequestAdapter(),
|
requestAdapter: axiosRequestAdapter(),
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ interface NavState {
|
|||||||
|
|
||||||
const DEFAULT_NAV_MENUS: NavItem[] = [
|
const DEFAULT_NAV_MENUS: NavItem[] = [
|
||||||
{ label: '记账', path: '/finance', icon: 'CircleDollarSign' },
|
{ label: '记账', path: '/finance', icon: 'CircleDollarSign' },
|
||||||
{ label: '恋爱记', path: '/love', icon: 'Heart' },
|
// { label: '恋爱记', path: '/love', icon: 'Heart' },
|
||||||
{ label: '聊天', path: '/chat', icon: 'MessageCircle' },
|
// { label: '聊天', path: '/chat', icon: 'MessageCircle' },
|
||||||
{ label: '个人中心', path: '/user', icon: 'CircleUserRound' },
|
{ label: '个人中心', path: '/user', icon: 'CircleUserRound' },
|
||||||
{ label: '空间管理', path: '/space', icon: 'Earth' },
|
{ label: '空间管理', path: '/space', icon: 'Earth' },
|
||||||
]
|
]
|
||||||
|
|||||||