+
From 82dbce6f126d175cd789c3ba254d88e48c18f565 Mon Sep 17 00:00:00 2001 From: MiraiMagician <158348508@qq.com> Date: Sun, 6 Jun 2021 12:05:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E8=B5=9E=E5=B9=B6=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=89=8D=E7=AB=AF=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/like.js | 34 +++++++++++++++++++ src/api/post.js | 5 +-- src/assets/app.css | 30 +++++++++++++++++ src/i18n/lang/en.js | 6 ++-- src/i18n/lang/zh.js | 6 ++-- src/view/post/Author.vue | 48 ++++++++------------------- src/view/post/Detail.vue | 67 +++++++++++++++++++++++++++++++++++++ src/view/post/Index.vue | 72 +++++++++++++++++++++++++++++++++++++++- 8 files changed, 226 insertions(+), 42 deletions(-) create mode 100644 src/api/like.js diff --git a/src/api/like.js b/src/api/like.js new file mode 100644 index 0000000..e611eec --- /dev/null +++ b/src/api/like.js @@ -0,0 +1,34 @@ +import request from '@/util/request' + +// 关注 +export function like(id) { + return request(({ + url: `/post/like`, + method: 'get', + params: { + topic_id: id + } + })) +} + +// 关注 +export function unLike(id) { + return request(({ + url: `/post/unlike`, + method: 'get', + params: { + topic_id: id + } + })) +} + +// 验证是否关注 +export function hasLiked(id) { + return request(({ + url: `/post/hasliked`, + method: 'get', + params: { + topic_id: id + } + })) +} \ No newline at end of file diff --git a/src/api/post.js b/src/api/post.js index 69e405c..1af27ff 100644 --- a/src/api/post.js +++ b/src/api/post.js @@ -1,13 +1,14 @@ import request from '@/util/request' -export function getList(pageNo, size, tab) { +export function getList(pageNo, size, tab, userid) { return request(({ url: '/post/list', method: 'get', params: { pageNo: pageNo, size: size, - tab: tab + tab: tab, + userid:userid } })) } diff --git a/src/assets/app.css b/src/assets/app.css index 0cd905d..eb0e3ac 100644 --- a/src/assets/app.css +++ b/src/assets/app.css @@ -157,4 +157,34 @@ a:hover { .vditor-reset { font-size: 14px !important; +} + +.like{ + color: rgb(64, 158, 255); + background: rgb(205, 228, 255); + height: 30px; + width: 110px; + border-radius: 15px; + border:1px; + } + +.like:hover +{ + color: rgb(255, 255, 255); + background: rgb(64, 158, 255); +} + +.liked{ + color: rgb(255, 255, 255); + background: rgb(64, 158, 255); + height: 30px; + width: 110px; + border-radius: 15px; + border:1px; + } + +.liked:hover +{ + color: rgb(255, 255, 255); + background: rgb(0, 128, 255); } \ No newline at end of file diff --git a/src/i18n/lang/en.js b/src/i18n/lang/en.js index 6b37ca4..7a61f19 100644 --- a/src/i18n/lang/en.js +++ b/src/i18n/lang/en.js @@ -57,6 +57,8 @@ export default { posting: 'Publish idea', settled: 'Sign up', signIn: 'Sign in', + changeBillboard: 'Change billboard', + changeSentence: 'Change daliy sentence', promotion: 'Promotion', detail: 'Not received related promotion!', sentence: 'Daily sentence' @@ -82,7 +84,8 @@ export default { latest: 'Latest topics', release: 'Released', view: 'Views', - hot: 'Hot Topics' + hot: 'Hot Topics', + star: 'Favourites' }, user: { score: 'Score', @@ -107,7 +110,6 @@ export default { placeholder: 'Add a comment...', submit: 'Submit', success: 'Comment successfully', - empty: 'Comment cannot be empty', failed: 'Cannot comment to this post, {0}' } } \ No newline at end of file diff --git a/src/i18n/lang/zh.js b/src/i18n/lang/zh.js index 528b177..9051eae 100644 --- a/src/i18n/lang/zh.js +++ b/src/i18n/lang/zh.js @@ -57,6 +57,8 @@ export default { posting: '发表想法', settled: '马上入驻', signIn: '社区登入', + changeBillboard: '修改公告栏', + changeSentence: '修改每日一句', promotion: '推广', detail: '未收到有关推广!', sentence: '每日一句' @@ -82,7 +84,8 @@ export default { latest: '最新主题', release: '发布于', view: '浏览', - hot: '热门主题' + hot: '热门主题', + star: '收藏夹' }, user: { score: '积分', @@ -107,7 +110,6 @@ export default { placeholder: '此处输入评论...', submit: '提交', success: '评论成功', - empty: '评论不能为空', failed: '无法在此帖发表评论, {0}' } } \ No newline at end of file diff --git a/src/view/post/Author.vue b/src/view/post/Author.vue index f3bc40b..f5f3b70 100644 --- a/src/view/post/Author.vue +++ b/src/view/post/Author.vue @@ -52,7 +52,7 @@ diff --git a/src/view/post/Detail.vue b/src/view/post/Detail.vue index 9ba65ea..977d84d 100644 --- a/src/view/post/Detail.vue +++ b/src/view/post/Detail.vue @@ -5,6 +5,7 @@
+