diff --git a/src/main/index.js b/src/main/index.js index 72d5a72..60f902a 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -8,8 +8,8 @@ File({ app, shell, BrowserWindow, ipcMain }) function createWindow() { // Create the browser window. const mainWindow = new BrowserWindow({ - width: 888, - height: 520, + width: 1050, + height: 650, show: false, frame: false, autoHideMenuBar: true, diff --git a/src/renderer/src/api/file/index.js b/src/renderer/src/api/file/index.js index d7e590b..8b03c3b 100644 --- a/src/renderer/src/api/file/index.js +++ b/src/renderer/src/api/file/index.js @@ -8,3 +8,9 @@ export const getSmarttalkPage = (params) => { params }) } +export function deleteSmarttalk(id) { + return request({ + url: '/smarttalk/file/' + id, + method: 'delete' + }) +} diff --git a/src/renderer/src/assets/main.css b/src/renderer/src/assets/main.css index 2598141..b76b451 100644 --- a/src/renderer/src/assets/main.css +++ b/src/renderer/src/assets/main.css @@ -32,3 +32,27 @@ html,body{ fill: currentColor; overflow: hidden; } +::-webkit-scrollbar { + width:5px; + height:5px; + background-color:#F5F5F5; +} +/* 滚动条上的滚动滑块. */ +::-webkit-scrollbar-thumb { + background-color: #a3b7cb; + border-radius: 50px; +} +/* 滚动条轨道. */ +::-webkit-scrollbar-track { + -webkit-box-shadow:inset 0 0 6px rgba(0, 142, 255, 1); + box-shadow:inset 0 0 6px rgba(0, 142, 255, 1); + background-color:#E7E3DF; +} +/* 滚动条没有滑块的轨道部分 */ +::-webkit-scrollbar-track-piece { + background-color: #E7E3DF; +} +/* 当同时有垂直滚动条和水平滚动条时交汇的部分. */ +::-webkit-scrollbar-corner { + background:transparent; +} diff --git a/src/renderer/src/components/upload-dialog/index.vue b/src/renderer/src/components/upload-dialog/index.vue index a8c7f7f..d171943 100644 --- a/src/renderer/src/components/upload-dialog/index.vue +++ b/src/renderer/src/components/upload-dialog/index.vue @@ -112,12 +112,7 @@ const hanleFileChange = (file) => { if (file.status === 'ready') { // 给一个默认的fileData file.fileData = { - textbookId: '123', - levelFirstId: '123', - levelSecondId: '123', - fileSource: '平台', - fileFlag: 1, - fileRoot: '资源' + fileFlag: 1 } fileList.value.push(file) } @@ -227,4 +222,4 @@ const submitFile = () => { } } } - \ No newline at end of file + diff --git a/src/renderer/src/layout/components/Uploader.vue b/src/renderer/src/layout/components/Uploader.vue index bfc5b9e..21488a6 100644 --- a/src/renderer/src/layout/components/Uploader.vue +++ b/src/renderer/src/layout/components/Uploader.vue @@ -119,7 +119,7 @@ export default { this.uploadDatas = this.uploadNow.fileData this.getFileMD5(this.uploadNow.raw).then((md5) => { this.uploadDatas.md5 = md5 - this.$refs.talk_uploader_core.handleStart(this.uploadNow.raw) + // this.$refs.talk_uploader_core.handleStart(this.uploadNow.raw) this.$refs.talk_uploader_core.submit() }) } diff --git a/src/renderer/src/utils/date.js b/src/renderer/src/utils/date.js new file mode 100644 index 0000000..4a1025d --- /dev/null +++ b/src/renderer/src/utils/date.js @@ -0,0 +1,78 @@ +// 判断是不是昨天 +const isYestday = (date) => { + var yesterday = new Date(new Date() - 1000 * 60 * 60 * 24) + return ( + yesterday.getYear() === date.getYear() && + yesterday.getMonth() === date.getMonth() && + yesterday.getDate() === date.getDate() + ) +} + +// 判断是不是今年 +const isYear = (date) => { + return date.getYear() === new Date().getYear() +} + +//将时间转为 yy/mm/dd hh:mm:ss +const formatDateTime = (date) => { + if (!date) { + return '' + } + var dateObject = new Date(date) + var y = dateObject.getFullYear() + var m = dateObject.getMonth() + 1 + m = m < 10 ? '0' + m : m + var d = dateObject.getDate() + d = d < 10 ? '0' + d : d + var h = dateObject.getHours() + h = h < 10 ? '0' + h : h + var minute = dateObject.getMinutes() + minute = minute < 10 ? '0' + minute : minute + var second = dateObject.getSeconds() + second = second < 10 ? '0' + second : second + return y + '/' + m + '/' + d + ' ' + h + ':' + minute + ':' + second +} + +/** + * 将时间戳转换为文本描述。 + * + * 此函数旨在将时间戳转换为更易读的文本格式,以便用户可以更直观地理解时间信息。 + * 通过传入的时间,函数将生成对应的时间文本,如"刚刚"、"5分钟前"、"昨天"等。 + * 如果设置了simple参数为true,则会返回更简单的23/06/25,只显示年月日,如果是今年只返回月和日。 + * + * @param {string} timeStamp - 需要转换的时间。 + * @param {boolean} simple - 是否使用简单的格式,默认为false,如:23/06/25、06/25。 + * @returns {string} - 转换后的时间文本。 + */ +export const toTimeText = (timeStamp, simple) => { + if (!timeStamp) { + return '' + } + var dateTime = new Date(timeStamp) + var currentTime = Date.parse(new Date()) //当前时间 + var timeDiff = currentTime - dateTime //与当前时间误差 + var timeText = '' + if (timeDiff <= 60000) { + //一分钟内 + timeText = '刚刚' + } else if (timeDiff > 60000 && timeDiff < 3600000) { + //1小时内 + timeText = Math.floor(timeDiff / 60000) + '分钟前' + } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { + //今日 + timeText = formatDateTime(dateTime).substr(11, 5) + } else if (isYestday(dateTime)) { + //昨天 + timeText = '昨天' + formatDateTime(dateTime).substr(11, 5) + } else if (isYear(dateTime)) { + //今年 + timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14) + } else { + //不属于今年 + timeText = formatDateTime(dateTime) + if (simple) { + timeText = timeText.substr(2, 8) + } + } + return timeText +} diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index be39e8a..4a60228 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -1,6 +1,6 @@