@jx3box/jx3box-common-ui 8.2.16 → 8.3.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": "8.2.16",
3
+ "version": "8.3.0",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,7 +24,6 @@
24
24
  </template>
25
25
 
26
26
  <script>
27
- import User from "@jx3box/jx3box-common/js/user";
28
27
  import panel from "../../assets/data/panel.json";
29
28
  import { getMenu } from "../../service/header";
30
29
  import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
@@ -35,6 +34,12 @@ export default {
35
34
  panel,
36
35
  };
37
36
  },
37
+ props: {
38
+ isTeammate: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ },
38
43
  computed: {
39
44
  userPanel: function () {
40
45
  return this.panel.filter((item) => {
@@ -46,9 +51,6 @@ export default {
46
51
  return item.onlyAdmin;
47
52
  });
48
53
  },
49
- isTeammate() {
50
- return JSON.parse(sessionStorage.getItem("is_teammate"));
51
- },
52
54
  },
53
55
  mounted() {
54
56
  this.loadPanel();
@@ -29,9 +29,15 @@ export default {
29
29
  /**
30
30
  * 1. 用户第一次进入页面时,没有记录,则显示,并记录到meta
31
31
  * 2. 用户第二次进入页面,此时meta有记录,但是用户并未进入会员中心,则显示
32
+ *
33
+ * meta如果为null,说明用户未登录,不显示
34
+ * meta如果为0,说明用户已经看过,不显示,同时比较config的值,如果config的值大于local,更新local为config的值和meta为1
35
+ * meta如果为1,说明用户未看过,显示
32
36
  */
33
37
  let meta = null
34
- meta = meta = User.isLogin() && await getUserMeta({ key: "mall_pop" });
38
+ if (User.isLogin()) {
39
+ meta = await getUserMeta({ key: "mall_pop" });
40
+ }
35
41
  let config = await getConfig({ key: "mall" });
36
42
 
37
43
  if (meta == null) {
@@ -17,13 +17,13 @@
17
17
  <asset :asset="asset" />
18
18
 
19
19
  <!-- manage -->
20
- <manage />
20
+ <manage :isTeammate="isTeammate" />
21
21
 
22
22
  <!-- 语言切换 -->
23
23
  <!-- <lang-switch /> -->
24
24
 
25
25
  <!-- user info -->
26
- <user-info :asset="asset" @logout="logout" />
26
+ <user-info :asset="asset" @logout="logout" @update="update" />
27
27
  </template>
28
28
  <template v-else>
29
29
  <div class="c-header-login">
@@ -43,12 +43,12 @@ import dayjs from "dayjs";
43
43
  import isToday from "dayjs/plugin/isToday";
44
44
  dayjs.extend(isToday);
45
45
 
46
- import message from "./message.vue"
47
- import publish from "./publish.vue"
48
- import vip from "./vip.vue"
49
- import asset from "./asset.vue"
50
- import manage from "./manage.vue"
51
- import userInfo from './userInfo.vue';
46
+ import message from "./message.vue";
47
+ import publish from "./publish.vue";
48
+ import vip from "./vip.vue";
49
+ import asset from "./asset.vue";
50
+ import manage from "./manage.vue";
51
+ import userInfo from "./userInfo.vue";
52
52
  // import langSwitch from "./langSwitch.vue";
53
53
  import shop from "./shop.vue";
54
54
  export default {
@@ -60,7 +60,7 @@ export default {
60
60
  manage,
61
61
  userInfo,
62
62
  // langSwitch,
63
- shop
63
+ shop,
64
64
  },
65
65
  data: function () {
66
66
  return {
@@ -83,6 +83,8 @@ export default {
83
83
  // 链接
84
84
  login_url: __Links.account.login + "?redirect=" + location.href,
85
85
  register_url: __Links.account.register + "?redirect=" + location.href,
86
+
87
+ isTeammate: false,
86
88
  };
87
89
  },
88
90
  methods: {
@@ -133,7 +135,7 @@ export default {
133
135
  // 初始化
134
136
  init: function () {
135
137
  if (this.isLogin) {
136
- this.loadAsset( )
138
+ this.loadAsset();
137
139
  this.signIn();
138
140
  }
139
141
  },
@@ -142,6 +144,10 @@ export default {
142
144
  logout: function () {
143
145
  this.isLogin = false;
144
146
  },
147
+ // 更新用户信息
148
+ update: function ({ is_teammate }) {
149
+ this.isTeammate = is_teammate;
150
+ },
145
151
  },
146
152
  created: function () {
147
153
  this.init();
@@ -103,6 +103,7 @@ import { getMenu } from "../../service/header";
103
103
  export default {
104
104
  name: "info",
105
105
  props: ["asset"],
106
+ emits: ["update"],
106
107
  data() {
107
108
  return {
108
109
  isPhone: window.innerWidth < 768,
@@ -120,6 +121,7 @@ export default {
120
121
  isSuperAuthor: false,
121
122
 
122
123
  panel: [],
124
+ isTeammate: false,
123
125
  };
124
126
  },
125
127
  computed: {
@@ -148,9 +150,6 @@ export default {
148
150
  return item.onlyAdmin;
149
151
  });
150
152
  },
151
- isTeammate() {
152
- return JSON.parse(sessionStorage.getItem("is_teammate"));
153
- },
154
153
  pro_expire_date: function () {
155
154
  return this.asset.pro_expire_date ? showDate(this.asset.pro_expire_date) : "-";
156
155
  },
@@ -188,7 +187,8 @@ export default {
188
187
  .then((data) => {
189
188
  this.user = data;
190
189
  this.isSuperAuthor = !!data.sign;
191
- sessionStorage.setItem("is_teammate", JSON.stringify(data.is_teammate));
190
+ this.isTeammate = this.user?.is_teammate;
191
+ this.$emit("update", this.user);
192
192
  })
193
193
  .catch((err) => {
194
194
  if (err?.data.code < -1) {
@@ -31,7 +31,9 @@ export default {
31
31
  * 2. 用户第二次进入页面,此时meta有记录,但是用户并未进入会员中心,则显示
32
32
  */
33
33
  let meta = null
34
- meta = User.isLogin() && await getUserMeta({ key: 'vip_pop' });
34
+ if (User.isLogin()) {
35
+ meta = await getUserMeta({ key: "vip_pop" });
36
+ }
35
37
  let config = await getConfig({ key: "vip" });
36
38
 
37
39