|
@@ -40,6 +40,8 @@ import AttachmentImport, { deleteRes } from "./AttachmentImport";
|
|
|
import VideoModal from "../general/VideoModal";
|
|
import VideoModal from "../general/VideoModal";
|
|
|
import FileSize from "../general/FileSize";
|
|
import FileSize from "../general/FileSize";
|
|
|
import modal from "antd/lib/modal";
|
|
import modal from "antd/lib/modal";
|
|
|
|
|
+import { useAppSelector } from "../../hooks";
|
|
|
|
|
+import { currentUser } from "../../reducers/current-user";
|
|
|
|
|
|
|
|
const { Text } = Typography;
|
|
const { Text } = Typography;
|
|
|
|
|
|
|
@@ -77,6 +79,10 @@ const AttachmentWidget = ({
|
|
|
const [videoVisible, setVideoVisible] = useState(false);
|
|
const [videoVisible, setVideoVisible] = useState(false);
|
|
|
const [videoUrl, setVideoUrl] = useState<string>();
|
|
const [videoUrl, setVideoUrl] = useState<string>();
|
|
|
|
|
|
|
|
|
|
+ const user = useAppSelector(currentUser);
|
|
|
|
|
+
|
|
|
|
|
+ const currStudio = studioName ? studioName : user?.realName;
|
|
|
|
|
+
|
|
|
const showDeleteConfirm = (id: string[], title: string) => {
|
|
const showDeleteConfirm = (id: string[], title: string) => {
|
|
|
Modal.confirm({
|
|
Modal.confirm({
|
|
|
icon: <ExclamationCircleOutlined />,
|
|
icon: <ExclamationCircleOutlined />,
|
|
@@ -249,6 +255,7 @@ const AttachmentWidget = ({
|
|
|
<Dropdown
|
|
<Dropdown
|
|
|
menu={{
|
|
menu={{
|
|
|
items: [
|
|
items: [
|
|
|
|
|
+ { label: "链接", key: "link" },
|
|
|
{ label: "替换", key: "replace" },
|
|
{ label: "替换", key: "replace" },
|
|
|
{ label: "引用模版", key: "tpl" },
|
|
{ label: "引用模版", key: "tpl" },
|
|
|
{ label: "删除", key: "delete", danger: true },
|
|
{ label: "删除", key: "delete", danger: true },
|
|
@@ -256,6 +263,12 @@ const AttachmentWidget = ({
|
|
|
onClick: (e) => {
|
|
onClick: (e) => {
|
|
|
console.log("click ", e.key);
|
|
console.log("click ", e.key);
|
|
|
switch (e.key) {
|
|
switch (e.key) {
|
|
|
|
|
+ case "link":
|
|
|
|
|
+ const link = `/attachments/${row.filename}`;
|
|
|
|
|
+ navigator.clipboard.writeText(link).then(() => {
|
|
|
|
|
+ message.success("已经拷贝到剪贴板");
|
|
|
|
|
+ });
|
|
|
|
|
+ break;
|
|
|
case "replace":
|
|
case "replace":
|
|
|
setReplaceId(row.id);
|
|
setReplaceId(row.id);
|
|
|
setImportOpen(true);
|
|
setImportOpen(true);
|
|
@@ -378,7 +391,7 @@ const AttachmentWidget = ({
|
|
|
let url = "/v2/attachment?";
|
|
let url = "/v2/attachment?";
|
|
|
switch (view) {
|
|
switch (view) {
|
|
|
case "studio":
|
|
case "studio":
|
|
|
- url += `view=studio&studio=${studioName}`;
|
|
|
|
|
|
|
+ url += `view=studio&studio=${currStudio}`;
|
|
|
break;
|
|
break;
|
|
|
case "all":
|
|
case "all":
|
|
|
url += `view=all`;
|
|
url += `view=all`;
|