Commit 996c6119 authored by 吴永生#A02208's avatar 吴永生#A02208

fix: 文件传输支持实时网速

parent 53f3ef04
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:17:48 * @Date: 2022-05-31 10:17:48
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-13 09:59:45 * @LastEditTime: 2022-06-16 20:22:37
* @FilePath: /bkunyun/src/api/api_prefix.ts * @FilePath: /bkunyun/src/api/api_prefix.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -32,7 +32,7 @@ switch (process.env.REACT_APP_ENV) { ...@@ -32,7 +32,7 @@ switch (process.env.REACT_APP_ENV) {
if (["www.bkunyun.com"].includes(window.location.host)) { if (["www.bkunyun.com"].includes(window.location.host)) {
BACKEND_API_URI_PREFIX = "https://www.bkunyun.com"; BACKEND_API_URI_PREFIX = "https://www.bkunyun.com";
} else { } else {
BACKEND_API_URI_PREFIX = "http://47.57.4.97"; BACKEND_API_URI_PREFIX = "http://47.75.104.171";
} }
break; break;
} }
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 14px; font-size: 14px;
} }
.speedBox {
display: flex;
justify-content: space-between;
align-items: center;
}
.rightBox { .rightBox {
cursor: pointer; cursor: pointer;
......
...@@ -79,6 +79,20 @@ const FileItem = observer((props: IProps) => { ...@@ -79,6 +79,20 @@ const FileItem = observer((props: IProps) => {
}); });
} }
}; };
const speed = useMemo(() => {
let val = 0;
const time = Math.floor((itemInfo?.endTime - itemInfo.startTime) / 1000);
if (time > 0) {
val = Math.floor(itemInfo?.bytesUploaded / time);
}
return val;
}, [itemInfo?.bytesUploaded, itemInfo?.endTime, itemInfo.startTime]);
console.log(
Math.floor((itemInfo?.endTime - itemInfo.startTime) / 1000),
"111111"
);
return ( return (
<div className={styles.itemBox}> <div className={styles.itemBox}>
<div className={styles.leftBox}> <div className={styles.leftBox}>
...@@ -122,9 +136,15 @@ const FileItem = observer((props: IProps) => { ...@@ -122,9 +136,15 @@ const FileItem = observer((props: IProps) => {
</span> </span>
</> </>
) : ( ) : (
<span className={styles.span}>{`${storageUnitFromB( <div className={styles.speedBox}>
itemInfo?.bytesUploaded || 0 <span className={styles.span}>{`${storageUnitFromB(
)}/${storageUnitFromB(itemInfo?.bytesTotal || 0)}`}</span> itemInfo?.bytesUploaded || 0
)}/${storageUnitFromB(itemInfo?.bytesTotal || 0)}`}</span>{" "}
:
<span className={styles.span}>{`${storageUnitFromB(
speed
)}/s`}</span>
</div>
)} )}
</div> </div>
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-10 18:05:21 * @Date: 2022-06-10 18:05:21
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-16 03:05:08 * @LastEditTime: 2022-06-16 21:15:59
* @FilePath: /bkunyun/src/views/ConsoleLayout/components/TransferList/index.tsx * @FilePath: /bkunyun/src/views/ConsoleLayout/components/TransferList/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -46,7 +46,7 @@ const TranSferList = observer(() => { ...@@ -46,7 +46,7 @@ const TranSferList = observer(() => {
size="small" size="small"
/> />
</Box> </Box>
<Box> <Box style={{ height: 400, overflowY: "auto" }}>
{uploadInfoStore?.fileList.map((item) => { {uploadInfoStore?.fileList.map((item) => {
return <FileItem fileItemInfo={item} key={item.id} />; return <FileItem fileItemInfo={item} key={item.id} />;
})} })}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13 * @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-16 18:17:04 * @LastEditTime: 2022-06-16 20:49:14
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx * @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -50,22 +50,18 @@ const ProjectMembers = observer(() => { ...@@ -50,22 +50,18 @@ const ProjectMembers = observer(() => {
const [projectName, setProjectMember] = useState(""); const [projectName, setProjectMember] = useState("");
/** 过滤后数据 */ /** 过滤后数据 */
const [filterTableData, setFilterTableData] = useState([]); const [filterTableData, setFilterTableData] = useState([]);
/** 项目所有者 */
const [projectOwner, setProjectOwner] = useState("");
const columns = useMemo(() => { const columns = useMemo(() => {
const val: any = [ const val: any = [
{ id: "username", label: "成员名称" }, { id: "username", label: "成员名称" },
{ id: "projectRoleDesc", label: "项目权限" }, { id: "projectRoleDesc", label: "项目权限" },
{ id: "phone", label: "联系方式" }, { id: "phone", label: "联系方式" },
]; {
if (isProjectOwner(projectOwner)) {
val.push({
id: "operation", id: "operation",
label: "操作", label: "操作",
width: 160, width: 160,
render: (item: any, row: any) => { render: (item: any, row: any) => {
return item?.projectRole === "OWNER" ? null : ( return row?.projectRole === "OWNER" ? null : (
<> <>
<span <span
style={{ color: "#1370FF", cursor: "pointer" }} style={{ color: "#1370FF", cursor: "pointer" }}
...@@ -86,10 +82,10 @@ const ProjectMembers = observer(() => { ...@@ -86,10 +82,10 @@ const ProjectMembers = observer(() => {
</> </>
); );
}, },
}); },
} ];
return val; return val;
}, [projectOwner]); }, []);
/** 获取表格数据 */ /** 获取表格数据 */
const getTableList = useCallback(() => { const getTableList = useCallback(() => {
...@@ -101,7 +97,6 @@ const ProjectMembers = observer(() => { ...@@ -101,7 +97,6 @@ const ProjectMembers = observer(() => {
}) })
.then((res) => { .then((res) => {
const { data = {} } = res; const { data = {} } = res;
setProjectOwner(data.owner);
setTableData(data?.members || []); setTableData(data?.members || []);
}); });
}, [currentProjectStore?.currentProjectInfo, http]); }, [currentProjectStore?.currentProjectInfo, http]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment