@jx3box/jx3box-common-ui 6.5.3 → 6.5.5

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-common-ui",
3
- "version": "6.5.3",
3
+ "version": "6.5.5",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/cms.js CHANGED
@@ -7,10 +7,15 @@ function getPostAuthors(post_id) {
7
7
  function uploadImage(formData){
8
8
  return $cms().post(`/api/cms/upload/avatar`, formData);
9
9
  }
10
-
10
+ //获取装扮
11
+ function getDecoration(params) {
12
+ return $cms().get(`/api/cms/user/decoration`,{
13
+ params
14
+ });
15
+ }
11
16
  // 通用上传
12
17
  function upload(formData){
13
18
  return $cms().post(`/api/cms/upload`, formData);
14
19
  }
15
20
 
16
- export { getPostAuthors, uploadImage, upload };
21
+ export { getPostAuthors, uploadImage, upload,getDecoration };
@@ -1,12 +1,13 @@
1
1
  <template>
2
2
  <aside
3
- class="c-sidebar-left c-sidebar"
3
+ class="c-sidebar-left c-sidebar m-theme"
4
4
  :class="{
5
5
  isclose: !isOpen,
6
6
  isopen: isOpen,
7
7
  'without-bread': withoutBread,
8
8
  }"
9
9
  v-if="!isApp"
10
+ :style="decoration"
10
11
  >
11
12
  <div class="c-sidebar-left-inner">
12
13
  <slot></slot>
@@ -36,6 +37,8 @@
36
37
  <script>
37
38
  import Bus from "../service/bus";
38
39
  import { isApp } from "../assets/js/app.js";
40
+ import {getDecoration} from "../service/cms"
41
+ import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
39
42
  export default {
40
43
  name: "LeftSidebar",
41
44
  props: ["open", "withoutBread"],
@@ -43,6 +46,7 @@ export default {
43
46
  return {
44
47
  isOpen: true,
45
48
  isApp: isApp(),
49
+ decoration:{}
46
50
  };
47
51
  },
48
52
  computed: {
@@ -60,6 +64,44 @@ export default {
60
64
  let status = !this.isOpen;
61
65
  Bus.$emit("toggleLeftSide", status);
62
66
  },
67
+ showDecoration:function(val,type){
68
+ return __imgPath + `decoration/images/${val}/${type}.png`;
69
+ },
70
+ getDecoration(){
71
+ let decoration_sidebar=sessionStorage.getItem('decoration_sidebar')
72
+ if(decoration_sidebar == 'no'){
73
+ return;
74
+ }
75
+ //已有缓存,读取解析
76
+ if(decoration_sidebar){
77
+ this.setDecoration(JSON.parse(decoration_sidebar))
78
+ return;
79
+ }
80
+ getDecoration({using:1,type:'sidebar'}).then(data=>{
81
+ let res=data.data.data
82
+ if(res.length==0){
83
+ //空 则为无主题,不再加载接口,界面设No
84
+ sessionStorage.setItem('decoration_sidebar','no')
85
+ return;
86
+ }
87
+ let decoration=res.filter(val => {
88
+ return val.type === 'sidebar'
89
+ })
90
+ console.log(decoration)
91
+ if(decoration.length>0){
92
+ sessionStorage.setItem('decoration_sidebar',JSON.stringify(decoration[0]))
93
+ this.setDecoration(decoration[0])
94
+ }else{
95
+ //空 则为无主题,不再加载接口,界面设No
96
+ sessionStorage.setItem('decoration_sidebar','no')
97
+ }
98
+ })
99
+ },
100
+ setDecoration(decoration_sidebar){
101
+ this.decoration={
102
+ 'background-image':'url('+this.showDecoration(decoration_sidebar.val,decoration_sidebar.type)+')'
103
+ }
104
+ }
63
105
  },
64
106
  mounted: function () {
65
107
  Bus.$on("toggleLeftSide", (data) => {
@@ -76,10 +118,18 @@ export default {
76
118
  },
77
119
  created: function () {
78
120
  this.isOpen = this.open === undefined ? true : this.open;
121
+ this.getDecoration()
79
122
  },
80
123
  };
81
124
  </script>
82
125
 
83
126
  <style lang="less">
84
127
  @import "../assets/css/left-sidebar.less";
128
+ // 虚拟装扮主题
129
+ .m-theme{
130
+ // background: url(../assets/testbg.png) no-repeat;
131
+ background-repeat: no-repeat;
132
+ background-size: contain;
133
+ background-position: top right;
134
+ }
85
135
  </style>
@@ -50,7 +50,7 @@
50
50
  />
51
51
 
52
52
  <!-- 评论 -->
53
- <div class="m-single-comment">
53
+ <div ref="commentView" class="m-single-comment">
54
54
  <el-divider content-position="left">评论</el-divider>
55
55
  <Comment :id="id" category="post" v-if="id && allow_comment" />
56
56
  <el-alert title="作者没有开启评论功能" type="warning" show-icon v-else></el-alert>
@@ -62,7 +62,13 @@
62
62
  <slot name="single-footer"></slot>
63
63
  </footer>
64
64
 
65
- <right-affix :postId="id" :postType="post_type" :postTitle="post_title"></right-affix>
65
+ <right-affix
66
+ :postId="id"
67
+ :postType="post_type"
68
+ :postTitle="post_title"
69
+ :showComment="id && allow_comment"
70
+ @toComment="toComment($event)"
71
+ ></right-affix>
66
72
  </div>
67
73
  </template>
68
74
 
@@ -170,6 +176,12 @@ export default {
170
176
  this.super_author = super_author;
171
177
  this.other_authors = other_authors;
172
178
  },
179
+ toComment() {
180
+ this.$refs.commentView.scrollIntoView({
181
+ block: "center",
182
+ behavior: "auto",
183
+ });
184
+ },
173
185
  },
174
186
  watch: {
175
187
  extend_data: {
@@ -3,6 +3,11 @@
3
3
  <div class="item">
4
4
  <fav :postId="postId" :postType="postType" :postTitle="postTitle" :hiddenNum="true"></fav>
5
5
  </div>
6
+ <el-tooltip v-if="showComment" effect="dark" content="去评论" placement="left">
7
+ <div class="item" @click="toComment">
8
+ <i class="el-icon-chat-dot-square"></i>
9
+ </div>
10
+ </el-tooltip>
6
11
  <el-tooltip effect="dark" content="回到顶部" placement="bottom">
7
12
  <div class="item" v-show="scrollBtnShow" @click="goTop">
8
13
  <div class="to-top"></div>
@@ -15,7 +20,7 @@
15
20
  import Fav from "../interact/Fav2.vue";
16
21
  export default {
17
22
  name: "RightAffix",
18
- props: ["postId", "postType", "postTitle"],
23
+ props: ["postId", "postType", "postTitle", "showComment"],
19
24
  data() {
20
25
  return {
21
26
  scrollToptimer: null,
@@ -42,6 +47,9 @@ export default {
42
47
  self.isTop = true;
43
48
  }, 30);
44
49
  },
50
+ toComment() {
51
+ this.$emit("toComment");
52
+ },
45
53
  },
46
54
  mounted() {
47
55
  //获取页面可视区高度
@@ -89,18 +97,26 @@ export default {
89
97
  &:hover {
90
98
  background-color: #f6fcff;
91
99
  }
100
+ .el-icon-chat-dot-square {
101
+ font-size: 20px;
102
+ font-weight: bold;
103
+ color: #3871e0;
104
+ }
105
+ .w-fav2 svg{
106
+ .size(26px);
107
+ }
92
108
  }
93
109
  .to-top {
94
110
  width: 0;
95
111
  height: 0;
96
- border-left: 12px solid transparent;
97
- border-right: 12px solid transparent;
98
- border-bottom: 18px solid skyblue;
112
+ border-left: 10px solid transparent;
113
+ border-right: 10px solid transparent;
114
+ border-bottom: 16px solid #87ceeb;
99
115
  }
100
116
  }
101
- @media screen and (max-width:@smallpc){
102
- .right-affix{
103
- right:0;
117
+ @media screen and (max-width: @smallpc) {
118
+ .right-affix {
119
+ right: 0;
104
120
  }
105
121
  }
106
122
  </style>