personal_details.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="total-page page-box size-28 task-bg">
  3. <Nav :type="1" :genre="2" :title="title" :is_fixed="true">
  4. <view class="m-30 m-b20">
  5. <view class="row-justify-sb sys-background-fff center p-30 bor-bottom-1" @click="setUploading(true)"
  6. style="border-radius: 20rpx 20rpx 0 0;" hover-class="is-hovers">
  7. <text class="size-28 text-color-666">头像</text>
  8. <view class="row-c">
  9. <image class="wh-80 r-100 m-r10" :src="memberData.head_img" mode=""></image>
  10. <uni-icons type="forward" size="20" color="#999999"></uni-icons>
  11. </view>
  12. </view>
  13. <view class="row-justify-sb sys-background-fff bor-bottom-1 center p-30" hover-class="is-hover_pass"
  14. @click="onSetMessage(4,'修改昵称')">
  15. <text class="size-28 text-color-666">昵称</text>
  16. <view class="row-c line-34">
  17. <text class="text-color-12">{{memberData.nickname}}</text>
  18. <uni-icons type="forward" size="16" color="#999999"></uni-icons>
  19. </view>
  20. </view>
  21. <view class="row-justify-sb sys-background-fff bor-bottom-1 center p-30" hover-class="is-hover_pass"
  22. @click="onSetMessage(5,'修改姓名')">
  23. <text class="size-28 text-color-666">姓名</text>
  24. <view class="row-c line-34">
  25. <text class="text-color-12">{{memberData.name}}</text>
  26. <uni-icons type="forward" size="16" color="#999999"></uni-icons>
  27. </view>
  28. </view>
  29. <view class="row-justify-sb sys-background-fff center p-30" style="border-radius: 0 0 20rpx 20rpx;"
  30. hover-class="is-hover_pass" @click="onSetMessage(3,'修改手机号')">
  31. <text class="size-28 text-color-666">手机号</text>
  32. <view class="row-c line-34">
  33. <text class="text-color-12">{{memberData.phone}}</text>
  34. <uni-icons type="forward" size="16" color="#999999"></uni-icons>
  35. </view>
  36. </view>
  37. </view>
  38. <view class=" m-lr30 r-20">
  39. <view class="row-justify-sb sys-background-fff center p-30 r-20" hover-class="is-hover_pass"
  40. @click="onSetMessage(2,'修改密码')">
  41. <text class="size-28 text-color-666">密码</text>
  42. <view class="row-c line-34">
  43. <text class="text-color-12">去修改</text>
  44. <uni-icons type="forward" size="16" color="#999999"></uni-icons>
  45. </view>
  46. </view>
  47. </view>
  48. </Nav>
  49. <uni-popup ref="popup" type="bottom">
  50. <view class="popup-block">
  51. <view class="popup-row" @click="camera(1)">拍照</view>
  52. <view class="popup-row" @click="camera(2)">从手机里面选择</view>
  53. <view class="popup-row" @click="setUploading(false)">取消</view>
  54. </view>
  55. </uni-popup>
  56. </view>
  57. </template>
  58. <script>
  59. import EnInput from "@/components/en-from/en-input/index.vue";
  60. import {
  61. getMemberInfo,
  62. updateMemberInfo
  63. } from "@/api/user";
  64. import txUploadFile from "@/service/txOssSts";
  65. import tools from "@/service/tools";
  66. export default {
  67. components: {
  68. EnInput
  69. },
  70. data() {
  71. return {
  72. id: 0,
  73. title: '',
  74. phoneShake: false,
  75. memberData: {
  76. 'head_img': "",
  77. 'name': "",
  78. 'nickname': "",
  79. 'phone': "",
  80. 'position_name': "",
  81. }
  82. }
  83. },
  84. onLoad(options) {
  85. // this.id = options.id
  86. // this.title = options.title
  87. // this.getMemberInfo()
  88. // uni.$on('updateMemberInfo', () => {
  89. // this.getMemberInfo()
  90. // })
  91. },
  92. methods: {
  93. camera(sourceType) {
  94. console.log('chooseMedia接口调试-------------')
  95. uni.chooseMedia({
  96. mediaType: 'image',
  97. count: 1, //默认9
  98. sizeType: "compressed",
  99. sourceType: [sourceType === 1 ? 'camera' : 'album'],
  100. success: (res) => {
  101. console.log(res)
  102. if (res.tempFiles.length > 0) {
  103. txUploadFile(res.tempFiles[0].tempFilePath).then((data) => {
  104. if (!data) {
  105. tools.error('图片上传失败')
  106. } else {
  107. this.memberData.head_img = data.Location;
  108. updateMemberInfo({
  109. 'head_img': this.memberData.head_img
  110. }).then((res) => {
  111. if (res.code === 1) {
  112. uni.$emit('updateMemberInfo')
  113. } else {
  114. tools.error(res.msg)
  115. }
  116. })
  117. this.setUploading(false);
  118. }
  119. })
  120. } else {
  121. tools.error("请选择上传的图片")
  122. }
  123. },
  124. });
  125. },
  126. setUploading(showImg) {
  127. if (showImg) {
  128. this.$refs.popup.open("bottom");
  129. } else {
  130. this.$refs.popup.close();
  131. }
  132. },
  133. getMemberInfo() {
  134. getMemberInfo({
  135. 'type': 2
  136. }).then((res) => {
  137. if (res.code === 1) {
  138. this.memberData = res.data;
  139. }
  140. })
  141. },
  142. onSubmit() {
  143. this.phoneShake = true
  144. setTimeout(() => {
  145. this.phoneShake = false
  146. this.passwordShake = false
  147. this.codedShake = false
  148. }, 500)
  149. },
  150. getVerifiedCode() {},
  151. onSetMessage(id, name) {
  152. uni.navigateTo({
  153. url: `/page_subpack/system_setting/system_setting?id=${id}&title=${name}`
  154. })
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. @import "@/static/css/wh-common";
  161. .is-hovers {
  162. background-color: #e5e5e5e5;
  163. }
  164. .is-hover_pass {
  165. background-color: #e5e5e5e5;
  166. }
  167. .input-text {
  168. display: block;
  169. width: 120rpx;
  170. text-align: right;
  171. }
  172. .input-item {
  173. height: 96rpx;
  174. padding: 28rpx 40rpx;
  175. box-sizing: border-box;
  176. .login-input {
  177. width: 100%;
  178. }
  179. }
  180. .input-item:last-child {
  181. margin-top: 30rpx;
  182. }
  183. .input-send {
  184. display: flex;
  185. justify-content: flex-start;
  186. align-items: center;
  187. .login-input {
  188. width: calc(100% - 140rpx);
  189. }
  190. .login-send {
  191. width: 140rpx;
  192. text-align: center;
  193. }
  194. }
  195. .input-but {
  196. margin-top: 40rpx;
  197. width: 100%;
  198. height: 96rpx;
  199. line-height: 96rpx;
  200. text-align: center;
  201. }
  202. </style>