fix: update date path

This commit is contained in:
yanglbme 2020-08-30 09:43:05 +08:00
parent ec2ae4aa51
commit 624a0d3307
6 changed files with 36 additions and 36 deletions

View File

@ -16,12 +16,12 @@ const fileUploadConfig = {
}
function fileUpload(content, fileName) {
function fileUpload(content, filename) {
const date = new Date();
const dir = date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate();
const dir = date.getFullYear() + '/' + (date.getMonth() + 1).toString().padStart(2, '0') + '/' + date.getDate().toString().padStart(2, '0');
const uuid = uuidv4();
const token = fileUploadConfig.accessToken[Math.floor(Math.random() * fileUploadConfig.accessToken.length)].replace('doocsmd', '');
const dateFilename = new Date().getTime() + '-' + uuid + '.' + fileName.split('.')[1];
const dateFilename = new Date().getTime() + '-' + uuid + '.' + filename.split('.')[1];
const url = `https://api.github.com/repos/${fileUploadConfig.username}/${fileUploadConfig.repo}/contents/${dir}/${dateFilename}`;
return fetch({

View File

@ -200,7 +200,7 @@ export function fixCodeWhiteSpace(value = 'pre') {
const preDomList = document.getElementsByClassName('code__pre');
if (preDomList.length > 0) {
preDomList.forEach(pre=> {
preDomList.forEach(pre => {
pre.style.whiteSpace = value;
})
}

View File

@ -109,14 +109,14 @@ export default {
return !this.nightMode ? 'success' : 'default';
},
...mapState({
output: state=> state.output,
editor: state=> state.editor,
cssEditor: state=> state.cssEditor,
currentFont: state=> state.currentFont,
currentSize: state=> state.currentSize,
currentColor: state=> state.currentColor,
codeTheme: state=> state.codeTheme,
nightMode: state=> state.nightMode
output: state => state.output,
editor: state => state.editor,
cssEditor: state => state.cssEditor,
currentFont: state => state.currentFont,
currentSize: state => state.currentSize,
currentColor: state => state.currentColor,
codeTheme: state => state.codeTheme,
nightMode: state => state.nightMode
})
},
methods: {
@ -156,9 +156,9 @@ export default {
},
//
beforeUpload(file) {
uploadImgFile(file).then(res=> {
uploadImgFile(file).then(res => {
this.$emit('uploaded', res)
}).catch(err=> {
}).catch(err => {
this.$message({
showClose: true,
message: err,
@ -201,7 +201,7 @@ export default {
e.target.blur();
},
// CSS
async customStyle () {
async customStyle() {
this.$emit('showCssEditor');
this.$nextTick(() => {
if(!this.cssEditor) {

View File

@ -21,10 +21,10 @@ export default {
},
computed: {
btnType() {
return !this.nightMode ? 'success' : 'default';
return this.nightMode ? 'default' : 'success';
},
...mapState({
nightMode: state=> state.nightMode
nightMode: state => state.nightMode
})
}
}

View File

@ -59,9 +59,9 @@ export default {
// el-upload
//
beforeUpload(file) {
uploadImgFile(file).then(res=> {
uploadImgFile(file).then(res => {
this.$emit('menuTick', 'insertPic', res)
}).catch(err=> {
}).catch(err => {
this.$message({
showClose: true,
message: err,

View File

@ -93,14 +93,14 @@ export default {
},
computed: {
...mapState({
wxRenderer: state=> state.wxRenderer,
output: state=> state.output,
editor: state=> state.editor,
cssEditor: state=> state.cssEditor,
currentSize: state=> state.currentSize,
currentColor: state=> state.currentColor,
nightMode: state=> state.nightMode,
rightClickMenuVisible: state=> state.rightClickMenuVisible
wxRenderer: state => state.wxRenderer,
output: state => state.output,
editor: state => state.editor,
cssEditor: state => state.cssEditor,
currentSize: state => state.currentSize,
currentColor: state => state.currentColor,
nightMode: state => state.nightMode,
rightClickMenuVisible: state => state.rightClickMenuVisible
})
},
created() {
@ -132,9 +132,9 @@ export default {
if (item.kind === 'file') {
this.isImgLoading = true;
const pasteFile = item.getAsFile()
uploadImgFile(pasteFile).then(res=> {
uploadImgFile(pasteFile).then(res => {
this.uploaded(res)
}).catch(err=> {
}).catch(err => {
this.$message({
showClose: true,
message: err,
@ -206,7 +206,7 @@ export default {
},
//
leftAndRightScroll() {
const scrollCB = text=> {
const scrollCB = text => {
let source, target;
clearTimeout(this.timeout);
@ -214,14 +214,14 @@ export default {
source = this.$refs.preview.$el;
target = document.getElementsByClassName('CodeMirror-scroll')[0];
this.editor.off('scroll', editorScrollCB);
this.timeout = setTimeout(()=> {
this.timeout = setTimeout(() => {
this.editor.on('scroll', editorScrollCB);
}, 300);
} else if (text === 'editor') {
source = document.getElementsByClassName('CodeMirror-scroll')[0];
target = this.$refs.preview.$el;
target.removeEventListener("scroll", previewScrollCB, false);
this.timeout = setTimeout(()=> {
this.timeout = setTimeout(() => {
target.addEventListener("scroll", previewScrollCB, false);
}, 300);
}
@ -231,10 +231,10 @@ export default {
target.scrollTo(0, height);
};
const editorScrollCB = ()=> {
const editorScrollCB = () => {
scrollCB('editor');
};
const previewScrollCB = ()=> {
const previewScrollCB = () => {
scrollCB('preview');
};
@ -244,12 +244,12 @@ export default {
//
onEditorRefresh() {
this.editorRefresh();
setTimeout(()=> PR.prettyPrint(), 0);
setTimeout(() => PR.prettyPrint(), 0);
},
//
endCopy() {
this.backLight = false;
setTimeout(()=> {
setTimeout(() => {
this.isCoping = false;
}, 800);
},