personal-data.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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">注销账户</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. editNameTap() {
  109. uni.navigateTo({
  110. url: "/pages/my/edit-name"
  111. });
  112. },
  113. sexPickerChange(e) {
  114. this.sexIndex = e.detail.value;
  115. },
  116. datePickerChange(e) {
  117. this.dateValue = e.detail.value;
  118. },
  119. synopsisTap() {
  120. uni.navigateTo({
  121. url: "/pages/my/edit-synopsis"
  122. });
  123. },
  124. addressTap() {
  125. uni.navigateTo({
  126. url: "/pages/my/address"
  127. });
  128. },
  129. editPhoneTap() {
  130. uni.navigateTo({
  131. url: "/pages/my/edit-phone"
  132. });
  133. },
  134. editContactCardsTap() {
  135. uni.navigateTo({
  136. url: "/pages/my/contact-cards"
  137. });
  138. },
  139. regionTap() {
  140. uni.navigateTo({
  141. url: "/pages/my/region"
  142. });
  143. },
  144. updateAvatar(e) {
  145. uni.chooseImage({
  146. count: 1,
  147. success: (_res) => {
  148. _res.tempFilePaths.forEach((pic, index) => {
  149. this.upload({
  150. url: 'package/upload/?l=save.start',
  151. filePath: pic,
  152. name: 'file',
  153. formData: {
  154. key: 9,
  155. },
  156. success: res => {
  157. let data = JSON.parse(res.data);
  158. if(data.status == 1) {
  159. }else {
  160. uni.showToast({
  161. icon:'error',
  162. title:'上传失败'
  163. })
  164. }
  165. uni.hideLoading()
  166. },
  167. fail() {
  168. uni.showToast({
  169. icon:'error',
  170. title:'上传失败'
  171. })
  172. uni.hideLoading()
  173. }
  174. })
  175. })
  176. }
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. /* #ifdef APP-PLUS */
  184. @import "../../static/colorui/main.css";
  185. @import "../../static/colorui/icon.css";
  186. @import "../../static/zaiui/style/app.scss";
  187. /* #endif */
  188. .zaiui-head-box {
  189. position: relative;
  190. padding: 45.45upx 90.9upx;
  191. }
  192. .zaiui-btn-view {
  193. position: fixed;
  194. width: 100%;
  195. bottom: 0;
  196. .flex {
  197. padding: 18.18upx;
  198. }
  199. }
  200. </style>