fix(basepath): add basepath
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
NEXT_PUBLIC_BASE_PATH=""
|
||||
NEXT_PUBLIC_BASE_PATH="/label"
|
||||
# NEXT_PUBLIC_BASE_PATH=""
|
||||
|
||||
|
||||
NEXT_PUBLIC_ENV=development
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
NEXT_PUBLIC_BASE_PATH=""
|
||||
NEXT_PUBLIC_BASE_PATH="/label"
|
||||
|
||||
NEXT_PUBLIC_ENV=staging
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ async function httpfetch<T>(options: OptionsProps): Promise<T> {
|
||||
}
|
||||
const pathList = options.url.split("/")
|
||||
const request = new Request(
|
||||
`/api/${options.isFormData ? "transferFormData" : "transfer"}/${pathList[pathList.length - 1]}`,
|
||||
`${process.env.NEXT_PUBLIC_BASE_PATH}/api/${options.isFormData ? "transferFormData" : "transfer"}/${pathList[pathList.length - 1]}`,
|
||||
myInit
|
||||
)
|
||||
return request
|
||||
|
||||
@@ -105,7 +105,9 @@ export const processVideo = async (
|
||||
const prefix = sanitizePrefix(
|
||||
params.namePrefix || stripFileExt(params.fileName)
|
||||
)
|
||||
const baseURL = params.baseURL || `${window.location.origin}/wasm`
|
||||
const baseURL =
|
||||
params.baseURL ||
|
||||
`${window.location.origin}${process.env.NEXT_PUBLIC_BASE_PATH}/wasm`
|
||||
const inputFile = base64ToFile(params.base64Data, params.fileName)
|
||||
|
||||
const worker = new Worker(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import {
|
||||
deleteDailyWorkData,
|
||||
getDailyWorkList,
|
||||
getSelfDailyWorkList,
|
||||
} from "@/components/label/api/daily"
|
||||
import { Daily } from "@/components/label/api/daily/typing"
|
||||
import { getSelfProjectList } from "@/components/label/api/project"
|
||||
@@ -201,7 +201,7 @@ export default function PersonReportPage() {
|
||||
if (!queryTrigger) return
|
||||
setLoading(true)
|
||||
try {
|
||||
const res = await getDailyWorkList(queryParams)
|
||||
const res = await getSelfDailyWorkList(queryParams)
|
||||
setRecords(res?.daily_work_list ?? [])
|
||||
setTotalItems(res?.total_items ?? 0)
|
||||
setSummary(res?.total_summary ?? null)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import {
|
||||
deleteDailyWorkData,
|
||||
getDailyWorkList,
|
||||
getTeamDailyWorkList,
|
||||
lockDailyWorkData,
|
||||
} from "@/components/label/api/daily"
|
||||
import { Daily } from "@/components/label/api/daily/typing"
|
||||
@@ -163,7 +163,7 @@ export default function TeamDailypaperPage() {
|
||||
if (!queryTrigger) return
|
||||
setLoading(true)
|
||||
try {
|
||||
const res = await getDailyWorkList(queryParams)
|
||||
const res = await getTeamDailyWorkList(queryParams)
|
||||
setRecords(res?.daily_work_list ?? [])
|
||||
setTotalItems(res?.total_items ?? 0)
|
||||
setSummary(res?.total_summary ?? null)
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getUserList } from "@/components/label/api/user"
|
||||
import { User } from "@/components/label/api/user/typing"
|
||||
import useAuth from "@/components/label/hooks/useAuth"
|
||||
import { useAllUserStore } from "@/components/label/store/auth"
|
||||
import { Badge, Button, Group, Paper, Stack, TextInput } from "@mantine/core"
|
||||
import { Button, Group, Paper, Stack, TextInput } from "@mantine/core"
|
||||
import { notifications } from "@mantine/notifications"
|
||||
import { IconEdit, IconRefresh, IconSearch } from "@tabler/icons-react"
|
||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
||||
@@ -30,7 +30,10 @@ export default function TeamEmployeePage() {
|
||||
const [importOpened, setImportOpened] = useState(false)
|
||||
const [selectedUser, setSelectedUser] = useState<User.UserInfo | null>(null)
|
||||
|
||||
const [queryTrigger, setQueryTrigger] = useState(0)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
if (!queryTrigger) return
|
||||
try {
|
||||
setLoading(true)
|
||||
const params: User.ListRequest = {
|
||||
@@ -52,48 +55,53 @@ export default function TeamEmployeePage() {
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [appliedName, page, pageSize])
|
||||
}, [appliedName, page, pageSize, queryTrigger])
|
||||
|
||||
useEffect(() => {
|
||||
queueMicrotask(load)
|
||||
load()
|
||||
}, [load])
|
||||
|
||||
useEffect(() => {
|
||||
queueMicrotask(() => {
|
||||
setQueryTrigger((v) => v + 1)
|
||||
})
|
||||
}, [])
|
||||
|
||||
const columns = useMemo(() => {
|
||||
const cols: DataTableColumn<User.UserInfo>[] = [
|
||||
{ accessor: "uid", title: "UID", width: 120, textAlign: "center" },
|
||||
{ accessor: "name", title: "姓名", width: 120, textAlign: "center" },
|
||||
{
|
||||
accessor: "work_status",
|
||||
title: "状态",
|
||||
width: 100,
|
||||
textAlign: "center",
|
||||
render: (record) =>
|
||||
record.work_status === 1 ? (
|
||||
<Badge color="green" variant="light">
|
||||
在职
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge color="gray" variant="light">
|
||||
离职
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessor: "group_name",
|
||||
title: "组织",
|
||||
width: 180,
|
||||
textAlign: "center",
|
||||
},
|
||||
{ accessor: "uid", title: "UID", width: 80, textAlign: "center" },
|
||||
{ accessor: "name", title: "姓名", width: 140, textAlign: "center" },
|
||||
// {
|
||||
// accessor: "work_status",
|
||||
// title: "状态",
|
||||
// width: 100,
|
||||
// textAlign: "center",
|
||||
// render: (record) =>
|
||||
// record.work_status === 1 ? (
|
||||
// <Badge color="green" variant="light">
|
||||
// 在职
|
||||
// </Badge>
|
||||
// ) : (
|
||||
// <Badge color="gray" variant="light">
|
||||
// 离职
|
||||
// </Badge>
|
||||
// ),
|
||||
// },
|
||||
// {
|
||||
// accessor: "group_name",
|
||||
// title: "组织",
|
||||
// width: 180,
|
||||
// textAlign: "center",
|
||||
// },
|
||||
{
|
||||
accessor: "base_city",
|
||||
title: "所在地",
|
||||
width: 180,
|
||||
textAlign: "center",
|
||||
},
|
||||
{
|
||||
accessor: "operation",
|
||||
title: "操作",
|
||||
width: 220,
|
||||
width: 140,
|
||||
textAlign: "center",
|
||||
render: (record) => (
|
||||
<Group justify="center" gap={4} wrap="nowrap">
|
||||
@@ -167,6 +175,7 @@ export default function TeamEmployeePage() {
|
||||
onClick={() => {
|
||||
setAppliedName(name)
|
||||
setPage(1)
|
||||
setQueryTrigger((v) => v + 1)
|
||||
}}>
|
||||
查询
|
||||
</Button>
|
||||
@@ -180,6 +189,7 @@ export default function TeamEmployeePage() {
|
||||
setAppliedName("")
|
||||
setPage(1)
|
||||
setPageSize(20)
|
||||
setQueryTrigger((v) => v + 1)
|
||||
}}>
|
||||
重置
|
||||
</Button>
|
||||
@@ -222,6 +232,7 @@ export default function TeamEmployeePage() {
|
||||
<DataTable<User.UserInfo>
|
||||
withTableBorder
|
||||
withRowBorders
|
||||
pinLastColumn
|
||||
fetching={loading}
|
||||
records={records}
|
||||
columns={columns}
|
||||
|
||||
@@ -2,9 +2,16 @@ import httpFetch from "@/api/fetch"
|
||||
import { Daily } from "./typing"
|
||||
import { BASE_LABEL_API } from "../const"
|
||||
|
||||
export const getDailyWorkList = (data: Daily.Request) => {
|
||||
export const getSelfDailyWorkList = (data: Daily.Request) => {
|
||||
return httpFetch<Daily.Response>({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/daily_work/list",
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/daily_work/list/self",
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
}
|
||||
export const getTeamDailyWorkList = (data: Daily.Request) => {
|
||||
return httpFetch<Daily.Response>({
|
||||
url: BASE_LABEL_API + "/api/v1/label_server/daily_work/list/team",
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Comment } from "./api/label/typing"
|
||||
import { del, get, set } from "idb-keyval"
|
||||
import superjson from "superjson"
|
||||
import { create } from "zustand"
|
||||
import { persist, PersistStorage, StorageValue } from "zustand/middleware"
|
||||
import { Comment } from "./api/label/typing"
|
||||
|
||||
type LabelData = Map<string, Map<string, [number, any[], any, any[]][]>>
|
||||
interface LabelState {
|
||||
|
||||
@@ -60,7 +60,7 @@ const FeishuAutoLogin = ({ useUserStore }: { useUserStore: any }) => {
|
||||
access_token: info.access_token || "",
|
||||
refresh_token: info.refresh_token || "",
|
||||
})
|
||||
window.location.href = "/"
|
||||
window.location.href = `${process.env.NEXT_PUBLIC_BASE_PATH}/`
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ const QrLogin = ({ useUserStore }: { useUserStore: any }) => {
|
||||
access_token: info.access_token || "",
|
||||
refresh_token: info.refresh_token || "",
|
||||
})
|
||||
window.location.href = "/"
|
||||
window.location.href = `${process.env.NEXT_PUBLIC_BASE_PATH}/`
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ export default function LoginPage({ useUserStore }: { useUserStore: any }) {
|
||||
access_token: info.access_token || "",
|
||||
refresh_token: info.refresh_token || "",
|
||||
})
|
||||
window.location.href = "/"
|
||||
window.location.href = `${process.env.NEXT_PUBLIC_BASE_PATH}/`
|
||||
} catch (error) {
|
||||
if (error) {
|
||||
const message =
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"prebuild:export-stage": "node scripts/disable-api-route.mjs",
|
||||
"build:export-stage": "NEXT_PUBLIC_URL=http://172.16.112.8:9110 NEXT_PUBLIC_OUTPUT_TYPE=export env-cmd -f .env.staging next build --turbopack",
|
||||
"postbuild:export-stage": "node scripts/restore-api-route.mjs",
|
||||
"build:standalone-prod": "NEXT_PUBLIC_URL=https://frontside2.soft.cowarobot.com NEXT_PUBLIC_OUTPUT_TYPE=standalone env-cmd -f .env.production next build --turbopack",
|
||||
"build:standalone-prod": "NEXT_PUBLIC_URL=http://172.16.112.8:9110 NEXT_PUBLIC_OUTPUT_TYPE=standalone env-cmd -f .env.production next build --turbopack",
|
||||
"prebuild:export-prod": "node scripts/disable-api-route.mjs",
|
||||
"build:export-prod": "NEXT_PUBLIC_URL=http://172.16.112.8:9110 NEXT_PUBLIC_OUTPUT_TYPE=export env-cmd -f .env.production next build --turbopack",
|
||||
"postbuild:export-prod": "node scripts/restore-api-route.mjs",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
importScripts("/wasm/ffmpeg-core.js")
|
||||
importScripts(`${process.env.NEXT_PUBLIC_BASE_PATH}/wasm/ffmpeg-core.js`)
|
||||
|
||||
const originalCreateFFmpegCore = self.createFFmpegCore
|
||||
|
||||
self.createFFmpegCore = (moduleOverrides) =>
|
||||
originalCreateFFmpegCore({
|
||||
...moduleOverrides,
|
||||
INITIAL_MEMORY: 268435456,
|
||||
ALLOW_MEMORY_GROWTH: 1,
|
||||
})
|
||||
originalCreateFFmpegCore({
|
||||
...moduleOverrides,
|
||||
INITIAL_MEMORY: 268435456,
|
||||
ALLOW_MEMORY_GROWTH: 1,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user