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");