|
@@ -311,6 +311,56 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ /* 获取完整的试卷数据 */
|
|
|
+ getComposeItem(paper) {
|
|
|
+ return new Promise(async (r, j) => {
|
|
|
+ let blobHost = JSON.parse(decodeURIComponent(localStorage.student_profile, "utf-8")).blob_uri
|
|
|
+ let splitHost = blobHost.split('/')
|
|
|
+ // 根据试卷的Blob地址 去读取JSON文件
|
|
|
+ let sasString = paper.scope === 'school' ? await $tools.getSchoolSas(paper.code) : await $tools.getPrivateSas(paper.code)
|
|
|
+ try {
|
|
|
+ let jsonInfo = await $tools.getFile(sasString.url + '/' + paper.code + paper.blob + '/index.json' + sasString.sas)
|
|
|
+ let jsonData = JSON.parse(jsonInfo)
|
|
|
+ console.log('2354563215135131')
|
|
|
+ console.log(jsonData)
|
|
|
+ // 获取试卷包含的试题数据并包装好
|
|
|
+ if (jsonData.slides && jsonData.slides.length) {
|
|
|
+ jsonData.item = []
|
|
|
+ const path = sasString.url + '/' + paper.code + paper.blob
|
|
|
+ let promiseArr = []
|
|
|
+
|
|
|
+ //jsonData.slides.forEach((item, index) => {
|
|
|
+ // promiseArr.push(new Promise(async (resolve, reject) => {
|
|
|
+ // // 获取题目JSON并且包装成完整试题对象
|
|
|
+ // let itemJson = JSON.parse(await $tools.getFile(path + '/' + item.url + sasString.sas))
|
|
|
+ // itemJson.exercise.question = itemJson.item[0].question
|
|
|
+ // itemJson.exercise.option = itemJson.item[0].option
|
|
|
+ // itemJson.exercise.id = itemJson.id
|
|
|
+ // itemJson.exercise.pid = itemJson.pid
|
|
|
+ // itemJson.exercise.score = item.scoring ? item.scoring.score : 0,
|
|
|
+ // // jsonData.item.push(itemJson.exercise)
|
|
|
+ // resolve(itemJson.exercise)
|
|
|
+ // }))
|
|
|
+ //})
|
|
|
+
|
|
|
+ //Promise.all(promiseArr).then(res => {
|
|
|
+ // res.forEach((resItem, resIndex) => {
|
|
|
+ // resItem.children = []
|
|
|
+ // if (resItem.pid) {
|
|
|
+ // let pItem = res.filter(i => i.id === resItem.pid)[0]
|
|
|
+ // pItem.children.push(resItem)
|
|
|
+ // pItem.score = pItem.score + resItem.score
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // jsonData.item = res.filter(i => !i.pid)
|
|
|
+ // r(jsonData)
|
|
|
+ //})
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ j(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
/* 提取富文本内容中的文本 */
|
|
|
getSimpleText(html) {
|