Browse Source

修改密码页面

lzw 3 months ago
parent
commit
fbdb7dbcef
3 changed files with 200 additions and 0 deletions
  1. 1 0
      src/assets/startIcon.svg
  2. 190 0
      src/components/pages/changePswd/changePswd.vue
  3. 9 0
      src/router/index.js

+ 1 - 0
src/assets/startIcon.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1735895368402" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2284" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M927 679.5L635.7 511.7 927 343.9c29.1-14.6 43.7-58.3 22.1-87.4-14.6-29.1-58.3-43.7-87.4-22.1L570.5 402.2V67.8c7-36.7-22.1-65.8-58.3-65.8-36.1 0-65.8 29.1-65.8 65.8v335L155.1 235c-22.1-21.6-65.8-7-80.4 22.1-14.6 29.1-7.6 72.8 22.1 87.4l291.3 167.8L96.9 680.1c-29.1 14.6-43.7 58.3-21.6 87.4 14.6 22.1 36.7 29.1 58.3 29.1 7 0 21.6 0 29.1-7.6L454 621.2v335c-7.6 36.7 22.1 65.8 58.3 65.8 36.1 0 65.2-29.1 65.2-65.8v-335L868.7 789c7.6 7.6 22.1 7.6 29.1 7.6 22.1 0 43.7-14.6 58.3-29.1 7-29.8 0-73.5-29.1-88z" fill="#E52323" p-id="2285"></path></svg>

+ 190 - 0
src/components/pages/changePswd/changePswd.vue

@@ -0,0 +1,190 @@
+<template>
+    <div class="changeBox">
+        <div class="changeArea">
+            <div>
+                <div class="changeTitle">
+                    <div>您的密码过于简单</div>
+                    <div>请重新修改</div>
+                </div>
+                <div class="changeContent">
+                    <div class="dialog-content-item-content">
+                        <span>
+                            账号
+                        </span>
+                        <input v-model="account" type="text" placeholder="请输入新账户" class="input" />
+                    </div>
+                    <div class="dialog-content-item-content">
+                        <span>
+                            <img src="@/assets/startIcon.svg" alt="字符" class="search-icon2" />
+                            新密码
+                        </span>
+                        <input v-model="password" type="password" placeholder="请输入新密码" class="input" />
+                    </div>
+                    <div class="dialog-content-item-content">
+                        <span>
+                            <img src="@/assets/startIcon.svg" alt="字符" class="search-icon2" />
+                            新密码确认
+                        </span>
+                        <input v-model="password1" type="password" placeholder="请输入新密码" class="input" />
+                    </div>
+                    <div class="user_p">
+                        <p>
+                            要确保您的帐户安全无虑,请设置安全系数高的密码,例如:密码应由字母或符号、数字组成.
+                        </p>
+                    </div>
+                    <button class="button" @click="confirmPswd">确认提交</button>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</template>
+<script>
+export default {
+    name: 'changePswd',
+    data() {
+        return {
+            userid: this.$route.query.userid,
+            account: '',
+            password: '',
+            password1: ''
+        }
+    },
+    methods: {
+        getUser() {
+            let params = {
+                userid: this.userid
+            };
+            this.ajax
+                .get(this.$store.state.api + "selectUser", params)
+                .then(res => {
+                    this.account = res.data[0][0].accountNumber
+
+                })
+                .catch(err => {
+                    console.error(err);
+                });
+        },
+        confirmPswd() {
+            // 检查 password 和 password1 是否为空
+            if (!this.password) {
+                this.$message.error("请输入新密码");
+                return;
+            }
+            if (!this.password1) {
+                this.$message.error("请确认新密码");
+                return;
+            }
+
+            const reg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,16}$/;
+            if (!reg.test(this.password)) {
+                this.$message.error("密码长度为8-16位,且包含大小写字母");
+                return;
+            } else if (this.password != this.password1) {
+                this.$message.error("两次新密码不相同");
+                return;
+            }
+
+            let params = [
+                {
+                    uid: this.userid,
+                    pa: this.password
+                }
+            ];
+            this.ajax
+                .post(this.$store.state.api + "iniPassword", params)
+                .then((res) => {
+                    if (res.data.success == 1) {
+                        this.$message.success("修改成功")
+                        this.password = '';
+                        this.password1 = '';
+                        window.topU.U.UF.F.closeWindow(window.topU.U.UF.UI.form.allForm['updatePaDialog']);
+                    }
+                    else {
+                        this.$message.error("修改失败");
+                    }
+
+                })
+                .catch((err) => {
+                    this.$message.error("修改失败");
+                    console.error(err);
+                });
+        }
+    },
+    mounted() {
+        this.getUser()
+    },
+}
+</script>
+<style scoped>
+.changeBox {
+    background-color: #fff;
+    height: 100vh;
+}
+
+.changeArea {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    height: 100%;
+}
+
+.changeTitle div {
+    font-size: 32px;
+    font-weight: bold;
+    margin-bottom: 7px;
+}
+
+.dialog-content-item-content {
+    font-size: 15px;
+    font-weight: 550;
+    margin-top: 20px;
+}
+
+/* input输入框样式 */
+.input {
+    width: 100%;
+    padding: 8px;
+    margin-top: 10px;
+    border: 1px solid #ccc;
+    border-radius: 4px;
+    background-color: #f0f2f5;
+    height: 36px;
+    outline: none;
+}
+
+.input>>>.el-input--suffix .el-input__inner {
+    padding: 0
+}
+
+/* 用户协议框架 */
+.user_p {
+    height: 50px;
+    margin-top: 20px;
+}
+
+.user_p p {
+    color: #535353;
+    font-size: 15px
+}
+
+/* 提交按钮样式 */
+.button {
+    width: 100%;
+    height: 50px;
+    background-color: #3681fc;
+    color: white;
+    border: none;
+    border-radius: 5px;
+    font-size: 16px;
+    cursor: pointer;
+    text-align: center;
+    margin-top: 40px;
+    outline: none;
+}
+
+.search-icon2 {
+    width: 10px;
+    height: 10px;
+}
+</style>

+ 9 - 0
src/router/index.js

@@ -5,6 +5,7 @@ import 'element-ui/lib/theme-chalk/index.css'
 import inviteLogin from '@/components/pages/inviteLogin/inviteLogin'
 import inviteLoginSZ from '@/components/pages/inviteLoginSZ/inviteLogin'
 import inviteLoginST from '@/components/pages/inviteLoginST/inviteLogin'
+import changePswd from '../components/pages/changePswd/changePswd.vue'
 
 // 全局修改默认配置,点击空白处不能关闭弹窗
 ElementUI.Dialog.props.closeOnClickModal.default = false
@@ -35,5 +36,13 @@ export default new Router({
                         requireAuth: '' // 不需要鉴权
                 }
         },
+        {
+            path: '/changePswd',
+            name: 'changePswd',
+            component: changePswd,
+            meta: {
+                    requireAuth: '' // 不需要鉴权
+            }
+    },
     ]
 })