+
-
-
{{ item.n_title }}
+
+
{{ item.title }}
{{ item.published }}
@@ -54,65 +54,18 @@ const search_text = ref('')
const pageSize = 5
const page = 1
-const news = ref([
- {
- a_id: '1',
- n_title: '1',
- synopsis: '1',
- published: '1',
- pic: '1'
- },
- {
- a_id: '2',
- n_title: '2',
- synopsis: '2',
- published: '2',
- pic: '2'
- },
- {
- a_id: '3',
- n_title: '3',
- synopsis: '3',
- published: '3',
- pic: '3'
- },
- {
- a_id: '1',
- n_title: '1',
- synopsis: '1',
- published: '1',
- pic: '1'
- },
- {
- a_id: '2',
- n_title: '2',
- synopsis: '2',
- published: '2',
- pic: '2'
- },
- {
- a_id: '3',
- n_title: '3',
- synopsis: '3',
- published: '3',
- pic: '3'
- },
+const articles = ref([])
-])
-
-const getNews = async () => {
+const getArticles = async () => {
try {
- const response = await axios.get('/api/blog/get/news', {
- headers: {
- Authorization: 'Bearer ' + userinfo.token
- },
+ const response = await axios.get('/api/blog/get/articles', {
params: {
current: page,
size: pageSize
}
})
if (response.data.code === 200) {
- news.value = response.data.data.records
+ articles.value = response.data.data.records
} else {
console.log(response.data.message)
return
@@ -124,31 +77,15 @@ const getNews = async () => {
}
-const openDetails = async (a_id) => {
- // const response = await axios.get('/api/blog/get/article/' + a_id, {
- // headers: {
- // Authorization: 'Bearer ' + userinfo.token
- // }
- // })
- // if (!response.data.code === 200) {
- // console.log(response.data.message)
- // return
- // }
- // details.setViewDetails(response.data.data)
- details.setViewDetails({
- id: "1212",
- title: "12312",
- content: "231323",
- created: "123123",
- updated: "123132",
- })
+const openDetails = async (item) => {
+ details.setViewDetails(item)
router.push('viewDetails')
}
onMounted(() => {
- getNews()
+ getArticles()
})
diff --git a/src/views/blog/blog.vue b/src/views/blog/blog.vue
index 9629a47..3d2bdf8 100644
--- a/src/views/blog/blog.vue
+++ b/src/views/blog/blog.vue
@@ -36,11 +36,11 @@
-
-
+
+
-
-
+
+
管理员登录
@@ -54,14 +54,14 @@
-
-
+
+
-
-
+
+
-
-
+
+
@@ -81,7 +81,6 @@
\ No newline at end of file
diff --git a/src/views/blog/show.vue b/src/views/blog/show.vue
index b27bbaf..40a75c5 100644
--- a/src/views/blog/show.vue
+++ b/src/views/blog/show.vue
@@ -20,12 +20,12 @@
-
+
-
{{ item.n_title }}
+
{{ item.title }}
{{ item.published }}
@@ -67,51 +67,7 @@ const search_text = ref('')
const pageSize = 5
const page = 1
-const news = ref([
- {
- a_id: '1',
- n_title: '1',
- synopsis: '1',
- published: '1',
- pic: '1'
- },
- {
- a_id: '2',
- n_title: '2',
- synopsis: '2',
- published: '2',
- pic: '2'
- },
- {
- a_id: '3',
- n_title: '3',
- synopsis: '3',
- published: '3',
- pic: '3'
- },
- {
- a_id: '1',
- n_title: '1',
- synopsis: '1',
- published: '1',
- pic: '1'
- },
- {
- a_id: '2',
- n_title: '2',
- synopsis: '2',
- published: '2',
- pic: '2'
- },
- {
- a_id: '3',
- n_title: '3',
- synopsis: '3',
- published: '3',
- pic: '3'
- },
-
-])
+const news = ref([])
const dialogWidth = computed(() => {
return window.innerWidth < 768 ? '90%' : '60%'
@@ -121,7 +77,6 @@ const getNews = async () => {
try {
const response = await axios.get('/api/blog/get/news', {
headers: {
- Authorization: 'Bearer ' + userinfo.token
},
params: {
current: page,
@@ -141,24 +96,8 @@ const getNews = async () => {
}
-const openDetails = async (a_id) => {
- // const response = await axios.get('/api/blog/get/article/' + a_id, {
- // headers: {
- // Authorization: 'Bearer ' + userinfo.token
- // }
- // })
- // if (!response.data.code === 200) {
- // console.log(response.data.message)
- // return
- // }
- // details.setViewDetails(response.data.data)
- details.setViewDetails({
- id: "1212",
- title: "12312",
- content: "231323",
- created: "123123",
- updated: "123132",
- })
+const openDetails = async (item) => {
+ details.setViewDetails(item)
router.push('viewDetails')
}
@@ -166,7 +105,6 @@ const openDetails = async (a_id) => {
onMounted(() => {
getNews()
-
})
diff --git a/src/views/blog/viewDetails.vue b/src/views/blog/viewDetails.vue
index eb83370..c36ecc8 100644
--- a/src/views/blog/viewDetails.vue
+++ b/src/views/blog/viewDetails.vue
@@ -8,8 +8,7 @@
{{ details.detail.title }}
- 发布时间:{{ details.detail.created }}---更新时间:{{
- details.detail.updated }}
+ 发布时间: {{ details.detail.published }}
@@ -17,7 +16,6 @@
-