uni-oaview 1.0.23 → 1.0.25

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="networkErrorInfo">
3
+ <image style="width: 13px; height: 13px" src="../../imgs/warn.svg" />
4
+ <span style="margin-left: 5px; line-height: 10px">{{ networkErrorInfo }}</span>
5
+ </view>
6
+ </template>
7
+
8
+ <script lang="ts" setup>
9
+ import { ref } from 'vue';
10
+ const networkErrorInfo = ref();
11
+ /** 监听网络状态 */
12
+ uni.onNativeEventReceive(function (event: string, data: string) {
13
+ if (event === 'networkStatusInfo') {
14
+ networkErrorInfo.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,27 @@
1
1
  <template>
2
- <Logs />
3
- <view @click="clickHandler">
2
+ <oa-vconsole v-if="showLog" />
3
+ <view class="oa-page" :style="{ height: windowHeight }" @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
+ /** oa-page高度,使用的是安全高度,windowHeight不包含NavigationBar和TabBar的高度
19
+ * https://uniapp.dcloud.net.cn/api/system/info.html#safearea
20
+ */
21
+ const windowHeight = uni.getSystemInfoSync()?.windowHeight ?? 'auto';
22
+ const baseUrl = uni.getStorageSync('baseUrl');
23
+ /** 如果在debug状态,或者是在白名单里面,则展示vconsole */
24
+ const showLog = ref(whiteUrls.some((url) => url.includes(baseUrl)) || !!uni.getStorageSync('isDebug'));
9
25
  let isLock = false;
10
26
  setTimeout(function () {
11
27
  isLock = true;
@@ -22,7 +38,7 @@
22
38
  if (clickCount === count) {
23
39
  secretArray.push(count);
24
40
  if (secretArray.join('') === secret) {
25
- uni.$emit('show-debug-button');
41
+ showLog.value = true;
26
42
  }
27
43
  } else {
28
44
  clickCount = 0;
@@ -40,3 +56,9 @@
40
56
  });
41
57
  };
42
58
  </script>
59
+
60
+ <style lang="scss" scoped>
61
+ .oa-page {
62
+ position: relative;
63
+ }
64
+ </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/dist/index.d.ts CHANGED
@@ -1,19 +1,7 @@
1
- /**
2
- * 上报APP启动小程序的时候的入参
3
- * @param params
4
- */
5
- declare function sendLaunchAppParamsLog(params: any): void;
6
-
7
- /**
8
- * 防抖函数
9
- * @param callback
10
- * @param time
11
- * @returns
12
- */
13
- declare function createDebounceFn(callback: (...params: any[]) => void, time: number): (...params: any[]) => void;
1
+ import { App } from 'vue';
14
2
 
15
3
  declare const _default: {
16
- install: (Vue: any) => void;
4
+ install: (app: App<Element>, options: any) => void;
17
5
  };
18
6
 
19
- export { createDebounceFn, _default as default, sendLaunchAppParamsLog };
7
+ export { _default as default };
package/dist/index.umd.js CHANGED
@@ -10,6 +10,7 @@
10
10
  */
11
11
  function sendLaunchAppParamsLog(params) {
12
12
  var _a;
13
+ console.log('小程序启动入参:', params);
13
14
  // #ifndef H5
14
15
  try {
15
16
  var outputData = JSON.parse(JSON.stringify((_a = params === null || params === void 0 ? void 0 : params.referrerInfo) === null || _a === void 0 ? void 0 : _a.extraData));
@@ -21,33 +22,18 @@
21
22
  // #endif
22
23
  }
23
24
 
24
- /**
25
- * 防抖函数
26
- * @param callback
27
- * @param time
28
- * @returns
29
- */
30
- function createDebounceFn(callback, time) {
31
- var timer = null;
32
- return function () {
33
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
34
- params[_key] = arguments[_key];
25
+ var install = function install(app, options) {
26
+ app.mixin({
27
+ onLaunch: function onLaunch(params) {
28
+ sendLaunchAppParamsLog(params);
35
29
  }
36
- clearTimeout(timer);
37
- timer = setTimeout(function () {
38
- callback.apply(void 0, params);
39
- }, time);
40
- };
41
- }
42
-
43
- var install = function install(Vue) {};
30
+ });
31
+ };
44
32
  var index = {
45
33
  install: install
46
34
  };
47
35
 
48
- exports.createDebounceFn = createDebounceFn;
49
36
  exports["default"] = index;
50
- exports.sendLaunchAppParamsLog = sendLaunchAppParamsLog;
51
37
 
52
38
  Object.defineProperty(exports, '__esModule', { value: true });
53
39
 
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.25",
4
4
  "description": "uniapp小程序组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,6 +1,14 @@
1
- export * from './utils';
1
+ import { App } from 'vue';
2
2
 
3
- const install = (Vue: any) => {};
3
+ import { sendLaunchAppParamsLog } from './utils';
4
+
5
+ const install = (app: App<Element>, options: any) => {
6
+ app.mixin({
7
+ onLaunch(params: any) {
8
+ sendLaunchAppParamsLog(params);
9
+ },
10
+ });
11
+ };
4
12
 
5
13
  export default {
6
14
  install,
@@ -5,6 +5,7 @@ import { reportLog } from 'uniapp-log-sdk';
5
5
  * @param params
6
6
  */
7
7
  export function sendLaunchAppParamsLog(params: any) {
8
+ console.log('小程序启动入参:', params);
8
9
  // #ifndef H5
9
10
  try {
10
11
  const outputData = JSON.parse(JSON.stringify(params?.referrerInfo?.extraData));