fix(video): develop
This commit is contained in:
4
components/label/api/const.ts
Normal file
4
components/label/api/const.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export const BASE_LABEL_API =
|
||||
process.env.NEXT_PUBLIC_ENV === "production"
|
||||
? "https://label.cowarobot.com"
|
||||
: "http://172.16.112.8:9110"
|
||||
@@ -1,7 +1,7 @@
|
||||
import httpFetch from "@/api/fetch"
|
||||
import { usePermissionStore } from "../../store/auth"
|
||||
import { BASE_LABEL_API } from "../label"
|
||||
import { Daily } from "./typing"
|
||||
import { BASE_LABEL_API } from "../const"
|
||||
|
||||
export const getDailyWorkList = (data: Daily.Request) => {
|
||||
return httpFetch<Daily.Response>({
|
||||
|
||||
@@ -6,8 +6,7 @@ import {
|
||||
RequestLabelResult,
|
||||
ServerResponse,
|
||||
} from "./typing"
|
||||
|
||||
export const BASE_LABEL_API = "https://label.cowarobot.com"
|
||||
import { BASE_LABEL_API } from "../const"
|
||||
|
||||
// 获取标注结果
|
||||
export const getLabelResult = (task_id: number) => {
|
||||
@@ -58,7 +57,9 @@ export const getServerImage = async (data: {
|
||||
} else {
|
||||
if (res.data_list && res.data_list.length) {
|
||||
const { image_data } = res.data_list[0]
|
||||
resolve({ image_data })
|
||||
resolve({
|
||||
image_data,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import httpFetch from "@/api/fetch"
|
||||
import { usePermissionStore } from "../../store/auth"
|
||||
import { BASE_LABEL_API } from "../label"
|
||||
import { Project, ProjectDetail, ReviewUsers } from "./typing"
|
||||
import { BASE_LABEL_API } from "../const"
|
||||
|
||||
// 获取项目列表
|
||||
export const getProjectList = (data: Project.ListRequest) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import httpFetch from "@/api/fetch"
|
||||
import { usePermissionStore } from "../../store/auth"
|
||||
import { BASE_LABEL_API } from "../label"
|
||||
import { Scheme } from "./typing"
|
||||
import { BASE_LABEL_API } from "../const"
|
||||
|
||||
// 获取标注方案列表
|
||||
export const getLabelSchemeList = (params: Scheme.ListRequest) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import httpFetch from "@/api/fetch"
|
||||
import { usePermissionStore } from "../../store/auth"
|
||||
import { BASE_LABEL_API } from "../label"
|
||||
import { Task } from "./typing"
|
||||
import { BASE_LABEL_API } from "../const"
|
||||
|
||||
// 获取任务列表
|
||||
export const getTaskList = (data: Task.ListRequest) => {
|
||||
|
||||
@@ -2,10 +2,15 @@ import httpFetch from "@/api/fetch"
|
||||
import { ResultData } from "@/api/typing"
|
||||
import { Login } from "./types"
|
||||
|
||||
const BASE_PATH =
|
||||
process.env.NEXT_PUBLIC_ENV === "production"
|
||||
? "https://basis.soft.cowarobot.com"
|
||||
: "https://basis.softtest.cowarobot.cn"
|
||||
|
||||
// 获取验证码
|
||||
export const getVerifyCode = (params: { phone: string }) => {
|
||||
return httpFetch<ResultData<{}>>({
|
||||
url: `/api/v1/basis/login/get_verify_code`,
|
||||
url: BASE_PATH + `/api/v1/basis/login/get_verify_code`,
|
||||
method: "POST",
|
||||
body: JSON.stringify(params),
|
||||
})
|
||||
@@ -14,7 +19,7 @@ export const getVerifyCode = (params: { phone: string }) => {
|
||||
// 账户登录
|
||||
export const passwdLogin = (params: Login.ReqPasswdLogin) => {
|
||||
return httpFetch<ResultData<Login.ResLogin>>({
|
||||
url: `/api/v1/basis/login/passwd`,
|
||||
url: BASE_PATH + `/api/v1/basis/login/passwd`,
|
||||
method: "POST",
|
||||
body: JSON.stringify(params),
|
||||
isLogin: true,
|
||||
@@ -24,7 +29,7 @@ export const passwdLogin = (params: Login.ReqPasswdLogin) => {
|
||||
// 验证码登录
|
||||
export const verificationLogin = (params: Login.ReqVerificationLogin) => {
|
||||
return httpFetch<ResultData<Login.ResLogin>>({
|
||||
url: `/api/v1/basis/login/verification`,
|
||||
url: BASE_PATH + `/api/v1/basis/login/verification`,
|
||||
method: "POST",
|
||||
body: JSON.stringify(params),
|
||||
isLogin: true,
|
||||
@@ -34,7 +39,7 @@ export const verificationLogin = (params: Login.ReqVerificationLogin) => {
|
||||
// 飞书登录
|
||||
export const fetchFeishuLogin = (params: Login.ReqFeishuLogin) => {
|
||||
return httpFetch<ResultData<Login.ResLogin>>({
|
||||
url: `/api/v1/basis/login/feishu`,
|
||||
url: BASE_PATH + `/api/v1/basis/login/feishu`,
|
||||
method: "POST",
|
||||
body: JSON.stringify(params),
|
||||
isLogin: true,
|
||||
@@ -44,7 +49,7 @@ export const fetchFeishuLogin = (params: Login.ReqFeishuLogin) => {
|
||||
// 刷新token
|
||||
export const refreshKey = (params: { token: string }) => {
|
||||
return httpFetch<ResultData<Login.ResRefreshKey>>({
|
||||
url: `/api/v1/basis/key/refresh`,
|
||||
url: BASE_PATH + `/api/v1/basis/key/refresh`,
|
||||
method: "POST",
|
||||
body: JSON.stringify(params),
|
||||
isRefresh: true,
|
||||
@@ -59,3 +64,11 @@ export const deleteCookie = () => {
|
||||
isDeleteCookie: true,
|
||||
})
|
||||
}
|
||||
|
||||
// /api/v1/label_server/user/permission
|
||||
export const getUserPermission = () => {
|
||||
return httpFetch<any>({
|
||||
url: `/api/v1/label_server/user/permission`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useLoginStore } from "@/components/login/store"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { APP, PLATFORM, TENANT } from "@/components/login/libs/common"
|
||||
import { APP_ID, APP_SECRECT } from "./util"
|
||||
import { fetchFeishuLogin } from "../api"
|
||||
import { fetchFeishuLogin, getUserPermission } from "../api"
|
||||
|
||||
const HeaderIcon = DigitalIcon
|
||||
|
||||
@@ -60,6 +60,8 @@ const FeishuAutoLogin = ({ useUserStore }: { useUserStore: any }) => {
|
||||
access_token: info.access_token || "",
|
||||
refresh_token: info.refresh_token || "",
|
||||
})
|
||||
const permission = await getUserPermission()
|
||||
console.log(permission)
|
||||
window.location.href = "/"
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
TENANT,
|
||||
getQueryVariable,
|
||||
} from "@/components/login/libs/common"
|
||||
import { fetchFeishuLogin } from "../api"
|
||||
import { fetchFeishuLogin, getUserPermission } from "../api"
|
||||
|
||||
const QrLogin = ({ useUserStore }: { useUserStore: any }) => {
|
||||
const fingerprint = useLoginStore.getState().fingerprint
|
||||
@@ -57,6 +57,8 @@ const QrLogin = ({ useUserStore }: { useUserStore: any }) => {
|
||||
access_token: info.access_token || "",
|
||||
refresh_token: info.refresh_token || "",
|
||||
})
|
||||
const permission = await getUserPermission()
|
||||
console.log(permission)
|
||||
window.location.href = "/"
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
|
||||
@@ -26,7 +26,12 @@ import {
|
||||
import { useForm } from "@mantine/form"
|
||||
import { useDisclosure } from "@mantine/hooks"
|
||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||
import { getVerifyCode, passwdLogin, verificationLogin } from "./api"
|
||||
import {
|
||||
getUserPermission,
|
||||
getVerifyCode,
|
||||
passwdLogin,
|
||||
verificationLogin,
|
||||
} from "./api"
|
||||
import QrLogin from "./feishu/qr-login"
|
||||
import { APP, PLATFORM, TENANT } from "./libs/common"
|
||||
import { DigitalIcon } from "./resource/icons/digital"
|
||||
@@ -204,6 +209,8 @@ export default function LoginPage({ useUserStore }: { useUserStore: any }) {
|
||||
access_token: info.access_token || "",
|
||||
refresh_token: info.refresh_token || "",
|
||||
})
|
||||
const permission = await getUserPermission()
|
||||
console.log(permission)
|
||||
window.location.href = "/"
|
||||
} catch (error) {
|
||||
if (error) {
|
||||
@@ -295,6 +302,8 @@ export default function LoginPage({ useUserStore }: { useUserStore: any }) {
|
||||
access_token: info.access_token || "",
|
||||
refresh_token: info.refresh_token || "",
|
||||
})
|
||||
const permission = await getUserPermission()
|
||||
console.log(permission)
|
||||
window.location.href = "/"
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : "登录失败,请重试"
|
||||
|
||||
@@ -17,5 +17,5 @@ export const getQueryVariable = (variable: string) => {
|
||||
}
|
||||
|
||||
export const APP = "basis"
|
||||
export const PLATFORM = "basis"
|
||||
export const PLATFORM = "标注平台"
|
||||
export const TENANT = "cowarobot"
|
||||
|
||||
Reference in New Issue
Block a user