提交修改

This commit is contained in:
daihh
2022-10-25 19:37:35 +08:00
parent 21e3d0b3d9
commit 5059821ea0
4 changed files with 41 additions and 26 deletions

View File

@@ -68,10 +68,10 @@ const formRequest=axios.create({
console.log('err' + error) console.log('err' + error)
let { message } = error; let { message } = error;
if (message == "Network Error") { if (message == "Network Error") {
message = "后端接口连接异常"; message = "网络异常,接口连接异常";
} }
else if (message.includes("timeout")) { else if (message.includes("timeout")) {
message = "系统接口请求超时"; message = "网络异常或接口错误,请求超时";
} }
else if (message.includes("Request failed with status code")) { else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常"; message = "系统接口" + message.substr(message.length - 3) + "异常";

View File

@@ -100,6 +100,10 @@ export default {
type: Object, type: Object,
default: () => { } default: () => { }
}, },
current:{ //当前是否是可编辑的
type: Boolean,
default: false
},
height:{ height:{
type: Number, type: Number,
default: 200 default: 200
@@ -112,7 +116,9 @@ export default {
name: 'MyNote', name: 'MyNote',
data() { data() {
return { return {
inAnimationText:'笔记保存成功U币+2', inAnimationText:'笔记保存成功U币+5',
localSaveHandle:null,//本地保存的timeout对象
localKey:'NOTE_TEXT',//本地存储的key
isEdit:false, isEdit:false,
inputHeight:70, inputHeight:70,
listHeight:170, listHeight:170,
@@ -122,7 +128,6 @@ export default {
btnPlayTime:false,//是否显示添加视频时间 btnPlayTime:false,//是否显示添加视频时间
radio: '1', radio: '1',
notetab: 1, notetab: 1,
autoSave: null,
mynoteData: { mynoteData: {
type: 1, //我发布的是1 我导入的是2 type: 1, //我发布的是1 我导入的是2
content: '', content: '',
@@ -152,7 +157,6 @@ export default {
watch: { watch: {
//内容的高度 //内容的高度
height(val){ height(val){
//$this.controlHeight=h- //$this.controlHeight=h-
this.listHeight=val-95; this.listHeight=val-95;
this.inputHeight=(val-220); this.inputHeight=(val-220);
@@ -161,13 +165,14 @@ export default {
if(this.inputRows>20){ if(this.inputRows>20){
this.inputRows=20; this.inputRows=20;
} }
//console.log(this.inputHeight,this.inputRows,this.listHeight,'my note height'); //console.log(this.inputHeight,this.inputRows,this.listHeight,'my note height');
if(this.inputHeight>500){ if(this.inputHeight>500){
this.inputHeight=500; this.inputHeight=500;
} }
}, },
isedit(val){
this.isEdit=val;
},
selected:{ selected:{
handler(val,old){ handler(val,old){
this.$emit('change',this.selected) this.$emit('change',this.selected)
@@ -181,10 +186,7 @@ export default {
this.mynoteData.courseName = this.data.name; this.mynoteData.courseName = this.data.name;
// this.mynoteData.contentId = this.data.id; // this.mynoteData.contentId = this.data.id;
} }
}, }
// intTimeNote(val) {
// this.mynoteData.playTime = val;
// }
}, },
methods: { methods: {
handleClick(){ handleClick(){
@@ -194,7 +196,6 @@ export default {
//这里应该加上内容的id //这里应该加上内容的id
this.$emit('onPlayVideo',conId,time); this.$emit('onPlayVideo',conId,time);
}, },
//取消编辑 //取消编辑
editCancel(){ editCancel(){
this.isEdit = false; // 关闭编辑框 this.isEdit = false; // 关闭编辑框
@@ -205,7 +206,6 @@ export default {
let h = Math.floor(result / 3600); let h = Math.floor(result / 3600);
let m = Math.floor((result / 60 % 60)); let m = Math.floor((result / 60 % 60));
let s = Math.floor((result % 60)); let s = Math.floor((result % 60));
let res = ''; let res = '';
if (h > 0) { if (h > 0) {
res += `${h}:${m}:${s}`; res += `${h}:${m}:${s}`;
@@ -226,9 +226,13 @@ export default {
this.mynoteData.playTime = 0; this.mynoteData.playTime = 0;
}, },
autoSaveNote(){ autoSaveNote(){
this.autoSave = setInterval(() => { let $this=this;
localStorage.setItem("NOTE_TEXT", this.mynoteData.content); if(this.notetab==1){
}, 10000); localStorage.setItem($this.localKey, $this.mynoteData.content);
}
// this.localSaveHandle = setInterval(() => {
// }, 10000);
}, },
noteEdit(note) { noteEdit(note) {
this.isEdit = true; this.isEdit = true;
@@ -334,6 +338,7 @@ export default {
} else { } else {
this.mynoteData.content = this.content_new; //赋值笔记内容 this.mynoteData.content = this.content_new; //赋值笔记内容
let curOpenType=this.mynoteData.openType; let curOpenType=this.mynoteData.openType;
let $this=this;
apiNote.save(this.mynoteData).then(res => { apiNote.save(this.mynoteData).then(res => {
if (res.status == 200) { if (res.status == 200) {
if (!this.mynoteData.id) { if (!this.mynoteData.id) {
@@ -345,8 +350,8 @@ export default {
return return
} }
setTimeout(() => { setTimeout(() => {
localStorage.setItem("NOTE_TEXT", ''); localStorage.setItem($this.localKey, '');
// clearInterval(this.autoSave); // clearInterval(this.localSaveHandle);
that.getMyNote(); that.getMyNote();
that.notetabType(2); that.notetabType(2);
that.mynoteData = { that.mynoteData = {
@@ -378,13 +383,21 @@ export default {
} }
} }
}).catch(function(error) {
//
this.$message.error('当前网络异常,内容已离线保存');
//
localStorage.setItem(this.localKey, this.mynoteData.content);
}) })
} }
} }
}, },
beforeDestroy() { beforeDestroy() {
// clearInterval(this.autoSave); if(this.localSaveHandle!=null){
this.autoSave = null; clearInterval(this.localSaveHandle);
clearTimeout(this.localSaveHandle)
}
this.localSaveHandle = null;
}, },
} }
</script> </script>

View File

@@ -406,7 +406,7 @@ export function translate(field) {
export function formatUserNumber(num) { export function formatUserNumber(num) {
let rsNum =0; let rsNum =0;
if(num<5){ if(num<5){
return 0; return num;
} }
if(num<95){ if(num<95){
rsNum=Math.round((num+5)/10)*10; rsNum=Math.round((num+5)/10)*10;

View File

@@ -89,6 +89,8 @@
<div class="course-image-box"> <div class="course-image-box">
<course-image :course="cinfo"></course-image> <course-image :course="cinfo"></course-image>
<span v-if="cinfo.type == 20 || 10" class="course-type-left">录播课</span> <span v-if="cinfo.type == 20 || 10" class="course-type-left">录播课</span>
<span v-if="cinfo.type == 30" class="course-type-left">线下课</span>
<span v-if="cinfo.type == 40" class="course-type-left">学习项目</span>
</div> </div>
<div style="width:80%" class="course-title two-line-ellipsis" :title="cinfo.title" v-html="cinfo.name"></div> <div style="width:80%" class="course-title two-line-ellipsis" :title="cinfo.title" v-html="cinfo.name"></div>
<div class="course-info"> <div class="course-info">