uni-oaview 1.0.34 → 1.1.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.
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <uni-popup ref="popupRef" background-color="#fff" v-if="isShow" :is-mask-click="false">
3
+ <view class="popup-content">
4
+ <image src="../../imgs/toast/warning.svg" style="width: 32px; height: 32px" />
5
+ <span class="title">{{ state.title }}</span>
6
+ <div class="content">{{ state.content }}</div>
7
+ <div class="submit-buttons">
8
+ <div class="cancel-button" @click="submitClick('cancel')">{{ state.cancelText }}</div>
9
+ <div class="confirm-button" @click="submitClick('confirm')">{{ state.confirmText }}</div>
10
+ </div>
11
+ </view>
12
+ </uni-popup>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { reactive, ref } from 'vue';
17
+ import { OPEN_CONFIRM_BOX } from '../../constants';
18
+ const popupRef = ref();
19
+ const isShow = ref(false);
20
+ const state = reactive({
21
+ title: '温馨提示',
22
+ content: '请输入提醒内容',
23
+ confirmText: '确认',
24
+ cancelText: '取消',
25
+ });
26
+ /** 接收外部的回调函数,用于给外部发事件 */
27
+ let innerCallback: any = null;
28
+ const submitClick = (type: 'cancel' | 'confirm') => {
29
+ innerCallback?.(type);
30
+ popupRef.value.close();
31
+ };
32
+ uni.$on(OPEN_CONFIRM_BOX, (params: any) => {
33
+ isShow.value = true;
34
+ setTimeout(() => {
35
+ const { title, content, confirmText, cancelText, callback } = params;
36
+ innerCallback = callback;
37
+ state.title = title || '温馨提示';
38
+ state.content = content || '请输入提醒内容';
39
+ state.confirmText = confirmText || '确认';
40
+ state.cancelText = cancelText || '取消';
41
+ popupRef.value?.open('center');
42
+ });
43
+ });
44
+ </script>
45
+ <style scoped lang="scss">
46
+ ::v-deep {
47
+ .uni-popup__wrapper {
48
+ border-radius: 8px;
49
+ }
50
+ }
51
+ .popup-content {
52
+ padding: 16px 0;
53
+ padding-bottom: 0;
54
+ display: flex;
55
+ flex-direction: column;
56
+ align-items: center;
57
+ width: 280px;
58
+ border-radius: 8px;
59
+ & > .title {
60
+ margin-top: 16px;
61
+ color: rgba(25, 36, 44, 1);
62
+ font-family: PingFang SC;
63
+ font-weight: 600;
64
+ font-size: 16px;
65
+ }
66
+ & > .content {
67
+ text-align: center;
68
+ padding: 12px 16px 16px;
69
+ color: rgba(97, 105, 111, 1);
70
+ font-family: PingFang SC;
71
+ font-size: 14px;
72
+ }
73
+ & > .submit-buttons {
74
+ width: 100%;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ border-top: 1px solid rgba(221, 227, 231, 1);
79
+ height: 47px;
80
+ font-family: PingFang SC;
81
+ font-weight: 500;
82
+ font-size: 16px;
83
+ & > .cancel-button {
84
+ height: 100%;
85
+ flex-basis: 50%;
86
+ display: flex;
87
+ align-items: center;
88
+ justify-content: center;
89
+ color: rgba(25, 36, 44, 1);
90
+ }
91
+ & > .confirm-button {
92
+ height: 100%;
93
+ flex-basis: 50%;
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: center;
97
+ border-left: 1px solid rgba(221, 227, 231, 1);
98
+ color: rgba(17, 154, 245, 1);
99
+ }
100
+ }
101
+ }
102
+ </style>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <oa-toast />
3
+ <oa-confirm />
4
+ </template>
5
+
6
+ <script setup lang="ts">
7
+ import OaToast from '../oa-toast/oa-toast.vue';
8
+ import OaConfirm from '../oa-confirm/oa-confirm.vue';
9
+ </script>
@@ -4,11 +4,13 @@
4
4
  <NetworkError />
5
5
  <slot />
6
6
  </view>
7
+ <global-components />
7
8
  </template>
8
9
  <script lang="ts" setup>
9
10
  import { ref } from 'vue';
10
11
  import OaVconsole from '../oa-vconsole/oa-vconsole.vue';
11
12
  import NetworkError from './nextwork-error.vue';
13
+ import GlobalComponents from './global-components.vue';
12
14
  const whiteUrls = [
13
15
  'http://192.168.11.231:6174',
14
16
  'http://192.168.10.11:6174',
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <uni-popup ref="popupRef" background-color="#fff" v-if="isShow" :is-mask-click="false">
3
+ <view class="popup-content">
4
+ <image :src="state.imagePath" style="width: 32px; height: 32px" />
5
+ <span class="title">{{ state.title }}</span>
6
+ <div class="content">{{ state.content }}</div>
7
+ <div class="confirm-button" @click="() => popupRef.close()">{{ state.confirmText }}</div>
8
+ </view>
9
+ </uni-popup>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { Prop, PropType, reactive, ref, nextTick } from 'vue';
14
+ import successPath from '../../imgs/toast/success.svg';
15
+ import warningPath from '../../imgs/toast/warning.svg';
16
+ import { OPEN_TOAST } from '../../constants';
17
+ const popupRef = ref();
18
+ const isShow = ref(false);
19
+ const state = reactive({
20
+ title: '',
21
+ content: '',
22
+ confirmText: '',
23
+ type: 'success',
24
+ imagePath: successPath,
25
+ });
26
+
27
+ const open = () => {
28
+ popupRef.value?.open('center');
29
+ };
30
+ uni.$on(OPEN_TOAST, (params: any) => {
31
+ isShow.value = true;
32
+ setTimeout(() => {
33
+ const { title, content, confirmText, type } = params;
34
+ state.imagePath = type === 'success' ? successPath : warningPath;
35
+ state.title = title || '请输入标题';
36
+ state.content = content || '请输入内容';
37
+ state.confirmText = confirmText || '我知道了';
38
+ open();
39
+ });
40
+ });
41
+ </script>
42
+ <style scoped lang="scss">
43
+ ::v-deep {
44
+ .uni-popup__wrapper {
45
+ border-radius: 8px;
46
+ }
47
+ }
48
+ .popup-content {
49
+ padding: 16px 0;
50
+ padding-bottom: 0;
51
+ display: flex;
52
+ flex-direction: column;
53
+ align-items: center;
54
+ width: 280px;
55
+ border-radius: 8px;
56
+ & > .title {
57
+ margin-top: 16px;
58
+ color: rgba(25, 36, 44, 1);
59
+ font-family: PingFang SC;
60
+ font-weight: 600;
61
+ font-size: 16px;
62
+ }
63
+ & > .content {
64
+ text-align: center;
65
+ padding: 12px 16px 16px;
66
+ color: rgba(97, 105, 111, 1);
67
+ font-family: PingFang SC;
68
+ font-size: 14px;
69
+ }
70
+ & > .confirm-button {
71
+ margin: 0 -16px;
72
+ width: 100%;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ border-top: 1px solid rgba(221, 227, 231, 1);
77
+ height: 47px;
78
+ color: rgba(17, 154, 245, 1);
79
+ font-family: PingFang SC;
80
+ font-weight: 500;
81
+ font-size: 16px;
82
+ }
83
+ }
84
+ </style>
package/dist/index.d.ts CHANGED
@@ -1,5 +1,49 @@
1
1
  import { App } from 'vue';
2
2
 
3
+ /**
4
+ * 上报APP启动小程序的时候的入参
5
+ * @param params
6
+ */
7
+ declare function sendLaunchAppParamsLog(params: any): void;
8
+
9
+ /**
10
+ * 防抖函数
11
+ * @param callback
12
+ * @param time
13
+ * @returns
14
+ */
15
+ declare function createDebounceFn(callback: (...params: any[]) => void, time: number): (...params: any[]) => void;
16
+ /**
17
+ * 展示消息提醒,或者是确认弹窗等
18
+ * @param title
19
+ * @param duration
20
+ */
21
+ declare const Message: {
22
+ /**
23
+ * 成功弹出框提醒
24
+ * @param title 标题
25
+ * @param content 内容
26
+ * @param confirmText 确认按钮文本
27
+ */
28
+ success(title: string, content: string, confirmText?: string): void;
29
+ /**
30
+ * 警告弹框提醒
31
+ * @param title 警告标题
32
+ * @param content 警告内容
33
+ * @param confirmText 警告按钮文本
34
+ */
35
+ warning(title: string, content: string, confirmText?: string): void;
36
+ /**
37
+ * 确认弹窗
38
+ * @param content 确认内容
39
+ * @param title 标题
40
+ * @param confirmText 确定按钮文本
41
+ * @param cancelText 取消按钮文本
42
+ * @returns
43
+ */
44
+ confirm(content: string, title?: string, confirmText?: string, cancelText?: string): Promise<unknown>;
45
+ };
46
+
3
47
  declare const _default: {
4
48
  install: (app: App<Element>) => void;
5
49
  };
@@ -12,4 +56,4 @@ declare const _default: {
12
56
  */
13
57
  declare function getDataByApp(eventName: string, params: Record<string, any>, immediate?: boolean): Promise<any>;
14
58
 
15
- export { _default as default, getDataByApp };
59
+ export { Message, createDebounceFn, _default as default, getDataByApp, sendLaunchAppParamsLog };
package/dist/index.esm.js CHANGED
@@ -29,6 +29,96 @@ function sendLaunchAppParamsLog(params) {
29
29
  // #endif
30
30
  }
31
31
 
32
+ var prefix = 'oa-ehK3Krfu#$opk^Ug!6Ce!-';
33
+ /**
34
+ * 打开toast事件名称
35
+ */
36
+ var OPEN_TOAST = "".concat(prefix, "open-toast");
37
+ /**
38
+ * 打开确认框事件名称
39
+ */
40
+ var OPEN_CONFIRM_BOX = "".concat(prefix, "open-confirm-box");
41
+
42
+ /**
43
+ * 防抖函数
44
+ * @param callback
45
+ * @param time
46
+ * @returns
47
+ */
48
+ function createDebounceFn(callback, time) {
49
+ var timer = null;
50
+ return function () {
51
+ for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
52
+ params[_key] = arguments[_key];
53
+ }
54
+ clearTimeout(timer);
55
+ timer = setTimeout(function () {
56
+ callback.apply(void 0, params);
57
+ }, time);
58
+ };
59
+ }
60
+ /**
61
+ * 展示消息提醒,或者是确认弹窗等
62
+ * @param title
63
+ * @param duration
64
+ */
65
+ var Message = {
66
+ /**
67
+ * 成功弹出框提醒
68
+ * @param title 标题
69
+ * @param content 内容
70
+ * @param confirmText 确认按钮文本
71
+ */
72
+ success: function success(title, content, confirmText) {
73
+ uni.$emit(OPEN_TOAST, {
74
+ type: 'success',
75
+ title: title,
76
+ content: content,
77
+ confirmText: confirmText
78
+ });
79
+ },
80
+ /**
81
+ * 警告弹框提醒
82
+ * @param title 警告标题
83
+ * @param content 警告内容
84
+ * @param confirmText 警告按钮文本
85
+ */
86
+ warning: function warning(title, content, confirmText) {
87
+ uni.$emit(OPEN_TOAST, {
88
+ type: 'warning',
89
+ title: title,
90
+ content: content,
91
+ confirmText: confirmText
92
+ });
93
+ },
94
+ /**
95
+ * 确认弹窗
96
+ * @param content 确认内容
97
+ * @param title 标题
98
+ * @param confirmText 确定按钮文本
99
+ * @param cancelText 取消按钮文本
100
+ * @returns
101
+ */
102
+ confirm: function confirm(content, title, confirmText, cancelText) {
103
+ return new Promise(function (res, rej) {
104
+ var callback = function callback(type) {
105
+ if (type === 'confirm') {
106
+ res('');
107
+ } else {
108
+ rej();
109
+ }
110
+ };
111
+ uni.$emit(OPEN_CONFIRM_BOX, {
112
+ title: title,
113
+ content: content,
114
+ confirmText: confirmText,
115
+ cancelText: cancelText,
116
+ callback: callback
117
+ });
118
+ });
119
+ }
120
+ };
121
+
32
122
  var install = function install(app) {
33
123
  app.mixin({
34
124
  onLaunch: function onLaunch(params) {
@@ -69,4 +159,4 @@ function getDataByApp(eventName, params) {
69
159
  });
70
160
  }
71
161
 
72
- export { index as default, getDataByApp };
162
+ export { Message, createDebounceFn, index as default, getDataByApp, sendLaunchAppParamsLog };
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="29.0909091px" height="29.0909091px" viewBox="0 0 29.0909091 29.0909091" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <g id="移动端-Vxxx" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
4
+ <g id="访客预约信息-修改预约成功" transform="translate(-171.454545, -321.454545)">
5
+ <g id="编组-13" transform="translate(46.000000, 304.000000)">
6
+ <g id="Icon/面型/警告" transform="translate(124.000000, 16.000000)">
7
+ <rect id="矩形" x="0" y="0" width="32" height="32"></rect>
8
+ <g id="编组-2" transform="translate(1.454545, 1.454545)">
9
+ <circle id="形状结合" fill="#08C481" cx="14.5454545" cy="14.5454545" r="14.5454545"></circle>
10
+ <path d="M20.9444567,9.67069772 C21.4275716,9.18815268 22.2103936,9.1886146 22.6929386,9.67172945 C23.1691344,10.1484875 23.1749503,10.9171176 22.7107266,11.4010089 L22.6919069,11.4202114 L13.5142545,20.5869818 L13.511535,20.5901275 C13.5066942,20.5955994 13.5026412,20.5998753 13.4986256,20.6038574 L13.4830342,20.6184832 C12.8640885,21.2360716 11.8655948,21.241522 11.240883,20.636051 L11.2204245,20.6158691 L6.39752704,15.7823718 C5.9152273,15.2990121 5.9160866,14.5161904 6.39944634,14.0338907 C6.87644608,13.557937 7.64507904,13.5525113 8.12873464,14.0169806 L8.14792751,14.03581 L12.3538909,18.2510545 L20.9444567,9.67069772 Z" id="路径-7" fill="#FFFFFF" fill-rule="nonzero"></path>
11
+ </g>
12
+ </g>
13
+ </g>
14
+ </g>
15
+ </g>
16
+ </svg>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="29.0909091px" height="29.0909091px" viewBox="0 0 29.0909091 29.0909091" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <g id="移动端-Vxxx" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
4
+ <g id="访客预约信息-撤销提醒" transform="translate(-172.454545, -321.454545)" fill="#EE8300">
5
+ <g id="编组-13" transform="translate(47.000000, 304.000000)">
6
+ <g id="Icon/面型/警告" transform="translate(124.000000, 16.000000)">
7
+ <g id="编组-2" transform="translate(1.454545, 1.454545)">
8
+ <path d="M14.5454545,0 C22.5786873,0 29.0909091,6.51222182 29.0909091,14.5454545 C29.0909091,22.5786873 22.5786873,29.0909091 14.5454545,29.0909091 C6.51222182,29.0909091 0,22.5786873 0,14.5454545 C0,6.51222182 6.51222182,0 14.5454545,0 Z M14.5454545,20.9454545 C13.7421313,20.9454545 13.0909091,21.5966767 13.0909091,22.4 C13.0909091,23.2033233 13.7421313,23.8545455 14.5454545,23.8545455 C15.3487778,23.8545455 16,23.2033233 16,22.4 C16,21.5966767 15.3487778,20.9454545 14.5454545,20.9454545 Z M14.5454545,5.74545455 C13.8626298,5.74545455 13.3090909,6.2989934 13.3090909,6.98181818 L13.3090909,17.3090909 C13.3090909,17.9919157 13.8626298,18.5454545 14.5454545,18.5454545 C15.2282793,18.5454545 15.7818182,17.9919157 15.7818182,17.3090909 L15.7818182,6.98181818 C15.7818182,6.2989934 15.2282793,5.74545455 14.5454545,5.74545455 Z" id="形状结合"></path>
9
+ </g>
10
+ </g>
11
+ </g>
12
+ </g>
13
+ </g>
14
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-oaview",
3
- "version": "1.0.34",
3
+ "version": "1.1.0",
4
4
  "description": "uniapp小程序组件库",
5
5
  "main": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { App } from 'vue';
2
2
 
3
3
  import { sendLaunchAppParamsLog } from './utils';
4
+ export * from './utils';
4
5
 
5
6
  const install = (app: App<Element>) => {
6
7
  app.mixin({
@@ -1,5 +1,5 @@
1
1
  export * from './send-log';
2
-
2
+ import { OPEN_CONFIRM_BOX, OPEN_TOAST } from '../../constants';
3
3
  /**
4
4
  * 防抖函数
5
5
  * @param callback
@@ -15,3 +15,65 @@ export function createDebounceFn(callback: (...params: any[]) => void, time: num
15
15
  }, time);
16
16
  };
17
17
  }
18
+
19
+ /**
20
+ * 展示消息提醒,或者是确认弹窗等
21
+ * @param title
22
+ * @param duration
23
+ */
24
+ export const Message = {
25
+ /**
26
+ * 成功弹出框提醒
27
+ * @param title 标题
28
+ * @param content 内容
29
+ * @param confirmText 确认按钮文本
30
+ */
31
+ success(title: string, content: string, confirmText?: string) {
32
+ uni.$emit(OPEN_TOAST, {
33
+ type: 'success',
34
+ title,
35
+ content,
36
+ confirmText,
37
+ });
38
+ },
39
+ /**
40
+ * 警告弹框提醒
41
+ * @param title 警告标题
42
+ * @param content 警告内容
43
+ * @param confirmText 警告按钮文本
44
+ */
45
+ warning(title: string, content: string, confirmText?: string) {
46
+ uni.$emit(OPEN_TOAST, {
47
+ type: 'warning',
48
+ title,
49
+ content,
50
+ confirmText,
51
+ });
52
+ },
53
+ /**
54
+ * 确认弹窗
55
+ * @param content 确认内容
56
+ * @param title 标题
57
+ * @param confirmText 确定按钮文本
58
+ * @param cancelText 取消按钮文本
59
+ * @returns
60
+ */
61
+ confirm(content: string, title?: string, confirmText?: string, cancelText?: string) {
62
+ return new Promise((res, rej) => {
63
+ const callback = (type: 'confirm' | 'cancel') => {
64
+ if (type === 'confirm') {
65
+ res('');
66
+ } else {
67
+ rej();
68
+ }
69
+ };
70
+ uni.$emit(OPEN_CONFIRM_BOX, {
71
+ title,
72
+ content,
73
+ confirmText,
74
+ cancelText,
75
+ callback,
76
+ });
77
+ });
78
+ },
79
+ };