userCenter.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <view class="page">
  3. <view class="flex-col section_1">
  4. <view class="justify-between align-center group" @tap="tapAvatar">
  5. <text class="text">头像</text>
  6. <view class="flex-row">
  7. <image
  8. :src="userInfo.avatar ? userInfo.avatar : '/static/temp/pro.png'"
  9. class="image_1"
  10. />
  11. <image
  12. src="/static/my_rarrow.png"
  13. class="image_2 image_3"
  14. />
  15. </view>
  16. </view>
  17. <view class="flex-col">
  18. <view class="justify-between align-center group" @tap="showNickPanel">
  19. <text class="text">昵称</text>
  20. <view class="flex-row">
  21. <text class="text_4 clamp">昵称昵称</text>
  22. <image
  23. src="/static/my_rarrow.png"
  24. class="image_2 image_3"
  25. />
  26. </view>
  27. </view>
  28. <view class="flex-col">
  29. <view class="justify-between align-center group">
  30. <text class="text">姓名</text>
  31. <view class="flex-row">
  32. <text class="text_4 clamp">姓名姓名姓名</text>
  33. <image
  34. src="/static/my_rarrow.png"
  35. class="image_2 image_3"
  36. />
  37. </view>
  38. </view>
  39. </view>
  40. <view class="flex-col">
  41. <view class="justify-between align-center group" @tap='tapSex'>
  42. <text class="text">姓别</text>
  43. <view class="flex-row">
  44. <text class="text_4 clamp">姓别</text>
  45. <image
  46. src="/static/my_rarrow.png"
  47. class="image_2 image_3"
  48. />
  49. </view>
  50. </view>
  51. </view>
  52. <view class="flex-col">
  53. <picker mode="date" @change="onDate" :end="curDate" >
  54. <view class="justify-between align-center group">
  55. <text class="text">生日</text>
  56. <view class="flex-row">
  57. <text class="text_4 clamp">1998-12-18</text>
  58. <image
  59. src="/static/my_rarrow.png"
  60. class="image_2 image_3"
  61. />
  62. </view>
  63. </view>
  64. </picker>
  65. </view>
  66. </view>
  67. </view>
  68. <popup ref="nickRef" :isStopMaskHide="true">
  69. <view class="flex-col section_3 nick-panel">
  70. <text class="text_14">修改昵称</text>
  71. <view class="flex-col group_14">
  72. <view class="flex-col">
  73. <view class="group_16 align-center">
  74. <text class="text_15">原昵称:</text>
  75. <text class=" text_16 clamp">{{panelOVal}}</text>
  76. </view>
  77. <view class="flex-col items-start text-wrapper">
  78. <input type="text" class="text_17" placeholder="请输入昵称" v-model="panelVal">
  79. <!-- <text class="text_17">支持2-16位中英文、数字</text> -->
  80. </view>
  81. </view>
  82. <view class="flex-row group_17">
  83. <view class="flex-col items-center text-wrapper_1" @tap="cancel"><text class="text_18">取消</text></view>
  84. <view class="flex-col items-center text-wrapper_2" @tap="confirm"><text class="text_19">确认更改</text></view>
  85. </view>
  86. </view>
  87. </view>
  88. </popup>
  89. <KXChoose ref="sexRef" @rundata="onSex" />
  90. </view>
  91. </template>
  92. <script>
  93. import KXChoose from '@/components/kx-choose.vue'
  94. export default {
  95. components:{
  96. KXChoose,
  97. },
  98. data() {
  99. return {
  100. nickname:'',
  101. panelType:'', //修改昵称nick,姓名name
  102. panelVal:'', //输入值
  103. panelOVal:'', //原值
  104. curDate:'',
  105. sexs:[{name:'男'},{name:'女'}]
  106. };
  107. },
  108. onLoad() {
  109. this.curDate= this.$tools.handleDate(new Date());
  110. },
  111. methods:{
  112. onDate(e){
  113. console.log('onDate--',e.detail.value)
  114. },
  115. tapSex(){
  116. this.$refs.sexRef.open(this.sexs);
  117. },
  118. onSex({item,items}){
  119. console.log('onSex---',item,items)
  120. },
  121. showNickPanel(){
  122. this.$refs.nickRef.show()
  123. },
  124. hideNickPanel(){
  125. this.$refs.nickRef.hide()
  126. },
  127. cancel(){
  128. this.hideNickPanel()
  129. },
  130. async confirm(){
  131. this.cancel();
  132. let pRes = await this.$request('user.profile',{nickname:this.nickname})
  133. this.$tools.msg(pRes.msg);
  134. this.nickname = '';
  135. this.$store.dispatch('user/getUserInfo')
  136. },
  137. async tapAvatar(){
  138. let res = await this.$tools.uploadImg();
  139. let pRes = await this.$request('user.profile',{avatar:res.fullurl})
  140. this.$tools.msg(pRes.msg);
  141. this.avatar = res.fullurl;
  142. this.$store.dispatch('user/getUserInfo')
  143. },
  144. tapLink(){
  145. if(!this.userInfo.bsnlink){
  146. this.$tools.msg('您的地址尚未生成')
  147. return;
  148. }
  149. this.navTo('/pages/mine/chainAddr')
  150. }
  151. }
  152. };
  153. </script>
  154. <style lang="scss">
  155. page{
  156. background-color: #fff;
  157. }
  158. .page{
  159. padding-top: 10rpx;
  160. }
  161. // . {
  162. // text-transform: uppercase;
  163. // }
  164. .section_1 {
  165. background-color: #ffffff;
  166. border-radius: 20rpx;
  167. width: 690rpx;
  168. margin: 0 auto;
  169. }
  170. .group {
  171. height: 108rpx;
  172. // padding: 30rpx 24rpx 30rpx 31rpx;
  173. border-bottom: solid 2rpx #0000000f;
  174. .text {
  175. margin: 10rpx 0;
  176. color: #333333;
  177. font-size: 30rpx;
  178. font-family: PingFang;
  179. }
  180. .image_1 {
  181. width: 70rpx;
  182. height: 70rpx;
  183. border-radius: 70rpx;
  184. }
  185. .text_4 {
  186. color: #999999;
  187. font-size: 30rpx;
  188. font-family: PingFang;
  189. // line-height: 29rpx;
  190. letter-spacing: 2.7rpx;
  191. max-width: 400rpx;
  192. }
  193. .image_2 {
  194. width: 8rpx;
  195. height: 15rpx;
  196. }
  197. .image_3 {
  198. margin-left: 10rpx;
  199. align-self: center;
  200. }
  201. }
  202. .section_3 {
  203. padding: 30rpx 37rpx 34rpx;
  204. background-color: #ffffff;
  205. border-radius: 20rpx;
  206. }
  207. .text_14 {
  208. align-self: center;
  209. color: #333333;
  210. font-size: 34rpx;
  211. font-family: PingFang;
  212. line-height: 32rpx;
  213. letter-spacing: 1.36rpx;
  214. }
  215. .group_14 {
  216. margin-top: 38rpx;
  217. }
  218. .group_17 {
  219. margin-top: 41rpx;
  220. padding: 0 20rpx;
  221. }
  222. .group_16 {
  223. align-self: center;
  224. line-height: 27rpx;
  225. }
  226. .text-wrapper {
  227. margin-top: 30rpx;
  228. // padding: 24rpx 0 23rpx;
  229. background-color: #f1f1f1;
  230. border-radius: 10rpx;
  231. width: 500rpx;
  232. .text_17 {
  233. // margin-left: 37rpx;
  234. padding: 0 37rpx;
  235. color: #333;
  236. font-size: 28rpx;
  237. font-family: PingFang;
  238. letter-spacing: 1.12rpx;
  239. height: 74rpx;
  240. line-height: 74rpx;
  241. width: 100%;
  242. }
  243. }
  244. .text-wrapper_1 {
  245. padding: 19rpx 0 18rpx;
  246. background-color: #ececec;
  247. border-radius: 10rpx;
  248. width: 194rpx;
  249. height: 64rpx;
  250. }
  251. .text-wrapper_2 {
  252. margin-left: 72rpx;
  253. padding: 19rpx 0 18rpx;
  254. background-color: #363636;
  255. border-radius: 10rpx;
  256. width: 194rpx;
  257. height: 64rpx;
  258. }
  259. .text_15 {
  260. color: #333333;
  261. font-size: 28rpx;
  262. font-family: PingFang;
  263. line-height: 27rpx;
  264. letter-spacing: 1.12rpx;
  265. }
  266. .text_16 {
  267. color: #333333;
  268. font-size: 28rpx;
  269. font-family: PingFang;
  270. line-height: 27rpx;
  271. letter-spacing: 2.52rpx;
  272. max-width: 360rpx;
  273. }
  274. .text_18 {
  275. color: #333333;
  276. font-size: 28rpx;
  277. font-family: PingFang;
  278. line-height: 27rpx;
  279. letter-spacing: 1.12rpx;
  280. text-align: center;
  281. }
  282. .text_19 {
  283. color: #ffffff;
  284. font-size: 28rpx;
  285. font-family: PingFang;
  286. line-height: 27rpx;
  287. letter-spacing: 1.12rpx;
  288. text-align: center;
  289. }
  290. </style>