Commit 572fba7c authored by 王向前's avatar 王向前

添加个人信息、修改密码等用户信息

parent b0ca57a1
...@@ -29,7 +29,6 @@ const routes = [ ...@@ -29,7 +29,6 @@ const routes = [
title: '首页', title: '首页',
}, },
}, },
{ {
path: '/pages/user/people', path: '/pages/user/people',
name: 'people', name: 'people',
...@@ -115,9 +114,13 @@ const routes = [ ...@@ -115,9 +114,13 @@ const routes = [
title: '工作日报', title: '工作日报',
}, },
}, },
{
path: '/pages/user/modifyPw',
name: 'modifyPw',
meta: {
title: '修改密码',
},
},
] ]
export default routes export default routes
...@@ -36,6 +36,30 @@ ...@@ -36,6 +36,30 @@
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, },
{
"path" : "pages/user/setting",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/user/userdetail",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path": "pages/user/modifyPw",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"app-plus": {
"bounce": "none"
}
}
},
{ {
"path": "pages/kqgl/gzrb/index", "path": "pages/kqgl/gzrb/index",
"style": { "style": {
......
...@@ -212,6 +212,7 @@ ...@@ -212,6 +212,7 @@
password: loginParams.encodePWD, password: loginParams.encodePWD,
newPassword: md5(this.password) newPassword: md5(this.password)
} }
this.logining = true; this.logining = true;
//#ifdef MP-WEIXIN //#ifdef MP-WEIXIN
//若是小程序平台,则获取到openId。整个过程是静默完成的 //若是小程序平台,则获取到openId。整个过程是静默完成的
...@@ -265,10 +266,19 @@ ...@@ -265,10 +266,19 @@
"password": "" "password": ""
}) })
} }
this.$tip.success('登录成功!')
this.$Router.replaceAll({ uni.setStorage({
name: 'homepage' key: 'userinfo',
}) data:{...res.data},
success: function (r) {
that.$tip.success('登录成功!')
that.$Router.replaceAll({
name: 'homepage'
})
}
});
} else { } else {
this.$tip.alert(res.message); this.$tip.alert(res.message);
} }
......
<template>
<view class="bg-white" style="height: 100vh;">
<<cu-custom bgColor="bg-blue" :isBack="true">
<block slot="content">
修改密码
</block>
</cu-custom>
<scroll-view scroll-y class="page">
<view class="cu-list menu">
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
<view class="content">
<text class="text-grey">旧密码:</text>
</view>
<view class="action">
<input v-model="oldPassword" :focus="true" type="password">
</view>
</view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
<view class="content">
<text class="text-grey" >新密码:</text>
</view>
<view class="action">
<input type="password" v-model="newPassword">
</view>
</view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]" style="border-bottom: 1px solid #eee;">
<view class="content">
<text class="text-grey">密码确认:</text>
</view>
<view class="action">
<input v-model="newPasswordConfirm" type="password">
</view>
</view>
</view>
<view class="flex justify-center" >
<button class="cu-btn bg-blue lg margin-left shadow" style="margin-top: 30px;" @tap="confirm()">修改密码
</button>
</view>
</scroll-view>
</view>
</template>
<script>
export default{
data:function(){
return {
api:"kzzx/user/password/update",
oldPassword:"",
newPassword:"",
newPasswordConfirm:"",
}
},
methods:{
passWord(password) {
return /^(?=.*\d)(?=.*[a-zA-Z]).{6,}$/.test(password);
},
confirm(){
let that=this
if(!this.passWord(this.newPassword)){
console.log(this.newPassword)
this.$tip.toast('密码格式需要6位以上,数字字母组合');
return
}
if(this.newPassword!=this.newPasswordConfirm){
this.$tip.toast('密码确认不一致');
return
}
if(!this.oldPassword){
this.$tip.toast('请输入旧密码');
return
}
let data={
newPassword:this.newPassword,
oldPassword:this.oldPassword,
newPasswordConfirm:this.newPasswordConfirm
}
that.$http.post(that.api,data).then(e=>{
if(e.data.success){
this.$tip.toast('修改成功');
uni.removeStorage({key:"ACCESS_TOKEN"})
this.$Router.replaceAll({name:"login"})
}else{
this.$tip.toast(e.data.message||"修改失败");
}
})
}
}
}
</script>
<style>
</style>
\ No newline at end of file
This diff is collapsed.
<template>
<view class="bg-white" style="height: 100vh;">
<cu-header bgColor="bg-blue" :isBack="true">
<block slot="content">
{{title}}
</block>
</cu-header>
<view>
<view class=" flex bg-white cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
<view class="cu-item arrow animation-slide-bottom">
<view class="content flex justify-between" @tap="goTopage('department')" >
<view>
<text class="cuIcon-calendar text-blue margin-right-sm"></text>
<text class="text-grey">部门管理</text>
</view>
</view>
</view>
<view class="cu-item arrow animation-slide-bottom">
<view class="content flex justify-between" @tap="goTopage('txl')" >
<view>
<text class="cuIcon-read text-blue margin-right-sm"></text>
<text class="text-grey">通讯录</text>
</view>
</view>
</view>
<view class="cu-item arrow animation-slide-bottom">
<view class="content flex justify-between" @tap="goTopage('glysetting')" >
<view>
<text class="cuIcon-my text-blue margin-right-sm"></text>
<text class="text-grey">管理员设置</text>
</view>
</view>
</view>
<view class="cu-item arrow animation-slide-bottom">
<view class="content flex justify-between" @tap="goTopage('gsinfo')">
<view>
<text class="cuIcon-servicefill text-blue margin-right-sm"></text>
<text class="text-grey">关于我们</text>
</view>
<view>
</view>
</view>
</view>
<view v-if="showV" class="cu-item arrow animation-slide-bottom">
<view class="content flex justify-between" >
<view>
<text class="cuIcon-info text-blue margin-right-sm"></text>
<text class="text-grey">当前版本</text>
</view>
<view style="font-size: 14px;">
{{V}}
</view>
</view>
</view>
<!-- <view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.1s'}]" >
<view class="content flex justify-between" >
<view>
<text class="cuIcon-vip text-yellow margin-right-sm"></text>
<text class="text-grey">当前版本</text>
</view>
<view>
<text class="text-grey"></text>
</view>
</view>
</view> -->
</view>
</view>
</view>
</template>
<script>
export default {
data:function(){
return{
fileSizeString:"0kb",
title:"系统设置",
showV:false,
V:0
}
},
watch: {
// cur: {
// immediate: true,
// handler() {
// this.formatSize()
// },
// },
},
computed: {
isSuperuser() {
return this.$store.state.isSuperuser
}
},
methods:{
goTopage(e){
this.$Router.push({name:e})
},
clearCache() {
let that = this;
let os = plus.os.name;
if (os == 'Android') {
let main = plus.android.runtimeMainActivity();
let sdRoot = main.getCacheDir();
let files = plus.android.invoke(sdRoot, "listFiles");
let len = files.length;
for (let i = 0; i < len; i++) {
let filePath = '' + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径
plus.io.resolveLocalFileSystemURL(filePath, function(entry) {
if (entry.isDirectory) {
entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录
uni.showToast({
title: '缓存清理完成',
duration: 2000
});
that.formatSize(); // 重新计算缓存
}, function(e) {
console.log(e.message)
});
} else {
entry.remove();
}
}, function(e) {
console.log('文件路径读取失败')
});
}
} else { // ios
plus.cache.clear(function() {
uni.showToast({
title: '缓存清理完成',
duration: 2000
});
that.formatSize();
});
}},
// 计算缓存
formatSize() {
let that = this;
plus.cache.calculate(function(size) {
let sizeCache = parseInt(size);
if (sizeCache == 0) {
that.fileSizeString = "0B";
} else if (sizeCache < 1024) {
that.fileSizeString = sizeCache + "B";
} else if (sizeCache < 1048576) {
that.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
} else if (sizeCache < 1073741824) {
that.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
} else {
that.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
}
});
}
},
onLoad(d) {
let that=this
//#ifdef APP-PLUS
let platform = uni.getSystemInfoSync().platform;
if (platform == 'android'){
that.showV=true
plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
that.V = wgtinfo.version})
}
//#endif
}
}
</script>
<style>
</style>
<template> <template>
<view> <view>
<cu-custom bgColor="bg-blue" :isBack="true">
<block slot="content">
{{title}}
</block>
</cu-custom>
<scroll-view scroll-y class="page"> <scroll-view scroll-y class="page">
<cu-custom bgColor="bg-gradual-pink" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">用户详情</block>
<view slot="right" @tap="rightClick">编辑</view>
</cu-custom>
<!-- list列表 -->
<view class="cu-list menu"> <view class="cu-list menu">
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
<view class="content">
<text class="text-grey">头像</text>
</view>
<view class="action">
<view class="cu-avatar round sm" :style="{backgroundImage: 'url(' + personalMsg.avatar + ')'}"></view>
</view>
</view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]"> <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
<view class="content"> <view class="content">
<text class="text-grey">姓名</text> <text class="text-grey">姓名</text>
</view> </view>
<view class="action"> <view class="action">
<text class="text-grey">{{personalMsg.realname}}</text> <text class="text-grey">{{userinfo.username}}</text>
</view> </view>
</view> </view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]"> <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
<view class="content"> <view class="content">
<text class="text-grey">性别</text> <text class="text-grey">手机号</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.sex}}</text>
</view>
</view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.4s'}]">
<view class="content">
<text class="text-grey">生日</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.birthday}}</text>
</view>
</view>
</view>
<view class="cu-list menu">
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
<view class="content">
<text class="text-grey">对外信息展示</text>
</view>
<view class="action">
<text class="text-grey">{{getSubStringText(personalMsg.realname+'@'+personalMsg.orgCode,11)}}</text>
</view>
</view>
</view>
<view class="cu-list menu">
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.6s'}]">
<view class="content">
<text class="text-grey">所在部门</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.orgCode}}</text>
</view>
</view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.7s'}]">
<view class="content">
<text class="text-grey">工号</text>
</view> </view>
<view class="action"> <view class="action">
<text class="text-grey">{{personalMsg.workNo}}</text> <text class="text-grey">{{userinfo.phone||"未设置"}}</text>
</view> </view>
</view> </view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.8s'}]"> <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
<view class="content">
<text class="text-grey">状态</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.status}}</text>
</view>
</view>
</view>
<view class="cu-list menu">
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.9s'}]">
<view class="content"> <view class="content">
<text class="text-grey">手机</text> <text class="text-grey">邮箱</text>
</view> </view>
<view class="action"> <view class="action">
<text class="text-grey">{{personalMsg.phone}}</text> <text class="text-grey">{{userinfo.email||"未设置"}}</text>
</view> </view>
</view> </view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1s'}]"> <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
<view class="content"> <view class="content">
<text class="text-grey">邮箱</text> <text class="text-grey">部门</text>
</view> </view>
<view class="action"> <view class="action">
<text class="text-grey">{{personalMsg.email}}</text> <text class="text-grey">{{userinfo.bmmc||"未设置"}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="cu-list menu"> <view class="cu-list menu">
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.1s'}]"> <view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
<view class="content">
<text class="text-grey">职务</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.post}}</text>
</view>
</view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.2s'}]">
<view class="content">
<text class="text-grey">身份</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.identity}}</text>
</view>
</view>
<view class="cu-item animation-slide-bottom" v-if="personalMsg.identity =='上级'" >
<view class="content"> <view class="content">
<text class="text-grey">负责部门</text> <text class="text-grey">修改密码</text>
</view> </view>
<view class="action"> <view class="action">
<text class="text-grey">{{personalMsg.departIds}}</text> <text class="text-grey " @tap="modify()" style="color: cornflowerblue;cursor: pointer;">{{'前往修改'}}</text>
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script> <script>
import api from '@/api/api.js'
export default { export default {
data() { data() {
return { return {
personalMsg:{ userid:"",
avatar:'', userinfo:{},
realname:'', apiUser:"kzzx/user/query",
username:'', title:"个人信息"
sex:1,
birthday:new Date(),
orgCode:'',
workNo:'',
status:1,
phone:'',
telephone:'',
email:'',
post:'',
departIds:'',
identity:'',
},
userUrl:'/sys/user/queryById',
positionUrl:'/sys/position/list',
departUrl:'/sys/user/userDepartList'
}; };
}, },
onLoad() { onLoad() {
...@@ -176,55 +88,28 @@ ...@@ -176,55 +88,28 @@
url: '/pages/user/useredit?item='+item url: '/pages/user/useredit?item='+item
}); */ }); */
}, },
modify(){
this.$Router.push({name:"modifyPw"})
},
loadinfo(){ loadinfo(){
this.$http.get(this.userUrl,{params:{id:this.$store.getters.userid}}).then(res=> { let that=this
console.log("用户",res) uni.getStorage({
if (res.data.success) { key:'userinfo',
let result = res.data.result success:function(e){
if(result.avatar&&result.avatar.length >0) that.userid=e.data.userkey
this.personalMsg.avatar = api.getFileAccessHttpUrl(result.avatar) that.$http.post(that.apiUser,{id:that.userid}).then(e=>{
this.personalMsg.realname = result.realname if(e.data.success){
this.personalMsg.username= result.username that.userinfo=e.data.data.records[0]
this.personalMsg.post = result.post }else{
this.personalMsg.sex = result.sex===1?'男':'女'
this.personalMsg.birthday = result.birthday== null?'无':result.birthday
this.personalMsg.departIds= result.departIds
this.personalMsg.workNo= result.workNo
this.personalMsg.phone= result.phone
this.personalMsg.telephone= result.telephone== null?'无':result.telephone
this.personalMsg.email= result.email
this.personalMsg.post= result.post
this.personalMsg.identity= result.identity=== 1?'普通成员':'上级'
this.personalMsg.status= result.status === 1?'正常':'冻结'
this.personalMsg.orgCode= result.orgCode
}
}).catch(e=>{
console.log("请求错误",e)
})
this.$http.get(this.departUrl,{params:{userId:this.$store.getters.userid}}).then(res=> {
if (res.success) {
for (let item of res.result){
this.personalMsg.orgCode = item.title
this.personalMsg.departIds = item.title
}
}
}).catch(e=>{
console.log("请求错误",e)
})
this.$http.get(this.positionUrl).then(res=> {
if (res.success) {
let postArr = res.result.records
for (let item of postArr ){
if (this.personalMsg.post == item.code){
this.personalMsg.post = item.name
} }
} })
},
fail() {
} }
}).catch(e=>{ })
console.log("请求错误",e)
})
}, },
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment