|
@@ -290,22 +290,18 @@
|
|
|
// 获取blob里的问卷内容
|
|
|
getBlobItems(qnItem) {
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
- let profile = localStorage.student_profile || localStorage.user_profile
|
|
|
- let curBlobHost = JSON.parse(decodeURIComponent(profile, "utf-8")).blob_uri
|
|
|
- let schoolBlobHost = curBlobHost.slice(0, curBlobHost.lastIndexOf('/')) + '/' + localStorage.getItem('login_schoolCode')
|
|
|
- let privateBlobHost = curBlobHost.slice(0, curBlobHost.lastIndexOf('/')) + '/' + qnItem.creatorId
|
|
|
- let cntr = qnItem.scope === 'school' ? this.$store.state.userInfo.azp : qnItem.creatorId
|
|
|
- let blobHost = qnItem.scope === 'school' ? schoolBlobHost : privateBlobHost
|
|
|
+ console.log(qnItem);
|
|
|
+ let blobHost = this.$tools.getBlobHost()
|
|
|
// 根据试卷的Blob地址 去读取JSON文件
|
|
|
- let sasString = qnItem.scope === 'private' ? await this.$tools.getPrivateSas(cntr) : await this.$tools.getSchoolSas(cntr)
|
|
|
let promiseArr = []
|
|
|
- let indexJson = await this.getBlobJsonFile(qnItem.scope, qnItem.blob, cntr)
|
|
|
+ let indexJson = await this.getBlobJsonFile(qnItem)
|
|
|
if(indexJson.slides.length) {
|
|
|
for (let item of indexJson.slides) {
|
|
|
promiseArr.push(new Promise(async (r, j) => {
|
|
|
try {
|
|
|
- let itemJson = JSON.parse(await this.$tools.getFile(blobHost +
|
|
|
- item + sasString.sas))
|
|
|
+ let cntr = qnItem.scope === 'school' ? qnItem.school : qnItem.code.replace('Survey-','')
|
|
|
+ let itemFullPath = await this.$tools.getFileSas(blobHost + '/' + cntr + item)
|
|
|
+ let itemJson = JSON.parse(await this.$tools.getFile(itemFullPath.url))
|
|
|
r(itemJson)
|
|
|
} catch (e) {
|
|
|
j(e)
|
|
@@ -325,16 +321,13 @@
|
|
|
},
|
|
|
|
|
|
// 获取blob里的问卷信息
|
|
|
- getBlobJsonFile(scope, url, container) {
|
|
|
+ getBlobJsonFile(qnItem) {
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
- console.log(...arguments)
|
|
|
- let profile = localStorage.student_profile || localStorage.user_profile
|
|
|
- let blobUrl = JSON.parse(decodeURIComponent(profile, "utf-8")).blob_uri
|
|
|
- let blobHost = blobUrl.slice(0, blobUrl.lastIndexOf('/')) + '/' + container
|
|
|
- // 根据试卷的Blob地址 去读取JSON文件
|
|
|
- let sasString = scope === 'private' ? await this.$tools.getPrivateSas(container) : await this.$tools.getSchoolSas(container)
|
|
|
+ let blobHost = this.$tools.getBlobHost()
|
|
|
+ let cntr = qnItem.scope === 'school' ? qnItem.school : qnItem.code.replace('Survey-','')
|
|
|
+ let fullPath = await this.$tools.getFileSas(blobHost + '/' + cntr + qnItem.blob)
|
|
|
try {
|
|
|
- let itemJson = JSON.parse(await this.$tools.getFile(blobHost + url + sasString.sas))
|
|
|
+ let itemJson = JSON.parse(await this.$tools.getFile(fullPath.url))
|
|
|
resolve(itemJson)
|
|
|
} catch(e) {
|
|
|
this.$Message.error(this.$t('studentWeb.queNaire.fileErr'))
|