@jx3box/jx3box-common-ui 5.5.26 → 5.5.29

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.
@@ -36,10 +36,10 @@
36
36
  display: flex;
37
37
  }
38
38
  .u-level {
39
- padding: 2px 15px;
39
+ padding: 2px 8px;
40
40
  .fz(12px, 14px);
41
41
  color: #fff;
42
- background-color: #aad2fd;
42
+ background-color: #f39;
43
43
  border-radius: 2px;
44
44
  }
45
45
  .u-vip {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "5.5.26",
3
+ "version": "5.5.29",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.6.8",
34
- "@jx3box/jx3box-common": "^7.0.21",
34
+ "@jx3box/jx3box-common": "^7.0.24",
35
35
  "@jx3box/jx3box-data": "^1.8.6",
36
36
  "@jx3box/jx3box-editor": "^1.2.6",
37
37
  "axios": "^0.26.1",
package/service/author.js CHANGED
@@ -22,7 +22,7 @@ function getUserPosts(uid) {
22
22
  return $cms({ mute: true })
23
23
  .get(`/api/cms/posts/user/${uid}/latest`)
24
24
  .then((res) => {
25
- return res.data.data;
25
+ return res.data.data.list || [];
26
26
  });
27
27
  }
28
28
 
package/service/fav.js CHANGED
@@ -1,44 +1,61 @@
1
- import qs from "qs";
2
- import { $helper } from "@jx3box/jx3box-common/js/https.js";
1
+ // import qs from "qs";
2
+ // import { $helper } from "@jx3box/jx3box-common/js/https.js";
3
+
4
+ // function hasFav(post_type, post_id) {
5
+ // if (post_type && post_id) {
6
+ // return $helper({ popType: "notify" }).get(
7
+ // `/api/post/favorite/favorited`,
8
+ // {
9
+ // params: {
10
+ // post_type: post_type,
11
+ // post_id: post_id,
12
+ // },
13
+ // }
14
+ // );
15
+ // } else return null;
16
+ // }
17
+
18
+ // function addFav(post_type, post_id) {
19
+ // if (post_type && post_id) {
20
+ // return $helper({ popType: "notify" }).post(
21
+ // `/api/post/favorite`,
22
+ // qs.stringify({
23
+ // post_type: post_type,
24
+ // post_id: post_id,
25
+ // cancel: 0,
26
+ // })
27
+ // );
28
+ // } else return null;
29
+ // }
30
+
31
+ // function delFav(post_type, post_id) {
32
+ // if (post_type && post_id) {
33
+ // return $helper({ popType: "notify" }).post(
34
+ // `/api/post/favorite`,
35
+ // qs.stringify({
36
+ // post_type: post_type,
37
+ // post_id: post_id,
38
+ // cancel: 1,
39
+ // })
40
+ // );
41
+ // } else return null;
42
+ // }
43
+
44
+ // export { hasFav, addFav, delFav };
45
+ import { $next } from "@jx3box/jx3box-common/js/https.js";
46
+ const $n = $next();
3
47
 
4
48
  function hasFav(post_type, post_id) {
5
- if (post_type && post_id) {
6
- return $helper({ popType: "notify" }).get(
7
- `/api/post/favorite/favorited`,
8
- {
9
- params: {
10
- post_type: post_type,
11
- post_id: post_id,
12
- },
13
- }
14
- );
15
- } else return null;
49
+ return $n.get(`api/article/favorites/is-my/${post_id}/${post_type}`).then((res) => {
50
+ return res.data.data;
51
+ });
16
52
  }
17
-
18
- function addFav(post_type, post_id) {
19
- if (post_type && post_id) {
20
- return $helper({ popType: "notify" }).post(
21
- `/api/post/favorite`,
22
- qs.stringify({
23
- post_type: post_type,
24
- post_id: post_id,
25
- cancel: 0,
26
- })
27
- );
28
- } else return null;
53
+ function addFav(post_type, post_id, post_title) {
54
+ return $n.post(`api/article/favorites/add/${post_id}/${post_type}`, { post_title }).then((res) => {
55
+ return res.data.data;
56
+ });
29
57
  }
30
-
31
- function delFav(post_type, post_id) {
32
- if (post_type && post_id) {
33
- return $helper({ popType: "notify" }).post(
34
- `/api/post/favorite`,
35
- qs.stringify({
36
- post_type: post_type,
37
- post_id: post_id,
38
- cancel: 1,
39
- })
40
- );
41
- } else return null;
58
+ function delFav(id) {
59
+ return $n.delete(`api/article/favorites/my/${id}`);
42
60
  }
43
-
44
61
  export { hasFav, addFav, delFav };
package/src/App.vue CHANGED
@@ -41,15 +41,15 @@
41
41
  <UserPop title="添加用户" v-model="visible" @confirm="addUser" />
42
42
  <el-button @click="visible = true">用户POP</el-button>
43
43
 
44
- <Thx :postId="23865" postType="bbs" :userId="7" :adminBoxcoinEnable="true" :userBoxcoinEnable="true" />
44
+ <Thx :postId="23865" postType="bbs" postTitle="bbs23865的标题" :userId="7" :adminBoxcoinEnable="true" :userBoxcoinEnable="true" />
45
45
 
46
46
  <hr />
47
47
 
48
48
  <Like mode="heart" :count="100" :showCount="true" />
49
49
  <Down :count="100" :showCount="true" />
50
50
  <Mark label="KEY" value="VALUE" BGL="#000" BGR="#F39" />
51
- <Fav post-id="90" post-type="jx3dat" />
52
- <Feed post-id="90" post-type="jx3dat" />
51
+ <Fav post-id="90" post-type="jx3dat" post-title="jx3dat测试标题" />
52
+ <Feed post-id="90" post-type="jx3dat"/>
53
53
  <Print title="传入标题" />
54
54
  <QRcode />
55
55
  <Sharing />
@@ -1,19 +1,18 @@
1
1
  <template>
2
- <div class="c-authorposts">
2
+ <div class="c-authorposts" v-if="uid">
3
3
  <div class="u-label">
4
4
  <i class="el-icon-notebook-2"></i>
5
5
  <span>作者最新作品</span>
6
- <a :href="id | authorLink" class="u-more" target="_blank">全部 &raquo;</a>
6
+ <a :href="uid | authorLink" class="u-more" target="_blank">全部 &raquo;</a>
7
7
  </div>
8
-
8
+
9
9
  <ul v-if="data && data.length">
10
10
  <li v-for="(item, i) in data" :key="i">
11
- <a
12
- class="u-item"
13
- :href="url(item.ID, item.post_type)"
14
- target="_blank"
15
- >
16
- <span><i class="u-icon el-icon-reading"></i> {{ item.post_title || item.post_type + '/无标题' }}</span>
11
+ <a class="u-item" :href="url(item.ID, item.post_type)" target="_blank">
12
+ <span
13
+ ><i class="u-icon el-icon-reading"></i>
14
+ {{ item.post_title || item.post_type + "/无标题" }}</span
15
+ >
17
16
  </a>
18
17
  </li>
19
18
  </ul>
@@ -22,42 +21,40 @@
22
21
 
23
22
  <script>
24
23
  import { getUserPosts } from "../../service/author";
25
- import {authorLink,getLink} from '@jx3box/jx3box-common/js/utils'
24
+ import { authorLink, getLink } from "@jx3box/jx3box-common/js/utils";
26
25
  export default {
27
26
  name: "Authorposts",
28
27
  props: ["uid"],
29
28
  data: function() {
30
29
  return {
31
30
  data: [],
32
- id : this.uid || 0,
33
31
  };
34
32
  },
35
- computed : {
36
- },
37
- watch : {
38
- uid : function (newid){
39
- this.id = newid
40
- this.init()
41
- }
33
+ computed: {},
34
+ watch: {
35
+ uid: {
36
+ immediate: true,
37
+ handler: function(user_id) {
38
+ if (user_id) this.init();
39
+ },
40
+ },
42
41
  },
43
42
  methods: {
44
43
  url: function(pid, type) {
45
- return getLink(type,pid)
44
+ return getLink(type, pid);
45
+ },
46
+ init: function() {
47
+ getUserPosts(this.uid)
48
+ .then((data) => {
49
+ this.data = data.slice(0, 5);
50
+ })
51
+ .catch((err) => {
52
+ console.log(err);
53
+ });
46
54
  },
47
- init : function (){
48
- if (!this.id) return;
49
- getUserPosts(this.id).then((data) => {
50
- this.data = data.slice(0, 5);
51
- }).catch((err) => {
52
- console.log(err)
53
- })
54
- }
55
- },
56
- filters : {
57
- authorLink
58
55
  },
59
- mounted: function() {
60
- this.init()
56
+ filters: {
57
+ authorLink,
61
58
  },
62
59
  };
63
60
  </script>
@@ -1,9 +1,7 @@
1
1
  <template>
2
2
  <el-button class="w-fav" size="mini" type="primary" @click="doFav">
3
- <i v-if="!favorited" class="el-icon-star-off"></i>
4
- <i v-else class="el-icon-star-on"></i>
5
- <span v-if="!favorited">收藏</span>
6
- <span v-else>取消收藏</span>
3
+ <i :class="favorite ? 'el-icon-star-on' : 'el-icon-star-off'"></i>
4
+ <span>{{ favorite ? "取消收藏" : "收藏" }}</span>
7
5
  </el-button>
8
6
  </template>
9
7
 
@@ -12,63 +10,41 @@ import User from "@jx3box/jx3box-common/js/user";
12
10
  import { hasFav, addFav, delFav } from "../../service/fav";
13
11
  export default {
14
12
  name: "Fav",
15
- props: ["postType", "postId"],
16
- data: function() {
13
+ props: ["postType", "postId", "postTitle"],
14
+ data: function () {
17
15
  return {
18
16
  login: User.isLogin(),
19
- favorited: false,
17
+ favorite: false,
20
18
  };
21
19
  },
22
20
  methods: {
23
- doFav: function() {
21
+ doFav: function () {
24
22
  if (this.login) {
25
- this.favorited ? this.delFav() : this.addFav();
23
+ this.favorite ? this.delFav() : this.addFav();
26
24
  } else {
27
25
  User.toLogin();
28
26
  }
29
27
  },
30
- hasFav: function() {
31
- hasFav(this.postType, this.postId).then(
32
- (data) => {
33
- data = data.data;
34
- this.favorited = data.code === 200 && data.data.favorited > 0;
35
- },
36
- (err) => {
37
- this.fail(err);
38
- }
39
- );
28
+ hasFav: function () {
29
+ hasFav(this.postType, this.postId).then((res) => {
30
+ this.favorite = res.id || false;
31
+ });
40
32
  },
41
- addFav: function() {
42
- addFav(this.postType, this.postId).then(
43
- (data) => {
44
- if (data.data.code === 200) {
45
- this.favorited = true;
46
- } else this.fail(data.data.message);
47
- },
48
- (err) => {
49
- this.fail(err);
50
- }
51
- );
33
+ addFav: function () {
34
+ addFav(this.postType, this.postId, this.postTitle).then((res) => {
35
+ this.favorite = res.id;
36
+ });
52
37
  },
53
- delFav: function() {
54
- delFav(this.postType, this.postId).then(
55
- (data) => {
56
- if (data.data.code === 200) {
57
- this.favorited = false;
58
- } else this.fail(data.data.message);
59
- },
60
- (err) => {
61
- this.fail(err);
62
- }
63
- );
38
+ delFav: function () {
39
+ delFav(this.favorite).then(() => {
40
+ this.favorite = false;
41
+ });
64
42
  },
65
- fail: function(err) {
43
+ fail: function (err) {
66
44
  if (err.response && err.response.data && err.response.data.code) {
67
- this.$message.error(
68
- `[${err.response.data.code}] ${err.response.data.msg}`
69
- );
45
+ this.$message.error(`[${err.response.data.code}] ${err.response.data.msg}`);
70
46
  } else {
71
- this.$message.error(typeof err === 'string' ? err : "网络请求异常");
47
+ this.$message.error(typeof err === "string" ? err : "网络请求异常");
72
48
  }
73
49
  console.log(err);
74
50
  },
@@ -78,8 +54,8 @@ export default {
78
54
  immediate: true,
79
55
  handler() {
80
56
  if (this.login && this.postType && this.postId) this.hasFav();
81
- }
82
- }
57
+ },
58
+ },
83
59
  },
84
60
  };
85
61
  </script>
@@ -1,126 +1,89 @@
1
- <template>
2
- <div class="w-fav2" :class="{ disabled:favorited }" @click="doFav">
3
- <el-tooltip effect="dark" :content="favContent" placement="top-start">
4
- <div>
5
- <img class="u-icon" svg-inline src="../../assets/img/widget/star.svg" />
6
- <span class="u-count" v-if="total">{{ total }}</span>
7
- </div>
8
- </el-tooltip>
9
- </div>
10
- </template>
11
-
12
- <script>
13
- import User from "@jx3box/jx3box-common/js/user";
14
- import { hasFav, addFav, delFav } from "../../service/fav";
15
- export default {
16
- name: "Fav2",
17
- props: ["postType", "postId"],
18
- data: function () {
19
- return {
20
- login: User.isLogin(),
21
- favorited: false,
22
- total: 0,
23
- };
24
- },
25
- computed: {
26
- favContent() {
27
- return this.favorited ? "取消收藏" : "收藏";
28
- },
29
- },
30
- methods: {
31
- doFav: function () {
32
- if (this.login) {
33
- this.favorited ? this.delFav() : this.addFav();
34
- } else {
35
- User.toLogin();
36
- }
37
- },
38
- hasFav: function () {
39
- hasFav(this.postType, this.postId).then(
40
- (data) => {
41
- data = data.data;
42
- this.favorited =
43
- data.code === 200 && data.data.favorited > 0;
44
- this.total = data.data?.total || 0;
45
- },
46
- (err) => {
47
- this.fail(err);
48
- }
49
- );
50
- },
51
- addFav: function () {
52
- addFav(this.postType, this.postId).then(
53
- (data) => {
54
- if (data.data.code === 200) {
55
- this.favorited = true;
56
- this.total++;
57
- } else {
58
- this.fail(data.data.message);
59
- }
60
- },
61
- (err) => {
62
- this.fail(err);
63
- }
64
- );
65
- },
66
- delFav: function () {
67
- delFav(this.postType, this.postId).then(
68
- (data) => {
69
- if (data.data.code === 200) {
70
- this.favorited = false;
71
- this.total--;
72
- } else {
73
- this.fail(data.data.message);
74
- }
75
- },
76
- (err) => {
77
- this.fail(err);
78
- }
79
- );
80
- },
81
- fail: function (err) {
82
- if (err.response && err.response.data && err.response.data.code) {
83
- this.$message.error(
84
- `[${err.response.data.code}] ${err.response.data.msg}`
85
- );
86
- } else {
87
- this.$message.error(
88
- typeof err === "string" ? err : "网络请求异常"
89
- );
90
- }
91
- console.log(err);
92
- },
93
- },
94
- watch: {
95
- postId: {
96
- immediate: true,
97
- handler() {
98
- if (this.postType && this.postId) this.hasFav();
99
- },
100
- },
101
- },
102
- };
103
- </script>
104
-
105
- <style lang="less" scoped>
106
- .w-fav2 {
107
- .pointer;
108
- .dbi;
109
- .u-icon {
110
- .size(32px);
111
- .y;
112
- .pr;
113
- top: -1px;
114
- }
115
- .u-count {
116
- color: #888;
117
- .ml(10px);
118
- }
119
-
120
- &.disabled {
121
- svg * {
122
- fill: #aaa;
123
- }
124
- }
125
- }
126
- </style>
1
+ <template>
2
+ <div class="w-fav2" :class="{ disabled: favorite }" @click="doFav">
3
+ <el-tooltip effect="dark" :content="favContent" placement="top-start">
4
+ <div>
5
+ <img class="u-icon" svg-inline src="../../assets/img/widget/star.svg" />
6
+ <span class="u-count" v-if="total">{{ total }}</span>
7
+ </div>
8
+ </el-tooltip>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import User from "@jx3box/jx3box-common/js/user";
14
+ import { hasFav, addFav, delFav } from "../../service/fav";
15
+ export default {
16
+ name: "Fav2",
17
+ props: ["postType", "postId", "postTitle"],
18
+ data: function () {
19
+ return {
20
+ login: User.isLogin(),
21
+ favorite: false,
22
+ total: 0,
23
+ };
24
+ },
25
+ computed: {
26
+ favContent() {
27
+ return this.favorite ? "取消收藏" : "收藏";
28
+ },
29
+ },
30
+ methods: {
31
+ doFav: function () {
32
+ if (this.login) {
33
+ this.favorite ? this.delFav() : this.addFav();
34
+ } else {
35
+ User.toLogin();
36
+ }
37
+ },
38
+ hasFav: function () {
39
+ hasFav(this.postType, this.postId).then((res) => {
40
+ this.favorite = res.id || false;
41
+ this.total = res.totalFavorites || 0;
42
+ });
43
+ },
44
+ addFav: function () {
45
+ addFav(this.postType, this.postId, this.postTitle).then((res) => {
46
+ this.favorite = res.id;
47
+ this.total++;
48
+ });
49
+ },
50
+ delFav: function () {
51
+ delFav(this.favorite).then(() => {
52
+ this.favorite = false;
53
+ this.total && this.total--;
54
+ });
55
+ },
56
+ },
57
+ watch: {
58
+ postId: {
59
+ immediate: true,
60
+ handler() {
61
+ if (this.postType && this.postId) this.hasFav();
62
+ },
63
+ },
64
+ },
65
+ };
66
+ </script>
67
+
68
+ <style lang="less" scoped>
69
+ .w-fav2 {
70
+ .pointer;
71
+ .dbi;
72
+ .u-icon {
73
+ .size(32px);
74
+ .y;
75
+ .pr;
76
+ top: -1px;
77
+ }
78
+ .u-count {
79
+ color: #888;
80
+ .ml(10px);
81
+ }
82
+
83
+ &.disabled {
84
+ svg * {
85
+ fill: #aaa;
86
+ }
87
+ }
88
+ }
89
+ </style>
@@ -81,7 +81,7 @@ export default {
81
81
  return this.left && this.left >= this.count;
82
82
  },
83
83
  allowBoxcoin : function (){
84
- return this.postType && this.postId && this.userId
84
+ return this.postType && this.postId && (this.userId || (this.authors && this.authors.length))
85
85
  },
86
86
  client : function (){
87
87
  return location.href.includes('origin') ? 'origin' : 'std'
@@ -80,7 +80,7 @@ export default {
80
80
  return this.left && this.left >= this.count;
81
81
  },
82
82
  allowBoxcoin : function (){
83
- return this.postType && this.postId && this.userId
83
+ return this.postType && this.postId && (this.userId || (this.authors && this.authors.length))
84
84
  },
85
85
  client : function (){
86
86
  return location.href.includes('origin') ? 'origin' : 'std'
@@ -152,4 +152,4 @@ export default {
152
152
  .ml(10px);
153
153
  }
154
154
  }
155
- </style>
155
+ </style>
@@ -3,7 +3,7 @@
3
3
  <div class="w-thx-panel">
4
4
  <boxcoin-admin :postId="postId" :postType="postType" v-if="hasRight && adminBoxcoinEnable && boxcoin_enable" :userId="userId" :own="admin_left" :points="admin_points" :authors="authors" @updateRecord="updateRecord" />
5
5
  <Like :postId="postId" :postType="postType"></Like>
6
- <fav :postId="postId" :postType="postType"></fav>
6
+ <fav :postId="postId" :postType="postType" :postTitle="postTitle"></fav>
7
7
  <boxcoin-user :postId="postId" :postType="postType" :boxcoin="boxcoin" :userId="userId" :own="user_left" :points="user_points" :authors="authors" v-if="userBoxcoinEnable && boxcoin_enable" @updateRecord="updateRecord" />
8
8
  <Share :postId="postId" :postType="postType" />
9
9
  </div>
@@ -28,7 +28,7 @@ import User from '@jx3box/jx3box-common/js/user'
28
28
  import {getPostBoxcoinConfig,getBoxcoinStatus} from '../../service/thx'
29
29
  export default {
30
30
  name: "Thx",
31
- props: ["postId", "postType","userId","adminBoxcoinEnable","userBoxcoinEnable",'mode', 'authors'],
31
+ props: ["postId", "postType", "postTitle", "userId","adminBoxcoinEnable","userBoxcoinEnable",'mode', 'authors'],
32
32
  components: {
33
33
  Like,
34
34
  Share,
package/vue.config.js CHANGED
@@ -39,8 +39,7 @@ module.exports = {
39
39
  },
40
40
  },
41
41
  "/api/team": {
42
- target: "http://gray.team.api.jx3box.com",
43
- // "target": "https://team.api.jx3box.com",
42
+ "target": "https://team.api.jx3box.com",
44
43
  onProxyReq: function(request) {
45
44
  request.setHeader("origin", "");
46
45
  },
@@ -48,6 +47,9 @@ module.exports = {
48
47
  "/api/cms": {
49
48
  target: process.env["DEV_SERVER"] == "true" ? "http://localhost:5120" : "https://cms.jx3box.com",
50
49
  },
50
+ "/api/article": {
51
+ target: "https://next2.jx3box.com",
52
+ },
51
53
  "/api/messages": {
52
54
  target: "https://helper.jx3box.com",
53
55
  },
@@ -64,7 +66,7 @@ module.exports = {
64
66
  },
65
67
  },
66
68
  "/api": {
67
- target: "https://next.jx3box.com",
69
+ target: "https://next2.jx3box.com",
68
70
  onProxyReq: function(request) {
69
71
  request.setHeader("origin", "");
70
72
  },