wui-components-v2 1.2.21 → 1.2.23
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/login-form/login-form.vue +9 -1
- package/components/login-form-box/login-form-box.vue +14 -2
- package/components/phone-login-form/phone-login-form.vue +9 -1
- package/components/search/search.vue +63 -35
- package/components/wui-edit-page/wui-edit-page.vue +1 -1
- package/components/wui-login/wui-login.vue +12 -1
- package/composables/types/user.ts +2 -0
- package/package.json +1 -1
- package/styles/dark-mode.scss +498 -498
- package/styles/dark-mode.css +0 -523
- package/styles/dark-mode.min.css +0 -1
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { defineOptions, defineProps, reactive, ref } from 'vue'
|
|
2
|
+
import { defineEmits, defineOptions, defineProps, reactive, ref } from 'vue'
|
|
3
3
|
import { useRouter } from 'uni-mini-router'
|
|
4
4
|
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
5
5
|
import { getUserConfig, login } from '../../api/login'
|
|
6
6
|
import { useUser } from '../../composables/useUser'
|
|
7
7
|
import { useTabbar } from '../../composables/useTabbar'
|
|
8
8
|
import type { TabbarItem } from '../../composables/useTabbar'
|
|
9
|
+
import type { UserInfo } from '../../composables/types/user'
|
|
9
10
|
|
|
10
11
|
defineOptions({
|
|
11
12
|
name: 'LoginForm',
|
|
12
13
|
})
|
|
13
14
|
|
|
14
15
|
const props = defineProps<Props>()
|
|
16
|
+
|
|
17
|
+
// 登录成功回调,向父级抛出用户信息
|
|
18
|
+
const emit = defineEmits<{
|
|
19
|
+
'login-success': [user: UserInfo]
|
|
20
|
+
}>()
|
|
15
21
|
// 定义 Props 类型
|
|
16
22
|
interface Props {
|
|
17
23
|
tabbarItems: TabbarItem[]
|
|
@@ -52,6 +58,8 @@ function handleSubmit() {
|
|
|
52
58
|
if (res1.status === 'success') {
|
|
53
59
|
// 保存用户信息
|
|
54
60
|
setUserInfo(res1.user)
|
|
61
|
+
// 抛出登录成功事件(携带用户信息)
|
|
62
|
+
emit('login-success', res1.user)
|
|
55
63
|
|
|
56
64
|
// 记住账号密码
|
|
57
65
|
if (model.remember) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { defineOptions, defineProps, ref } from 'vue'
|
|
2
|
+
import { defineEmits, defineOptions, defineProps, ref } from 'vue'
|
|
3
3
|
import { useRouter } from 'uni-mini-router'
|
|
4
4
|
import type { TabbarItem } from '../../composables/useTabbar'
|
|
5
|
+
import type { UserInfo } from '../../composables/types/user'
|
|
5
6
|
import loginForm from '../login-form/login-form.vue'
|
|
6
7
|
import phoneLoginForm from '../phone-login-form/phone-login-form.vue'
|
|
7
8
|
|
|
@@ -19,6 +20,16 @@ interface Props {
|
|
|
19
20
|
}
|
|
20
21
|
const router = useRouter()
|
|
21
22
|
|
|
23
|
+
// 登录成功回调,向父级抛出用户信息
|
|
24
|
+
const emit = defineEmits<{
|
|
25
|
+
'login-success': [user: UserInfo]
|
|
26
|
+
}>()
|
|
27
|
+
|
|
28
|
+
// 透传子组件登录成功事件
|
|
29
|
+
function onLoginSuccess(user: UserInfo) {
|
|
30
|
+
emit('login-success', user)
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
// 登录模式
|
|
23
34
|
const loginMode = ref('account')
|
|
24
35
|
|
|
@@ -41,9 +52,10 @@ function changeLoginMode(mode: string) {
|
|
|
41
52
|
:tabbar-items="props.tabbarItems"
|
|
42
53
|
:url="props.url"
|
|
43
54
|
:gurl="props.gurl"
|
|
55
|
+
@login-success="onLoginSuccess"
|
|
44
56
|
/>
|
|
45
57
|
<!-- //账号登录 -->
|
|
46
|
-
<loginForm v-if="loginMode === 'account'" :tabbar-items="props.tabbarItems" />
|
|
58
|
+
<loginForm v-if="loginMode === 'account'" :tabbar-items="props.tabbarItems" @login-success="onLoginSuccess" />
|
|
47
59
|
|
|
48
60
|
<view v-if="props.gurl" class="pa-3 pt-0">
|
|
49
61
|
<wd-divider>或</wd-divider>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { defineOptions, defineProps, onUnmounted, reactive, ref } from 'vue'
|
|
2
|
+
import { defineEmits, defineOptions, defineProps, onUnmounted, reactive, ref } from 'vue'
|
|
3
3
|
import { useRouter } from 'uni-mini-router'
|
|
4
4
|
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
5
5
|
import { getUserConfig } from '../../api/login'
|
|
@@ -7,12 +7,18 @@ import { req } from '../../api/index'
|
|
|
7
7
|
import { useUser } from '../../composables/useUser'
|
|
8
8
|
import { useTabbar } from '../../composables/useTabbar'
|
|
9
9
|
import type { TabbarItem } from '../../composables/useTabbar'
|
|
10
|
+
import type { UserInfo } from '../../composables/types/user'
|
|
10
11
|
|
|
11
12
|
defineOptions({
|
|
12
13
|
name: 'PhoneLoginForm',
|
|
13
14
|
})
|
|
14
15
|
|
|
15
16
|
const props = defineProps<Props>()
|
|
17
|
+
|
|
18
|
+
// 登录成功回调,向父级抛出用户信息
|
|
19
|
+
const emit = defineEmits<{
|
|
20
|
+
'login-success': [user: UserInfo]
|
|
21
|
+
}>()
|
|
16
22
|
// 定义 Props 类型
|
|
17
23
|
interface Props {
|
|
18
24
|
gurl?: string// 获取验证码接口
|
|
@@ -144,6 +150,8 @@ function handleSubmit() {
|
|
|
144
150
|
if (res1.status === 'success') {
|
|
145
151
|
// 保存用户信息
|
|
146
152
|
setUserInfo(res1.user)
|
|
153
|
+
// 抛出登录成功事件(携带用户信息)
|
|
154
|
+
emit('login-success', res1.user)
|
|
147
155
|
// 跳转首页
|
|
148
156
|
router.pushTab('/pages/index/index')
|
|
149
157
|
setTabbarItemActive('index')
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, defineEmits, defineOptions, defineProps, ref } from 'vue'
|
|
3
3
|
import type { Enums, Fields, Split2TabCriterias } from '../../type'
|
|
4
4
|
import formControl from '../form-control/form-control.vue'
|
|
5
|
+
import { useManualThemeStore } from '../../store/manualThemeStore'
|
|
5
6
|
|
|
6
7
|
defineOptions({ name: 'Search' })
|
|
7
8
|
const props = defineProps<{
|
|
@@ -12,6 +13,10 @@ const props = defineProps<{
|
|
|
12
13
|
split2TabCriterias?: Split2TabCriterias[]
|
|
13
14
|
}>()
|
|
14
15
|
const emits = defineEmits(['submit'])
|
|
16
|
+
// 自行携带暗色主题,避免在非 tabBar 页面(无 wd-config-provider 祖先)时
|
|
17
|
+
// wot 组件保持亮色导致 search-type 等区域显示为白色
|
|
18
|
+
const themeStore = useManualThemeStore()
|
|
19
|
+
const theme = computed(() => themeStore.theme)
|
|
15
20
|
const show = ref(false)
|
|
16
21
|
const search = ref('')
|
|
17
22
|
const formControlRef = ref()
|
|
@@ -19,8 +24,7 @@ const entity = ref({})
|
|
|
19
24
|
const filterCriteria = computed(() => {
|
|
20
25
|
const criteriaSourceIds = props.split2TabCriterias?.map(item => item.sourceId) || []
|
|
21
26
|
const primarySourceId = props.primaryCriterion?.sourceId
|
|
22
|
-
if (!primarySourceId)
|
|
23
|
-
return props.criteria
|
|
27
|
+
if (!primarySourceId) return props.criteria
|
|
24
28
|
return props.criteria.filter(item => ![primarySourceId, ...criteriaSourceIds].includes(item.sourceId))
|
|
25
29
|
})
|
|
26
30
|
function handleClose() {
|
|
@@ -28,8 +32,7 @@ function handleClose() {
|
|
|
28
32
|
}
|
|
29
33
|
function handleSubmit() {
|
|
30
34
|
if (!formControlRef.value) {
|
|
31
|
-
if (!props.primaryCriterion?.sourceId)
|
|
32
|
-
return
|
|
35
|
+
if (!props.primaryCriterion?.sourceId) return
|
|
33
36
|
const data = `c_${props.primaryCriterion.sourceId}=${search.value}`
|
|
34
37
|
emits('submit', data)
|
|
35
38
|
handleClose()
|
|
@@ -46,22 +49,22 @@ function handleSubmit() {
|
|
|
46
49
|
data = `c_${props.primaryCriterion.sourceId}=${search.value}`
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
filterCriteria.value.forEach(
|
|
52
|
+
filterCriteria.value.forEach(item => {
|
|
50
53
|
for (const key in fdata) {
|
|
51
54
|
if (Object.prototype.hasOwnProperty.call(fdata, key)) {
|
|
52
55
|
const element = fdata[key]
|
|
53
56
|
if (item.sourceId === key) {
|
|
54
57
|
if (item.extControlType === 'relselectvalue') {
|
|
55
|
-
data = `${data}&c_${item.sourceId}=${element
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
data = `${data}&c_${item.sourceId}=${element
|
|
59
|
+
.map((item: string) => {
|
|
60
|
+
return item.split('@R@')[1]
|
|
61
|
+
})
|
|
62
|
+
.join('@,@')}`
|
|
63
|
+
} else if (item.extControlType === 'multiselect') {
|
|
60
64
|
element.forEach((subitem: string) => {
|
|
61
65
|
data = `${data}&c_${item.sourceId}=${subitem}`
|
|
62
66
|
})
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
67
|
+
} else {
|
|
65
68
|
data = `${data}&c_${item.sourceId}=${element}`
|
|
66
69
|
}
|
|
67
70
|
}
|
|
@@ -78,29 +81,56 @@ function handleSubmit() {
|
|
|
78
81
|
</script>
|
|
79
82
|
|
|
80
83
|
<template>
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
<wd-config-provider :theme="theme">
|
|
85
|
+
<view v-if="primaryCriterion?.controlType === 'text'" class="w-full">
|
|
86
|
+
<wd-search
|
|
87
|
+
v-model="search"
|
|
88
|
+
cancel-txt="搜索"
|
|
89
|
+
:placeholder="`请输入${primaryCriterion?.title || ''}搜索`"
|
|
90
|
+
@clear="handleSubmit"
|
|
91
|
+
@cancel="handleSubmit"
|
|
92
|
+
>
|
|
93
|
+
<template v-if="filterCriteria.length" #prefix>
|
|
94
|
+
<view class="search-type">
|
|
95
|
+
<wd-icon
|
|
96
|
+
name="filter"
|
|
97
|
+
size="17px"
|
|
98
|
+
class="text-gray-500 dark:text-[var(--wot-dark-color3)]"
|
|
99
|
+
@click="show = true"
|
|
100
|
+
/>
|
|
101
|
+
</view>
|
|
102
|
+
</template>
|
|
103
|
+
</wd-search>
|
|
104
|
+
</view>
|
|
105
|
+
<wd-popup v-model="show" position="bottom" custom-class="h-80vh" closable @close="handleClose">
|
|
106
|
+
<view class="relative box-border h-full p-1 bg-white dark:bg-[var(--wot-dark-background)]">
|
|
107
|
+
<view class="h-34px flex items-center justify-center text-black dark:text-[var(--wot-dark-color)]">筛i选</view>
|
|
108
|
+
<formControl
|
|
109
|
+
ref="formControlRef"
|
|
110
|
+
:field-group="{
|
|
111
|
+
fields: filterCriteria,
|
|
112
|
+
readOnly: false,
|
|
113
|
+
displayConfig: [],
|
|
114
|
+
id: '',
|
|
115
|
+
buttons: [],
|
|
116
|
+
title: '',
|
|
117
|
+
type: '',
|
|
118
|
+
pointSourceId: '',
|
|
119
|
+
mstrucId: '',
|
|
120
|
+
relationNames: [],
|
|
121
|
+
}"
|
|
122
|
+
:entity="entity"
|
|
123
|
+
:enum-column="enumColumn"
|
|
124
|
+
/>
|
|
125
|
+
<view class="h-12" />
|
|
126
|
+
<view
|
|
127
|
+
class="fixed bottom-0 left-0 right-0 box-border w-100% flex p-2 bg-white dark:bg-[var(--wot-dark-background)]"
|
|
128
|
+
>
|
|
129
|
+
<wd-button block custom-class="flex-1" @click="handleSubmit">确定</wd-button>
|
|
86
130
|
</view>
|
|
87
|
-
</template>
|
|
88
|
-
</wd-search>
|
|
89
|
-
</view>
|
|
90
|
-
<wd-popup v-model="show" position="bottom" custom-class="h-80vh" closable @close="handleClose">
|
|
91
|
-
<view class="relative box-border h-full p-1 bg-white dark:bg-[var(--wot-dark-background)]">
|
|
92
|
-
<view class="h-34px flex items-center justify-center">
|
|
93
|
-
筛选
|
|
94
|
-
</view>
|
|
95
|
-
<formControl ref="formControlRef" :field-group="{ fields: filterCriteria, readOnly: false, displayConfig: [], id: '', buttons: [], title: '', type: '', pointSourceId: '', mstrucId: '', relationNames: [] }" :entity="entity" :enum-column="enumColumn" />
|
|
96
|
-
<view class="h-12" />
|
|
97
|
-
<view class="fixed bottom-0 left-0 right-0 box-border w-100% flex p-2 bg-white dark:bg-[var(--wot-dark-background)]">
|
|
98
|
-
<wd-button block custom-class="flex-1" @click="handleSubmit">
|
|
99
|
-
确定
|
|
100
|
-
</wd-button>
|
|
101
131
|
</view>
|
|
102
|
-
</
|
|
103
|
-
</wd-
|
|
132
|
+
</wd-popup>
|
|
133
|
+
</wd-config-provider>
|
|
104
134
|
</template>
|
|
105
135
|
|
|
106
136
|
<style scoped>
|
|
@@ -123,6 +153,4 @@ function handleSubmit() {
|
|
|
123
153
|
font-size: 20px;
|
|
124
154
|
vertical-align: middle;
|
|
125
155
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
156
|
</style>
|
|
@@ -871,7 +871,7 @@ console.log(pageConfig, 'props111')
|
|
|
871
871
|
<template #title>
|
|
872
872
|
<view class="flex items-center justify-between">
|
|
873
873
|
<view class="flex-1 flex items-center justify-between pr-2">
|
|
874
|
-
<view>{{ group.title }}</view>
|
|
874
|
+
<view class="text-[#000]">{{ group.title }}</view>
|
|
875
875
|
<view v-if="group.type === 'relation'">
|
|
876
876
|
<view v-if="selectData[group.id]?.loading" class="flex justify-center p-3">
|
|
877
877
|
<wd-loading />
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!-- 纯色风格登录页面 -->
|
|
2
2
|
<script setup lang="ts">
|
|
3
|
-
import { defineOptions, defineProps } from 'vue'
|
|
4
3
|
import loginFormBox from '../login-form-box/login-form-box.vue'
|
|
5
4
|
import { useManualTheme } from '../../composables/useManualTheme'
|
|
6
5
|
import type { TabbarItem } from '../../composables/useTabbar'
|
|
6
|
+
import type { UserInfo } from '../../composables/types/user'
|
|
7
7
|
import companyLogo from '../../static/companyLogo.png'
|
|
8
8
|
|
|
9
9
|
defineOptions({
|
|
@@ -21,6 +21,16 @@ interface Props {
|
|
|
21
21
|
customLoginImg?: string // 自定义登录图片(默认使用 companyLogo)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// 登录成功回调,向父级抛出用户信息
|
|
25
|
+
const emit = defineEmits<{
|
|
26
|
+
'login-success': [user: UserInfo]
|
|
27
|
+
}>()
|
|
28
|
+
|
|
29
|
+
// 透传登录成功事件
|
|
30
|
+
function onLoginSuccess(user: UserInfo) {
|
|
31
|
+
emit('login-success', user)
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
const props = withDefaults(defineProps<Props>(), {
|
|
25
35
|
showRagister: false,
|
|
26
36
|
gurl: '',
|
|
@@ -53,6 +63,7 @@ const { currentThemeColor } = useManualTheme()
|
|
|
53
63
|
:show-ragister="showRagister"
|
|
54
64
|
:gurl="props.gurl"
|
|
55
65
|
:url="props.url"
|
|
66
|
+
@login-success="onLoginSuccess"
|
|
56
67
|
/>
|
|
57
68
|
</view>
|
|
58
69
|
</view>
|