|
|
@ -2,9 +2,10 @@ import React, { useEffect, useState, useRef } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { push } from 'react-router-redux'; |
|
|
|
import '../style.less' |
|
|
|
import { Notification, Popconfirm } from "@douyinfe/semi-ui"; |
|
|
|
import { Notification, Popconfirm, Modal } from "@douyinfe/semi-ui"; |
|
|
|
import copy from "copy-to-clipboard"; |
|
|
|
import moment from "moment"; |
|
|
|
import { IconRefresh } from '@douyinfe/semi-icons'; |
|
|
|
|
|
|
|
const Mirroring = (props) => { |
|
|
|
const { history, dispatch, actions, user, loading, StatusPushList } = props; |
|
|
@ -26,6 +27,8 @@ const Mirroring = (props) => { |
|
|
|
]); |
|
|
|
|
|
|
|
const [myCustomList, setMyCustomList] = useState([])//我的自定义镜像服务 |
|
|
|
const [isUpdate, setIsUpate] = useState(false) |
|
|
|
const [updateId, setUpdateId] = useState() |
|
|
|
useEffect(() => { |
|
|
|
getMirror() |
|
|
|
}, []); |
|
|
@ -42,10 +45,10 @@ const Mirroring = (props) => { |
|
|
|
setMaskNum(1000) |
|
|
|
} |
|
|
|
function todetail (color) {//去模板内部 |
|
|
|
dispatch(push('/mirroring_detail'+'?template='+color)); |
|
|
|
dispatch(push('/mirroring_detail' + '?template=' + color)); |
|
|
|
} |
|
|
|
function tomirrordetail(mid,template){ |
|
|
|
dispatch(push('/mirroring_detail'+'?template='+template+'&mid='+mid)); |
|
|
|
function tomirrordetail (mid, template) { |
|
|
|
dispatch(push('/mirroring_detail' + '?template=' + template + '&mid=' + mid)); |
|
|
|
} |
|
|
|
function todelete (id) {//删除我的自定义镜像服务 |
|
|
|
dispatch(openness.delMirror(id)).then((res) => { |
|
|
@ -57,22 +60,22 @@ const Mirroring = (props) => { |
|
|
|
getMirror() |
|
|
|
}) |
|
|
|
} |
|
|
|
function topublish(id){ |
|
|
|
function topublish (id) { |
|
|
|
dispatch(openness.putMirrorPublish(id)).then((res) => { |
|
|
|
getMirror() |
|
|
|
}) |
|
|
|
} |
|
|
|
function getTime(date){ |
|
|
|
if(date){ |
|
|
|
function getTime (date) { |
|
|
|
if (date) { |
|
|
|
let year = moment(date).year() + '-' |
|
|
|
let month = (moment(date).month() + 1) > 10 ? (moment(date).month() + 1) + '-' : '0' + (moment(date).month() + 1) + '-' |
|
|
|
let day = moment(date).date() > 10 ? moment(date).date() : '0' + moment(date).date(); |
|
|
|
let hour = moment(date).hour() > 10 ? moment(date).hour() : '0' + moment(date).hour(); |
|
|
|
let minute = moment(date).minute() > 10 ? moment(date).minute() : '0' + moment(date).minute(); |
|
|
|
let second = moment(date).second() > 10 ? moment(date).second() : '0' + moment(date).second(); |
|
|
|
return year + month+day + ' ' + hour + ':' + minute + ':' + second |
|
|
|
return year + month + day + ' ' + hour + ':' + minute + ':' + second |
|
|
|
} |
|
|
|
else{ |
|
|
|
else { |
|
|
|
return '' |
|
|
|
} |
|
|
|
} |
|
|
@ -205,13 +208,13 @@ const Mirroring = (props) => { |
|
|
|
src={item.template == 'blue' ? '/assets/images/imageImg/textblue.png' : item.template == 'black' ? '/assets/images/imageImg/textblack.png' : '/assets/images/imageImg/textwhite.png'} |
|
|
|
alt="设置" |
|
|
|
style={{ width: 330, height: 153, cursor: 'pointer' }} |
|
|
|
onClick={() => {tomirrordetail(item.mid,item.template)}} |
|
|
|
onClick={() => { tomirrordetail(item.mid, item.template) }} |
|
|
|
/> |
|
|
|
<div style={{ color: '#2F2F2F', fontSize: 16, width: 300, textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden' }}> |
|
|
|
{item.title} |
|
|
|
</div> |
|
|
|
<div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', marginTop: 10 }}> |
|
|
|
<div style={{ display: 'flex', cursor: 'pointer' }} onClick={()=>topublish(item.id)}> |
|
|
|
<div style={{ display: 'flex', cursor: 'pointer' }} onClick={() => topublish(item.id)}> |
|
|
|
<div style={{ display: 'flex', alignItems: 'center' }}> |
|
|
|
<img |
|
|
|
src="/assets/images/imageImg/release.png" |
|
|
@ -256,14 +259,19 @@ const Mirroring = (props) => { |
|
|
|
</Popconfirm> |
|
|
|
</div> |
|
|
|
<div style={{ color: 'rgba(0,0,0,0.45)', marginTop: 10, fontSize: 12 }}> |
|
|
|
最后编辑于:{getTime(item.updateTime)||getTime(item.createTime)} |
|
|
|
最后编辑于:{getTime(item.updateTime) || getTime(item.createTime)} |
|
|
|
</div> |
|
|
|
<div style={{ color: 'rgba(0,0,0,0.45)', marginTop: 8, fontSize: 12 }}> |
|
|
|
最后发布于:{getTime(item.publishTime)} |
|
|
|
</div> |
|
|
|
<div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', marginTop: 12 }}> |
|
|
|
<IconRefresh style={{ color: 'rgb(74 129 205 / 93%)', marginRight: 4 }} onClick={() => { |
|
|
|
setIsUpate(true) |
|
|
|
setUpdateId(item.id) |
|
|
|
}} /> |
|
|
|
<div style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }} onClick={() => { |
|
|
|
copy(item.mid ? item.mid : "暂无id"); |
|
|
|
const url = document.location?.toString()?.split("/") || [] |
|
|
|
copy(item.mid ? `${url[0] + '//' + url[2] + '/callService?mid=' + item.mid}` : "暂无id"); |
|
|
|
Notification.success({ |
|
|
|
content: "复制成功", |
|
|
|
duration: 2, |
|
|
@ -284,6 +292,32 @@ const Mirroring = (props) => { |
|
|
|
})} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{isUpdate ? <Modal |
|
|
|
title="更新mid" |
|
|
|
visible={true} |
|
|
|
onOk={() => { |
|
|
|
dispatch(openness.putUpdateMid(updateId)).then(res => { |
|
|
|
if (res.success) { |
|
|
|
myCustomList?.forEach(v => { |
|
|
|
if (v.id == updateId) { |
|
|
|
v.mid = res.payload.data?.mid |
|
|
|
} |
|
|
|
}) |
|
|
|
setMyCustomList([...myCustomList]) |
|
|
|
setIsUpate(false) |
|
|
|
setUpdateId('') |
|
|
|
} |
|
|
|
}) |
|
|
|
}} |
|
|
|
onCancel={() => { |
|
|
|
setIsUpate(false) |
|
|
|
setUpdateId('') |
|
|
|
}} |
|
|
|
closeOnEsc={true} |
|
|
|
> |
|
|
|
更新镜像服务的mid后,历史复制的镜像播放地址无效,需复制新的镜像地址。 |
|
|
|
</Modal> : "" |
|
|
|
} |
|
|
|
</> |
|
|
|
) |
|
|
|
} |
|
|
|