提交 a32c1c31 authored 作者: 王鹏飞's avatar 王鹏飞

Merge branch 'ip' into gdrtvu

VITE_LOGIN_URL=https://login.segedu.cn/auth/login/index VITE_LOGIN_URL=http://172.16.3.203:1001/auth/login/index
VITE_SECRET_ID=ezijing_9e887612acba9afb8ebf137969cc55bb VITE_SECRET_ID=ezijing_9e887612acba9afb8ebf137969cc55bb
VITE_SECRET_KEY=26cb02e8fc2c9a2a173498bb60d78fcf VITE_SECRET_KEY=26cb02e8fc2c9a2a173498bb60d78fcf
\ No newline at end of file
VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index VITE_LOGIN_URL=https://login.zijing.chat/auth/login/index
VITE_SECRET_ID=ezijing_9e887612acba9afb8ebf137969cc55bb VITE_SECRET_ID=ezijing_9e887612acba9afb8ebf137969cc55bb
VITE_SECRET_KEY=26cb02e8fc2c9a2a173498bb60d78fcf VITE_SECRET_KEY=26cb02e8fc2c9a2a173498bb60d78fcf
\ No newline at end of file
VITE_LOGIN_URL=https://login2.ezijing.com/auth/login/index VITE_LOGIN_URL=https://login2.zijing.chat/auth/login/index
VITE_SECRET_ID=ezijing_9e887612acba9afb8ebf137969cc55bb VITE_SECRET_ID=ezijing_9e887612acba9afb8ebf137969cc55bb
VITE_SECRET_KEY=26cb02e8fc2c9a2a173498bb60d78fcf VITE_SECRET_KEY=26cb02e8fc2c9a2a173498bb60d78fcf
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"dev": "vite --mode dev", "dev": "vite --mode dev",
"build": "vite build --mode prod && npm run deploy", "build": "vite build --mode prod",
"build:pre": "vite build --mode pre", "build:pre": "vite build --mode pre",
"build:test": "vite build --mode test", "build:test": "vite build --mode test",
"preview": "vite preview", "preview": "vite preview",
......
...@@ -46,3 +46,22 @@ export function getAllProjects() { ...@@ -46,3 +46,22 @@ export function getAllProjects() {
export function getQuestionCategory(params) { export function getQuestionCategory(params) {
return httpRequest.get(`/api/qbs/admin/v2/question-category/tree/${params.project_prefix}`, { params }) return httpRequest.get(`/api/qbs/admin/v2/question-category/tree/${params.project_prefix}`, { params })
} }
// 获取分片大小和唯一文件名
export function getLocalFileChunk(params) {
return httpRequest.get('/api/lab/v1/common/file/chunk', { params })
}
// 上传每个分片前请求接口来获取当前文件是否超时,之前的分片是否被清理,如果被请求则拒绝处理。返回客户端错误码,让客户端户端不再续传剩余分片
// 1文件被清理 0文件未被清理
export function checkLocalFile(params) {
return httpRequest.get('/api/lab/v1/common/file/check', { params })
}
// 上传文件
export function uploadLocalFile(data) {
return httpRequest.post('/api/lab/v1/common/file/upload', data, {
withCredentials: false,
headers: { 'Content-Type': 'multipart/form-data' }
})
}
import { getSignature, uploadFile } from '@/api/base' import { getLocalFileChunk, uploadLocalFile } from '@/api/base'
import md5 from 'blueimp-md5'
export default function (blobInfo, succFun, failFun) { export default function (blobInfo, succFun, failFun) {
const file = blobInfo.blob() const file = blobInfo.blob()
getSignature() getLocalFileChunk({ file_name: file.name, file_size: file.size })
.then(response => { .then(response => {
const prefix = 'upload/admin/' const params = {
const fileName = file.name file,
const key = prefix + md5(fileName + new Date().getTime()) + fileName.substr(fileName.lastIndexOf('.')) file_name: response.data.detail.file_name,
const { accessid, policy, signature, host } = response now_package_num: 1,
const data = { key, host, OSSAccessKeyId: accessid, policy, signature, success_action_status: '200', file } total_package_num: 1
const fileUrl = `${host}/${key}` }
uploadFile(data) uploadLocalFile(params)
.then(() => { .then(res => {
succFun(fileUrl) succFun(res.data.detail.uri)
}) })
.catch(() => { .catch(() => {
failFun('上传失败') failFun('上传失败')
}) })
}) })
.catch(() => { .catch(() => {
failFun('获取Signature失败') failFun('上传失败')
}) })
} }
...@@ -4,9 +4,9 @@ import { defineConfig } from 'vite' ...@@ -4,9 +4,9 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2' import vue from '@vitejs/plugin-vue2'
import checker from 'vite-plugin-checker' import checker from 'vite-plugin-checker'
export default defineConfig(({ mode }) => { export default defineConfig(() => {
return { return {
base: mode === 'prod' ? 'https://webapp-pub.ezijing.com/website/prod/qbs/' : '/', // base: mode === 'prod' ? 'https://webapp-pub.ezijing.com/website/prod/qbs/' : '/',
plugins: [vue(), checker({ eslint: { lintCommand: 'eslint "./src/**/*.{vue,js,jsx,ts,tsx}"' } })], plugins: [vue(), checker({ eslint: { lintCommand: 'eslint "./src/**/*.{vue,js,jsx,ts,tsx}"' } })],
server: { server: {
open: true, open: true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论