public: 发布2.8.0版本 (#1998)
* feat:修改token获取优先级,优先从header获取 * feat: 增加业务ctx的传递 * fix文件选择问题, 有公共函数onDownloadFile,去掉downloadFile * 没问题 * feat: 增加context引入 * fix: 修复图片多选的情况下点击确定抽屉无法收起的bug * feat: 提高header的token优先级,优化导出表格逻辑,不再依赖于cookie鉴权 --------- Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com> Co-authored-by: task <121913992@qq.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gin-vue-admin",
|
||||
"version": "2.7.9",
|
||||
"version": "2.8.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "node openDocument.js && vite --host --mode development",
|
||||
|
@@ -95,3 +95,34 @@ export const getSysExportTemplateList = (params) => {
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// ExportExcel 导出表格token
|
||||
// @Tags SysExportTemplate
|
||||
// @Summary 导出表格
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Router /sysExportTemplate/exportExcel [get]
|
||||
export const exportExcel = (params) => {
|
||||
return service({
|
||||
url: '/sysExportTemplate/exportExcel',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// ExportTemplate 导出表格模板
|
||||
// @Tags SysExportTemplate
|
||||
// @Summary 导出表格模板
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Router /sysExportTemplate/exportTemplate [get]
|
||||
export const exportTemplate = (params) => {
|
||||
return service({
|
||||
url: '/sysExportTemplate/exportTemplate',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
@@ -5,7 +5,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getUrl} from "@/utils/image";
|
||||
|
||||
import { exportExcel } from '@/api/exportTemplate'
|
||||
|
||||
const props = defineProps({
|
||||
templateId: {
|
||||
@@ -58,8 +59,17 @@
|
||||
)
|
||||
.join('&')
|
||||
|
||||
const url = `${baseUrl}/sysExportTemplate/exportExcel?templateID=${props.templateId}${params ? '&' + params : ''}`
|
||||
const res = await exportExcel({
|
||||
templateID: props.templateId,
|
||||
params
|
||||
})
|
||||
|
||||
if(res.code === 0){
|
||||
ElMessage.success('创建导出任务成功,开始下载')
|
||||
const url = `${baseUrl}${res.data}`
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
|
||||
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
</script>
|
||||
|
@@ -1,10 +1,13 @@
|
||||
<template>
|
||||
<el-button type="primary" icon="download" @click="exportTemplate"
|
||||
<el-button type="primary" icon="download" @click="exportTemplateFunc"
|
||||
>下载模板</el-button
|
||||
>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {exportTemplate} from "@/api/exportTemplate";
|
||||
|
||||
const props = defineProps({
|
||||
templateId: {
|
||||
type: String,
|
||||
@@ -12,9 +15,8 @@
|
||||
}
|
||||
})
|
||||
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const exportTemplate = async () => {
|
||||
const exportTemplateFunc = async () => {
|
||||
if (props.templateId === '') {
|
||||
ElMessage.error('组件未设置模板ID')
|
||||
return
|
||||
@@ -23,7 +25,16 @@
|
||||
if (baseUrl === "/"){
|
||||
baseUrl = ""
|
||||
}
|
||||
const url = `${baseUrl}/sysExportTemplate/exportTemplate?templateID=${props.templateId}`
|
||||
window.open(url, '_blank')
|
||||
|
||||
const res = await exportTemplate({
|
||||
templateID: props.templateId
|
||||
})
|
||||
|
||||
if(res.code === 0){
|
||||
ElMessage.success('创建导出任务成功,开始下载')
|
||||
const url = `${baseUrl}${res.data}`
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
@@ -4,6 +4,7 @@
|
||||
:show-file-list="false"
|
||||
:on-success="handleSuccess"
|
||||
:multiple="false"
|
||||
:headers="{'x-token': token}"
|
||||
>
|
||||
<el-button type="primary" icon="upload" class="ml-3"> 导入 </el-button>
|
||||
</el-upload>
|
||||
@@ -11,6 +12,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
let baseUrl = import.meta.env.VITE_BASE_API
|
||||
if (baseUrl === "/"){
|
||||
@@ -24,6 +26,10 @@
|
||||
}
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const token = userStore.token
|
||||
|
||||
const emit = defineEmits(['on-success'])
|
||||
|
||||
const url = `${baseUrl}/sysExportTemplate/importExcel?templateID=${props.templateId}`
|
||||
|
@@ -11,6 +11,7 @@
|
||||
:limit="limit"
|
||||
:accept="accept"
|
||||
class="upload-btn"
|
||||
:headers="{'x-token': token}"
|
||||
>
|
||||
<el-button type="primary"> 上传文件 </el-button>
|
||||
</el-upload>
|
||||
@@ -21,6 +22,7 @@
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getBaseUrl } from '@/utils/format'
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
defineOptions({
|
||||
name: 'UploadCommon'
|
||||
@@ -37,6 +39,10 @@
|
||||
}
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const token = userStore.token
|
||||
|
||||
const fullscreenLoading = ref(false)
|
||||
|
||||
const model = defineModel({ type: Array })
|
||||
|
@@ -7,6 +7,7 @@
|
||||
:on-success="uploadSuccess"
|
||||
:show-file-list="false"
|
||||
:data="{'classId': props.classId}"
|
||||
:headers="{'x-token': token}"
|
||||
multiple
|
||||
class="upload-btn"
|
||||
>
|
||||
@@ -20,12 +21,17 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { isVideoMime, isImageMime } from '@/utils/image'
|
||||
import { getBaseUrl } from '@/utils/format'
|
||||
import {Upload} from "@element-plus/icons-vue";
|
||||
import { Upload } from "@element-plus/icons-vue";
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
defineOptions({
|
||||
name: 'UploadCommon'
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const token = userStore.token
|
||||
|
||||
const props = defineProps({
|
||||
classId: {
|
||||
type: Number,
|
||||
|
@@ -8,6 +8,7 @@
|
||||
:data="{'classId': props.classId}"
|
||||
:on-success="handleImageSuccess"
|
||||
:on-change="handleFileChange"
|
||||
:headers="{'x-token': token}"
|
||||
>
|
||||
<el-button type="primary" icon="crop"> 裁剪上传</el-button>
|
||||
</el-upload>
|
||||
@@ -87,6 +88,7 @@ import { RefreshLeft, RefreshRight, Plus, Minus } from '@element-plus/icons-vue'
|
||||
import 'vue-cropper/dist/index.css'
|
||||
import { VueCropper } from 'vue-cropper'
|
||||
import { getBaseUrl } from '@/utils/format'
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
defineOptions({
|
||||
name: 'CropperImage'
|
||||
|
@@ -7,6 +7,7 @@
|
||||
:before-upload="beforeImageUpload"
|
||||
:multiple="false"
|
||||
:data="{'classId': props.classId}"
|
||||
:headers="{'x-token': token}"
|
||||
>
|
||||
<el-button type="primary" :icon="Upload">压缩上传</el-button>
|
||||
</el-upload>
|
||||
@@ -17,7 +18,8 @@
|
||||
import ImageCompress from '@/utils/image'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getBaseUrl } from '@/utils/format'
|
||||
import {Upload} from "@element-plus/icons-vue";
|
||||
import { Upload } from "@element-plus/icons-vue";
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
defineOptions({
|
||||
name: 'UploadImage'
|
||||
@@ -43,6 +45,10 @@
|
||||
}
|
||||
})
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const token = userStore.token
|
||||
|
||||
const beforeImageUpload = (file) => {
|
||||
const isJPG = file.type?.toLowerCase() === 'image/jpeg'
|
||||
const isPng = file.type?.toLowerCase() === 'image/png'
|
||||
|
@@ -17,7 +17,7 @@ export const viteLogo = (env) => {
|
||||
`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`
|
||||
)
|
||||
)
|
||||
console.log(greenText(`> 当前版本:v2.7.9`))
|
||||
console.log(greenText(`> 当前版本:v2.8.0`))
|
||||
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`))
|
||||
console.log(
|
||||
greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)
|
||||
|
@@ -10,7 +10,7 @@ export default {
|
||||
register(app)
|
||||
console.log(`
|
||||
欢迎使用 Gin-Vue-Admin
|
||||
当前版本:v2.7.9
|
||||
当前版本:v2.8.0
|
||||
加群方式:微信:shouzi_1994 QQ群:622360840
|
||||
项目地址:https://github.com/flipped-aurora/gin-vue-admin
|
||||
插件市场:https://plugin.gin-vue-admin.com
|
||||
|
@@ -84,6 +84,7 @@ import 'vue-cropper/dist/index.css'
|
||||
import { VueCropper } from 'vue-cropper'
|
||||
import { getBaseUrl } from '@/utils/format'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
defineOptions({
|
||||
name: 'scanUpload'
|
||||
|
@@ -657,7 +657,7 @@
|
||||
<el-table-column
|
||||
align="left"
|
||||
prop="dataTypeLong"
|
||||
label="数据库字段长度"
|
||||
label="字段长度/枚举值"
|
||||
width="160"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
@@ -741,6 +741,7 @@
|
||||
class="flex items-center"
|
||||
:before-upload="importJson"
|
||||
:show-file-list="false"
|
||||
:headers="{'x-token': token}"
|
||||
accept=".json"
|
||||
>
|
||||
<el-button type="primary" class="mx-2" :disabled="isAdd"
|
||||
@@ -828,6 +829,11 @@
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
import Sortable from 'sortablejs'
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const token = userStore.token
|
||||
|
||||
const handleFocus = () => {
|
||||
document.addEventListener('keydown', handleKeydown);
|
||||
@@ -931,7 +937,6 @@
|
||||
if (res.code === 0) {
|
||||
form.value.fields = []
|
||||
const json = JSON.parse(res.data)
|
||||
|
||||
json.fields?.forEach((item) => {
|
||||
item.fieldName = toUpperCase(item.fieldName)
|
||||
})
|
||||
|
@@ -6,6 +6,7 @@
|
||||
:show-file-list="false"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleSuccess"
|
||||
:headers="{'x-token': token}"
|
||||
name="plug"
|
||||
>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
@@ -20,6 +21,11 @@
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getBaseUrl } from '@/utils/format'
|
||||
import { useUserStore } from "@/pinia";
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const token = userStore.token
|
||||
|
||||
const handleSuccess = (res) => {
|
||||
if (res.code === 0) {
|
||||
|
Reference in New Issue
Block a user