1
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
});
|
||||
},
|
||||
showModal: false,
|
||||
confirmAction() {
|
||||
editTheme() {
|
||||
this.isSubmitting = true;
|
||||
axios.put('themes', { theme: theme })
|
||||
.then(data => {
|
||||
@@ -28,6 +28,16 @@
|
||||
this.isSubmitting = false;
|
||||
});
|
||||
},
|
||||
confirmDelete() {
|
||||
this.isSubmitting = true;
|
||||
axios.delete('themes?theme=' + theme)
|
||||
.then(data => {
|
||||
this.loadItems();
|
||||
})
|
||||
.finally(() => {
|
||||
this.isSubmitting = false;
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.loadItems();
|
||||
|
||||
|
||||
57
Yes.Blog/wwwroot/admin/js/theme/upgrade.js
Normal file
57
Yes.Blog/wwwroot/admin/js/theme/upgrade.js
Normal file
@@ -0,0 +1,57 @@
|
||||
document.addEventListener('alpine:init', function () {
|
||||
Alpine.data('data', function () {
|
||||
|
||||
const themeName = getUrlParameter("theme") || "default";
|
||||
|
||||
return {
|
||||
file: {
|
||||
|
||||
},
|
||||
tagInput: "",
|
||||
tempfile: null,
|
||||
coverUrl: "",
|
||||
files: [],
|
||||
isSubmitting: false,
|
||||
themeName: "",
|
||||
fileName: "",
|
||||
uploadFile:"",
|
||||
isZipFile(filename) {
|
||||
if (typeof filename !== 'string') return false;
|
||||
return /\.zip$/i.test(filename);
|
||||
},
|
||||
handleThemeUpload(file) {
|
||||
if (!this.isZipFile(file.name)) {
|
||||
window.pushError("请上传zip文件");
|
||||
return;
|
||||
}
|
||||
this.uploadFile = file;
|
||||
},
|
||||
save() {
|
||||
const formData = new FormData();
|
||||
formData.append('file', this.uploadFile);
|
||||
|
||||
axios.post('/themes/upload?theme=' + this.themeName, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then(data => {
|
||||
location.href = "/admin/theme";
|
||||
})
|
||||
},
|
||||
addFile() {
|
||||
const fileinput = document.getElementById('img-file-input');
|
||||
if (fileinput) {
|
||||
fileinput.click();
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.themeName = themeName;
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
document.title = "自定义模板内容 - " + window.config.name + "";
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user