loginFirst.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="name">给自己取个名字吧:</view>
  5. <view class="item">
  6. <input type="text" class="input" v-model="nickname" maxlength="10" placeholder="请输入2~10位昵称" />
  7. </view>
  8. <view class="name">请问你的性别是:</view>
  9. <view class="itemSex">
  10. <view class="sex2" :class="sex == 1?'active':''" style="margin-right: 10rpx;" @click="chkSex(1)">
  11. <image class="photo" src="../../static/me/sex_1.png" mode="widthFix" />
  12. <text>男性</text>
  13. </view>
  14. <view class="sex2" :class="sex == 2?'active':''" style="margin-left: 10rpx;" @click="chkSex(2)">
  15. <image class="photo" src="../../static/me/sex_2.png" mode="widthFix" />
  16. <text>女性</text>
  17. </view>
  18. </view>
  19. <view class="name">选一张图片作为您的头像:</view>
  20. <view class="bcenter">
  21. <block v-if="sex != 2">
  22. <view class="avator" :class="avator_str == 'a1.jpg'?'active':''" @click="selAvator('a1.jpg')">
  23. <image src="https://e.yujianmate.com/images/avator/a1.jpg" mode="widthFix" />
  24. </view>
  25. <view class="avator" :class="avator_str == 'a2.jpg'?'active':''" @click="selAvator('a2.jpg')">
  26. <image src="https://e.yujianmate.com/images/avator/a2.jpg" mode="widthFix" />
  27. </view>
  28. <view class="avator" :class="avator_str == 'a3.jpg'?'active':''" @click="selAvator('a3.jpg')">
  29. <image src="https://e.yujianmate.com/images/avator/a3.jpg" mode="widthFix" />
  30. </view>
  31. </block>
  32. <block v-if="sex != 1">
  33. <view class="avator" :class="avator_str == 'b1.jpg'?'active':''" @click="selAvator('b1.jpg')">
  34. <image src="https://e.yujianmate.com/images/avator/b1.jpg" mode="widthFix" />
  35. </view>
  36. <view class="avator" :class="avator_str == 'b2.jpg'?'active':''" @click="selAvator('b2.jpg')">
  37. <image src="https://e.yujianmate.com/images/avator/b2.jpg" mode="widthFix" />
  38. </view>
  39. <view class="avator" :class="avator_str == 'b3.jpg'?'active':''" @click="selAvator('b3.jpg')">
  40. <image src="https://e.yujianmate.com/images/avator/b3.jpg" mode="widthFix" />
  41. </view>
  42. </block>
  43. </view>
  44. <view class="blankHeight"></view>
  45. </view>
  46. <view class="btn_submit" @click="onFinish">下一步</view>
  47. <ToastW3 ref="ToastW3"></ToastW3>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. components: {},
  53. data() {
  54. return {
  55. title: '',
  56. step: 1,
  57. sel: 1,
  58. sex: 1,
  59. avator_str: '',
  60. sel_tags: [],
  61. nickname: '',
  62. myinfo: {},
  63. }
  64. },
  65. onLoad() {
  66. this.loadInfo();
  67. },
  68. onShow() {},
  69. methods: {
  70. onBack() {},
  71. chkSel() {
  72. if (this.sel == 1) {
  73. this.sel = 0;
  74. } else {
  75. this.sel = 1;
  76. }
  77. },
  78. chkSex(sex) {
  79. this.sex = sex;
  80. },
  81. selAvator(act) {
  82. this.avator_str = act;
  83. },
  84. bindChange: function(e) {
  85. const val = e.detail.value
  86. // this.XLvalue = this.xueli_list[val[0]]
  87. },
  88. loadInfo() {
  89. console.log({
  90. uuid: getApp().globalData.uuid,
  91. skey: getApp().globalData.skey
  92. });
  93. uni.request({
  94. url: this.$apiHost + '/Web/getinfo',
  95. data: {
  96. uuid: getApp().globalData.uuid,
  97. skey: getApp().globalData.skey
  98. },
  99. header: {
  100. "content-type": "application/json",
  101. 'sign': getApp().globalData.headerSign
  102. },
  103. success: (res) => {
  104. console.log("----:", res.data);
  105. this.myinfo = res.data;
  106. this.nickname = res.data.nickname;
  107. this.sex = res.data.sex_id;
  108. },
  109. complete: (com) => {
  110. // uni.hideLoading();
  111. },
  112. fail: (e) => {
  113. console.log("----e:", e);
  114. }
  115. });
  116. },
  117. onFinish() {
  118. let that = this;
  119. if (this.nickname.length < 2) {
  120. that.$refs['ToastW3'].showToast({
  121. title: "请给自己取个昵称",
  122. animation: 0
  123. });
  124. return;
  125. }
  126. uni.showLoading({
  127. mask: true,
  128. });
  129. uni.request({
  130. url: this.$apiHost + '/Web/editInfo', //仅为示例,并非真实接口地址。
  131. data: {
  132. uuid: getApp().globalData.uuid,
  133. nickname: this.nickname,
  134. sex: this.sex,
  135. avator_str: this.avator_str
  136. },
  137. header: {
  138. "content-type": "application/json",
  139. 'sign': getApp().globalData.headerSign
  140. },
  141. success: (res) => {
  142. console.log("----", res.data);
  143. if (res.data.success == "yes") {
  144. uni.navigateTo({
  145. url: '/pages/my/step'
  146. })
  147. // if (this.myinfo.nickname == "") {
  148. // uni.switchTab({
  149. // url: "/pages/index/index",
  150. // });
  151. // } else {
  152. // uni.switchTab({
  153. // url: "/pages/my/my",
  154. // });
  155. // }
  156. } else if (res.data.success == "no") {
  157. uni.showToast({
  158. title: res.data.str,
  159. icon: "none",
  160. });
  161. } else {
  162. uni.showToast({
  163. title: "操作失败,请联系客服",
  164. icon: "none",
  165. });
  166. }
  167. },
  168. complete: (com) => {
  169. uni.hideLoading();
  170. },
  171. });
  172. },
  173. }
  174. }
  175. </script>
  176. <style scoped lang="scss">
  177. @import 'loginFirst.scss';
  178. </style>