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

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

parent 53f3ef04
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:17:48
* @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
* @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) {
if (["www.bkunyun.com"].includes(window.location.host)) {
BACKEND_API_URI_PREFIX = "https://www.bkunyun.com";
} else {
BACKEND_API_URI_PREFIX = "http://47.57.4.97";
BACKEND_API_URI_PREFIX = "http://47.75.104.171";
}
break;
}
......
......@@ -17,6 +17,11 @@
text-overflow: ellipsis;
font-size: 14px;
}
.speedBox {
display: flex;
justify-content: space-between;
align-items: center;
}
.rightBox {
cursor: pointer;
......
......@@ -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 (
<div className={styles.itemBox}>
<div className={styles.leftBox}>
......@@ -122,9 +136,15 @@ const FileItem = observer((props: IProps) => {
</span>
</>
) : (
<div className={styles.speedBox}>
<span className={styles.span}>{`${storageUnitFromB(
itemInfo?.bytesUploaded || 0
)}/${storageUnitFromB(itemInfo?.bytesTotal || 0)}`}</span>
)}/${storageUnitFromB(itemInfo?.bytesTotal || 0)}`}</span>{" "}
:
<span className={styles.span}>{`${storageUnitFromB(
speed
)}/s`}</span>
</div>
)}
</div>
</div>
......
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-10 18:05:21
* @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
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -46,7 +46,7 @@ const TranSferList = observer(() => {
size="small"
/>
</Box>
<Box>
<Box style={{ height: 400, overflowY: "auto" }}>
{uploadInfoStore?.fileList.map((item) => {
return <FileItem fileItemInfo={item} key={item.id} />;
})}
......
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @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
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -50,22 +50,18 @@ const ProjectMembers = observer(() => {
const [projectName, setProjectMember] = useState("");
/** 过滤后数据 */
const [filterTableData, setFilterTableData] = useState([]);
/** 项目所有者 */
const [projectOwner, setProjectOwner] = useState("");
const columns = useMemo(() => {
const val: any = [
{ id: "username", label: "成员名称" },
{ id: "projectRoleDesc", label: "项目权限" },
{ id: "phone", label: "联系方式" },
];
if (isProjectOwner(projectOwner)) {
val.push({
{
id: "operation",
label: "操作",
width: 160,
render: (item: any, row: any) => {
return item?.projectRole === "OWNER" ? null : (
return row?.projectRole === "OWNER" ? null : (
<>
<span
style={{ color: "#1370FF", cursor: "pointer" }}
......@@ -86,10 +82,10 @@ const ProjectMembers = observer(() => {
</>
);
},
});
}
},
];
return val;
}, [projectOwner]);
}, []);
/** 获取表格数据 */
const getTableList = useCallback(() => {
......@@ -101,7 +97,6 @@ const ProjectMembers = observer(() => {
})
.then((res) => {
const { data = {} } = res;
setProjectOwner(data.owner);
setTableData(data?.members || []);
});
}, [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