userInfo.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="content">
  3. <!-- 个人信息 -->
  4. <view class="user-info">
  5. <view class="info-box">
  6. <view class="left justify-center align-center">
  7. <view class="head-box center">
  8. <u-avatar :src="avatar" size="50"></u-avatar>
  9. </view>
  10. <view class="info">
  11. <text class="name">{{nickName}}</text>
  12. <text class="title">{{phonenumber}}</text>
  13. </view>
  14. </view>
  15. <image class="right" :src="imgPath+'/app/images/icon_edit.png'" mode="aspectFill'" @click="editInfo">
  16. </image>
  17. </view>
  18. <!-- 公司 -->
  19. <view class="comp-info">
  20. <image class="img" :src="imgPath+'/app/images/icon_comp_white.png'" mode="aspectFill"></image>
  21. <text class="text">{{deptName}}</text>
  22. </view>
  23. </view>
  24. <!-- 详细信息 -->
  25. <view class="info-detail">
  26. <view class="item" v-if="inviteCode">
  27. <text class="label">邀请码</text>
  28. <text class="text es-mr-30">{{inviteCode}}</text>
  29. <text class="es-c-33 es-fs-24" @tap="copyFun" v-if="inviteCode">复制</text>
  30. </view>
  31. <view class="item">
  32. <text class="label">姓名</text>
  33. <text class="text">{{nickName}}</text>
  34. </view>
  35. <view class="item">
  36. <text class="label">性别</text>
  37. <text class="text">{{sex}}</text>
  38. </view>
  39. <view class="item column" @click="callPhone(phonenumber)">
  40. <view class="left">
  41. <text class="label">手机</text>
  42. <text class="text">{{phonenumber}}</text>
  43. </view>
  44. </view>
  45. <view class="item">
  46. <text class="label">邮箱</text>
  47. <text class="text">{{email}}</text>
  48. </view>
  49. <view class="item">
  50. <text class="label">部门</text>
  51. <text class="text">{{deptName}}</text>
  52. </view>
  53. <view class="item">
  54. <text class="label">岗位</text>
  55. <text class="text">{{postNames}}</text>
  56. </view>
  57. <view class="item">
  58. <text class="label">角色</text>
  59. <text class="text">{{roleNames}}</text>
  60. </view>
  61. <view class="item justify-start align-center" v-if="inviteCode">
  62. <text class="label">二维码</text>
  63. <uqrcode ref="uqrcode" canvas-id="qrcode" :value="inviteCode" :size="80" :options="{ margin: 10 }"></uqrcode>
  64. <!-- <text class="text">{{postNames}}</text> -->
  65. <!-- <image :src="qrCodeWeixin" class="w120 h120" mode="aspectFill"></image> -->
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. getInviteCode,
  73. getCompanyUser
  74. } from './api/manageCompany.js';
  75. export default {
  76. data() {
  77. return {
  78. avatar: this.$store.getters.imgpath + "/app/images/detault_head.jpg",
  79. nickName: "",
  80. deptName: "",
  81. postNames: "",
  82. phonenumber: "",
  83. email: "",
  84. sex: "",
  85. qrCodeWeixin: "",
  86. isShow: false,
  87. userId: null,
  88. inviteCode:'',
  89. roleNames: ''
  90. }
  91. },
  92. onLoad(option) {
  93. // 修改顶部导航背景色
  94. // uni.setNavigationBarColor({
  95. // frontColor: '#ffffff',
  96. // backgroundColor: '#4BC9B1',
  97. // animation: {
  98. // duration: 400,
  99. // timingFunc: 'easeIn'
  100. // }
  101. // })
  102. },
  103. computed: {
  104. imgPath() {
  105. return this.$store.getters.imgpath
  106. }
  107. },
  108. onShow() {
  109. this.getCompanyUser();
  110. },
  111. methods: {
  112. async getInviteCodeFun(){
  113. const res = await getInviteCode({salesId:this.userId})
  114. this.inviteCode = res.inviteCode || ''
  115. },
  116. copyFun() {
  117. uni.setClipboardData({
  118. data: this.inviteCode,
  119. success: () => {
  120. uni.showToast({
  121. title: '复制成功',
  122. icon: 'none'
  123. });
  124. },
  125. fail: () => {
  126. uni.showToast({
  127. title: '复制失败',
  128. icon: 'none'
  129. });
  130. }
  131. });
  132. },
  133. bindUser(data) {
  134. var that = this;
  135. that.userId = data.userId;
  136. this.getInviteCodeFun()
  137. that.nickName = data.nickName;
  138. that.deptName = data.companyName ? data.companyName : '暂无';
  139. that.phonenumber = data.phonenumber ? data.phonenumber : '暂无';
  140. if (data.posts) {
  141. that.postNames = data.posts.map(item => item.postName).join(",")
  142. }
  143. if (data.roles) {
  144. this.roleNames = data.roles.map(item => item.roleName).join(",")
  145. }
  146. // this.postNames=data.posts.map(item=>item.postName).join(",")||'暂无'
  147. // this.roleNames=data.roles.map(item=>item.roleName).join(",")||'暂无'
  148. that.email = data.email ? data.email : '暂无';
  149. if (data.sex == 0) {
  150. that.sex = "男";
  151. } else if (data.sex == 1) {
  152. that.sex = "女";
  153. } else if (data.sex == 2) {
  154. that.sex = "未知";
  155. }
  156. if (data.qrCodeWeixin.includes('http')) {
  157. that.qrCodeWeixin = data.qrCodeWeixin
  158. } else {
  159. that.qrCodeWeixin = uni.getStorageSync('requestPath') + data.qrCodeWeixin
  160. }
  161. if (data.avatar) {
  162. that.avatar = data.avatar;
  163. }
  164. },
  165. getCompanyUser() {
  166. var data = {};
  167. var that = this;
  168. getCompanyUser(data).then(
  169. res => {
  170. that.bindUser(res.user);
  171. },
  172. rej => {}
  173. );
  174. },
  175. // 拨打电话
  176. callPhone(tel) {
  177. uni.makePhoneCall({
  178. phoneNumber: tel
  179. })
  180. },
  181. // 个人信息编辑
  182. editInfo() {
  183. uni.navigateTo({
  184. url: 'editUser'
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss">
  191. page {
  192. background: #fff;
  193. }
  194. </style>
  195. <style scoped lang="scss">
  196. .content {
  197. // 个人信息
  198. .user-info {
  199. // background: #115296;
  200. background: linear-gradient(to right, #dae9ff, #e1e1fd);
  201. padding: 0 30upx;
  202. .info-box {
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. .left {
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. padding: 20upx 0;
  211. .head-box {
  212. width: 120upx;
  213. height: 120upx;
  214. line-height: 100upx;
  215. font-size: 30upx;
  216. color: #fff;
  217. text-align: center;
  218. margin-right: 20upx;
  219. .img {
  220. border-radius: 50%;
  221. width: 100%;
  222. height: 100%;
  223. }
  224. }
  225. .info {
  226. height: 80upx;
  227. display: flex;
  228. flex-direction: column;
  229. justify-content: space-between;
  230. .name {
  231. font-size: 30upx;
  232. color: #878787;
  233. }
  234. .title {
  235. font-size: 28upx;
  236. color: #878787;
  237. }
  238. }
  239. }
  240. .right {
  241. width: 40upx;
  242. height: 40upx;
  243. }
  244. }
  245. .comp-info {
  246. padding: 20upx 0 40upx;
  247. display: flex;
  248. align-items: center;
  249. .img {
  250. width: 30upx;
  251. height: 30upx;
  252. margin-right: 20upx;
  253. }
  254. .text {
  255. font-size: 30upx;
  256. color: #878787;
  257. }
  258. }
  259. }
  260. // 详细信息
  261. .info-detail {
  262. padding: 0 24upx;
  263. .item {
  264. padding: 20upx 0;
  265. border-bottom: 1px solid #f7f7f7;
  266. .label {
  267. font-size: 30upx;
  268. color: #999;
  269. margin-right: 20upx;
  270. }
  271. .text {
  272. font-size: 30upx;
  273. color: #333;
  274. }
  275. &.column {
  276. display: flex;
  277. align-items: center;
  278. justify-content: flex-start;
  279. align-items: flex-start;
  280. flex-direction: row;
  281. .img {
  282. width: 50upx;
  283. height: 50upx;
  284. margin-right: 20rpx;
  285. }
  286. }
  287. }
  288. }
  289. }
  290. </style>