添加文件修改内容

master
dfz 2 months ago
parent 80b405d64c
commit ac9ba2f056

@ -19,7 +19,7 @@ func (f *File) Creat(context *gin.Context) {
user_name := context.GetString(consts.ValidatorPrefix + "user_name") user_name := context.GetString(consts.ValidatorPrefix + "user_name")
file_Path := context.GetString(consts.ValidatorPrefix + "file_path") file_Path := context.GetString(consts.ValidatorPrefix + "file_path")
file_Name := context.GetString(consts.ValidatorPrefix + "file_name") file_Name := context.GetString(consts.ValidatorPrefix + "file_name")
final_Path := fmt.Sprintf("%s/%s.docx", file_Path, file_Name) final_Path := fmt.Sprintf("%s/%s", file_Path, file_Name)
//file, err := os.Create(final_Path) //file, err := os.Create(final_Path)
if err := file.CreateFile(user_name, final_Path); err != nil { if err := file.CreateFile(user_name, final_Path); err != nil {
@ -54,7 +54,7 @@ func (f *File) Get(context *gin.Context) {
user_name := context.GetString(consts.ValidatorPrefix + "user_name") user_name := context.GetString(consts.ValidatorPrefix + "user_name")
file_Path := context.GetString(consts.ValidatorPrefix + "file_path") file_Path := context.GetString(consts.ValidatorPrefix + "file_path")
file_Name := context.GetString(consts.ValidatorPrefix + "file_name") file_Name := context.GetString(consts.ValidatorPrefix + "file_name")
final_Path := fmt.Sprintf("%s/%s.docx", file_Path, file_Name) final_Path := fmt.Sprintf("%s/%s", file_Path, file_Name)
fileObj, err := file.GetFile(user_name, final_Path) fileObj, err := file.GetFile(user_name, final_Path)
if err != nil { if err != nil {
@ -84,11 +84,11 @@ func (f *File) Rename(context *gin.Context) {
user_name := context.GetString(consts.ValidatorPrefix + "user_name") user_name := context.GetString(consts.ValidatorPrefix + "user_name")
file_Path := context.GetString(consts.ValidatorPrefix + "file_path") file_Path := context.GetString(consts.ValidatorPrefix + "file_path")
file_Name := context.GetString(consts.ValidatorPrefix + "file_name") file_Name := context.GetString(consts.ValidatorPrefix + "file_name")
final_Path := fmt.Sprintf("%s/%s.docx", file_Path, file_Name) final_Path := fmt.Sprintf("%s/%s", file_Path, file_Name)
//old_Name := context.GetString(consts.ValidatorPrefix + "oldname") //old_Name := context.GetString(consts.ValidatorPrefix + "oldname")
new_Name := context.GetString(consts.ValidatorPrefix + "newname") new_Name := context.GetString(consts.ValidatorPrefix + "newname")
new_finalpath := fmt.Sprintf("%s/%s.docx", file_Path, new_Name) new_finalpath := fmt.Sprintf("%s/%s", file_Path, new_Name)
err := file.FileRename(user_name, final_Path, new_finalpath) err := file.FileRename(user_name, final_Path, new_finalpath)
if err != nil { if err != nil {
@ -117,11 +117,11 @@ func (f *File) Move(context *gin.Context) {
user_name := context.GetString(consts.ValidatorPrefix + "user_name") user_name := context.GetString(consts.ValidatorPrefix + "user_name")
file_Path := context.GetString(consts.ValidatorPrefix + "file_path") file_Path := context.GetString(consts.ValidatorPrefix + "file_path")
file_Name := context.GetString(consts.ValidatorPrefix + "file_name") file_Name := context.GetString(consts.ValidatorPrefix + "file_name")
final_Path := fmt.Sprintf("%s/%s.docx", file_Path, file_Name) final_Path := fmt.Sprintf("%s/%s", file_Path, file_Name)
//old_Name := context.GetString(consts.ValidatorPrefix + "oldname") //old_Name := context.GetString(consts.ValidatorPrefix + "oldname")
new_Path := context.GetString(consts.ValidatorPrefix + "newpath") new_Path := context.GetString(consts.ValidatorPrefix + "newpath")
new_finalpath := fmt.Sprintf("%s/%s.docx", new_Path, file_Name) new_finalpath := fmt.Sprintf("%s/%s", new_Path, file_Name)
err := file.FileMove(user_name, final_Path, new_finalpath) err := file.FileMove(user_name, final_Path, new_finalpath)
if err != nil { if err != nil {
@ -150,7 +150,7 @@ func (f *File) Save(context *gin.Context) {
user_name := context.GetString(consts.ValidatorPrefix + "user_name") user_name := context.GetString(consts.ValidatorPrefix + "user_name")
Save_path := context.GetString(consts.ValidatorPrefix + "save_path") Save_path := context.GetString(consts.ValidatorPrefix + "save_path")
file_Name := context.GetString(consts.ValidatorPrefix + "file_name") file_Name := context.GetString(consts.ValidatorPrefix + "file_name")
final_savePath := fmt.Sprintf("%s/%s.docx", Save_path, file_Name) final_savePath := fmt.Sprintf("%s/%s", Save_path, file_Name)
fileDataBase64 := context.PostForm("file_data") fileDataBase64 := context.PostForm("file_data")
if fileDataBase64 == "" { if fileDataBase64 == "" {
@ -185,7 +185,7 @@ func (f *File) Delete(context *gin.Context) {
user_name := context.GetString(consts.ValidatorPrefix + "user_name") user_name := context.GetString(consts.ValidatorPrefix + "user_name")
file_Path := context.GetString(consts.ValidatorPrefix + "file_path") file_Path := context.GetString(consts.ValidatorPrefix + "file_path")
file_Name := context.GetString(consts.ValidatorPrefix + "file_name") file_Name := context.GetString(consts.ValidatorPrefix + "file_name")
final_Path := fmt.Sprintf("%s/%s.docx", file_Path, file_Name) final_Path := fmt.Sprintf("%s/%s", file_Path, file_Name)
err := file.FileDe(user_name, final_Path) err := file.FileDe(user_name, final_Path)
if err != nil { if err != nil {

@ -690,6 +690,8 @@ class PicRecog extends Plugin {
// 配置CKEditor5 // 配置CKEditor5
// DFZ
//
function setConfig() { function setConfig() {
// 获取用户的样式配置 // 获取用户的样式配置
const userConfig = getUserConfigFromBackend(); const userConfig = getUserConfigFromBackend();

@ -3,7 +3,10 @@ import { MarkdownToHtml } from '@ckeditor/ckeditor5-markdown-gfm/src/markdown2ht
import { HtmlToMarkdown } from '@ckeditor/ckeditor5-markdown-gfm/src/html2markdown/html2markdown.js'; import { HtmlToMarkdown } from '@ckeditor/ckeditor5-markdown-gfm/src/html2markdown/html2markdown.js';
// 获取用户配置 // 获取用户配置
export function getUserConfigFromBackend() { export function getUserConfigFromBackend() {
// TODO 请求用户配置 // TODO 请求用户样式
const options = {}; const options = {};
// 字体、字号、样式 // 字体、字号、样式
const { const {
@ -93,6 +96,7 @@ export function getUserConfigFromBackend() {
} }
// TODO 实现自动保存saveData方法将编辑内容发送至后端 // TODO 实现自动保存saveData方法将编辑内容发送至后端
// DFZ
export function saveData(data) { export function saveData(data) {
// return new Promise( resolve => { // return new Promise( resolve => {
// setTimeout( () => { // setTimeout( () => {

@ -355,10 +355,12 @@ export default {
this.$refs.editorToolbarElement.appendChild(editor.ui.view.toolbar.element); this.$refs.editorToolbarElement.appendChild(editor.ui.view.toolbar.element);
this.$refs.editorMenuBarElement.appendChild(editor.ui.view.menuBarView.element); this.$refs.editorMenuBarElement.appendChild(editor.ui.view.menuBarView.element);
// //
// DFZ
const pageContent = this.store.state.user.filecontent; const pageContent = this.store.state.user.filecontent;
editor.setData(pageContent); editor.setData(pageContent);
// editorwindow便使| // editorwindow便使|
window.editor = editor; window.editor = editor;
// CSS DFZ
}, },
// sidebar // sidebar
// / // /
@ -398,6 +400,7 @@ export default {
} }
}, },
// //
// DFZ
submitForm() { submitForm() {
const selectedStyles = {}; const selectedStyles = {};
for (const key in this.formData) { for (const key in this.formData) {
@ -416,6 +419,7 @@ export default {
cssClass += `}`; cssClass += `}`;
console.log(cssClass); // cssClass console.log(cssClass); // cssClass
alert(cssClass); alert(cssClass);
} else { } else {
alert("类名不能为空!"); alert("类名不能为空!");
@ -595,6 +599,7 @@ export default {
saveButton.onclick = () => { saveButton.onclick = () => {
// save // save
// TODO // TODO
// DFZ
// 使style // 使style
// styleDefinition:[name: 'styleName',element: 'element',classes: [className]] // styleDefinition:[name: 'styleName',element: 'element',classes: [className]]
const styleName = prompt("请输入样式名称:"); const styleName = prompt("请输入样式名称:");

@ -93,6 +93,7 @@ export default {
} }
else { else {
axios({ axios({
// DFZ
url:' http://1.94.171.222:8000/operation/open/', url:' http://1.94.171.222:8000/operation/open/',
type:'get', type:'get',
params:{ params:{

Loading…
Cancel
Save