leisure-core 0.6.22 → 0.6.24

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.
@@ -20,6 +20,15 @@
20
20
  </span>
21
21
  <el-dropdown-menu slot="dropdown">
22
22
  <el-dropdown-item command="1">修改密码</el-dropdown-item>
23
+ <el-dropdown-item command="3">个人信息</el-dropdown-item>
24
+ <el-dropdown-item
25
+ v-for="item in extraDropdownItems"
26
+ :key="item.command"
27
+ :command="item.command"
28
+ :divided="item.divided"
29
+ >
30
+ {{ item.label }}
31
+ </el-dropdown-item>
23
32
  <el-dropdown-item command="2">退出</el-dropdown-item>
24
33
  </el-dropdown-menu>
25
34
  </el-dropdown>
@@ -134,9 +143,6 @@
134
143
  autocomplete="off"
135
144
  ></el-input>
136
145
  </el-form-item>
137
- <el-form-item label="昵称" prop="nick">
138
- <el-input v-model="ruleForm.nick" autocomplete="off"></el-input>
139
- </el-form-item>
140
146
  </el-form>
141
147
  <div
142
148
  ref="pwdref"
@@ -156,6 +162,16 @@
156
162
  >
157
163
  </div>
158
164
  </el-dialog>
165
+ <le-dialog-container :showDialog="showPerInfo" title="个人信息" width="30%">
166
+ <le-list-form
167
+ :formColumns="formColumns"
168
+ :formData="perInfo"
169
+ :columnsPerRow="1"
170
+ :handleStatus="2"
171
+ @closeDialog="cancelChangePerInfo"
172
+ @saveData="savePerInfo"
173
+ ></le-list-form>
174
+ </le-dialog-container>
159
175
  <div v-show="contextMenuVisible">
160
176
  <ul
161
177
  :style="{ left: menuLeft + 'px', top: menuTop + 'px' }"
@@ -184,11 +200,16 @@
184
200
  </el-container>
185
201
  </template>
186
202
  <script>
203
+ import { cancel } from "@/api/distribution_goods";
187
204
  import { cloneDeep } from "lodash";
188
205
  import { throttle } from "lodash"; // 可选,用于性能优化
189
206
  export default {
190
207
  name: "le-home",
191
208
  props: {
209
+ extraDropdownItems: {
210
+ type: Array,
211
+ default: () => [],
212
+ },
192
213
  companyInfo: {
193
214
  type: Object,
194
215
  default: () => ({}),
@@ -234,6 +255,7 @@ export default {
234
255
  title: "",
235
256
  cacheView: [],
236
257
  showChangePwd: false,
258
+ showPerInfo: false,
237
259
  username: "",
238
260
  changeUid: "",
239
261
  tabNameCurrent: "",
@@ -241,7 +263,14 @@ export default {
241
263
  ruleForm: {
242
264
  pwd: "",
243
265
  confirmPwd: "",
266
+ },
267
+ formColumns: [
268
+ { prop: "nick", label: "昵称" },
269
+ { prop: "phone", label: "手机号" },
270
+ ],
271
+ perInfo: {
244
272
  nick: this.$store.getters.userinfo.nick,
273
+ phone: this.$store.getters.userinfo.phone,
245
274
  },
246
275
  rules: {
247
276
  pwd: [{ validator: validatePass, trigger: "blur" }],
@@ -391,12 +420,10 @@ export default {
391
420
  }
392
421
  },
393
422
  handleCommand(command) {
394
- if (command == 1) {
395
- this.changPwd();
396
- }
397
- if (command == 2) {
398
- this.signout();
399
- }
423
+ if (command === "1") this.changPwd();
424
+ else if (command === "2") this.signout();
425
+ else if (command === "3") this.changPerson();
426
+ else this.$emit("command", command); // 抛出外部命令
400
427
  },
401
428
  changPwd() {
402
429
  this.changeUid = this.$store.getters.userinfo.id;
@@ -404,12 +431,47 @@ export default {
404
431
  this.ruleForm.confirmPwd = "";
405
432
  this.showChangePwd = true;
406
433
  },
434
+ changPerson() {
435
+ this.changeUid = this.$store.getters.userinfo.id;
436
+ this.perInfo.nick = this.$store.getters.userinfo.nick;
437
+ this.perInfo.phone = this.$store.getters.userinfo.phone;
438
+ this.showPerInfo = true;
439
+ },
440
+ validatePhone(phone) {
441
+ const phoneRegex = /^1[3-9]\d{9}$/;
442
+ return phoneRegex.test(phone);
443
+ },
407
444
  cancelChangePwd() {
408
445
  this.showChangePwd = false;
409
446
  this.changeUid = "";
410
447
  this.ruleForm.pwd = "";
411
448
  this.ruleForm.confirmPwd = "";
412
449
  },
450
+ cancelChangePerInfo() {
451
+ this.showPerInfo = false;
452
+ this.perInfo.nick = "";
453
+ this.perInfo.phone = "";
454
+ },
455
+ savePerInfo(param) {
456
+ if (param.phone) {
457
+ if (!this.validatePhone(param.phone)) {
458
+ this.$message.error("请输入有效的手机号");
459
+ return;
460
+ }
461
+ }
462
+
463
+ if (!param.nick && !param.phone) {
464
+ this.$message.error("昵称和手机号至少填写一项");
465
+ return;
466
+ }
467
+
468
+ let params = {
469
+ uid: this.$store.getters.userinfo.id,
470
+ nick: param.nick,
471
+ phone: param.phone,
472
+ };
473
+ this.$emit("savePerInfo", params);
474
+ },
413
475
  saveChangePwd(formName) {
414
476
  this.$refs[formName].validate((valid) => {
415
477
  if (valid) {
@@ -417,7 +479,6 @@ export default {
417
479
  pwd: this.ruleForm.pwd,
418
480
  confirmPwd: this.ruleForm.confirmPwd,
419
481
  uid: this.changeUid,
420
- nick: this.ruleForm.nick,
421
482
  };
422
483
  this.$emit("userChangePwd", params, this.changePwdAfter);
423
484
  } else {
@@ -428,7 +489,7 @@ export default {
428
489
  },
429
490
  changePwdAfter(res) {
430
491
  if (res && res.data && res.data.code == "10000") {
431
- this.$message.success("修改密码成功");
492
+ this.$message.success("更新成功");
432
493
  localStorage.clear();
433
494
  this.$store.commit("setUserInfo", null);
434
495
  this.$router.replace({ path: "/" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.6.22",
3
+ "version": "0.6.24",
4
4
  "description": "leisure-core是京心数据基于vue2.x开发的一套后台管理系统桌面端组件库,封装了大量实用的UI控件模板,非常方便开发者快速搭建前端应用",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",