pdf
xiangpei
2024-05-17 b60049c4fd341d6a0d109408aa998e02528fc6d6
src/views/onlineStudy/file.vue
@@ -37,8 +37,8 @@
            class="showContent" />
          <img v-if="scope.row.contentType === 'img'" :src="'/api/files/' + scope.row.contentUrl.url"
            class="showContent" />
          <el-link type="primary" v-if="scope.row.contentType === 'pdf'" :src="'/api/files/' + scope.row.contentUrl.url"
            class="showContent" @click="checkPdf">点击查看</el-link>
          <el-link type="primary" v-if="scope.row.contentType === 'pdf'"
            class="showContent" @click="checkPdf('/api/files/' + scope.row.contentUrl.url)">点击查看</el-link>
        </template>
      </el-table-column>
      <el-table-column prop="attachment" label="附件">
@@ -94,11 +94,6 @@
        <el-button type="primary" @click="handlerSubmit">保 存</el-button>
      </span>
    </el-dialog>
    <el-dialog title="PDF查看" :visible.sync="pdfDialog" width="80%" :before-close="closePdfDialog">
      <vue-office-pdf :src="pdf" @rendered="rendered" />
    </el-dialog>
  </div>
</template>
@@ -108,10 +103,9 @@
import StudyTypeAPI from '@/api/study-type';
import Upload from '@/components/UploadC';
import VueOfficePdf from '@vue-office/pdf';
export default {
  name: 'type',
  components: { Upload, Pagination, VueOfficePdf },
  components: { Upload, Pagination },
  computed: {
    fileContentUrl: () => {
      return this.form ? this.form.contentUrl ? [this.form.contentUrl] : [] : [];
@@ -119,13 +113,12 @@
  },
  data() {
    return {
      pdf: '',
      dialogTitle: '添加学习内容',
      ids: [],
      typeList: [],
      searchForm: {
        pageNum: 1,
        pageSize: 10,
        pageSize: 5,
        typeName: ''
      },
      total: 0,
@@ -157,15 +150,11 @@
    };
  },
  methods: {
    checkPdf() {
      this.pdf = 'http://static.shanhuxueyuan.com/test.pdf';
      this.pdfDialog = true;
    checkPdf(url) {
      window.open('/#/online/study/pdf/view?pdfUrl=' + url, '_blank')
    },
    closePdfDialog() {
      this.pdfDialog = false;
    },
    rendered() {
    },
    fileChange() {
      this.form.contentUrl = [];