@jx3box/jx3box-vue3-ui 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-vue3-ui",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -16,7 +16,7 @@
16
16
  </breadcrumb>
17
17
  <LeftSidebar :open="true" :uid="8">
18
18
  <LeftSideToggle :mobileOnly="true" />
19
- <!-- <Author :author="author" :uid="37" /> -->
19
+ <Author :uid="8" />
20
20
  </LeftSidebar>
21
21
 
22
22
  <Main :withoutLeft="false" :withoutRight="false">
@@ -37,19 +37,13 @@
37
37
  </template>
38
38
 
39
39
  <script>
40
+ import Author from './Author.vue';
40
41
  import SimpleThxVue from "./single/SimpleThx.vue";
41
42
  export default {
42
43
  name: "App",
43
44
  components: {
44
- // Main,
45
- // Header,
46
- // Footer,
47
- // Breadcrumb,
48
- // LeftSidebar,
49
- // LeftSideToggle,
50
- // RightSidebar,
51
- // Bottom,
52
45
  SimpleThxVue,
46
+ Author,
53
47
  },
54
48
  };
55
49
  </script>
package/src/Author.vue ADDED
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <div class="c-author">
3
+ <AuthorInfo :uid="uid" @ready="installModules" />
4
+ <template v-if="data">
5
+ <div class="u-interact">
6
+ <AuthorFollow style="margin-right: 8px;" :uid="uid" />
7
+ <AuthorGift :uid="uid" />
8
+ </div>
9
+ <!-- <AuthorMsg :uid="uid" /> -->
10
+ <AuthorLink class="u-block u-links" :uid="uid" :data="data" />
11
+ <AuthorMedals class="u-block u-trophy" :uid="uid" />
12
+ <AuthorTeams class="u-block u-teams" :uid="uid" />
13
+ <AuthorFans class="u-block u-fans" :uid="uid" />
14
+ <slot></slot>
15
+ <AuthorPosts class="u-block u-posts" :uid="uid" />
16
+ </template>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import AuthorInfo from "./author/AuthorInfo.vue";
22
+ import AuthorLink from "./author/AuthorLink.vue";
23
+ import AuthorFollow from "./author/AuthorFollow.vue";
24
+ // import AuthorMsg from "./author/AuthorMsg.vue";
25
+ import AuthorGift from "./author/AuthorGift.vue";
26
+ import AuthorFans from "./author/AuthorFans.vue";
27
+ import AuthorMedals from "./author/AuthorMedals.vue";
28
+ import AuthorTeams from "./author/AuthorTeams.vue";
29
+ import AuthorPosts from "./author/AuthorPosts.vue";
30
+ export default {
31
+ name: "AuthorComp",
32
+ props: ["uid"],
33
+ data: function () {
34
+ return {
35
+ data: "",
36
+ };
37
+ },
38
+ methods: {
39
+ installModules: function (data) {
40
+ this.data = data;
41
+ },
42
+ },
43
+ components: {
44
+ AuthorInfo,
45
+ AuthorLink,
46
+ AuthorFollow,
47
+ // AuthorMsg,
48
+ AuthorGift,
49
+ AuthorMedals,
50
+ AuthorTeams,
51
+ AuthorPosts,
52
+ AuthorFans,
53
+ },
54
+ };
55
+ </script>
56
+
57
+ <style lang="less">
58
+ @import "../assets/css/author.less";
59
+ </style>
@@ -0,0 +1,163 @@
1
+ <template>
2
+ <div class="c-author-fans" v-if="list && list.length">
3
+ <div class="u-label">
4
+ <img svg-inline src="../../assets/img/leftsidebar/fans.svg" />
5
+ <span>粉丝榜</span>
6
+ </div>
7
+ <div class="f-avatar">
8
+ <el-tooltip
9
+ class="item"
10
+ effect="dark"
11
+ :content="'累计打赏' + item.money.toString() + '金箔'"
12
+ placement="top"
13
+ v-for="item in list"
14
+ :key="item.pay_user_id"
15
+ >
16
+ <a class="u-fan" :href="authorLink(item.pay_user_id)"
17
+ ><el-avatar class="u-avatar" shape="circle" :size="20" :src="showAvatar(item.pay_user.avatar)"
18
+ ><el-icon><Avatar/></el-icon></el-avatar
19
+ ></a>
20
+ </el-tooltip>
21
+ <el-avatar class="u-avatar u-more" shape="circle" :size="20" v-if="total > MAX_LENGTH">
22
+ <span class="f-avatar-num" v-if="total > 99">···</span>
23
+ <span class="f-avatar-num" v-else>+{{ total - MAX_LENGTH }}</span>
24
+ </el-avatar>
25
+ </div>
26
+ <div class="f-bottom">本赛季共 {{ total }} 人为TA赠礼</div>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ import { getFansList } from "../../service/author";
32
+ import { showAvatar, authorLink } from "@jx3box/jx3box-common/js/utils";
33
+ export default {
34
+ name: "AuthorFans",
35
+ props: {
36
+ uid: {
37
+ type: Number,
38
+ default: 0,
39
+ },
40
+ },
41
+ data() {
42
+ return {
43
+ list: [],
44
+ total: 0,
45
+ MAX_LENGTH : 8,
46
+ };
47
+ },
48
+ methods: {
49
+ getData() {
50
+ getFansList(this.uid).then((res) => {
51
+ this.list = res.data.data.list?.slice(0,this.MAX_LENGTH) || [];
52
+ this.total = res.data.data.totalUser || 0;
53
+ });
54
+ },
55
+ showAvatar,
56
+ authorLink,
57
+ },
58
+ watch: {
59
+ uid: {
60
+ immediate: true,
61
+ handler: function () {
62
+ this.getData();
63
+ },
64
+ },
65
+ },
66
+ };
67
+ </script>
68
+
69
+ <style lang="less">
70
+ .c-author-fans {
71
+ box-sizing: border-box;
72
+ // padding: 10px;
73
+ // background: #ffffff;
74
+ font-family: "Microsoft YaHei";
75
+ font-style: normal;
76
+ // .h(133px);
77
+ .f-main-box {
78
+ display: flex;
79
+ justify-content: center;
80
+ width: 100%;
81
+ .f-left {
82
+ .w(65.3%);
83
+ .f-l-box {
84
+ .w(100%);
85
+ .h(50px);
86
+ background: #ff7cab;
87
+ border-radius: 5px 0px 0px 5px;
88
+ display: flex;
89
+ justify-content: center;
90
+ align-items: center;
91
+ flex: none;
92
+ .f-l-title {
93
+ .w(48px);
94
+ .h(21px);
95
+ .fz(16px, 21px);
96
+ font-weight: 700;
97
+ color: #ffffff;
98
+ }
99
+ }
100
+ }
101
+ .f-right {
102
+ position: relative;
103
+ .w(34.7%);
104
+ .f-r-box {
105
+ display: flex;
106
+ justify-content: center;
107
+ align-items: center;
108
+ flex: none;
109
+ .h(50px);
110
+ .w(100%);
111
+ z-index: 2;
112
+ position: absolute;
113
+ .f-r-num {
114
+ font-weight: 700;
115
+ .fz(10px, 13px);
116
+ .w(100%);
117
+ color: rgba(0, 0, 0, 0.5);
118
+ padding-left: 37.5%;
119
+ }
120
+ }
121
+ .f-r-line {
122
+ .h(5px);
123
+ background: #ff7cab;
124
+ border-radius: 0px 5px 5px 0px;
125
+ }
126
+ .f-r-mb {
127
+ .mb(2.5px);
128
+ }
129
+ .f-r-w-80 {
130
+ .w(100%);
131
+ }
132
+ .f-r-w-70 {
133
+ .w(87.5%);
134
+ }
135
+ .f-r-w-30 {
136
+ .w(37.5%);
137
+ }
138
+ .f-r-w-20 {
139
+ .w(25%);
140
+ }
141
+ }
142
+ }
143
+ .f-avatar {
144
+ height: 30px;
145
+ .f-avatar-num {
146
+ .fz(12px);
147
+ color: #888;
148
+ font-weight: 700;
149
+ }
150
+ .u-fan{
151
+ .mr(5px);
152
+ }
153
+ }
154
+ .f-bottom {
155
+ .mt(5px);
156
+ .fz(12px, 14px);
157
+ font-weight: 400;
158
+ color: #888;
159
+ // transform: scale(0.8);
160
+ // transform-origin: 0 0;
161
+ }
162
+ }
163
+ </style>
@@ -0,0 +1,208 @@
1
+ <template>
2
+ <div class="c-author-follow">
3
+ <el-button
4
+ v-if="!isFollow"
5
+ class="u-btn"
6
+ :class="{ 'is-follow': isFollow, 'u-fans-box': isSelf }"
7
+ size="small"
8
+ plain
9
+ icon="Plus"
10
+ @click="follow"
11
+ :loading="loading"
12
+ :disabled="isSelf"
13
+ >{{ btnText }}</el-button
14
+ >
15
+ <el-popover
16
+ v-else
17
+ placement="bottom"
18
+ trigger="hover"
19
+ popper-class="c-author-follow-popover"
20
+ :visible-arrow="true"
21
+ >
22
+ <div class="u-action-list">
23
+ <div class="u-action-item" v-for="item in actions" :key="item.label" @click.stop="item.action">
24
+ {{ item.label }}
25
+ </div>
26
+ </div>
27
+ <template #reference>
28
+ <el-button class="u-trigger" size="small" :type="btnType" plain icon="Check">{{
29
+ btnText
30
+ }}</el-button>
31
+ </template>
32
+ </el-popover>
33
+ </div>
34
+ </template>
35
+
36
+ <script>
37
+ import { follow, unfollow, getFansCount } from "../../service/follow";
38
+ import User from "@jx3box/jx3box-common/js/user";
39
+ export default {
40
+ name: "AuthorFollow",
41
+ props: {
42
+ uid: {
43
+ type: Number,
44
+ default: 0,
45
+ },
46
+ },
47
+ data() {
48
+ return {
49
+ isFollow: false,
50
+ fansNum: 0,
51
+ loading: false,
52
+ };
53
+ },
54
+ computed: {
55
+ btnText() {
56
+ return this.isFollow ? "已粉" : "关注";
57
+ },
58
+ btnType() {
59
+ return this.isFollow ? "info" : "warning";
60
+ },
61
+ actions() {
62
+ return [
63
+ {
64
+ label: "发送私信",
65
+ action: () => {
66
+ window.open("/dashboard/letter?receiver=" + this.uid);
67
+ },
68
+ },
69
+ {
70
+ label: "取消关注",
71
+ action: () => {
72
+ this.unfollow();
73
+ },
74
+ },
75
+ ];
76
+ },
77
+ isSelf() {
78
+ return this.uid == this.user.uid;
79
+ },
80
+ user() {
81
+ return User.getInfo();
82
+ },
83
+ isLogin: function () {
84
+ return User.isLogin();
85
+ },
86
+ },
87
+ watch: {
88
+ uid: {
89
+ immediate: true,
90
+ handler(val) {
91
+ val && this.loadFans();
92
+ },
93
+ },
94
+ },
95
+ methods: {
96
+ // 格式化粉丝数
97
+ formatFansNum(num) {
98
+ if (num < 10000) {
99
+ return num === 0 ? "" : num;
100
+ } else {
101
+ return (num / 10000).toFixed(1) + "万";
102
+ }
103
+ },
104
+ // 关注
105
+ follow() {
106
+ if (!this.isLogin) {
107
+ User.toLogin();
108
+ return;
109
+ }
110
+ follow(this.uid)
111
+ .then(() => {
112
+ this.$message.success("关注成功");
113
+ this.isFollow = true;
114
+ this.loadFans();
115
+ })
116
+ .catch((err) => {
117
+ console.log(err);
118
+ });
119
+ },
120
+ // 取消关注
121
+ unfollow() {
122
+ this.$confirm("确定不再关注此人?", "提示", {
123
+ confirmButtonText: "确定",
124
+ cancelButtonText: "取消",
125
+ type: "warning",
126
+ }).then(() => {
127
+ unfollow(this.uid)
128
+ .then(() => {
129
+ this.$message.success("取关成功");
130
+ this.isFollow = false;
131
+ this.loadFans();
132
+ })
133
+ .catch((err) => {
134
+ console.log(err);
135
+ });
136
+ });
137
+ },
138
+ loadFans() {
139
+ this.loading = true;
140
+ getFansCount(this.uid)
141
+ .then((res) => {
142
+ this.fansNum = res.data.data.follower_count || 0;
143
+ this.isFollow = res.data.data.is_followed;
144
+ })
145
+ .catch((err) => {
146
+ console.log(err);
147
+ })
148
+ .finally(() => {
149
+ this.loading = false;
150
+ });
151
+ },
152
+ },
153
+ };
154
+ </script>
155
+
156
+ <style lang="less">
157
+ .c-author-follow {
158
+ .u-btn.el-button {
159
+ cursor: default;
160
+ &:hover {
161
+ cursor: pointer;
162
+ background-color: @light-pink ;
163
+ color: #fff ;
164
+ border-color: darken(@light-pink, 2%) ;
165
+ }
166
+ }
167
+
168
+ .u-fans-box {
169
+ cursor: not-allowed;
170
+ &:hover {
171
+ cursor: not-allowed;
172
+ }
173
+ }
174
+ .u-trigger {
175
+ &:hover {
176
+ cursor: default;
177
+ }
178
+ }
179
+ }
180
+ .c-author-follow-popover {
181
+ //.u-follow-popover {
182
+ &.el-popover {
183
+ min-width: 100px;
184
+ padding: 0;
185
+ margin-top: 5px;
186
+ .u-action-list {
187
+ .u-action-item {
188
+ text-align: center;
189
+ cursor: pointer;
190
+ padding: 8px 10px;
191
+ &:hover {
192
+ background: rgb(248, 248, 251);
193
+ }
194
+ }
195
+ }
196
+ }
197
+ //}
198
+ .u-follow-count {
199
+ margin-left: 5px;
200
+ }
201
+ }
202
+
203
+ @media screen and (max-width: @phone) {
204
+ .el-message-box {
205
+ max-width: 60%;
206
+ }
207
+ }
208
+ </style>