hy-app 0.1.1
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/README.md +42 -0
- package/api/http.ts +138 -0
- package/api/index.ts +1 -0
- package/common/index.ts +1 -0
- package/common/versionControl.ts +102 -0
- package/components/dialog/TheDialog.vue +128 -0
- package/components/dialog/index.ts +38 -0
- package/components/hy-address-picker/hy-address-picker.vue +262 -0
- package/components/hy-address-picker/props.ts +27 -0
- package/components/hy-address-picker/typing.d.ts +98 -0
- package/components/hy-avatar/hy-avatar.vue +217 -0
- package/components/hy-avatar/props.ts +20 -0
- package/components/hy-avatar/typing.d.ts +64 -0
- package/components/hy-back-top/hy-back-top.vue +71 -0
- package/components/hy-back-top/props.ts +23 -0
- package/components/hy-back-top/typing.d.ts +49 -0
- package/components/hy-badge/hy-badge.vue +155 -0
- package/components/hy-badge/props.ts +19 -0
- package/components/hy-badge/typing.d.ts +60 -0
- package/components/hy-button/hy-button.vue +394 -0
- package/components/hy-button/props.ts +36 -0
- package/components/hy-button/typing.d.ts +125 -0
- package/components/hy-card/hy-card.vue +198 -0
- package/components/hy-card/props.ts +29 -0
- package/components/hy-card/typing.d.ts +112 -0
- package/components/hy-cell/hy-cell.vue +268 -0
- package/components/hy-cell/props.ts +20 -0
- package/components/hy-cell/typing.d.ts +98 -0
- package/components/hy-check-button/hy-check-button.vue +71 -0
- package/components/hy-check-button/props.ts +20 -0
- package/components/hy-check-button/typing.d.ts +79 -0
- package/components/hy-checkbox/hy-checkbox.vue +299 -0
- package/components/hy-checkbox/props.ts +28 -0
- package/components/hy-checkbox/typing.d.ts +77 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +584 -0
- package/components/hy-datetime-picker/props.ts +36 -0
- package/components/hy-datetime-picker/typing.d.ts +135 -0
- package/components/hy-divider/hy-divider.vue +164 -0
- package/components/hy-divider/props.ts +21 -0
- package/components/hy-divider/typing.d.ts +64 -0
- package/components/hy-empty/hy-empty.vue +122 -0
- package/components/hy-empty/props.ts +21 -0
- package/components/hy-empty/typing.d.ts +68 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +94 -0
- package/components/hy-folding-panel/props.ts +17 -0
- package/components/hy-folding-panel/typing.d.ts +59 -0
- package/components/hy-form/hy-form.vue +372 -0
- package/components/hy-form/props.ts +15 -0
- package/components/hy-form/typing.d.ts +51 -0
- package/components/hy-grid/hy-grid.vue +126 -0
- package/components/hy-grid/props.ts +16 -0
- package/components/hy-grid/typing.d.ts +62 -0
- package/components/hy-icon/hy-icon.vue +207 -0
- package/components/hy-icon/props.ts +24 -0
- package/components/hy-icon/typing.d.ts +80 -0
- package/components/hy-input/hy-input.vue +402 -0
- package/components/hy-input/props.ts +41 -0
- package/components/hy-input/typing.d.ts +148 -0
- package/components/hy-line/hy-line.vue +44 -0
- package/components/hy-line/props.ts +12 -0
- package/components/hy-line/typing.d.ts +32 -0
- package/components/hy-line-progress/hy-line-progress.vue +118 -0
- package/components/hy-line-progress/props.ts +12 -0
- package/components/hy-line-progress/typing.d.ts +28 -0
- package/components/hy-list/hy-list.vue +250 -0
- package/components/hy-list/props.ts +18 -0
- package/components/hy-list/typing.d.ts +50 -0
- package/components/hy-login/ThePhoneLogin.vue +106 -0
- package/components/hy-login/TheUserLogin.vue +391 -0
- package/components/hy-login/hy-login.vue +283 -0
- package/components/hy-login/props.ts +32 -0
- package/components/hy-login/typing.d.ts +60 -0
- package/components/hy-modal/hy-modal.vue +240 -0
- package/components/hy-modal/props.ts +24 -0
- package/components/hy-modal/typing.d.ts +70 -0
- package/components/hy-navbar/hy-navbar.vue +194 -0
- package/components/hy-navbar/props.ts +24 -0
- package/components/hy-navbar/typing.d.ts +81 -0
- package/components/hy-notice-bar/hy-column-notice.vue +130 -0
- package/components/hy-notice-bar/hy-notice-bar.vue +82 -0
- package/components/hy-notice-bar/hy-row-notice.vue +182 -0
- package/components/hy-notice-bar/props.ts +19 -0
- package/components/hy-notice-bar/typing.d.ts +56 -0
- package/components/hy-number-step/hy-number-step.vue +428 -0
- package/components/hy-number-step/props.ts +29 -0
- package/components/hy-number-step/typing.d.ts +104 -0
- package/components/hy-overlay/hy-overlay.vue +54 -0
- package/components/hy-overlay/props.ts +10 -0
- package/components/hy-overlay/typing.d.ts +24 -0
- package/components/hy-picker/hy-picker.vue +499 -0
- package/components/hy-picker/props.ts +30 -0
- package/components/hy-picker/typing.d.ts +115 -0
- package/components/hy-popup/hy-popup.vue +269 -0
- package/components/hy-popup/props.ts +21 -0
- package/components/hy-popup/typing.d.ts +68 -0
- package/components/hy-price/hy-price.vue +86 -0
- package/components/hy-price/props.ts +13 -0
- package/components/hy-price/typing.d.ts +36 -0
- package/components/hy-qrcode/hy-qrcode.vue +153 -0
- package/components/hy-qrcode/props.ts +20 -0
- package/components/hy-qrcode/qrcode.js +1364 -0
- package/components/hy-qrcode/typing.d.ts +64 -0
- package/components/hy-radio/hy-radio.vue +319 -0
- package/components/hy-radio/props.ts +28 -0
- package/components/hy-radio/typing.d.ts +85 -0
- package/components/hy-rate/hy-rate.vue +261 -0
- package/components/hy-rate/props.ts +18 -0
- package/components/hy-rate/typing.d.ts +60 -0
- package/components/hy-read-more/hy-read-more.vue +134 -0
- package/components/hy-read-more/props.ts +20 -0
- package/components/hy-read-more/typing.d.ts +44 -0
- package/components/hy-safe-bottom/hy-safe-bottom.vue +64 -0
- package/components/hy-scroll-list/hy-scroll-list.vue +146 -0
- package/components/hy-scroll-list/props.ts +12 -0
- package/components/hy-scroll-list/typing.d.ts +28 -0
- package/components/hy-search/hy-search.vue +294 -0
- package/components/hy-search/props.ts +29 -0
- package/components/hy-search/typing.d.ts +109 -0
- package/components/hy-slider/hy-slider.vue +511 -0
- package/components/hy-slider/props.ts +21 -0
- package/components/hy-slider/typing.d.ts +68 -0
- package/components/hy-steps/hy-steps.vue +352 -0
- package/components/hy-steps/props.ts +15 -0
- package/components/hy-steps/typing.d.ts +58 -0
- package/components/hy-subsection/hy-subsection.vue +272 -0
- package/components/hy-subsection/props.ts +16 -0
- package/components/hy-subsection/typing.d.ts +44 -0
- package/components/hy-swiper/hy-swiper-indicator.vue +105 -0
- package/components/hy-swiper/hy-swiper.vue +242 -0
- package/components/hy-swiper/props.ts +30 -0
- package/components/hy-swiper/typing.d.ts +107 -0
- package/components/hy-switch/hy-switch.vue +168 -0
- package/components/hy-switch/props.ts +16 -0
- package/components/hy-switch/typing.d.ts +48 -0
- package/components/hy-tabs/hy-tabs.vue +416 -0
- package/components/hy-tabs/props.ts +26 -0
- package/components/hy-tabs/typing.d.ts +86 -0
- package/components/hy-tag/hy-tag.vue +374 -0
- package/components/hy-tag/props.ts +22 -0
- package/components/hy-tag/typing.d.ts +76 -0
- package/components/hy-textarea/hy-textarea.vue +229 -0
- package/components/hy-textarea/props.ts +26 -0
- package/components/hy-textarea/typing.d.ts +27 -0
- package/components/hy-tooltip/hy-tooltip.vue +332 -0
- package/components/hy-tooltip/props.ts +17 -0
- package/components/hy-tooltip/typing.d.ts +52 -0
- package/components/hy-transition/hy-transition.vue +150 -0
- package/components/hy-transition/index.scss +113 -0
- package/components/hy-transition/props.ts +10 -0
- package/components/hy-transition/typing.d.ts +36 -0
- package/components/hy-upload/hy-upload.vue +557 -0
- package/components/hy-upload/props.ts +29 -0
- package/components/hy-upload/typing.d.ts +147 -0
- package/components/hy-warn/hy-warn.vue +228 -0
- package/components/hy-warn/props.ts +14 -0
- package/components/hy-warn/typing.d.ts +40 -0
- package/components/hy-waterfall/hy-waterfall.vue +51 -0
- package/components/hy-waterfall/props.ts +10 -0
- package/components/hy-waterfall/typing.d.ts +20 -0
- package/components/index.ts +162 -0
- package/components/message/TheMessage.vue +169 -0
- package/components/message/index.ts +54 -0
- package/components/u-form/form.js +22 -0
- package/components/u-form/hy-form.vue +324 -0
- package/components/u-form/props.js +49 -0
- package/components/u-form/schema.js +1451 -0
- package/components/u-form/u-form.vue +267 -0
- package/components/u-form/utils.js +65 -0
- package/components/u-form-item/formItem.js +24 -0
- package/components/u-form-item/hy-form-item.vue +360 -0
- package/components/u-form-item/props.js +57 -0
- package/components/u-form-item/u-form-item.vue +294 -0
- package/components/yk-dialog/yk-dialog.vue +129 -0
- package/components/yk-tabbar/props.ts +49 -0
- package/components/yk-tabbar/yk-tabbar.vue +224 -0
- package/config/color.ts +6 -0
- package/config/icon.ts +366 -0
- package/config/index.ts +2 -0
- package/global/index.ts +6 -0
- package/global/register-properties.ts +37 -0
- package/index.ts +8 -0
- package/libs/css/common.scss +0 -0
- package/libs/css/iconfont.css +379 -0
- package/libs/css/iconfont.ttf +0 -0
- package/libs/css/mixin.scss +15 -0
- package/package.json +42 -0
- package/public/icons/error.png +0 -0
- package/public/icons/success.png +0 -0
- package/public/icons/warning.png +0 -0
- package/store/index.ts +1 -0
- package/store/userInfo.ts +25 -0
- package/theme.scss +94 -0
- package/typing/index.ts +7 -0
- package/typing/modules/common.d.ts +50 -0
- package/typing/modules/dialog.ts +17 -0
- package/typing/modules/enum.ts +67 -0
- package/typing/modules/form.ts +161 -0
- package/typing/modules/http.ts +68 -0
- package/typing/modules/icon.d.ts +366 -0
- package/typing/modules/img.ts +15 -0
- package/typing/modules/rect.ts +10 -0
- package/utils/address.json +5890 -0
- package/utils/base64.ts +119 -0
- package/utils/index.ts +3 -0
- package/utils/inside.ts +310 -0
- package/utils/utils.ts +446 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="normal-login-container">
|
|
3
|
+
<view class="logo-content align-center flex justify-center">
|
|
4
|
+
<image class="image" :src="props.logo" mode="widthFix"></image>
|
|
5
|
+
</view>
|
|
6
|
+
<!-- 登录 -->
|
|
7
|
+
<view class="login-form-content">
|
|
8
|
+
<view class="form-top">
|
|
9
|
+
<view
|
|
10
|
+
class="top-col"
|
|
11
|
+
v-for="(item, i) in tabs"
|
|
12
|
+
:key="i"
|
|
13
|
+
@tap="currentTab = i"
|
|
14
|
+
>
|
|
15
|
+
<view class="form-top-title">
|
|
16
|
+
{{ item.name }}
|
|
17
|
+
</view>
|
|
18
|
+
<view
|
|
19
|
+
:class="i === currentTab ? 'line' : ''"
|
|
20
|
+
:style="'background:' + props.themeColor"
|
|
21
|
+
></view>
|
|
22
|
+
</view>
|
|
23
|
+
</view>
|
|
24
|
+
<TheUserLogin
|
|
25
|
+
v-if="'user' === indexCode(currentTab)"
|
|
26
|
+
ref="userLoginRef"
|
|
27
|
+
:themeColor="props.themeColor"
|
|
28
|
+
:prefix="props.prefix"
|
|
29
|
+
:isShowPwd="isShowPwd"
|
|
30
|
+
:userPlaceholder="userPlaceholder"
|
|
31
|
+
:pwdPlaceholder="pwdPlaceholder"
|
|
32
|
+
:customUserValidator="props.customUserValidator"
|
|
33
|
+
:customPwdValidator="props.customPwdValidator"
|
|
34
|
+
:userNumValidator="props.userNumValidator"
|
|
35
|
+
:pwdNumValidator="props.pwdNumValidator"
|
|
36
|
+
/>
|
|
37
|
+
<ThePhoneLogin
|
|
38
|
+
v-if="'phone' === indexCode(currentTab)"
|
|
39
|
+
ref="phoneLoginRef"
|
|
40
|
+
:themeColor="props.themeColor"
|
|
41
|
+
:customPhoneValidator="props.customPhoneValidator"
|
|
42
|
+
/>
|
|
43
|
+
<view class="action-btn">
|
|
44
|
+
<HyButton class="login-btn" :color="props.themeColor" @click="loginFn"
|
|
45
|
+
>登录
|
|
46
|
+
</HyButton>
|
|
47
|
+
</view>
|
|
48
|
+
<view class="footer">
|
|
49
|
+
<view
|
|
50
|
+
class="footer__tips"
|
|
51
|
+
v-for="(item, i) in menu"
|
|
52
|
+
:key="i"
|
|
53
|
+
@click="clickMenuFn(i)"
|
|
54
|
+
>{{ item }}</view
|
|
55
|
+
>
|
|
56
|
+
</view>
|
|
57
|
+
</view>
|
|
58
|
+
</view>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script lang="ts" setup>
|
|
62
|
+
import { ref, toRefs, computed, watch } from "vue";
|
|
63
|
+
import { storeToRefs } from "pinia";
|
|
64
|
+
import { encryptData } from "../../utils";
|
|
65
|
+
import { useUserInfo } from "../../store";
|
|
66
|
+
import defaultProps from "./props";
|
|
67
|
+
import IProps from "./typing";
|
|
68
|
+
|
|
69
|
+
// 组件
|
|
70
|
+
import TheUserLogin from "./TheUserLogin.vue";
|
|
71
|
+
import ThePhoneLogin from "./ThePhoneLogin.vue";
|
|
72
|
+
import HyButton from "../hy-button/hy-button.vue";
|
|
73
|
+
|
|
74
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
75
|
+
const emit = defineEmits(["login", "handleClickMenu"]);
|
|
76
|
+
|
|
77
|
+
const userInfoStore = useUserInfo();
|
|
78
|
+
const { userForm, rememberPsw } = storeToRefs(userInfoStore);
|
|
79
|
+
const indexCode = computed(() => {
|
|
80
|
+
return (temp: string | number) => {
|
|
81
|
+
switch (Number(props.loginType)) {
|
|
82
|
+
case 1:
|
|
83
|
+
return "user";
|
|
84
|
+
case 2:
|
|
85
|
+
return "phone";
|
|
86
|
+
default:
|
|
87
|
+
if (temp == 0) {
|
|
88
|
+
return "user";
|
|
89
|
+
} else {
|
|
90
|
+
return "phone";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
const selectModel = (temp: number) => {
|
|
96
|
+
return new Promise((resolve, reject) => {
|
|
97
|
+
switch (Number(props.loginType)) {
|
|
98
|
+
case 1:
|
|
99
|
+
resolve("user");
|
|
100
|
+
break;
|
|
101
|
+
case 2:
|
|
102
|
+
resolve("phone");
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
if (temp == 0) {
|
|
106
|
+
resolve("user");
|
|
107
|
+
} else {
|
|
108
|
+
resolve("phone");
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
const tabs = ref([
|
|
115
|
+
{
|
|
116
|
+
name: "账号登录"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "验证码登录"
|
|
120
|
+
}
|
|
121
|
+
]);
|
|
122
|
+
const currentTab = ref(0);
|
|
123
|
+
const userLoginRef = ref<typeof TheUserLogin>(null);
|
|
124
|
+
const phoneLoginRef = ref<typeof ThePhoneLogin>(null);
|
|
125
|
+
watch(
|
|
126
|
+
() => Number(props.loginType),
|
|
127
|
+
(newVal) => {
|
|
128
|
+
tabs.value = computed(() => {
|
|
129
|
+
switch (newVal) {
|
|
130
|
+
case 1:
|
|
131
|
+
return [{ name: "账号登录" }];
|
|
132
|
+
case 2:
|
|
133
|
+
return [{ name: "验证码登录" }];
|
|
134
|
+
default:
|
|
135
|
+
return [{ name: "账号登录" }, { name: "验证码登录" }];
|
|
136
|
+
}
|
|
137
|
+
}).value;
|
|
138
|
+
},
|
|
139
|
+
{ immediate: true, deep: true }
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* 登录用户名
|
|
144
|
+
* */
|
|
145
|
+
const loginFn = async () => {
|
|
146
|
+
const type = await selectModel(currentTab.value);
|
|
147
|
+
switch (type) {
|
|
148
|
+
case "user":
|
|
149
|
+
let user = userForm.value.name;
|
|
150
|
+
let pwd = userForm.value.pwd;
|
|
151
|
+
await userLoginRef.value.loginFn();
|
|
152
|
+
//缓存账号和密码
|
|
153
|
+
if (rememberPsw.value == 1) {
|
|
154
|
+
uni.setStorageSync(
|
|
155
|
+
`${props.prefix}_account`,
|
|
156
|
+
encryptData({
|
|
157
|
+
rememberPsw: rememberPsw.value,
|
|
158
|
+
userName: user,
|
|
159
|
+
password: pwd
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
} else {
|
|
163
|
+
// 如果没有选记住密码就移除之前保存的
|
|
164
|
+
uni.removeStorageSync(`${props.prefix}_account`);
|
|
165
|
+
uni.setStorageSync(
|
|
166
|
+
`${props.prefix}_account`,
|
|
167
|
+
encryptData({ rememberPsw: rememberPsw.value })
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
emit("login", { user, pwd });
|
|
171
|
+
break;
|
|
172
|
+
case "phone":
|
|
173
|
+
await phoneLoginRef.value.loginFn();
|
|
174
|
+
break;
|
|
175
|
+
default:
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 点击下面小菜单
|
|
182
|
+
* */
|
|
183
|
+
const clickMenuFn = (index: number) => {
|
|
184
|
+
emit("handleClickMenu", index);
|
|
185
|
+
};
|
|
186
|
+
</script>
|
|
187
|
+
|
|
188
|
+
<style lang="scss" scoped>
|
|
189
|
+
.normal-login-container {
|
|
190
|
+
width: 100%;
|
|
191
|
+
height: 100vh;
|
|
192
|
+
padding: 0 60rpx;
|
|
193
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
194
|
+
box-sizing: border-box;
|
|
195
|
+
/* #endif */
|
|
196
|
+
display: flex;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
//align-items: center;
|
|
200
|
+
|
|
201
|
+
/*logo图片展示*/
|
|
202
|
+
.logo-content {
|
|
203
|
+
width: 300rpx;
|
|
204
|
+
display: flex;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
align-items: center;
|
|
207
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
208
|
+
margin: 0 auto 100rpx;
|
|
209
|
+
box-sizing: border-box;
|
|
210
|
+
height: auto;
|
|
211
|
+
.image {
|
|
212
|
+
width: 100%;
|
|
213
|
+
height: auto;
|
|
214
|
+
}
|
|
215
|
+
/* #endif */
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/*登录模块*/
|
|
219
|
+
.login-form-content {
|
|
220
|
+
//text-align: center;
|
|
221
|
+
box-shadow: 0px 5px 4px 0px rgba(200, 200, 200, 0.5);
|
|
222
|
+
border-radius: 10px;
|
|
223
|
+
background: #ffffff;
|
|
224
|
+
padding: 28rpx 50rpx 50rpx;
|
|
225
|
+
|
|
226
|
+
.form-top {
|
|
227
|
+
display: flex;
|
|
228
|
+
justify-content: space-around;
|
|
229
|
+
margin-bottom: 40rpx;
|
|
230
|
+
|
|
231
|
+
.top-col {
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
justify-content: center;
|
|
235
|
+
align-items: center;
|
|
236
|
+
|
|
237
|
+
.form-top-title {
|
|
238
|
+
font-size: 28rpx;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.line {
|
|
242
|
+
width: 90rpx;
|
|
243
|
+
height: 4rpx;
|
|
244
|
+
margin-top: 6rpx;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.mui-input-row {
|
|
250
|
+
display: flex;
|
|
251
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
252
|
+
justify-self: start;
|
|
253
|
+
/* #endif */
|
|
254
|
+
margin-top: 27rpx;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.action-btn {
|
|
258
|
+
margin-top: 30rpx;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.footer {
|
|
262
|
+
display: flex;
|
|
263
|
+
justify-content: space-around;
|
|
264
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
265
|
+
margin: auto 20%;
|
|
266
|
+
/* #endif */
|
|
267
|
+
|
|
268
|
+
&__tips {
|
|
269
|
+
font-size: 12px;
|
|
270
|
+
margin-top: 27rpx;
|
|
271
|
+
text-align: center;
|
|
272
|
+
color: grey;
|
|
273
|
+
text-decoration: underline;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.xieyi {
|
|
278
|
+
color: #333;
|
|
279
|
+
margin-top: 40rpx;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
|
|
3
|
+
const defaultProps: IProps = {
|
|
4
|
+
logo: "",
|
|
5
|
+
loginType: 0,
|
|
6
|
+
themeColor: "#20D56E",
|
|
7
|
+
prefix: "gxh",
|
|
8
|
+
isShowPwd: false,
|
|
9
|
+
userPlaceholder: "输入您的用户名",
|
|
10
|
+
pwdPlaceholder: "输入您的密码",
|
|
11
|
+
menu: ["立即注册", "忘记密码?"],
|
|
12
|
+
customUserValidator: () => ({}),
|
|
13
|
+
customPwdValidator: () => ({}),
|
|
14
|
+
userNumValidator: () => ({}),
|
|
15
|
+
pwdNumValidator: () => ({
|
|
16
|
+
min: 6,
|
|
17
|
+
max: 20,
|
|
18
|
+
message: "长度在6-20个字符之间",
|
|
19
|
+
trigger: ["blur", "change"]
|
|
20
|
+
}),
|
|
21
|
+
customPhoneValidator: () => ({
|
|
22
|
+
// 自定义验证函数,见上说明
|
|
23
|
+
validator: (rule, value, callback) => {
|
|
24
|
+
// 上面有说,返回true表示校验通过,返回false表示不通过
|
|
25
|
+
return /^[1][0-9]{10}$/.test(value);
|
|
26
|
+
},
|
|
27
|
+
message: "手机号码不正确",
|
|
28
|
+
trigger: ["change", "blur"]
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default defaultProps;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export default interface IProps {
|
|
2
|
+
/**
|
|
3
|
+
* @description 登录logo
|
|
4
|
+
* */
|
|
5
|
+
logo?: string;
|
|
6
|
+
/**
|
|
7
|
+
* @description 登录类型:可选:1-用户密码登录、2-手机验证码登录、其他-两者都可以
|
|
8
|
+
* */
|
|
9
|
+
loginType?: number | string;
|
|
10
|
+
/**
|
|
11
|
+
* @description 主题颜色
|
|
12
|
+
* */
|
|
13
|
+
themeColor?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @description 浏览器缓存名称前缀
|
|
16
|
+
* */
|
|
17
|
+
prefix?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @description 是否需要显示密码操作
|
|
20
|
+
* */
|
|
21
|
+
isShowPwd?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @description 用户输入框占位提示
|
|
24
|
+
* */
|
|
25
|
+
userPlaceholder?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description 密码输入框占位提示
|
|
28
|
+
* */
|
|
29
|
+
pwdPlaceholder?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @description 底部小菜单
|
|
32
|
+
* */
|
|
33
|
+
menu?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* @description 自定义用户名效验
|
|
36
|
+
* customUserValidator: {
|
|
37
|
+
* validator: (rule, value, callback) => {
|
|
38
|
+
* },
|
|
39
|
+
* message: '提示信息',
|
|
40
|
+
* trigger: ['change','blur'],
|
|
41
|
+
* }
|
|
42
|
+
* */
|
|
43
|
+
customUserValidator?: Record<string, any>;
|
|
44
|
+
/**
|
|
45
|
+
* @description 自定义密码效验
|
|
46
|
+
* */
|
|
47
|
+
customPwdValidator?: Record<string, any>;
|
|
48
|
+
/**
|
|
49
|
+
* @description 用户名输入数量校验
|
|
50
|
+
* */
|
|
51
|
+
userNumValidator?: Record<string, any>;
|
|
52
|
+
/**
|
|
53
|
+
* @description 密码输入数量校验
|
|
54
|
+
* */
|
|
55
|
+
pwdNumValidator?: Record<string, any>;
|
|
56
|
+
/**
|
|
57
|
+
* @description 自定义手机效验规则
|
|
58
|
+
* */
|
|
59
|
+
customPhoneValidator?: Record<string, any>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HyPopup
|
|
3
|
+
mode="center"
|
|
4
|
+
:zoom="zoom"
|
|
5
|
+
:show="show"
|
|
6
|
+
:customStyle="{
|
|
7
|
+
borderRadius: '6px',
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
marginTop: `-${addUnit(negativeTop)}`
|
|
10
|
+
}"
|
|
11
|
+
:closeOnClickOverlay="closeOnClickOverlay"
|
|
12
|
+
:safeAreaInsetBottom="false"
|
|
13
|
+
:duration="400"
|
|
14
|
+
@click="clickHandler"
|
|
15
|
+
>
|
|
16
|
+
<view
|
|
17
|
+
class="hy-modal"
|
|
18
|
+
:style="{
|
|
19
|
+
width: addUnit(width)
|
|
20
|
+
}"
|
|
21
|
+
>
|
|
22
|
+
<view class="hy-modal__title" v-if="title">{{ title }}</view>
|
|
23
|
+
<view
|
|
24
|
+
class="hy-modal__content"
|
|
25
|
+
:style="{
|
|
26
|
+
paddingTop: `${title ? 12 : 25}px`
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<slot>
|
|
30
|
+
<text class="hy-modal__content__text">
|
|
31
|
+
{{ content }}
|
|
32
|
+
</text>
|
|
33
|
+
</slot>
|
|
34
|
+
</view>
|
|
35
|
+
<view
|
|
36
|
+
class="hy-modal__button-group--confirm-button"
|
|
37
|
+
v-if="$slots.confirmButton"
|
|
38
|
+
>
|
|
39
|
+
<slot name="confirmButton"></slot>
|
|
40
|
+
</view>
|
|
41
|
+
<template v-else>
|
|
42
|
+
<view
|
|
43
|
+
class="hy-modal__button-group"
|
|
44
|
+
:style="{
|
|
45
|
+
flexDirection: buttonReverse ? 'row-reverse' : 'row'
|
|
46
|
+
}"
|
|
47
|
+
>
|
|
48
|
+
<view
|
|
49
|
+
class="hy-modal__button-group__wrapper u-modal__button-group__wrapper--cancel"
|
|
50
|
+
:hover-stay-time="150"
|
|
51
|
+
hover-class="hy-modal__button-group__wrapper--hover"
|
|
52
|
+
:class="[
|
|
53
|
+
showCancelButton &&
|
|
54
|
+
!showConfirmButton &&
|
|
55
|
+
'hy-modal__button-group__wrapper--only-cancel'
|
|
56
|
+
]"
|
|
57
|
+
v-if="showCancelButton"
|
|
58
|
+
@tap.stop="cancelHandler"
|
|
59
|
+
>
|
|
60
|
+
<text
|
|
61
|
+
class="hy-modal__button-group__wrapper__text"
|
|
62
|
+
:style="{
|
|
63
|
+
color: cancelColor
|
|
64
|
+
}"
|
|
65
|
+
>{{ cancelText }}</text
|
|
66
|
+
>
|
|
67
|
+
</view>
|
|
68
|
+
<view
|
|
69
|
+
class="hy-modal__button-group__wrapper--line"
|
|
70
|
+
v-if="showConfirmButton && showCancelButton"
|
|
71
|
+
></view>
|
|
72
|
+
<view
|
|
73
|
+
class="hy-modal__button-group__wrapper u-modal__button-group__wrapper--confirm"
|
|
74
|
+
:hover-stay-time="150"
|
|
75
|
+
hover-class="hy-modal__button-group__wrapper--hover"
|
|
76
|
+
:class="[
|
|
77
|
+
!showCancelButton &&
|
|
78
|
+
showConfirmButton &&
|
|
79
|
+
'hy-modal__button-group__wrapper--only-confirm'
|
|
80
|
+
]"
|
|
81
|
+
v-if="showConfirmButton"
|
|
82
|
+
@tap="confirmHandler"
|
|
83
|
+
>
|
|
84
|
+
<HyIcon
|
|
85
|
+
v-if="loading"
|
|
86
|
+
:name="IconConfig.LOADING"
|
|
87
|
+
:isRotate="loading"
|
|
88
|
+
></HyIcon>
|
|
89
|
+
<text
|
|
90
|
+
v-else
|
|
91
|
+
class="hy-modal__button-group__wrapper__text"
|
|
92
|
+
:style="{
|
|
93
|
+
color: confirmColor
|
|
94
|
+
}"
|
|
95
|
+
>{{ confirmText }}</text
|
|
96
|
+
>
|
|
97
|
+
</view>
|
|
98
|
+
</view>
|
|
99
|
+
</template>
|
|
100
|
+
</view>
|
|
101
|
+
</HyPopup>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<script setup lang="ts">
|
|
105
|
+
import { ref, toRefs, watch } from "vue";
|
|
106
|
+
import defaultProps from "./props";
|
|
107
|
+
import IProps from "./typing";
|
|
108
|
+
import { addUnit } from "../../utils";
|
|
109
|
+
import { IconConfig } from "../../config";
|
|
110
|
+
|
|
111
|
+
// 组件
|
|
112
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
113
|
+
import HyPopup from "../hy-popup/hy-popup.vue";
|
|
114
|
+
|
|
115
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
116
|
+
const { show, asyncClose, closeOnClickOverlay } = toRefs(props);
|
|
117
|
+
const emit = defineEmits(["confirm", "cancel", "close", "update:show"]);
|
|
118
|
+
|
|
119
|
+
const loading = ref<boolean>(false);
|
|
120
|
+
|
|
121
|
+
watch(
|
|
122
|
+
() => show.value,
|
|
123
|
+
(newValue) => {
|
|
124
|
+
if (newValue && loading.value) loading.value = false;
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @description 点击确定按钮
|
|
130
|
+
* */
|
|
131
|
+
const confirmHandler = () => {
|
|
132
|
+
// 如果配置了异步关闭,将按钮值为loading状态
|
|
133
|
+
if (asyncClose.value) {
|
|
134
|
+
loading.value = true;
|
|
135
|
+
} else {
|
|
136
|
+
emit("update:show", false);
|
|
137
|
+
}
|
|
138
|
+
emit("confirm");
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @description 点击取消按钮
|
|
143
|
+
* */
|
|
144
|
+
const cancelHandler = () => {
|
|
145
|
+
emit("update:show", false);
|
|
146
|
+
emit("cancel");
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @description 点击遮罩
|
|
151
|
+
* */
|
|
152
|
+
const clickHandler = () => {
|
|
153
|
+
if (closeOnClickOverlay.value) {
|
|
154
|
+
emit("update:show", false);
|
|
155
|
+
emit("close");
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
</script>
|
|
159
|
+
|
|
160
|
+
<style lang="scss" scoped>
|
|
161
|
+
@import "../../libs/css/mixin.scss";
|
|
162
|
+
@import "../../theme.scss";
|
|
163
|
+
|
|
164
|
+
$u-modal-border-radius: 6px;
|
|
165
|
+
|
|
166
|
+
.hy-modal {
|
|
167
|
+
width: 650rpx;
|
|
168
|
+
border-radius: $hy-border-radius-base;
|
|
169
|
+
overflow: hidden;
|
|
170
|
+
|
|
171
|
+
&__title {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
align-items: center;
|
|
176
|
+
font-size: 16px;
|
|
177
|
+
font-weight: bold;
|
|
178
|
+
color: $hy-color-title;
|
|
179
|
+
text-align: center;
|
|
180
|
+
padding-top: 25px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&__content {
|
|
184
|
+
padding: 12px 25px 25px 25px;
|
|
185
|
+
@include flex;
|
|
186
|
+
justify-content: center;
|
|
187
|
+
|
|
188
|
+
&__text {
|
|
189
|
+
text-align: v-bind(contentTextAlign);
|
|
190
|
+
font-size: 15px;
|
|
191
|
+
color: $hy-text-color-grey;
|
|
192
|
+
flex: 1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&__button-group {
|
|
197
|
+
border-top: $hy-border-line;
|
|
198
|
+
@include flex;
|
|
199
|
+
|
|
200
|
+
&--confirm-button {
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
padding: 0 25px 15px 25px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&__wrapper {
|
|
206
|
+
flex: 1;
|
|
207
|
+
@include flex;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
align-items: center;
|
|
210
|
+
height: 48px;
|
|
211
|
+
|
|
212
|
+
&--line {
|
|
213
|
+
background: $hy-text-color-light;
|
|
214
|
+
width: 1px;
|
|
215
|
+
height: 48px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&--confirm,
|
|
219
|
+
&--only-cancel {
|
|
220
|
+
border-bottom-right-radius: $hy-border-radius-base;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&--cancel,
|
|
224
|
+
&--only-confirm {
|
|
225
|
+
border-bottom-left-radius: $hy-border-radius-base;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&--hover {
|
|
229
|
+
background-color: $hy-bg-color-grey;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&__text {
|
|
233
|
+
color: $hy-color-subtitle;
|
|
234
|
+
font-size: 16px;
|
|
235
|
+
text-align: center;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
import { ColorConfig } from "../../config";
|
|
3
|
+
|
|
4
|
+
const defaultProps: IProps = {
|
|
5
|
+
show: false,
|
|
6
|
+
title: "",
|
|
7
|
+
content: "",
|
|
8
|
+
confirmText: "确认",
|
|
9
|
+
cancelText: "取消",
|
|
10
|
+
showConfirmButton: true,
|
|
11
|
+
showCancelButton: false,
|
|
12
|
+
confirmColor: ColorConfig.primary,
|
|
13
|
+
cancelColor: "#606266",
|
|
14
|
+
buttonReverse: false,
|
|
15
|
+
zoom: true,
|
|
16
|
+
asyncClose: false,
|
|
17
|
+
closeOnClickOverlay: false,
|
|
18
|
+
negativeTop: 0,
|
|
19
|
+
width: "650rpx",
|
|
20
|
+
confirmButtonShape: "",
|
|
21
|
+
contentTextAlign: "left"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default defaultProps;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export default interface IProps {
|
|
2
|
+
/**
|
|
3
|
+
* @description 是否显示模态框,请赋值给show (默认 false )
|
|
4
|
+
* */
|
|
5
|
+
show: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* @description 标题内容
|
|
8
|
+
* */
|
|
9
|
+
title?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @description 模态框内容,如传入slot内容,则此参数无效
|
|
12
|
+
* */
|
|
13
|
+
content?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @description 确认按钮的文字 (默认 '确认' )
|
|
16
|
+
* */
|
|
17
|
+
confirmText?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @description 取消按钮的文字 (默认 '取消' )
|
|
20
|
+
* */
|
|
21
|
+
cancelText?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @description 是否显示确认按钮 (默认 true )
|
|
24
|
+
* */
|
|
25
|
+
showConfirmButton?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @description 是否显示取消按钮 (默认 false )
|
|
28
|
+
* */
|
|
29
|
+
showCancelButton?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @description 确认按钮的颜色 (默认 '#2979ff' )
|
|
32
|
+
* */
|
|
33
|
+
confirmColor?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @description 取消按钮的颜色 (默认 '#606266' )
|
|
36
|
+
* */
|
|
37
|
+
cancelColor?: string;
|
|
38
|
+
/**
|
|
39
|
+
* @description 对调确认和取消的位置 (默认 false )
|
|
40
|
+
* */
|
|
41
|
+
buttonReverse?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @description 是否开启缩放模式 (默认 true )
|
|
44
|
+
* */
|
|
45
|
+
zoom?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @description 是否异步关闭,只对确定按钮有效,见上方说明 (默认 false )
|
|
48
|
+
* */
|
|
49
|
+
asyncClose?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @description 是否允许点击遮罩关闭Modal (默认 false )
|
|
52
|
+
* */
|
|
53
|
+
closeOnClickOverlay?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* @description 往上偏移的值,给一个负的margin-top,往上偏移,避免和键盘重合的情况,单位任意,数值则默认为px单位 (默认 0 )
|
|
56
|
+
* */
|
|
57
|
+
negativeTop?: number;
|
|
58
|
+
/**
|
|
59
|
+
* @description modal宽度,不支持百分比,可以数值,px,rpx单位 (默认 '650rpx' )
|
|
60
|
+
* */
|
|
61
|
+
width?: string | number;
|
|
62
|
+
/**
|
|
63
|
+
* @description 确认按钮的样式,如设置,将不会显示取消按钮
|
|
64
|
+
* */
|
|
65
|
+
confirmButtonShape?: HyApp.ShapeType;
|
|
66
|
+
/**
|
|
67
|
+
* @description 文案对齐方式
|
|
68
|
+
* */
|
|
69
|
+
contentTextAlign?: HyApp.LeftRightType | "center";
|
|
70
|
+
}
|