zhuhao_dev #14

Merged
zhuhao merged 2 commits from zhuhao_dev into main 2024-07-11 14:31:52 +08:00
5 changed files with 38 additions and 16 deletions
Showing only changes of commit ed6fd5e89b - Show all commits

View File

@ -1,5 +1,5 @@
import { resolve } from 'path' import { resolve } from 'path'
// const path = require('path') import path from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite' import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import WindiCSS from "vite-plugin-windicss" import WindiCSS from "vite-plugin-windicss"
@ -14,15 +14,16 @@ export default defineConfig({
renderer: { renderer: {
resolve: { resolve: {
alias: { alias: {
'@': resolve('./src/renderer/src'), // '@': resolve('./src/renderer/src'),
// '@': path.join(__dirname, './src/renderer/src'), // '@': path.resolve(__dirname, 'src/renderer/src'),
'@': path.join(__dirname, './src/renderer/src'),
} }
}, },
server: { server: {
proxy: { proxy: {
'/dev-api': { '/dev-api': {
target: 'http://27.128.240.72:7865', // target: 'http://27.128.240.72:7865',
// target: 'http://192.168.2.52:7863', target: 'http://192.168.2.52:7863',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')
}, },

14
jsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*":[
"src/renderer/src/*"
]
}
},
"exclude": [
"node_modeules",
"dist"
]
}

View File

@ -0,0 +1,10 @@
// 查询evaluation列表
import request from '@/utils/request'
export const getSmarttalkPage = (params) => {
return request({
url: '/smarttalk/file/getSmarttalkPage',
method: 'post',
params
})
}

View File

@ -16,7 +16,8 @@
</template> </template>
<script> <script>
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js'
export default { export default {
name: 'Prepare', name: 'Prepare',
props: { props: {
@ -38,16 +39,12 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
beforeUpload(file) { beforeUpload(file) {
const fileReader = new FileReader(); const fileReader = new FileReader()
console.log(file)
fileReader.onload = (e) => { fileReader.onload = (e) => {
const buffer = e.target.result; const buffer = e.target.result
const md5 = CryptoJS.MD5(buffer).toString(); this.uploadDatas.md5 = CryptoJS.MD5(buffer).toString()
console.log('文件的MD5是:', md5); }
this.uploadDatas.md5 = md5; fileReader.readAsArrayBuffer(file)
// 使md5
};
fileReader.readAsArrayBuffer(file);
} }
} }
} }

View File

@ -1 +1 @@
<template> <div> <FileUpload :multiple="true" :upload-data="uploadData" ></FileUpload> </div> </template> <script> import FileUpload from '@/components/file-upload/index.vue' const { ipcRenderer } = window.electron || {} export default { name: 'Prepare', components: { FileUpload }, data() { return { fileUrl: "https://wzyzoss.eos-chongqing-3.cmecloud.cn/2024/7/10/117cdf208c6b4e58bf2b73369eaf3cb5.pptx", filePath: "C:/Users/zhuhao/Desktop/工作文档/0901高一【数学(人教A版)】集合的概念-PPT课件.pptx", uploadData: { textbookId: '123', levelFirstId: '123', levelSecondId: '123', fileSource: '平台', fileFlag: '课件' } } }, created() { ipcRenderer.removeAllListeners('copy-file-default-reply'); ipcRenderer.on('copy-file-default-reply', (e,param)=>{ this.callback(param) }) }, mounted() { // const destination = '0901高一【数学(人教A版)】集合的概念-PPT课件.pptx' setTimeout(()=>{ // ipcRenderer.send('open-path-app',this.filePath) // const source = 'D:\\edufile\\0901高一【数学(人教A版)】集合的概念-PPT课件.pptx' // ipcRenderer.send('copy-file-default',{ source, destination }) ipcRenderer.send('download-file-default',this.fileUrl) },2000) }, methods: { callback({error, filePath}) { if (error) { console.error('An error occurred:', error) return } console.log('File copied to:', filePath) } } } </script> <style scoped lang="scss"></style> <template> <div> <FileUpload :multiple="true" :upload-data="uploadData" ></FileUpload> </div> </template> <script> import FileUpload from '@/components/file-upload/index.vue' import { getSmarttalkPage } from '@/api/file' const { ipcRenderer } = window.electron || {} export default { name: 'Prepare', components: { FileUpload }, data() { return { fileUrl: "https://wzyzoss.eos-chongqing-3.cmecloud.cn/2024/7/10/117cdf208c6b4e58bf2b73369eaf3cb5.pptx", filePath: "C:/Users/zhuhao/Desktop/工作文档/0901高一【数学(人教A版)】集合的概念-PPT课件.pptx", uploadData: { textbookId: '123', levelFirstId: '123', levelSecondId: '123', fileSource: '平台', fileFlag: '课件' } } }, created() { ipcRenderer.removeAllListeners('copy-file-default-reply'); ipcRenderer.on('copy-file-default-reply', (e,param)=>{ this.callback(param) }) }, mounted() { // const destination = '0901高一【数学(人教A版)】集合的概念-PPT课件.pptx' setTimeout(()=>{ // ipcRenderer.send('open-path-app',this.filePath) // const source = 'D:\\edufile\\0901高一【数学(人教A版)】集合的概念-PPT课件.pptx' // ipcRenderer.send('copy-file-default',{ source, destination }) // ipcRenderer.send('download-file-default',this.fileUrl) },2000) getSmarttalkPage({nowPage:1,pageSize:2}).then(res=>{ console.log(res) }) }, methods: { callback({error, filePath}) { if (error) { console.error('An error occurred:', error) return } console.log('File copied to:', filePath) } } } </script> <style scoped lang="scss"></style>