- 编辑
- 删除
+
+
+ 编辑
+
+
+ 删除
+
-
+
// 组件
-import Vue from "vue";
-import { Toast, Dialog } from "vant";
-import { mapState, mapActions } from "vuex";
-import HeadTop from "@/components/common/head.vue";
+import Vue from 'vue'
+import { Toast, Dialog } from 'vant'
+import { mapState, mapActions } from 'vuex'
+import HeadTop from '@/components/common/head.vue'
// 工具
import {
bytesToSize,
timestampToTime,
scrollToID,
- formatSeconds,
-} from "../../utils";
+ formatSeconds
+} from '../../utils'
// 接口
import {
getVideoList,
doGetVideoDetialById,
doFindInviteCode,
- deleteVideoById,
-} from "../../api/myPage";
+ deleteVideoById
+} from '../../api/myPage'
-Vue.use(Toast);
+Vue.use(Toast)
export default {
components: {
- HeadTop,
+ HeadTop
},
data() {
return {
- showPopup:false,// 编辑和删除显示隐藏
- clickItem: -1,// 弹出层显示隐藏
- showTrue: true,// 弹出层显示隐藏
- showFalse: false,// 弹出层显示隐藏
+ showPopup: false, // 编辑和删除显示隐藏
+ clickItem: -1, // 弹出层显示隐藏
+ showTrue: true, // 弹出层显示隐藏
+ showFalse: false, // 弹出层显示隐藏
inPage: false,
isShowMessageCover: false,
videoList: [],
currentPage: 1,
pageSize: 4,
- prePage: "",
- total: "",
- };
+ prePage: '',
+ total: ''
+ }
},
computed: {
...mapState({
- characters: (state) => state.publicObj.characters,
- }),
+ characters: (state) => state.publicObj.characters
+ })
},
methods: {
- ...mapActions(["setCharacters"]),
+ ...mapActions(['setCharacters']),
closeDialog() {
Dialog.close
},
// 点击显示编辑删除
showDialog(id) {
- this.showPopup=true
- this.clickItem=id
+ this.showPopup = true
+ this.clickItem = id
},
go(url) {
- this.$router.push(url);
+ this.$router.push(url)
},
changeTime(timestamp, form) {
- return timestampToTime(timestamp, form);
+ return timestampToTime(timestamp, form)
},
pageChange() {
- this.loadVideoList(this.currentPage, this.pageSize);
+ this.loadVideoList(this.currentPage, this.pageSize)
},
// 点击空白区域退出提示
exitCover(e) {
- if (e.srcElement.id != "message") {
- this.isShowMessageCover = false;
+ if (e.srcElement.id != 'message') {
+ this.isShowMessageCover = false
}
},
// 秒转化时分秒
formatSeconds(seconds) {
if (seconds) {
- return formatSeconds(seconds);
+ return formatSeconds(seconds)
} else {
- return "无";
+ return '无'
}
},
// 将bytes转化
bytesToSize(bytes) {
if (bytes) {
- return bytesToSize(bytes);
+ return bytesToSize(bytes)
} else {
- return "无";
+ return '无'
}
},
// 查看详情
goDetail(item) {
- const status = item.videoStatus;
+ const status = item.videoStatus
if (status == 0) {
this.$router.push({
- path: "/getPaper",
+ path: '/getPaper',
query: {
- id: item.id,
- },
- });
+ id: item.id
+ }
+ })
} else if (status == 1) {
- Toast.fail("视频生成中");
- return;
+ Toast.fail('视频生成中')
+ return
} else if (status == 2) {
- const url = item.videoPathUri + item.videoPath;
+ const url = item.videoPathUri + item.videoPath
this.$router.push({
- path: "/downloadVideo",
+ path: '/downloadVideo',
query: {
videoId: item.videoId,
- videoUrl: url,
- },
- });
+ videoUrl: url
+ }
+ })
} else if (status == 3) {
this.$router.push({
- path: "/getPaper",
+ path: '/getPaper',
query: {
- id: item.id,
- },
- });
+ id: item.id
+ }
+ })
}
},
// 删除作品
goDelete(id) {
Dialog.confirm({
- title: "删除作品",
- message: "您确定要删除该作品吗?",
+ title: '删除作品',
+ message: '您确定要删除该作品吗?'
})
- .then(async() => {
- await this.deleteVideoById(id);
- this.loadVideoList(this.currentPage, this.pageSize);
+ .then(async () => {
+ await this.deleteVideoById(id)
+ this.loadVideoList(this.currentPage, this.pageSize)
})
.catch(() => {
- return;
- });
+ return
+ })
},
/**
@@ -255,13 +258,13 @@ export default {
*/
async loadVideoList(pageNum, pageSize) {
try {
- const res = await getVideoList(pageNum, pageSize);
- console.log(res, "获取作品列表");
- this.videoList = res.data.list;
- this.total = res.data.total;
+ const res = await getVideoList(pageNum, pageSize)
+ console.log(res, '获取作品列表')
+ this.videoList = res.data.list
+ this.total = res.data.total
} catch (error) {
- console.log(error, "error");
- Toast.fail(error.message);
+ console.log(error, 'error')
+ Toast.fail(error.message)
}
},
@@ -270,12 +273,12 @@ export default {
*/
async getVideoDetialById(id) {
try {
- const res = await doGetVideoDetialById(id);
- console.log(res, "通过视频id获取视频详情");
- return res.data;
+ const res = await doGetVideoDetialById(id)
+ console.log(res, '通过视频id获取视频详情')
+ return res.data
} catch (error) {
- console.log(error, "error");
- Toast.fail(error.message);
+ console.log(error, 'error')
+ Toast.fail(error.message)
}
},
@@ -284,11 +287,11 @@ export default {
*/
async deleteVideoById(id) {
try {
- const res = await deleteVideoById(id);
- console.log(res, "根据id删除作品");
+ const res = await deleteVideoById(id)
+ console.log(res, '根据id删除作品')
} catch (error) {
- console.log(error, "error");
- Toast.fail(error.message);
+ console.log(error, 'error')
+ Toast.fail(error.message)
}
},
@@ -297,37 +300,37 @@ export default {
*/
async checkInviteCode() {
try {
- const res = await doFindInviteCode();
- console.log(res, "查询用户邀请码数据");
- const status = res.data.status;
+ const res = await doFindInviteCode()
+ console.log(res, '查询用户邀请码数据')
+ const status = res.data.status
// 当没有邀请码时
if (status == 0) {
- scrollToID("top");
- this.isShowMessageCover = true;
+ scrollToID('top')
+ this.isShowMessageCover = true
} else if (status == 1) {
- this.goCreateNew();
+ this.goCreateNew()
}
} catch (error) {
- console.log(error, "error");
- Toast.fail(error.message);
+ console.log(error, 'error')
+ Toast.fail(error.message)
}
},
goCreateNew() {
- this.$router.push("/chooseModel");
- },
+ this.$router.push('/chooseModel')
+ }
},
mounted() {
- this.inPage = true;
- scrollToID("top");
+ this.inPage = true
+ scrollToID('top')
},
created() {
- this.loadVideoList(1, this.pageSize);
- },
-};
+ this.loadVideoList(1, this.pageSize)
+ }
+}