zhaoke 1 рік тому
батько
коміт
b3593688e5
2 змінених файлів з 35 додано та 87 видалено
  1. 1 0
      public/staticConfig.js
  2. 34 87
      src/layout/index.vue

+ 1 - 0
public/staticConfig.js

@@ -6,6 +6,7 @@ window.PLATFROM_CONFIG = {
   appId: 'q7kdjmmaf0kerwpf', //appid
   baggageMessageURL: '/openApi/query',
   getBase64: 'http://10.211.67.163:8083/getBase64',
+  editRule: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[`!@#$%^&*()_+{}":?><`,./';=-])[\da-zA-Z`!@#$%^&*()_+{}":?><`,./';=-]{8,}$/
 }
 
 const baseNewUrl = window.location.hostname

+ 34 - 87
src/layout/index.vue

@@ -1,82 +1,36 @@
 <template>
   <div class="app-wrapper">
-    <sidebar
-      class="sidebar-container"
-      id="sidebar-containers"
-    />
+    <sidebar class="sidebar-container" id="sidebar-containers" />
     <div class="main-container">
       <navbar />
       <app-main id="main-containers" />
     </div>
     <!--修改密码弹框-->
-    <Dialog
-      width="496px"
-      customClass="dataStoreInfoDialog"
-      :flag="pwdflag"
-    >
+    <Dialog width="496px" customClass="dataStoreInfoDialog" :flag="pwdflag">
       <div class="dialog-public-background">
         <div class="title">修改密码</div>
         <div class="content">
           <div class="ruleZf">
-            特殊字符:`、!、@、#、$、%、^、&、*、(、)、_、+、{、}、"、:、?、>、&lt;、`、,、.、/、'、;、[、]、=、-、\、|
+            特殊字符:`、!、@、#、$、%、^、&、*、(、)、_、+、{、}、"、:、?、>、&lt;、`、,、.、/、'、;、=、-
           </div>
           <div class="ruleZf">
             密码规则:长度为8-20个字符,并且必须包含数字、大写字母、小写字母、特殊字符
           </div>
-          <el-form
-            :model="dataForm"
-            :rules="dataRules"
-            ref="dataForm"
-            class="demo-dataForm"
-          >
-            <el-form-item
-              label="旧密码"
-              prop="old"
-            >
-              <el-input
-                size="medium"
-                placeholder="请输入旧密码"
-                show-password
-                v-model="dataForm.old"
-              ></el-input>
+          <el-form :model="dataForm" :rules="dataRules" ref="dataForm" class="demo-dataForm">
+            <el-form-item label="旧密码" prop="old">
+              <el-input size="medium" placeholder="请输入旧密码" show-password v-model="dataForm.old"></el-input>
             </el-form-item>
-            <el-form-item
-              label="新密码"
-              prop="new"
-            >
-              <el-input
-                size="medium"
-                placeholder="请输入新密码"
-                show-password
-                v-model="dataForm.new"
-              ></el-input>
+            <el-form-item label="新密码" prop="new">
+              <el-input size="medium" placeholder="请输入新密码" show-password v-model="dataForm.new"></el-input>
             </el-form-item>
-            <el-form-item
-              label="再次确认新密码"
-              prop="again"
-            >
-              <el-input
-                size="medium"
-                placeholder="请再次确认新密码"
-                show-password
-                v-model="dataForm.again"
-              ></el-input>
+            <el-form-item label="再次确认新密码" prop="again">
+              <el-input size="medium" placeholder="请再次确认新密码" show-password v-model="dataForm.again"></el-input>
             </el-form-item>
           </el-form>
         </div>
         <div class="foot center t30">
-          <el-button
-            size="medium"
-            type="primary"
-            @click="addSubmit('dataForm')"
-            class="r24"
-            >保存</el-button
-          >
-          <el-button
-            size="medium"
-            @click="resetForm('dataForm')"
-            >取消</el-button
-          >
+          <el-button size="medium" type="primary" @click="addSubmit('dataForm')" class="r24">保存</el-button>
+          <el-button size="medium" @click="resetForm('dataForm')">取消</el-button>
         </div>
       </div>
     </Dialog>
@@ -85,23 +39,9 @@
       <div class="airportInfoDialog">
         <div class="flx">退出系统</div>
         <div class="content">是否确认退出系统?</div>
-        <div
-          class="foot right t30"
-          style="margin-top: 24px"
-        >
-          <el-button
-            size="medium"
-            class="r25 r26"
-            @click="outQd"
-            type="primary"
-            >确定</el-button
-          >
-          <el-button
-            size="medium"
-            @click="outQx"
-            class="r26"
-            >取消</el-button
-          >
+        <div class="foot right t30" style="margin-top: 24px">
+          <el-button size="medium" class="r25 r26" @click="outQd" type="primary">确定</el-button>
+          <el-button size="medium" @click="outQx" class="r26">取消</el-button>
         </div>
       </div>
     </Dialog>
@@ -132,7 +72,7 @@ export default {
     AbnormalBaggageDialog,
   },
   mixins: [ResizeMixin],
-  data() {
+  data () {
     return {
       dataForm: {
         //数据项表单
@@ -156,30 +96,37 @@ export default {
   },
   methods: {
     //存储数据项-提交
-    addSubmit(formName) {
+    addSubmit (formName) {
       this.$refs[formName].validate(valid => {
         if (valid) {
-          if (this.dataForm.new !== this.dataForm.again) {
-            this.$message.error('两次输入的密码不一致,请重新输入')
-            return false
+          const r = PLATFROM_CONFIG.editRule
+          const b = r.test(this.dataForm.new)
+          if (b) {
+            if (this.dataForm.new !== this.dataForm.again) {
+              this.$message.error('两次输入的密码不一致,请重新输入')
+              return false
+            }
+            this.editPwd()
+          }
+          else {
+            this.$message.error('请根据密码规则设置密码')
           }
-          this.editPwd()
         } else {
           return false
         }
       })
     },
     //存储数据项-取消
-    resetForm(formName) {
+    resetForm (formName) {
       this.$store.dispatch('app/togglePwdflag', false)
       this.$refs[formName].resetFields()
     },
     //退出系统-取消
-    outQx() {
+    outQx () {
       this.$store.dispatch('app/toggleOutflag', false)
     },
     //退出系统-确定
-    async outQd() {
+    async outQd () {
       const res = await this.$store.dispatch('user/logout')
       const that = this
       if (res) {
@@ -198,7 +145,7 @@ export default {
       }
     },
     // 修改密码
-    async editPwd() {
+    async editPwd () {
       try {
         const res = await modifyData({
           serviceId: SERVICE_ID.changePwd,
@@ -244,8 +191,8 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-@import '~@/styles/mixin.scss';
-@import '~@/styles/variables.scss';
+@import "~@/styles/mixin.scss";
+@import "~@/styles/variables.scss";
 
 .app-wrapper {
   @include clearfix;