@jx3box/jx3box-common-ui 6.1.4 → 6.1.7

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/src/Author.vue CHANGED
@@ -1,225 +1,52 @@
1
1
  <template>
2
- <div class="c-author" v-if="data">
3
- <div class="u-author">
4
- <Avatar class="u-avatar" :uid="uid" :url="data.user_avatar" :size="68" :frame="data.user_avatar_frame" />
5
- <div class="u-info">
6
- <a class="u-name" :href="authorLink(uid)" target="_blank">
7
- <span>{{ data.display_name.slice(0, 8) }}</span>
8
- <el-tooltip class="item" effect="dark" content="签约作者" placement="top" v-if="isSuperAuthor">
9
- <a class="u-superauthor" href="/dashboard/#/cooperation" target="_blank">
10
- <img :src="super_author_icon" alt="superauthor" />
11
- </a>
12
- </el-tooltip>
13
- </a>
14
- <div class="u-extend">
15
- <el-tooltip class="item" effect="dark" placement="top">
16
- <div slot="content">
17
- <span class="u-tips">经验值:{{ data.experience }}</span>
18
- </div>
19
- <span class="u-level" :class="'lv-' + level" :style={backgroundColor:showLevelColor(level)}>Lv.{{ level }}</span>
20
- </el-tooltip>
21
- <el-tooltip class="item" effect="dark" :content="vipTypeTitle" placement="top" v-if="isVip">
22
- <a class="u-vip" href="/vip/premium?from=sidebar_author" target="_blank">
23
- <i class="i-icon-vip on">{{ vipType }}</i>
24
- </a>
25
- </el-tooltip>
26
- </div>
2
+ <div class="c-author">
3
+ <AuthorInfo :uid="uid" @ready="installModules" />
4
+ <template v-if="data">
5
+ <div class="u-fans">
6
+ <AuthorFollow style="margin-right: 8px;" :uid="uid" />
7
+ <AuthorGift :uid="uid" />
27
8
  </div>
28
- </div>
29
- <div class="u-bio">{{ data.user_bio }}</div>
30
- <AuthorFollow class="u-follow-box" :uid="uid" />
31
- <div class="u-link" v-if="hasLink">
32
- <a v-if="data.weibo_name" class="u-weibo" :href="weiboLink(data.weibo_id)" target="_blank">
33
- <img svg-inline src="../assets/img/author/weibo.svg" />
34
- {{ data.weibo_name }}
35
- </a>
36
- <a v-if="data.github_name" class="u-github" :href="githubLink(data.github_name)" target="_blank">
37
- <img svg-inline src="../assets/img/author/github.svg" />
38
- {{ data.github_name }}
39
- </a>
40
- <div v-if="data.tuilan_id" class="u-tuilan" title="推栏ID">
41
- <img src="../assets/img/author/tuilan.png" />
42
- {{ data.tuilan_id }}
43
- </div>
44
- <a v-if="data.tv_type && data.tv_id" class="u-tv" :href="tv_link" target="_blank">
45
- <img :src="tv_img" />
46
- {{ data.tv_id }}
47
- <span class="u-tv-living" v-if="tv_status">
48
- <div class="u-tv-living-icon">
49
- <div class="u-tv-living-icon-col first"></div>
50
- <div class="u-tv-living-icon-col"></div>
51
- <div class="u-tv-living-icon-col last"></div>
52
- </div>
53
- </span>
54
- </a>
55
- </div>
56
- <slot></slot>
57
- <div class="u-trophy" v-if="hasTrophy">
58
- <div class="u-label">
59
- <i class="el-icon-trophy"></i>
60
- <span>作者荣誉</span>
61
- </div>
62
- <div class="u-medals" v-if="medals && medals.length">
63
- <!-- <span class="u-medal" v-for="(item, i) in medals" :key="i">
64
- <img :src="showMedalIcon(item.medal)" :title="showMedalDesc(item)" />
65
- </span> -->
66
- <medal :medals="medals" :showIcon="showMedalIcon"></medal>
67
- </div>
68
- </div>
69
- <div class="u-teams" v-if="teams && teams.length">
70
- <div class="u-label">
71
- <i class="el-icon-school"></i>
72
- <span>所属团队</span>
73
- </div>
74
- <a class="u-team" v-for="(item, i) in teams" :key="i" :href="teamLink(item.team_id)" target="_blank">
75
- <img class="u-team-logo" :src="showTeamLogo(item.team_logo)" />
76
- <span class="u-team-name">{{ item.team_name }}@{{ item.team_server }}</span>
77
- </a>
78
- </div>
79
- <Authorposts :uid="uid" />
9
+ <!-- <AuthorMsg :uid="uid" /> -->
10
+ <AuthorLink class="u-links" :uid="uid" :data="data" />
11
+ <AuthorMedals class="u-trophy" :uid="uid" />
12
+ <AuthorTeams class="u-teams" :uid="uid" />
13
+ <slot></slot>
14
+ <AuthorPosts class="u-posts" :uid="uid" />
15
+ </template>
80
16
  </div>
81
17
  </template>
82
18
 
83
19
  <script>
84
- // const liveStatusMap = ["等待开播", "直播中", "直播结束"];
85
- import { authorLink, tvLink, getLink, getThumbnail } from "@jx3box/jx3box-common/js/utils";
86
- import { __server, __imgPath,__userLevelColor } from "@jx3box/jx3box-common/data/jx3box.json";
87
- import { getUserInfo, getDouyu, getUserMedals, getUserPublicTeams } from "../service/author";
88
- import { user as medal_map } from "@jx3box/jx3box-common/data/medals.json";
89
- import User from "@jx3box/jx3box-common/js/user";
90
- import { __userLevel } from "@jx3box/jx3box-common/data/jx3box.json";
91
- // components
92
- import medal from './medal/medal.vue'
93
- import Avatar from "./author/Avatar.vue";
94
- import Authorposts from "./author/Authorposts.vue";
20
+ import AuthorInfo from "./author/AuthorInfo.vue";
21
+ import AuthorLink from "./author/AuthorLink.vue";
95
22
  import AuthorFollow from "./author/AuthorFollow.vue";
23
+ // import AuthorMsg from "./author/AuthorMsg.vue";
24
+ import AuthorGift from "./author/AuthorGift.vue";
25
+ import AuthorMedals from "./author/AuthorMedals.vue";
26
+ import AuthorTeams from "./author/AuthorTeams.vue";
27
+ import AuthorPosts from "./author/AuthorPosts.vue";
96
28
  export default {
97
29
  name: "Author",
98
30
  props: ["uid"],
99
- data: function() {
31
+ data: function () {
100
32
  return {
101
33
  data: "",
102
- tv: "",
103
- medals: [],
104
- medal_map,
105
- teams: [
106
- // {
107
- // team_name : '诗画印象',
108
- // team_logo : 'https://oss.jx3box.com/2019/09/logo.png',
109
- // team_server : "蝶恋花"
110
- // }
111
- ],
112
- isVIP: false,
113
34
  };
114
35
  },
115
- computed: {
116
- tv_type: function() {
117
- return this.data && this.data.tv_type;
118
- },
119
- tv_id: function() {
120
- return (this.data && this.data.tv_id) || 0;
121
- },
122
- tv_img: function() {
123
- return __imgPath + "image/tv/" + this.tv_type + ".png";
124
- },
125
- tv_link: function() {
126
- return tvLink(this.tv_type, this.tv_id) || "";
127
- },
128
- tv_status: function() {
129
- return (this.tv && this.tv.show_status == 1) || false;
130
- },
131
- super_author_icon: function() {
132
- return __imgPath + "image/user/" + "superauthor.svg";
133
- },
134
- hasLink: function() {
135
- return this.data.weibo_name || this.data.github_name || this.data.tuilan_id || this.data.tv_id;
136
- },
137
- hasTrophy: function() {
138
- return this.medals.length;
139
- },
140
- vipType: function() {
141
- return this.data?.is_pro ? "PRO" : "PRE";
142
- },
143
- vipTypeTitle: function() {
144
- return this.data?.is_pro ? "专业版会员" : "高级版会员";
145
- },
146
- isVip: function() {
147
- return this.data?.is_pro || this.data?.is_pre;
148
- },
149
- isSuperAuthor: function() {
150
- return this.data?.sign;
151
- },
152
- level: function() {
153
- return User.getLevel(this.data?.experience);
154
- },
155
- },
156
36
  methods: {
157
- loadData: function() {
158
- return getUserInfo(this.uid)
159
- .then((data) => {
160
- this.data = data;
161
- })
162
- .then(() => {
163
- this.loadMedals();
164
- this.loadTeams();
165
- });
166
- },
167
- loadTV: function() {
168
- if (this.tv_type == "douyu") {
169
- if (!this.tv_id || isNaN(this.tv_id)) return;
170
- getDouyu(this.tv_id).then((data) => {
171
- this.tv = data;
172
- });
173
- }
174
- },
175
- loadMedals: function() {
176
- getUserMedals(this.uid).then((data) => {
177
- this.medals = data;
178
- });
179
- },
180
- loadTeams: function() {
181
- getUserPublicTeams(this.uid).then((data) => {
182
- this.teams = data && data.slice(0, 5);
183
- });
184
- },
185
-
186
- // filters
187
- showMedalIcon: function(val) {
188
- return __imgPath + "image/medals/user/" + val + ".gif";
189
- },
190
- showMedalDesc: function(item) {
191
- return item.medal_desc || medal_map[item.medal];
37
+ installModules: function (data) {
38
+ this.data = data;
192
39
  },
193
- authorLink,
194
- weiboLink: function(val) {
195
- return "https://weibo.com/" + val;
196
- },
197
- githubLink: function(val) {
198
- return "https://github.com/" + val;
199
- },
200
- teamLink: function(team_id) {
201
- return getLink("org", team_id);
202
- },
203
- showTeamLogo: function(val) {
204
- return getThumbnail(val, 96);
205
- },
206
- showLevelColor:function (level){
207
- return __userLevelColor[level]
208
- }
209
- },
210
- watch: {
211
- uid: function() {
212
- this.loadData();
213
- },
214
- },
215
- mounted: function() {
216
- this.uid && this.loadData();
217
40
  },
218
41
  components: {
219
- Avatar,
220
- Authorposts,
221
- medal,
42
+ AuthorInfo,
43
+ AuthorLink,
222
44
  AuthorFollow,
45
+ // AuthorMsg,
46
+ AuthorGift,
47
+ AuthorMedals,
48
+ AuthorTeams,
49
+ AuthorPosts,
223
50
  },
224
51
  };
225
52
  </script>
@@ -1,45 +1,37 @@
1
1
  <template>
2
- <div class="u-follow">
3
- <!-- <template v-if="isLogin">
4
- <template v-if="isSelf">
5
- <div class="u-fans-box">
6
- <span class="u-fans-label">关注</span>
7
- <span class="u-fans">{{ formatFansNum(fansNum) }}</span>
8
- </div>
9
- </template>
10
- <template v-else>
11
-
12
- </template>
13
- </template>
14
- <el-button class="u-fans-box" @click="follow" size="mini" v-else>
15
- <span class="u-fans-label">关注</span>
16
- <span class="u-fans">{{ formatFansNum(fansNum) }}</span>
17
- </el-button> -->
2
+ <div class="c-author-follow">
18
3
  <el-button
19
4
  v-if="!isFollow"
5
+ class="u-btn"
20
6
  :class="{ 'is-follow': isFollow, 'u-fans-box': isSelf }"
21
7
  size="mini"
22
- :icon="!isSelf && btnIcon"
8
+ plain
9
+ :icon="btnIcon"
23
10
  @click="follow"
24
- :type="isSelf ? '' : btnType"
25
11
  :loading="loading"
26
12
  :disabled="isSelf"
27
13
  >
28
- {{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span>
14
+ {{ btnText }}
15
+ <!-- <span class="u-follow-count">{{ formatFansNum(fansNum) }} </span> -->
29
16
  </el-button>
30
17
  <el-popover
31
18
  v-else
32
19
  placement="bottom"
33
20
  trigger="hover"
34
- popper-class="u-follow-popover"
21
+ popper-class="c-author-follow-popover"
35
22
  :visible-arrow="false"
36
23
  >
37
24
  <div class="u-action-list">
38
- <div class="u-action-item" v-for="item in actions" :key="item.label" @click.stop="item.action">{{ item.label }}</div>
25
+ <div class="u-action-item" v-for="item in actions" :key="item.label" @click.stop="item.action">
26
+ {{ item.label }}
27
+ </div>
39
28
  </div>
40
- <el-button class="u-unfollow-btn" size="mini" :type="btnType" slot="reference">{{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span></el-button>
29
+ <el-button class="u-btn" size="mini" :type="btnType" slot="reference"
30
+ >{{ btnText }}
31
+ <!-- TODO:后续在粉丝榜中展示粉丝数 -->
32
+ <!-- <span class="u-follow-count">{{ formatFansNum(fansNum) }}</span> -->
33
+ </el-button>
41
34
  </el-popover>
42
- <el-button size="mini" icon="el-icon-message" disabled title="Lv4+可用">私信</el-button>
43
35
  </div>
44
36
  </template>
45
37
 
@@ -58,7 +50,7 @@ export default {
58
50
  return {
59
51
  isFollow: false,
60
52
  fansNum: 0,
61
- loading: false
53
+ loading: false,
62
54
  };
63
55
  },
64
56
  computed: {
@@ -66,10 +58,10 @@ export default {
66
58
  return this.isFollow ? "已关注" : "关注";
67
59
  },
68
60
  btnIcon() {
69
- return this.isSelf ? "" : (this.isFollow ? "" : "el-icon-plus");
61
+ return this.isSelf ? "" : this.isFollow ? "" : "el-icon-plus";
70
62
  },
71
63
  btnType() {
72
- return this.isFollow ? "info" : "warning"
64
+ return this.isFollow ? "info" : "warning";
73
65
  },
74
66
  actions() {
75
67
  return [
@@ -87,7 +79,7 @@ export default {
87
79
  user() {
88
80
  return User.getInfo();
89
81
  },
90
- isLogin: function() {
82
+ isLogin: function () {
91
83
  return User.isLogin();
92
84
  },
93
85
  },
@@ -97,7 +89,7 @@ export default {
97
89
  handler(val) {
98
90
  val && this.loadFans();
99
91
  },
100
- }
92
+ },
101
93
  },
102
94
  methods: {
103
95
  // 格式化粉丝数
@@ -126,10 +118,10 @@ export default {
126
118
  },
127
119
  // 取消关注
128
120
  unfollow() {
129
- this.$confirm('确定不再关注此人?', '提示', {
130
- confirmButtonText: '确定',
131
- cancelButtonText: '取消',
132
- type: 'warning'
121
+ this.$confirm("确定不再关注此人?", "提示", {
122
+ confirmButtonText: "确定",
123
+ cancelButtonText: "取消",
124
+ type: "warning",
133
125
  }).then(() => {
134
126
  unfollow(this.uid)
135
127
  .then((res) => {
@@ -151,49 +143,42 @@ export default {
151
143
  })
152
144
  .catch((err) => {
153
145
  console.log(err);
154
- }).finally(() => {
146
+ })
147
+ .finally(() => {
155
148
  this.loading = false;
156
149
  });
157
- }
150
+ },
158
151
  },
159
152
  };
160
153
  </script>
161
154
 
162
155
  <style lang="less">
163
- .u-unfollow-btn {
164
- &.el-button {
165
- margin-right: 10px;
166
- }
167
- }
168
- .u-follow-popover {
169
- &.el-popover {
170
- min-width: 100px;
171
- padding: 0;
172
- margin: 0;
173
- .u-action-list {
174
- .u-action-item {
175
- text-align: center;
176
- cursor: pointer;
177
- padding: 8px 10px;
178
- &:hover {
179
- background: rgb(248,248,251);
156
+ .c-author-follow-popover {
157
+ .u-follow-popover {
158
+ &.el-popover {
159
+ min-width: 100px;
160
+ padding: 0;
161
+ margin: 0;
162
+ .u-action-list {
163
+ .u-action-item {
164
+ text-align: center;
165
+ cursor: pointer;
166
+ padding: 8px 10px;
167
+ &:hover {
168
+ background: rgb(248, 248, 251);
169
+ }
180
170
  }
181
171
  }
182
172
  }
183
173
  }
184
- }
185
- .u-follow-count{
186
- margin-left:5px;
174
+ .u-follow-count {
175
+ margin-left: 5px;
176
+ }
187
177
  }
188
178
 
189
- .u-fans-box {
190
- cursor: default !important;
191
- .u-fans-label {
192
- color: #999;
193
- margin-right: 5px;
194
- }
195
- .u-fans {
196
- color: #333;
179
+ @media screen and (max-width: @phone) {
180
+ .el-message-box {
181
+ max-width: 60%;
197
182
  }
198
183
  }
199
184
  </style>