uni-oaview 1.1.3 → 1.1.5
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/components/oa-login/oa-login.vue +32 -16
- package/components/oa-toast/oa-toast.vue +11 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +16 -10
- package/package.json +1 -1
- package/src/utils/index.ts +16 -10
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
|
-
import { ref, reactive } from 'vue';
|
|
21
|
+
import { ref, reactive, PropType } from 'vue';
|
|
22
22
|
const formRef = ref();
|
|
23
23
|
const props = defineProps({
|
|
24
24
|
password: {
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
default:
|
|
27
27
|
'f0d5937ddef983a4fbf56eec5c84ab78e7402fd6b55b8b7271f75f676b57bae1afe09a476702f414c12b5259899db3790ab1d8915827f2f956f48c8ab4af7541',
|
|
28
28
|
},
|
|
29
|
+
type: {
|
|
30
|
+
type: String as PropType<'token' | 'cookie'>,
|
|
31
|
+
default: 'token',
|
|
32
|
+
},
|
|
29
33
|
});
|
|
30
34
|
const emit = defineEmits(['loginSuccess']);
|
|
31
35
|
const updateFormData = (key: string, value: any) => {
|
|
@@ -101,21 +105,33 @@
|
|
|
101
105
|
department: '这是一个很长很长的部门部门321312321312',
|
|
102
106
|
position: '这是一个很长很长的职位321312312321321312',
|
|
103
107
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
if (props.type === 'token') {
|
|
109
|
+
uni.request({
|
|
110
|
+
url: `${baseUrl}/api/gatewayproxy/routing/getToken?t=${Date.now()}`,
|
|
111
|
+
method: 'POST',
|
|
112
|
+
success: (res: any) => {
|
|
113
|
+
uni.hideLoading();
|
|
114
|
+
emit('loginSuccess', {
|
|
115
|
+
...formData,
|
|
116
|
+
token: res.data.data,
|
|
117
|
+
userInfo,
|
|
118
|
+
});
|
|
119
|
+
uni.showToast({
|
|
120
|
+
title: '登录成功',
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
uni.hideLoading();
|
|
126
|
+
emit('loginSuccess', {
|
|
127
|
+
...formData,
|
|
128
|
+
userInfo,
|
|
129
|
+
session: res.header['m_token'],
|
|
130
|
+
});
|
|
131
|
+
uni.showToast({
|
|
132
|
+
title: '登录成功',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
119
135
|
},
|
|
120
136
|
complete: () => {
|
|
121
137
|
uni.hideLoading();
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
<image :src="state.imagePath" style="width: 32px; height: 32px" />
|
|
5
5
|
<span class="title">{{ state.title }}</span>
|
|
6
6
|
<div class="content">{{ state.content }}</div>
|
|
7
|
-
<div class="confirm-button" @click="
|
|
7
|
+
<div class="confirm-button" @click="submitClick">{{ state.confirmText }}</div>
|
|
8
8
|
</view>
|
|
9
9
|
</uni-popup>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
|
-
import {
|
|
13
|
+
import { reactive, ref } from 'vue';
|
|
14
14
|
import successPath from '../../imgs/toast/success.svg';
|
|
15
15
|
import warningPath from '../../imgs/toast/warning.svg';
|
|
16
16
|
import { OPEN_TOAST } from '../../constants';
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
imagePath: successPath,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
/** 接收外部的回调函数,用于给外部发事件 */
|
|
30
|
+
let innerCallback: any = null;
|
|
31
|
+
const submitClick = () => {
|
|
32
|
+
innerCallback?.();
|
|
33
|
+
popupRef.value.close();
|
|
34
|
+
};
|
|
29
35
|
const open = () => {
|
|
30
36
|
popupRef.value?.open('center');
|
|
31
37
|
};
|
|
@@ -40,7 +46,8 @@
|
|
|
40
46
|
if (!isPageAlive.value) return;
|
|
41
47
|
isShow.value = true;
|
|
42
48
|
setTimeout(() => {
|
|
43
|
-
const { title, content, confirmText, type } = params;
|
|
49
|
+
const { title, content, confirmText, type, callback } = params;
|
|
50
|
+
innerCallback = callback;
|
|
44
51
|
state.imagePath = type === 'success' ? successPath : warningPath;
|
|
45
52
|
state.title = title || '请输入标题';
|
|
46
53
|
state.content = content || '请输入内容';
|
|
@@ -71,6 +78,7 @@
|
|
|
71
78
|
font-size: 16px;
|
|
72
79
|
}
|
|
73
80
|
& > .content {
|
|
81
|
+
box-sizing: border-box;
|
|
74
82
|
text-align: center;
|
|
75
83
|
padding: 12px 16px 16px;
|
|
76
84
|
color: rgba(97, 105, 111, 1);
|
package/dist/index.d.ts
CHANGED
|
@@ -25,14 +25,14 @@ declare const Message: {
|
|
|
25
25
|
* @param content 内容
|
|
26
26
|
* @param confirmText 确认按钮文本
|
|
27
27
|
*/
|
|
28
|
-
success(title: string, content: string, confirmText?: string):
|
|
28
|
+
success(title: string, content: string, confirmText?: string): Promise<unknown>;
|
|
29
29
|
/**
|
|
30
30
|
* 警告弹框提醒
|
|
31
31
|
* @param title 警告标题
|
|
32
32
|
* @param content 警告内容
|
|
33
33
|
* @param confirmText 警告按钮文本
|
|
34
34
|
*/
|
|
35
|
-
warning(title: string, content: string, confirmText?: string):
|
|
35
|
+
warning(title: string, content: string, confirmText?: string): Promise<unknown>;
|
|
36
36
|
/**
|
|
37
37
|
* 确认弹窗
|
|
38
38
|
* @param content 确认内容
|
package/dist/index.esm.js
CHANGED
|
@@ -70,11 +70,14 @@ var Message = {
|
|
|
70
70
|
* @param confirmText 确认按钮文本
|
|
71
71
|
*/
|
|
72
72
|
success: function success(title, content, confirmText) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
return new Promise(function (res) {
|
|
74
|
+
uni.$emit(OPEN_TOAST, {
|
|
75
|
+
type: 'success',
|
|
76
|
+
title: title,
|
|
77
|
+
content: content,
|
|
78
|
+
confirmText: confirmText,
|
|
79
|
+
callback: res
|
|
80
|
+
});
|
|
78
81
|
});
|
|
79
82
|
},
|
|
80
83
|
/**
|
|
@@ -84,11 +87,14 @@ var Message = {
|
|
|
84
87
|
* @param confirmText 警告按钮文本
|
|
85
88
|
*/
|
|
86
89
|
warning: function warning(title, content, confirmText) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
return new Promise(function (res) {
|
|
91
|
+
uni.$emit(OPEN_TOAST, {
|
|
92
|
+
type: 'warning',
|
|
93
|
+
title: title,
|
|
94
|
+
content: content,
|
|
95
|
+
confirmText: confirmText,
|
|
96
|
+
callback: res
|
|
97
|
+
});
|
|
92
98
|
});
|
|
93
99
|
},
|
|
94
100
|
/**
|
package/package.json
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -29,11 +29,14 @@ export const Message = {
|
|
|
29
29
|
* @param confirmText 确认按钮文本
|
|
30
30
|
*/
|
|
31
31
|
success(title: string, content: string, confirmText?: string) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
return new Promise((res) => {
|
|
33
|
+
uni.$emit(OPEN_TOAST, {
|
|
34
|
+
type: 'success',
|
|
35
|
+
title,
|
|
36
|
+
content,
|
|
37
|
+
confirmText,
|
|
38
|
+
callback: res,
|
|
39
|
+
});
|
|
37
40
|
});
|
|
38
41
|
},
|
|
39
42
|
/**
|
|
@@ -43,11 +46,14 @@ export const Message = {
|
|
|
43
46
|
* @param confirmText 警告按钮文本
|
|
44
47
|
*/
|
|
45
48
|
warning(title: string, content: string, confirmText?: string) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
return new Promise((res) => {
|
|
50
|
+
uni.$emit(OPEN_TOAST, {
|
|
51
|
+
type: 'warning',
|
|
52
|
+
title,
|
|
53
|
+
content,
|
|
54
|
+
confirmText,
|
|
55
|
+
callback: res,
|
|
56
|
+
});
|
|
51
57
|
});
|
|
52
58
|
},
|
|
53
59
|
/**
|