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 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 uuid = uuidv4();
const token = fileUploadConfig.accessToken[Math.floor(Math.random() * fileUploadConfig.accessToken.length)].replace('doocsmd', ''); 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}`; const url = `https://api.github.com/repos/${fileUploadConfig.username}/${fileUploadConfig.repo}/contents/${dir}/${dateFilename}`;
return fetch({ return fetch({

View File

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