Merge pull request 'zhuhao_dev' (#14) from zhuhao_dev into main

Reviewed-on: #14
This commit is contained in:
朱浩 2024-07-11 14:31:51 +08:00
commit 86725d05a8
5 changed files with 38 additions and 16 deletions

View File

@ -1,5 +1,5 @@
import { resolve } from 'path'
// const path = require('path')
import path from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from "vite-plugin-windicss"
@ -14,15 +14,16 @@ export default defineConfig({
renderer: {
resolve: {
alias: {
'@': resolve('./src/renderer/src'),
// '@': path.join(__dirname, './src/renderer/src'),
// '@': resolve('./src/renderer/src'),
// '@': path.resolve(__dirname, 'src/renderer/src'),
'@': path.join(__dirname, './src/renderer/src'),
}
},
server: {
proxy: {
'/dev-api': {
target: 'http://27.128.240.72:7865',
// target: 'http://192.168.2.52:7863',
// target: 'http://27.128.240.72:7865',
target: 'http://192.168.2.52:7863',
changeOrigin: true,
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>
<script>
import { getToken } from '@/utils/auth'
import CryptoJS from 'crypto-js';
import CryptoJS from 'crypto-js'
export default {
name: 'Prepare',
props: {
@ -38,16 +39,12 @@ export default {
mounted() {},
methods: {
beforeUpload(file) {
const fileReader = new FileReader();
console.log(file)
const fileReader = new FileReader()
fileReader.onload = (e) => {
const buffer = e.target.result;
const md5 = CryptoJS.MD5(buffer).toString();
console.log('文件的MD5是:', md5);
this.uploadDatas.md5 = md5;
// 使md5
};
fileReader.readAsArrayBuffer(file);
const buffer = e.target.result
this.uploadDatas.md5 = CryptoJS.MD5(buffer).toString()
}
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>