@jx3box/jx3box-common-ui 6.6.5 → 6.6.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.
@@ -0,0 +1,227 @@
1
+ <template>
2
+ <div class="c-game-switch">
3
+ <div class="u-current on" @click.stop="onShow">
4
+ <span>{{ currentGame.name }}</span>
5
+ </div>
6
+
7
+ <div class="c-game-list" v-show="showMore">
8
+ <a
9
+ class="u-game-item"
10
+ v-for="item in games"
11
+ :key="item.key"
12
+ :class="{ active: current === item.key, disabled: item.disabled }"
13
+ :href="itemHref(item)"
14
+ @click.stop="handleClick(item)"
15
+ >
16
+ <img class="u-img" :src="item.img" alt="" />
17
+ <span>{{ item.name }}</span>
18
+ </a>
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
25
+ export default {
26
+ name: "gameSwitch",
27
+ data() {
28
+ return {
29
+ games: [
30
+ {
31
+ name: "剑网3",
32
+ img: __imgPath + "image/xsj/jx3czb.png",
33
+ key: "jx3",
34
+ path: "https://www.jx3box.com",
35
+ disabled: false,
36
+ },
37
+ {
38
+ name: "剑网3缘起",
39
+ img: __imgPath + "image/xsj/jx3yq.png",
40
+ key: "jx3origin",
41
+ path: "https://origin.jx3box.com",
42
+ disabled: false,
43
+ },
44
+ {
45
+ name: "指尖江湖",
46
+ img: __imgPath + "image/xsj/zjjh.png",
47
+ key: "zjjh",
48
+ path: "https://zjjh.jx3box.com",
49
+ disabled: true,
50
+ },
51
+ {
52
+ name: "指尖对弈",
53
+ img: __imgPath + "image/xsj/zjdy.png",
54
+ key: "zjdy",
55
+ path: "https://zjdy.jx3box.com",
56
+ disabled: true,
57
+ },
58
+ {
59
+ name: "剑侠世界3",
60
+ img: __imgPath + "image/xsj/jxsj3.png",
61
+ key: "jxsj3",
62
+ path: "https://jxsj3.jx3box.com",
63
+ disabled: true,
64
+ },
65
+ {
66
+ name: "剑侠世界",
67
+ img: __imgPath + "image/xsj/jxsj.png",
68
+ key: "jxsj",
69
+ path: "https://jxsj.jx3box.com",
70
+ disabled: true,
71
+ },
72
+ {
73
+ name: "剑网1:归来",
74
+ img: __imgPath + "image/xsj/jx1gl.png",
75
+ key: "jx1",
76
+ path: "https://jx1.jx3box.com",
77
+ disabled: true,
78
+ },
79
+ {
80
+ name: "双生视界",
81
+ img: __imgPath + "image/xsj/sssj.png",
82
+ key: "sssj",
83
+ path: "https://sssj.jx3box.com",
84
+ disabled: true,
85
+ },
86
+ ],
87
+ current: "jx3",
88
+
89
+ showMore: false,
90
+ };
91
+ },
92
+ computed: {
93
+ currentGame() {
94
+ return this.games.find((item) => item.key == this.current);
95
+ },
96
+ },
97
+ mounted() {
98
+ const _host = window.location.host;
99
+ const _game = this.games.find((item) => item.path.indexOf(_host) > -1);
100
+ if (_game) {
101
+ this.current = _game.key;
102
+ }
103
+ this.close();
104
+ },
105
+ methods: {
106
+ handleClick(item) {
107
+ if (item.disabled) {
108
+ return;
109
+ }
110
+ this.current = item.key;
111
+ },
112
+ itemHref(item) {
113
+ if (item.disabled) {
114
+ return "javascript:;";
115
+ }
116
+ return item.path;
117
+ },
118
+ onShow() {
119
+ this.showMore = !this.showMore;
120
+ },
121
+ close() {
122
+ document.addEventListener("click", () => {
123
+ this.showMore = false;
124
+ });
125
+ },
126
+ },
127
+ };
128
+ </script>
129
+
130
+ <style lang="less">
131
+ .arrow(t,@width,@color,@x:50%) {
132
+ &:before {
133
+ bottom: 100%;
134
+ left: @x;
135
+ content: " ";
136
+ height: 0;
137
+ width: 0;
138
+ position: absolute;
139
+ pointer-events: none;
140
+ border-style: solid;
141
+ border-color: transparent;
142
+ border-bottom-color: @color;
143
+ border-width: unit(@width, px);
144
+ @margin: -@width;
145
+ margin-left: unit(@margin, px);
146
+ }
147
+ }
148
+ .c-game-switch {
149
+ .fl;
150
+ margin: 15px 0;
151
+ .mr(10px);
152
+ .pr;
153
+ .u-current {
154
+ .flex;
155
+ align-items: center;
156
+ .pointer;
157
+ .dbi;
158
+ .y(top);
159
+ font-size: 14px;
160
+ color: #fff;
161
+ padding: 5px 10px;
162
+ background-color: #7d7d7d;
163
+ border: 2px solid #303133;
164
+ border-radius: 4px;
165
+ .pr;
166
+ .z(1);
167
+ .u-img {
168
+ width: 20px;
169
+ height: 20px;
170
+ margin-right: 5px;
171
+ }
172
+
173
+ &.on {
174
+ background-color: @primary;
175
+ .pointer;
176
+ }
177
+ }
178
+ }
179
+ .c-game-list {
180
+ .arrow(t,5px,@bg-black,12%);
181
+ position: absolute;
182
+ top: calc(100% + 14px);
183
+ left: -10px;
184
+ width: 300px;
185
+ background-color: #24292e;
186
+ padding: 10px;
187
+ border: 1px solid rgba(27, 31, 35, 0.15);
188
+ border-radius: 4px;
189
+ box-shadow: 0 3px 12px rgba(27, 31, 35, 0.15);
190
+ margin-top: 6px;
191
+ display: grid;
192
+ grid-template-columns: repeat(2, 1fr);
193
+ // gap:10px;
194
+ grid-row-gap: 8px;
195
+ grid-column-gap: 10px;
196
+ .u-game-item {
197
+ .flex;
198
+ align-items: center;
199
+ padding: 6px;
200
+ .pointer;
201
+ border-radius: 4px;
202
+ color: #fff;
203
+ font-size: 14px;
204
+ .u-img {
205
+ width: 24px;
206
+ height: 24px;
207
+ margin-right: 5px;
208
+ border-radius: 4px;
209
+ }
210
+ &.active {
211
+ background-color: @primary;
212
+ color: #fff;
213
+ }
214
+ &:not(.disabled) {
215
+ &:hover {
216
+ background-color: @primary;
217
+ color: #fff;
218
+ }
219
+ }
220
+ &.disabled {
221
+ filter: grayscale(100%);
222
+ color: #c0c4cc;
223
+ cursor: not-allowed;
224
+ }
225
+ }
226
+ }
227
+ </style>
@@ -1,73 +1,163 @@
1
1
  <template>
2
2
  <div class="c-header-user" id="c-header-user">
3
3
  <template v-if="isLogin">
4
- <!-- user msg -->
4
+ <!-- 消息中心 -->
5
5
  <div class="c-header-msg" id="c-header-msg">
6
- <el-tooltip effect="dark" content="我的消息" placement="bottom">
6
+ <el-tooltip effect="dark" content="消息中心" placement="bottom">
7
7
  <a class="u-msg" :href="url.msg">
8
8
  <i class="u-icon u-icon-msg">
9
9
  <i class="u-pop" style="display: none" v-show="pop"></i>
10
- <img svg-inline src="../../assets/img/header/msg.svg" />
10
+ <img svg-inline src="../../assets/img/header/bell.svg" />
11
11
  </i>
12
12
  </a>
13
13
  </el-tooltip>
14
14
  </div>
15
15
 
16
- <!-- user panel -->
16
+ <!-- 创作中心 -->
17
17
  <div class="c-header-panel" id="c-header-panel">
18
- <el-tooltip effect="dark" content="发布中心" placement="bottom">
18
+ <el-tooltip effect="dark" content="创作中心" placement="bottom">
19
19
  <a class="u-post" :href="url.publish">
20
- <img class="u-add" svg-inline src="../../assets/img/header/add.svg" />
20
+ <img class="u-add" svg-inline src="../../assets/img/header/edit.svg" />
21
21
  </a>
22
22
  </el-tooltip>
23
23
  </div>
24
24
 
25
+ <!-- 我的资产 -->
26
+ <div class="c-header-panel c-header-assets" @mouseenter="onAssetsHover" @mouseleave="onAssetsBlur">
27
+ <a class="u-asset" href="/dashboard/boxcoin">
28
+ <img class="u-coin" svg-inline src="../../assets/img/header/coin.svg" />
29
+ </a>
30
+
31
+ <div class="u-assets" v-show="showAssets">
32
+ <div class="u-detail">
33
+ <span class="u-item">
34
+ <!-- <span class="u-item-primary>" -->
35
+ <span class="u-label"><i class="el-icon-user"></i> 等级</span>
36
+ <span class="u-value">Lv.{{ level }}</span>
37
+ <!-- </span> -->
38
+ <!-- <span class="u-item-extend"><a href="/notice/28917" target="_blank">[权益]</a></span> -->
39
+ </span>
40
+ <span class="u-item">
41
+ <span class="u-item-primary"
42
+ ><span class="u-label"><i class="el-icon-coin"></i> 盒币</span>
43
+ <span class="u-value">{{ asset.box_coin }}</span></span
44
+ >
45
+ <span class="u-item-extend"
46
+ ><a href="/dashboard/boxcoin" target="_blank">[兑换通宝]</a></span
47
+ >
48
+ </span>
49
+ <span class="u-item">
50
+ <span class="u-item-primary"
51
+ ><span class="u-label"><i class="el-icon-wallet"></i> 金箔</span
52
+ ><span class="u-value">{{ asset.cny }}</span></span
53
+ >
54
+ <span class="u-item-extend"
55
+ ><a href="/vip/cny" target="_blank">[充值]</a>
56
+ <a href="/dashboard/cny" target="_blank">[提现]</a></span
57
+ >
58
+ </span>
59
+ <span class="u-item">
60
+ <span class="u-item-primary"
61
+ ><span class="u-label"><i class="el-icon-sugar"></i> 银铛</span>
62
+ <span class="u-value">{{ asset.points }}</span></span
63
+ >
64
+ <span class="u-item-extend"
65
+ ><a href="/vip/mall" target="_blank">[兑礼]</a
66
+ ><a href="/vip/lottery" target="_blank">[抽奖]</a></span
67
+ >
68
+ </span>
69
+ <span class="u-item">
70
+ <span class="u-item-primary"
71
+ ><span class="u-label"><i class="el-icon-bank-card"></i> 卡密</span>
72
+ <span class="u-value">{{ asset.ext_info ? asset.ext_info.keycode : 0 }}</span></span
73
+ >
74
+ <span class="u-item-extend"><a href="/dashboard/card" target="_blank">[查看]</a></span>
75
+ </span>
76
+ </div>
77
+ </div>
78
+ </div>
79
+
80
+ <!-- vip -->
81
+ <div class="c-header-panel" id="c-header-vip">
82
+ <el-tooltip effect="dark" content="会员中心" placement="bottom">
83
+ <a class="u-post" href="/vip/premium">
84
+ <img class="u-add" svg-inline src="../../assets/img/header/vip.svg" />
85
+ </a>
86
+ </el-tooltip>
87
+ </div>
88
+
89
+ <!-- manage -->
90
+ <div
91
+ class="c-header-panel c-header-manage"
92
+ id="c-header-manage"
93
+ v-if="isEditor"
94
+ @mouseenter="showManage = true"
95
+ @mouseleave="showManage = false"
96
+ >
97
+ <span class="u-post">
98
+ <img class="u-add" svg-inline src="../../assets/img/header/manage.svg" />
99
+ </span>
100
+ <ul class="u-menu" v-show="showManage">
101
+ <li v-if="isAdmin">
102
+ <a href="/admin">站点配置</a>
103
+ </li>
104
+ <li v-if="isEditor">
105
+ <a href="https://os.jx3box.com/admin">管理平台</a>
106
+ </li>
107
+ </ul>
108
+ </div>
109
+
25
110
  <!-- user info -->
26
111
  <div class="c-header-info">
27
112
  <div class="c-header-profile" id="c-header-profile" @click="showmenu">
28
113
  <img class="u-avatar" :src="user.avatar" />
29
- <span class="u-dropdown"></span>
30
- <ul class="u-menu" v-show="!fold">
31
- <li>
32
- <a class="u-me" :href="url.homepage">
33
- <b>{{ showUserName(user.name) }}</b>
34
- <img
35
- v-if="isSuperAuthor"
36
- :src="super_author_icon"
37
- class="u-superauthor-profile"
38
- alt="superauthor"
39
- title="签约作者"
40
- />
41
- <em>(UID : {{ user.uid }})</em>
42
- </a>
43
- </li>
44
- <li>
45
- <a class="u-vip" href="/vip/premium?from=header_usermenu" target="_blank">
46
- <i class="i-icon-vip" :class="{ on: isVIP || isPRO }">{{ vipType }}</i>
47
- <span class="u-vip-type">
48
- <template v-if="isVIP || isPRO">
49
- {{ vipTypeTxt }}
50
- <span class="u-vip-left">({{ vipLeftDays }}天)</span>
51
- </template>
52
- <template v-else>升级账号类型</template>
53
- </span>
54
- <!-- <span class="u-expire" v-if="expire_date">(有效期至:{{expire_date}})</span> -->
55
- </a>
56
- </li>
57
- <hr />
58
- <template v-for="(item, i) in panel">
59
- <li :key="'panel-' + i" v-if="isEditor || !item.onlyAdmin">
60
- <a :href="item.link">{{ item.label }}</a>
61
- </li>
62
- </template>
63
- <hr />
64
- <li>
65
- <a :href="url.profile">设置</a>
66
- </li>
67
- <li>
68
- <a @click="logout()">登出</a>
69
- </li>
70
- </ul>
114
+ <div class="m-info" v-show="!fold">
115
+ <div class="u-profile">
116
+ <b :title="user.name">{{ showUserName(user.name) }}</b>
117
+ <div class="u-id">
118
+ <span>魔盒UID:{{ user.uid }}</span>
119
+ <i class="el-icon-document-copy u-copy" @click.stop="copyText(user.uid)"></i>
120
+ </div>
121
+ <div class="m-vip">
122
+ <a href="/dashboard/cooperation">
123
+ <img
124
+ :src="super_author_icon"
125
+ class="u-superauthor-profile"
126
+ alt="superauthor"
127
+ title="签约作者"
128
+ :class="{ off: !isSuperAuthor }"
129
+ /></a>
130
+
131
+ <a
132
+ class="u-vip"
133
+ href="/vip/premium?from=header_usermenu"
134
+ target="_blank"
135
+ title="专业版"
136
+ >
137
+ <i class="i-icon-vip" :class="{ on: isPRO }">{{ vipType }}</i>
138
+ </a>
139
+ </div>
140
+ </div>
141
+
142
+ <el-button-group class="u-actions">
143
+ <a class="el-button el-button--default" :href="url.profile">资料设置</a>
144
+ <a class="el-button el-button--default" :href="url.homepage">个人主页</a>
145
+ <a class="el-button el-button--default" href="/dashboard/frame">主题风格</a>
146
+ </el-button-group>
147
+
148
+ <div class="m-other">
149
+ <a href="/dashboard/fav" class="u-item"> 我的收藏 </a>
150
+ <a href="/team/role/manage" class="u-item"> 我的角色 </a>
151
+ <a href="/dashboard/purchases" class="u-item"> 付费购买的资源 </a>
152
+ <a href="/vip/mall" class="u-item"> 积分商城兑好礼 </a>
153
+ <hr />
154
+ <a href="/dashboard/feedback" class="u-item"> 反馈中心 </a>
155
+ <hr />
156
+ <div class="u-logout">
157
+ <el-button @click="logout">退出登录</el-button>
158
+ </div>
159
+ </div>
160
+ </div>
71
161
  </div>
72
162
  </div>
73
163
  </template>
@@ -90,6 +180,7 @@ import { getMsg, getMenu } from "../../service/header";
90
180
  import { getMyInfo, userSignIn } from "../../service/author";
91
181
  import dayjs from "dayjs";
92
182
  import isToday from "dayjs/plugin/isToday";
183
+ import { copyText } from "../../assets/js/utils";
93
184
  dayjs.extend(isToday);
94
185
  export default {
95
186
  props: [],
@@ -126,6 +217,12 @@ export default {
126
217
  was_pro: 0,
127
218
  },
128
219
 
220
+ // assets
221
+ showAssets: false,
222
+
223
+ // manage
224
+ showManage: false,
225
+
129
226
  // 链接
130
227
  login_url: __Links.account.login + "?redirect=" + location.href,
131
228
  register_url: __Links.account.register + "?redirect=" + location.href,
@@ -140,7 +237,7 @@ export default {
140
237
  return User._isPRO(this.asset) || false;
141
238
  },
142
239
  vipType: function () {
143
- return this.isPRO ? "PRO" : "PRE";
240
+ return "PRO";
144
241
  },
145
242
  vipTypeTxt: function () {
146
243
  return this.isPRO ? "专业版" : "高级版";
@@ -169,6 +266,9 @@ export default {
169
266
  siteRoot: function () {
170
267
  return location.host.includes("origin") ? __OriginRoot : __Root;
171
268
  },
269
+ level: function () {
270
+ return User.getLevel(this.asset.experience);
271
+ },
172
272
  },
173
273
  watch: {
174
274
  fold(val) {
@@ -237,24 +337,30 @@ export default {
237
337
  if (user_last_login && dayjs(user_last_login).isToday()) {
238
338
  console.log("已签到");
239
339
  } else {
240
- userSignIn()
241
- .then((res) => {
242
- let msg = this.$message({
243
- type: "success",
244
- message: "签到成功",
245
- customClass: "c-header-signin",
246
- duration: 0,
340
+ // 延迟2秒执行 feedback#501
341
+ const signTimer = setTimeout(() => {
342
+ userSignIn()
343
+ .then((res) => {
344
+ let msg = this.$message({
345
+ type: "success",
346
+ message: "签到成功",
347
+ customClass: "c-header-signin",
348
+ duration: 0,
349
+ });
350
+ // 模拟手动关闭
351
+ setTimeout(() => {
352
+ msg.close();
353
+ }, 3000);
354
+ localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
355
+ })
356
+ .catch((err) => {
357
+ localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
358
+ console.log(dayjs.tz.guess());
359
+ })
360
+ .finally(() => {
361
+ clearTimeout(signTimer);
247
362
  });
248
- // 模拟手动关闭
249
- setTimeout(() => {
250
- msg.close();
251
- }, 3000);
252
- localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
253
- })
254
- .catch((err) => {
255
- localStorage.setItem("user_last_login", JSON.stringify(dayjs()));
256
- console.log(dayjs.tz.guess());
257
- })
363
+ }, 2000);
258
364
  }
259
365
  } catch (e) {
260
366
  console.log(e);
@@ -272,6 +378,13 @@ export default {
272
378
  this.isSuperAuthor = !!res.sign;
273
379
  });
274
380
  },
381
+ onAssetsHover: function () {
382
+ this.showAssets = true;
383
+ },
384
+ onAssetsBlur: function () {
385
+ this.showAssets = false;
386
+ },
387
+ copyText,
275
388
 
276
389
  // 初始化
277
390
  init: function () {