diff --git a/src/apis/myCreating.js b/src/apis/myCreating.js
new file mode 100644
index 0000000..5f8e2da
--- /dev/null
+++ b/src/apis/myCreating.js
@@ -0,0 +1,27 @@
+import request from "@/utils/request.js";
+
+const baseURL = import.meta.env.VITE_APP_BASE_API
+
+/**
+ * @description 获取我的视频作品
+ * @params pageSize,pageNum
+ * @returns data
+ */
+export function userPhotoVideoList(pageSize, pageNum, title) {
+ return request({
+ url: `/api/userPhotoVideo/list?pageSize=${pageSize}&pageNum=${pageNum}&title=${title}`,
+ method: 'get'
+ })
+}
+
+/**
+ * @description 删除视频作品
+ * @params videoID
+ * @returns data
+ */
+export function delUserPhotoVideoByID(videoID) {
+ return request({
+ url: `/api/userPhotoVideo/del?id=${videoID}`,
+ method: 'get'
+ })
+}
\ No newline at end of file
diff --git a/src/lang/package/en.ts b/src/lang/package/en.ts
index f95a529..82a9e15 100644
--- a/src/lang/package/en.ts
+++ b/src/lang/package/en.ts
@@ -47,12 +47,20 @@ export default {
// 我的视频
myCreating: {
title: "My Creating",
- typeTitle: "Type a title",
+ search: "Search...",
name: "Name",
date: "Date",
+ videoTitle: "Video Title:",
download: "Download",
delete: "Delete",
more: "More",
+ draft: "Draft",
+ generating: "Generating",
+ generationFailed: "Failed",
+ generationSucceed: "Succeed",
+ draftText: "Draft",
+ generatingText: "The video is generating, please wait a moment",
+ generationFailedText: "The video generate is failed, Reason:",
},
// 个人账户
diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts
index a37681e..4990bc8 100644
--- a/src/lang/package/zh-cn.ts
+++ b/src/lang/package/zh-cn.ts
@@ -47,12 +47,20 @@ export default {
// 我的视频
myCreating: {
title: "我的视频",
- typeTitle: "输入标题",
+ search: "搜索:我的视频",
name: "名称",
date: "时间",
+ videoTitle: "视频标题:",
download: "下载",
delete: "删除",
more: "更多",
+ draft: "草稿",
+ generating: "生成中",
+ generationFailed: "生成失败",
+ generationSucceed: "生成成功",
+ draftText: "草稿",
+ generatingText: "视频正在生成中,请稍等哦",
+ generationFailedText: "视频生成失败。原因:",
},
// 个人账户
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 5b1d250..1c95584 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -18,7 +18,7 @@
- -
+
diff --git a/src/permission.ts b/src/permission.ts
index f9087ec..fd471e7 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -16,7 +16,7 @@ router.beforeEach(async (to, from, next) => {
// 已登录
if (AccessToken) {
if (to.path === "/login") {
- next({ path: "/" });
+ next({ path: "/createVideo" });
} else {
next();
}
diff --git a/src/types/components.d.ts b/src/types/components.d.ts
index d67af9e..3e97630 100644
--- a/src/types/components.d.ts
+++ b/src/types/components.d.ts
@@ -38,6 +38,7 @@ declare module '@vue/runtime-core' {
IEpEdit: typeof import('~icons/ep/edit')['default']
IEpGoods: typeof import('~icons/ep/goods')['default']
IEpMenu: typeof import('~icons/ep/menu')['default']
+ IEpSearch: typeof import('~icons/ep/search')['default']
IEpSetting: typeof import('~icons/ep/setting')['default']
IEpVideoPlay: typeof import('~icons/ep/video-play')['default']
LangSelect: typeof import('./../components/LangSelect/index.vue')['default']
diff --git a/src/utils/request.js b/src/utils/request.js
index f714b9e..151c1b1 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -1,5 +1,5 @@
import axios from 'axios'
-import router from '@/router'
+import router from '@/router/index'
import { ElMessage } from 'element-plus'
ElMessage
@@ -35,25 +35,19 @@ request.interceptors.request.use(
request.interceptors.response.use(
function (response) {
let code = response.data.code
- // 当token过期或损坏时
+ // 当token无效(过期或损坏)时
if (code == 1052) {
+ localStorage.removeItem("AccessToken");
router.push("/login");
ElMessage.error("登录过期,请重新登录!");
return
-
// 弹出错误
} else if (code != 200) {
- if (code == 1053) {
- router.push("/login");
- // Toast.fail("请您先登录!");
- return
-
- } else if (code == 500) {
+ if (code == 500) {
ElMessage.error("系统异常,请稍后再试");
// 其他错误
} else {
-
return Promise.reject(response.data)
}
} else {
diff --git a/src/utils/tools.js b/src/utils/tools.js
new file mode 100644
index 0000000..218bf50
--- /dev/null
+++ b/src/utils/tools.js
@@ -0,0 +1,168 @@
+/**
+* @description:使用JSON进行深度拷贝
+*/
+export function deepCopy(data) {
+ const copyData = JSON.stringify(data)
+ return JSON.parse(copyData)
+}
+
+/**
+* @description 将bytes转化
+* @param {number} bytes
+* @return string
+*/
+export function bytesToSize(bytes) {
+ if (bytes === 0) return '0 B';
+ var k = 1000, // or 1024
+ sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
+ i = Math.floor(Math.log(bytes) / Math.log(k));
+
+ return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
+}
+
+/**
+* @description 秒转化时分秒
+* @param {number} seconds
+* @return string
+*/
+export function formatSeconds(value) {
+ var theTime = parseInt(value);// 秒
+ var theTime1 = 0;// 分
+ var theTime2 = 0;// 小时
+ if (theTime > 60) {
+ theTime1 = parseInt(theTime / 60);
+ theTime = parseInt(theTime % 60);
+ if (theTime1 > 60) {
+ theTime2 = parseInt(theTime1 / 60);
+ theTime1 = parseInt(theTime1 % 60);
+ }
+ }
+ var result = "" + parseInt(theTime) + " 秒";
+ if (theTime1 > 0) {
+ result = "" + parseInt(theTime1) + " 分" + result;
+ }
+ if (theTime2 > 0) {
+ result = "" + parseInt(theTime2) + " 小时" + result;
+ }
+ return result;
+}
+
+/**
+* @description:滚动到对应id的位置
+* @param {type} id
+*/
+export function scrollToID(id) {
+ document.querySelector("#" + id).scrollIntoView({
+ behavior: "smooth",
+ block: "start",
+ inline: "nearest",
+ });
+}
+
+/**
+* @description 根据时间戳获取时间
+* @param {*} timestamp 必传,number类型,时间戳数据(10位及以下,10位至13位)
+* @param {*} format 选传,string类型,提供以下时间格式:YYYY-MM-DD hh:mm:ss、YYYY/MM/DD hh:mm:ss、YYYY.MM.DD hh:mm:ss、YYYY MM DD hh:mm:ss、YYYY年MM月DD日 hh:mm:ss、YYYY-MM-DD、YYYY/MM/DD、YYYY.MM.DD、YYYY MM DD、YYYY年MM月DD日;若不传,则默认为:YYYY-MM-DD
+* @returns 根据要求的时间格式
+* @version V 1.0, Created by YWQ, 2022.10.20
+*/
+export function timestampToTime(timestamp, format) {
+ //时间戳为10位需*1000,时间戳为13位不需乘1000
+ const length = timestamp && timestamp.length ? timestamp.length : ''
+ if (!length) return ""
+ let date
+ if (length <= 10) {
+ date = new Date(timestamp * 1000)
+ } else {
+ date = new Date(timestamp)
+ }
+ let Y = String(date.getFullYear())
+ let M = String(date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
+ let D = String(date.getDate() + 1 < 10 ? '0' + (date.getDate()) : date.getDate())
+ let h = String(date.getHours() + 1 < 10 ? '0' + (date.getHours()) : date.getHours())
+ let m = String(date.getMinutes() + 1 < 10 ? '0' + (date.getMinutes()) : date.getMinutes())
+ let s = String(date.getSeconds() + 1 < 10 ? '0' + (date.getSeconds()) : date.getSeconds())
+ // return Y + M + D + h + m + s
+ if (format == "YYYY-MM-DD hh:mm:ss") {
+ return Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s
+ } else if (format == "YYYY/MM/DD hh:mm:ss") {
+ return Y + "/" + M + "/" + D + " " + h + ":" + m + ":" + s
+ } else if (format == "YYYY.MM.DD hh:mm:ss") {
+ return Y + "." + M + "." + D + " " + h + ":" + m + ":" + s
+ } else if (format == "YYYY MM DD hh:mm:ss") {
+ return Y + " " + M + " " + D + " " + h + ":" + m + ":" + s
+ } else if (format == "YYYY年MM月DD日 hh:mm:ss") {
+ return Y + "年" + M + "月" + D + "日" + " " + h + ":" + m + ":" + s
+ } else if (format == "YYYY-MM-DD") {
+ return Y + "-" + M + "-" + D
+ } else if (format == "YYYY/MM/DD") {
+ return Y + "/" + M + "/" + D
+ } else if (format == "YYYY.MM.DD") {
+ return Y + "." + M + "." + D
+ } else if (format == "YYYY MM DD") {
+ return Y + " " + M + " " + D
+ } else if (format == "YYYY年MM月DD日") {
+ return Y + "年" + M + "月" + D + "日"
+ } else {
+ return Y + "-" + M + "-" + D
+ }
+}
+
+// /**
+// * @description:获取设备类型
+// * @returns PC端为null,移动端为设备类型(Array)
+// */
+// export function getDeviceType() {
+// return navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
+// }
+
+/**
+* @description:根据经纬度计算距离
+* @param {*} locationInfo (lat1, lng1, lat2, lng2)
+* @return: distanceObj: { distance , distance_str }
+*/
+export function getDistances(lat1, lng1, lat2, lng2) {
+
+ function rad(d) {
+ return d * Math.PI / 180.0;
+ }
+ var radLat1 = rad(lat1);
+ var radLat2 = rad(lat2);
+ var a = radLat1 - radLat2;
+ var b = rad(lng1) - rad(lng2);
+ var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
+ Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
+ s = s * 6378.137;
+ s = Math.round(s * 10000) / 10000;
+
+ var distance = s;
+ var distance_str = "";
+
+ if (parseInt(distance) >= 1) {
+ distance_str = distance.toFixed(2) + "km";
+ } else {
+ distance_str = (distance * 1000).toFixed(2) + "m";
+ }
+
+ let objData = {
+ distance: distance,
+ distance_str: distance_str
+ }
+ return objData
+}
+
+/**
+* @description:文本打字机
+* @param {*} data (text,target,duration)
+*/
+export function typeWriter(text, target, duration) {
+ let i = 0;
+ let timer = setInterval(() => {
+ target += text[i];
+ if (i + 1 == text.length) {
+ clearInterval(timer);
+ } else {
+ i++;
+ }
+ }, duration || 100);
+}
diff --git a/src/views/myCreating/index.vue b/src/views/myCreating/index.vue
index 6dcd18d..aa323f3 100644
--- a/src/views/myCreating/index.vue
+++ b/src/views/myCreating/index.vue
@@ -3,19 +3,41 @@
-
+
+
+
+ {{ $t("myCreating." + item.statusName) }}
+
+
- {{ $t("myCreating.name") }}
- {{ $t("myCreating.date") }}
+ {{ item.title }}
+ {{ item.createDate }}
...
-
+
{{ $t("myCreating.download") }}
-
+
@@ -47,24 +72,38 @@
destroy-on-close
class="elDialog"
v-model="showDialog"
- :title="presentVideo"
+ :title="presentItem.title"
width="40%"
center
>
+
+ {{ $t("myCreating." + presentItem.statusName + "Text") }}
+ {{
+ presentItem.videoMsg
+ }}
+
-
+