mineEdit.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view>
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="editBox">
  5. <view class="edit_avatar">
  6. <view class="edit_title">
  7. <span>头像</span>
  8. </view>
  9. <view class="userAvatar">
  10. <image src="../../static/mine/Rectangle 1547.png" mode="aspectFill"></image>
  11. </view>
  12. </view>
  13. <view class="setName">
  14. <view class="edit_title">
  15. <span>昵称</span>
  16. </view>
  17. <view class="input_details">
  18. <view class="nickname">
  19. <input type="text" maxlength="10" placeholder="请输入一个昵称"
  20. placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="nickname" />
  21. </view>
  22. </view>
  23. </view>
  24. <view class="setPicker">
  25. <picker mode="selector" :range="genderList" @change="handelGender">
  26. <view class="content">
  27. <view class="edit_title">
  28. <span>性别</span>
  29. </view>
  30. <view class="input_details">
  31. <view class="details">
  32. <view class="uni-input text">{{gender}}</view>
  33. </view>
  34. <view class="arrow">
  35. <image src="../../static/mine/arrow-right_gray.png" mode="aspectFill"></image>
  36. </view>
  37. </view>
  38. </view>
  39. </picker>
  40. </view>
  41. <view class="setPicker">
  42. <picker mode="selector" :range="schoolList" @change="handelSchool">
  43. <view class="content">
  44. <view class="edit_title">
  45. <span>学校</span>
  46. </view>
  47. <view class="input_details">
  48. <view class="details">
  49. <view class="uni-input text">{{school}}</view>
  50. </view>
  51. <view class="arrow">
  52. <image src="../../static/mine/arrow-right_gray.png" mode="aspectFill"></image>
  53. </view>
  54. </view>
  55. </view>
  56. </picker>
  57. </view>
  58. <view class="setPicker">
  59. <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
  60. <view class="content">
  61. <view class="edit_title">
  62. <span>生日</span>
  63. </view>
  64. <view class="input_details">
  65. <view class="details">
  66. <view class="uni-input text">{{date}}</view>
  67. </view>
  68. <view class="arrow">
  69. <image src="../../static/mine/arrow-right_gray.png" mode="aspectFill"></image>
  70. </view>
  71. </view>
  72. </view>
  73. </picker>
  74. </view>
  75. <view class="setPicker">
  76. <picker mode="selector" :range="hobbyList" @change="handelHobby">
  77. <view class="content">
  78. <view class="edit_title">
  79. <span>兴趣标签</span>
  80. </view>
  81. <view class="input_details">
  82. <view class="details">
  83. <view class="uni-input text">{{hobby}}</view>
  84. </view>
  85. <view class="arrow">
  86. <image src="../../static/mine/arrow-right_gray.png" mode="aspectFill"></image>
  87. </view>
  88. </view>
  89. </view>
  90. </picker>
  91. </view>
  92. <view class="setIntro">
  93. <view class="edit_title">
  94. <span>简介</span>
  95. </view>
  96. <view class="input_details">
  97. <view class="selfdomIntro">
  98. <textarea type="text" placeholder="请输入你的个性签名" maxlength="75"
  99. placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="selfdomintro" />
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="btnBox">
  105. <view class="btn">
  106. <button>保存修改</button>
  107. <button @click="gotoLogin">退出登录</button>
  108. </view>
  109. </view>
  110. </view>
  111. </template>
  112. <script>
  113. export default {
  114. data() {
  115. const currentDate = this.getDate({
  116. format: true
  117. })
  118. return {
  119. navBarData: {
  120. title: '个人资料',
  121. btn: 1
  122. },
  123. nickname: '',
  124. selfdomintro: '',
  125. genderList: ['男', '女'],
  126. gender: '男',
  127. schoolList: ['xx学院', 'xx学院', 'xx学院'],
  128. school: 'xx学院',
  129. date: currentDate,
  130. hobbyList: ['篮球'],
  131. hobby: '篮球'
  132. };
  133. },
  134. computed: {
  135. startDate() {
  136. return this.getDate('start');
  137. },
  138. endDate() {
  139. return this.getDate('end');
  140. }
  141. },
  142. methods: {
  143. handelGender(e) {
  144. this.gender = this.genderList[e.detail.value]
  145. },
  146. handelSchool(e) {
  147. this.school = this.schoolList[e.detail.value]
  148. },
  149. handeHobby(e) {
  150. this.hobby = this.hobbyList[e.detail.value]
  151. },
  152. bindDateChange: function(e) {
  153. this.date = e.detail.value
  154. },
  155. getDate(type) {
  156. const date = new Date();
  157. let year = date.getFullYear();
  158. let month = date.getMonth() + 1;
  159. let day = date.getDate();
  160. if (type === 'start') {
  161. year = year - 60;
  162. } else if (type === 'end') {
  163. year = year + 2;
  164. }
  165. month = month > 9 ? month : '0' + month;
  166. day = day > 9 ? day : '0' + day;
  167. return `${year}-${month}-${day}`;
  168. },
  169. gotoLogin(){
  170. uni.navigateTo({
  171. url:'/pages/login/login'
  172. })
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss">
  178. .edit_title {
  179. display: flex;
  180. align-items: center;
  181. font-size: 32rpx;
  182. }
  183. .editBox {
  184. width: 100%;
  185. height: 840rpx;
  186. display: flex;
  187. flex-direction: column;
  188. background-color: #fff;
  189. border-top: 1px solid #E7E7E7;
  190. padding: 0 18px;
  191. .edit_avatar {
  192. height: 164rpx;
  193. display: flex;
  194. justify-content: space-between;
  195. .userAvatar {
  196. display: flex;
  197. align-items: center;
  198. image {
  199. width: 120rpx;
  200. height: 120rpx;
  201. }
  202. }
  203. }
  204. .setName {
  205. display: flex;
  206. justify-content: space-between;
  207. height: 92rpx;
  208. border-top: 1px solid #E7E7E7;
  209. .input_details {
  210. display: flex;
  211. align-items: center;
  212. flex-direction: row;
  213. .nickname {
  214. width: 100px;
  215. text-align: end;
  216. font-size: 28rpx;
  217. color: rgb(153, 153, 153);
  218. }
  219. }
  220. }
  221. .setPicker {
  222. height: 92rpx;
  223. border-top: 1px solid #E7E7E7;
  224. .content {
  225. height: 92rpx;
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. .input_details {
  230. display: flex;
  231. align-items: center;
  232. .details {
  233. display: flex;
  234. flex-direction: row;
  235. .text {
  236. font-size: 28rpx;
  237. color: rgb(153, 153, 153);
  238. }
  239. }
  240. .arrow {
  241. display: flex;
  242. image {
  243. width: 32rpx;
  244. height: 32rpx;
  245. }
  246. }
  247. }
  248. }
  249. }
  250. .setIntro {
  251. display: flex;
  252. flex-direction: column;
  253. justify-content: space-evenly;
  254. height: 216rpx;
  255. border-top: 1px solid #E7E7E7;
  256. .input_details {
  257. display: flex;
  258. align-items: center;
  259. .selfdomIntro {
  260. width: 100%;
  261. height: 88rpx;
  262. textarea{
  263. width: 100%;
  264. height: 88rpx;
  265. font-size: 28rpx;
  266. color: rgb(153, 153, 153);
  267. }
  268. }
  269. }
  270. }
  271. }
  272. .btnBox{
  273. position: absolute;
  274. margin: 0 85rpx;
  275. bottom: 40px;
  276. .btn{
  277. button{
  278. width: 580rpx;
  279. height: 88rpx;
  280. border: none;
  281. border-radius: 100rpx;
  282. border: 1px solid lightgray;
  283. font-size: 36rpx;
  284. color: #545454;
  285. text-align: center;
  286. &:first-child{
  287. background-color: rgb(0, 86, 168);
  288. color: white;
  289. margin-bottom: 24rpx;
  290. }
  291. &::after{
  292. border: none;
  293. }
  294. }
  295. }
  296. }
  297. </style>