@jx3box/jx3box-common-ui 6.5.8 → 6.6.0

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.8",
3
+ "version": "6.6.0",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -17,8 +17,8 @@
17
17
  bread info
18
18
  </Breadcrumb>
19
19
 
20
- <LeftSidebar :open="true">
21
- <LeftSideToggle :mobileOnly="true" />
20
+ <LeftSidebar :open="true" :uid="8">
21
+ <LeftSideToggle :mobileOnly="true"/>
22
22
  <Author
23
23
  :author="author"
24
24
  :uid="8"
@@ -7,7 +7,7 @@
7
7
  'without-bread': withoutBread,
8
8
  }"
9
9
  v-if="!isApp"
10
- :style="decoration"
10
+ :style="{backgroundImage:bg}"
11
11
  >
12
12
  <div class="c-sidebar-left-inner">
13
13
  <slot></slot>
@@ -39,26 +39,32 @@ import Bus from "../service/bus";
39
39
  import { isApp } from "../assets/js/app.js";
40
40
  import {getDecoration} from "../service/cms"
41
41
  import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
42
- import User from '@jx3box/jx3box-common'
42
+ import User from '@jx3box/jx3box-common/js/user'
43
43
  export default {
44
44
  name: "LeftSidebar",
45
- props: ["open", "withoutBread"],
45
+ props: ["open", "withoutBread","uid"],
46
46
  data: function () {
47
47
  return {
48
48
  isOpen: true,
49
+ user_id:null,
49
50
  isApp: isApp(),
50
- decoration:{}
51
+ bg:""
51
52
  };
52
53
  },
53
54
  computed: {
54
55
  stickyHeader: function () {
55
56
  return this.withoutBread;
56
- },
57
+ }
57
58
  },
58
59
  watch: {
59
60
  open: function (newval) {
60
61
  this.isOpen = newval === undefined ? true : !!newval;
61
62
  },
63
+ uid: function (newval) {
64
+ this.user_id = newval ;
65
+ this.getDecoration()
66
+
67
+ },
62
68
  },
63
69
  methods: {
64
70
  toggleLeftSide: function () {
@@ -69,8 +75,12 @@ export default {
69
75
  return __imgPath + `decoration/images/${val}/${type}.png`;
70
76
  },
71
77
  getDecoration(){
72
- let decoration_sidebar=sessionStorage.getItem('decoration_sidebar')
78
+ if(!this.user_id){
79
+ return;
80
+ }
81
+ let decoration_sidebar=sessionStorage.getItem('decoration_sidebar'+this.user_id)
73
82
  if(decoration_sidebar == 'no'){
83
+ this.bg =""
74
84
  return;
75
85
  }
76
86
  //已有缓存,读取解析
@@ -78,29 +88,29 @@ export default {
78
88
  this.setDecoration(JSON.parse(decoration_sidebar))
79
89
  return;
80
90
  }
81
- getDecoration({using:1}).then(data=>{
91
+ getDecoration({using:1,user_id:this.user_id}).then(data=>{
82
92
  let res=data.data.data
83
93
  if(res.length==0){
84
94
  //空 则为无主题,不再加载接口,界面设No
85
- sessionStorage.setItem('decoration_sidebar','no')
95
+ sessionStorage.setItem('decoration_sidebar'+this.user_id,'no')
96
+ this.bg =""
86
97
  return;
87
98
  }
88
99
  let decoration=res.filter(val => {
89
100
  return val.type === 'sidebar'
90
101
  })
91
102
  if(decoration.length>0){
92
- sessionStorage.setItem('decoration_sidebar',JSON.stringify(decoration[0]))
103
+ sessionStorage.setItem('decoration_sidebar'+this.user_id,JSON.stringify(decoration[0]))
93
104
  this.setDecoration(decoration[0])
94
105
  }else{
95
106
  //空 则为无主题,不再加载接口,界面设No
96
- sessionStorage.setItem('decoration_sidebar','no')
107
+ sessionStorage.setItem('decoration_sidebar'+this.user_id,'no')
108
+ this.bg =""
97
109
  }
98
110
  })
99
111
  },
100
112
  setDecoration(decoration_sidebar){
101
- this.decoration={
102
- 'background-image':'url('+this.showDecoration(decoration_sidebar.val,decoration_sidebar.type)+')'
103
- }
113
+ this.bg = `url(${this.showDecoration(decoration_sidebar.val,decoration_sidebar.type)})`;
104
114
  }
105
115
  },
106
116
  mounted: function () {
@@ -118,7 +128,8 @@ export default {
118
128
  },
119
129
  created: function () {
120
130
  this.isOpen = this.open === undefined ? true : this.open;
121
- User.isLogin() && this.getDecoration()
131
+ this.user_id = this.uid
132
+ this.getDecoration()
122
133
  },
123
134
  };
124
135
  </script>