@jx3box/jx3box-common-ui 6.5.4 → 6.5.6
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 +1 -1
- package/service/cms.js +7 -2
- package/src/LeftSidebar.vue +50 -1
package/package.json
CHANGED
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 };
|
package/src/LeftSidebar.vue
CHANGED
|
@@ -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,43 @@ 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}).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
|
+
if(decoration.length>0){
|
|
91
|
+
sessionStorage.setItem('decoration_sidebar',JSON.stringify(decoration[0]))
|
|
92
|
+
this.setDecoration(decoration[0])
|
|
93
|
+
}else{
|
|
94
|
+
//空 则为无主题,不再加载接口,界面设No
|
|
95
|
+
sessionStorage.setItem('decoration_sidebar','no')
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
setDecoration(decoration_sidebar){
|
|
100
|
+
this.decoration={
|
|
101
|
+
'background-image':'url('+this.showDecoration(decoration_sidebar.val,decoration_sidebar.type)+')'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
63
104
|
},
|
|
64
105
|
mounted: function () {
|
|
65
106
|
Bus.$on("toggleLeftSide", (data) => {
|
|
@@ -76,10 +117,18 @@ export default {
|
|
|
76
117
|
},
|
|
77
118
|
created: function () {
|
|
78
119
|
this.isOpen = this.open === undefined ? true : this.open;
|
|
120
|
+
this.getDecoration()
|
|
79
121
|
},
|
|
80
122
|
};
|
|
81
123
|
</script>
|
|
82
124
|
|
|
83
125
|
<style lang="less">
|
|
84
126
|
@import "../assets/css/left-sidebar.less";
|
|
127
|
+
// 虚拟装扮主题
|
|
128
|
+
.m-theme{
|
|
129
|
+
// background: url(../assets/testbg.png) no-repeat;
|
|
130
|
+
background-repeat: no-repeat;
|
|
131
|
+
background-size: contain;
|
|
132
|
+
background-position: top right;
|
|
133
|
+
}
|
|
85
134
|
</style>
|