@uxda/appkit 1.1.2 → 1.2.0

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.
@@ -0,0 +1,227 @@
1
+ <script setup lang="ts">
2
+ import {reactive, ref} from 'vue'
3
+ import OcrId from './../../components/ocr-id/index.vue'
4
+ import {OcrResultType} from './../../components/ocr-id/index.vue'
5
+ import DdArea from './../../components/dd-area/index.vue'
6
+ import DdSelector from './../../components/dd-selector/index.vue'
7
+ import Taro from "@tarojs/taro";
8
+
9
+ const props = withDefaults(defineProps<{
10
+ banner?: string
11
+ }>(), {
12
+ banner: 'https://cdn.ddjf.com/static/images/wx-yunservice/ai-form-bg2.png'
13
+ })
14
+
15
+ const formState = reactive({
16
+ name: '',
17
+ certNo: '',
18
+ scene: 'person',
19
+ areaCode: '',
20
+ position: '',
21
+ companyName: '',
22
+ companyNo: ''
23
+ })
24
+
25
+ const positionOptions = [
26
+ {
27
+ label: "老板",
28
+ value: "老板",
29
+ },
30
+ {
31
+ label: "业务负责人",
32
+ value: "业务负责人",
33
+ },
34
+ {
35
+ label: "风控负责人",
36
+ value: "风控负责人",
37
+ },
38
+ {
39
+ label: "其它",
40
+ value: "其它",
41
+ },
42
+ ]
43
+
44
+ const emit = defineEmits(['submit'])
45
+
46
+ function onOCRInfo(payload: OcrResultType) {
47
+ if (!payload) return
48
+ formState.name = payload.faceInfo.name
49
+ formState.certNo = payload.faceInfo.certNo
50
+ }
51
+
52
+ function showVerifyToast(tip: string, duration = 1500) {
53
+ if (!tip) return
54
+ Taro.showToast({
55
+ title: tip,
56
+ icon: 'none',
57
+ duration,
58
+ })
59
+ }
60
+
61
+ async function submit() {
62
+ if (!formState.name){
63
+ showVerifyToast('请输入你的姓名')
64
+ return
65
+ }
66
+ const params = {
67
+ useCase: formState.scene,
68
+ customerName: formState.name
69
+ }
70
+ if (formState.scene === 'person') {
71
+ if (!formState.certNo){
72
+ showVerifyToast('请输入身份证号码')
73
+ return
74
+ }
75
+ if (formState.certNo.length != 18){
76
+ showVerifyToast('请输入正确的身份证号码')
77
+ return
78
+ }
79
+ params['idCardNo'] = formState.certNo
80
+ } else {
81
+ if (!formState.position){
82
+ showVerifyToast('请选择你的职位')
83
+ return
84
+ }
85
+ if (!formState.companyName){
86
+ showVerifyToast('请输入公司名称')
87
+ return
88
+ }
89
+ if (!formState.companyNo){
90
+ showVerifyToast('请输入社会统一信用代码')
91
+ return
92
+ }
93
+ if (formState.companyNo.length != 18){
94
+ showVerifyToast('请输入正确的社会统一信用代码')
95
+ return
96
+ }
97
+ if (!formState.areaCode){
98
+ showVerifyToast('请选择所在地区')
99
+ return
100
+ }
101
+ params['customerPosition'] = formState.position
102
+ params['companyName'] = formState.companyName
103
+ params['idCardNo'] = formState.companyNo
104
+ params['customerArea'] = formState.areaCode
105
+ }
106
+ console.log(formState)
107
+ emit('submit', params)
108
+ }
109
+ </script>
110
+
111
+ <template>
112
+ <div class="self-registration">
113
+ <div class="self-registration-body">
114
+ <img :src="banner" class="self-registration-banner" alt=""/>
115
+ <nut-form>
116
+ <nut-form-item label="使用场景" required body-align="right">
117
+ <nut-radiogroup v-model="formState.scene" direction="horizontal">
118
+ <nut-radio label="person">个人使用</nut-radio>
119
+ <nut-radio label="company">公司使用</nut-radio>
120
+ </nut-radiogroup>
121
+ </nut-form-item>
122
+ <nut-form-item label="你的姓名" required>
123
+ <div class="self-registration__input">
124
+ <input v-model="formState.name" class="nut-input-text" placeholder="请输入或拍照识别" type="text" :maxlength="20"/>
125
+ <OcrId @ocr="onOCRInfo" style="margin-left: 5px"/>
126
+ </div>
127
+ </nut-form-item>
128
+
129
+ <nut-form-item v-if="formState.scene === 'person'" label="身份证号码" required>
130
+ <input v-model="formState.certNo" class="nut-input-text" placeholder="请输入" type="text" :maxlength="18"/>
131
+ </nut-form-item>
132
+
133
+ <template v-else>
134
+ <nut-form-item label="你的职位" required>
135
+ <DdSelector v-model:value="formState.position" :options="positionOptions"/>
136
+ </nut-form-item>
137
+ <nut-form-item label="公司名称" required>
138
+ <input v-model="formState.companyName" class="nut-input-text" placeholder="请输入" type="text"
139
+ :maxlength="50"/>
140
+ </nut-form-item>
141
+ <nut-form-item label="社会统一信用代码" required>
142
+ <input v-model="formState.companyNo" class="nut-input-text" placeholder="请输入" type="text" :maxlength="18"/>
143
+ </nut-form-item>
144
+ <nut-form-item label="所在地区" required>
145
+ <DdArea
146
+ v-model:value="formState.areaCode"
147
+ placeholder="请选择"/>
148
+ </nut-form-item>
149
+ </template>
150
+ </nut-form>
151
+ </div>
152
+ <div class="self-registration-bottom">
153
+ <nut-button block type="primary" class="experience-button" @click="submit">立即体验</nut-button>
154
+ </div>
155
+ </div>
156
+ </template>
157
+
158
+ <style lang="scss">
159
+ .self-registration {
160
+ width: 100%;
161
+ height: 100%;
162
+ display: flex;
163
+ flex-direction: column;
164
+
165
+ &-body {
166
+ flex: 1;
167
+ padding: 12px;
168
+ overflow: auto;
169
+ }
170
+
171
+ &-banner {
172
+ width: 100%;
173
+ height: 170px;
174
+ }
175
+
176
+ .nut-cell-group__warp {
177
+ border-radius: 5px;
178
+ margin: 12px 0 0;
179
+ }
180
+
181
+ &__input {
182
+ display: flex;
183
+ align-items: center;
184
+ }
185
+
186
+ &-bottom {
187
+ background-color: white;
188
+ padding-bottom: var(--safe-bottom-height);
189
+ }
190
+
191
+ .experience-button {
192
+ margin: 7.5px 12px;
193
+ border-radius: 5px;
194
+ width: calc(100% - 24px);
195
+ }
196
+
197
+ .nut-input-text {
198
+ text-align: right !important;
199
+ }
200
+
201
+ .nut-form-item__label.required::before {
202
+ display: none;
203
+ }
204
+
205
+ .nut-form-item__label.required::after {
206
+ content: "*";
207
+ color: #fa2c19;
208
+ margin-right: 4px;
209
+ }
210
+
211
+ .nut-form-item__label {
212
+ width: unset;
213
+ }
214
+
215
+ .input-placeholder {
216
+ color: #cccccc;
217
+ }
218
+
219
+ .nut-radio__icon {
220
+ font-size: 16px;
221
+ }
222
+
223
+ .nut-radio__icon--unchecked {
224
+ font-size: 16px;
225
+ }
226
+ }
227
+ </style>
@@ -0,0 +1,3 @@
1
+ import SelfRegistration from './SelfRegistration.vue'
2
+
3
+ export { SelfRegistration }
@@ -0,0 +1 @@
1
+ export * from './components'
@@ -1 +1,2 @@
1
1
  export * from './useSafeArea'
2
+ export * from './useTabbar'
@@ -0,0 +1,24 @@
1
+ import { ref } from 'vue'
2
+
3
+ const tab = ref<string>(''),
4
+ changeCallback = ref<(value: string) => void>(
5
+ (value: string) => {
6
+ console.log('ORIGINAL changeCallback===', value)
7
+ }
8
+ )
9
+
10
+ const setTab = (value: string) => {
11
+ tab.value = value
12
+ changeCallback.value(value)
13
+ }
14
+
15
+ const onTabChange = (callback: (value: string) => void) => {
16
+ changeCallback.value = callback
17
+ }
18
+
19
+ export function useTabbar () {
20
+ return {
21
+ onTabChange,
22
+ setTab
23
+ }
24
+ }
@@ -1,61 +0,0 @@
1
- {
2
- "新建组件": {
3
- "prefix": ["nsc", "nutshell"],
4
- "body": [
5
- "import { PropType, ObjectEmitsOptions, SlotsType } from 'vue'"
6
- "import { define, MakePropsType } from '../../utils'"
7
- "",
8
- "export const ${2}Props = {"
9
- "\tlabel: {"
10
- "\t\ttype: String"
11
- "\t}"
12
- "}"
13
- ""
14
- "export type ${1}Emits = {"
15
- "}"
16
- ""
17
- "const ${2}Emits: ${1}Emits = {"
18
- "}"
19
- ""
20
- "export type ${1}Slots = {"
21
- "\tdefault: never,"
22
- "}"
23
- ""
24
- "export type ${1}Props = MakePropsType<typeof ${2}Props, ${1}Emits>"
25
- "",
26
- "$BLOCK_COMMENT_START*"
27
- " * ${3} 组件 <ns-${2}>"
28
- " $BLOCK_COMMENT_END"
29
- "export const Ns${1:$TM_FILENAME_BASE} = define({"
30
- "\tname: 'Ns${1}',"
31
- "\tprops: ${2}Props,"
32
- "\temits: ${2}Emits,"
33
- "\tsetup (props, ctx) {"
34
- "\t\treturn {"
35
- "\t\t}"
36
- "\t}"
37
- "})"
38
- "// 需要增加 import 到 ./index.ts, ../components.ts"
39
- ],
40
- "description": "新建组件"
41
- },
42
-
43
- "新建 vendor": {
44
- "prefix": ["nsv", "nutshell-vendor"],
45
- "body": [
46
- "import { h, SetupContext } from 'vue'",
47
- "import { ${2:$TM_FILENAME_BASE} as Antdv${2} } from 'ant-design-vue'",
48
- "import { ${1}Props } from '../../../../components'"
49
- "",
50
- "export const ${1:$TM_FILENAME_BASE} = (props: ${1}Props, ctx: SetupContext) => {",
51
- "",
52
- "\treturn h(Antdv${2}, {",
53
- "\t\tclass: 'ns-${3}',",
54
- "\t}, () => '')",
55
- "}",
56
- "// + import => ./index.ts, ../components.ts"
57
- ""
58
- ],
59
- "description": "新建组件"
60
- }
61
- }
@@ -1,7 +0,0 @@
1
- {
2
- "recommendations": [
3
- "editorconfig.editorconfig",
4
- ],
5
- "unwantedRecommendations": [
6
- ]
7
- }
@@ -1,98 +0,0 @@
1
- {
2
- "eslint.enable": true,
3
- "eslint.validate": [],
4
- "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
5
- "files.exclude": {
6
- "**/dist": true,
7
- "**/nutshell.css": true,
8
- "**/antdv.css": true,
9
- "**/nutui.css": true,
10
- "**/auto-imports.d.ts": true,
11
- "**/node_modules": true,
12
- "**/yarn-error.log": true,
13
- "**/.eslintrc-auto-import.json": true,
14
- },
15
- "workbench.colorCustomizations": {
16
- "[Atlantic Night]": {
17
- "editor.background": "#060f3d",
18
- "tab.border": "#060f3d",
19
- "tab.activeBackground": "#060f3d",
20
- "tab.activeBorder": "#060f3d",
21
- "tab.activeBorderTop": "#060f3d",
22
- "tab.inactiveBackground": "#060f3d",
23
- "tab.activeModifiedBorder": "#060f3d",
24
- "sideBar.background": "#060f3d",
25
- "sideBar.border": "#060f3d",
26
- "sideBar.foreground": "#0091ff",
27
- "sideBarSectionHeader.border": "#060f3d",
28
- "focusBorder": "#060f3d",
29
- "sideBarSectionHeader.background": "#060f3d",
30
- "activityBar.background": "#060f3d",
31
- "activityBar.foreground": "#ff009d",
32
- "activityBar.activeBorder": "#ff009d",
33
- "activityBar.inactiveForeground": "#ff009d",
34
- "scrollbarSlider.background": "#00569d66",
35
- "activityBar.border": "#060f3d",
36
- "activityBar.activeBackground": "#060f3d",
37
- "editorGroup.border": "#060f3d",
38
- "editorGroupHeader.noTabsBackground": "#060f3d",
39
- "editorGroupHeader.tabsBackground": "#060f3d",
40
- "editorGroupHeader.tabsBorder": "#060f3d",
41
- "editorWidget.background": "#060f3d",
42
- "editorHoverWidget.background": "#001163",
43
- "editorHoverWidget.border": "#002aff",
44
- "editorSuggestWidget.background": "#001163",
45
- "editorSuggestWidget.border": "#002aff",
46
- "editorSuggestWidget.focusHighlightForeground": "#00ff73",
47
- "editorSuggestWidget.selectedBackground": "#ff009d",
48
- "editorGutter.background": "#060f3d",
49
- "editor.lineHighlightBackground": "#08165a",
50
- "editor.lineHighlightBorder": "#060f3d",
51
- "titleBar.activeBackground": "#060f3d",
52
- "titleBar.inactiveBackground": "#060f3d",
53
- "quickInput.background": "#001163",
54
- "quickInputList.focusBackground": "#ff009d",
55
- "quickInputTitle.background": "#ff0000",
56
- "quickInput.foreground": "#00ff73",
57
- "input.background": "#060f3d",
58
- }
59
- },
60
- "editor.semanticTokenColorCustomizations": {
61
- "rules": {
62
- "keyword.void": {
63
- "foreground": "#ffff99",
64
- "fontStyle": "underline"
65
- }
66
- },
67
- },
68
- "editor.tokenColorCustomizations": {
69
- "[Shades of Purple]": {
70
- "comments": {
71
- "foreground": "#00ffae",
72
- "fontStyle": ""
73
- },
74
- "textMateRules": [
75
- {
76
- "name": "types",
77
- "scope": "entity.name.type",
78
- "settings": {
79
- "fontStyle": "bold underline",
80
- },
81
- },
82
- {
83
- "scope": "variable.other.readwrite.ts",
84
- "settings": {
85
- "foreground": "#ff00c8"
86
- }
87
- },
88
- {
89
- "scope": "entity.other.attribute-name.html",
90
- "settings": {
91
- "fontStyle": "",
92
- "foreground": "#ffbb00"
93
- },
94
- }
95
- ]
96
- }
97
- }
98
- }