userInfo.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="content">
  3. <!-- 个人信息 -->
  4. <view class="user-info">
  5. <view class="info-box">
  6. <view class="left">
  7. <view class="head-box">
  8. <image class="img" :src="avatar" mode="aspectFill"></image>
  9. </view>
  10. <view class="info">
  11. <!-- <text class="name">{{nickName}}</text> -->
  12. <!-- <text class="title">{{postNames}}</text> -->
  13. <view>
  14. <text class="fs28">{{nickName}}</text>
  15. <text class="fs24 ml40 base-color-3">{{sex}}</text>
  16. </view>
  17. <view class="base-color-9 fs24 mt12">注册时间:{{!userinfo.createTime||userinfo.createTime.slice(0, 10)}}</view>
  18. </view>
  19. </view>
  20. <image v-if="!isShow" class="right" src="/static/images/icon_edit.png" mode="aspectFill" @click="editInfo"></image>
  21. </view>
  22. <!-- 公司 -->
  23. <view class="justify-between">
  24. <view class="comp-info">
  25. <image class="img" src="/static/images/icon_comp.png" mode="aspectFill"></image>
  26. <text class="fs24 base-color-6">{{deptName}}</text>
  27. </view>
  28. <view class="comp-info">
  29. <image class="img" src="/static/images/phone.png" mode="aspectFill"></image>
  30. <text class="fs24 base-color-6">{{userinfo.phonenumber}}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 详细信息 -->
  35. <view class="p20 justify-between wrap">
  36. <view class="base-bg-sure radius12 pl20 ptb12 item">
  37. <view class="bold">会员总数</view>
  38. <view class="mt12 base-color">
  39. <text class="fs40 bold">98</text>
  40. <text class="fs28">人</text>
  41. </view>
  42. </view>
  43. <view class="base-bg-sure radius12 pl20 ptb12 item">
  44. <view class="bold">今日新增会员</view>
  45. <view class="mt12 base-color">
  46. <text class="fs40 bold">98</text>
  47. <text class="fs28">人</text>
  48. </view>
  49. </view>
  50. <view class="base-bg-sure radius12 pl20 ptb12 item">
  51. <view class="bold">会员红包数</view>
  52. <view class="mt12 base-color">
  53. <text class="fs40 bold">98</text>
  54. <text class="fs28">个</text>
  55. </view>
  56. </view>
  57. <view class="base-bg-sure radius12 pl20 ptb12 item">
  58. <view class="bold">新会员红包金额</view>
  59. <view class="mt12 base-color">
  60. <text class="fs40 bold">98</text>
  61. <text class="fs28">元</text>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="footer-btn ">
  66. <view :class="shenhe?'shenhed':'notshenhe'" @click="submitshen">{{shenhe?'已审核':'待审核'}}</view>
  67. <view class="base-bg-false base-color-red bor-red" @click="submitjin">{{jinyong?'禁用':'未禁用'}}</view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {getUserInfoByUserId,getUserInfo} from '@/api/user.js';
  73. export default {
  74. data() {
  75. return {
  76. avatar:"/static/images/default.png",
  77. nickName:"",
  78. deptName:"",
  79. postNames:"",
  80. phonenumber:"",
  81. email:"",
  82. sex:"",
  83. isShow:false,
  84. userId:undefined,
  85. userinfo:[],
  86. shenhe:false,
  87. jinyong:false
  88. }
  89. },
  90. onLoad(option) {
  91. // 修改顶部导航背景色
  92. // uni.setNavigationBarColor({
  93. // frontColor: '#ffffff',
  94. // backgroundColor: '#4BC9B1',
  95. // animation: {
  96. // duration: 400,
  97. // timingFunc: 'easeIn'
  98. // }
  99. // })
  100. if(!this.utils.isEmpty(option.userId)){
  101. this.userId = option.userId;
  102. this.isShow=true;
  103. }
  104. },
  105. onShow() {
  106. if(this.isShow){
  107. this.getUserInfoByUserId(this.userId);
  108. }
  109. else{
  110. this.getUserInfo();
  111. }
  112. },
  113. methods: {
  114. submitshen(){
  115. },
  116. submitjin(){
  117. },
  118. bindUser(data){
  119. var that=this;
  120. that.userinfo=data.user
  121. console.log(that.userinfo)
  122. that.nickName=data.user.nickName;
  123. that.deptName=data.user.dept.deptName;
  124. that.posts=data.post;
  125. that.phonenumber=data.user.phonenumber;
  126. that.email=data.user.email;
  127. if(data.user.sex==0){
  128. that.sex="男";
  129. }
  130. else if(data.user.sex==1){
  131. that.sex="女";
  132. }
  133. else if(data.user.sex==2){
  134. that.sex="未知";
  135. }
  136. if(data.post!=null&&data.post.length>0){
  137. var posts=[];
  138. data.post.forEach( (v,i) => {
  139. posts.push(v);
  140. },this);
  141. that.postNames=posts.toString()
  142. }
  143. if(!that.utils.isEmpty(data.user.avatar)){
  144. that.avatar=uni.getStorageSync('requestPath')+data.user.avatar;
  145. }
  146. },
  147. getUserInfoByUserId(userId){
  148. var data = {userId:userId};
  149. var that=this;
  150. getUserInfoByUserId(data).then(
  151. res => {
  152. that.bindUser(res);
  153. },
  154. rej => {}
  155. );
  156. },
  157. getUserInfo(){
  158. var data = {};
  159. var that=this;
  160. getUserInfo(data).then(
  161. res => {
  162. that.bindUser(res);
  163. },
  164. rej => {}
  165. );
  166. },
  167. // 拨打电话
  168. callPhone(tel){
  169. uni.makePhoneCall({
  170. phoneNumber: tel
  171. })
  172. },
  173. // 个人信息编辑
  174. editInfo() {
  175. uni.navigateTo({
  176. url: '../editUser'
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. page{
  184. background: #fff;
  185. }
  186. </style>
  187. <style scoped lang="scss">
  188. .footer-btn{
  189. display: flex;
  190. justify-content: space-around;
  191. position: fixed;
  192. bottom: 0;
  193. width: 100%;
  194. padding: 40rpx 0;
  195. view{
  196. width: 40%;
  197. text-align: center;
  198. padding: 20rpx 0;
  199. border-radius: 50rpx;
  200. }
  201. }
  202. .shenhed{
  203. background-color: rgba(64, 149,229,0.1);
  204. border: 2rpx solid #4095E5;
  205. color:#4095E5 ;
  206. }
  207. .notshenhe{
  208. background-color:rgba(255, 108,71,0.1) ;
  209. border: 2rpx solid #FF6C47;
  210. color: #FF6C47;
  211. }
  212. .item{
  213. width: calc(50% - 20rpx);
  214. margin-top: 20rpx;
  215. }
  216. .content{
  217. // 个人信息
  218. .user-info{
  219. background: linear-gradient(to right, #dae9ff, #e1e1fd);
  220. padding: 0 30upx;
  221. .info-box{
  222. display: flex;
  223. align-items: center;
  224. justify-content: space-between;
  225. .left{
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. padding: 20upx 0;
  230. .head-box{
  231. width: 120upx;
  232. height: 120upx;
  233. line-height: 100upx;
  234. font-size: 30upx;
  235. color: #fff;
  236. text-align: center;
  237. margin-right: 20upx;
  238. .img{
  239. border-radius: 50%;
  240. width: 100%;
  241. height: 100%;
  242. }
  243. }
  244. }
  245. .right{
  246. width: 40upx;
  247. height: 40upx;
  248. }
  249. }
  250. .comp-info{
  251. padding: 20upx 0 40upx;
  252. display: flex;
  253. align-items: center;
  254. .img{
  255. width: 30upx;
  256. height: 30upx;
  257. margin-right: 20upx;
  258. }
  259. .text{
  260. font-size: 30upx;
  261. color: #fff;
  262. }
  263. }
  264. }
  265. }
  266. </style>