personal_details.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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, updateMemberInfo
  62. } from "@/api/user";
  63. import txUploadFile from "@/service/txOssSts";
  64. import tools from "@/service/tools";
  65. export default {
  66. components: {
  67. EnInput
  68. },
  69. data() {
  70. return {
  71. id: 0,
  72. title: '',
  73. phoneShake: false,
  74. memberData: {
  75. 'head_img': "",
  76. 'name': "",
  77. 'nickname': "",
  78. 'phone': "",
  79. 'position_name': "",
  80. }
  81. }
  82. },
  83. onLoad(options) {
  84. this.id = options.id
  85. this.title = options.title
  86. this.getMemberInfo()
  87. uni.$on('updateMemberInfo', () => {
  88. this.getMemberInfo()
  89. })
  90. },
  91. methods: {
  92. camera(sourceType) {
  93. console.log('chooseMedia接口调试-------------')
  94. uni.chooseMedia({
  95. mediaType: 'image',
  96. count: 1, //默认9
  97. sizeType: "compressed",
  98. sourceType: [sourceType===1?'camera':'album'],
  99. success: (res) => {
  100. console.log(res)
  101. if(res.tempFiles.length>0){
  102. txUploadFile(res.tempFiles[0].tempFilePath).then(( data) => {
  103. if(!data){
  104. tools.error('图片上传失败')
  105. }else {
  106. this.memberData.head_img=data.Location;
  107. updateMemberInfo({'head_img':this.memberData.head_img}).then((res)=>{
  108. if(res.code===1){
  109. uni.$emit('updateMemberInfo')
  110. }else {
  111. tools.error(res.msg)
  112. }
  113. })
  114. this.setUploading(false);
  115. }
  116. })
  117. }else {
  118. tools.error("请选择上传的图片")
  119. }
  120. },
  121. });
  122. },
  123. setUploading(showImg){
  124. if(showImg){
  125. this.$refs.popup.open("bottom");
  126. }else {
  127. this.$refs.popup.close();
  128. }
  129. },
  130. getMemberInfo() {
  131. getMemberInfo({
  132. 'type': 2
  133. }).then((res) => {
  134. if (res.code === 1) {
  135. this.memberData = res.data;
  136. }
  137. })
  138. },
  139. onSubmit() {
  140. this.phoneShake = true
  141. setTimeout(() => {
  142. this.phoneShake = false
  143. this.passwordShake = false
  144. this.codedShake = false
  145. }, 500)
  146. },
  147. getVerifiedCode() {},
  148. onSetMessage(id, name) {
  149. uni.navigateTo({
  150. url: `/page_subpack/system_setting/system_setting?id=${id}&title=${name}`
  151. })
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. @import "@/static/css/wh-common";
  158. .is-hovers {
  159. background-color: #e5e5e5e5;
  160. }
  161. .is-hover_pass {
  162. background-color: #e5e5e5e5;
  163. }
  164. .input-text {
  165. display: block;
  166. width: 120rpx;
  167. text-align: right;
  168. }
  169. .input-item {
  170. height: 96rpx;
  171. padding: 28rpx 40rpx;
  172. box-sizing: border-box;
  173. .login-input {
  174. width: 100%;
  175. }
  176. }
  177. .input-item:last-child {
  178. margin-top: 30rpx;
  179. }
  180. .input-send {
  181. display: flex;
  182. justify-content: flex-start;
  183. align-items: center;
  184. .login-input {
  185. width: calc(100% - 140rpx);
  186. }
  187. .login-send {
  188. width: 140rpx;
  189. text-align: center;
  190. }
  191. }
  192. .input-but {
  193. margin-top: 40rpx;
  194. width: 100%;
  195. height: 96rpx;
  196. line-height: 96rpx;
  197. text-align: center;
  198. }
  199. </style>