Changepassword-b9f16465.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import { d as defineComponent, r as ref, o as onMounted, b as createElementBlock, e as createBaseVNode, c as createVNode, f as withCtx, u as useRouter, j as openBlock, s as createTextVNode, _ as _export_sfc } from "./index-5e4623ce.js";
  2. import { C as CellGroup } from "./index-3a8cf159.js";
  3. import { B as Button } from "./index-b1054607.js";
  4. import "./index-8540448e.js";
  5. import { F as Field } from "./index-41ec7e28.js";
  6. import { u as useLocalStore, p as post } from "./request-76e4192b.js";
  7. import { F as Form } from "./index-0229ad12.js";
  8. import "./use-scope-id-0b5b8615.js";
  9. import "./index-487cde8c.js";
  10. import "./use-route-726f0d0b.js";
  11. import "./index-217c49a0.js";
  12. import "./axios-8cd254ce.js";
  13. const _hoisted_1 = { style: { "height": "100vh", "overflow": "hidden", "display": "flex", "flex-direction": "column" } };
  14. const _hoisted_2 = { style: { "height": "100%", "background-image": "url('static/images/bg-register.png')", "background-repeat": "no-repeat", "background-position-y": "0px", "background-size": "100%" } };
  15. const _hoisted_3 = { style: { "margin-top": "60px" } };
  16. const _hoisted_4 = { style: { "margin": "16px" } };
  17. const _sfc_main = /* @__PURE__ */ defineComponent({
  18. __name: "Changepassword",
  19. setup(__props) {
  20. const router = useRouter();
  21. const localStore = useLocalStore();
  22. const formRef = ref();
  23. const username = ref("");
  24. const password = ref("");
  25. const rememberPasswordChecked = ref(true);
  26. const onLogin = () => {
  27. router.replace("/login");
  28. };
  29. onMounted(() => {
  30. console.log("onMounted");
  31. rememberPasswordChecked.value = localStore.$state.rememberPassword;
  32. if (rememberPasswordChecked.value) {
  33. username.value = localStore.$state.username;
  34. password.value = localStore.$state.password;
  35. }
  36. });
  37. const onSubmit = () => {
  38. var _a;
  39. (_a = formRef.value) == null ? void 0 : _a.validate().then(() => {
  40. localStore.$patch({
  41. rememberPassword: rememberPasswordChecked.value
  42. });
  43. if (rememberPasswordChecked.value) {
  44. localStore.$patch({
  45. username: username.value,
  46. password: password.value
  47. });
  48. }
  49. post("/user/login", {
  50. username: username.value,
  51. password: password.value
  52. }).then(({ data }) => {
  53. console.log(data);
  54. if (data.code == 0) {
  55. localStore.$patch((state) => {
  56. state.token = data.data.token;
  57. });
  58. router.push("/");
  59. }
  60. });
  61. }).catch((ex) => {
  62. console.log(ex);
  63. });
  64. };
  65. return (_ctx, _cache) => {
  66. const _component_van_field = Field;
  67. const _component_van_button = Button;
  68. const _component_van_cell_group = CellGroup;
  69. const _component_van_form = Form;
  70. return openBlock(), createElementBlock("div", _hoisted_1, [
  71. createBaseVNode("div", _hoisted_2, [
  72. _cache[6] || (_cache[6] = createBaseVNode("div", { style: { "padding": "100px 16px 30px 32px", "display": "flex", "justify-content": "space-between", "align-items": "center" } }, [
  73. createBaseVNode("div", null, [
  74. createBaseVNode("div", { style: { "color": "#5C677C", "height": "30px" } }),
  75. createBaseVNode("div", { style: { "font-size": "1.1rem", "font-weight": "bold" } }, [
  76. createBaseVNode("span", null, "忘记密码")
  77. ]),
  78. createBaseVNode("div", { style: { "font-size": "0.9rem", "color": "#6D7A90" } }, [
  79. createBaseVNode("span", null, "请输入手机号和验证码找回密码")
  80. ])
  81. ])
  82. ], -1)),
  83. createBaseVNode("div", _hoisted_3, [
  84. createVNode(_component_van_form, {
  85. ref_key: "formRef",
  86. ref: formRef,
  87. "show-error": "",
  88. "show-error-message": false,
  89. onSubmit
  90. }, {
  91. default: withCtx(() => [
  92. createVNode(_component_van_cell_group, { inset: "" }, {
  93. default: withCtx(() => [
  94. createVNode(_component_van_field, {
  95. modelValue: username.value,
  96. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => username.value = $event),
  97. name: "username",
  98. label: "手机号",
  99. "label-width": "70",
  100. placeholder: "请输入账号",
  101. rules: [{ required: true, message: "请填写账号" }]
  102. }, null, 8, ["modelValue"]),
  103. createVNode(_component_van_field, {
  104. style: { "align-items": "center" },
  105. modelValue: username.value,
  106. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => username.value = $event),
  107. name: "username",
  108. label: "验证码",
  109. "label-width": "70",
  110. placeholder: "请输入验证码",
  111. rules: [{ required: true, message: "请填写账号" }]
  112. }, {
  113. button: withCtx(() => [
  114. createVNode(_component_van_button, {
  115. type: "primary",
  116. size: "mini"
  117. }, {
  118. default: withCtx(() => _cache[3] || (_cache[3] = [
  119. createTextVNode("获取验证码")
  120. ])),
  121. _: 1
  122. })
  123. ]),
  124. _: 1
  125. }, 8, ["modelValue"]),
  126. createVNode(_component_van_field, {
  127. modelValue: password.value,
  128. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => password.value = $event),
  129. name: "password",
  130. center: "",
  131. clearable: "",
  132. label: "密码",
  133. "label-width": "70",
  134. type: "password",
  135. placeholder: "请输入密码",
  136. rules: [{ required: true, message: "请输入密码" }]
  137. }, null, 8, ["modelValue"])
  138. ]),
  139. _: 1
  140. }),
  141. createBaseVNode("div", _hoisted_4, [
  142. createVNode(_component_van_button, {
  143. round: "",
  144. block: "",
  145. type: "primary",
  146. size: "large",
  147. "native-type": "submit"
  148. }, {
  149. default: withCtx(() => _cache[4] || (_cache[4] = [
  150. createTextVNode("确认")
  151. ])),
  152. _: 1
  153. })
  154. ]),
  155. createBaseVNode("div", { style: { "padding": "0px 16px", "display": "flex", "justify-content": "space-between" } }, [
  156. createBaseVNode("div", null, [
  157. _cache[5] || (_cache[5] = createBaseVNode("span", null, "密码已找回?", -1)),
  158. createBaseVNode("a", { onClick: onLogin }, "去登录")
  159. ])
  160. ])
  161. ]),
  162. _: 1
  163. }, 512)
  164. ])
  165. ])
  166. ]);
  167. };
  168. }
  169. });
  170. const Changepassword_vue_vue_type_style_index_0_scoped_ec25cabe_lang = "";
  171. const Changepassword = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ec25cabe"]]);
  172. export {
  173. Changepassword as default
  174. };