mineEdit.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view>
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="editBox">
  5. <view class="edit_avatar">
  6. <view class="edit_title">
  7. <text>头像</text>
  8. </view>
  9. <view class="userAvatar">
  10. <image :src="userAvatar"></image>
  11. </view>
  12. </view>
  13. <view class="setName">
  14. <view class="edit_title">
  15. <text>昵称</text>
  16. </view>
  17. <view class="input_details">
  18. <view class="nickname">
  19. <input type="text" style=" text-align: right;" maxlength="10" placeholder="请输入一个昵称"
  20. placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="username" />
  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. <text>性别</text>
  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="http://43.139.158.220:5007/img/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. <text>学校</text>
  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="http://43.139.158.220:5007/img/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. <text>生日</text>
  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="http://43.139.158.220:5007/img/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. <text>兴趣标签</text>
  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="http://43.139.158.220:5007/img/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. <text>简介</text>
  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. userAvatar:'',
  124. username: '',
  125. selfdomintro: '',
  126. genderList: ['男', '女'],
  127. gender: '男',
  128. schoolList: ['xx学院', 'xx学院', 'xx学院'],
  129. school: 'xx学院',
  130. date: currentDate,
  131. hobbyList: ['篮球'],
  132. hobby: '篮球'
  133. };
  134. },
  135. computed: {
  136. startDate() {
  137. return this.getDate('start');
  138. },
  139. endDate() {
  140. return this.getDate('end');
  141. }
  142. },
  143. methods: {
  144. handelGender(e) {
  145. this.gender = this.genderList[e.detail.value]
  146. },
  147. handelSchool(e) {
  148. this.school = this.schoolList[e.detail.value]
  149. },
  150. handeHobby(e) {
  151. this.hobby = this.hobbyList[e.detail.value]
  152. },
  153. bindDateChange: function(e) {
  154. this.date = e.detail.value
  155. },
  156. getDate(type) {
  157. const date = new Date();
  158. let year = date.getFullYear();
  159. let month = date.getMonth() + 1;
  160. let day = date.getDate();
  161. if (type === 'start') {
  162. year = year - 60;
  163. } else if (type === 'end') {
  164. year = year + 2;
  165. }
  166. month = month > 9 ? month : '0' + month;
  167. day = day > 9 ? day : '0' + day;
  168. return `${year}-${month}-${day}`;
  169. },
  170. gotoLogin(){
  171. let user= {
  172. openid:'',
  173. avatar: "",
  174. desc: "",
  175. email: "",
  176. phone: "",
  177. sex: "",
  178. token: "",
  179. username: "暂无",
  180. __v: 0,
  181. _id: ""
  182. }
  183. this.$store.dispatch('asyncUpdateUser', user)
  184. uni.navigateTo({
  185. url:'/pages/login_Wechat/login_Wechat'
  186. })
  187. },
  188. },
  189. onShow() {
  190. console.log(this.$store.state);
  191. this.userAvatar=this.$store.state.user.avatar;
  192. this.username=this.$store.state.user.username;
  193. // this.isManage = this.$store.state.user.openid;
  194. // console.log(this.isManage == "");
  195. }
  196. }
  197. </script>
  198. <style lang="scss">
  199. .edit_title {
  200. display: flex;
  201. align-items: center;
  202. font-size: 32rpx;
  203. }
  204. .editBox {
  205. width: 100%;
  206. height: 840rpx;
  207. display: flex;
  208. flex-direction: column;
  209. background-color: #fff;
  210. border-top: 1px solid #E7E7E7;
  211. padding: 0 18px;
  212. .edit_avatar {
  213. height: 164rpx;
  214. display: flex;
  215. justify-content: space-between;
  216. .userAvatar {
  217. display: flex;
  218. align-items: center;
  219. image {
  220. width: 120rpx;
  221. height: 120rpx;
  222. }
  223. }
  224. }
  225. .setName {
  226. display: flex;
  227. justify-content: space-between;
  228. height: 92rpx;
  229. border-top: 1px solid #E7E7E7;
  230. .input_details {
  231. display: flex;
  232. align-items: center;
  233. flex-direction: row;
  234. .nickname {
  235. width: 350rpx;
  236. text-align: end;
  237. // padding-right: 10rpx;
  238. // margin-right: 10rpx;
  239. font-size: 28rpx;
  240. color: rgb(153, 153, 153);
  241. }
  242. }
  243. }
  244. .setPicker {
  245. height: 92rpx;
  246. border-top: 1px solid #E7E7E7;
  247. .content {
  248. height: 92rpx;
  249. display: flex;
  250. align-items: center;
  251. justify-content: space-between;
  252. .input_details {
  253. display: flex;
  254. align-items: center;
  255. .details {
  256. display: flex;
  257. flex-direction: row;
  258. .text {
  259. font-size: 28rpx;
  260. color: rgb(153, 153, 153);
  261. }
  262. }
  263. .arrow {
  264. display: flex;
  265. image {
  266. width: 32rpx;
  267. height: 32rpx;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. .setIntro {
  274. display: flex;
  275. flex-direction: column;
  276. justify-content: space-evenly;
  277. height: 216rpx;
  278. border-top: 1px solid #E7E7E7;
  279. .input_details {
  280. display: flex;
  281. align-items: center;
  282. .selfdomIntro {
  283. width: 100%;
  284. height: 88rpx;
  285. textarea{
  286. width: 100%;
  287. height: 88rpx;
  288. font-size: 28rpx;
  289. color: rgb(153, 153, 153);
  290. }
  291. }
  292. }
  293. }
  294. }
  295. .btnBox{
  296. position: absolute;
  297. margin: 0 85rpx;
  298. bottom: 40px;
  299. .btn{
  300. button{
  301. width: 580rpx;
  302. height: 88rpx;
  303. border: none;
  304. border-radius: 100rpx;
  305. border: 1px solid lightgray;
  306. font-size: 36rpx;
  307. display: flex;
  308. justify-content: center;
  309. align-items: center;
  310. color: #545454;
  311. text-align: center;
  312. &:first-child{
  313. background-color: rgb(0, 86, 168);
  314. color: white;
  315. margin-bottom: 24rpx;
  316. }
  317. &::after{
  318. border: none;
  319. }
  320. }
  321. }
  322. }
  323. </style>