Переглянути джерело

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/aiot-app into dengfei

695593266@qq.com 7 місяців тому
батько
коміт
4d60aabf6a

+ 12 - 1
api/common.js

@@ -15,6 +15,17 @@ export async function login(data) {
 	}
 	return Promise.reject(res.message)
 }
+
+
+// 修改用户密码
+export async function updatePassword(data) {
+	const res = await postJ(Vue.prototype.apiUrl + '/system/account/updatePassword', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(res.message)
+}
+
 /**
  * 获取用户信息
  */
@@ -113,4 +124,4 @@ export async function getLatestVersion(code) {
 		return data.data;
 	}
 	return Promise.reject(data.message);
-}
+}

+ 1 - 1
api/wt/index.js

@@ -41,7 +41,7 @@ export async function getUnreadNotifyMessageCountAPI() {
 
 //获取待办事项列表
 export async function getTodoTaskPage(query, loding = true) {
-	const res = await get(
+	const res = await postJ(
 		Vue.prototype.apiUrl + `/bpm/task/todo-page`, query, loding
 	);
 	if (res.code == 0) {

+ 1 - 1
manifest.json

@@ -2,7 +2,7 @@
     "name" : "智慧工厂",
     "appid" : "__UNI__45B3907",
     "description" : "",
-    "versionName" : "V1.0.3.14",
+    "versionName" : "V1.0.3.16",
     "versionCode" : "100",
     "transformPx" : false,
     "h5" : {

+ 232 - 0
pages/systemSettings/components/password-modal.vue

@@ -0,0 +1,232 @@
+<template>
+	<u-popup :show="popShow" @close="cancel" mode="center" :is-mask-click="false">
+		<view class="popup-wrapper">
+			<view class="title">服务器设置</view>
+
+			<u-form labelPosition="left" labelAlign="right" :model="formData" :rules="rules" ref="formRef"
+				label-width="150">
+
+				<u-form-item label="旧密码" prop="oldPassword" class="form-required">
+					<u-input v-model="formData.oldPassword" placeholder="输入" type="password">
+					</u-input>
+				</u-form-item>
+
+				<u-form-item label="新密码" prop="newPassword" class="form-required">
+					<u-input v-model="formData.newPassword" placeholder="输入" type="password">
+					</u-input>
+				</u-form-item>
+
+				<u-form-item label="确认密码" prop="newPassword1" class="form-required">
+					<u-input v-model="formData.newPassword1" placeholder="输入" type="password">
+					</u-input>
+				</u-form-item>
+			</u-form>
+			<view class="footer">
+				<u-button size="small" @click="cancel">取消</u-button>
+				<u-button size="small" type="success" @click="confirm">确定</u-button>
+			</view>
+		</view>
+	</u-popup>
+</template>
+
+<script>
+	import {
+		updatePassword
+	} from '@/api/common.js'
+	export default {
+		data() {
+			return {
+
+				popShow: false,
+				formData: {
+					oldPassword: '',
+					newPassword: '',
+					newPassword1: ''
+				},
+				rules: {
+					oldPassword: {
+						type: 'string',
+						required: true,
+						message: '请输入旧密码',
+						trigger: ['blur']
+					},
+					newPassword: {
+						type: 'string',
+						required: true,
+						message: '请输入新密码',
+						trigger: ['blur']
+					},
+					newPassword1: [{
+						required: true,
+						type: 'string',
+						trigger: ['blur'],
+						validator: (_rule, value, callback) => {
+							if (!value) {
+								return callback(new Error('请再次输入新密码'));
+							}
+							if (value !== this.formData.newPassword) {
+								return callback(new Error('两次输入密码不一致'));
+							}
+							callback();
+						}
+					}]
+				}
+			}
+		},
+		created() {
+
+		},
+		methods: {
+			open() {
+				this.popShow = true
+			},
+
+			cancel() {
+				this.popShow = false
+			},
+			loginOut() {
+
+				uni.showModal({
+					title: '提示',
+					content: '确认退出登录',
+					success: res => {
+						console.log(res, res.confirm, '-----确认退出登录');
+						if (res.confirm) {
+							console.log('-----确认退出登录9999999');
+
+							try {
+								postJ(this.apiUrl + '/main/user/logout')
+									.then(res => {
+
+										uni.showToast({
+											title: '退出成功',
+											icon: 'success',
+											duration: 500
+										})
+
+
+										setTimeout(() => {
+											uni.clearStorage()
+											uni.removeStorageSync('token')
+											uni.removeStorageSync('userInfo')
+											uni.removeStorageSync('treeList')
+											uni.reLaunch({
+												url: '/pages/login/login'
+											})
+
+										}, 500)
+
+									})
+									.catch(err => {
+										console.log(err);
+										uni.showToast({
+											title: '退出失败',
+											icon: 'none'
+										})
+									})
+
+							} catch (error) {
+								console.log(error, 'error----')
+								uni.reLaunch({
+									url: '/pages/login/login'
+								})
+							}
+						} else if (res.cancel) {
+							console.log('用户点击取消')
+						}
+					}
+				})
+			},
+			confirm() {
+				const userInfo = uni.getStorageSync("userInfo");
+				this.$refs.formRef
+					.validate()
+					.then(res => {
+						// Vue.prototype.apiWebUrl =
+						// 	`${this.formData.protocal}${this.formData.hostname}:${this.formData.port}/web`
+						// Vue.prototype.apiUrl =
+						// 	`${this.formData.protocal}${this.formData.hostname}:${this.formData.port}/api`
+						// Vue.prototype.webviewUrl =
+						// 	`${this.formData.protocal}${this.formData.hostname}:${this.formData.port}`
+
+						// uni.setStorageSync('apiInfo', this.formData)
+						// this.$emit('setServerStatus', true)
+						// this.cancel()
+						this.formData.id = userInfo.userId
+						updatePassword(this.formData).then(res => {
+							if (res == 1) {
+								uni.$u.toast('密码修改成功')
+								setTimeout(() => {
+									uni.removeStorageSync('token')
+									uni.removeStorageSync('userInfo')
+									uni.removeStorageSync('treeList')
+									uni.reLaunch({
+										url: '/pages/login/login'
+									})
+
+								}, 500)
+
+							}
+						})
+
+					})
+					.catch(errors => {
+						uni.$u.toast('校验失败')
+					})
+			}
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	.popup-wrapper {
+		padding: 0 20rpx;
+
+		.title {
+			text-align: center;
+			font-weight: bold;
+			padding: 20rpx;
+		}
+
+		/deep/.u-form {
+			.u-input__content__field-wrapper__field,
+			.u-form-item__body__left__content__label {
+				font-size: 28rpx !important;
+			}
+
+			.u-form-item__body__right__content__slot {}
+		}
+
+		/deep/.uni-stat__select {
+			// height: 76rpx !important;
+			width: 150rpx;
+			flex: 0;
+
+			.uni-select {
+				width: 150rpx;
+				font-size: 28rpx !important;
+			}
+
+			.uni-stat-box,
+			.uni-select__input-box {
+				// height: 76rpx !important;
+			}
+		}
+
+		/deep/.u-input {
+			flex: 1;
+			padding: 12rpx 18rpx !important;
+			border: 1px solid #e5e5e5;
+		}
+
+		.footer {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			padding: 20rpx 0;
+
+			.u-button+.u-button {
+				margin-left: 20rpx;
+			}
+		}
+	}
+</style>

+ 106 - 98
pages/systemSettings/index.vue

@@ -10,6 +10,10 @@
           }}</text>
 				</u-cell>
 			</picker>
+			<u-cell title="修改密码" :isLink="true" arrow-direction="right" @click="$refs.passwordModalRef.open()">
+			
+		
+			</u-cell>
 			<u-cell title="服务器地址" :isLink="true" arrow-direction="right" @click="handleServerSettings">
 				<text slot="value" class="u-slot-value" :key="apiAdress">{{
           apiAdress
@@ -24,12 +28,13 @@
 		<view class="flex-buttom">
 			<view class="btn" @click="loginOut"> 退出登录 </view>
 			<view class="copyright">
-				<view>版权所有© 2019-2021中赢合力</view>
+				<view>版权所有© 2019-2025中赢合力</view>
 				<view>湘ICP备20015098号</view>
 			</view>
 		</view>
 		<updatePop ref="updatePop" :versionNum="versionNum" :downloadUrl="downloadUrl" :sizes="VersionInfo.fileSize">
 		</updatePop>
+		<passwordModal ref="passwordModalRef"></passwordModal>
 		<ServerSetting ref="serverSettingRef" @setServerStatus="setServerStatus" />
 	</view>
 </template>
@@ -40,6 +45,7 @@
 		get
 	} from '@/utils/api.js'
 	import updatePop from './components/updatePop.vue'
+	import passwordModal from './components/password-modal.vue'
 	import {
 		setMemo,
 		isMemo,
@@ -52,7 +58,7 @@
 	export default {
 		components: {
 			updatePop,
-			ServerSetting
+			ServerSetting,passwordModal
 		},
 		data() {
 			return {
@@ -117,7 +123,7 @@
 						console.log(res, res.confirm, '-----确认退出登录');
 						if (res.confirm) {
 							console.log('-----确认退出登录9999999');
-							uni.clearStorage()
+							// uni.clearStorage()
 							try {
 								postJ(this.apiUrl + '/main/user/logout')
 									.then(res => {
@@ -182,111 +188,113 @@
 				// 	}
 				// })
 
-			// #ifdef APP-PLUS
-			getLatestVersion().then(res => {
-				console.log('res:', res)
-				const {
-					appVersion
-				} = uni.getAppBaseInfo()
-				if (appVersion != res.versionCode) {
-					uni.showModal({
-						title: '发现新版本',
-						content: '更新说明:' + res.releaseNotes,
-						confirmText: '立即更新',
-						success: (val) => {
-							if (val.confirm) {
-								const downloadTask = uni.downloadFile({
-									url: `${Vue.prototype.webviewUrl}/kd-aiot/${res.fileStorePath}`,
-									success: (data) => {
-										if (data.statusCode === 200) {
-											uni.saveFile({
-												tempFilePath: data
-													.tempFilePath,
-												success: (saveRes) => {
-													// uni.showToast({
-													// 	title: '下载成功',
-													// 	icon: 'success'
-													// });
-													// uni.hideLoading();
-													// uni.showLoading({
-													// 	title: "正在更新...",
-													// 	mask: true,
-													// });
-													// 调用安装逻辑
-													plus.runtime.install(
-														saveRes
-														.savedFilePath, {
-															force: true
-														},
-														function() {
-															// uni
-															// 	.hideLoading();
-														},
-														function() {
-															// uni
-															// 	.hideLoading();
-															uni.showToast({
-																title: '更新失败',
-																icon: 'error'
+				// #ifdef APP-PLUS
+				getLatestVersion().then(res => {
+					console.log('res:', res)
+					const {
+						appVersion
+					} = uni.getAppBaseInfo()
+					if (appVersion != res.versionCode) {
+						uni.showModal({
+							title: '发现新版本',
+							content: '更新说明:' + res.releaseNotes,
+							confirmText: '立即更新',
+							success: (val) => {
+								if (val.confirm) {
+									const downloadTask = uni.downloadFile({
+										url: `${Vue.prototype.webviewUrl}/kd-aiot/${res.fileStorePath}`,
+										success: (data) => {
+											if (data.statusCode === 200) {
+												uni.saveFile({
+													tempFilePath: data
+														.tempFilePath,
+													success: (saveRes) => {
+														// uni.showToast({
+														// 	title: '下载成功',
+														// 	icon: 'success'
+														// });
+														// uni.hideLoading();
+														// uni.showLoading({
+														// 	title: "正在更新...",
+														// 	mask: true,
+														// });
+														// 调用安装逻辑
+														plus.runtime.install(
+															saveRes
+															.savedFilePath, {
+																force: true
+															},
+															function() {
+																// uni
+																// 	.hideLoading();
+															},
+															function() {
+																// uni
+																// 	.hideLoading();
+																uni.showToast({
+																	title: '更新失败',
+																	icon: 'error'
+																});
 															});
-														});
 
-												}
-											});
+													}
+												});
+											}
+										}
+									});
+
+									// 先显示初始的loading提示
+									uni.showLoading({
+										title: "正在下载安装包: 0%",
+										mask: true,
+									});
+
+									// 记录上次显示的进度,避免频繁更新
+									let lastProgress = 0;
+									let loadingVisible = true;
+
+									downloadTask.onProgressUpdate((ress) => {
+										console.log('下载进度:', ress)
+
+										// 只在进度有明显变化(每10%)或者达到100%时更新提示
+										if ((ress.progress > lastProgress && ress.progress %
+												10 === 0) || ress.progress === 100) {
+											// 先隐藏再显示以更新内容
+											if (loadingVisible) {
+												uni.hideLoading();
+											}
+
+											if (ress.progress < 100) {
+												uni.showLoading({
+													title: "正在下载安装包: " + ress
+														.progress + "%",
+													mask: true,
+												});
+												loadingVisible = true;
+											} else {
+												loadingVisible = false;
+											}
+											lastProgress = ress.progress;
 										}
-									}
-								});
+									})
 
-								// 先显示初始的loading提示
-								uni.showLoading({
-									title: "正在下载安装包: 0%",
-									mask: true,
-								});
-								
-								// 记录上次显示的进度,避免频繁更新
-								let lastProgress = 0;
-								let loadingVisible = true;
-								
-								downloadTask.onProgressUpdate((ress) => {
-									console.log('下载进度:', ress)
-									
-									// 只在进度有明显变化(每10%)或者达到100%时更新提示
-									if ((ress.progress > lastProgress && ress.progress % 10 === 0) || ress.progress === 100) {
-										// 先隐藏再显示以更新内容
+									// 确保任务完成时隐藏loading
+									downloadTask.onStop(() => {
 										if (loadingVisible) {
 											uni.hideLoading();
+											loadingVisible = false;
 										}
-										
-										if (ress.progress < 100) {
-											uni.showLoading({
-												title: "正在下载安装包: " + ress.progress + "%",
-												mask: true,
-											});
-											loadingVisible = true;
-										} else {
+									})
+									downloadTask.onError(() => {
+										if (loadingVisible) {
+											uni.hideLoading();
 											loadingVisible = false;
 										}
-										lastProgress = ress.progress;
-									}
-								})
-								
-								// 确保任务完成时隐藏loading
-								downloadTask.onStop(() => {
-									if (loadingVisible) {
-										uni.hideLoading();
-										loadingVisible = false;
-									}
-								})
-								downloadTask.onError(() => {
-									if (loadingVisible) {
-										uni.hideLoading();
-										loadingVisible = false;
-									}
-								})
+									})
+								}
 							}
-						}
-					});
-				}
+						});
+					}
 
 				}).catch(err => {
 					console.log('err:', err)