|
|
@@ -5,6 +5,7 @@
|
|
|
:before-close="handleClose"
|
|
|
fullscreen
|
|
|
:show-close="false"
|
|
|
+ v-loading="pageloading"
|
|
|
>
|
|
|
<template #header>
|
|
|
<div class="topH">
|
|
|
@@ -14,7 +15,7 @@
|
|
|
</div>
|
|
|
<div class="backA">
|
|
|
<div class="bABtn" style="flex-shrink: 0;" @click="openCourseDetail">进入课程</div>
|
|
|
- <div @click="dialogVisible = false" style="cursor: pointer;display: flex;align-items: center;gap: 5px;">
|
|
|
+ <div @click="handleCloseL" style="cursor: pointer;display: flex;align-items: center;gap: 5px;">
|
|
|
<img src="../../assets/icon/backk.svg" alt="">
|
|
|
<span style="flex-shrink: 0;">返回</span>
|
|
|
</div>
|
|
|
@@ -51,7 +52,7 @@
|
|
|
<div v-for="item in inst.file" :key="item.id">
|
|
|
<div @click="cutPdf(item.url)" class="pdfCS" :class="[pdfUrl == item.url? 'pdfback' : '']">
|
|
|
<div class="pdfCSTit">{{ item.name }}</div>
|
|
|
- <!-- <img style="flex-shrink: 0;" src="../../assets/icon/xiazai.png" alt="" > -->
|
|
|
+ <img style="flex-shrink: 0;" src="../../assets/icon/xiazai.png" alt="" @click.stop="downloadPdf(item)">
|
|
|
<!-- @click.stop="downloadPdf(item.url,item.name)" -->
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -81,8 +82,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import axios from 'axios';
|
|
|
-import { ref,onMounted } from 'vue';
|
|
|
+import { ref } from 'vue';
|
|
|
import { userInfoStore } from '../../stores/counter'
|
|
|
import { defineExpose } from 'vue'
|
|
|
const user = userInfoStore()
|
|
|
@@ -94,68 +94,88 @@ const drawer = ref(false)
|
|
|
const drawertit = ref('0')
|
|
|
const inst = ref('')
|
|
|
const pdfUrl = ref('')
|
|
|
-const listData = ref([])
|
|
|
-const loading = ref(false)
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- requestUser()
|
|
|
-})
|
|
|
-
|
|
|
-const downloadPdf =(url, fileName = '')=>{
|
|
|
+const pageloading = ref(false)
|
|
|
+// onMounted(() => {
|
|
|
+// requestUser()
|
|
|
+// })
|
|
|
+const downloadPdf =(f) =>{
|
|
|
+ console.log('f',f);
|
|
|
+
|
|
|
+ var credentials = {
|
|
|
+ accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
+ secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR"
|
|
|
+ }; //秘钥形式的登录上传
|
|
|
+ window.AWS.config.update(credentials);
|
|
|
+ window.AWS.config.region = "cn-northwest-1"; //设置区域
|
|
|
+ let url2 = f.url;
|
|
|
+ let _url2 = "";
|
|
|
+ if (
|
|
|
+ url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
|
|
|
+ ) {
|
|
|
+ _url2 = url2.split(
|
|
|
+ "https://view.officeapps.live.com/op/view.aspx?src="
|
|
|
+ )[1];
|
|
|
+ } else {
|
|
|
+ _url2 = url2;
|
|
|
+ }
|
|
|
+ let _this = this;
|
|
|
|
|
|
- const a=document.createElement('a');
|
|
|
- a.href= url;
|
|
|
- a.download= fileName;
|
|
|
- a.style.display='none';
|
|
|
- document.body.appendChild(a);
|
|
|
- a.click();
|
|
|
- setTimeout(()=>{if(a.parentNode)a.parentNode.removeChild(a);},100);
|
|
|
-}
|
|
|
+ _this.downLoading = true;
|
|
|
+ var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
|
|
|
+ let name = decodeURIComponent(
|
|
|
+ _url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
|
|
|
+ );
|
|
|
+ var params = {
|
|
|
+ Bucket: "ccrb",
|
|
|
+ Key: name
|
|
|
+ };
|
|
|
+ s3.getObject(params, function(err, data) {
|
|
|
+ _this.downLoading = false;
|
|
|
+ if (err) console.log(err, err.stack);
|
|
|
+ // an error occurred
|
|
|
+ else {
|
|
|
+ let url = window.URL.createObjectURL(new Blob([data.Body]));
|
|
|
+ let a = document.createElement("a");
|
|
|
+ a.name = f.name;
|
|
|
+ a.href = url;
|
|
|
+ a.download = f.name;
|
|
|
+ a.click();
|
|
|
+ console.log(data);
|
|
|
+ } // sxuccessful response
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
-// 拉取用户信息并处理
|
|
|
-const requestUser = () => {
|
|
|
- loading.value = true
|
|
|
|
|
|
- axios.get(`https://pbl.cocorobo.cn/api/pbl/selectAiExp?cl=1`)
|
|
|
- .then(res => {
|
|
|
- console.log(res);
|
|
|
- let data = res.data
|
|
|
- data[0].forEach(item1 => {
|
|
|
- // 在第二个数组中查找匹配的数据
|
|
|
- const matchedItems = data[1].filter(item2 => item2.levA === item1.id);
|
|
|
- // 将匹配的数据存入ch属性
|
|
|
- item1.ch = matchedItems;
|
|
|
- });
|
|
|
- listData.value = data[0]
|
|
|
- loading.value = false
|
|
|
- })
|
|
|
- .catch(err=>{
|
|
|
- console.log(err);
|
|
|
- loading.value = false
|
|
|
- })
|
|
|
-};
|
|
|
const handleClose = (done) => {
|
|
|
done()
|
|
|
}
|
|
|
+
|
|
|
+const handleCloseL = () => {
|
|
|
+ dialogVisible.value = false
|
|
|
+ iframeRef1Url.value = ''
|
|
|
+}
|
|
|
const cutPdf = (val) =>{
|
|
|
pdfUrl.value = val
|
|
|
}
|
|
|
const gotoPage = (val)=>{
|
|
|
+ pageloading.value = true
|
|
|
dialogVisible.value = true
|
|
|
- // window.open(val.link, "_blank")
|
|
|
console.log('val',val);
|
|
|
+ inst.value = ''
|
|
|
+ drawertit.value = '0'
|
|
|
iframeRef1Url.value = val.link
|
|
|
cid.value = val.courselink
|
|
|
- if (inst.value) {
|
|
|
+ console.log('inst.value',inst.value);
|
|
|
+ if (val.inst) {
|
|
|
inst.value = JSON.parse(val.inst)
|
|
|
console.log('inst',{...inst.value});
|
|
|
if ({...inst.value}.file.length) {
|
|
|
pdfUrl.value = {...inst.value}.file[0].url
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
dialogVisible.value = true
|
|
|
Tips.value = val.name
|
|
|
+ pageloading.value = false
|
|
|
}
|
|
|
defineExpose({
|
|
|
gotoPage
|