| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- 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";
- import { C as CellGroup } from "./index-3a8cf159.js";
- import { B as Button } from "./index-b1054607.js";
- import "./index-8540448e.js";
- import { F as Field } from "./index-41ec7e28.js";
- import { u as useLocalStore, p as post } from "./request-76e4192b.js";
- import { F as Form } from "./index-0229ad12.js";
- import "./use-scope-id-0b5b8615.js";
- import "./index-487cde8c.js";
- import "./use-route-726f0d0b.js";
- import "./index-217c49a0.js";
- import "./axios-8cd254ce.js";
- const _hoisted_1 = { style: { "height": "100vh", "overflow": "hidden", "display": "flex", "flex-direction": "column" } };
- 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%" } };
- const _hoisted_3 = { style: { "margin-top": "60px" } };
- const _hoisted_4 = { style: { "margin": "16px" } };
- const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "Changepassword",
- setup(__props) {
- const router = useRouter();
- const localStore = useLocalStore();
- const formRef = ref();
- const username = ref("");
- const password = ref("");
- const rememberPasswordChecked = ref(true);
- const onLogin = () => {
- router.replace("/login");
- };
- onMounted(() => {
- console.log("onMounted");
- rememberPasswordChecked.value = localStore.$state.rememberPassword;
- if (rememberPasswordChecked.value) {
- username.value = localStore.$state.username;
- password.value = localStore.$state.password;
- }
- });
- const onSubmit = () => {
- var _a;
- (_a = formRef.value) == null ? void 0 : _a.validate().then(() => {
- localStore.$patch({
- rememberPassword: rememberPasswordChecked.value
- });
- if (rememberPasswordChecked.value) {
- localStore.$patch({
- username: username.value,
- password: password.value
- });
- }
- post("/user/login", {
- username: username.value,
- password: password.value
- }).then(({ data }) => {
- console.log(data);
- if (data.code == 0) {
- localStore.$patch((state) => {
- state.token = data.data.token;
- });
- router.push("/");
- }
- });
- }).catch((ex) => {
- console.log(ex);
- });
- };
- return (_ctx, _cache) => {
- const _component_van_field = Field;
- const _component_van_button = Button;
- const _component_van_cell_group = CellGroup;
- const _component_van_form = Form;
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", _hoisted_2, [
- _cache[6] || (_cache[6] = createBaseVNode("div", { style: { "padding": "100px 16px 30px 32px", "display": "flex", "justify-content": "space-between", "align-items": "center" } }, [
- createBaseVNode("div", null, [
- createBaseVNode("div", { style: { "color": "#5C677C", "height": "30px" } }),
- createBaseVNode("div", { style: { "font-size": "1.1rem", "font-weight": "bold" } }, [
- createBaseVNode("span", null, "忘记密码")
- ]),
- createBaseVNode("div", { style: { "font-size": "0.9rem", "color": "#6D7A90" } }, [
- createBaseVNode("span", null, "请输入手机号和验证码找回密码")
- ])
- ])
- ], -1)),
- createBaseVNode("div", _hoisted_3, [
- createVNode(_component_van_form, {
- ref_key: "formRef",
- ref: formRef,
- "show-error": "",
- "show-error-message": false,
- onSubmit
- }, {
- default: withCtx(() => [
- createVNode(_component_van_cell_group, { inset: "" }, {
- default: withCtx(() => [
- createVNode(_component_van_field, {
- modelValue: username.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => username.value = $event),
- name: "username",
- label: "手机号",
- "label-width": "70",
- placeholder: "请输入账号",
- rules: [{ required: true, message: "请填写账号" }]
- }, null, 8, ["modelValue"]),
- createVNode(_component_van_field, {
- style: { "align-items": "center" },
- modelValue: username.value,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => username.value = $event),
- name: "username",
- label: "验证码",
- "label-width": "70",
- placeholder: "请输入验证码",
- rules: [{ required: true, message: "请填写账号" }]
- }, {
- button: withCtx(() => [
- createVNode(_component_van_button, {
- type: "primary",
- size: "mini"
- }, {
- default: withCtx(() => _cache[3] || (_cache[3] = [
- createTextVNode("获取验证码")
- ])),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_van_field, {
- modelValue: password.value,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => password.value = $event),
- name: "password",
- center: "",
- clearable: "",
- label: "密码",
- "label-width": "70",
- type: "password",
- placeholder: "请输入密码",
- rules: [{ required: true, message: "请输入密码" }]
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_4, [
- createVNode(_component_van_button, {
- round: "",
- block: "",
- type: "primary",
- size: "large",
- "native-type": "submit"
- }, {
- default: withCtx(() => _cache[4] || (_cache[4] = [
- createTextVNode("确认")
- ])),
- _: 1
- })
- ]),
- createBaseVNode("div", { style: { "padding": "0px 16px", "display": "flex", "justify-content": "space-between" } }, [
- createBaseVNode("div", null, [
- _cache[5] || (_cache[5] = createBaseVNode("span", null, "密码已找回?", -1)),
- createBaseVNode("a", { onClick: onLogin }, "去登录")
- ])
- ])
- ]),
- _: 1
- }, 512)
- ])
- ])
- ]);
- };
- }
- });
- const Changepassword_vue_vue_type_style_index_0_scoped_ec25cabe_lang = "";
- const Changepassword = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ec25cabe"]]);
- export {
- Changepassword as default
- };
|