cloud-web-corejs 1.0.54-dev.760 → 1.0.54-dev.762

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,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.760",
4
+ "version": "1.0.54-dev.762",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -1,14 +1,27 @@
1
1
  /**version-1.1*/
2
2
  let modules = {};
3
3
 
4
+ function getVNodeValue(vnode, name) {
5
+ let propsData = vnode && vnode.componentOptions && vnode.componentOptions.propsData;
6
+ if (propsData && Object.prototype.hasOwnProperty.call(propsData, name)) {
7
+ return propsData[name];
8
+ }
9
+ let attrs = vnode && vnode.data && vnode.data.attrs;
10
+ if (attrs && Object.prototype.hasOwnProperty.call(attrs, name)) {
11
+ return attrs[name];
12
+ }
13
+ return undefined;
14
+ }
15
+
4
16
  function resolveConfig(binding, vnode) {
5
17
  let scale = binding.value != null && binding.value !== "" ? Number(binding.value) : 2;
6
18
  if (isNaN(scale) || scale < 0) {
7
19
  scale = 2;
8
20
  }
9
- let comp = vnode.componentInstance;
10
- let min = comp ? comp.min : null;
11
- let negative = comp && comp.$attrs ? comp.$attrs.negative : false;
21
+ // componentUpdated 在父组件的 patch 期间执行。此处如果读取 componentInstance
22
+ // 的响应式属性,会让父组件错误订阅子组件,最终形成无限更新循环。
23
+ let min = getVNodeValue(vnode, "min");
24
+ let negative = getVNodeValue(vnode, "negative");
12
25
  negative = negative == "true" || negative == true;
13
26
 
14
27
  if (min != null && isFinite(min)) {
package/src/utils/vab.js CHANGED
@@ -158,6 +158,7 @@ let typeList = [
158
158
  "mp4",
159
159
  "flv",
160
160
  "avi",
161
+ "mov",
161
162
  "rm",
162
163
  "mkv",
163
164
  "mpeg",
@@ -92,9 +92,8 @@ export default {
92
92
  beforeDestroy() {
93
93
  this.clearQrLoginTimer();
94
94
  this.clearSmsTimer();
95
- // 兜底:登录组件随路由切换销毁时关闭跳转期 loading($baseLoading 挂在 body 上,
96
- // 不随组件销毁自动关闭)
97
- this.closeRedirectLoading();
95
+ // 注意:这里不能关跳转期 loading。组件销毁发生在导航确认时,而首页真正渲染上屏
96
+ // 还在其后,遮罩要撑过这段时间,由 closeRedirectLoading 收口
98
97
  },
99
98
  created() {
100
99
  this.init();
@@ -250,10 +249,11 @@ export default {
250
249
  localStorage.removeItem("currentMenuId");
251
250
  this.rememberPassword();
252
251
  window.removeEventListener("keydown", this.keyDown, false);
253
- // 登录成功后的跳转链路(getWebPrefix → 路由守卫拉用户信息/生成动态路由 → 首页渲染)
254
- // 耗时较长,loading 保持打开防止期间登录页被再次操作;
255
- // closeRedirectLoading 在跳转完成/中止/请求失败/组件销毁时统一收口
256
- this.redirectLoadingObj = loadingObj;
252
+ // 登录成功后的跳转链路(getWebPrefix → 路由守卫拉用户信息/生成动态路由 →
253
+ // 首页渲染上屏)耗时较长,换成挂在 body 上的全屏遮罩顶住这段时间,
254
+ // 防止登录页被再次操作;由 closeRedirectLoading 统一收口
255
+ loadingObj.close();
256
+ this.openRedirectLoading();
257
257
  this.handleRedirectUrl();
258
258
  } else {
259
259
  setTimeout(function () {
@@ -470,19 +470,11 @@ export default {
470
470
  prefix = prefix || window.WEB_PREFIX;
471
471
  location.href = prefix + "/index.html" + path;
472
472
  } else {
473
- this.$router.push(
474
- {
475
- path: path,
476
- },
477
- () => {
478
- // 跳转完成(守卫链+首页组件解析结束)
479
- this.closeRedirectLoading();
480
- },
481
- () => {
482
- // 跳转被中止(如守卫拉取用户信息失败后重定向回登录页),恢复登录页可操作
483
- this.closeRedirectLoading(true);
484
- }
485
- );
473
+ // 遮罩不在 push 的回调里收口:守卫内的重定向会让原始导航走 onAbort,
474
+ // 而真正的导航仍在继续,统一交给 openRedirectLoading 里注册的 afterEach
475
+ this.$router.push({
476
+ path: path,
477
+ });
486
478
  }
487
479
  }, () => {
488
480
  // getWebPrefix 请求失败:恢复登录页可操作,避免 loading 永久卡死
@@ -528,10 +520,71 @@ export default {
528
520
  });
529
521
  },
530
522
  /**
531
- * 登录跳转期 loading 统一收口:跳转完成/中止、getWebPrefix 失败、组件销毁时调用。
523
+ * 打开登录跳转期的全屏遮罩。
524
+ * 不能用 fullscreen:true —— element 的全屏 loading 是全局单例(fullscreenLoading),
525
+ * request.js 里 isLoading 的请求(getWebPrefix 就是)用的正是这个单例,请求结束会把
526
+ * 它一起 close 掉。这里传 target:body + fullscreen:false 拿独立实例,遮罩挂在 body 上
527
+ * 不随登录组件销毁而消失,全屏样式手动补。
528
+ */
529
+ openRedirectLoading() {
530
+ this.closeRedirectLoading();
531
+ let loading = this.$baseLoading({
532
+ target: document.body,
533
+ fullscreen: false,
534
+ lock: true,
535
+ });
536
+ let el = loading && loading.$el;
537
+ if (el) {
538
+ el.style.position = "fixed";
539
+ el.style.top = "0";
540
+ el.style.left = "0";
541
+ el.style.width = "100%";
542
+ el.style.height = "100%";
543
+ el.style.zIndex = 9999;
544
+ }
545
+ this.redirectLoadingObj = loading;
546
+ // 收口挂在 afterEach 上:路由守卫里的重定向会让原始 push 走 onAbort,但新导航
547
+ // 其实还在继续(实测 onAbort 在 +211ms 触发,首页 +577ms 才绘制完成),所以不能
548
+ // 用 push 的回调收口。afterEach 只在导航真正确认后触发一次,且带最终目标路由
549
+ this.redirectAfterEachOff = this.$router.afterEach((to) => {
550
+ if (String((to && to.path) || "").indexOf("/login") >= 0) {
551
+ // 兜了一圈又回到登录页(如守卫拉用户信息失败),恢复登录页可操作
552
+ this.closeRedirectLoading(true);
553
+ } else {
554
+ this.closeRedirectLoadingAfterPaint();
555
+ }
556
+ });
557
+ // 兜底:跳转链路既不 complete 也不 abort 时不至于永久锁死
558
+ this.redirectLoadingTimer = setTimeout(() => {
559
+ this.closeRedirectLoading(true);
560
+ }, 20000);
561
+ },
562
+ /**
563
+ * 等目标页真正绘制上屏后再撤遮罩:$nextTick 等 Vue 完成 patch,
564
+ * 双 rAF 等浏览器完成这一帧的绘制
565
+ */
566
+ closeRedirectLoadingAfterPaint() {
567
+ this.$nextTick(() => {
568
+ requestAnimationFrame(() => {
569
+ requestAnimationFrame(() => {
570
+ this.closeRedirectLoading();
571
+ });
572
+ });
573
+ });
574
+ },
575
+ /**
576
+ * 登录跳转期 loading 统一收口:上屏完成、跳转中止、getWebPrefix 失败、超时兜底时调用。
532
577
  * reenable=true 时恢复登录页可操作(跳转失败仍停留在登录页的场景)
533
578
  */
534
579
  closeRedirectLoading(reenable) {
580
+ if (this.redirectAfterEachOff) {
581
+ this.redirectAfterEachOff();
582
+ this.redirectAfterEachOff = null;
583
+ }
584
+ if (this.redirectLoadingTimer) {
585
+ clearTimeout(this.redirectLoadingTimer);
586
+ this.redirectLoadingTimer = null;
587
+ }
535
588
  if (this.redirectLoadingObj) {
536
589
  this.redirectLoadingObj.close();
537
590
  this.redirectLoadingObj = null;