From b19c888d4c5ff564e76d9cd1e5adddf6ed35c8ee Mon Sep 17 00:00:00 2001
From: qirong <2032486488@qq.com>
Date: 星期二, 12 十二月 2023 13:57:29 +0800
Subject: [PATCH] 修改上传

---
 src/views/index.vue                 |  139 +++++++++++++++------------
 vite.config.ts                      |    2 
 dist.zip                            |    0 
 src/utils/request.ts                |    2 
 src/components/FileUpload/index.vue |   12 +-
 src/views/system/oss/index.vue      |   92 +++++++++++++++++-
 6 files changed, 171 insertions(+), 76 deletions(-)

diff --git a/dist.zip b/dist.zip
index f4cbf83..504fed4 100644
--- a/dist.zip
+++ b/dist.zip
Binary files differ
diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue
index a153cb7..8bd0a8c 100644
--- a/src/components/FileUpload/index.vue
+++ b/src/components/FileUpload/index.vue
@@ -12,13 +12,14 @@
       ref="fileUploadRef"
       :auto-upload="false"
       :on-exceed="handleExceed"
+      :before-upload="handleBeforeUpload"
     >
       <!-- 涓婁紶鎸夐挳 -->
       <el-button type="primary">閫夊彇鏂囦欢</el-button>
     </el-upload>
     <!-- 涓婁紶鎻愮ず -->
     <div class="el-upload__tip" v-if="showTip">
-      <span>璇蜂笂浼犳枃浠�</span>
+      <span>涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃200MB</span>
     </div>
 
   </div>
@@ -31,6 +32,7 @@
 import { LoadingInstance } from 'element-plus/es/components/loading/src/loading';
 import router from "@/router";
 let downloadLoadingInstance: LoadingInstance;
+
 const props = defineProps({
     modelValue: [String, Object, Array],
     // 鏁伴噺闄愬埗
@@ -159,7 +161,10 @@
     proxy?.$modal.msgError("涓婁紶鏂囦欢澶辫触");
 }
 const handleUploadProgress=(e: any) => {
-  downloadLoadingInstance = ElLoading.service({ text: '姝e湪涓婁紶鏂囦欢锛岃绋嶅��', background: 'rgba(0, 0, 0, 0.7)' });
+//   downloadLoadingInstance = ElLoading.service({ text: '姝e湪涓婁紶鏂囦欢锛岃绋嶅��', background: 'rgba(0, 0, 0, 0.7)' });
+//   dialogVisible.value = true;
+  emit('closePopup','123123');
+
 }
 // 涓婁紶鎴愬姛鍥炶皟
 const handleUploadSuccess = (res: any, file: UploadFile) => {
@@ -167,10 +172,8 @@
     if (res.code === 200) {
       proxy?.$modal.msgSuccess("涓婁紶鏂囦欢鎴愬姛");
       emit('closePopup',res.data)
-
       console.log('璋冪敤鐖剁粍浠�',res);
       fileUploadRef.value!.clearFiles()
-      downloadLoadingInstance.close();
         uploadList.value.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
         uploadedSuccessfully();
     }else if (res.code == 401) {
@@ -181,7 +184,6 @@
         proxy?.$modal.msgError(res.msg);
         fileUploadRef.value?.handleRemove(file);
         uploadedSuccessfully();
-      downloadLoadingInstance.close();
 
     }
 }
diff --git a/src/utils/request.ts b/src/utils/request.ts
index c89cc52..2e495be 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -66,7 +66,7 @@
         const s_url = sessionObj.url; // 璇锋眰鍦板潃
         const s_data = sessionObj.data; // 璇锋眰鏁版嵁
         const s_time = sessionObj.time; // 璇锋眰鏃堕棿
-        const interval = 600000; // 闂撮殧鏃堕棿(ms)锛屽皬浜庢鏃堕棿瑙嗕负閲嶅鎻愪氦
+        const interval = 6; // 闂撮殧鏃堕棿(ms)锛屽皬浜庢鏃堕棿瑙嗕负閲嶅鎻愪氦
         if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
           const message = '鏁版嵁姝e湪澶勭悊锛岃鍕块噸澶嶆彁浜�';
           console.warn(`[${s_url}]: ` + message);
diff --git a/src/views/index.vue b/src/views/index.vue
index 786012e..65dfbe8 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -1,66 +1,68 @@
 <template>
   <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">
+<!--    <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="originalName">
-              <el-input v-model="queryParams.originalName" 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>
-              <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-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-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-row  style="text-align: center">
+          <el-col>
+          <el-input v-model="input1" placeholder="璇疯緭鍏ユ彁鍙栫爜" style="width: 150px">
+    </el-input>
+            <el-button type="primary" @click="downloadFile">涓嬭浇</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-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>
-      <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="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="createTime" />
-        <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>
+<!--      <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="index"  />-->
+<!--&lt;!&ndash;        <el-table-column type="selection" width="55" align="center" />&ndash;&gt;-->
+<!--        <el-table-column label="鍘熷悕" align="center" prop="originalName" />-->
+<!--        <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">-->
+<!--              <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" />
+<!--      <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>
@@ -83,14 +85,13 @@
       <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-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>-->
+<!--      <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 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>
-          <!--          <el-button  type="primary" @click="visibleCode = false">纭� 瀹�</el-button>-->
-          <el-button @click="visibleCode = false">鍙� 娑�</el-button>
+          <el-button  type="primary" @click="visibleCode = false">纭� 瀹�</el-button>
         </div>
       </template>
     </el-dialog>
@@ -132,6 +133,7 @@
 const inputRef = ref<any>()
 const inputSty =ref<any>()
 const currentIp = ref('')
+const input1 = ref('')
 const childFile = ref<any>()
 const figType = ref<any>()
 // 榛樿鎺掑簭
@@ -288,12 +290,13 @@
   await childFile.value.handleCilck()
   dialog.visible = false;
 }
-const lookPawsd = async (row: OssVO) => {
-  console.log(row, row.ossId);
-  testtxt.value = row.password;
-  titleDownload.value = '鏌ョ湅鎻愬彇鐮�'
-  pasTxt.value = ''
-  visibleCode.value = true
+const lookPawsd = async (row:any) => {
+  console.log(row);
+  // row.msg = ':/"123456'
+      testtxt.value = row.msg.slice(2);
+      titleDownload.value = '鏌ョ湅鎻愬彇鐮�'
+      pasTxt.value = ''
+      visibleCode.value = true
 }
 const handleCode = async (row: OssVO) => {
   console.log(row, row.ossId);
@@ -396,7 +399,7 @@
 
     // await refreshPage()
 
-    console.log('permissions', useUserStore().permissions,'system:oss:upload');
+      console.log('permissions', useUserStore().permissions,'system:oss:upload');
     // token.value = data.access_token;
   }
 }
@@ -428,6 +431,18 @@
   // }
 
 })
+const downloadFile = ()=>{
+  console.log(input1.value);
+  if (input1.value){
+    proxy?.$download.ossDown("12345678",input1.value)
+  }else {
+    inputSty.value ={
+      border: '1px solid red'
+    }
+    // inputRef.value.style.border = '1px solid red'
+  }
+  visibleCode.value=false
+}
 onMounted(async () => {
   console.log('绗簩aaaaaaa',useUserStore().permissions);
   // 绛夊緟 useUserStore() 鏂规硶鐨� getInfo() 鏂规硶杩斿洖缁撴灉骞惰祴鍊肩粰 err 鍙橀噺
diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue
index 786012e..9da3493 100644
--- a/src/views/system/oss/index.vue
+++ b/src/views/system/oss/index.vue
@@ -80,19 +80,33 @@
     </el-dialog>
     <el-dialog :title="titleDownload" v-model="visibleCode" width="500px" append-to-body>
       <p style="color: red">鎻愬彇鐮佸皢浼氬湪24灏忔椂鍚庡け鏁堣灏藉揩涓嬭浇!</p>
-      <span v-show="titleDownload=='鏌ョ湅鎻愬彇鐮�'">{{testtxt}}</span>
+      <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 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>
-          <!--          <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="30%"
+    :close-on-click-modal = "false"
+    :close-on-press-escape = "false"
+    :show-close = "false"
+    :before-close="handleClose"
+  >
+    <span @closePopup1="lookPawsd1()">
+    <el-progress type="dashboard" :percentage="percentage2" :color="colors" />
+    </span>
     </el-dialog>
   </div>
 </template>
@@ -106,6 +120,52 @@
 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:null,//瀹氫箟瀹氭椂鍣�
+    })
+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 = null;
+  }
+})
+
+
+
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
 const ossList = ref<OssVO[]>([]);
@@ -135,7 +195,7 @@
 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>();
@@ -264,6 +324,7 @@
 /** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */
 /** 鏂囦欢鎸夐挳鎿嶄綔 */
 const handleFile = () => {
+  
   reset();
   type.value = 0;
   dialog.visible = true;
@@ -290,10 +351,27 @@
 }
 const lookPawsd = async (row: OssVO) => {
   console.log(row, row.ossId);
-  testtxt.value = row.password;
+  clearInterval(state.mytime);
+    state.mytime = null;
+  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 = null;
+    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);
diff --git a/vite.config.ts b/vite.config.ts
index 5709a25..81263c2 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -28,7 +28,7 @@
         [env.VITE_APP_BASE_API]: {
           // target: 'http://80.36.32.176:8080',
           // target: 'http://51.9.57.211:8080',
-          target: 'http://192.168.3.43:8080',
+          target: 'http://80.36.32.176:8080',
           changeOrigin: true,
           rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
         }

--
Gitblit v1.8.0