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

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

parent b0ca57a1
......@@ -29,7 +29,6 @@ const routes = [
title: '首页',
},
},
{
path: '/pages/user/people',
name: 'people',
......@@ -115,9 +114,13 @@ const routes = [
title: '工作日报',
},
},
{
path: '/pages/user/modifyPw',
name: 'modifyPw',
meta: {
title: '修改密码',
},
},
]
export default routes
......@@ -36,6 +36,30 @@
"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",
"style": {
......
......@@ -212,6 +212,7 @@
password: loginParams.encodePWD,
newPassword: md5(this.password)
}
this.logining = true;
//#ifdef MP-WEIXIN
//若是小程序平台,则获取到openId。整个过程是静默完成的
......@@ -265,10 +266,19 @@
"password": ""
})
}
this.$tip.success('登录成功!')
this.$Router.replaceAll({
uni.setStorage({
key: 'userinfo',
data:{...res.data},
success: function (r) {
that.$tip.success('登录成功!')
that.$Router.replaceAll({
name: 'homepage'
})
}
});
} else {
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
<template>
<view>
<scroll-view scroll-y class="page bg-oa">
<!-- 头部logo-->
<view class="UCenter-bg" @click="remove">
<image :src="personalList.avatar" round class="png animation-slide-right margin-bottom-sm"
mode="widthFix" :style="[{animationDelay: '0.1s'}]"></image>
<view class="text-xl animation-slide-left" :style="[{animationDelay: '0.2s'}]">
{{personalList.depart}}
<view style="height: 100vh;">
<cu-custom bgColor="bg-blue">
<block slot="content">
{{title}}
</block>
</cu-custom>
<scroll-view scroll-y class="page">
<view class="bg-white padding-lr-sm margin-top-xs " style="height: 50px;">
<view class="flex" style="">
<image style="border-radius: 50%;height: 48px;width: 48px;" src="../../static/icon/tx.jpg"></image>
<view style="padding-left: 10px;line-height:48px;font-size: 16px;">
{{userName}}, {{getTimeState()}}
</view>
<image src="/static/wave.gif" mode="scaleToFill" class="gif-wave"></image>
</view>
<!-- 个人信息卡片-->
<!-- <view class="cu-list menu-avatar">
<view class="cu-item">
<view class="cu-avatar round lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10006.jpg);"></view>
<view class="content flex-sub">
<view class="text-grey">{{personalList.avatar}}</view>
<view class="text-gray text-sm flex justify-between">
经理
</view>
<view class="flex cu-list menu margin-top-sm shadow-lg radius">
<view class="cu-item " @tap="gotoUserPage()"
style="margin-top: 10px;border-bottom: 1px solid #eee;">
<view class="content">
<text class=" "></text>
<text class="text-grey">个人信息</text>
</view>
</view>
<view class="cu-item " url="/pages/user/setting" style="margin-top: 10px;">
<view class="content">
<text class=" "></text>
<text class="text-grey">系统设置</text>
</view>
</view>
</view> -->
<view class="padding flex text-center text-grey bg-white shadow-warp">
<view class="flex flex-sub flex-direction solid-right animation-slide-top"
:style="[{animationDelay: '0.2s'}]">
<view class="text-xl text-orange">{{personalList.username}}</view>
<view class="margin-top-sm"><text class="cuIcon-people"></text> 用户</view>
</view>
<view class="text-center margin-bottom-sm margin-top-sm">
<button style="display: flex;" class="cu-btn lg margin-top-sm bg-white text-red"
@tap="clearToken"><text space="emsp">退出当前账号</text>
</button>
</view>
<view class="flex flex-sub flex-direction animation-slide-top" :style="[{animationDelay: '0.2s'}]">
<view class="text-xl text-green">{{personalList.post?personalList.post:'员工'}}</view>
<view class="margin-top-sm"><text class="cuIcon-news"></text> 职务</view>
<view class="cu-tabbar-height"></view>
</scroll-view>
<view class="cu-modal bottom-modal" :class="modalName=='bottomModal'?'show':''">
<view class="cu-dialog">
<view class="padding-sm">
<view class="cu-list grid col-5 text-sm border" style="background-color: transparent;">
<view class="cu-item" v-for="(item,index) in settingList" :key="index"
@tap="jumptoPage(item.page)">
<view class="padding-tb">
<view class="text-center" style="position: relative;">
<view class="menu-avatar setting-menu" style="background-color:white;">
<img :src="item.icon" style="padding: 8px">
</view>
<view class="margin-top-xs">{{item.title}}</view>
<view class="menu-cur message-info" v-show="item.wtsl&&item.wtsl>0">
<block>{{item.wtsl>99?"99+":item.wtsl}}</block>
</view>
<!-- 列表list-->
<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
<!-- <view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
<view class="content" >
<text class="cuIcon-favorfill text-yellow"></text>
<text class="text-grey">收藏</text>
</view>
</view>
<view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
<view class="content">
<text class="cuIcon-redpacket_fill text-red"></text>
<text class="text-grey">红包</text>
</view>
</view>
<view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
<navigator class="content" url="/pages/user/userdetail" hover-class="none">
<text class="cuIcon-settingsfill text-cyan"></text>
<text class="text-grey">设置</text>
</navigator>
</view> -->
<view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.7s'}]">
<navigator class="content" hover-class="none" @tap="logout">
<text class="cuIcon-exit text-cyan"></text>
<text class="text-grey">退出</text>
</navigator>
</view>
<view class="flex text-center">
<button style="flex: 1;background: white;" class="cu-btn round margin-sm" @tap="hideModal"><text
space="emsp">取消</text></button>
</view>
</view>
</view>
<view class="cu-bar tabbar bg-white shadow foot">
<view :class="PageCur=='mainPool'?'action text-blue':'action text-black'" @click="NavChange"
data-cur="mainPool">
<view :class="PageCur=='mainPool'?'cuIcon-circlefill':'cuIcon-circle'"></view>工作台
</view>
<view :class="PageCur=='people'?'action text-blue':'action text-black'" @click="NavChange"
data-cur="people">
<view :class="PageCur=='people'?'cuIcon-peoplefill':'cuIcon-people'"></view>个人中心
</view>
</view>
<view class="cu-tabbar-height"></view>
</scroll-view>
</view>
</template>
<script>
import appUpdate from 'common/util/appUpdate.js'
import api from '@/api/api'
import {
us,
os
} from '@/common/util/work.js'
export default {
name: "people",
data() {
return {
personalList: {
avatar: '',
realname: '',
username: '',
post: ''
},
positionUrl: '/sys/position/list',
departUrl: '/sys/user/userDepartList',
userUrl: '/sys/user/queryById',
PageCur: 'people',
title: "个人中心",
isShow: "gr",
userName: "用户",
userId: '',
id: ''
};
id: '',
navList: [],
typeList: [
],
messageNumber: null,
timer: null,
settingList: [],
modalName: null
}
},
watch: {
cur: {
immediate: true,
handler() {
let that=this
uni.getStorage({
key:'userinfo',
success:function(e){
// this.load()
// #ifdef APP-PLUS
// 检测升级
// console.log("appUpdate")
// appUpdate()
// #endif
that.userName=e.data.username
},
fail() {
}
})
console.log('watch',this.cur)
this.userId=this.$store.getters.userid;
},
},
},
computed: {
isSuperuser() {
return this.$store.state.isSuperuser
}
},
methods: {
remove() {
uni.removeStorageSync('Access-Token')
gotoUserPage(){
this.$Router.push({
name: "userdetail"
})
},
load() {
this.$http.get(this.userUrl, {
params: {
id: this.$store.getters.userid
}
}).then(res => {
console.log("res", res)
if (res.data.success) {
let perArr = res.data.result
let avatar = (perArr.avatar && perArr.avatar.length > 0) ? api.getFileAccessHttpUrl(perArr
.avatar) : '/static/avatar_boy.png'
this.personalList.avatar = avatar
this.personalList.realname = perArr.realname
this.personalList.username = perArr.username
this.personalList.post = perArr.post
this.personalList.depart = perArr.departIds
}
}).catch(err => {
console.log(err);
toMessage() {
this.$Router.push({
name: "message"
})
this.hideModal()
},
hideModal() {
this.modalName = null;
},
jumptoPage(value) {
this.hideModal()
this.$Router.push({
name: value
});
},
logout() {
NavChange: function(e) {
this.PageCur = e.currentTarget.dataset.cur;
this.$Router.replace({
name: this.PageCur
})
},
getTtemDotInfo() {},
selectPage() {},
getTimeState() {
// 获取当前时间
let timeNow = new Date();
// 获取当前小时
let hours = timeNow.getHours();
// 设置默认文字
let state = ``;
// 判断当前时间段
if (hours >= 0 && hours <= 10) {
state = `早上好!`;
} else if (hours > 10 && hours <= 14) {
state = `中午好!`;
} else if (hours > 14 && hours <= 18) {
state = `下午好!`;
} else if (hours > 18 && hours <= 24) {
state = `晚上好!`;
}
return state;
},
clearToken() {
uni.removeStorage({
key: "ACCESS_TOKEN"
})
......@@ -137,14 +192,98 @@
this.$Router.replaceAll({
name: "login"
})
},
goToPage(item, type) {
this.$Router.push({
name: "mywork",
params: {
id: item.id,
name: item.name,
type: type
}
})
},
},
onShow() {
},
onLoad() {
},
onHide() {
},
onUnload() {
},
destroyed() {
}
}
</script>
<style>
.UCenter-bg {
<style scoped>
/deep/.cu-list+.cu-list {
margin-top: 10px;
}
.menu-cur {
font-size: 12px;
vertical-align: middle;
position: absolute;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0px 8px;
height: 48rpx;
font-family: Helvetica Neue, Helvetica, sans-serif;
white-space: nowrap;
top: 0;
right: 0;
}
.butselected {
width: 50%;
color: #FFFFFF;
background-color: #0066CC;
text-align: center;
line-height: 34px;
}
.butnoselected {
width: 50%;
color: #0066CC;
background-color: #FFFFFF;
text-align: center;
line-height: 34px;
}
.c {
width: 50%;
color: #0066CC;
background-color: #FFFFFF;
text-align: center;
line-height: 34px;
}
.peoplebut {
border: 1px solid #0066CC;
height: 36px;
width: 25vh;
border-radius: 0px;
margin: 0 auto;
margin-bottom: 10px;
}
.UCenter-bg {
/* #ifdef MP-WEIXIN */
background-image: url('https://static.jeecg.com/upload/test/blue_1595818030310.png');
/* #endif */
/* #ifndef MP-WEIXIN */
/* background-image: url('/static/blue.png'); */
/* #endif */
background-size: cover;
height: 400rpx;
display: flex;
......@@ -159,6 +298,10 @@
text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}
.userinforbg {
background: linear-gradient(to top, pink, #4a86e8);
}
.UCenter-bg text {
opacity: 0.8;
}
......@@ -192,9 +335,89 @@
height: 300rpx;
}
.bg-oa {
background-image: url('/static/oa.png');
background-size: 180% 100%;
height: 100vh;
.min-height {
height: 20rpx;
}
.bg-f {
background-color: #f8f8f8;
}
/deep/ .cu-list.menu-avatar>.cu-item:after,
.cu-list.menu>.cu-item:after {
border: none;
}
/deep/ .nav-owner .cu-list .cu-item {
/* display: flex;
flex-wrap: wrap;
justify-content: space-between; */
margin: 0 10px;
border-radius: 4px;
/* min-height: 35px; */
}
/deep/ .cu-list.grid>.cu-item [class*=cuIcon] {
margin-top: 0;
}
/deep/ .nav-owner .cu-list .cu-item .icon {
flex: 1;
}
/deep/ .nav-owner .cu-list .cu-item .text {}
/deep/ .cu-list.menu>.cu-item {
min-height: 45px;
}
/deep/ .cu-list.menu>.cu-item.arrow:before {
content: "全部\e6a3";
font-size: 12px;
width: 36px;
color: #999;
}
.menu-cur {
font-size: 12px;
vertical-align: middle;
position: absolute;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0px 8px;
height: 48rpx;
font-family: Helvetica Neue, Helvetica, sans-serif;
white-space: nowrap;
top: 0;
right: 0;
}
.message-info {
background-color: #ff5500;
color: white;
width: 24px;
height: 24px;
border-radius: 12px;
font-size: 12px;
color: white !important;
}
.setting-menu {
background-color: white;
width: 96rpx;
height: 96rpx;
line-height: 96rpx;
border-radius: 24px;
display: inline-block;
/* padding: 8px; */
border-radius: 48rpx;
}
.setting-menu img {
width: 64rpx;
height: 64rpx;
display: inline-block;
}
</style>
\ No newline at end of file
<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>
<view>
<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 bgColor="bg-blue" :isBack="true">
<block slot="content">
{{title}}
</block>
</cu-custom>
<!-- list列表 -->
<scroll-view scroll-y class="page">
<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="content">
<text class="text-grey">姓名</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.realname}}</text>
<text class="text-grey">{{userinfo.username}}</text>
</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">
<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>
<text class="text-grey">手机号</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.workNo}}</text>
</view>
<text class="text-grey">{{userinfo.phone||"未设置"}}</text>
</view>
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.8s'}]">
<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="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
<view class="content">
<text class="text-grey">手机</text>
<text class="text-grey">邮箱</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.phone}}</text>
<text class="text-grey">{{userinfo.email||"未设置"}}</text>
</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">
<text class="text-grey">邮箱</text>
<text class="text-grey">部门</text>
</view>
<view class="action">
<text class="text-grey">{{personalMsg.email}}</text>
<text class="text-grey">{{userinfo.bmmc||"未设置"}}</text>
</view>
</view>
</view>
<view class="cu-list menu">
<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '1.1s'}]">
<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="cu-item animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
<view class="content">
<text class="text-grey">负责部门</text>
<text class="text-grey">修改密码</text>
</view>
<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>
</scroll-view>
</view>
</template>
<script>
import api from '@/api/api.js'
export default {
data() {
return {
personalMsg:{
avatar:'',
realname:'',
username:'',
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'
userid:"",
userinfo:{},
apiUser:"kzzx/user/query",
title:"个人信息"
};
},
onLoad() {
......@@ -176,55 +88,28 @@
url: '/pages/user/useredit?item='+item
}); */
},
modify(){
this.$Router.push({name:"modifyPw"})
},
loadinfo(){
this.$http.get(this.userUrl,{params:{id:this.$store.getters.userid}}).then(res=> {
console.log("用户",res)
if (res.data.success) {
let result = res.data.result
if(result.avatar&&result.avatar.length >0)
this.personalMsg.avatar = api.getFileAccessHttpUrl(result.avatar)
this.personalMsg.realname = result.realname
this.personalMsg.username= result.username
this.personalMsg.post = result.post
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)
})
let that=this
uni.getStorage({
key:'userinfo',
success:function(e){
that.userid=e.data.userkey
that.$http.post(that.apiUser,{id:that.userid}).then(e=>{
if(e.data.success){
that.userinfo=e.data.data.records[0]
}else{
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)
})
},
fail() {
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
}
}
}
}).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