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/index.js |  105 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/public/static/admin/js/blog/index.js b/public/static/admin/js/blog/index.js
index d0d0654..72e071b 100644
--- a/public/static/admin/js/blog/index.js
+++ b/public/static/admin/js/blog/index.js
@@ -2,19 +2,112 @@
     mixins: [sharedMixin],/////共用的方法/////
     data() {
         return {
-            list: [],
+            blogList: [],
+            listCount: 0,
+            searchForm: {
+                keyword: "",
+                page: 1,
+                limit: 20,
+            },
+            ifsubmit: false,
         };
     },
     mounted() {
     },
-    created() { },
+    created() {
+        this.getBlogList();
+    },
     methods: {
-        index() {
+        formatDate(time) {
+            return moment(time * 1000).format("YYYY-MM-DD H:m");
+        },
+
+        /////改变状态/////
+        changeBlogStatus(id) {
             let that = this;
-            let url = "/admin/adminmenu/index.html"
-            postRequest(url, {}).then(res => {
+            let loading = this.$loading({
+                lock: true,
+                text: 'Loading',
+                spinner: 'el-icon-loading',
+                background: 'rgba(0, 0, 0, 0.7)'
+            });
+            let url = "/admin/blog/change_blog_status.html";
+            postRequest(url, { id: id }).then(res => {
+                loading.close()
                 if (res.data.code == 200) {
-                    that.list = res.data.list;
+                    that.$message({
+                        message: res.data.message,
+                        type: 'success',
+                        duration: 1000,
+                        center: true,
+                        onClose: function () {
+                            that.getBlogList();
+                        }
+                    })
+                } else {
+                    that.$message({
+                        message: res.data.message,
+                        type: 'error',
+                        duration: 2000,
+                        center: true
+                    });
+                }
+            })
+        },
+
+        /////进入编辑页面/////
+        editBlog(id) {
+            window.location.href = "/admin/blog/add/id/" + id + ".html";
+        },
+
+        /////删除文章/////
+        deleteBlog(id) {
+            let that = this;
+            let loading = this.$loading({
+                lock: true,
+                text: 'Loading',
+                spinner: 'el-icon-loading',
+            });
+            let url = "/admin/blog/delete_blog.html";
+            postRequest(url, { id: id }).then(res => {
+                loading.close()
+                if (res.data.code == 200) {
+                    that.$message({
+                        message: res.data.message,
+                        type: 'success',
+                        duration: 1000,
+                        center: true,
+                        onClose: function () {
+                            that.getBlogList();
+                        }
+                    })
+                } else {
+                    that.$message({
+                        message: res.data.message,
+                        type: 'error',
+                        duration: 2000,
+                        center: true
+                    });
+                }
+            })
+        },
+
+        /////获取文章列表/////
+        getBlogList(page = 1) {
+            let that = this;
+            that.searchForm.page = page;
+            let loading = this.$loading({
+                lock: true,
+                text: 'Loading',
+                spinner: 'el-icon-loading',
+                background: 'rgba(0, 0, 0, 0.7)'
+            });
+            let url = "/admin/blog/get_blog_list.html"
+            postRequest(url, that.searchForm).then(res => {
+                loading.close()
+                if (res.data.code == 200) {
+                    that.blogList = res.data.data.list;
+                    that.listCount = +res.data.data.total;
                 }
             });
         },

--
Gitblit v1.9.0