Compare commits
2 Commits
a568b9d9df
...
4d471aa45d
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d471aa45d | |||
| a6b187c9c9 |
28
.workbuddy/expert-history.json
Normal file
28
.workbuddy/expert-history.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": 2,
|
||||
"sessions": {
|
||||
"22fe5580026e4f249cf9bb33390baa6a": [
|
||||
{
|
||||
"expertId": "SeniorDeveloper",
|
||||
"name": "Will",
|
||||
"profession": "高级开发工程师",
|
||||
"avatarUrl": "https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/experts/avatars/02-Engineering/SeniorDeveloper/SeniorDeveloper.png",
|
||||
"promptUrl": "https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/experts/experts/02-Engineering/SeniorDeveloper/SeniorDeveloper_zh.md",
|
||||
"usedAt": 1775908159660,
|
||||
"industryId": "all"
|
||||
}
|
||||
],
|
||||
"751f0e28e31849adb28b750fe4cdcde7": [
|
||||
{
|
||||
"expertId": "SeniorDeveloper",
|
||||
"name": "Will",
|
||||
"profession": "高级开发工程师",
|
||||
"avatarUrl": "https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/experts/avatars/02-Engineering/SeniorDeveloper/SeniorDeveloper.png",
|
||||
"promptUrl": "https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/experts/experts/02-Engineering/SeniorDeveloper/SeniorDeveloper_zh.md",
|
||||
"usedAt": 1775908159660,
|
||||
"industryId": "all"
|
||||
}
|
||||
]
|
||||
},
|
||||
"lastUpdated": 1775908690098
|
||||
}
|
||||
38
src/hooks/useConfig.ts
Normal file
38
src/hooks/useConfig.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
// Config 类型定义
|
||||
interface Config {
|
||||
tel?: string;
|
||||
workDay?: string;
|
||||
theme?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义Hook用于获取和管理网站配置数据
|
||||
* @returns {Object} 包含配置数据和加载状态的对象
|
||||
*/
|
||||
export const useConfig = () => {
|
||||
const [config, setConfig] = useState<Config | null>(null);
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [error, setError] = useState<Error | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
// 从本地存储读取配置
|
||||
const storedConfig = Taro.getStorageSync('config');
|
||||
if (storedConfig) {
|
||||
setConfig(storedConfig);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const refetch = () => {
|
||||
// 不再调用接口,仅返回本地存储的配置
|
||||
const storedConfig = Taro.getStorageSync('config') || {};
|
||||
setConfig(storedConfig);
|
||||
setLoading(false);
|
||||
return Promise.resolve(storedConfig);
|
||||
};
|
||||
|
||||
return { config, loading, error, refetch };
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { View, Text, Button, Image } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { SERVER_API_URL } from "@/utils/server";
|
||||
|
||||
// 邀请相关接口使用独立的 API 域名
|
||||
// 注意:使用 /api/_app 前缀表示小程序专用接口(免登录)
|
||||
const INVITE_API_URL = 'https://websopy-api.websoft.top';
|
||||
import { TenantId } from "@/config/app";
|
||||
|
||||
@@ -83,7 +83,7 @@ const InvitePage: React.FC = () => {
|
||||
console.log('请求头:', { 'content-type': 'application/json', TenantId });
|
||||
|
||||
const res = await Taro.request({
|
||||
url: `${INVITE_API_URL}/api/developer/invite/info?token=${encodeURIComponent(inviteToken)}`,
|
||||
url: `${INVITE_API_URL}/api/_app/developer/invite/info?token=${encodeURIComponent(inviteToken)}`,
|
||||
method: 'GET',
|
||||
header: {
|
||||
'content-type': 'application/json',
|
||||
@@ -142,7 +142,7 @@ const InvitePage: React.FC = () => {
|
||||
setAuthLoading(true);
|
||||
|
||||
const res = await Taro.request({
|
||||
url: `${INVITE_API_URL}/api/developer/invite/accept`,
|
||||
url: `${INVITE_API_URL}/api/_app/developer/invite/accept`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
token,
|
||||
|
||||
Reference in New Issue
Block a user