|
@@ -91,7 +91,7 @@
|
|
|
:class="{
|
|
|
activefileList: row.fileList && row.fileList.length == 1,
|
|
|
}"
|
|
|
- :before-upload="beforeUpload"
|
|
|
+ :before-upload="beforeUpload"
|
|
|
list-type="picture-card"
|
|
|
:action="uploadFileUrl"
|
|
|
:on-success="handleUploadSuccess"
|
|
@@ -149,7 +149,7 @@
|
|
|
<div class="marksDiv">
|
|
|
<el-input
|
|
|
class="gray"
|
|
|
- maxlength="1000"
|
|
|
+ maxlength="1000"
|
|
|
type="textarea"
|
|
|
:autosize="{ minRows: 3 }"
|
|
|
v-model="row.marks"
|
|
@@ -202,9 +202,18 @@ link.setAttribute("href", linkIco);
|
|
|
|
|
|
const caseId = ref(null);
|
|
|
const project = reactive({
|
|
|
- title: '我的脚本',
|
|
|
+ title: "我的脚本",
|
|
|
});
|
|
|
-const DrawFormats = [".jpg", ".jpeg", ".png",".mp4",".m4v",".mp3",".aac", ".wav"]
|
|
|
+const DrawFormats = [
|
|
|
+ ".jpg",
|
|
|
+ ".jpeg",
|
|
|
+ ".png",
|
|
|
+ ".mp4",
|
|
|
+ ".m4v",
|
|
|
+ ".mp3",
|
|
|
+ ".aac",
|
|
|
+ ".wav",
|
|
|
+];
|
|
|
const isNotFound = ref(false);
|
|
|
|
|
|
const dialogImageUrl = ref("");
|
|
@@ -261,16 +270,16 @@ const columns = ref([
|
|
|
{ prop: "marks", label: "备注" },
|
|
|
]);
|
|
|
const beforeUpload = async (file: File) => {
|
|
|
- const fileType = file.name
|
|
|
- .substring(file.name.lastIndexOf("."))
|
|
|
- .toUpperCase();
|
|
|
- if (!DrawFormats.some((type) => type.toUpperCase() === fileType)) {
|
|
|
- ElMessage.error(`请上传${DrawFormats}格式的文件`);
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
- };
|
|
|
+ const fileType = file.name
|
|
|
+ .substring(file.name.lastIndexOf("."))
|
|
|
+ .toUpperCase();
|
|
|
+ if (!DrawFormats.some((type) => type.toUpperCase() === fileType)) {
|
|
|
+ ElMessage.error(`请上传${DrawFormats}格式的文件`);
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+};
|
|
|
const checkSourceIsVideo = computed(() => (url: string) => {
|
|
|
return url.includes(".mp4") || url.includes(".m4v");
|
|
|
});
|
|
@@ -278,7 +287,12 @@ const checkSourceIsAudio = computed(() => (url: string) => {
|
|
|
return url.includes(".mp3") || url.includes(".aac") || url.includes(".wav");
|
|
|
});
|
|
|
const checkSourceIsImage = computed(() => (url: string) => {
|
|
|
- return url.includes(".jpg") || url.includes(".png") || url.includes(".jpeg") || url.includes(".gif");
|
|
|
+ return (
|
|
|
+ url.includes(".jpg") ||
|
|
|
+ url.includes(".png") ||
|
|
|
+ url.includes(".jpeg") ||
|
|
|
+ url.includes(".gif")
|
|
|
+ );
|
|
|
});
|
|
|
|
|
|
const getCoverUrl = computed(() => (url: string) => {
|
|
@@ -287,7 +301,10 @@ const getCoverUrl = computed(() => (url: string) => {
|
|
|
// return (
|
|
|
// url + "?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto"
|
|
|
// );
|
|
|
- case url.includes(".mp3") || url.includes(".aac") || url.includes(".wmv") || url.includes(".wav"):
|
|
|
+ case url.includes(".mp3") ||
|
|
|
+ url.includes(".aac") ||
|
|
|
+ url.includes(".wmv") ||
|
|
|
+ url.includes(".wav"):
|
|
|
return musicHeadphones;
|
|
|
default:
|
|
|
return url;
|
|
@@ -310,19 +327,32 @@ onMounted(async () => {
|
|
|
isNotFound.value = true;
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- isNotFound.value = true;
|
|
|
+ //TODO hack 由于没hook
|
|
|
+ if (error === "用户未登录") {
|
|
|
+ location.href = getRootLoginURl();
|
|
|
+ } else {
|
|
|
+ isNotFound.value = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
getCaseScriptList();
|
|
|
console.log("caseId", caseId); //query传参
|
|
|
});
|
|
|
|
|
|
+function getRootLoginURl() {
|
|
|
+ const currentPath = location.pathname.replace("/mirror.html", "");
|
|
|
+ const loginUrl =
|
|
|
+ location.protocol + "//" + location.host + currentPath + "/#/login";
|
|
|
+ console.log("loginUrl", loginUrl);
|
|
|
+ return loginUrl;
|
|
|
+}
|
|
|
+
|
|
|
function getCaseScriptList() {
|
|
|
getCaseScriptInfo(caseId.value)
|
|
|
.then((res) => {
|
|
|
- project.title = res && res.name || '我的脚本';
|
|
|
- data.list = res && res.content || [];
|
|
|
- data.newSortList = res && res.content || [];
|
|
|
+ project.title = (res && res.name) || "我的脚本";
|
|
|
+ data.list = (res && res.content) || [];
|
|
|
+ data.newSortList = (res && res.content) || [];
|
|
|
const idList = data.list.map((ele) => ele.id);
|
|
|
active.value = idList.length == 0 ? 0 : Math.max.apply(null, idList) || 1;
|
|
|
sortList.value = data.list.map((_, index) => index);
|
|
@@ -348,8 +378,7 @@ function handleAdd() {
|
|
|
// data.list.length = 0;
|
|
|
// Object.assign(data.list, content);
|
|
|
console.log("add", data.list, data.newSortList);
|
|
|
- if(data.newSortList.length == 0){
|
|
|
-
|
|
|
+ if (data.newSortList.length == 0) {
|
|
|
}
|
|
|
for (var i = 1; i <= addLine.value; i++) {
|
|
|
console.log(i);
|
|
@@ -389,11 +418,11 @@ const handlePictureCardPreview = (file: UploadFile) => {
|
|
|
const saveProject = () => {
|
|
|
// let content = sortList.value.map((index) => data.list[index]);
|
|
|
let apiDataList = data.newSortList.map((item) => {
|
|
|
- let asData = data.list.find(ele => ele.id === item.id) || {};
|
|
|
+ let asData = data.list.find((ele) => ele.id === item.id) || {};
|
|
|
return {
|
|
|
...item,
|
|
|
...asData,
|
|
|
- }
|
|
|
+ };
|
|
|
});
|
|
|
console.log("saveProject", data.list, data.newSortList);
|
|
|
CaseScriptSaveOrUpdate({
|