From 62a15f5a88c640726304819605178958df2a88d5 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Mon, 3 Apr 2023 16:00:14 +0800 Subject: [PATCH] =?UTF-8?q?a1300399510@qq.com=20=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=8E=202023/04/03=20-16:00:02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 4 +- src/utils/common.js | 22 ++++++- .../search/searchResult/SearchResult.vue | 30 +++------- src/views/user/UserIndex.vue | 57 +++++++++---------- src/views/user/user.vue | 2 - 5 files changed, 56 insertions(+), 59 deletions(-) diff --git a/src/main.js b/src/main.js index 1aa5434..f580196 100755 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import router from './router' import store from './store' import ElementUI, { Message, Pagination } from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; -import { skipUrl, pageStop, pageMove, goTologin, copy } from "@/utils/common.js" +import { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading } from "@/utils/common.js" import http from "@/utils/request" Vue.config.productionTip = false @@ -21,6 +21,8 @@ Vue.prototype.$pageStop = pageStop // 页面禁止滑动 Vue.prototype.$pageMove = pageMove // 页面可以滑动 Vue.prototype.$Message = Message // 消息提示框 Vue.prototype.$copy = copy // 复制 +Vue.prototype.$startupUnderLoading = startupUnderLoading // 复制 +Vue.prototype.$closeUnderLoading = closeUnderLoading // 复制 //svg文件引入 import './icons' diff --git a/src/utils/common.js b/src/utils/common.js index d41c461..b670580 100755 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -43,8 +43,24 @@ function copy(value, message) { copyInput.remove(); if (message) this.$message.success(message); - - + + } -export { skipUrl, pageStop, pageMove, goTologin, copy } \ No newline at end of file + +// 启动加载中 +function startupUnderLoading(that) { + that.loading = that.$loading({ + lock: true, + text: '加载中...', + background: 'rgba(0, 0, 0, 0.7)' + }); +} + +// 关闭加载中 +function closeUnderLoading(that) { + that.loading.close(); +} + + +export { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading } \ No newline at end of file diff --git a/src/views/search/searchResult/SearchResult.vue b/src/views/search/searchResult/SearchResult.vue index 162f900..7733e26 100755 --- a/src/views/search/searchResult/SearchResult.vue +++ b/src/views/search/searchResult/SearchResult.vue @@ -15,17 +15,15 @@
大约找到
{{ count }}
条结果
-
+
{{ item.forum }}
-
诚招室友一起合租香港大学附近房子 女生
-
- -
- {{ item.message }} + +
+
-
+
@@ -93,8 +91,8 @@ export default { watch: { searchResultState(val, oldval) { - if (val) this.startupUnderLoading() - else this.closeUnderLoading() + if (val) this.$startupUnderLoading(this) + else this.$closeUnderLoading(this) } }, @@ -129,23 +127,9 @@ export default { // 点击改变页数 currentChange() { - console.log("dfgdf", this.page); this.getSearchResult() }, - // 启动加载中 - startupUnderLoading() { - this.loading = this.$loading({ - lock: true, - text: '加载中...', - background: 'rgba(0, 0, 0, 0.7)' - }); - }, - - // 关闭加载中 - closeUnderLoading() { - this.loading.close(); - }, // 点击清空 input 的值 diff --git a/src/views/user/UserIndex.vue b/src/views/user/UserIndex.vue index 8684d87..fc9e9ad 100755 --- a/src/views/user/UserIndex.vue +++ b/src/views/user/UserIndex.vue @@ -2,24 +2,24 @@
- +
-
{{ info.nickname }}
+
{{ user.nickname }}
-
279
+
{{ count.prestige }}
声望
-
279
-
声望
+
{{ count.gtercurrency }}
+
寄托币
-
279
-
声望
+
{{ count.digest }}
+
精华
@@ -29,8 +29,8 @@ 消息
-
{{ count.collect }}
-
{{ 1 }}
+
{{ count.message }}
+
{{ user.messagenum }}
@@ -40,7 +40,7 @@ 收藏
-
{{ count.creation }}
+
{{ count.fav }}
@@ -49,7 +49,7 @@ 发帖
-
{{ count.likearticle }}
+
{{ count.post }}
@@ -58,7 +58,7 @@ 回帖
-
{{ count.comment }}
+
{{ count.reply }}
@@ -70,7 +70,6 @@ 个人资料
-
{{ count.creation }}
@@ -79,7 +78,6 @@ 设置头像
-
{{ count.likearticle }}
@@ -88,7 +86,6 @@ 我的状态
-
{{ count.comment }}
@@ -97,7 +94,6 @@ 修改密码
-
{{ count.comment }}
@@ -106,7 +102,6 @@ 绑定邮箱
-
{{ count.comment }}
@@ -115,7 +110,6 @@ 绑定手机
-
{{ count.comment }}
@@ -124,7 +118,6 @@ 绑定第三方账号
-
{{ count.comment }}
@@ -133,7 +126,6 @@ 浏览个人主页
-
{{ count.comment }}
@@ -152,26 +144,31 @@ export default { data() { return { - info: { - avatar: "https://oss.gter.net/avatar/97KwEWANd_4DHWiY6VbnSUFSCKroYWFjYQ~~/middle", - nickname: "Ada.Wu" - }, - count: { - collect: 10, - creation: 10, - likearticle: 10, - comment: 10, + user: { + avatar: "", + nickname: "", + messagenum: 0 }, + count: {}, }; }, mounted() { - + this.init() }, methods: { + init() { + this.$http.post("/api/user", "").then(res => { + console.log(res, "res"); + let data = res.data + this.count = data.count + this.user = data.user + console.log(this.count); + }) + }, }, }; diff --git a/src/views/user/user.vue b/src/views/user/user.vue index 897aa50..b90ca67 100755 --- a/src/views/user/user.vue +++ b/src/views/user/user.vue @@ -14,12 +14,10 @@ export default { data() { return { - }; }, mounted() { - }, methods: {