leisure-core 0.6.20 → 0.6.21

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.
@@ -119,6 +119,7 @@
119
119
  </template>
120
120
 
121
121
  <script>
122
+ import { setToken } from "../../le-libs/js/tokens";
122
123
  export default {
123
124
  name: "le-login",
124
125
  props: {
@@ -234,8 +235,12 @@ export default {
234
235
  const code = res?.data?.code || "";
235
236
  if (code === "10000") {
236
237
  const data = res.data.data;
238
+ if (data && data.cid && data.cid.length > 0) {
239
+ this.$store.commit("setCid", data.cid);
240
+ }
237
241
  this.$store.commit("setUserInfo", data);
238
- this.$store.commit("setToken", data.token);
242
+ this.$emit("loginAfter", data);
243
+ setToken(res.data.data.token);
239
244
  this.$message.success("登录成功");
240
245
  } else {
241
246
  this.$message.error(res?.data?.msg || "登录失败");
@@ -250,12 +255,25 @@ export default {
250
255
  return this.formdata;
251
256
  },
252
257
 
258
+ validatePhone(phone) {
259
+ const phoneRegex = /^1[3-9]\d{9}$/;
260
+ return phoneRegex.test(phone);
261
+ },
262
+
253
263
  // 发送验证码
254
264
  sendCaptcha() {
255
- // 验证用户名是否已输入
256
- if (!this.formdata.account) {
257
- this.$message.warning("请输入用户名");
258
- return;
265
+ if (
266
+ !this.formdata.account ||
267
+ !this.validatePhone(this.formdata.account)
268
+ ) {
269
+ this.$message.error("请输入正确的手机号码");
270
+ return false;
271
+ }
272
+
273
+ // 验证密码
274
+ if (!this.formdata.pwd) {
275
+ this.$message.error("请输入密码");
276
+ return false;
259
277
  }
260
278
 
261
279
  this.sending = true;
@@ -263,6 +281,7 @@ export default {
263
281
  // 触发发送验证码事件,父组件可以监听这个事件来处理发送逻辑
264
282
  this.$emit("sendCaptcha", {
265
283
  account: this.formdata.account,
284
+ pwd: this.formdata.pwd,
266
285
  success: this.startCountdown,
267
286
  fail: () => {
268
287
  this.sending = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.6.20",
3
+ "version": "0.6.21",
4
4
  "description": "leisure-core是京心数据基于vue2.x开发的一套后台管理系统桌面端组件库,封装了大量实用的UI控件模板,非常方便开发者快速搭建前端应用",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",