From fb6fb889fa31e7ba3e28683e53641cd9a4d480f6 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期一, 06 十一月 2023 18:02:33 +0800
Subject: [PATCH] 修改视频专网
---
src/views/index.vue | 635 +++++++++++++++++++++++-------
src/plugins/download.ts | 26 +
src/utils/request.ts | 1
src/layout/components/Navbar.vue | 38
src/store/modules/user.ts | 1
src/components/VideoUpload/index.vue | 217 ++++++++++
src/views/system/oss/index.vue | 115 +++--
src/permission.ts | 7
src/views/register.vue | 6
.env.development | 2
src/views/login.vue | 52 +-
src/layout/components/Sidebar/Logo.vue | 2
index.html | 6
package.json | 2
.env.production | 2
public/favicon.ico | 0
src/api/system/oss/index.ts | 13
src/router/index.ts | 2
src/components/FileUpload/index.vue | 2
src/App.vue | 20
20 files changed, 883 insertions(+), 266 deletions(-)
diff --git a/.env.development b/.env.development
index 4fa628d..546360e 100644
--- a/.env.development
+++ b/.env.development
@@ -1,5 +1,5 @@
# 椤甸潰鏍囬
-VITE_APP_TITLE = RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�
+VITE_APP_TITLE = 璺ㄧ綉鏂囦欢鍚屾绯荤粺
# 寮�鍙戠幆澧冮厤缃�
VITE_APP_ENV = 'development'
diff --git a/.env.production b/.env.production
index d723d2a..8a9b298 100644
--- a/.env.production
+++ b/.env.production
@@ -1,5 +1,5 @@
# 椤甸潰鏍囬
-VITE_APP_TITLE = RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�
+VITE_APP_TITLE = 璺ㄧ綉鏂囦欢鍚屾绯荤粺
# 鐢熶骇鐜閰嶇疆
VITE_APP_ENV = 'production'
diff --git a/index.html b/index.html
index c0dab51..a105c48 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,7 @@
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="icon" href="/favicon.ico" />
- <title>RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�</title>
+ <title>璺ㄧ綉鏂囦欢鍚屾绯荤粺</title>
<!--[if lt IE 11
]><script>
window.location.href='/html/ie.html';
@@ -125,7 +125,7 @@
top: 0;
width: 51%;
height: 100%;
- background: #7171C6;
+ background: #23b385;
z-index: 1000;
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
@@ -209,7 +209,7 @@
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
- <div class="load_title">姝e湪鍔犺浇绯荤粺璧勬簮锛岃鑰愬績绛夊緟</div>
+ <div class="load_title">姝e湪鍔犺浇鏂囦欢绯荤粺璧勬簮锛岃绋嶅悗</div>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
diff --git a/package.json b/package.json
index 9b26e96..1772d36 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ruoyi-vue-plus",
"version": "5.1.0",
- "description": "RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�",
+ "description": "璺ㄧ綉鏂囦欢鍚屾绯荤粺",
"author": "LionLi",
"license": "MIT",
"scripts": {
diff --git a/public/favicon.ico b/public/favicon.ico
index 3f919d8..06d74f1 100644
--- a/public/favicon.ico
+++ b/public/favicon.ico
Binary files differ
diff --git a/src/App.vue b/src/App.vue
index 41ffdd4..4eaa6b3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -5,15 +5,29 @@
</template>
<script setup lang="ts">
+import axios from 'axios';
import useSettingsStore from '@/store/modules/settings'
import { handleThemeStyle } from '@/utils/theme'
import useAppStore from '@/store/modules/app';
-
+import { createUser } from "@/api/system/oss";
+import { setToken } from "@/utils/auth";
+import usePermissionStore from "@/store/modules/permission";
+import { isHttp } from "@/utils/validate";
const appStore = useAppStore();
const size = computed(() => appStore.size as any);
-onMounted(() => {
- nextTick(() => {
+import router from './router';
+import { to as tos } from "await-to-js";
+import useUserStore from "@/store/modules/user";
+
+
+
+
+
+
+onMounted(async () => {
+
+ await nextTick(() => {
// 鍒濆鍖栦富棰樻牱寮�
handleThemeStyle(useSettingsStore().theme)
})
diff --git a/src/api/system/oss/index.ts b/src/api/system/oss/index.ts
index 4472112..57c5ad4 100644
--- a/src/api/system/oss/index.ts
+++ b/src/api/system/oss/index.ts
@@ -26,3 +26,16 @@
method: 'delete'
});
}
+export function createUser(winIp: string | number | Array<string | number>) {
+ return request({
+ url: '/auth/auto' ,
+ method: 'put',
+ data: winIp
+ });
+}
+export function examineIds(ossId: string | number) {
+ return request({
+ url: '/resource/oss/' + ossId,
+ method: 'get'
+ } )
+}
diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue
index be99ac0..bd9f099 100644
--- a/src/components/FileUpload/index.vue
+++ b/src/components/FileUpload/index.vue
@@ -54,7 +54,7 @@
// 澶у皬闄愬埗(MB)
fileSize: propTypes.number.def(5),
// 鏂囦欢绫诲瀷, 渚嬪['png', 'jpg', 'jpeg']
- fileType: propTypes.array.def(["doc", "xls", "ppt", "txt", "pdf"]),
+ fileType: propTypes.array.def(["doc","docx","xlsx", "xls", "ppt", "txt", "pdf"]),
// 鏄惁鏄剧ず鎻愮ず
isShowTip: propTypes.bool.def(true),
});
diff --git a/src/components/VideoUpload/index.vue b/src/components/VideoUpload/index.vue
new file mode 100644
index 0000000..a65fffc
--- /dev/null
+++ b/src/components/VideoUpload/index.vue
@@ -0,0 +1,217 @@
+<template>
+ <div class="upload-file">
+ <el-upload
+ multiple
+ :action="uploadFileUrl"
+ :before-upload="handleBeforeUpload"
+ :file-list="fileList"
+ :limit="limit"
+ :on-error="handleUploadError"
+ :on-exceed="handleExceed"
+ :on-success="handleUploadSuccess"
+ :show-file-list="false"
+ :headers="headers"
+ class="upload-file-uploader"
+ ref="fileUploadRef"
+ >
+ <!-- 涓婁紶鎸夐挳 -->
+ <el-button type="primary">閫夊彇鏂囦欢</el-button>
+ </el-upload>
+ <!-- 涓婁紶鎻愮ず -->
+ <div class="el-upload__tip" v-if="showTip">
+ 璇蜂笂浼�
+ <template v-if="fileSize">
+ 澶у皬涓嶈秴杩� <b style="color: #f56c6c">{{ fileSize }}MB</b>
+ </template>
+ <template v-if="fileType">
+ 鏍煎紡涓� <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
+ </template>
+ 鐨勬枃浠�
+ </div>
+ <!-- 鏂囦欢鍒楄〃 -->
+ <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
+ <li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
+ <el-link :href="`${file.url}`" :underline="false" target="_blank">
+ <span class="el-icon-document"> {{ getFileName(file.name) }} </span>
+ </el-link>
+ <div class="ele-upload-list__item-content-action">
+ <el-link :underline="false" @click="handleDelete(index)" type="danger">鍒犻櫎</el-link>
+ </div>
+ </li>
+ </transition-group>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { listByIds, delOss } from "@/api/system/oss";
+import { propTypes } from '@/utils/propTypes';
+import { globalHeaders } from "@/utils/request";
+
+const props = defineProps({
+ modelValue: [String, Object, Array],
+ // 鏁伴噺闄愬埗
+ limit: propTypes.number.def(5),
+ // 澶у皬闄愬埗(MB)
+ fileSize: propTypes.number.def(150),
+ // 鏂囦欢绫诲瀷, 渚嬪['png', 'jpg', 'jpeg']
+ fileType: propTypes.array.def(["mp4","mov","3gp", "mpeg-4", "avi"]),
+ // 鏄惁鏄剧ず鎻愮ず
+ isShowTip: propTypes.bool.def(true),
+});
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const emit = defineEmits(['update:modelValue']);
+const number = ref(0);
+const uploadList = ref<any[]>([]);
+
+const baseUrl = import.meta.env.VITE_APP_BASE_API;
+const uploadFileUrl = ref(baseUrl + "/resource/oss/upload"); // 涓婁紶鏂囦欢鏈嶅姟鍣ㄥ湴鍧�
+const headers = ref(globalHeaders());
+
+const fileList = ref<any[]>([]);
+const showTip = computed(
+ () => props.isShowTip && (props.fileType || props.fileSize)
+);
+
+const fileUploadRef = ref<ElUploadInstance>();
+
+watch(() => props.modelValue, async val => {
+ if (val) {
+ let temp = 1;
+ // 棣栧厛灏嗗�艰浆涓烘暟缁�
+ let list = [];
+ if (Array.isArray(val)) {
+ list = val;
+ } else {
+ const res = await listByIds(val as string)
+ list = res.data.map((oss) => {
+ const data = { name: oss.originalName, url: oss.url, ossId: oss.ossId };
+ return data;
+ });
+ }
+ // 鐒跺悗灏嗘暟缁勮浆涓哄璞℃暟缁�
+ fileList.value = list.map(item => {
+ item = { name: item.name, url: item.url, ossId: item.ossId };
+ item.uid = item.uid || new Date().getTime() + temp++;
+ return item;
+ });
+ } else {
+ fileList.value = [];
+ return [];
+ }
+}, { deep: true, immediate: true });
+
+// 涓婁紶鍓嶆牎妫�鏍煎紡鍜屽ぇ灏�
+const handleBeforeUpload = (file: any) => {
+ // 鏍℃鏂囦欢绫诲瀷
+ if (props.fileType.length) {
+ const fileName = file.name.split('.');
+ const fileExt = fileName[fileName.length - 1];
+ const isTypeOk = props.fileType.indexOf(fileExt) >= 0;
+ if (!isTypeOk) {
+ proxy?.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${props.fileType.join("/")}鏍煎紡鏂囦欢!`);
+ return false;
+ }
+ }
+ // 鏍℃鏂囦欢澶у皬
+ if (props.fileSize) {
+ const isLt = file.size / 1024 / 1024 < props.fileSize;
+ if (!isLt) {
+ proxy?.$modal.msgError(`涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`);
+ return false;
+ }
+ }
+ proxy?.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
+ number.value++;
+ return true;
+}
+
+// 鏂囦欢涓暟瓒呭嚭
+const handleExceed = () => {
+ proxy?.$modal.msgError(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${props.limit} 涓�!`);
+}
+
+// 涓婁紶澶辫触
+const handleUploadError = () => {
+ proxy?.$modal.msgError("涓婁紶鏂囦欢澶辫触");
+}
+
+// 涓婁紶鎴愬姛鍥炶皟
+const handleUploadSuccess = (res: any, file: UploadFile) => {
+ if (res.code === 200) {
+ uploadList.value.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
+ uploadedSuccessfully();
+ } else {
+ number.value--;
+ proxy?.$modal.closeLoading();
+ proxy?.$modal.msgError(res.msg);
+ fileUploadRef.value?.handleRemove(file);
+ uploadedSuccessfully();
+ }
+}
+
+// 鍒犻櫎鏂囦欢
+const handleDelete = (index: number) => {
+ let ossId = fileList.value[index].ossId;
+ delOss(ossId);
+ fileList.value.splice(index, 1);
+ emit("update:modelValue", listToString(fileList.value));
+}
+
+// 涓婁紶缁撴潫澶勭悊
+const uploadedSuccessfully = () => {
+ if (number.value > 0 && uploadList.value.length === number.value) {
+ fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
+ uploadList.value = [];
+ number.value = 0;
+ emit("update:modelValue", listToString(fileList.value));
+ proxy?.$modal.closeLoading();
+ }
+}
+
+// 鑾峰彇鏂囦欢鍚嶇О
+const getFileName = (name: string) => {
+ // 濡傛灉鏄痷rl閭d箞鍙栨渶鍚庣殑鍚嶅瓧 濡傛灉涓嶆槸鐩存帴杩斿洖
+ if (name.lastIndexOf("/") > -1) {
+ return name.slice(name.lastIndexOf("/") + 1);
+ } else {
+ return name;
+ }
+}
+
+// 瀵硅薄杞垚鎸囧畾瀛楃涓插垎闅�
+const listToString = (list: any[], separator?: string) => {
+ let strs = "";
+ separator = separator || ",";
+ list.forEach(item => {
+ if (item.ossId) {
+ strs += item.ossId + separator;
+ }
+ })
+ return strs != "" ? strs.substring(0, strs.length - 1) : "";
+}
+</script>
+
+<style scoped lang="scss">
+.upload-file-uploader {
+ margin-bottom: 5px;
+}
+
+.upload-file-list .el-upload-list__item {
+ border: 1px solid #e4e7ed;
+ line-height: 2;
+ margin-bottom: 10px;
+ position: relative;
+}
+
+.upload-file-list .ele-upload-list__item-content {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ color: inherit;
+}
+
+.ele-upload-list__item-content-action .el-link {
+ margin-right: 10px;
+}
+</style>
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 3c0e45d..96e6212 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -6,19 +6,19 @@
<div class="right-menu flex align-center">
<template v-if="appStore.device !== 'mobile'">
- <el-select
- v-model="companyName"
- clearable
- filterable
- reserve-keyword
- :placeholder="$t('navbar.selectTenant')"
- v-if="userId === 1 && tenantEnabled"
- @change="dynamicTenantEvent"
- @clear="dynamicClearEvent"
- >
- <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"> </el-option>
- <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
- </el-select>
+<!-- <el-select-->
+<!-- v-model="companyName"-->
+<!-- clearable-->
+<!-- filterable-->
+<!-- reserve-keyword-->
+<!-- :placeholder="$t('navbar.selectTenant')"-->
+<!-- v-if="userId === 1 && tenantEnabled"-->
+<!-- @change="dynamicTenantEvent"-->
+<!-- @clear="dynamicClearEvent"-->
+<!-- >-->
+<!-- <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"> </el-option>-->
+<!-- <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>-->
+<!-- </el-select>-->
<!-- <header-search id="header-search" class="right-menu-item" /> -->
<search-menu ref="searchMenuRef" />
@@ -27,13 +27,13 @@
<svg-icon class-name="search-icon" icon-class="search" />
</div>
</el-tooltip>
- <el-tooltip content="Github" effect="dark" placement="bottom">
- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
- </el-tooltip>
+<!-- <el-tooltip content="Github" effect="dark" placement="bottom">-->
+<!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
+<!-- </el-tooltip>-->
- <el-tooltip :content="$t('navbar.document')" effect="dark" placement="bottom">
- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
- </el-tooltip>
+<!-- <el-tooltip :content="$t('navbar.document')" effect="dark" placement="bottom">-->
+<!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />-->
+<!-- </el-tooltip>-->
<el-tooltip :content="$t('navbar.full')" effect="dark" placement="bottom">
<screenfull id="screenfull" class="right-menu-item hover-effect" />
diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue
index a06158a..9976fd7 100644
--- a/src/layout/components/Sidebar/Logo.vue
+++ b/src/layout/components/Sidebar/Logo.vue
@@ -35,7 +35,7 @@
}
})
-const title = ref('RuoYi-Vue-Plus');
+const title = ref('鏂囦欢绠$悊绯荤粺');
const settingsStore = useSettingsStore();
const sideTheme = computed(() => settingsStore.sideTheme);
</script>
diff --git a/src/permission.ts b/src/permission.ts
index 4543d08..d87f2a4 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -10,17 +10,19 @@
import usePermissionStore from '@/store/modules/permission';
NProgress.configure({ showSpinner: false });
-const whiteList = ['/login', '/register', '/social-callback'];
+const whiteList = ['/login', '/register', '/social-callback','/index'];
router.beforeEach(async (to, from, next) => {
NProgress.start();
if (getToken()) {
+ console.log('鏈塼oken',to.path);
to.meta.title && useSettingsStore().setTitle(to.meta.title as string);
/* has token*/
if (to.path === '/login') {
next({ path: '/' });
NProgress.done();
} else {
+ console.log(useUserStore().roles);
if (useUserStore().roles.length === 0) {
isRelogin.show = true;
// 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁宸叉媺鍙栧畬user_info淇℃伅
@@ -50,7 +52,8 @@
// 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
next();
} else {
- next(`/login?redirect=${to.fullPath}`); // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
+ // next(`/login?redirect=${to.fullPath}`); // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
+ next(`/index`); // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
NProgress.done();
}
}
diff --git a/src/plugins/download.ts b/src/plugins/download.ts
index ef66b3a..2cdfa50 100644
--- a/src/plugins/download.ts
+++ b/src/plugins/download.ts
@@ -61,5 +61,29 @@
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'];
ElMessage.error(errMsg);
- }
+ },
+ async ossDown(ossId: string | number,pawd:string) {
+ const url = baseURL + '/resource/oss/download/' + ossId +'/' + pawd;
+ downloadLoadingInstance = ElLoading.service({ text: '姝e湪涓嬭浇鏁版嵁锛岃绋嶅��', background: 'rgba(0, 0, 0, 0.7)' });
+ try {
+ const res = await axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: globalHeaders()
+ });
+ const isBlob = blobValidate(res.data);
+ if (isBlob) {
+ const blob = new Blob([res.data], { type: 'application/octet-stream' });
+ FileSaver.saveAs(blob, decodeURIComponent(res.headers['download-filename'] as string));
+ } else {
+ this.printErrMsg(res.data);
+ }
+ downloadLoadingInstance.close();
+ } catch (r) {
+ console.error(r);
+ ElMessage.error('涓嬭浇鏂囦欢鍑虹幇閿欒锛岃鑱旂郴绠$悊鍛橈紒');
+ downloadLoadingInstance.close();
+ }
+ },
};
diff --git a/src/router/index.ts b/src/router/index.ts
index 6c56cd3..03e32e2 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -71,7 +71,7 @@
path: '/index',
component: () => import('@/views/index.vue'),
name: 'Index',
- meta: { title: '棣栭〉', icon: 'dashboard', affix: true }
+ meta: { title: '鏂囦欢绠$悊', icon: 'dashboard', affix: true }
}
]
},
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 2593d1a..6808194 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -34,6 +34,7 @@
const getInfo = async (): Promise<void> => {
const [err, res] = await to(getUserInfo());
if (res) {
+ console.log(res,'getUserInfo');
const data = res.data;
const user = data.user;
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
diff --git a/src/utils/request.ts b/src/utils/request.ts
index ed67713..fe246b1 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -107,6 +107,7 @@
if (code === 401) {
// prettier-ignore
if (!isRelogin.show) {
+ // isRelogin.show = true;
isRelogin.show = true;
ElMessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', {
confirmButtonText: '閲嶆柊鐧诲綍',
diff --git a/src/views/index.vue b/src/views/index.vue
index 438c1af..33c0ed7 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -1,167 +1,484 @@
<template>
- <div class="app-container home">
- <el-row :gutter="20">
- <el-col :sm="24" :lg="12" style="padding-left: 20px">
- <h2>RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�</h2>
- <p>
- RuoYi-Vue-Plus 鏄熀浜� RuoYi-Vue 閽堝 鍒嗗竷寮忛泦缇� 鍦烘櫙鍗囩骇(涓嶅吋瀹瑰師妗嗘灦)
- <br />
- * 鍓嶇寮�鍙戞鏋� Vue3銆乀S銆丒lement Plus<br />
- * 鍚庣寮�鍙戞鏋� Spring Boot<br />
- * 瀹瑰櫒妗嗘灦 Undertow 鍩轰簬 Netty 鐨勯珮鎬ц兘瀹瑰櫒<br />
- * 鏉冮檺璁よ瘉妗嗘灦 Sa-Token 鏀寔澶氱粓绔璇佺郴缁�<br />
- * 鍏崇郴鏁版嵁搴� MySQL 閫傞厤 8.X 鏈�浣� 5.7<br />
- * 缂撳瓨鏁版嵁搴� Redis 閫傞厤 6.X 鏈�浣� 4.X<br />
- * 鏁版嵁搴撴鏋� Mybatis-Plus 蹇�� CRUD 澧炲姞寮�鍙戞晥鐜�<br />
- * 鏁版嵁搴撴鏋� p6spy 鏇村己鍔茬殑 SQL 鍒嗘瀽<br />
- * 澶氭暟鎹簮妗嗘灦 dynamic-datasource 鏀寔涓讳粠涓庡绉嶇被鏁版嵁搴撳紓鏋�<br />
- * 搴忓垪鍖栨鏋� Jackson 缁熶竴浣跨敤 jackson 楂樻晥鍙潬<br />
- * Redis瀹㈡埛绔� Redisson 鎬ц兘寮哄姴銆丄PI涓板瘜<br />
- * 鍒嗗竷寮忛檺娴� Redisson 鍏ㄥ眬銆佽姹侷P銆侀泦缇D 澶氱闄愭祦<br />
- * 鍒嗗竷寮忛攣 Lock4j 娉ㄨВ閿併�佸伐鍏烽攣 澶氱澶氭牱<br />
- * 鍒嗗竷寮忓箓绛� Lock4j 鍩轰簬鍒嗗竷寮忛攣瀹炵幇<br />
- * 鍒嗗竷寮忛摼璺拷韪� SkyWalking 鏀寔閾捐矾杩借釜銆佺綉鏍煎垎鏋愩�佸害閲忚仛鍚堛�佸彲瑙嗗寲<br />
- * 鍒嗗竷寮忎换鍔¤皟搴� PowerJob 楂樻�ц兘 楂樺彲闈� 鏄撴墿灞�<br />
- * 鏂囦欢瀛樺偍 Minio 鏈湴瀛樺偍<br />
- * 鏂囦欢瀛樺偍 涓冪墰銆侀樋閲屻�佽吘璁� 浜戝瓨鍌�<br />
- * 鐩戞帶妗嗘灦 SpringBoot-Admin 鍏ㄦ柟浣嶆湇鍔$洃鎺�<br />
- * 鏍¢獙妗嗘灦 Validation 澧炲己鎺ュ彛瀹夊叏鎬� 涓ヨ皑鎬�<br />
- * Excel妗嗘灦 Alibaba EasyExcel 鎬ц兘浼樺紓 鎵╁睍鎬у己<br />
- * 鏂囨。妗嗘灦 SpringDoc銆乯avadoc 鏃犳敞瑙i浂鍏ヤ镜鍩轰簬java娉ㄩ噴<br />
- * 宸ュ叿绫绘鏋� Hutool銆丩ombok 鍑忓皯浠g爜鍐椾綑 澧炲姞瀹夊叏鎬�<br />
- * 浠g爜鐢熸垚鍣� 閫傞厤MP銆丼pringDoc瑙勮寖鍖栦唬鐮� 涓�閿敓鎴愬墠鍚庣浠g爜<br />
- * 閮ㄧ讲鏂瑰紡 Docker 瀹瑰櫒缂栨帓 涓�閿儴缃蹭笟鍔¢泦缇�<br />
- * 鍥介檯鍖� SpringMessage Spring鏍囧噯鍥介檯鍖栨柟妗�<br />
- </p>
- <p><b>褰撳墠鐗堟湰:</b> <span>v5.1.0</span></p>
- <p>
- <el-tag type="danger">¥鍏嶈垂寮�婧�</el-tag>
- </p>
- <p>
- <el-button type="primary" icon="Cloudy" plain @click="goTarget('https://gitee.com/dromara/RuoYi-Vue-Plus')">璁块棶鐮佷簯</el-button>
- <el-button type="primary" icon="Cloudy" plain @click="goTarget('https://github.com/dromara/RuoYi-Vue-Plus')">璁块棶GitHub</el-button>
- <el-button type="primary" icon="Cloudy" plain @click="goTarget('https://plus-doc.dromara.org/#/ruoyi-vue-plus/changlog')"
- >鏇存柊鏃ュ織</el-button
- >
- </p>
- </el-col>
+ <div class="p-2">
+ <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
+ <div class="mb-[10px]" v-show="showSearch">
+ <el-card shadow="hover">
+ <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
+ <!-- <el-form-item label="鏂囦欢鍚�" prop="fileName">-->
+ <!-- <el-input v-model="queryParams.fileName" placeholder="璇疯緭鍏ユ枃浠跺悕" clearable style="width: 200px" @keyup.enter="handleQuery" />-->
+ <!-- </el-form-item>-->
+ <el-form-item label="鍘熷悕" prop="originalName">
+ <el-input v-model="queryParams.originalName" placeholder="璇疯緭鍏ュ師鍚�" clearable style="width: 200px" @keyup.enter="handleQuery" />
+ </el-form-item>
+ <el-form-item label="鏂囦欢鍚庣紑" prop="fileSuffix">
+ <el-input v-model="queryParams.fileSuffix" placeholder="璇疯緭鍏ユ枃浠跺悗缂�" clearable style="width: 200px" @keyup.enter="handleQuery" />
+ </el-form-item>
+ <!-- <el-form-item label="鍒涘缓鏃堕棿">-->
+ <!-- <el-date-picker-->
+ <!-- v-model="dateRangeCreateTime"-->
+ <!-- value-format="YYYY-MM-DD HH:mm:ss"-->
+ <!-- type="daterange"-->
+ <!-- range-separator="-"-->
+ <!-- start-placeholder="寮�濮嬫棩鏈�"-->
+ <!-- end-placeholder="缁撴潫鏃ユ湡"-->
+ <!-- :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"-->
+ <!-- ></el-date-picker>-->
+ <!-- </el-form-item>-->
+ <!-- <el-form-item label="鏈嶅姟鍟�" prop="service">-->
+ <!-- <el-input v-model="queryParams.service" placeholder="璇疯緭鍏ユ湇鍔″晢" clearable style="width: 200px" @keyup.enter="handleQuery" />-->
+ <!-- </el-form-item>-->
+ <el-form-item>
+ <el-button type="primary" icon="search" @click="handleQuery">鎼滅储</el-button>
+ <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
+ </el-card>
+ </div>
+ </transition>
- <el-col :sm="24" :lg="12" style="padding-left: 20px">
- <h2>RuoYi-Cloud-Plus澶氱鎴峰井鏈嶅姟绠$悊绯荤粺</h2>
- <p>
- RuoYi-Cloud-Plus 寰湇鍔¢�氱敤鏉冮檺绠$悊绯荤粺 閲嶅啓 RuoYi-Cloud 鍏ㄦ柟浣嶅崌绾�(涓嶅吋瀹瑰師妗嗘灦)
- <br />
- * 鍓嶇寮�鍙戞鏋� Vue3銆乀S銆丒lement UI<br />
- * 鍚庣寮�鍙戞鏋� Spring Boot<br />
- * 寰湇鍔″紑鍙戞鏋� Spring Cloud銆丼pring Cloud Alibaba<br />
- * 瀹瑰櫒妗嗘灦 Undertow 鍩轰簬 XNIO 鐨勯珮鎬ц兘瀹瑰櫒<br />
- * 鏉冮檺璁よ瘉妗嗘灦 Sa-Token銆丣wt 鏀寔澶氱粓绔璇佺郴缁�<br />
- * 鍏崇郴鏁版嵁搴� MySQL 閫傞厤 8.X 鏈�浣� 5.7<br />
- * 鍏崇郴鏁版嵁搴� Oracle 閫傞厤 11g 12c<br />
- * 鍏崇郴鏁版嵁搴� PostgreSQL 閫傞厤 13 14<br />
- * 鍏崇郴鏁版嵁搴� SQLServer 閫傞厤 2017 2019<br />
- * 缂撳瓨鏁版嵁搴� Redis 閫傞厤 6.X 鏈�浣� 5.X<br />
- * 鍒嗗竷寮忔敞鍐屼腑蹇� Alibaba Nacos 閲囩敤2.X 鍩轰簬GRPC閫氫俊楂樻�ц兘<br />
- * 鍒嗗竷寮忛厤缃腑蹇� Alibaba Nacos 閲囩敤2.X 鍩轰簬GRPC閫氫俊楂樻�ц兘<br />
- * 鏈嶅姟缃戝叧 Spring Cloud Gateway 鍝嶅簲寮忛珮鎬ц兘缃戝叧<br />
- * 璐熻浇鍧囪 Spring Cloud Loadbalancer 璐熻浇鍧囪 澶勭悊<br />
- * RPC杩滅▼璋冪敤 Apache Dubbo 鍘熺敓鎬佷娇鐢ㄤ綋楠屻�侀珮鎬ц兘<br />
- * 鍒嗗竷寮忛檺娴佺啍鏂� Alibaba Sentinel 鏃犱镜鍏ャ�侀珮鎵╁睍<br />
- * 鍒嗗竷寮忎簨鍔� Alibaba Seata 鏃犱镜鍏ャ�侀珮鎵╁睍 鏀寔 鍥涚妯″紡<br />
- * 鍒嗗竷寮忔秷鎭槦鍒� Spring Cloud Stream 闂ㄩ潰妗嗘灦鍏煎鍚勭MQ闆嗘垚<br />
- * 鍒嗗竷寮忔秷鎭槦鍒� Apache Kafka 楂樻�ц兘楂橀�熷害<br />
- * 鍒嗗竷寮忔秷鎭槦鍒� Apache RocketMQ 楂樺彲鐢ㄥ姛鑳藉鏍�<br />
- * 鍒嗗竷寮忔秷鎭槦鍒� RabbitMQ 鏀寔鍚勭鎵╁睍鎻掍欢鍔熻兘澶氭牱鎬�<br />
- * 鍒嗗竷寮忔悳绱㈠紩鎿� ElasticSearch 涓氱晫鐭ュ悕<br />
- * 鍒嗗竷寮忛摼璺拷韪� Apache SkyWalking 閾捐矾杩借釜銆佺綉鏍煎垎鏋愩�佸害閲忚仛鍚堛�佸彲瑙嗗寲<br />
- * 鍒嗗竷寮忔棩蹇椾腑蹇� ELK 涓氱晫鎴愮啛瑙e喅鏂规<br />
- * 鍒嗗竷寮忕洃鎺� Prometheus銆丟rafana 鍏ㄦ柟浣嶆�ц兘鐩戞帶<br />
- * 鍏朵綑涓� Vue 鐗堟湰涓�鑷�<br />
- </p>
- <p><b>褰撳墠鐗堟湰:</b> <span>v2.1.0</span></p>
- <p>
- <el-tag type="danger">¥鍏嶈垂寮�婧�</el-tag>
- </p>
- <p>
- <el-button type="primary" icon="Cloudy" plain @click="goTarget('https://gitee.com/dromara/RuoYi-Cloud-Plus')">璁块棶鐮佷簯</el-button>
- <el-button type="primary" icon="Cloudy" plain @click="goTarget('https://github.com/dromara/RuoYi-Cloud-Plus')">璁块棶GitHub</el-button>
- <el-button type="primary" icon="Cloudy" plain @click="goTarget('https://plus-doc.dromara.org/#/ruoyi-cloud-plus/changlog')"
- >鏇存柊鏃ュ織</el-button
- >
- </p>
- </el-col>
- </el-row>
- <el-divider />
+ <el-card shadow="hover">
+ <template #header>
+ <el-row :gutter="10" class="mb8">
+ <el-col :span="1.5">
+ <el-button type="primary" plain icon="Upload" @click="handleFile" v-if="isContains(useUserStore().permissions, 'system:oss:upload')">涓婁紶鏂囦欢</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button type="primary" plain icon="Upload" @click="handleImage" v-if="isContains(useUserStore().permissions, 'system:oss:upload')">涓婁紶鍥剧墖</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button type="primary" plain icon="Upload" @click="handleVideo" v-if="isContains(useUserStore().permissions, 'system:oss:upload')">涓婁紶瑙嗛</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-if="isContains(useUserStore().permissions, 'system:oss:remove')">
+ 鍒犻櫎
+ </el-button>
+ </el-col>
+ <!-- <el-col :span="1.5">-->
+ <!-- <el-button-->
+ <!-- :type="previewListResource ? 'danger' : 'warning'"-->
+ <!-- plain-->
+ <!-- @click="handlePreviewListResource(!previewListResource)"-->
+ <!-- v-hasPermi="['system:oss:edit']"-->
+ <!-- >棰勮寮�鍏� :-->
+ <!-- {{-->
+ <!-- previewListResource ? "绂佺敤" : "鍚敤" }}</el-button-->
+ <!-- >-->
+ <!-- </el-col>-->
+ <el-col :span="1.5">
+ <el-button type="info" plain icon="Operation" @click="handleOssConfig" v-hasPermi="['system:oss:lists']">閰嶇疆绠$悊</el-button>
+ </el-col>
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+ </el-row>
+ </template>
+
+ <el-table
+ v-loading="loading"
+ :data="ossList"
+ @selection-change="handleSelectionChange"
+ :header-cell-class-name="handleHeaderClass"
+ @header-click="handleHeaderCLick"
+ v-if="showTable"
+ >
+ <el-table-column type="selection" width="55" align="center" />
+ <!-- <el-table-column label="瀵硅薄瀛樺偍涓婚敭" align="center" prop="ossId" v-if="true" />-->
+ <!-- <el-table-column label="鏂囦欢鍚�" align="center" prop="fileName" />-->
+ <el-table-column label="鍘熷悕" align="center" prop="originalName" />
+ <el-table-column label="鏂囦欢鍚庣紑" align="center" prop="fileSuffix" />
+ <!-- <el-table-column label="鏂囦欢灞曠ず" align="center" prop="url">-->
+ <!-- <template #default="scope">-->
+ <!-- <ImagePreview-->
+ <!-- v-if="previewListResource && checkFileSuffix(scope.row.fileSuffix)"-->
+ <!-- :width="100"-->
+ <!-- :height="100"-->
+ <!-- :src="scope.row.url"-->
+ <!-- :preview-src-list="[scope.row.url]"-->
+ <!-- />-->
+ <!-- <span v-text="scope.row.url" v-if="!checkFileSuffix(scope.row.fileSuffix) || !previewListResource" />-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+ <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180" sortable="custom">
+ <template #default="scope">
+ <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="涓婁紶浜�" align="center" prop="createByName" />
+ <!-- <el-table-column label="鏈嶅姟鍟�" align="center" prop="service" sortable="custom" />-->
+ <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+ <template #default="scope">
+ <el-tooltip content="鏌ョ湅鎻愬彇鐮�" placement="top">
+ <el-button link type="primary" icon="Search" @click="handleCode(scope.row)" v-if="isContains(useUserStore().permissions, 'system:oss:view')"></el-button>
+ </el-tooltip>
+ <el-tooltip content="涓嬭浇" placement="top">
+ <el-button link type="primary" icon="Download" @click="handleDownload(scope.row)" v-if="isContains(useUserStore().permissions, 'system:oss:download')"></el-button>
+ </el-tooltip>
+ <el-tooltip content="鍒犻櫎" placement="top">
+ <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-if="isContains(useUserStore().permissions, 'system:oss:remove')"></el-button>
+ </el-tooltip>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+ </el-card>
+ <!-- 娣诲姞鎴栦慨鏀筄SS瀵硅薄瀛樺偍瀵硅瘽妗� -->
+ <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
+ <el-form ref="ossFormRef" :model="form" :rules="rules" label-width="80px">
+ <el-form-item label="鏂囦欢鍚�">
+ <fileUpload v-model="form.file" v-if="type === 0" />
+ <imageUpload v-model="form.file" v-if="type === 1" />
+ <video-upload v-model="form.file" v-if="type === 2" />"
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
+ <el-button @click="cancel">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <el-dialog :title="titleDownload" v-model="visibleCode" width="500px" append-to-body>
+ <span v-show="titleDownload=='鏌ョ湅鎻愬彇鐮�'">{{testtxt}}</span>
+ <el-input style="margin: 10px 0" ref="inputRef" :style="inputSty" v-show="titleDownload!='鏌ョ湅鎻愬彇鐮�'" v-model="pasTxt" v-if="isContains(useUserStore().permissions, 'system:oss:download')" placeholder="璇疯緭鍏ユ枃浠舵彁鍙栫爜"></el-input>
+ <el-button link type="primary" v-show="titleDownload!='鏌ョ湅鎻愬彇鐮�'" icon="Download" @click="handleDownloadFile()" v-if="isContains(useUserStore().permissions, 'system:oss:download')">涓嬭浇</el-button>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="visibleCode = false">纭� 瀹�</el-button>
+ <el-button @click="visibleCode = false">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
</div>
</template>
-<script setup name="Index" lang="ts">
+<script setup name="Oss" lang="ts">
+import { listOss, delOss, createUser, examineIds } from "@/api/system/oss";
+import ImagePreview from "@/components/ImagePreview/index.vue";
+import { OssForm, OssQuery, OssVO } from "@/api/system/oss/types";
+import { getInfo } from "@/api/login";
+import { to as tos } from "await-to-js";
+import useUserStore from "@/store/modules/user";
+import { setToken } from "@/utils/auth";
+import usePermissionStore from "@/store/modules/permission";
+import { isHttp } from "@/utils/validate";
+import { any } from "vue-types";
-const goTarget = (url:string) => {
- window.open(url, '__blank')
+const router = useRouter();
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+
+const ossList = ref<OssVO[]>([]);
+const showTable = ref(true);
+const buttonLoading = ref(false);
+const loading = ref(true);
+const showSearch = ref(true);
+const ids = ref<Array<string | number>>([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+const type = ref(0);
+const previewListResource = ref(true);
+const dateRangeCreateTime = ref<[DateModelType, DateModelType]>(['', '']);
+const visibleCode = ref(false);
+const dialog = reactive<DialogOption>({
+ visible: false,
+ title: ''
+});
+const testtxt = ref<any>()
+const pasTxt = ref<any>()
+const titleDownload = ref<any>()
+const downIds = ref<any>()
+const inputRef = ref<any>()
+const inputSty =ref<any>()
+const currentIp = ref('')
+// 榛樿鎺掑簭
+const defaultSort = ref({ prop: 'createTime', order: 'ascending' });
+
+const ossFormRef = ref<ElFormInstance>();
+const queryFormRef = ref<ElFormInstance>();
+
+const initFormData = {
+ file: undefined,
}
+const data = reactive<PageData<OssForm, OssQuery>>({
+ form: { ...initFormData },
+ // 鏌ヨ鍙傛暟
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ fileName: '',
+ originalName: '',
+ fileSuffix: '',
+ createTime: '',
+ service: '',
+ orderByColumn: defaultSort.value.prop,
+ isAsc: defaultSort.value.order
+ },
+ rules: {
+ file: [
+ { required: true, message: "鏂囦欢涓嶈兘涓虹┖", trigger: "blur" }
+ ]
+ }
+});
+
+const { queryParams, form, rules } = toRefs(data);
+const sure = () => {
+ testtxt.value += 1
+}
+/** 鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃 */
+const getList = async () => {
+
+ loading.value = true;
+ const res = await proxy?.getConfigKey("sys.oss.previewListResource");
+ previewListResource.value = res?.data === undefined ? true : res.data === 'true';
+ const response = await listOss(proxy?.addDateRange(queryParams.value, dateRangeCreateTime.value, "CreateTime"));
+ ossList.value = response.rows;
+ total.value = response.total;
+ loading.value = false;
+ showTable.value = true;
+}
+function checkFileSuffix(fileSuffix: string[]) {
+ let arr = ["png", "jpg", "jpeg"];
+ return arr.some(type => {
+ return fileSuffix.indexOf(type) > -1;
+ });
+}
+/** 鍙栨秷鎸夐挳 */
+function cancel() {
+ dialog.visible = false;
+ reset();
+}
+/** 琛ㄥ崟閲嶇疆 */
+function reset() {
+ form.value = { ...initFormData };
+ ossFormRef.value?.resetFields();
+}
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+function handleQuery() {
+ queryParams.value.pageNum = 1;
+ getList();
+}
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+function resetQuery() {
+ showTable.value = false;
+ dateRangeCreateTime.value = ['', ''];
+ queryFormRef.value?.resetFields();
+ queryParams.value.orderByColumn = defaultSort.value.prop;
+ queryParams.value.isAsc = defaultSort.value.order;
+ handleQuery();
+}
+/** 閫夋嫨鏉℃暟 */
+function handleSelectionChange(selection: OssVO[]) {
+ ids.value = selection.map(item => item.ossId);
+ single.value = selection.length != 1;
+ multiple.value = !selection.length;
+}
+/** 璁剧疆鍒楃殑鎺掑簭涓烘垜浠嚜瀹氫箟鐨勬帓搴� */
+const handleHeaderClass = ({ column }: any): any => {
+ column.order = column.multiOrder
+}
+/** 鐐瑰嚮琛ㄥご杩涜鎺掑簭 */
+const handleHeaderCLick = (column: any) => {
+ if (column.sortable !== 'custom') {
+ return
+ }
+ switch (column.multiOrder) {
+ case 'descending':
+ column.multiOrder = 'ascending';
+ break;
+ case 'ascending':
+ column.multiOrder = '';
+ break;
+ default:
+ column.multiOrder = 'descending';
+ break;
+ }
+ handleOrderChange(column.property, column.multiOrder)
+}
+const handleOrderChange = (prop: string, order: string) => {
+ let orderByArr = queryParams.value.orderByColumn ? queryParams.value.orderByColumn.split(",") : [];
+ let isAscArr = queryParams.value.isAsc ? queryParams.value.isAsc.split(",") : [];
+ let propIndex = orderByArr.indexOf(prop)
+ if (propIndex !== -1) {
+ if (order) {
+ //鎺掑簭閲屽凡瀛樺湪 鍙慨鏀规帓搴�
+ isAscArr[propIndex] = order;
+ } else {
+ //濡傛灉order涓簄ull 鍒欏垹闄ゆ帓搴忓瓧娈靛拰灞炴��
+ isAscArr.splice(propIndex, 1);//鍒犻櫎鎺掑簭
+ orderByArr.splice(propIndex, 1);//鍒犻櫎灞炴��
+ }
+ } else {
+ //鎺掑簭閲屼笉瀛樺湪鍒欐柊澧炴帓搴�
+ orderByArr.push(prop);
+ isAscArr.push(order);
+ }
+ //鍚堝苟鎺掑簭
+ queryParams.value.orderByColumn = orderByArr.join(",");
+ queryParams.value.isAsc = isAscArr.join(",");
+ getList();
+}
+/** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */
+const handleOssConfig = () => {
+ router.push('/system/oss-config/index')
+}
+/** 鏂囦欢鎸夐挳鎿嶄綔 */
+const handleFile = () => {
+ reset();
+ type.value = 0;
+ dialog.visible = true;
+ dialog.title = "涓婁紶鏂囦欢";
+}
+/** 鍥剧墖鎸夐挳鎿嶄綔 */
+const handleImage = () => {
+ reset();
+ type.value = 1;
+ dialog.visible = true;
+ dialog.title = "涓婁紶鍥剧墖";
+}
+const handleVideo = ()=>{
+ reset();
+ type.value = 2;
+ dialog.visible = true;
+ dialog.title = "涓婁紶瑙嗛";
+}
+/** 鎻愪氦鎸夐挳 */
+const submitForm = () => {
+ dialog.visible = false;
+ getList();
+}
+const handleCode = async (row: OssVO) => {
+ console.log(row, row.ossId);
+
+ await examineIds(row.ossId).then(res => {
+ console.log(res);
+ if (res.code == 200) {
+ testtxt.value = res.msg;
+ titleDownload.value = '鏌ョ湅鎻愬彇鐮�'
+ pasTxt.value = ''
+ // inputSty.value ={
+ // border: '1px solid blue'
+ // }
+ visibleCode.value = true
+
+ } else {
+ const message = res.msg;
+ proxy?.$modal.msgSuccess(message);
+
+ }
+ })
+}
+/** 涓嬭浇鎸夐挳鎿嶄綔 */
+const handleDownload = (row: OssVO) => {
+ titleDownload.value = '杈撳叆鎻愬彇鐮�'
+ pasTxt.value = ''
+ inputSty.value ={
+ border: '1px solid blue',
+ borderRadius: '5px'
+ }
+ visibleCode.value = true
+ downIds.value = ref(row.ossId)
+ console.log(toRaw(downIds.value.value));
+}
+const handleDownloadFile = ()=>{
+ console.log(downIds.value);
+ if (pasTxt.value){
+ proxy?.$download.ossDown(downIds.value.value,pasTxt.value)
+ }else {
+ console.log(inputRef.value);
+ inputSty.value ={
+ border: '1px solid red'
+ }
+ // inputRef.value.style.border = '1px solid red'
+ }
+
+}
+/** 鐢ㄦ埛鐘舵�佷慨鏀� */
+const handlePreviewListResource = async (preview: boolean) => {
+ let text = preview ? "鍚敤" : "鍋滅敤";
+ try {
+ await proxy?.$modal.confirm('纭瑕�"' + text + '""棰勮鍒楄〃鍥剧墖"閰嶇疆鍚�?');
+ await proxy?.updateConfigByKey("sys.oss.previewListResource", preview);
+ await getList()
+ proxy?.$modal.msgSuccess(text + "鎴愬姛");
+ } catch { return }
+}
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (row?: OssVO) => {
+ const ossIds = row?.ossId || ids.value;
+ await proxy?.$modal.confirm('鏄惁纭鍒犻櫎OSS瀵硅薄瀛樺偍缂栧彿涓�"' + ossIds + '"鐨勬暟鎹」?');
+ loading.value = true;
+ await delOss(ossIds).finally(() => loading.value = false);
+ await getList();
+ proxy?.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+}
+const refreshPage = async () => {
+ // const [err] = await tos(useUserStore().getInfo());
+ // console.log(err);
+ const accessRoutes = await usePermissionStore().generateRoutes();
+ // 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛�
+ accessRoutes.forEach((route) => {
+ if (!isHttp(route.path)) {
+ router.addRoute(route); // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛�
+ }
+ });
+ // location.reload();
+};
+const isContains = (arr: string | any[], value: any) => {
+ return arr.includes(value);
+};
+const setAddUser = async (val: any | number | (string | number)[]) => {
+ console.log(val);
+ const res = await createUser(val)
+ console.log(res);
+ if (res.code==200){
+ const data = res.data;
+ setToken(data.access_token);
+ await refreshPage()
+ await getList()
+ await nextTick(async () => {
+ const [err] = await tos(useUserStore().getInfo());
+ console.log('useUserStore', useUserStore,err);
+ console.log('permissions', useUserStore().permissions,'system:oss:upload');
+
+ })
+
+ // token.value = data.access_token;
+ }
+}
+// watch(() => value.value, (newValue) => {
+// if (newValue) {
+// showValue.value = true;
+// } else {
+// showValue.value = false;
+// }
+// });
+onBeforeMount( async () => {
+ console.log('绗竴',useUserStore().permissions);
+ try {
+ // 浣跨敤fetch API鑾峰彇褰撳墠IP鍦板潃
+ await fetch('https://api.ipify.org/?format=json')
+ .then(response => response.json())
+ .then(async data => {
+ currentIp.value = data.ip;
+ let obj = {
+ username: data.ip
+ }
+ await setAddUser(obj)
+ })
+ .catch(error => {
+ console.error('鑾峰彇IP鍦板潃澶辫触锛�', error);
+ });
+ } catch (error) {
+ console.log(error);
+ }
+
+})
+onMounted(async () => {
+ console.log('绗簩',useUserStore().permissions);
+ // 绛夊緟 useUserStore() 鏂规硶鐨� getInfo() 鏂规硶杩斿洖缁撴灉骞惰祴鍊肩粰 err 鍙橀噺
+ // const [err] = await tos(useUserStore().getInfo());
+
+ // 璋冪敤 getList() 鏂规硶
+ // await getList();
+})
+
</script>
-
-<style scoped lang="scss">
-.home {
- blockquote {
- padding: 10px 20px;
- margin: 0 0 20px;
- font-size: 17.5px;
- border-left: 5px solid #eee;
- }
- hr {
- margin-top: 20px;
- margin-bottom: 20px;
- border: 0;
- border-top: 1px solid #eee;
- }
- .col-item {
- margin-bottom: 20px;
- }
-
- ul {
- padding: 0;
- margin: 0;
- }
-
- font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: 13px;
- color: #676a6c;
- overflow-x: hidden;
-
- ul {
- list-style-type: none;
- }
-
- h4 {
- margin-top: 0px;
- }
-
- h2 {
- margin-top: 10px;
- font-size: 26px;
- font-weight: 100;
- }
-
- p {
- margin-top: 10px;
-
- b {
- font-weight: 700;
- }
- }
-
- .update-log {
- ol {
- display: block;
- list-style-type: decimal;
- margin-block-start: 1em;
- margin-block-end: 1em;
- margin-inline-start: 0;
- margin-inline-end: 0;
- padding-inline-start: 40px;
- }
- }
-}
-</style>
diff --git a/src/views/login.vue b/src/views/login.vue
index 60b7940..02cef14 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -1,13 +1,13 @@
<template>
<div class="login">
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
- <h3 class="title">RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�</h3>
- <el-form-item prop="tenantId" v-if="tenantEnabled">
- <el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">
- <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>
- <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
- </el-select>
- </el-form-item>
+ <h3 class="title">璺ㄧ綉鏂囦欢鍚屾绯荤粺</h3>
+<!-- <el-form-item prop="tenantId" v-if="tenantEnabled">-->
+<!-- <el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">-->
+<!-- <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>-->
+<!-- <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>-->
+<!-- </el-select>-->
+<!-- </el-form-item>-->
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="璐﹀彿">
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
@@ -27,20 +27,20 @@
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">璁颁綇瀵嗙爜</el-checkbox>
- <el-form-item style="float: right;">
- <el-button circle title="寰俊鐧诲綍" @click="doSocialLogin('wechat')">
- <svg-icon icon-class="wechat" />
- </el-button>
- <el-button circle title="MaxKey鐧诲綍" @click="doSocialLogin('maxkey')">
- <svg-icon icon-class="maxkey" />
- </el-button>
- <el-button circle title="Gitee鐧诲綍" @click="doSocialLogin('gitee')">
- <svg-icon icon-class="gitee" />
- </el-button>
- <el-button circle title="Github鐧诲綍" @click="doSocialLogin('github')">
- <svg-icon icon-class="github" />
- </el-button>
- </el-form-item>
+ <!-- <el-form-item style="float: right;">-->
+ <!-- <el-button circle title="寰俊鐧诲綍" @click="doSocialLogin('wechat')">-->
+<!-- <svg-icon icon-class="wechat" />-->
+<!-- </el-button>-->
+<!-- <el-button circle title="MaxKey鐧诲綍" @click="doSocialLogin('maxkey')">-->
+<!-- <svg-icon icon-class="maxkey" />-->
+<!-- </el-button>-->
+<!-- <el-button circle title="Gitee鐧诲綍" @click="doSocialLogin('gitee')">-->
+<!-- <svg-icon icon-class="gitee" />-->
+<!-- </el-button>-->
+<!-- <el-button circle title="Github鐧诲綍" @click="doSocialLogin('github')">-->
+<!-- <svg-icon icon-class="github" />-->
+<!-- </el-button>-->
+<!-- </el-form-item>-->
<el-form-item style="width:100%;">
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
<span v-if="!loading">鐧� 褰�</span>
@@ -53,7 +53,7 @@
</el-form>
<!-- 搴曢儴 -->
<div class="el-login-footer">
- <span>Copyright 漏 2018-2023 鐤媯鐨勭嫯瀛怢i All Rights Reserved.</span>
+ <span>Copyright 漏 浼樺垱鍔�.</span>
</div>
</div>
</template>
@@ -82,7 +82,7 @@
tenantId: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勭鎴风紪鍙�" }],
username: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ偍鐨勮处鍙�' }],
password: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ偍鐨勫瘑鐮�' }],
- code: [{ required: false, trigger: 'change', message: '璇疯緭鍏ラ獙璇佺爜' }]
+ code: [{ required: true, trigger: 'change', message: '璇疯緭鍏ラ獙璇佺爜' }]
};
const codeUrl = ref('');
@@ -90,7 +90,7 @@
// 楠岃瘉鐮佸紑鍏�
const captchaEnabled = ref(true);
// 绉熸埛寮�鍏�
-const tenantEnabled = ref(true);
+const tenantEnabled = ref(false);
// 娉ㄥ唽寮�鍏�
@@ -125,7 +125,9 @@
console.log(loginForm.value);
const [err] = await to(userStore.login(loginForm.value));
if (!err) {
- await router.push({ path: redirect.value || '/' });
+ console.log(redirect.value);
+ // await router.push({ path: redirect.value || '/' });
+ await router.push({ path: '/oss' || '/' });
loading.value = false;
} else {
loading.value = false;
diff --git a/src/views/register.vue b/src/views/register.vue
index c2dd6a3..d4d262a 100644
--- a/src/views/register.vue
+++ b/src/views/register.vue
@@ -1,7 +1,7 @@
<template>
<div class="register">
<el-form ref="registerRef" :model="registerForm" :rules="registerRules" class="register-form">
- <h3 class="title">RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�</h3>
+ <h3 class="title">璺ㄧ綉鏂囦欢鍚屾绯荤粺</h3>
<el-form-item prop="tenantId" v-if="tenantEnabled">
<el-select v-model="registerForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"> </el-option>
@@ -50,7 +50,7 @@
</el-form>
<!-- 搴曢儴 -->
<div class="el-register-footer">
- <span>Copyright 漏 2018-2023 鐤媯鐨勭嫯瀛怢i All Rights Reserved.</span>
+ <span>Copyright 漏 浼樺垱鍔�.</span>
</div>
</div>
</template>
@@ -73,7 +73,7 @@
});
// 绉熸埛寮�鍏�
-const tenantEnabled = ref(true);
+const tenantEnabled = ref(false);
const equalToPassword = (rule: any, value: string, callback: any) => {
diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue
index ec11708..d8f17ef 100644
--- a/src/views/system/oss/index.vue
+++ b/src/views/system/oss/index.vue
@@ -4,29 +4,29 @@
<div class="mb-[10px]" v-show="showSearch">
<el-card shadow="hover">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
- <el-form-item label="鏂囦欢鍚�" prop="fileName">
- <el-input v-model="queryParams.fileName" placeholder="璇疯緭鍏ユ枃浠跺悕" clearable style="width: 200px" @keyup.enter="handleQuery" />
- </el-form-item>
+<!-- <el-form-item label="鏂囦欢鍚�" prop="fileName">-->
+<!-- <el-input v-model="queryParams.fileName" placeholder="璇疯緭鍏ユ枃浠跺悕" clearable style="width: 200px" @keyup.enter="handleQuery" />-->
+<!-- </el-form-item>-->
<el-form-item label="鍘熷悕" prop="originalName">
<el-input v-model="queryParams.originalName" placeholder="璇疯緭鍏ュ師鍚�" clearable style="width: 200px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="鏂囦欢鍚庣紑" prop="fileSuffix">
<el-input v-model="queryParams.fileSuffix" placeholder="璇疯緭鍏ユ枃浠跺悗缂�" clearable style="width: 200px" @keyup.enter="handleQuery" />
</el-form-item>
- <el-form-item label="鍒涘缓鏃堕棿">
- <el-date-picker
- v-model="dateRangeCreateTime"
- value-format="YYYY-MM-DD HH:mm:ss"
- type="daterange"
- range-separator="-"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
- ></el-date-picker>
- </el-form-item>
- <el-form-item label="鏈嶅姟鍟�" prop="service">
- <el-input v-model="queryParams.service" placeholder="璇疯緭鍏ユ湇鍔″晢" clearable style="width: 200px" @keyup.enter="handleQuery" />
- </el-form-item>
+<!-- <el-form-item label="鍒涘缓鏃堕棿">-->
+<!-- <el-date-picker-->
+<!-- v-model="dateRangeCreateTime"-->
+<!-- value-format="YYYY-MM-DD HH:mm:ss"-->
+<!-- type="daterange"-->
+<!-- range-separator="-"-->
+<!-- start-placeholder="寮�濮嬫棩鏈�"-->
+<!-- end-placeholder="缁撴潫鏃ユ湡"-->
+<!-- :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"-->
+<!-- ></el-date-picker>-->
+<!-- </el-form-item>-->
+<!-- <el-form-item label="鏈嶅姟鍟�" prop="service">-->
+<!-- <el-input v-model="queryParams.service" placeholder="璇疯緭鍏ユ湇鍔″晢" clearable style="width: 200px" @keyup.enter="handleQuery" />-->
+<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery">鎼滅储</el-button>
<el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
@@ -46,23 +46,26 @@
<el-button type="primary" plain icon="Upload" @click="handleImage" v-hasPermi="['system:oss:upload']">涓婁紶鍥剧墖</el-button>
</el-col>
<el-col :span="1.5">
+ <el-button type="primary" plain icon="Upload" @click="handleVideo" v-hasPermi="['system:oss:upload']">涓婁紶瑙嗛</el-button>
+ </el-col>
+ <el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:oss:remove']">
鍒犻櫎
</el-button>
</el-col>
+<!-- <el-col :span="1.5">-->
+<!-- <el-button-->
+<!-- :type="previewListResource ? 'danger' : 'warning'"-->
+<!-- plain-->
+<!-- @click="handlePreviewListResource(!previewListResource)"-->
+<!-- v-hasPermi="['system:oss:edit']"-->
+<!-- >棰勮寮�鍏� :-->
+<!-- {{-->
+<!-- previewListResource ? "绂佺敤" : "鍚敤" }}</el-button-->
+<!-- >-->
+<!-- </el-col>-->
<el-col :span="1.5">
- <el-button
- :type="previewListResource ? 'danger' : 'warning'"
- plain
- @click="handlePreviewListResource(!previewListResource)"
- v-hasPermi="['system:oss:edit']"
- >棰勮寮�鍏� :
- {{
- previewListResource ? "绂佺敤" : "鍚敤" }}</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button type="info" plain icon="Operation" @click="handleOssConfig" v-hasPermi="['system:oss:list']">閰嶇疆绠$悊</el-button>
+ <el-button type="info" plain icon="Operation" @click="handleOssConfig" v-hasPermi="['system:oss:lists']">閰嶇疆绠$悊</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -77,31 +80,34 @@
v-if="showTable"
>
<el-table-column type="selection" width="55" align="center" />
- <el-table-column label="瀵硅薄瀛樺偍涓婚敭" align="center" prop="ossId" v-if="false" />
- <el-table-column label="鏂囦欢鍚�" align="center" prop="fileName" />
+<!-- <el-table-column label="瀵硅薄瀛樺偍涓婚敭" align="center" prop="ossId" v-if="true" />-->
+<!-- <el-table-column label="鏂囦欢鍚�" align="center" prop="fileName" />-->
<el-table-column label="鍘熷悕" align="center" prop="originalName" />
<el-table-column label="鏂囦欢鍚庣紑" align="center" prop="fileSuffix" />
- <el-table-column label="鏂囦欢灞曠ず" align="center" prop="url">
- <template #default="scope">
- <ImagePreview
- v-if="previewListResource && checkFileSuffix(scope.row.fileSuffix)"
- :width="100"
- :height="100"
- :src="scope.row.url"
- :preview-src-list="[scope.row.url]"
- />
- <span v-text="scope.row.url" v-if="!checkFileSuffix(scope.row.fileSuffix) || !previewListResource" />
- </template>
- </el-table-column>
+<!-- <el-table-column label="鏂囦欢灞曠ず" align="center" prop="url">-->
+<!-- <template #default="scope">-->
+<!-- <ImagePreview-->
+<!-- v-if="previewListResource && checkFileSuffix(scope.row.fileSuffix)"-->
+<!-- :width="100"-->
+<!-- :height="100"-->
+<!-- :src="scope.row.url"-->
+<!-- :preview-src-list="[scope.row.url]"-->
+<!-- />-->
+<!-- <span v-text="scope.row.url" v-if="!checkFileSuffix(scope.row.fileSuffix) || !previewListResource" />-->
+<!-- </template>-->
+<!-- </el-table-column>-->
<el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180" sortable="custom">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="涓婁紶浜�" align="center" prop="createByName" />
- <el-table-column label="鏈嶅姟鍟�" align="center" prop="service" sortable="custom" />
+<!-- <el-table-column label="鏈嶅姟鍟�" align="center" prop="service" sortable="custom" />-->
<el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
<template #default="scope">
+ <el-tooltip content="鏌ョ湅鎻愬彇鐮�" placement="top">
+ <el-button link type="primary" icon="Search" @click="handleCode(scope.row)" v-hasPermi="['system:oss:decode']"></el-button>
+ </el-tooltip>
<el-tooltip content="涓嬭浇" placement="top">
<el-button link type="primary" icon="Download" @click="handleDownload(scope.row)" v-hasPermi="['system:oss:download']"></el-button>
</el-tooltip>
@@ -120,12 +126,22 @@
<el-form-item label="鏂囦欢鍚�">
<fileUpload v-model="form.file" v-if="type === 0" />
<imageUpload v-model="form.file" v-if="type === 1" />
+ <video-upload v-model="form.file" v-if="type === 2" />"
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
<el-button @click="cancel">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <el-dialog title="鏌ョ湅鎻愬彇鐮�" v-model="visibleCode" width="500px" append-to-body>
+ <span>qw15rw</span>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="visibleCode = false">纭� 瀹�</el-button>
+ <el-button @click="visibleCode = false">鍙� 娑�</el-button>
</div>
</template>
</el-dialog>
@@ -152,7 +168,7 @@
const type = ref(0);
const previewListResource = ref(true);
const dateRangeCreateTime = ref<[DateModelType, DateModelType]>(['', '']);
-
+const visibleCode = ref(false);
const dialog = reactive<DialogOption>({
visible: false,
title: ''
@@ -300,11 +316,20 @@
dialog.visible = true;
dialog.title = "涓婁紶鍥剧墖";
}
+const handleVideo = ()=>{
+ reset();
+ type.value = 2;
+ dialog.visible = true;
+ dialog.title = "涓婁紶瑙嗛";
+}
/** 鎻愪氦鎸夐挳 */
const submitForm = () => {
dialog.visible = false;
getList();
}
+const handleCode = ()=>{
+ visibleCode.value = true
+}
/** 涓嬭浇鎸夐挳鎿嶄綔 */
const handleDownload = (row: OssVO) => {
proxy?.$download.oss(row.ossId)
--
Gitblit v1.8.0