@jx3box/jx3box-common-ui 6.1.1 → 6.1.4
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 +3 -3
- package/src/interact/Like2.vue +69 -62
- package/src/single/PostHeader.vue +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-common-ui",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.4",
|
|
4
4
|
"description": "JX3BOX UI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"last 2 versions"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@jx3box/jx3box-comment-ui": "^1.7.
|
|
33
|
+
"@jx3box/jx3box-comment-ui": "^1.7.1",
|
|
34
34
|
"@jx3box/jx3box-common": "^7.4.0",
|
|
35
|
-
"@jx3box/jx3box-data": "^1.
|
|
35
|
+
"@jx3box/jx3box-data": "^1.11.1",
|
|
36
36
|
"@jx3box/jx3box-editor": "^1.4.8",
|
|
37
37
|
"axios": "^0.26.1",
|
|
38
38
|
"dayjs": "^1.11.0",
|
package/src/interact/Like2.vue
CHANGED
|
@@ -1,62 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: iRuxu
|
|
3
|
+
* @Date: 2022-04-29 22:34:07
|
|
4
|
+
* @LastEditTime: 2022-07-24 16:51:43
|
|
5
|
+
* @Description:
|
|
6
|
+
-->
|
|
7
|
+
<template>
|
|
8
|
+
<div class="w-like2" :class="{ disabled:!status }" @click="addLike" v-if="ready">
|
|
9
|
+
<el-tooltip effect="dark" content="点赞" placement="top-start">
|
|
10
|
+
<div>
|
|
11
|
+
<img
|
|
12
|
+
class="u-icon"
|
|
13
|
+
svg-inline
|
|
14
|
+
src="../../assets/img/widget/like2.svg"
|
|
15
|
+
/>
|
|
16
|
+
<span class="u-count" v-if="count">{{ count }}</span>
|
|
17
|
+
</div>
|
|
18
|
+
</el-tooltip>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { postStat, getStat } from "@jx3box/jx3box-common/js/stat";
|
|
24
|
+
import { getRewrite } from "@jx3box/jx3box-common/js/utils";
|
|
25
|
+
import _ from "lodash";
|
|
26
|
+
export default {
|
|
27
|
+
name: "Like2",
|
|
28
|
+
props: ["postType", "postId"],
|
|
29
|
+
data: function () {
|
|
30
|
+
return {
|
|
31
|
+
status: true,
|
|
32
|
+
count: 0,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
ready() {
|
|
37
|
+
return this.postType && this.postId;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
init: function () {
|
|
42
|
+
this.loadStat();
|
|
43
|
+
},
|
|
44
|
+
loadStat: function () {
|
|
45
|
+
getStat(this.postType, this.postId).then((res) => {
|
|
46
|
+
this.count = res.data.likes || 0;
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
// 点赞
|
|
50
|
+
addLike: function () {
|
|
51
|
+
if (!this.ready) return;
|
|
52
|
+
this.count++;
|
|
53
|
+
if (this.status) {
|
|
54
|
+
postStat(this.postType, this.postId, "likes");
|
|
55
|
+
}
|
|
56
|
+
this.status = false;
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
watch : {
|
|
60
|
+
postId : function (val){
|
|
61
|
+
this.init();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style lang="less">
|
|
68
|
+
@import "../../assets/css/like2.less";
|
|
69
|
+
</style>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<span class="u-title u-sub-block" :href="url" :title="title">
|
|
6
6
|
<i class="u-original" v-if="isOriginal">原创</i>
|
|
7
7
|
<i class="u-private" v-if="post.post_status != 'publish'">
|
|
8
|
-
<i class="el-icon-lock" v-if="post.post_status == 'draft' || post.post_status == 'pending' ||
|
|
8
|
+
<i class="el-icon-lock" v-if="post.post_status == 'draft' || post.post_status == 'pending' || !!~~post.visible" style="color:#fb9b24"></i>
|
|
9
9
|
<i class="el-icon-delete" v-if="post.post_status == 'dustbin'" style="color:#c00"></i>
|
|
10
10
|
</i>
|
|
11
11
|
<span class="u-title-text">{{ title }}</span>
|