提交 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_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_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_KEY=26cb02e8fc2c9a2a173498bb60d78fcf
\ No newline at end of file
......@@ -2,7 +2,7 @@
"version": "0.0.0",
"scripts": {
"dev": "vite --mode dev",
"build": "vite build --mode prod && npm run deploy",
"build": "vite build --mode prod",
"build:pre": "vite build --mode pre",
"build:test": "vite build --mode test",
"preview": "vite preview",
......
......@@ -46,3 +46,22 @@ export function getAllProjects() {
export function getQuestionCategory(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 md5 from 'blueimp-md5'
import { getLocalFileChunk, uploadLocalFile } from '@/api/base'
export default function (blobInfo, succFun, failFun) {
const file = blobInfo.blob()
getSignature()
getLocalFileChunk({ file_name: file.name, file_size: file.size })
.then(response => {
const prefix = 'upload/admin/'
const fileName = file.name
const key = prefix + md5(fileName + new Date().getTime()) + fileName.substr(fileName.lastIndexOf('.'))
const { accessid, policy, signature, host } = response
const data = { key, host, OSSAccessKeyId: accessid, policy, signature, success_action_status: '200', file }
const fileUrl = `${host}/${key}`
uploadFile(data)
.then(() => {
succFun(fileUrl)
const params = {
file,
file_name: response.data.detail.file_name,
now_package_num: 1,
total_package_num: 1
}
uploadLocalFile(params)
.then(res => {
succFun(res.data.detail.uri)
})
.catch(() => {
failFun('上传失败')
})
})
.catch(() => {
failFun('获取Signature失败')
failFun('上传失败')
})
}
......@@ -4,9 +4,9 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2'
import checker from 'vite-plugin-checker'
export default defineConfig(({ mode }) => {
export default defineConfig(() => {
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}"' } })],
server: {
open: true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论