|
@@ -169,11 +169,11 @@ export default {
|
|
|
'table', // 表格
|
|
|
],
|
|
|
// 生成随机UUID工具
|
|
|
- randomId: function() {
|
|
|
+ randomId: function () {
|
|
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
|
|
|
},
|
|
|
// 生成随机UUID工具
|
|
|
- guid: function() {
|
|
|
+ guid: function () {
|
|
|
return (this.randomId() + this.randomId() + '-' + this.randomId() + '-' + this.randomId() + '-' + this
|
|
|
.randomId() +
|
|
|
'-' + this.randomId() + this.randomId() + this.randomId())
|
|
@@ -251,7 +251,7 @@ export default {
|
|
|
for (var k in o)
|
|
|
if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((
|
|
|
'00' + o[
|
|
|
- k]).substr(('' + o[k]).length)))
|
|
|
+ k]).substr(('' + o[k]).length)))
|
|
|
return fmt
|
|
|
},
|
|
|
|
|
@@ -274,8 +274,8 @@ export default {
|
|
|
var formData = new FormData();
|
|
|
xhr.open('get', url); //url填写后台的接口地址,如果是post,在formData append参数(参考原文地址)
|
|
|
// xhr.responseType = 'arraybuffer';
|
|
|
- xhr.onload = function(e) {
|
|
|
- switch (e.currentTarget.status){
|
|
|
+ xhr.onload = function (e) {
|
|
|
+ switch (e.currentTarget.status) {
|
|
|
case 200:
|
|
|
resolve(e.currentTarget.response)
|
|
|
break;
|
|
@@ -286,7 +286,7 @@ export default {
|
|
|
case 403:
|
|
|
Message.error(app.$t('http.error403'))
|
|
|
reject(403)
|
|
|
- break;
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -368,8 +368,8 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- getBlobHost(){
|
|
|
+
|
|
|
+ getBlobHost() {
|
|
|
let s = store.state.user.userProfile.blob_uri || store.state.user.studentProfile.blob_uri || 'https://teammodelstorage.blob.core.chinacloudapi.cn/hbcn'
|
|
|
return s.split(s.substring(s.lastIndexOf('/')))[0]
|
|
|
},
|
|
@@ -398,9 +398,9 @@ export default {
|
|
|
)
|
|
|
} else {
|
|
|
r({
|
|
|
- sas:'?' + store.state.user.userProfile.blob_sas,
|
|
|
- name:code || store.state.userInfo.TEAMModelId,
|
|
|
- url:this.getBlobHost()
|
|
|
+ sas: '?' + store.state.user.userProfile.blob_sas,
|
|
|
+ name: code || store.state.userInfo.TEAMModelId,
|
|
|
+ url: this.getBlobHost()
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -429,9 +429,9 @@ export default {
|
|
|
)
|
|
|
} else {
|
|
|
r({
|
|
|
- sas:'?' + store.state.user.schoolProfile.blob_sas,
|
|
|
- name:code || store.state.userInfo.schoolCode,
|
|
|
- url:this.getBlobHost()
|
|
|
+ sas: '?' + store.state.user.schoolProfile.blob_sas,
|
|
|
+ name: code || store.state.userInfo.schoolCode,
|
|
|
+ url: this.getBlobHost()
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -440,7 +440,7 @@ export default {
|
|
|
* 获取单个文件授权
|
|
|
*/
|
|
|
getFileSas(param) {
|
|
|
- console.log('获取单个文件授权',param)
|
|
|
+ console.log('获取单个文件授权', param)
|
|
|
return new Promise((r, j) => {
|
|
|
$api.blob.urlSasR({
|
|
|
url: param
|
|
@@ -460,9 +460,23 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ /* 根据容器名称获取完整授权码 */
|
|
|
+ getBlobSas(code) {
|
|
|
+ return new Promise((r, j) => {
|
|
|
+ $api.blob.blobSasR({
|
|
|
+ name: code,
|
|
|
+ role: 'teacher'
|
|
|
+ }).then(res => {
|
|
|
+ if (!res.error) {
|
|
|
+ r('?' + res.sas)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
/* 获取视频第一帧 */
|
|
|
getVideoBase64(url) {
|
|
|
- return new Promise(function(resolve, reject) {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
let dataURL = '';
|
|
|
let video = document.createElement("video");
|
|
|
video.setAttribute('crossOrigin', 'anonymous'); //处理跨域
|
|
@@ -470,7 +484,7 @@ export default {
|
|
|
video.setAttribute('preload', 'auto');
|
|
|
video.setAttribute('width', 150);
|
|
|
video.setAttribute('height', 90);
|
|
|
- video.addEventListener('loadeddata', function() {
|
|
|
+ video.addEventListener('loadeddata', function () {
|
|
|
let canvas = document.createElement("canvas"),
|
|
|
width = video.width, //canvas的尺寸和图片一样
|
|
|
height = video.height;
|
|
@@ -482,7 +496,7 @@ export default {
|
|
|
var img = new Image()
|
|
|
img.src = require('@/assets/icon/icon_play.png')
|
|
|
img.setAttribute('crossOrigin', 'anonymous');
|
|
|
- img.onload = function() {
|
|
|
+ img.onload = function () {
|
|
|
//画图
|
|
|
canvas.getContext("2d").drawImage(img, 55, 25, 40, 40);
|
|
|
var data = canvas.toDataURL('image/jpeg');
|
|
@@ -591,9 +605,9 @@ export default {
|
|
|
editor.selection.getSelectionStartElem().elems[0].innerHTML += `<span><span> </span><span class="richText-audio" contenteditable="false" >
|
|
|
<span class="audio-info">
|
|
|
<i class="ivu-icon ivu-icon-ios-musical-notes" style="font-size: 24px;margin:0 10px"></i>
|
|
|
- <span class="audio-name">${ file.name }</span>
|
|
|
+ <span class="audio-name">${file.name}</span>
|
|
|
</span>
|
|
|
- <audio src="${ fileBlobUrl }" id="audio" controls="controls" controlsList="nodownload"></audio>
|
|
|
+ <audio src="${fileBlobUrl}" id="audio" controls="controls" controlsList="nodownload"></audio>
|
|
|
</span><span> </span></span>`
|
|
|
editor.change.emit()
|
|
|
vm.$EventBus.$emit('noSave', {
|
|
@@ -628,13 +642,13 @@ export default {
|
|
|
}))
|
|
|
}
|
|
|
Promise.all(promiseArr).then(result => {
|
|
|
- localStorage.setItem('noSave','[]')
|
|
|
+ localStorage.setItem('noSave', '[]')
|
|
|
}).catch(err => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
|
|
|
},
|
|
|
- isEqual: function(x, y) {
|
|
|
+ isEqual: function (x, y) {
|
|
|
// If both x and y are null or undefined and exactly the same
|
|
|
if (x === y) {
|
|
|
return true;
|
|
@@ -660,7 +674,7 @@ export default {
|
|
|
continue;
|
|
|
}
|
|
|
// Numbers, Strings, Functions, Booleans must be strictly equal
|
|
|
- if (typeof(x[p]) !== "object") {
|
|
|
+ if (typeof (x[p]) !== "object") {
|
|
|
return false;
|
|
|
}
|
|
|
// Objects and Arrays must be tested recursively
|
|
@@ -688,7 +702,7 @@ export default {
|
|
|
val.fScores[subjectIndex].value[index],
|
|
|
stu.subjects[subjectIndex].fieldPoint[index],
|
|
|
val.fScores[subjectIndex].value[index] == 0 ? 0 : (stu.subjects[subjectIndex].fieldPoint[index] / val.fScores[subjectIndex].value[index])
|
|
|
- .toFixed(2)
|
|
|
+ .toFixed(2)
|
|
|
])
|
|
|
})
|
|
|
return result
|
|
@@ -697,7 +711,7 @@ export default {
|
|
|
getLevelClassPercent(val, subjectIndex, index) {
|
|
|
let result = []
|
|
|
val.classes.forEach(classItem => {
|
|
|
- result.push(classItem.subjects[subjectIndex].field.map((score,index) => val.fieldwrong[subjectIndex].value[index][1] == 0 ? 0 : Number(score / val.fieldwrong[subjectIndex].value[index][1]) * 100)[index])
|
|
|
+ result.push(classItem.subjects[subjectIndex].field.map((score, index) => val.fieldwrong[subjectIndex].value[index][1] == 0 ? 0 : Number(score / val.fieldwrong[subjectIndex].value[index][1]) * 100)[index])
|
|
|
})
|
|
|
return result
|
|
|
},
|
|
@@ -709,7 +723,7 @@ export default {
|
|
|
stuResult[item] = this.getLevelStuPercent(val, subjectIndex, index)
|
|
|
classResult[item] = this.getLevelClassPercent(val, subjectIndex, index)
|
|
|
})
|
|
|
- stuResult.grade = val.fieldAllPer[subjectIndex].value.map((score,index) => (val.fieldwrong[subjectIndex].value[index][1] == 0 ? 0 : Number(score / val.fieldwrong[subjectIndex].value[index][1]).toFixed(2)) * 100)
|
|
|
+ stuResult.grade = val.fieldAllPer[subjectIndex].value.map((score, index) => (val.fieldwrong[subjectIndex].value[index][1] == 0 ? 0 : Number(score / val.fieldwrong[subjectIndex].value[index][1]).toFixed(2)) * 100)
|
|
|
stuResult.keys = val.knowKey
|
|
|
classResult.keys = val.knowkey
|
|
|
classResult.className = val.classes.map(i => i.className)
|
|
@@ -731,7 +745,7 @@ export default {
|
|
|
val.kScores[subjectIndex].value[index],
|
|
|
stu.subjects[subjectIndex].point[index],
|
|
|
val.kScores[subjectIndex].value[index] == 0 ? 0 : (stu.subjects[subjectIndex].point[index] / val.kScores[subjectIndex].value[index])
|
|
|
- .toFixed(2)
|
|
|
+ .toFixed(2)
|
|
|
])
|
|
|
})
|
|
|
return result
|
|
@@ -741,7 +755,7 @@ export default {
|
|
|
let result = []
|
|
|
val.classes.forEach(classItem => {
|
|
|
// 取当前班级在每个知识点的得分 除以知识点的总分 得到每个班在该知识点的得分率 index=>知识点下标
|
|
|
- result.push(classItem.subjects[subjectIndex].point.map((score,pointIndex) => val.wrong[subjectIndex].value[pointIndex][1] == 0 ? 0 : Number(score / val.wrong[subjectIndex].value[pointIndex][1]) * 100)[index])
|
|
|
+ result.push(classItem.subjects[subjectIndex].point.map((score, pointIndex) => val.wrong[subjectIndex].value[pointIndex][1] == 0 ? 0 : Number(score / val.wrong[subjectIndex].value[pointIndex][1]) * 100)[index])
|
|
|
})
|
|
|
return result
|
|
|
},
|
|
@@ -754,7 +768,7 @@ export default {
|
|
|
classResult[item] = this.getKnowClassPercent(val, subjectIndex, index)
|
|
|
})
|
|
|
// 取当前年级在每个知识点的得分 除以知识点的总分 得到年级在该知识点的得分率
|
|
|
- stuResult.grade = val.knowAllper[subjectIndex].value.map((score,index) => val.wrong[subjectIndex].value[index][1] == 0 ? 0 : Number(score / val.wrong[subjectIndex].value[index][1]) * 100)
|
|
|
+ stuResult.grade = val.knowAllper[subjectIndex].value.map((score, index) => val.wrong[subjectIndex].value[index][1] == 0 ? 0 : Number(score / val.wrong[subjectIndex].value[index][1]) * 100)
|
|
|
stuResult.keys = val.knowKey
|
|
|
classResult.keys = val.knowkey
|
|
|
classResult.className = val.classes.map(i => i.className)
|