uni-oaview 1.0.23 → 1.0.24

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.
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <view class="network-error" v-if="isNetworkError">
3
+ <image style="width: 13px; height: 13px" src="../../imgs/warn.svg" />
4
+ <span style="margin-left: 5px; line-height: 10px">网络错误,请检查本地连接</span>
5
+ </view>
6
+ </template>
7
+
8
+ <script lang="ts" setup>
9
+ import { ref } from 'vue';
10
+ const isNetworkError = ref(false);
11
+ /** 监听网络状态 */
12
+ uni.onNativeEventReceive(function (event: string, data: boolean) {
13
+ if (event === 'networkStatus') {
14
+ isNetworkError.value = !data;
15
+ }
16
+ });
17
+ </script>
18
+ <style scoped lang="scss">
19
+ .network-error {
20
+ position: absolute;
21
+ z-index: 1000;
22
+ top: 0;
23
+ width: 100vw;
24
+ background-color: rgba(255, 0, 0, 0.1);
25
+ font-size: 10px;
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: center;
29
+ height: 25px;
30
+ color: #3c3c3c;
31
+ }
32
+ </style>
@@ -1,11 +1,23 @@
1
1
  <template>
2
- <Logs />
3
- <view @click="clickHandler">
2
+ <oa-vconsole v-if="showLog" />
3
+ <view class="oa-page" @click="clickHandler">
4
+ <NetworkError />
4
5
  <slot />
5
6
  </view>
6
7
  </template>
7
8
  <script lang="ts" setup>
8
- import Logs from '../oa-vconsole/oa-vconsole.vue';
9
+ import { ref } from 'vue';
10
+ import OaVconsole from '../oa-vconsole/oa-vconsole.vue';
11
+ import NetworkError from './nextwork-error.vue';
12
+ const whiteUrls = [
13
+ 'http://192.168.11.231:6174',
14
+ 'http://192.168.10.11:6174',
15
+ 'http://dev-oa.ge.cn:6174',
16
+ 'http://test-oa.ge.cn:6174',
17
+ ];
18
+ const baseUrl = uni.getStorageSync('baseUrl');
19
+ /** 如果在debug状态,或者是在白名单里面,则展示vconsole */
20
+ const showLog = ref(whiteUrls.some((url) => url.includes(baseUrl)) || !!uni.getStorageSync('isDebug'));
9
21
  let isLock = false;
10
22
  setTimeout(function () {
11
23
  isLock = true;
@@ -22,7 +34,7 @@
22
34
  if (clickCount === count) {
23
35
  secretArray.push(count);
24
36
  if (secretArray.join('') === secret) {
25
- uni.$emit('show-debug-button');
37
+ showLog.value = true;
26
38
  }
27
39
  } else {
28
40
  clickCount = 0;
@@ -40,3 +52,9 @@
40
52
  });
41
53
  };
42
54
  </script>
55
+
56
+ <style lang="scss" scoped>
57
+ .oa-page {
58
+ position: relative;
59
+ }
60
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <uni-popup ref="popupRef" v-if="isShowDebugButton" background-color="#fff">
2
+ <uni-popup ref="popupRef" background-color="#fff">
3
3
  <view style="height: 500px; background-color: white; width: 100vw">
4
4
  <uni-segmented-control
5
5
  styleType="text"
@@ -30,7 +30,6 @@
30
30
  </view>
31
31
  </uni-popup>
32
32
  <view
33
- v-if="isShowDebugButton"
34
33
  @click="openDebug"
35
34
  class="debug-button"
36
35
  :style="{
@@ -40,7 +39,7 @@
40
39
  @touchstart="start"
41
40
  @touchmove="move"
42
41
  >
43
- <image style="width: 40rpx; height: 40rpx" src="../../imgs/debug.svg" />
42
+ <image style="width: 20px; height: 20px" src="../../imgs/debug.svg" />
44
43
  </view>
45
44
  </template>
46
45
 
@@ -52,24 +51,12 @@
52
51
  import Storage from './storage.vue';
53
52
  import Console from './console.vue';
54
53
  import System from './system.vue';
55
- const whiteUrls = [
56
- 'http://192.168.11.231:6174',
57
- 'http://192.168.10.11:6174',
58
- 'http://dev-oa.ge.cn:6174',
59
- 'http://test-oa.ge.cn:6174',
60
- ];
61
- const show = ref(false);
62
54
  const popupRef = ref();
63
- const baseUrl = uni.getStorageSync('baseUrl');
64
- const isShowDebugButton = ref(whiteUrls.some((url) => url.includes(baseUrl)) || !!uni.getStorageSync('isDebug'));
65
55
  const list = ref(['console', 'network', 'event', 'error', 'storage', 'system']);
66
56
  const current = ref(0);
67
57
  const openDebug = () => {
68
58
  popupRef.value?.open('bottom');
69
59
  };
70
- uni.$once('show-debug-button', () => {
71
- isShowDebugButton.value = true;
72
- });
73
60
  const bottom = ref(200);
74
61
  const right = ref(10);
75
62
  let pageX: number, pageY: number;
@@ -91,8 +78,8 @@
91
78
 
92
79
  <style lang="scss" scoped>
93
80
  .debug-button {
94
- width: 80rpx;
95
- height: 80rpx;
81
+ width: 40px;
82
+ height: 40px;
96
83
  position: fixed;
97
84
  z-index: 1000;
98
85
  border-radius: 50%;
package/imgs/warn.svg ADDED
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1686388435978" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2392" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 992C246.912 992 32 777.088 32 512 32 246.912 246.912 32 512 32c265.088 0 480 214.912 480 480 0 265.088-214.912 480-480 480zM480 256v352a32 32 0 0 0 64 0V256a32 32 0 0 0-64 0z m-16 528a48 48 0 1 0 96 0 48 48 0 0 0-96 0z" p-id="2393" fill="red"></path></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-oaview",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "uniapp小程序组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "typings": "dist/index.d.ts",