xiangpei
2024-11-03 802f9516b59f342d7aa8a734d35061a1ab910520
教学资源附件查看/下载
1个文件已修改
43 ■■■■■ 已修改文件
src/views/folder/index.vue 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/folder/index.vue
@@ -111,6 +111,14 @@
                        >
                          下载
                        </el-button>
                        <el-button
                            link
                            type="primary"
                            @click.prevent="showAttachment(scope.row.attachment)"
                            v-if="scope.row.attachment && scope.row.attachment.length > 0"
                        >
                          查看附件
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
@@ -178,6 +186,27 @@
    >
      <DocumentViewer :fileUrl="fileUrl"></DocumentViewer>
    </el-drawer> -->
    <el-dialog
        v-model="attachmentShow"
        title="附件"
        width="500"
        :close-on-click-modal="false"
        :before-close="handleClose"
    >
      <div v-for="(attachment, index) in attachmentList" :key="index">
        <el-link type="primary" :href="'/api/upload/download?url=' + attachment.url +'&fileName=' + attachment.name">
          {{ attachment.name }}
        </el-link>
      </div>
      <div></div>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="handleClose">取消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
@@ -206,6 +235,7 @@
  });
const time = ref(null);
const attachmentShow = ref(false)
const fileType = {
  img: {
@@ -270,6 +300,7 @@
const searchText = ref("");
const searchSubject = ref("");
const searchContentType = ref("");
const attachmentList = ref([]);
const loading = ref(false);
@@ -297,6 +328,18 @@
const total = ref(0);
// const fileUrl = ref("");
const fileViewer = ref(false);
const handleClose = () => {
  attachmentShow.value = false
}
const showAttachment = (attachmentListParam) => {
  attachmentList.value = attachmentListParam
  console.log(attachmentList.value, "ww")
  attachmentShow.value = true
}
const checkRow = (item) => {
  // fileUrl.value = item.contentUrl.url;
  fileType[item.contentType] && fileType[item.contentType].handle(item);