From 17e42d4e0fa95c7af0173be4ef4768eeb6090d5f Mon Sep 17 00:00:00 2001
From: chengkun <chengkun@ishangstudy.com>
Date: Mon, 15 Sep 2025 14:43:34 +0800
Subject: [PATCH] 提交
---
public/static/admin/js/blog/add.js | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/public/static/admin/js/blog/add.js b/public/static/admin/js/blog/add.js
index f0de19b..a9f4e7b 100644
--- a/public/static/admin/js/blog/add.js
+++ b/public/static/admin/js/blog/add.js
@@ -1,7 +1,9 @@
+var id = $("#id").val();
const App = {
mixins: [sharedMixin],/////共用的方法/////
data() {
return {
+ blog_id: id,
addBlogForm: {
title: '',
en_title: '',
@@ -17,11 +19,14 @@
mounted() {
},
created() {
- window.setHtmlValue = this.setHtmlValue;
+ window.getHtmlValue = this.getHtmlValue;
+ if (this.blog_id > 0) {
+ this.getBlogInfo();
+ }
},
methods: {
/////获取富文本内容/////
- setHtmlValue(value, type = 1) {
+ getHtmlValue(value, type = 1) {
if (type == 1) {
this.addBlogForm.content = value;
} else {
@@ -64,6 +69,28 @@
}
return true;
},
+
+ /////获取博客信息/////
+ getBlogInfo() {
+ let that = this;
+ let url = "/admin/blog/get_blog_info.html";
+ postRequest(url, { id: that.blog_id }).then(res => {
+ if (res.data.code == 200) {
+ that.addBlogForm = res.data.data;
+ setTimeout(function () {
+ window.setHtmlValue(res.data.data.content, 1);
+ window.setHtmlValue(res.data.data.en_content, 2);
+ })
+ } else {
+ that.$message({
+ message: res.data.message,
+ type: 'error',
+ duration: 1500,
+ center: true
+ });
+ }
+ })
+ },
/////保存/////
onSubmit() {
var that = this;
--
Gitblit v1.9.0