1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
| const App = {
| mixins: [sharedMixin],/////共用的方法/////
| data() {
| return {
| blogList: [],
| listCount: 0,
| searchForm: {
| keyword: "",
| page: 1,
| limit: 20,
| },
| ifsubmit: false,
| };
| },
| mounted() {
| },
| created() {
| this.getBlogList();
| },
| methods: {
| formatDate(time) {
| return moment(time * 1000).format("YYYY-MM-DD H:m");
| },
|
| /////改变状态/////
| changeBlogStatus(id) {
| let that = this;
| 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.$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;
| }
| });
| },
|
| /////保存菜单/////
| saveMenu() {
| var that = this;
| if (that.ifsubmit) {
| return false;
| }
| that.ifsubmit = true;
| let url = "/admin/adminmenu/saveMenu.html";
| postRequest(url, that.Add_form).then(res => {
| if (res.data.code == 200) {
| that.$message({
| message: res.data.message,
| type: 'success',
| duration: 1000,
| center: true,
| onClose: function () {
| that.ifsubmit = false;
| that.dialogVisible_menu = false;
| that.index();
|
| }
| });
| }
| else {
| that.ifsubmit = false;
| that.$message({
| message: res.data.message,
| type: 'error',
| duration: 1500,
| center: true
| });
| }
| });
| },
|
| }
| };
| const app = Vue.createApp(App);
| for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
| app.component(key, component)
| }
| app.use(ElementPlus, {
| locale: ElementPlusLocaleZhCn,
| });
| app.mount("#vue_item");
|
|