From fc193342cbb2de557d7e590b7051629ff3cdcb14 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 22 十二月 2023 09:59:48 +0800
Subject: [PATCH] 内网
---
src/views/system/oss/index.vue | 212 +++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 166 insertions(+), 46 deletions(-)
diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue
index b6ea088..71e2fc5 100644
--- a/src/views/system/oss/index.vue
+++ b/src/views/system/oss/index.vue
@@ -25,11 +25,11 @@
<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="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="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-if="isContains(useUserStore().permissions, 'system:oss:remove')">-->
+ <!-- 鍒犻櫎-->
+ <!-- </el-button>-->
+ <!-- </el-col>-->
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
@@ -41,9 +41,10 @@
@header-click="handleHeaderCLick"
v-if="showTable"
>
- <el-table-column type="selection" width="55" align="center" />
+ <el-table-column type="index" />
+ <!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="鍘熷悕" align="center" prop="originalName" />
- <el-table-column label="涓婁紶浜�" align="center" prop="createByName" />
+ <el-table-column label="涓婁紶鏃堕棿" align="center" prop="createTime" />
<el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="鏌ョ湅鎻愬彇鐮�" placement="top">
@@ -65,9 +66,9 @@
<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 ref="childFile" @closePopup="getList()" v-model="form.file" v-if="type === 0" />
+ <fileUpload ref="childFile" @closePopup="getList();lookPawsd($event)" @openPopup="lookPawsd($event)" 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" />"
+ <video-upload v-model="form.file" v-if="type === 2" />
</el-form-item>
</el-form>
<template #footer>
@@ -78,15 +79,34 @@
</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>
+ <p style="color: red">鎻愬彇鐮佸皢浼氬湪24灏忔椂鍚庡け鏁堣灏藉揩涓嬭浇!</p>
+ <span v-show="titleDownload=='鏌ョ湅鎻愬彇鐮�'" style="font-size: 32px;">{{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-input style="margin: 10px 0" ref="inputRef" :style="inputSty" v-show="titleDownload=='璇疯緭鍏ユ彁鍙栫爜'" v-model="pasTxt" 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>-->
+ <!-- <el-button link type="primary" v-show="titleDownload=='璇疯緭鍏ユ彁鍙栫爜'" icon="Delete" @click="delFile()" >鍒犻櫎</el-button>-->
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="visibleCode = false">纭� 瀹�</el-button>
- <el-button @click="visibleCode = false">鍙� 娑�</el-button>
+ <el-button type="primary" v-show="titleDownload=='杈撳叆鎻愬彇鐮�'" @click="handleDownloadFile()" v-if="isContains(useUserStore().permissions, 'system:oss:download')">涓� 杞�</el-button>
+ <el-button type="primary" v-show="titleDownload=='璇疯緭鍏ユ彁鍙栫爜'" @click="delFile()" >鍒� 闄�</el-button>
+ <el-button type="primary" v-if="titleDownload!='杈撳叆鎻愬彇鐮�'&&titleDownload!='璇疯緭鍏ユ彁鍙栫爜'" @click="visibleCode = false">纭� 瀹�</el-button>
</div>
</template>
+ </el-dialog>
+
+ <!-- 杩涘害鏉� -->
+ <el-dialog
+ v-model="dialogVisible"
+ title=""
+ width="37%"
+ :close-on-click-modal = "false"
+ :close-on-press-escape = "false"
+ :show-close = "false"
+
+ >
+ <span @closePopup1="lookPawsd1()">
+ <el-progress type="dashboard" :percentage="percentage2" style="display: flex;justify-content: center" :color="colors" />
+ </span>
</el-dialog>
</div>
</template>
@@ -96,10 +116,56 @@
import { OssForm, OssQuery, OssVO } from "@/api/system/oss/types";
import { to as tos } from "await-to-js";
import useUserStore from "@/store/modules/user";
-import { setToken } from "@/utils/auth";
+import { getToken, setToken } from "@/utils/auth";
import usePermissionStore from "@/store/modules/permission";
import { isHttp } from "@/utils/validate";
import router from '@/router';
+import { onMounted, ref } from 'vue';
+import { Minus, Plus } from '@element-plus/icons-vue';
+import { ElMessageBox } from 'element-plus';
+
+const dialogVisible = ref(false)
+
+const state = reactive({
+ mytime:0,//瀹氫箟瀹氭椂鍣�
+ })
+const percentage = ref(10)
+const percentage2 = ref(0)
+
+const colors = [
+ { color: '#f56c6c', percentage: 20 },
+ { color: '#e6a23c', percentage: 40 },
+ { color: '#5cb87a', percentage: 60 },
+ { color: '#1989fa', percentage: 80 },
+ { color: '#6f7ad3', percentage: 100 },
+]
+
+const increase = () => {
+ percentage.value += 10
+ if (percentage.value > 100) {
+ percentage.value = 100
+ }
+}
+const decrease = () => {
+ percentage.value -= 10
+ if (percentage.value < 0) {
+ percentage.value = 0
+ }
+}
+onMounted(() => {
+
+
+})
+watch(percentage2, (new1,new2) => {
+ console.log(new1,new2)
+ if(new1 == 95){
+ clearInterval(state.mytime);
+ state.mytime = 0;
+ }
+})
+
+
+
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const ossList = ref<OssVO[]>([]);
@@ -127,8 +193,9 @@
const inputSty =ref<any>()
const currentIp = ref('')
const childFile = ref<any>()
+const figType = ref<any>()
// 榛樿鎺掑簭
-const defaultSort = ref({ prop: 'createTime', order: 'ascending' });
+const defaultSort = ref({ prop: 'createTime', order: 'descending' });
const ossFormRef = ref<ElFormInstance>();
const queryFormRef = ref<ElFormInstance>();
@@ -257,6 +324,7 @@
/** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */
/** 鏂囦欢鎸夐挳鎿嶄綔 */
const handleFile = () => {
+ percentage2.value = 0;
reset();
type.value = 0;
dialog.visible = true;
@@ -281,13 +349,38 @@
await childFile.value.handleCilck()
dialog.visible = false;
}
+const lookPawsd = async (row: any) => {
+ console.log(row, row.ossId);
+
+ clearInterval(state.mytime);
+ state.mytime = 0;
+ if(row == '123123'){
+ dialogVisible.value = true;
+ state.mytime = setInterval(() => {
+ percentage2.value = (percentage2.value % 100) + 5
+ }, 500)
+ }
+ else{
+ dialogVisible.value = false;
+ clearInterval(state.mytime);
+ state.mytime = 0;
+ testtxt.value = row.password;
+ titleDownload.value = '鏌ョ湅鎻愬彇鐮�'
+ pasTxt.value = ''
+ visibleCode.value = true
+ }
+
+}
+const lookPawsd1 = async () => {
+ dialogVisible.value = true;
+}
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;
+ testtxt.value = res.data.password;
titleDownload.value = '鏌ョ湅鎻愬彇鐮�'
pasTxt.value = ''
// inputSty.value ={
@@ -314,6 +407,13 @@
downIds.value = ref(row.ossId)
console.log(toRaw(downIds.value.value));
}
+const delFile=async () => {
+ let oss = figType.value+'/'+ pasTxt.value;
+ await delOss(oss).finally(() => loading.value = false);
+ await getList();
+ proxy?.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ visibleCode.value = false
+}
const handleDownloadFile = ()=>{
console.log(downIds.value);
if (pasTxt.value){
@@ -325,20 +425,31 @@
}
// inputRef.value.style.border = '1px solid red'
}
-
+ visibleCode.value=false
}
/** 鐢ㄦ埛鐘舵�佷慨鏀� */
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
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("鍒犻櫎鎴愬姛");
+ let ossIds = row?.ossId || ids.value;
+ titleDownload.value = '璇疯緭鍏ユ彁鍙栫爜'
+ pasTxt.value = ''
+ inputSty.value ={
+ border: '1px solid blue',
+ borderRadius: '5px'
+ }
+ visibleCode.value = true
+ figType.value = ossIds
+ console.log(figType);
+ // await proxy?.$modal.confirm('鏄惁纭鍒犻櫎OSS瀵硅薄瀛樺偍缂栧彿涓�"' + ossIds + '"鐨勬暟鎹」?');
+ // loading.value = true;
+ // ossIds = ossIds+'/'+pasTxt.value;
+ // await delOss(ossIds).finally(() => loading.value = false);
+ // await getList();
+ // proxy?.$modal.msgSuccess("鍒犻櫎鎴愬姛");
}
const refreshPage = async () => {
const accessRoutes = await usePermissionStore().generateRoutes();
+ console.log(accessRoutes,'accessRoutes',router);
// 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛�
accessRoutes.forEach((route) => {
if (!isHttp(route.path)) {
@@ -350,6 +461,7 @@
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)
@@ -357,11 +469,12 @@
if (res.code==200){
const data = res.data;
setToken(data.access_token);
- await getList()
- // await refreshPage()
-
const [err] = await tos(useUserStore().getInfo());
console.log('useUserStore', useUserStore,err);
+ await getList()
+
+ // await refreshPage()
+
console.log('permissions', useUserStore().permissions,'system:oss:upload');
// token.value = data.access_token;
}
@@ -375,32 +488,39 @@
// });
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);
- }
+ // 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);
+ console.log('绗簩aaaaaaa',useUserStore().permissions);
// 绛夊緟 useUserStore() 鏂规硶鐨� getInfo() 鏂规硶杩斿洖缁撴灉骞惰祴鍊肩粰 err 鍙橀噺
// const [err] = await tos(useUserStore().getInfo());
+ if (getToken()){
+ console.log('鏈塼oken');
+ await getList();
+ }else {
+ console.log('鏃爐oken');
+ router.push('/login')
+ }
// 璋冪敤 getList() 鏂规硶
- // await getList();
+
})
</script>
--
Gitblit v1.8.0