index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view class="register">
  3. <view class="content">
  4. <!-- 头部logo -->
  5. <view class="header">
  6. <image :src="fetch.avatar" @click="avatarSet(0)"></image>
  7. <avatar @upload="avatarUpload" ref="avatar"></avatar>
  8. </view>
  9. <!-- 主体 -->
  10. <view class="main">
  11. <wInput
  12. v-model="fetch.name"
  13. type="text"
  14. placeholder="昵称"
  15. ></wInput>
  16. <wInput
  17. v-model="fetch.info"
  18. type="text"
  19. placeholder="介绍"
  20. ></wInput>
  21. </view>
  22. <wButton
  23. class="wbutton"
  24. text="修改资料"
  25. :rotate="isRotate"
  26. @click.native="update()"
  27. ></wButton>
  28. <!-- 其他登录 -->
  29. <view class="other_login cuIcon">
  30. <view class="login_icon">
  31. <view class="cuIcon-weixin" @tap="bind_weixin"></view>
  32. </view>
  33. </view>
  34. <!-- 底部信息 -->
  35. <view class="footer">
  36. <navigator url="forget" open-type="navigate" @click="shiming">关系伙伴</navigator>
  37. <text>|</text>
  38. <navigator url="register" open-type="navigate" @click="tixian">快速提现</navigator>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import wInput from '@/lib/watch-login/watch-input.vue' //input
  45. import wButton from '@/lib/watch-login/watch-button.vue' //button
  46. import avatar from "@/lib/yq-avatar/yq-avatar.vue";
  47. export default {
  48. data() {
  49. return {
  50. fetch : {
  51. name : '',
  52. avatar : '',
  53. sex : 3,
  54. },
  55. isRotate: false, //是否加载旋转
  56. openAvatar : false
  57. }
  58. },
  59. components:{
  60. wInput,
  61. wButton,
  62. avatar
  63. },
  64. // 重新加载
  65. onPullDownRefresh: function() {
  66. this.getData();
  67. },
  68. onLoad() {
  69. this.Dever.checkLogin();
  70. this.getData();
  71. },
  72. methods: {
  73. getData : function() {
  74. this.Dever.get(this, 'app/user/?l=api.getBaseUser');
  75. },
  76. bind_weixin : function() {
  77. this.Dever.alert('暂未开通');
  78. },
  79. shiming : function() {
  80. this.Dever.alert('敬请期待');
  81. },
  82. tixian : function() {
  83. this.Dever.alert('敬请期待');
  84. },
  85. update : function() {
  86. if(this.isRotate){
  87. //判断是否加载中,避免重复点击请求
  88. return false;
  89. }
  90. if (!this.fetch.name) {
  91. this.Dever.alert('昵称不能为空');
  92. return false;
  93. }
  94. this.isRotate = true;
  95. var self = this;
  96. this.Dever.post('package/passport/?l=app.update', {noloading:1, username: this.fetch.name, info: this.fetch.info, gender: this.fetch.sex}, function(t) {
  97. self.isRotate = false;
  98. self.Dever.alert('已保存资料,仅影响未修改过信息的合小记');
  99. }, function(t) {
  100. self.Dever.alert(t.msg);
  101. self.isRotate = false;
  102. });
  103. },
  104. avatarUpload : function(e) {
  105. var self = this;
  106. this.openAvatar = false;
  107. this.Dever.uploadFile(e.path, 'avatar', 1, function(type, file) {
  108. self.fetch.avatar = file;
  109. self.Dever.post('package/passport/?l=app.update', {avatar:file, noloading:1});
  110. });
  111. },
  112. avatarSet : function(index) {
  113. this.openAvatar = true;
  114. this.$refs.avatar.fChooseImg(index,{
  115. selWidth: "300rpx", selHeight: "300rpx",
  116. expWidth: '260rpx', expHeight: '260rpx',
  117. avatarSrc : this.fetch.avatar,
  118. bgImage : this.fetch.avatar,
  119. noTab : true,
  120. });
  121. }
  122. }
  123. }
  124. </script>
  125. <style>
  126. @import url("@/lib/watch-login/css/icon.css");
  127. @import url("@/lib/watch-login/css/main.css");
  128. .other_agree {
  129. display: flex;
  130. flex-direction: row;
  131. justify-content: center;
  132. align-items: center;
  133. margin-top: 50rpx;
  134. text-align: center;
  135. }
  136. .other_login {
  137. margin-top: 80rpx;
  138. }
  139. </style>