BUG修复

This commit is contained in:
朱浩 2025-01-15 16:16:30 +08:00
parent afa1fd2f8d
commit ca6efb4d66
8 changed files with 209 additions and 5 deletions

View File

@ -14,7 +14,7 @@
"build:unpack": "npm run build && electron-builder --dir",
"build:dev": "npm run build && electron-builder --win --config ./electron-builder-test.yml",
"build:test": "node updatePackageJsonName.js && electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
"build": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
"build:prod": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
"build:yc": "node updatePackageJsonName.js && electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
"build:yc2": "node updatePackageJsonName.js && electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
"build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml",
@ -42,7 +42,7 @@
"@vue-office/excel": "^1.7.11",
"@vue-office/pdf": "^2.0.2",
"@vueuse/core": "^10.11.0",
"aix-plugins-aitools": "^1.1.0",
"aix-plugins-aitools": "^1.1.5",
"animate.css": "^4.1.1",
"circular-json": "^0.5.9",
"clipboard": "^2.0.11",
@ -139,4 +139,4 @@
"vue-tsc": "^1.8.25",
"windicss": "^3.5.6"
}
}
}

View File

@ -14,6 +14,7 @@
<body>
<div id="app"></div>
<script src="./public/lib/build/aws-sdk-2.100.0.min.js"></script>
<script type="module" src="/src/main.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -94,4 +94,19 @@ export const addFileToSC = (params) => {
method: 'post',
params
})
}
}
export const createSignature = (data) => {
return request({
url: '/eos/createSignature',
method: 'post',
data
})
}
export const sessionToken = () => {
return request({
url: '/eos/sessionToken',
method: 'get'
})
}

View File

@ -0,0 +1,135 @@
<template>
<!-- <form @submit.prevent="submitForm" enctype="multipart/form-data">-->
<form action="https://wzyzoss.eos-chongqing-3.cmecloud.cn" method="post" enctype="multipart/form-data">
<!-- action 是具体要上传的地址 -->
<!--
上传后文件Object:
<input type="input" name="key" :value="uploadData.key" placeholder="文件名" style="width: 400px"/><br/><br/>
ACL
<input type="hidden" name="acl" :value="uploadData.acl" placeholder="文件 ACL" style="width: 400px"/><br/><br/>
Content-Type:
<input type="input" name="Content-Type" :value="uploadData['Content-Type']" placeholder="文件类型" style="width: 400px"/><br/><br/>
X-Amz-Credential
<input type="text" name="X-Amz-Credential" :value="uploadData['x-amz-credential']" placeholder="X-Amz-Credential从后端程序返回中获取" style="width: 400px"/><br/><br/>
X-Amz-Algorithm
<input type="text" name="X-Amz-Algorithm" :value="uploadData['x-amz-algorithm']" placeholder="X-Amz-Algorithm 从后端程序返回中获取" style="width: 400px"/><br/><br/>
X-Amz-Date
<input type="text" name="X-Amz-Date" :value="uploadData['x-amz-date']" placeholder="X-Amz-Date 从后端程序返回中获取" style="width: 400px"><br/><br/>
Policy
<input type="text" name="Policy" :value="uploadData.policy" placeholder="Policy 从后端程序返回中获取" style="width: 400px"/><br/><br/>
X-Amz-Signature
<input type="text" name="X-Amz-Signature" :value="uploadData['x-amz-signature']" placeholder="X-Amz-Signature 从后端程序返回中获取" style="width: 400px"/><br/><br/>
-->
选择文件Object
<input type="file" name="file" @change="handleFileChange" style="width: 400px"/> <br/><br/>
<input type="submit" name="submit" value="上传到 EOS" style="width: 400px"/><br/><br/>
<el-button @click="uploadFile">上传</el-button>
</form>
</template>
<script setup>
import {ref, onMounted} from "vue"
import {createSignature, sessionToken} from "@/api/file";
import axios from "axios"
const url = "https://wzyzoss.eos-chongqing-3.cmecloud.cn"
const uploadData = ref({
"bucket": "wzyzoss",
"x-amz-date": "20250113T061000Z",
"x-amz-signature": "2d6fba9f27544bfc7414d660e2e73aafdaf02fe3de45e68f59d580276239cd07",
"acl": "private",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"key": "wzyzossa",
"x-amz-credential": "07ICFAF4IWWZP6RH0WCG/20250113/us-east-1/s3/aws4_request",
"Content-Type": null,
"policy": "eyJleHBpcmF0aW9uIjoiMjAyNS0wMS0xM1QwNzoxMDowMC42NzVaIiwiY29uZGl0aW9ucyI6W3sieC1hbXotZGF0ZSI6IjIwMjUwMTEzVDA2MTAwMFoifSx7ImFjbCI6InByaXZhdGUifSx7ImJ1Y2tldCI6Ind6eXpvc3MifSxbInN0YXJ0cy13aXRoIiwiJGtleSIsInd6eXpvc3NhIl0sWyJzdGFydHMtd2l0aCIsIiRDb250ZW50LVR5cGUiLCJudWxsIl0seyJ4LWFtei1hbGdvcml0aG0iOiJBV1M0LUhNQUMtU0hBMjU2In0seyJ4LWFtei1jcmVkZW50aWFsIjoiMDdJQ0ZBRjRJV1daUDZSSDBXQ0cvMjAyNTAxMTMvdXMtZWFzdC0xL3MzL2F3czRfcmVxdWVzdCJ9LFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDEsMTAwMDAwXV19"
})
const submitForm = ()=> {
let formData = new FormData();
for (const formDataKey in formData) {
formData.append(formDataKey, formData[formDataKey]);
}
axios.post(url, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
console.log('表单提交成功,服务器响应:', response.data);
})
.catch(error => {
console.log('表单提交失败:', error);
});
}
const S3Data = {
apiVersion: "2006-03-01",
accessKeyId: "2UYNH48SKS4O3WB4W4OI", // access key ID
secretAccessKey: "spwk4vcPbQUa3n7H8AwOFWqhK712XUX23CrUlwC8", // secret access key
endpoint: "eos-chongqing-3.cmecloud.cn",
signatureVersion: "v2",
sslEnabled: true // HTTPS
}
let selectedFile = null
const handleFileChange = (event)=> {
//
selectedFile = event.target.files[0];
}
const uploadMessage = ref(null)
const uploadFile = ()=>{
if (selectedFile) {
console.log(S3Data)
// AWS.S3
const s3 = new AWS.S3(S3Data);
let params = {
Key: selectedFile.name,
Bucket: "wzyzoss",
ContentType: selectedFile.type,
Body: selectedFile
}
console.log(params)
s3.putObject(params, function (err, data) {
console.log(err,data)
});
}
}
onMounted(()=>{
console.log(AWS)
/*createSignature({objectName:"123.jpg",contentType:"image/png"}).then(res=>{
uploadData.value = res.body
})*/
sessionToken().then(res=>{
uploadMessage.value = res.data
console.log(res.data)
S3Data.accessKeyId = res.data.accessKeyId
// S3Data.accessKeyId = "kzOm2cc7nT12ao907Tc"
S3Data.secretAccessKey = res.data.secretAccessKey
// S3Data.secretAccessKey = "MYXV8Z3UKZVQETFNKQKLJQA67II6E3YEY8RODCV"
S3Data.endpoint = res.data.endPoint
S3Data.sessionToken = res.data.sessionToken
// S3Data.sessionToken = "zPpRolsWE3n7fbmqdt/tzyoSeYULFedptLuKdnJBag5X9y73fitu93WPLMMqYQzYTR+mg86jxs3IQJjOpgFRShdiNB2/mWRvfyeEZ3xo6cRMYnFXSLASIxCyvAH48pH6Z1pI3NuqtaZzlx7zdeoHYCskOuzBXoLhxN1cCXTg3AEZqQ0K4v1RcPIi4cD/YE+XCa+V7DjYU2Bs9zxZ4I52wXOtdnTg9Gj+MwfT+CywOio="
S3Data.apiVersion = "2006-03-01"
})
})
</script>
<style scoped lang="scss">
</style>

View File

@ -411,12 +411,14 @@ export const dataSetJson = {
"考试-小学-语文": "570f7ed2cc9d11ef9e070242ac140002",
"考试-小学-数学": "983270b8cc9d11efbbd80242ac140002",
"考试-小学-英语": "d5f80e4ccc9d11ef96fa0242ac140002",
"课标-小学-信息科技": "2fe08c7ad18911efbeaa0242ac140002",
"课标-小学-科学": "935cfec8bf6a11ef98950242ac140006",
"课标-小学-数学": "3c4e298fbf7911ef8e8b0242ac140002",
"课标-小学-语文": "f76f1aa5bf7111ef90c80242ac140002",
"课标-小学-道德": "8da87869cbd711ef92280242ac140002",
"课标-小学-英语": "dc963316cbd811ef8d820242ac140002",
"课标-小学-劳动": "fc047d81cbdc11efa1740242ac140002",
"教材-小学-信息科技": "2fe08c7ad18911efbeaa0242ac140002",
"教材-小学-科学": "935cfec8bf6a11ef98950242ac140006",
"教材-小学-数学": "3c4e298fbf7911ef8e8b0242ac140002",
"教材-小学-语文": "f76f1aa5bf7111ef90c80242ac140002",

View File

@ -69,6 +69,7 @@
<div class="content-body-right-item-text">{{item.name}}</div>
</div>
</div>
<!-- <Eos></Eos>-->
</div>
</div>
</div>
@ -102,6 +103,7 @@ import * as commUtils from "@/utils/comm";
import * as Api_server from "@/api/apiService"; //
import useClassTaskStore from '@/store/modules/classTask'
import { slidesToImg } from '@/utils/ppt' // ppt
import Eos from "@/components/FileUpload/Eos.vue"
const router = useRouter()
const userStore = useUserStore().user //

View File

@ -7,7 +7,7 @@ const packageJsonPath = path.join(__dirname, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
console.log(env)
let res = env.npm_lifecycle_event.replace("build", "").replace(":", "");
res = res?"-" + res:"";
res = res&&res!=='prod'?"-" + res:"";
packageJson.name = "aix-win-ws" + res
// 将修改后的内容写回package.json文件