uni-oaview 1.0.4 → 1.0.6
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 +14 -20
- package/components/oa-user-avatar/oa-user-avatar.vue +30 -0
- package/components/oa-vconsole/oa-vconsole.vue +1 -1
- package/dist/index.umd.mini.js +1 -1
- package/package.json +16 -4
- 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
- package/components/oa-image/oa-image.vue +0 -9
|
@@ -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,19 @@
|
|
|
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: {
|
|
24
|
+
type: String,
|
|
25
|
+
default:
|
|
26
|
+
'f0d5937ddef983a4fbf56eec5c84ab78e7402fd6b55b8b7271f75f676b57bae1afe09a476702f414c12b5259899db3790ab1d8915827f2f956f48c8ab4af7541',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const emit = defineEmits(['loginSuccess']);
|
|
26
30
|
const formData = reactive({
|
|
27
31
|
username: 'lixd',
|
|
28
|
-
password:
|
|
29
|
-
'f0d5937ddef983a4fbf56eec5c84ab78e7402fd6b55b8b7271f75f676b57bae1afe09a476702f414c12b5259899db3790ab1d8915827f2f956f48c8ab4af7541',
|
|
32
|
+
password: props.password,
|
|
30
33
|
verificationCode: 88,
|
|
31
34
|
});
|
|
32
35
|
const rules = ref({
|
|
@@ -80,34 +83,25 @@
|
|
|
80
83
|
},
|
|
81
84
|
success: (res: any) => {
|
|
82
85
|
const { uuid: id, email, ...otherParams } = res.data.data;
|
|
83
|
-
const
|
|
84
|
-
opinions.userInfo = {
|
|
85
|
-
...opinions.userInfo,
|
|
86
|
+
const userInfo = {
|
|
86
87
|
id,
|
|
87
88
|
email,
|
|
88
89
|
...otherParams,
|
|
89
90
|
department: '这是一个很长很长的部门部门321312321312',
|
|
90
91
|
position: '这是一个很长很长的职位321312312321321312',
|
|
91
92
|
};
|
|
92
|
-
uni.setStorageSync('opinions', opinions);
|
|
93
93
|
uni.request({
|
|
94
94
|
url: `${baseUrl}/api/gatewayproxy/routing/getToken?t=${Date.now()}`,
|
|
95
95
|
method: 'POST',
|
|
96
96
|
success: (res: any) => {
|
|
97
97
|
uni.hideLoading();
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
emit('loginSuccess', {
|
|
99
|
+
token: res.data.data,
|
|
100
|
+
userInfo,
|
|
101
|
+
});
|
|
100
102
|
uni.showToast({
|
|
101
103
|
title: '登录成功',
|
|
102
104
|
});
|
|
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
105
|
},
|
|
112
106
|
});
|
|
113
107
|
},
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<image v-if="isShow" :src="imgSrc" class="img-box" @error="handleImgError" />
|
|
3
|
+
<image v-else src="@/static/icon/userinro.svg" class="img-box" />
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script lang="ts" setup>
|
|
7
|
+
import { computed, ref } from 'vue';
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
username: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: uni.getStorageSync('userInfo')?.username,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const isShow = ref(true);
|
|
16
|
+
const baseUrl = uni.getStorageSync('baseUrl');
|
|
17
|
+
const imgSrc = computed(() => {
|
|
18
|
+
return `${baseUrl === '' ? 'http://192.168.10.11:8065' : baseUrl}/api/v4/users/image/notrust?id=${props.username}`;
|
|
19
|
+
});
|
|
20
|
+
const handleImgError = () => {
|
|
21
|
+
isShow.value = false;
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
<style scoped lang="scss">
|
|
25
|
+
.img-box {
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
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.6",
|
|
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",
|
|
@@ -35,9 +36,20 @@
|
|
|
35
36
|
"rollup-plugin-terser": "^7.0.2",
|
|
36
37
|
"rollup-plugin-typescript2": "^0.27.2",
|
|
37
38
|
"rollup-plugin-vue": "^6.0.0",
|
|
38
|
-
"typescript": "^4.0.2"
|
|
39
|
+
"typescript": "^4.0.2",
|
|
40
|
+
"uniapp-log-sdk": "^1.1.1",
|
|
41
|
+
"uview-plus": "^3.1.30",
|
|
42
|
+
"@vueuse/core": "^9.12.0",
|
|
43
|
+
"clipboard": "^2.0.11",
|
|
44
|
+
"dayjs": "1.11.7",
|
|
45
|
+
"@dcloudio/uni-ui": "^1.4.26"
|
|
39
46
|
},
|
|
40
47
|
"peerDependencies": {
|
|
41
|
-
"uniapp-log-sdk": "^1.1.1"
|
|
48
|
+
"uniapp-log-sdk": "^1.1.1",
|
|
49
|
+
"uview-plus": "^3.1.30",
|
|
50
|
+
"@vueuse/core": "^9.12.0",
|
|
51
|
+
"clipboard": "^2.0.11",
|
|
52
|
+
"dayjs": "1.11.7",
|
|
53
|
+
"@dcloudio/uni-ui": "^1.4.26"
|
|
42
54
|
}
|
|
43
55
|
}
|
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
|
+
};
|