personal-data.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view>
  3. <!--标题栏-->
  4. <bar-title bgColor="bg-white" isBack>
  5. <block slot="content">个人资料</block>
  6. </bar-title>
  7. <!-- <view class="bg-white solid-top zaiui-head-box">
  8. <view class="text-center margin-bottom-sm">
  9. <text class="text-black">完成</text>
  10. <text class="text-orange text-xxl">100%</text>
  11. <text class="text-black">,太棒啦!</text>
  12. </view>
  13. <progress class="zaiui-progress-radius" percent="100" active stroke-width="10" activeColor="#f37b1d"/>
  14. </view> -->
  15. <!--设置列表-->
  16. <view class="cu-list menu sm-border margin-top">
  17. <view class="cu-item arrow">
  18. <view class="content">头像</view>
  19. <view class="action">
  20. <view @click="updateAvatar" class="cu-avatar round sm" :style="[{backgroundImage:'url('+ avatar_img +')'}]"/>
  21. </view>
  22. </view>
  23. <view class="cu-item arrow" @tap="editNameTap">
  24. <view class="content">昵称</view>
  25. <view class="action">
  26. <text class="text-gray">{{userInfo.name}}</text>
  27. </view>
  28. </view>
  29. <!-- <view class="cu-item arrow">
  30. <view class="content">性别</view>
  31. <view class="action">
  32. <picker @change="sexPickerChange" :value="sexIndex" :range="sexPicker">
  33. <view class="picker text-gray">
  34. {{sexIndex>-1?sexPicker[sexIndex]:'男'}}
  35. </view>
  36. </picker>
  37. </view>
  38. </view>
  39. <view class="cu-item arrow">
  40. <view class="content">出生日期</view>
  41. <view class="action">
  42. <picker mode="date" :value="dateValue" start="1920-01-01" end="2020-05-01" @change="datePickerChange">
  43. <view class="picker text-gray">
  44. {{dateValue}}
  45. </view>
  46. </picker>
  47. </view>
  48. </view>
  49. <view class="cu-item arrow" @tap="synopsisTap">
  50. <view class="content">个人简介</view>
  51. <view class="action">
  52. <text class="text-gray">交个朋友</text>
  53. </view>
  54. </view> -->
  55. </view>
  56. <view class="cu-list menu sm-border margin-top">
  57. <view class="cu-item arrow" @tap="editPhoneTap">
  58. <view class="content">手机号</view>
  59. <view class="action">
  60. <text class="text-gray">{{userInfo.phone}}</text>
  61. </view>
  62. </view>
  63. <!-- <view class="cu-item arrow" @tap="regionTap">
  64. <view class="content">地区</view>
  65. <view class="action">
  66. <text class="text-gray">太阳</text>
  67. </view>
  68. </view> -->
  69. <view class="cu-item arrow" @tap="addressTap">
  70. <view class="content">收货地址</view>
  71. </view>
  72. <!-- <view class="cu-item arrow" @tap="editContactCardsTap">
  73. <view class="content">联系卡</view>
  74. </view> -->
  75. </view>
  76. <view class="cu-list menu sm-border margin-top">
  77. <view class="cu-item arrow">
  78. <view class="content" @click="logout">退出登录</view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import barTitle from '@/components/zaiui-common/basics/bar-title';
  85. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  86. export default {
  87. components: {
  88. barTitle
  89. },
  90. data() {
  91. return {
  92. avatar_img: '/static/images/avatar/1.jpg', sexIndex: 0, sexPicker: ['男', '女'], dateValue: '1945-10-01',
  93. }
  94. },
  95. onLoad() {
  96. if(!this.userInfo.id) {
  97. this.loadUserInfo()
  98. }
  99. },
  100. onReady() {
  101. _tool.setBarColor(true);
  102. uni.pageScrollTo({
  103. scrollTop: 0,
  104. duration: 0
  105. });
  106. },
  107. methods: {
  108. logout() {
  109. uni.removeStorageSync('baseToken')
  110. this.setUserInfo({})
  111. uni.reLaunch({
  112. url: '/pages/app/index'
  113. })
  114. },
  115. editNameTap() {
  116. uni.navigateTo({
  117. url: "/pages/my/edit-name"
  118. });
  119. },
  120. sexPickerChange(e) {
  121. this.sexIndex = e.detail.value;
  122. },
  123. datePickerChange(e) {
  124. this.dateValue = e.detail.value;
  125. },
  126. synopsisTap() {
  127. uni.navigateTo({
  128. url: "/pages/my/edit-synopsis"
  129. });
  130. },
  131. addressTap() {
  132. uni.navigateTo({
  133. url: "/pages/my/address"
  134. });
  135. },
  136. editPhoneTap() {
  137. uni.navigateTo({
  138. url: "/pages/my/edit-phone"
  139. });
  140. },
  141. editContactCardsTap() {
  142. uni.navigateTo({
  143. url: "/pages/my/contact-cards"
  144. });
  145. },
  146. regionTap() {
  147. uni.navigateTo({
  148. url: "/pages/my/region"
  149. });
  150. },
  151. updateAvatar(e) {
  152. uni.chooseImage({
  153. count: 1,
  154. success: (_res) => {
  155. _res.tempFilePaths.forEach((pic, index) => {
  156. this.upload({
  157. url: 'package/upload/?l=save.start',
  158. filePath: pic,
  159. name: 'file',
  160. formData: {
  161. key: 9,
  162. },
  163. success: res => {
  164. let data = JSON.parse(res.data);
  165. if(data.status == 1) {
  166. }else {
  167. uni.showToast({
  168. icon:'error',
  169. title:'上传失败'
  170. })
  171. }
  172. uni.hideLoading()
  173. },
  174. fail() {
  175. uni.showToast({
  176. icon:'error',
  177. title:'上传失败'
  178. })
  179. uni.hideLoading()
  180. }
  181. })
  182. })
  183. }
  184. })
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss">
  190. /* #ifdef APP-PLUS */
  191. @import "../../static/colorui/main.css";
  192. @import "../../static/colorui/icon.css";
  193. @import "../../static/zaiui/style/app.scss";
  194. /* #endif */
  195. .zaiui-head-box {
  196. position: relative;
  197. padding: 45.45upx 90.9upx;
  198. }
  199. .zaiui-btn-view {
  200. position: fixed;
  201. width: 100%;
  202. bottom: 0;
  203. .flex {
  204. padding: 18.18upx;
  205. }
  206. }
  207. </style>