From 89761212ad3ac02b68276d82c26ab6cd767ea216 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu <819527061@qq.com>
Date: 星期二, 06 一月 2026 14:56:29 +0800
Subject: [PATCH] 新政修改密码功能

---
 pages/home/home.vue |  283 ++++++++++++++++++++++++++++++++++++++++++++++
 utils/jihua.js      |    5 
 utils/request.js    |    4 
 utils/index.js      |   13 ++
 main.js             |    3 
 5 files changed, 300 insertions(+), 8 deletions(-)

diff --git a/main.js b/main.js
index 5a527eb..bf891bc 100644
--- a/main.js
+++ b/main.js
@@ -9,10 +9,11 @@
 
 
 // 璇锋眰鐩稿叧
-import { reqAll, reqGet, reqPost } from './utils/index.js';
+import { reqAll, reqGet, reqPost, reqPut } from './utils/index.js';
 Vue.prototype.$reqAll = reqAll;
 Vue.prototype.$reqGet = reqGet;
 Vue.prototype.$reqPost = reqPost;
+Vue.prototype.$reqPut = reqPut;
 
 Vue.prototype.$store = store
 
diff --git a/pages/home/home.vue b/pages/home/home.vue
index b89a968..81c1ea5 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -145,7 +145,7 @@
                   <view class="num">{{item.lyDSum || 0}}</view>
                 </view>
                 <view class="caol-block">
-                  <view class="name">鏃ュ悎璁�(鍏�)</view>
+                  <view class="name">鏃ュ悎璁�(鍚�)</view>
                   <view class="num">{{item.d1 || 0}}</view>
                 </view>
               </view>
@@ -529,6 +529,14 @@
 		<!-- 鑿滃崟鏍� -->
 		<!-- <popup-menu @menuShow="menushow" ref="menuRef"></popup-menu> -->
 		<u-gap height="15" bgColor="#eeeeee"></u-gap>
+
+
+
+    <view class="editorPass" @click="handlePwd">
+        <image class="icon" src="@/static/home/editorIcon.png"></image>
+        <view class="">淇敼瀵嗙爜</view>
+    </view>
+    <view class="huiseBox"></view>
 		<view class="utils">
 			<view class="utils-container">
 				<view class="utils-container-body" @click="redirectLogin">
@@ -542,6 +550,66 @@
 			</view>
 		</view>
 		<u-gap height="60" bgColor="#eeeeee"></u-gap>
+
+    <view class="passWord-main-box">
+      <u-popup :show="passShow"
+               :closeable="true"
+               :closeOnClickOverlay="true"
+               @close="handleClosePassShow"
+               mode="center"
+               width="90%"
+               class="passBox">
+        <view class="popup-box">
+          <u-form :model="formData" ref="uForm" borderBottom :rules="rules" :label-width="150">
+            <u-form-item prop="password" label="鍘熷瘑鐮�" borderBottom>
+              <u-input
+                  class="flex-1"
+                  type="password"
+                  v-model="formData.password"
+                  :border="false"
+                  placeholder="璇疯緭鍏ュ師鏉ョ殑瀵嗙爜"
+              />
+            </u-form-item>
+            <u-form-item prop="newpassword1" label="鏂板瘑鐮�" borderBottom>
+              <u-input
+                  class="flex-1"
+                  type="password"
+                  v-model="formData.newpassword1"
+                  placeholder="瀵嗙爜搴旂敱8-16浣嶆暟瀛椼�佸瓧姣嶃�佺鍙风粍鎴愩�傝涓嶈浣跨敤瀹规槗琚寽鍒扮殑瀵嗙爜"
+                  :border="false"
+              />
+            </u-form-item>
+            <view class="intensity">
+              <view class="psdText">瀵嗙爜寮哄害</view>
+              <view
+                  class="line"
+                  :class="[level.includes('low') ? 'low' : '']"></view>
+              <view
+                  class="line"
+                  :class="[level.includes('middle') ? 'middle' : '']"></view>
+              <view
+                  class="line"
+                  :class="[level.includes('high') ? 'high' : '']"></view>
+              <div class="warningtext">
+                瀵嗙爜搴旂敱8-16浣嶆暟瀛椼�佸瓧姣嶃�佺鍙风粍鎴愩�傝涓嶈浣跨敤瀹规槗琚寽鍒扮殑瀵嗙爜
+              </div>
+            </view>
+            <u-form-item prop="newpassword2" label="纭瀵嗙爜" borderBottom>
+              <u-input
+                  class="flex-1"
+                  type="password"
+                  v-model="formData.newpassword2"
+                  placeholder="鍐嶆杈撳叆鏂板瘑鐮�"
+                  :border="false"
+              />
+            </u-form-item>
+          </u-form>
+          <view class="sumbmit-box">
+            <u-button type="primary" shape="circle" @click="handlePassConfirm" :loading="sumbLoading"> 纭畾 </u-button>
+          </view>
+        </view>
+      </u-popup>
+    </view>
 	</view>
 </template>
 
@@ -576,7 +644,83 @@
 		}
 	},
 	data() {
+    const validatePass = (rule, value, callback) => {
+      if (this.formData.newpassword1 !== "") {
+        if (value !== this.formData.newpassword1) {
+          callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!"));
+        } else {
+          callback();
+        }
+      } else {
+        callback();
+      }
+    };
+    const checkPassword = (rule, value, callback) => {
+      // let roles = this.$store.getters.roles;//褰撳墠鐢ㄦ埛瑙掕壊id
+      // let passL = 8;
+      // if (roles.concat(1)){
+      //   passL = 10
+      // }
+      let passL = 8;
+      this.level = []
+      if(!value) {
+        return callback('瀵嗙爜涓嶈兘涓虹┖')
+      }
+      if(value.length < passL) {
+        return callback(`瀵嗙爜涓嶈兘灏戜簬${passL}浣峘)
+      }
+      if(value.length > 16) {
+        return callback('瀵嗙爜涓嶈兘澶т簬16浣�')
+      }
+      //鏍¢獙鏄暟瀛�
+      const regex1 = /^\d+$/
+      // 鏍¢獙瀛楁瘝
+      const regex2 = /^[A-Za-z]+$/
+      // 鏍¢獙绗﹀彿
+      const regex3 =
+          /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥�'锛屻�傘�乚+$/
+      if(regex1.test(value)) {
+        this.level.push('low')
+        return callback('瀵嗙爜寮哄害杩囦綆')
+      }else if(regex2.test(value)) {
+        this.level.push('low')
+        return callback('瀵嗙爜寮哄害杩囦綆')
+      }else if(regex3.test(value)) {
+        this.level.push('low')
+        return callback('瀵嗙爜寮哄害杩囦綆')
+      }else if(/^[A-Za-z\d]+$/.test(value)) {
+        this.level.push('low')
+        this.level.push('middle')
+        return callback('瀵嗙爜寮哄害杩囦綆')
+      }else if(
+          /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥�'锛屻�傘�乗d]+$/.test(
+              value
+          )
+      ) {
+        this.level.push('low')
+        this.level.push('middle')
+        return callback('瀵嗙爜寮哄害杩囦綆')
+      }else if(
+          /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥�'锛屻�傘�丄-Za-z]+$/.test(
+              value
+          )
+      ) {
+        this.level.push('low')
+        this.level.push('middle')
+        return callback('瀵嗙爜寮哄害杩囦綆')
+      } else if (
+          /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥�'锛屻�傘�丄-Za-z\d]+$/.test(
+              value
+          )
+      ) {
+        this.level.push('low')
+        this.level.push('middle')
+        this.level.push('high')
+      }
+      return callback()
+    };
 		return {
+      level:[],
 			// ucharts鍥捐〃
 			chartData: {},
 			opts: {
@@ -652,7 +796,6 @@
 			procInstId: '',
 			// 閫夋嫨鍣�
 			statusSeletShow: false,
-			statusList: [['涓浗', '缇庡浗', '鏃ユ湰']],
 			// data
 			shenqingData: [],
 			daibanData: [],
@@ -694,12 +837,37 @@
       d1Sum:0,  //鎬昏
       lyDSumSum:0,  //璺繍
       dsumSum:0,  //姹借繍
+      passShow: false,  //瀵嗙爜寮规
+      sumbLoading: false,
+      formData: {
+        password:'',
+        newpassword1:'',
+        newpassword2:'',
+      },
+      rules: {
+        password: [{
+          type: 'string',
+          required: true,
+          message: '璇峰~鍐欏瘑鐮�',
+          trigger: ['blur', 'change']
+        }],
+        newpassword1: [{
+          required: true,
+          validator: checkPassword,
+          trigger: 'change'
+        }],
+        newpassword2: [{
+          required: true,
+          validator: validatePass,
+          trigger: "blur"
+        }]
+      }
 		};
 	},
 	// 鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚銆傛敞鎰忓鏋滄覆鏌撻�熷害蹇紝浼氬湪椤甸潰杩涘叆鍔ㄧ敾瀹屾垚鍓嶈Е鍙�
-	// onReady() {
-
-	// },
+	onReady() {
+    this.$refs.uForm.setRules(this.rules)
+	},
 	// 鐐瑰嚮瀵艰埅鏍忚彍鍗曞悗
 	onNavigationBarButtonTap(e) {
 		console.log('閫�鍑哄鑸爮鎸夐挳浜嬩欢', e);
@@ -776,6 +944,41 @@
     },
   },
 	methods: {
+    handlePassConfirm() { //淇敼瀵嗙爜
+      //鍒楄〃鏌ヨ
+      this.$refs.uForm.validate().then(res => {
+        this.sumbLoading = true
+        uni.showLoading({
+          title: '姝e湪鍔犺浇...'
+        });
+        this.formData.deptId = uni.getStorageSync('userInfo')?.deptId
+        this.formData.username = uni.getStorageSync('userInfo')?.username
+        this.$reqPut('editInfo',this.formData).then(res => {
+          if (res.code == 0) {
+            this.passShow = false
+            this.sumbLoading = false
+            this.$u.toast('淇敼瀵嗙爜鎴愬姛!');
+            setTimeout(() => {
+              uni.reLaunch({
+                url:"/pages/login/login"
+              })
+            }, 1000)
+            uni.hideLoading();
+          }else {
+            this.$u.toast(res.msg || '淇敼瀵嗙爜澶辫触');
+            this.sumbLoading = false
+            uni.hideLoading();
+          }
+        })
+      })
+
+    },
+    handleClosePassShow() {
+      this.passShow = false
+    },
+    handlePwd() {
+      this.passShow = true
+    },
     handleShouKuanIsMore() {  //褰撴棩鏀舵鎯呭喌
       this.shoukuanIsMore = !this.shoukuanIsMore
     },
@@ -1225,6 +1428,17 @@
 ::v-deep{
   .uni-table-td,.uni-table-th{
     color: #000;
+  }
+  .u-popup__content{
+    width: 85%;
+    padding: 40rpx;
+    box-sizing: border-box;
+    border-radius: 10rpx;
+  }
+  .passWord-main-box{
+    .u-icon__icon{
+      font-size: 28rpx!important;
+    }
   }
 }
 ::v-deep.home {
@@ -1745,4 +1959,63 @@
     }
   }
 }
+.sumbmit-box{
+  margin-top: 40rpx;
+}
+.editorPass{
+  width: 100%;
+  justify-content: center;
+  display: flex;
+  margin: 20rpx 0;
+  align-items: center;
+  .icon{
+    width: 46rpx;
+    height: 46rpx;
+    margin-right: 10rpx;
+  }
+}
+.huiseBox{
+  width: 100%;
+  height: 12rpx;
+  background: #eeeeee;
+}
+.intensity {
+  width: 100%;
+  margin-top: 10rpx;
+  .psdText {
+    font-size: 14px;
+    margin-right: 10px;
+  }
+
+  .line {
+    display: inline-block;
+    width: 70rpx;
+    height: 8rpx;
+    background: #d8d8d8;
+    border-radius: 6rpx;
+    margin-right: 16rpx;
+
+    &.low {
+      background: #f4664a;
+    }
+
+    &.middle {
+      background: #ffb700;
+    }
+
+    &.high {
+      background: #2cbb79;
+    }
+  }
+
+  .level {
+    margin: 0 32rpx 0 16rpx;
+  }
+
+  .warningtext {
+    color: #5a5a5a;
+    font-size: 24rpx;
+    margin-top: 10rpx;
+  }
+}
 </style>
diff --git a/utils/index.js b/utils/index.js
index 1c6b914..73d0f11 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -39,3 +39,16 @@
 	opt.params = params;
 	return fetch(url, opt)
 }
+
+// put璇锋眰
+export const reqPut = (url, params,form, opt = {}) => {
+    if(form == 'form'){
+        opt.header = {'Content-Type': 'application/x-www-form-urlencoded'}
+    } else {
+        opt.header = typeObj['headerPOST'];
+    }
+    opt.method = "PUT";
+    opt.data = params;
+    opt.params = params;
+    return fetch(url, opt)
+}
diff --git a/utils/jihua.js b/utils/jihua.js
index 8f080eb..0b4e480 100644
--- a/utils/jihua.js
+++ b/utils/jihua.js
@@ -22,6 +22,11 @@
 		method:'GET'
 	},
 
+    editInfo:{  // 鏇存敼涓汉淇℃伅
+        url:'/admin/user/edit',
+        method:'put'
+    },
+
 
 	xscarshippingdayplan: {
 		url: '/yunxiao/xscarshippingdayplan/page',
diff --git a/utils/request.js b/utils/request.js
index 0cd164d..4718052 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -86,9 +86,9 @@
  // let BaseUrl = 'http://192.168.0.115:9999';
 // const BaseUrl = 'https://mx.jzeg.cn:9998';
 // const BaseUrl = 'https://mx.res.jzeg.cn:8887';
-const BaseUrl = 'https://mxwx.res.jzeg.cn:8887';
+const BaseUrl = 'https://mxwx.res.jzeg.cn:8887';  //绾夸笂
 // let BaseUrl = 'http://192.168.0.114:9999';
-// const BaseUrl = 'http://192.168.0.102:9999'; // 椋炲摜
+// const BaseUrl = 'http://192.168.0.148:9999'; // 椋炲摜
 
 //const BaseUrl = "https://mx.jzeg.cn:9998"; // 姝e紡鏈嶅姟
 

--
Gitblit v1.9.1