jiangping
2024-11-29 a2e8793e2c53c7e80b67c1fe407b78fde59b2296
admin/src/components/common/CommonHeader.vue
@@ -31,10 +31,9 @@
      </div>
    </div>
    <!-- 修改密码 -->
    <template v-if="editPsd">
      <GlobalAlertWindow title="修改密码" :visible.sync="visible.changePwd"
        :showClose="!userInfo.needChangePwd || userInfo.needChangePwd == '0'"
        :showCancel="!userInfo.needChangePwd || userInfo.needChangePwd == '0'" @confirm="confirmChangePwd"
        :showClose="userInfo && (!userInfo.needChangePwd || userInfo.needChangePwd == '0')"
        :showCancel="userInfo && (!userInfo.needChangePwd || userInfo.needChangePwd == '0')" @confirm="confirmChangePwd"
        @close="visible.changePwd = false">
        <el-form :model="changePwdData.form" ref="changePwdDataForm" :rules="changePwdData.rules">
          <el-form-item label="原始密码" prop="oldPwd" required>
@@ -52,8 +51,6 @@
          </el-form-item>
        </el-form>
      </GlobalAlertWindow>
    </template>
  </div>
</template>
@@ -75,7 +72,6 @@
    return {
      title: process.env.VUE_APP_TITLE,
      headerNavData: {},
      editPsd: false,
      visible: {
        // 修改密码
        changePwd: false
@@ -117,8 +113,8 @@
  },
  mounted() {
    // console.log('userInfo',this.userInfo);
    if (!this.userInfo.needChangePwd || this.userInfo.needChangePwd == '0') {
    // needChangePwd 0 : 默认密码需要修改,1 不需要
    if (userInfo &&(!this.userInfo.needChangePwd || this.userInfo.needChangePwd == '0')) {
      this.visible.changePwd = true
    }
  },
@@ -138,8 +134,6 @@
    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo']),
    // 修改密码
    changePwd() {
      this.$set(this.userInfo, 'needChangePwd', this.$store.state.userInfo.needChangePwd)
      this.editPsd = true
      this.visible.changePwd = true
      this.$nextTick(() => {
        this.$refs.changePwdDataForm.resetFields()
@@ -192,6 +186,7 @@
        })
          .then(() => {
            this.$tip.apiSuccess('修改成功')
            this.$store.commit('setUserInfo', {needChangePwd: 1})
            this.visible.changePwd = false
          })
          .catch(e => {