qinyan 1 年之前
父節點
當前提交
c141aa747f

+ 1 - 1
package.json

@@ -26,7 +26,7 @@
     "@ckeditor/ckeditor5-theme-lark": "^38.0.0",
     "@ckeditor/ckeditor5-vue": "^5.1.0",
     "@linaria/core": "^4.1.1",
-    "@queenjs-modules/auth": "^0.0.18",
+    "@queenjs-modules/auth": "^0.0.19",
     "@queenjs-modules/queditor": "0.0.13",
     "@queenjs-modules/queentree": "^0.0.10",
     "@queenjs-modules/queentree-explorer": "^0.0.6",

+ 3 - 1
src/pages/website/Promotion2/controller.tsx

@@ -39,7 +39,9 @@ export function createPromotinController(
     resource.showModal(
       <ShareModal record={record} controller={ctrl}>
         {{
-          preview: () => <editor.components.Preview />,
+          preview: () => (
+            <editor.components.Preview class="pointer-events-none" />
+          ),
         }}
       </ShareModal>,
       {

+ 0 - 112
src/pages/website/Settings/ResetForm.tsx

@@ -1,112 +0,0 @@
-import { useAuth } from "@queenjs-modules/auth";
-import { CaptchaInput } from "@queenjs-modules/auth/components/components/captcha";
-import { Button, Form, Input } from "ant-design-vue";
-import { queenApi } from "queenjs";
-import { defineComponent, reactive } from "vue";
-
-const layout = {
-  wrapperCol: { span: 24 },
-};
-const tailLayout = {
-  wrapperCol: { span: 24 },
-};
-
-export default defineComponent({
-  emits: ["success"],
-  setup(props, { emit }) {
-    const auth = useAuth();
-
-    const state = reactive({
-      loading: false,
-    });
-
-    const formState = reactive({
-      phone: "",
-      code: "",
-      password: "",
-      rePwd: "",
-    });
-
-    const rules = reactive({
-      phone: [{ required: true, message: "手机号不能为空", trigger: "change" }],
-      code: [{ required: true, message: "验证码不能为空", trigger: "change" }],
-      password: [
-        { required: true, message: "密码不能为空", trigger: "change" },
-      ],
-      rePwd: [{ required: true, message: "请确认密码", trigger: "change" }],
-    });
-
-    const { validate, validateInfos } = Form.useForm(formState, rules);
-
-    const submit = async () => {
-      try {
-        state.loading = true;
-        const { rePwd, ...formData } = await validate();
-        if (rePwd !== formData.password) {
-          queenApi.messageError("输入密码不一致!");
-          return;
-        }
-        await auth.actions.resetPassword(formData);
-        emit("success");
-      } finally {
-        state.loading = false;
-      }
-    };
-
-    function getCodeByClick() {
-      return auth.actions.getSmsCode({
-        phone: formState.phone,
-        use: "resetPasswd",
-      });
-    }
-
-    return () => (
-      <Form {...layout} name="basic">
-        <Form.Item name="phone" {...validateInfos.phone}>
-          <Input
-            placeholder="请输入手机号码"
-            v-model={[formState.phone, "value"]}
-            maxlength={30}
-          />
-        </Form.Item>
-        <Form.Item name="code" {...validateInfos.code}>
-          <CaptchaInput
-            disabled={!/^1[3456789]\d{9}$/.test(formState.phone)}
-            value={formState.code}
-            onChange={(v) => (formState.code = v)}
-            onGetCode={getCodeByClick}
-          />
-        </Form.Item>
-        <Form.Item name="password" {...validateInfos.password}>
-          <Input
-            type="password"
-            placeholder="请设置密码"
-            v-model={[formState.password, "value"]}
-            maxlength={12}
-          />
-        </Form.Item>
-        <Form.Item name="rePwd" {...validateInfos.rePwd}>
-          <Input
-            type="password"
-            placeholder="再次确认密码"
-            v-model={[formState.rePwd, "value"]}
-            maxlength={12}
-          />
-        </Form.Item>
-        <Form.Item {...tailLayout}>
-          <Button
-            htmlType="submit"
-            block
-            type="primary"
-            size="large"
-            shape="round"
-            loading={state.loading}
-            onClick={submit}
-          >
-            修改密码
-          </Button>
-        </Form.Item>
-      </Form>
-    );
-  },
-});

+ 0 - 22
src/pages/website/Settings/ResetPassModal.tsx

@@ -1,22 +0,0 @@
-import { useModal } from "queenjs";
-import { defineComponent } from "vue";
-import ResetForm from "./ResetForm";
-import { useAuth } from "@queenjs-modules/auth";
-
-export default defineComponent({
-  setup() {
-    const modal = useModal();
-    const auth = useAuth();
-
-    return () => {
-      return (
-        <ResetForm
-          onSuccess={() => {
-            modal.cancel();
-            auth.actions.logout();
-          }}
-        />
-      );
-    };
-  },
-});

+ 16 - 6
src/pages/website/Settings/index.tsx

@@ -1,20 +1,30 @@
+import { useAuth } from "@queenjs-modules/auth";
+import ResetForm from "@queenjs-modules/auth/components/components/ResetForm";
 import { IconLock } from "@queenjs/icons";
 import { Button, Tabs } from "ant-design-vue";
 import { queenApi } from "queenjs";
+import Modal from "queenjs/adapter/vue/components/modal";
 import { defineComponent } from "vue";
-import ResetPassModal from "./ResetPassModal";
 
 const options = ["账户与安全"];
 
 export default defineComponent({
   setup() {
-    // const modal = useModal();
+    const auth = useAuth();
 
     const showModal = () => {
-      queenApi.dialog(<ResetPassModal />, {
-        width: "400px",
-        title: "修改密码",
-      });
+      queenApi.dialog(
+        <ResetForm
+          onSuccess={() => {
+            Modal.clear();
+            auth.actions.logout();
+          }}
+        />,
+        {
+          width: "400px",
+          title: "修改密码",
+        }
+      );
     };
 
     return () => (

+ 4 - 4
yarn.lock

@@ -1736,10 +1736,10 @@
   resolved "http://124.70.149.18:4873/@polka%2furl/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1"
   integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==
 
-"@queenjs-modules/auth@^0.0.18":
-  version "0.0.18"
-  resolved "http://124.70.149.18:4873/@queenjs-modules%2fauth/-/auth-0.0.18.tgz#48a7abd1023cee213cbfdd1b822e52041a070818"
-  integrity sha512-zQGPz1GUR2QE3qCkfpdQ3vDkNNuFRhvrD+ErCynnlDP/QQNgvOoHizPEO5OE4VzdBu+/psGWymQs+9zONGuO3A==
+"@queenjs-modules/auth@^0.0.19":
+  version "0.0.19"
+  resolved "http://124.70.149.18:4873/@queenjs-modules%2fauth/-/auth-0.0.19.tgz#2235626d3a628e3a359ef56c3b003b2cb8f3f9c2"
+  integrity sha512-4t7YAhDqy2JRrUMhUbV1PTGZvZjOcUp2dUFZcVHKT/+1l04qkzn4qOnINGxxGr2Dejmcuz9piEXYkQ/gWDPj3Q==
 
 "@queenjs-modules/queditor@0.0.13":
   version "0.0.13"