@xilonglab/vue-main 1.6.31 → 1.6.35

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.
@@ -1,72 +1,87 @@
1
- <script setup>
2
- import User from '#/user'
3
- import { ref, reactive, inject } from 'vue'
4
-
5
- const store = inject('store')
6
- const refs = { form: ref(null) }
7
- const data = reactive({ oldPassword: '', newPassword: '', repeatPassword: '' })
8
- const error = reactive({ oldPassword: '', newPassword: '', repeatPassword: '' })
9
-
10
- const rules = {
11
- oldPassword: [{ required: true, message: "请输入原密码", trigger: "blur" }],
12
- newPassword: [{ required: true, message: "请输入新密码", trigger: "blur" }],
13
- repeatPassword: [{ required: true, message: "请再确认密码", trigger: "blur" }],
14
- }
15
-
16
- const confirm = async () => {
17
- const isValid = await refs.form.value.validate()
18
- if (!isValid) return
19
-
20
- if (data.newPassword !== data.repeatPassword) {
21
- error.repeatPassword = '两次输入不一致'
22
- } else {
23
- const { oldPassword, newPassword } = data
24
- const rsp = await User.Password.resource.put({
25
- userId: store.state.userData.id,
26
- oldPassword,
27
- newPassword
28
- })
29
- if (rsp?.code === 500 && rsp.msg === '原密码错误') {
30
- error.oldPassword = '原密码错误'
31
- } else {
32
- Object.keys(data).forEach(key => data[key] = '')
33
- }
34
- }
35
- }
36
- </script>
37
-
38
- <template>
39
- <div class="setting">
40
- <div class="wrapper">
41
- <el-form class="form" :ref="refs.form" :model="data" :rules="rules">
42
- <el-form-item label="原密码" prop="oldPassword" :error="error.oldPassword">
43
- <xl-input type="password" v-model="data.oldPassword" placeholder="" style="width:100%"/>
44
- </el-form-item>
45
- <el-form-item label="新密码" prop="newPassword" :error="error.newPassword">
46
- <xl-input type="password" v-model="data.newPassword" placeholder="" style="width:100%"/>
47
- </el-form-item>
48
- <el-form-item label="请确认" prop="repeatPassword" :error="error.repeatPassword">
49
- <xl-input type="password" v-model="data.repeatPassword" placeholder="" style="width:100%"/>
50
- </el-form-item>
51
- <xl-button l="确定" type="primary" @click="confirm"/>
52
- </el-form>
53
- </div>
54
- </div>
55
- </template>
56
-
57
- <style lang="less">
58
- .setting {
59
- background: #fff;
60
- .wrapper {
61
- height: 100%;
62
- display: flex;
63
- align-items: center;
64
- justify-content: center;
65
- .form {
66
- width: 360px;
67
- height: 300px;
68
- text-align: center;
69
- }
70
- }
71
- }
1
+ <script setup>
2
+ import User from '#/user'
3
+ import { ref, reactive, inject } from 'vue'
4
+
5
+ const store = inject('store')
6
+ const refs = { form: ref(null) }
7
+ const data = reactive({ oldPassword: '', newPassword: '', repeatPassword: '' })
8
+ const error = reactive({ oldPassword: '', newPassword: '', repeatPassword: '' })
9
+
10
+ const validateNewPassword = (rule, value, callback) => {
11
+ if (!value || value.length < 6) {
12
+ callback(new Error('密码长度必须大于等于6位'))
13
+ } else if (/^\d+$/.test(value)) {
14
+ callback(new Error('密码不能为纯数字'))
15
+ } else if (/^[a-zA-Z]+$/.test(value)) {
16
+ callback(new Error('密码不能为纯字母'))
17
+ } else {
18
+ callback()
19
+ }
20
+ }
21
+
22
+ const rules = {
23
+ oldPassword: [{ required: true, message: "请输入原密码", trigger: "blur" }],
24
+ newPassword: [
25
+ { required: true, message: "请输入新密码", trigger: "blur" },
26
+ { validator: validateNewPassword, trigger: "blur" }
27
+ ],
28
+ repeatPassword: [{ required: true, message: "请再确认密码", trigger: "blur" }],
29
+ }
30
+
31
+ const confirm = async () => {
32
+ const isValid = await refs.form.value.validate()
33
+ if (!isValid) return
34
+
35
+ if (data.newPassword !== data.repeatPassword) {
36
+ error.repeatPassword = '两次输入不一致'
37
+ } else {
38
+ const { oldPassword, newPassword } = data
39
+ const rsp = await User.Password.resource.put({
40
+ userId: store.state.userData.id,
41
+ oldPassword,
42
+ newPassword
43
+ })
44
+ if (rsp?.code === 500 && rsp.msg === '原密码错误') {
45
+ error.oldPassword = '原密码错误'
46
+ } else {
47
+ Object.keys(data).forEach(key => data[key] = '')
48
+ }
49
+ }
50
+ }
51
+ </script>
52
+
53
+ <template>
54
+ <div class="setting">
55
+ <div class="wrapper">
56
+ <el-form class="form" :ref="refs.form" :model="data" :rules="rules">
57
+ <el-form-item label="原密码" prop="oldPassword" :error="error.oldPassword">
58
+ <xl-input type="password" v-model="data.oldPassword" placeholder="" style="width:100%"/>
59
+ </el-form-item>
60
+ <el-form-item label="新密码" prop="newPassword" :error="error.newPassword">
61
+ <xl-input type="password" v-model="data.newPassword" placeholder="" style="width:100%"/>
62
+ </el-form-item>
63
+ <el-form-item label="请确认" prop="repeatPassword" :error="error.repeatPassword">
64
+ <xl-input type="password" v-model="data.repeatPassword" placeholder="" style="width:100%"/>
65
+ </el-form-item>
66
+ <xl-button l="确定" type="primary" @click="confirm"/>
67
+ </el-form>
68
+ </div>
69
+ </div>
70
+ </template>
71
+
72
+ <style lang="less">
73
+ .setting {
74
+ background: #fff;
75
+ .wrapper {
76
+ height: 100%;
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ .form {
81
+ width: 360px;
82
+ height: 300px;
83
+ text-align: center;
84
+ }
85
+ }
86
+ }
72
87
  </style>
@@ -1,5 +1,5 @@
1
- /* Element 弹窗打开时会给 body 增加右侧补偿,当前布局下会出现可见空隙 */
2
- body.el-popup-parent--hidden {
3
- width: 100% !important;
4
- padding-right: 0 !important;
1
+ /* Element 弹窗打开时会给 body 增加右侧补偿,当前布局下会出现可见空隙 */
2
+ body.el-popup-parent--hidden {
3
+ width: 100% !important;
4
+ padding-right: 0 !important;
5
5
  }
@@ -1,43 +1,43 @@
1
- @import './element.css';
2
-
3
- :root {
4
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
5
- line-height: 1.5;
6
- font-weight: 400;
7
-
8
- color-scheme: light dark;
9
- color: rgba(255, 255, 255, 0.87);
10
- background-color: #242424;
11
-
12
- font-synthesis: none;
13
- text-rendering: optimizeLegibility;
14
- -webkit-font-smoothing: antialiased;
15
- -moz-osx-font-smoothing: grayscale;
16
- -webkit-text-size-adjust: 100%;
17
- }
18
-
19
- html,
20
- body,
21
- #app {
22
- height: 100%;
23
- width: 100%;
24
- margin: 0;
25
- padding: 0;
26
- }
27
-
28
- input[type=number]::-webkit-inner-spin-button,
29
- input[type=number]::-webkit-outer-spin-button {
30
- -webkit-appearance: none;
31
- appearance: none;
32
- margin: 0;
33
- }
34
-
35
- ::-webkit-scrollbar {
36
- width: 10px;
37
- height: 10px;
38
- }
39
-
40
- ::-webkit-scrollbar-thumb {
41
- background-color: #e7ebf5;
42
- border-radius: 10px;
1
+ @import './element.css';
2
+
3
+ :root {
4
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
5
+ line-height: 1.5;
6
+ font-weight: 400;
7
+
8
+ color-scheme: light dark;
9
+ color: rgba(255, 255, 255, 0.87);
10
+ background-color: #242424;
11
+
12
+ font-synthesis: none;
13
+ text-rendering: optimizeLegibility;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ -webkit-text-size-adjust: 100%;
17
+ }
18
+
19
+ html,
20
+ body,
21
+ #app {
22
+ height: 100%;
23
+ width: 100%;
24
+ margin: 0;
25
+ padding: 0;
26
+ }
27
+
28
+ input[type=number]::-webkit-inner-spin-button,
29
+ input[type=number]::-webkit-outer-spin-button {
30
+ -webkit-appearance: none;
31
+ appearance: none;
32
+ margin: 0;
33
+ }
34
+
35
+ ::-webkit-scrollbar {
36
+ width: 10px;
37
+ height: 10px;
38
+ }
39
+
40
+ ::-webkit-scrollbar-thumb {
41
+ background-color: #e7ebf5;
42
+ border-radius: 10px;
43
43
  }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "name": "@xilonglab/vue-main",
3
- "version": "1.6.31",
4
- "description": "xilong vue main",
5
- "main": "packages/index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "author": "xilonglab",
10
- "license": "ISC",
11
- "dependencies": {
12
- "@imengyu/vue3-context-menu": "^1.3.3",
13
- "element-plus": "2.3.6",
14
- "image-conversion": "^2.1.1",
15
- "vue-router": "^4.2.2"
16
- }
1
+ {
2
+ "name": "@xilonglab/vue-main",
3
+ "version": "1.6.35",
4
+ "description": "xilong vue main",
5
+ "main": "packages/index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "xilonglab",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@imengyu/vue3-context-menu": "^1.3.3",
13
+ "element-plus": "2.3.6",
14
+ "image-conversion": "^2.1.1",
15
+ "vue-router": "^4.2.2"
16
+ }
17
17
  }
@@ -1,74 +1,74 @@
1
- <script setup>
2
- defineOptions({ name: "XlControlBar" })
3
-
4
- const props = defineProps({
5
- leftFlex: {
6
- type: Number,
7
- default: 1,
8
- },
9
- rightFlex: {
10
- type: Number,
11
- default: 3,
12
- },
13
- })
14
- </script>
15
-
16
-
17
- <template>
18
- <div class="xl-control-bar">
19
- <div class="wrapper1" :style="`flex: ${props.leftFlex};`">
20
- <div class="left">
21
- <slot name="left" />
22
- </div>
23
- </div>
24
- <div class="wrapper2" :style="`flex: ${props.rightFlex};`">
25
- <div class="right">
26
- <slot name="right" />
27
- </div>
28
- </div>
29
- </div>
30
- </template>
31
-
32
-
33
- <style lang="less">
34
- .xl-control-bar {
35
- display: flex;
36
- position: absolute;
37
- top: 3px;
38
- right: 0;
39
- width: 100%;
40
- z-index: 1;
41
- background: transparent;
42
- min-width: 0;
43
-
44
- .left {
45
- display: flex;
46
- align-items: center;
47
- }
48
-
49
- .wrapper1 {
50
- min-width: 0;
51
- }
52
-
53
- .wrapper2 {
54
- padding: 0;
55
- min-width: 0;
56
- }
57
-
58
- .right {
59
- float: right;
60
- display: flex;
61
- align-items: center;
62
- padding: 3px 40px 3px 5px;
63
-
64
- .xl-radio-button {
65
- margin-right: 7px;
66
- }
67
-
68
- .xl-button,
69
- .ant-btn-group {
70
- margin-left: 3px;
71
- }
72
- }
73
- }
1
+ <script setup>
2
+ defineOptions({ name: "XlControlBar" })
3
+
4
+ const props = defineProps({
5
+ leftFlex: {
6
+ type: Number,
7
+ default: 1,
8
+ },
9
+ rightFlex: {
10
+ type: Number,
11
+ default: 3,
12
+ },
13
+ })
14
+ </script>
15
+
16
+
17
+ <template>
18
+ <div class="xl-control-bar">
19
+ <div class="wrapper1" :style="`flex: ${props.leftFlex};`">
20
+ <div class="left">
21
+ <slot name="left" />
22
+ </div>
23
+ </div>
24
+ <div class="wrapper2" :style="`flex: ${props.rightFlex};`">
25
+ <div class="right">
26
+ <slot name="right" />
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </template>
31
+
32
+
33
+ <style lang="less">
34
+ .xl-control-bar {
35
+ display: flex;
36
+ position: absolute;
37
+ top: 3px;
38
+ right: 0;
39
+ width: 100%;
40
+ z-index: 1;
41
+ background: transparent;
42
+ min-width: 0;
43
+
44
+ .left {
45
+ display: flex;
46
+ align-items: center;
47
+ }
48
+
49
+ .wrapper1 {
50
+ min-width: 0;
51
+ }
52
+
53
+ .wrapper2 {
54
+ padding: 0;
55
+ min-width: 0;
56
+ }
57
+
58
+ .right {
59
+ float: right;
60
+ display: flex;
61
+ align-items: center;
62
+ padding: 3px 40px 3px 5px;
63
+
64
+ .xl-radio-button {
65
+ margin-right: 7px;
66
+ }
67
+
68
+ .xl-button,
69
+ .ant-btn-group {
70
+ margin-left: 3px;
71
+ }
72
+ }
73
+ }
74
74
  </style>