Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/view/product/Detail.vue
huangyan 1 kuukausi sitten
vanhempi
commit
4716f615e6
1 muutettua tiedostoa jossa 23 lisäystä ja 20 poistoa
  1. 23 20
      src/view/resource/Index.vue

+ 23 - 20
src/view/resource/Index.vue

@@ -3,10 +3,14 @@
     <el-card>
       <!-- 添加el-button触发弹窗 -->
       <!-- 添加一个按钮来控制显示Upload组件 -->
-      <el-button type="primary" @click="toggleUpload">上传图片</el-button>
+      <!-- 添加el-button触发弹窗 -->
+      <el-button type="primary" @click="showUploadDialog = true">上传图片</el-button>
 
-      <!-- 使用v-if根据showUpload的值来决定是否渲染Upload组件 -->
-      <upload v-if="showUpload"></upload>
+      <!-- 使用el-dialog组件 -->
+      <el-dialog v-model="showUploadDialog" title="上传图片">
+        <!-- 在这里插入你的upload组件 -->
+        <upload @close="showUploadDialog = false" />
+      </el-dialog>
       <!-- 添加el-dialog组件 -->
       <el-table :data="tableData" border style="width: 100%;margin-top:20px">
         <el-table-column label="序号" width="60">
@@ -28,26 +32,25 @@
         <el-table-column label="操作" width="100">
           <template #default="scope">
             <el-button type="danger" size="small" @click="deleteResource(scope.row.ID)">删除</el-button>
-<!--            <el-button type="primary" size="small" @click="deleteResource(scope.row.ID)">修改</el-button>-->
-<!--            <el-button size="small"-->
-<!--                       @click="() => router.push({ path: '/user/detail', query: { id: scope.row.id } })">详情-->
-<!--            </el-button>-->
+            <!--            <el-button type="primary" size="small" @click="deleteResource(scope.row.ID)">修改</el-button>-->
+            <!--            <el-button size="small"-->
+            <!--                       @click="() => router.push({ path: '/user/detail', query: { id: scope.row.id } })">详情-->
+            <!--            </el-button>-->
 
           </template>
         </el-table-column>
       </el-table>
       <!-- 分页 -->
-      <el-pagination style="margin-top:20px" :current-page="searchForm.page" :page-size="searchForm.size"
-                      :total="total"
-                     @current-change="handleCurrentChange"/>
+      <el-pagination style="margin-top:20px" :current-page="searchForm.page" :page-size="searchForm.size" :total="total"
+        @current-change="handleCurrentChange" />
     </el-card>
   </div>
 </template>
 
 <script setup>
-import {onMounted, reactive, ref} from "vue";
-import {ElMessage, ElMessageBox} from 'element-plus';
-import {useRouter} from 'vue-router'
+import { onMounted, reactive, ref } from "vue";
+import { ElMessage, ElMessageBox } from 'element-plus';
+import { useRouter } from 'vue-router'
 import resource from "../../api/resource";
 import Upload from "./upload.vue";
 
@@ -98,14 +101,14 @@ const searchUser = () => {
 // 删除资源信息
 const deleteResource = (id) => {
   ElMessageBox.confirm(
-      '确定要删除该资源信息吗?',
-      {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning',
-      }
+    '确定要删除该资源信息吗?',
+    {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning',
+    }
   ).then(async () => {
-    const res = await resource.deleteResource({id: id});
+    const res = await resource.deleteResource({ id: id });
     if (res.data.Code === 200) {
       ElMessage.success("删除成功")
       getResourceList();