uni-oaview 1.0.4 → 1.0.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-helloworld/oa-helloworld.vue +1 -1
- package/components/oa-login/oa-login.vue +10 -20
- package/dist/index.umd.mini.js +1 -1
- package/package.json +3 -2
- package/src/index.ts +7 -0
- package/src/shims-vue.d.ts +4 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/validation.ts +52 -0
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
<uni-forms-item required label="用户名" name="username">
|
|
5
5
|
<uni-easyinput type="text" v-model="formData.username" placeholder="请输入用户名" />
|
|
6
6
|
</uni-forms-item>
|
|
7
|
-
<uni-forms-item required name="password" label="密码">
|
|
8
|
-
<uni-easyinput type="password" v-model="formData.password" placeholder="请输入用户名" />
|
|
9
|
-
</uni-forms-item>
|
|
10
7
|
<uni-forms-item name="verificationCode" label="验证码">
|
|
11
8
|
<uni-easyinput type="text" v-model="formData.verificationCode" placeholder="请输入验证码" />
|
|
12
9
|
</uni-forms-item>
|
|
@@ -20,13 +17,15 @@
|
|
|
20
17
|
</template>
|
|
21
18
|
|
|
22
19
|
<script setup lang="ts">
|
|
23
|
-
import { requestInstance } from '@/requests';
|
|
24
20
|
import { ref, reactive } from 'vue';
|
|
25
21
|
const formRef = ref();
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
password: String,
|
|
24
|
+
});
|
|
25
|
+
const emit = defineEmits(['loginSuccess']);
|
|
26
26
|
const formData = reactive({
|
|
27
27
|
username: 'lixd',
|
|
28
|
-
password:
|
|
29
|
-
'f0d5937ddef983a4fbf56eec5c84ab78e7402fd6b55b8b7271f75f676b57bae1afe09a476702f414c12b5259899db3790ab1d8915827f2f956f48c8ab4af7541',
|
|
28
|
+
password: props.password,
|
|
30
29
|
verificationCode: 88,
|
|
31
30
|
});
|
|
32
31
|
const rules = ref({
|
|
@@ -80,34 +79,25 @@
|
|
|
80
79
|
},
|
|
81
80
|
success: (res: any) => {
|
|
82
81
|
const { uuid: id, email, ...otherParams } = res.data.data;
|
|
83
|
-
const
|
|
84
|
-
opinions.userInfo = {
|
|
85
|
-
...opinions.userInfo,
|
|
82
|
+
const userInfo = {
|
|
86
83
|
id,
|
|
87
84
|
email,
|
|
88
85
|
...otherParams,
|
|
89
86
|
department: '这是一个很长很长的部门部门321312321312',
|
|
90
87
|
position: '这是一个很长很长的职位321312312321321312',
|
|
91
88
|
};
|
|
92
|
-
uni.setStorageSync('opinions', opinions);
|
|
93
89
|
uni.request({
|
|
94
90
|
url: `${baseUrl}/api/gatewayproxy/routing/getToken?t=${Date.now()}`,
|
|
95
91
|
method: 'POST',
|
|
96
92
|
success: (res: any) => {
|
|
97
93
|
uni.hideLoading();
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
emit('loginSuccess', {
|
|
95
|
+
token: res.data.data,
|
|
96
|
+
userInfo,
|
|
97
|
+
});
|
|
100
98
|
uni.showToast({
|
|
101
99
|
title: '登录成功',
|
|
102
100
|
});
|
|
103
|
-
const currentPages = getCurrentPages();
|
|
104
|
-
let page = currentPages.pop();
|
|
105
|
-
while (currentPages.length && page?.route === 'pages/mock/index') {
|
|
106
|
-
page = currentPages.pop();
|
|
107
|
-
}
|
|
108
|
-
uni.redirectTo({
|
|
109
|
-
url: '/pages/qiandao/index',
|
|
110
|
-
});
|
|
111
101
|
},
|
|
112
102
|
});
|
|
113
103
|
},
|
package/dist/index.umd.mini.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uni-oaview",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "uniapp小程序组件库",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
-
"components"
|
|
10
|
+
"components",
|
|
11
|
+
"src"
|
|
11
12
|
],
|
|
12
13
|
"author": "",
|
|
13
14
|
"license": "ISC",
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 防抖函数
|
|
3
|
+
* @param callback
|
|
4
|
+
* @param time
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export function createDebounceFn(callback: (...params: any[]) => void, time: number) {
|
|
8
|
+
let timer: any = null;
|
|
9
|
+
return (...params: any[]) => {
|
|
10
|
+
clearTimeout(timer);
|
|
11
|
+
timer = setTimeout(() => {
|
|
12
|
+
callback(...params);
|
|
13
|
+
}, time);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getAsk() {
|
|
18
|
+
return '我是航帆范德萨范德萨';
|
|
19
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 判断当前参数是否是undefined或者null
|
|
3
|
+
* @param {Object} obj
|
|
4
|
+
*/
|
|
5
|
+
export function isNullOrUndefined(value: any) {
|
|
6
|
+
return typeof value === 'undefined' || value === null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 是否对象
|
|
10
|
+
*/
|
|
11
|
+
export function isObject(value: any) {
|
|
12
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 判断当前参数是否是空, 包括空字符和空对象,空数组,null,undefined
|
|
17
|
+
* @param {Object} obj
|
|
18
|
+
*/
|
|
19
|
+
export function isEmpty(obj: any) {
|
|
20
|
+
if (isNullOrUndefined(obj)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(obj) && obj.length === 0) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (typeof obj === 'string' && obj === '') {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 验证十进制数字
|
|
33
|
+
*/
|
|
34
|
+
export function isNumber(value: any) {
|
|
35
|
+
return /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 正则校验是否为颜色,支持#FFF,#FFFFFF,#FFFFFFFF格式
|
|
40
|
+
*/
|
|
41
|
+
export function CheckIsColor(color: any) {
|
|
42
|
+
const type = '^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$';
|
|
43
|
+
const reg = new RegExp(type);
|
|
44
|
+
return color.match(reg) !== null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default {
|
|
48
|
+
isNullOrUndefined,
|
|
49
|
+
isObject,
|
|
50
|
+
isEmpty,
|
|
51
|
+
isNumber,
|
|
52
|
+
};
|