瀏覽代碼

修改密码,登录后修改密码提示

sangwenwei 1 年之前
父節點
當前提交
cbef5f2c1d

+ 16 - 1
src/api/auth/loginService.js

@@ -1,5 +1,6 @@
 import request from "@/utils/httpRequest";
 import { AUTH_PATH as prefix } from "../AppPath";
+import { SYS_PATH as sysPrefix } from "../AppPath";
 
 export default {
 	getCode: function () {
@@ -27,5 +28,19 @@ export default {
 			method: "get",
 			params: { userName: userName },
 		})
-	}
+	},
+	getPhoneCode (loginForm) {
+		return request({
+			url: sysPrefix + '/sys/user/getPhoneCode',
+			method: 'get',
+			params: {mobile: loginForm},
+		})
+	},
+	savePwd: function (loginForm) {
+		return request({
+			url:sysPrefix + "/sys/user/saveNewPassword",
+			method:"get",
+			params:{mobile:loginForm.phoneNumber,code:loginForm.phoneCode,newPassword: loginForm.newPassword},
+		})
+	},
 };

+ 5 - 4
src/api/sys/userService.js

@@ -31,7 +31,7 @@ export default {
 	savePwd: function (inputForm) {
 		return request({
 			url: prefix + "/sys/user/savePwd",
-			method: "put",
+			method: "post",
 			params: inputForm,
 		});
 	},
@@ -105,9 +105,9 @@ export default {
 		});
 	},
 
-	is() {
+	is:function() {
 		return request({
-			url: prefix + `/sys/user/isAdmin`,
+			url: prefix + "/sys/user/isAdmin",
 			method: "get",
 		});
 	},
@@ -126,7 +126,7 @@ export default {
 			params: { id: id },
 		});
 	},
-	isUpdatePassword() {
+	isUpdatePassword:function() {
 		return request({
 			url: prefix + `/sys/user/isUpdatePassword`,
 			method: "get",
@@ -147,4 +147,5 @@ export default {
 			method: "post",
 		});
 	},
+
 };

+ 18 - 18
src/assets/fonts/demo_index.html

@@ -36,9 +36,9 @@
 </head>
 <body>
   <div class="main">
-    <h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
+    <h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont " target="_blank">
       <img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
-      
+
     </a></h1>
     <div class="nav-tabs">
       <ul id="tabs" class="dib-box">
@@ -46,36 +46,36 @@
         <li class="dib"><span>Font class</span></li>
         <li class="dib"><span>Symbol</span></li>
       </ul>
-      
+
     </div>
     <div class="tab-container">
       <div class="content unicode" style="display: block;">
           <ul class="icon_lists dib-box">
-          
+
             <li class="dib">
               <span class="icon iconfont">&#xe669;</span>
                 <div class="name">32、文件下载模板</div>
                 <div class="code-name">&amp;#xe669;</div>
               </li>
-          
+
             <li class="dib">
               <span class="icon iconfont">&#xe63e;</span>
                 <div class="name">下载模板</div>
                 <div class="code-name">&amp;#xe63e;</div>
               </li>
-          
+
             <li class="dib">
               <span class="icon iconfont">&#xe653;</span>
                 <div class="name">下载模板</div>
                 <div class="code-name">&amp;#xe653;</div>
               </li>
-          
+
             <li class="dib">
               <span class="icon iconfont">&#xe774;</span>
                 <div class="name">下载模板</div>
                 <div class="code-name">&amp;#xe774;</div>
               </li>
-          
+
           </ul>
           <div class="article markdown">
           <h2 id="unicode-">Unicode 引用</h2>
@@ -119,7 +119,7 @@
       </div>
       <div class="content font-class">
         <ul class="icon_lists dib-box">
-          
+
           <li class="dib">
             <span class="icon iconfont icon-32wenjianxiazaimoban"></span>
             <div class="name">
@@ -128,7 +128,7 @@
             <div class="code-name">.icon-32wenjianxiazaimoban
             </div>
           </li>
-          
+
           <li class="dib">
             <span class="icon iconfont icon-xiazaimoban"></span>
             <div class="name">
@@ -137,7 +137,7 @@
             <div class="code-name">.icon-xiazaimoban
             </div>
           </li>
-          
+
           <li class="dib">
             <span class="icon iconfont icon-xiazaimoban1"></span>
             <div class="name">
@@ -146,7 +146,7 @@
             <div class="code-name">.icon-xiazaimoban1
             </div>
           </li>
-          
+
           <li class="dib">
             <span class="icon iconfont icon-xiazaimoban2"></span>
             <div class="name">
@@ -155,7 +155,7 @@
             <div class="code-name">.icon-xiazaimoban2
             </div>
           </li>
-          
+
         </ul>
         <div class="article markdown">
         <h2 id="font-class-">font-class 引用</h2>
@@ -182,7 +182,7 @@
       </div>
       <div class="content symbol">
           <ul class="icon_lists dib-box">
-          
+
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-32wenjianxiazaimoban"></use>
@@ -190,7 +190,7 @@
                 <div class="name">32、文件下载模板</div>
                 <div class="code-name">#icon-32wenjianxiazaimoban</div>
             </li>
-          
+
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-xiazaimoban"></use>
@@ -198,7 +198,7 @@
                 <div class="name">下载模板</div>
                 <div class="code-name">#icon-xiazaimoban</div>
             </li>
-          
+
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-xiazaimoban1"></use>
@@ -206,7 +206,7 @@
                 <div class="name">下载模板</div>
                 <div class="code-name">#icon-xiazaimoban1</div>
             </li>
-          
+
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-xiazaimoban2"></use>
@@ -214,7 +214,7 @@
                 <div class="name">下载模板</div>
                 <div class="code-name">#icon-xiazaimoban2</div>
             </li>
-          
+
           </ul>
           <div class="article markdown">
           <h2 id="symbol-">Symbol 引用</h2>

+ 1 - 1
src/router/systemRouter.js

@@ -7,7 +7,7 @@ const routes = [
 	{
 		name: "layout",
 		path: "/",
-		meta: { title: "工作台" },
+		meta: { title: "" },
 		component: () => import("@/layout/index.vue"),
 		redirect: tool.data.get("APP_HOME") || config.DASHBOARD_URL,
 		children: [

+ 39 - 4
src/views/dashboard/widgets/components/TodoList.vue

@@ -1,4 +1,5 @@
 <template>
+	<div>
 	<el-card class="box-card">
 		<template #header>
 			<div class="card-header">
@@ -151,6 +152,10 @@
 			:processInstanceId="processInstanceId"
 		></flow-chart>
 	</v-dialog>
+
+		<UpdatePassword :innerVisible="innerVisible" v-on:innerDialog="getInnerStatus($event)"></UpdatePassword>
+
+	</div>
 </template>
 
 <script>
@@ -158,6 +163,8 @@
 	import pick from "lodash.pick";
 	import UserSelect from "@/components/userSelect/UserSelectDialog";
 	import taskService from "@/api/flowable/taskService";
+	import userService from "@/api/sys/UserService";
+	import UpdatePassword from "@/views/layout/UpdatePassword2.vue";
 	export default {
 		title: "我的待办",
 		icon: "wodedaiban",
@@ -179,10 +186,13 @@
 				visible: false,
 				currentTask: null,
 				processInstanceId: "",
-				timer: null
+				timer: null,
+				innerVisible:true
 			};
 		},
 		mounted() {
+
+			// this.$refs.updatePassword.test()
 			// 页面加载后
 			// 1.在执行定时器前先执行一次获取接口数据的操作函数, 否则接口会1秒钟后才调用
 			// 2.为了避免退出当前页面后,在其他页面也继续调用接口,退出前需要清除定时器.
@@ -190,19 +200,43 @@
 			this.timer = setInterval(() => {
 				setTimeout(this.refreshList, 0)
 			}, 60000)
+
+
+			userService.is().then((data) => {
+				console.log('是否为管理员', data)
+				// this.$router.replace({
+				// 	path:"/UpdataPassword.vue"
+				// })
+				if (!data) {
+					// 如果当前用户不是管理员,则判断是否修改过密码
+					userService.isUpdatePassword().then((data) => {
+						console.log('是否修改过密码', data)
+						if (!data){
+							// 如果没有修改过密码,则弹出密码修改窗口
+							this.innerVisible = true
+							// this.$refs.updatePassword.init(true);
+							// console.log(this.$refs.updatePassword,11111111111111111111111111)
+						}
+					})
+				}
+			})
+		},
+		activated(){
+
 		},
 		beforeDestroy () {
 			clearInterval(this.timer)
 			this.timer = null
 		},
-		activated() {
-			this.refreshList();
-		},
 		components: {
 			UserSelect,
+			UpdatePassword,
 			// FlowChart
 		},
 		methods: {
+			getInnerStatus(status){
+				this.innerVisible = status
+			},
 			// 获取数据列表
 			refreshList() {
 				this.loading = true;
@@ -275,6 +309,7 @@
 					this.$refs.preview.init();
 				});
 			},
+
 		},
 	};
 </script>

+ 1 - 1
src/views/flowable/task/TaskForm.vue

@@ -1002,7 +1002,7 @@ export default {
 										this.$router.push({path: '/sys/dashboard/workBench/PendingList'})
 										this.cc(data)
 									}else if (this.cs === 'cs') {
-										this.$router.push({path: '/dashboard/index'})
+										this.$router.push({path: ''})
 										this.cc(data)
 									} else {
 										this.$router.push({path: '/flowable/task/TodoList'})

+ 30 - 3
src/views/home/components/TodoList2.vue

@@ -75,13 +75,16 @@
 			:processInstanceId="processInstanceId"
 		></flow-chart>
 	</v-dialog>
-</template>
+
+	<UpdatePassword :innerVisible="innerVisible" v-on:innerDialog="getInnerStatus($event)"></UpdatePassword></template>
 
 <script>
 	// import FlowChart from '../modeler/FlowChart'
 	import pick from "lodash.pick";
 	import UserSelect from "@/components/userSelect/UserSelectDialog";
 	import taskService from "@/api/flowable/taskService";
+	import userService from "@/api/sys/UserService";
+	import UpdatePassword from "@/views/layout/UpdatePassword.vue";
 	export default {
 		// title: "我的待办",
 		// icon: "wodedaiban",
@@ -103,7 +106,8 @@
 				visible: false,
 				currentTask: null,
 				processInstanceId: "",
-				timer: null
+				timer: null,
+				innerVisible:true
 			};
 		},
 		mounted() {
@@ -114,19 +118,42 @@
 			this.timer = setInterval(() => {
 				setTimeout(this.refreshList, 0)
 			}, 60000)
+			// 判断当前用户是否为管理员
+			userService.is().then((data) => {
+				console.log('是否为管理员', data)
+				if (!data) {
+					// 如果当前用户不是管理员,则判断是否修改过密码
+					userService.isUpdatePassword().then((data) => {
+						console.log('是否修改过密码', data)
+						if (!data) {
+							console.log('是否修改过密码2',data)
+							// 如果没有修改过密码,则弹出密码修改窗口
+							this.innerVisible = true
+							// this.$refs.updatePassword.init(data)
+
+						}
+					})
+				}
+			})
+
 		},
 		beforeDestroy () {
 			clearInterval(this.timer)
 			this.timer = null
 		},
 		activated() {
-			this.refreshList();
+
+
 		},
 		components: {
 			UserSelect,
+			UpdatePassword
 			// FlowChart
 		},
 		methods: {
+			getInnerStatus(status){
+				this.innerVisible = status
+			},
 			// 获取数据列表
 			refreshList() {
 				this.loading = true;

+ 38 - 0
src/views/home/index.vue

@@ -24,6 +24,9 @@
 			</el-row>
 		</div>
 	</div>
+	<UpdatePassword :innerVisible="innerVisible" v-on:innerDialog="getInnerStatus($event)"></UpdatePassword>
+
+<!--	<UpdatePassword ref="updatePassword"></UpdatePassword>-->
 </template>
 
 <script>
@@ -34,6 +37,8 @@ import PopularContent from "./components/popular-content.vue";
 import CateforiesPercent from "./components/categories-percent.vue";
 import RecentlyVisited from "./components/recently-visited.vue";
 import QuickOperation from "./components/quick-operation.vue";
+import UpdatePassword from "@/views/layout/UpdatePassword2.vue";
+
 // import TodoList from './components/todoList.vue'
 import Announcement from "./components/announcement.vue";
 import TodoList2 from "./components/TodoList2.vue";
@@ -42,8 +47,14 @@ import Carousel from "./components/carousel.vue";
 import Docs from "./components/docs.vue";
 import Wx from "./components/wx.vue";
 import Footer from "@/components/footer/index.vue";
+import userService from "@/api/sys/UserService";
 export default {
 	name: "Dashboard", // If you want the include property of keep-alive to take effect, you must name the component
+	data(){
+		return{
+			innerVisible:true
+		}
+	},
 	components: {
 		Banner,
 		DataPanel,
@@ -59,7 +70,34 @@ export default {
 		Docs,
 		Wx,
 		Footer,
+		UpdatePassword,
+		// updatePassword
 	},
+	 activated() {
+		 userService.is().then((data) => {
+			 console.log('是否为管理员', data)
+			 // this.$router.replace({
+			 // 	path:"/UpdataPassword.vue"
+			 // })
+			 if (!data) {
+				 // 如果当前用户不是管理员,则判断是否修改过密码
+				 userService.isUpdatePassword().then((data) => {
+					 console.log('是否修改过密码', data)
+					 if (!data){
+						 // 如果没有修改过密码,则弹出密码修改窗口
+						 this.innerVisible = true
+						 // this.$refs.updatePassword.init(true);
+						 // console.log(this.$refs.updatePassword,11111111111111111111111111)
+					 }
+				 })
+			 }
+		 })
+	},
+	methods:{
+		getInnerStatus(status){
+			this.innerVisible = status
+		}
+	}
 };
 </script>
 

+ 144 - 0
src/views/layout/UpdatePassword2.vue

@@ -0,0 +1,144 @@
+<template>
+		<v-dialog
+		title="修改密码"
+		:close-on-click-modal="true"
+		append-to-body
+		v-model="dialogVisible"
+		width="70%"
+		height="600px"
+	>
+			<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
+					 label-width="80px" @submit.native.prevent>
+				<div style="margin-bottom: 20px;" v-if="showTip">
+					<el-alert
+						title="当前账号的密码仍为初始密码,风险较大,请及时修改"
+						type="warning"
+						:closable="false"
+						center
+						show-icon>
+					</el-alert>
+				</div>
+				<el-form-item label="账号">
+					<span>{{ userName }}</span>
+				</el-form-item>
+				<el-form-item label="原密码" prop="password">
+					<el-input type="password" size="small" v-model="dataForm.password" ></el-input>
+				</el-form-item>
+				<el-form-item label="新密码" prop="newPassword">
+					<el-input type="password" size="small" v-model="dataForm.newPassword" ></el-input>
+				</el-form-item>
+				<el-form-item label="确认密码" prop="confirmPassword">
+					<el-input type="password" size="small" v-model="dataForm.confirmPassword" ></el-input>
+				</el-form-item>
+			</el-form>
+				<span slot="footer" class="dialog-footer" style="float: right">
+					<el-button size="large" @click="dialogVisible = false" icon="el-icon-circle-close">关闭</el-button>
+					<el-button size="large" type="primary" @click="dataFormSubmit()">确定</el-button>
+				</span>
+	</v-dialog>
+</template>
+
+<script>
+	import {clearLoginInfo} from '@/utils'
+	import userService from '@/api/sys/UserService'
+	export default {
+		name:'child',
+		props:{
+			innerVisible:{
+				type: Boolean,
+				default: true
+			}
+		},
+
+		data() {
+			let validateConfirmPassword = (rule, value, callback) => {
+				if (this.dataForm.newPassword !== value) {
+					callback(new Error('确认密码与新密码不一致'))
+				} else {
+					callback()
+				}
+			}
+			return {
+				dialogVisible: this.innerVisible,
+				showTip: true,
+				dataForm: {
+					password: '',
+					newPassword: '',
+					confirmPassword: ''
+				},
+				dataRule: {
+					password: [
+						{required: true, message: '原密码不能为空', trigger: 'blur'}
+					],
+					newPassword: [
+						{required: true, message: '新密码不能为空', trigger: 'blur'}
+					],
+					confirmPassword: [
+						{required: true, message: '确认密码不能为空', trigger: 'blur'},
+						{validator: validateConfirmPassword, trigger: 'blur'}
+					]
+				}
+			};
+		},
+		computed: {
+			userName: {
+				get () {
+					return this.$store.state.user.name
+				}
+			},
+			mainTabs: {
+				get () {
+					return this.$store.state.common.mainTabs
+				},
+				set (val) {
+					this.$store.commit('common/updateMainTabs', val)
+				}
+			}
+		},
+		methods: {
+			handleClose(done) {
+				this.$emit("innerDialog",false)
+			},
+			// 初始化
+			init (showTip) {
+				if (this.commonJS.isNotEmpty(showTip)) {
+					this.showTip = showTip
+				} else {
+					this.showTip = false
+				}
+				this.dialogVisible = true
+				// this.$nextTick(() => {
+				  this.$refs.dataForm.resetFields()
+				//   //this.$refs['dataForm'].resetFields()
+				// })
+			},
+			// 表单提交
+			dataFormSubmit () {
+				this.$refs.dataForm.validate((valid) => {
+					if (valid) {
+						userService.savePwd({
+							'oldPassword': this.dataForm.password,
+							'newPassword': this.dataForm.newPassword
+						}).then((data) => {
+							this.$message({
+								message: '修改成功, 请重新登录!',
+								type: 'success',
+								duration: 1500
+							})
+							this.dialogVisible = false
+							this.$nextTick(() => {
+								this.mainTabs = []
+								clearLoginInfo()
+								this.$router.replace({name: 'login'})
+							})
+						})
+					}
+				})
+			}
+		},
+		created(){
+
+		}
+	};
+</script>
+<style></style>

+ 1 - 0
src/views/program/registered/ProjectFormUpdate.vue

@@ -600,6 +600,7 @@
 				  highlight-current-row
 				  :edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: false, icon: '#'}"
 			  >
+
 				  <vxe-table-column field="name"  title="姓名" :edit-render="{name: '$input'}" align="center">
 					  <template v-slot:edit="scope">
 						  <vxe-input v-model="scope.row.name" :disabled="commonJS.isNotEmpty(scope.row.userId)"  style="width: 100%" class="my-search">

+ 2 - 2
src/views/sys/login/components/login-form.vue

@@ -135,8 +135,8 @@
 					<el-form-item  prop="phoneCode">
 						<el-input type="text" placeholder="请输入验证码" v-model="inputForm.phoneCode" style="width: 300px"></el-input>
 							<el-button slot="append" type="primary" @click="pushPhoneCode" :loading="!showPhoneCode" style="background-color: #3595f9;width: 100px">
-							<span v-if="showPhoneCode" style="color: blue">获取验证码</span>
-							<span v-else class="count" style="color: blue">请等待 {{count}} s</span>
+							<span v-if="showPhoneCode" style="color: white">获取验证码</span>
+							<span v-else class="count" style="color: white">请等待 {{count}} s</span>
 						</el-button>
 					</el-form-item>
 					<el-form-item prop="newPassword">