feat: 本次提交更新内容如下
同步
This commit is contained in:
10
nkebao/src/components/DeviceSelection/api.ts
Normal file
10
nkebao/src/components/DeviceSelection/api.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import request from "@/api/request";
|
||||||
|
|
||||||
|
// 获取设备列表
|
||||||
|
export function getDeviceList(params: {
|
||||||
|
page: number;
|
||||||
|
limit: number;
|
||||||
|
keyword?: string;
|
||||||
|
}) {
|
||||||
|
return request("/v1/device/list", params, "GET");
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { SearchOutlined, ReloadOutlined } from "@ant-design/icons";
|
import { SearchOutlined, ReloadOutlined } from "@ant-design/icons";
|
||||||
import { Input, Button, Checkbox, Popup, Toast } from "antd-mobile";
|
import { Input, Button, Checkbox, Popup, Toast } from "antd-mobile";
|
||||||
import request from "@/api/request";
|
import { getDeviceList } from "./api";
|
||||||
import style from "./module.scss";
|
import style from "./module.scss";
|
||||||
|
|
||||||
// 设备选择项接口
|
// 设备选择项接口
|
||||||
@@ -37,15 +37,11 @@ export default function DeviceSelection({
|
|||||||
const fetchDevices = async (keyword: string = "") => {
|
const fetchDevices = async (keyword: string = "") => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const res = await request(
|
const res = await getDeviceList({
|
||||||
"/v1/device/list",
|
page: 1,
|
||||||
{
|
limit: 100,
|
||||||
page: 1,
|
keyword: keyword.trim() || undefined,
|
||||||
limit: 100,
|
});
|
||||||
keyword: keyword.trim() || undefined,
|
|
||||||
},
|
|
||||||
"GET"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (res && Array.isArray(res.list)) {
|
if (res && Array.isArray(res.list)) {
|
||||||
setDevices(
|
setDevices(
|
||||||
|
|||||||
10
nkebao/src/components/DeviceSelectionDialog/api.ts
Normal file
10
nkebao/src/components/DeviceSelectionDialog/api.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import request from "@/api/request";
|
||||||
|
|
||||||
|
// 获取设备列表
|
||||||
|
export function getDeviceList(params: {
|
||||||
|
page: number;
|
||||||
|
limit: number;
|
||||||
|
keyword?: string;
|
||||||
|
}) {
|
||||||
|
return request("/v1/device/list", params, "GET");
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect, useCallback } from "react";
|
import React, { useState, useEffect, useCallback } from "react";
|
||||||
import { SearchOutlined, ReloadOutlined } from "@ant-design/icons";
|
import { SearchOutlined, ReloadOutlined } from "@ant-design/icons";
|
||||||
import { Input, Button, Checkbox, Popup, Toast } from "antd-mobile";
|
import { Input, Button, Checkbox, Popup, Toast } from "antd-mobile";
|
||||||
import request from "@/api/request";
|
import { getDeviceList } from "./api";
|
||||||
import style from "./module.scss";
|
import style from "./module.scss";
|
||||||
|
|
||||||
interface Device {
|
interface Device {
|
||||||
@@ -36,15 +36,11 @@ export function DeviceSelectionDialog({
|
|||||||
const fetchDevices = useCallback(async (keyword: string = "") => {
|
const fetchDevices = useCallback(async (keyword: string = "") => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await request(
|
const response = await getDeviceList({
|
||||||
"/v1/device/list",
|
page: 1,
|
||||||
{
|
limit: 100,
|
||||||
page: 1,
|
keyword: keyword.trim() || undefined,
|
||||||
limit: 100,
|
});
|
||||||
keyword: keyword.trim() || undefined,
|
|
||||||
},
|
|
||||||
"GET"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response && Array.isArray(response.list)) {
|
if (response && Array.isArray(response.list)) {
|
||||||
// 转换服务端数据格式为组件需要的格式
|
// 转换服务端数据格式为组件需要的格式
|
||||||
|
|||||||
11
nkebao/src/components/FriendSelection/api.ts
Normal file
11
nkebao/src/components/FriendSelection/api.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import request from "@/api/request";
|
||||||
|
|
||||||
|
// 获取好友列表
|
||||||
|
export function getFriendList(params: {
|
||||||
|
page: number;
|
||||||
|
limit: number;
|
||||||
|
deviceIds?: string;
|
||||||
|
keyword?: string;
|
||||||
|
}) {
|
||||||
|
return request("/v1/friend", params, "GET");
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
RightOutlined,
|
RightOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Input, Button, Popup, Toast } from "antd-mobile";
|
import { Input, Button, Popup, Toast } from "antd-mobile";
|
||||||
import request from "@/api/request";
|
import { getFriendList } from "./api";
|
||||||
import style from "./module.scss";
|
import style from "./module.scss";
|
||||||
|
|
||||||
// 微信好友接口类型
|
// 微信好友接口类型
|
||||||
@@ -97,7 +97,7 @@ export default function FriendSelection({
|
|||||||
params.deviceIds = deviceIds.join(",");
|
params.deviceIds = deviceIds.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await request("/v1/friend", params, "GET");
|
const res = await getFriendList(params);
|
||||||
|
|
||||||
if (res && Array.isArray(res.list)) {
|
if (res && Array.isArray(res.list)) {
|
||||||
setFriends(
|
setFriends(
|
||||||
|
|||||||
10
nkebao/src/components/GroupSelection/api.ts
Normal file
10
nkebao/src/components/GroupSelection/api.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import request from "@/api/request";
|
||||||
|
|
||||||
|
// 获取群组列表
|
||||||
|
export function getGroupList(params: {
|
||||||
|
page: number;
|
||||||
|
limit: number;
|
||||||
|
keyword?: string;
|
||||||
|
}) {
|
||||||
|
return request("/v1/chatroom", params, "GET");
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
RightOutlined,
|
RightOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Input, Button, Popup, Toast } from "antd-mobile";
|
import { Input, Button, Popup, Toast } from "antd-mobile";
|
||||||
import request from "@/api/request";
|
import { getGroupList } from "./api";
|
||||||
import style from "./module.scss";
|
import style from "./module.scss";
|
||||||
|
|
||||||
// 群组接口类型
|
// 群组接口类型
|
||||||
@@ -81,7 +81,7 @@ export default function GroupSelection({
|
|||||||
params.keyword = keyword.trim();
|
params.keyword = keyword.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await request("/v1/chatroom", params, "GET");
|
const res = await getGroupList(params);
|
||||||
|
|
||||||
if (res && Array.isArray(res.list)) {
|
if (res && Array.isArray(res.list)) {
|
||||||
setGroups(
|
setGroups(
|
||||||
|
|||||||
10
nkebao/src/vite-env.d.ts
vendored
10
nkebao/src/vite-env.d.ts
vendored
@@ -1 +1,11 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
declare module "*.scss" {
|
||||||
|
const content: { [className: string]: string };
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.css" {
|
||||||
|
const content: { [className: string]: string };
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user