person-card.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="test">
  3. <view v-if="showChangeName" class="change-name-wrapper">
  4. <view class="change-name">
  5. <view class="title">昵称修改</view>
  6. <view class="oldName">
  7. 旧昵称:<input type="text" :value="oldName" disabled />
  8. </view>
  9. <view class="newName">
  10. 新昵称:<input type="text" v-model="newName" focus maxlength="12" placeholder="请输入您的新昵称" />
  11. </view>
  12. <view class="bar">
  13. <text @click="showChangeName = false">取消</text>
  14. <text class="save" @click="changeName">保存</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="content">
  19. <view class="top-bg">
  20. <image :src="info.avatar" mode="widthFix"></image>
  21. </view>
  22. <view class="info">
  23. <image class="avatar" :src="info.avatar"></image>
  24. <view class="nickname">{{ info.nickname || '' }}</view>
  25. <view class="realname">
  26. <text class="left">真实姓名</text>
  27. <text class="right">{{ info.real_name || '' }}</text>
  28. </view>
  29. <view class="phone">
  30. <text class="left">联系方式</text>
  31. <text class="right">{{ info.mobile }}</text>
  32. </view>
  33. </view>
  34. <view class="level-info">
  35. <view class="level-items" :class="{ open: open }">
  36. <view class="level-item">
  37. <text class="left">客户类别</text>
  38. <text class="right">{{ info.level }}</text>
  39. </view>
  40. <view class="level-item">
  41. <text class="left">分享人</text>
  42. <text class="right">{{ info.recom_nickname }}</text>
  43. </view>
  44. <view class="level-item">
  45. <text class="left">上级批发商</text>
  46. <text class="right">{{ info.up_nickname || '' }}</text>
  47. </view>
  48. </view>
  49. <view class="level-lock basecolor" @tap="toogle">{{ open ? '收起' : '显示更多' }}</view>
  50. </view>
  51. <view class="team-info">
  52. <view v-if="this.title == '我的名片'" @tap="showChangeName = true">
  53. <text class="left">修改昵称</text>
  54. <text class="cuIcon-right"></text>
  55. </view>
  56. <!-- <view @click="toShareSet">
  57. <text class="left">分享设置</text>
  58. <text class="cuIcon-right"></text>
  59. </view> -->
  60. <view v-if="info.status == 0" @tap="toAuthCard">
  61. <text class="left">授权书</text>
  62. <text class="cuIcon-right"></text>
  63. </view>
  64. <view>
  65. <text class="left">团队人数</text>
  66. <text class="right">{{ info.team_num || '0' }}人</text>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- <view class="share_mobile_container">
  71. <view class="share_mobile_main">
  72. </view>
  73. </view> -->
  74. </view>
  75. </template>
  76. <script>
  77. import {
  78. _API_TeamPerData
  79. } from '@/apis/team.js'
  80. import {
  81. _API_Proxy_ChangeName
  82. } from '@/apis/user.js'
  83. export default {
  84. data() {
  85. return {
  86. title: '个人名片',
  87. info: {},
  88. open: false,
  89. id: '',
  90. showChangeName: false,
  91. oldName: this.$store.state.userinfo.nickname,
  92. newName: ''
  93. }
  94. },
  95. onLoad(opt) {
  96. if (opt.self) { // 如果是用户查看自己的命片
  97. this.title = '我的名片'
  98. }
  99. this.id = opt.id
  100. _API_TeamPerData({
  101. id: opt.id
  102. }).then(res => {
  103. this.info = res.data
  104. if (this.title !== '我的名片') {
  105. if (this.info.real_name) {
  106. this.info.real_name = this.info.real_name.replace(/./g, '*').replace(/^\*/, this.info
  107. .real_name[0])
  108. } else {
  109. this.info.real_name = '***'
  110. }
  111. }
  112. })
  113. },
  114. methods: {
  115. toShareSet() {
  116. uni.navigateTo({
  117. url: '../share-set/index'
  118. })
  119. },
  120. toogle() {
  121. this.open = !this.open
  122. },
  123. toAuthCard() {
  124. uni.navigateTo({
  125. url: `../auth-card/auth-card?id=${this.id}`
  126. })
  127. },
  128. changeName() {
  129. if (this.newName.trim()) {
  130. uni.loading()
  131. _API_Proxy_ChangeName({
  132. nickname: this.newName.trim()
  133. }).then(res => {
  134. this.info.nickname = this.newName.trim()
  135. uni.loading()
  136. uni.$emit('INIT')
  137. this.showChangeName = false
  138. this.newName = ''
  139. })
  140. } else {
  141. uni.toast('新昵称不能为空')
  142. }
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss">
  148. .share_mobile_container {
  149. position: fixed;
  150. top: 0;
  151. left: 0;
  152. right: 0;
  153. bottom: 0;
  154. z-index: 99;
  155. display: flex;
  156. align-items: center;
  157. justify-content: center;
  158. .share_mobile_main {}
  159. }
  160. .test {
  161. @include page();
  162. .change-name-wrapper {
  163. z-index: 1;
  164. width: 100vw;
  165. height: 100vh;
  166. @include flex();
  167. position: fixed;
  168. background: rgba(0, 0, 0, .3);
  169. .change-name {
  170. width: 540rpx;
  171. height: 400rpx;
  172. font-size: 32rpx;
  173. background: #FFFFFF;
  174. border-radius: 6rpx;
  175. @include flex(column);
  176. justify-content: space-between;
  177. .title {
  178. width: 100%;
  179. height: 90rpx;
  180. @include flex();
  181. }
  182. .oldName,
  183. .newName {
  184. width: 100%;
  185. @include flex();
  186. justify-content: flex-start;
  187. margin-left: 41rpx;
  188. input {
  189. width: 335rpx;
  190. height: 54rpx;
  191. border: 1rpx solid #AAAAAA;
  192. box-sizing: border-box;
  193. padding: 0 8rpx;
  194. font-size: 28rpx;
  195. }
  196. }
  197. .bar {
  198. width: 100%;
  199. height: 76rpx;
  200. @include flex();
  201. color: #666666;
  202. border-top: 1rpx solid #F2F4F5;
  203. text {
  204. flex: 1;
  205. height: 100%;
  206. @include flex();
  207. &.save {
  208. color: $app-base-color;
  209. border-left: 1rpx solid #F2F4F5;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. .content {
  216. .top-bg {
  217. height: 300rpx;
  218. overflow: hidden;
  219. filter: blur(8rpx);
  220. image {
  221. width: 100%;
  222. transform: translateY(-25%);
  223. }
  224. }
  225. .info {
  226. @include flex(column);
  227. height: 270rpx;
  228. font-size: 26rpx;
  229. position: relative;
  230. background: #FFFFFF;
  231. justify-content: flex-end;
  232. border-bottom: 1rpx solid $app-base-bg;
  233. .avatar {
  234. top: 0;
  235. left: 50%;
  236. width: 108rpx;
  237. height: 108rpx;
  238. position: absolute;
  239. border-radius: 8rpx;
  240. transform: translate(-50%, -50%);
  241. }
  242. >view {
  243. @include flex();
  244. width: 100%;
  245. padding: 0 30rpx;
  246. line-height: 72rpx;
  247. box-sizing: border-box;
  248. justify-content: flex-start;
  249. &.nickname {
  250. margin-bottom: 12rpx;
  251. justify-content: center;
  252. }
  253. .left {
  254. width: 300rpx;
  255. }
  256. }
  257. }
  258. .level-info {
  259. background: #FFFFFF;
  260. margin-bottom: 20rpx;
  261. .level-items {
  262. height: 0;
  263. overflow: hidden;
  264. &.open {
  265. height: 270rpx;
  266. }
  267. >view {
  268. @include flex();
  269. width: 100%;
  270. height: 90rpx;
  271. padding: 0 30rpx;
  272. box-sizing: border-box;
  273. justify-content: flex-start;
  274. border-bottom: 1rpx solid $app-base-bg;
  275. .left {
  276. width: 300rpx;
  277. }
  278. }
  279. }
  280. .level-lock {
  281. @include flex();
  282. height: 60rpx;
  283. }
  284. }
  285. .team-info {
  286. >view {
  287. @include flex();
  288. width: 100%;
  289. height: 90rpx;
  290. padding: 0 30rpx;
  291. font-size: 32rpx;
  292. background: #FFFFFF;
  293. box-sizing: border-box;
  294. justify-content: space-between;
  295. border-bottom: 1rpx solid $app-base-bg;
  296. .left {
  297. width: 300rpx;
  298. }
  299. .right {
  300. display: flex;
  301. justify-content: center;
  302. align-items: center;
  303. }
  304. .eqcode_img {
  305. width: 40px;
  306. height: 40px;
  307. }
  308. }
  309. }
  310. }
  311. }
  312. </style>