diff --git a/.env.development b/.env.development index 7eda2c1..91cdc23 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,6 @@ -NEXT_PUBLIC_BASE_PATH="" +NEXT_PUBLIC_BASE_PATH="/label" +# NEXT_PUBLIC_BASE_PATH="" + NEXT_PUBLIC_ENV=development diff --git a/.env.staging b/.env.staging index cf50bf9..76749d6 100644 --- a/.env.staging +++ b/.env.staging @@ -1,4 +1,5 @@ NEXT_PUBLIC_BASE_PATH="" +NEXT_PUBLIC_BASE_PATH="/label" NEXT_PUBLIC_ENV=staging diff --git a/api/fetch.ts b/api/fetch.ts index ca3c7d1..6bfbba9 100644 --- a/api/fetch.ts +++ b/api/fetch.ts @@ -79,7 +79,7 @@ async function httpfetch(options: OptionsProps): Promise { } 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 diff --git a/app/component/label/video2image/processVideo.ts b/app/component/label/video2image/processVideo.ts index 4ab4a58..ed9233e 100644 --- a/app/component/label/video2image/processVideo.ts +++ b/app/component/label/video2image/processVideo.ts @@ -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( diff --git a/app/management/person/report/page.tsx b/app/management/person/report/page.tsx index dcbfaff..1c4aefd 100644 --- a/app/management/person/report/page.tsx +++ b/app/management/person/report/page.tsx @@ -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) diff --git a/app/management/team/dailypaper/page.tsx b/app/management/team/dailypaper/page.tsx index ac1380f..7710d36 100644 --- a/app/management/team/dailypaper/page.tsx +++ b/app/management/team/dailypaper/page.tsx @@ -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) diff --git a/app/management/team/employee/page.tsx b/app/management/team/employee/page.tsx index b462add..20ffe7e 100644 --- a/app/management/team/employee/page.tsx +++ b/app/management/team/employee/page.tsx @@ -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(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[] = [ - { 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 ? ( - - 在职 - - ) : ( - - 离职 - - ), - }, - { - 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 ? ( + // + // 在职 + // + // ) : ( + // + // 离职 + // + // ), + // }, + // { + // 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) => ( @@ -167,6 +175,7 @@ export default function TeamEmployeePage() { onClick={() => { setAppliedName(name) setPage(1) + setQueryTrigger((v) => v + 1) }}> 查询 @@ -180,6 +189,7 @@ export default function TeamEmployeePage() { setAppliedName("") setPage(1) setPageSize(20) + setQueryTrigger((v) => v + 1) }}> 重置 @@ -222,6 +232,7 @@ export default function TeamEmployeePage() { withTableBorder withRowBorders + pinLastColumn fetching={loading} records={records} columns={columns} diff --git a/components/label/api/daily/index.ts b/components/label/api/daily/index.ts index b140d3a..b3011f9 100644 --- a/components/label/api/daily/index.ts +++ b/components/label/api/daily/index.ts @@ -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({ - 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({ + url: BASE_LABEL_API + "/api/v1/label_server/daily_work/list/team", method: "POST", body: JSON.stringify(data), }) diff --git a/components/label/store.ts b/components/label/store.ts index b2ee58f..aba4aa4 100644 --- a/components/label/store.ts +++ b/components/label/store.ts @@ -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> interface LabelState { diff --git a/components/login/feishu/auto-login.tsx b/components/login/feishu/auto-login.tsx index 3666be8..fcea3ae 100644 --- a/components/login/feishu/auto-login.tsx +++ b/components/login/feishu/auto-login.tsx @@ -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) } diff --git a/components/login/feishu/qr-login.tsx b/components/login/feishu/qr-login.tsx index 8eed9cf..d7fd896 100644 --- a/components/login/feishu/qr-login.tsx +++ b/components/login/feishu/qr-login.tsx @@ -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) } diff --git a/components/login/index.tsx b/components/login/index.tsx index 156961e..1bf6459 100644 --- a/components/login/index.tsx +++ b/components/login/index.tsx @@ -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 = diff --git a/package.json b/package.json index 9ab85bb..ffbe1d5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/public/wasm/ffmpeg-core-wrapper.js b/public/wasm/ffmpeg-core-wrapper.js index a30bb77..85db82c 100644 --- a/public/wasm/ffmpeg-core-wrapper.js +++ b/public/wasm/ffmpeg-core-wrapper.js @@ -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, + })