step.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <block v-if="step == 1">
  5. <view class="name">请问你的性别是:</view>
  6. <view class="itemSex">
  7. <view class="sex2" :class="sex == 1?'active':''" style="margin-right: 10rpx;" @click="chkSex(1)">
  8. <image class="photo" src="../../static/me/sex_1.png" mode="widthFix" />
  9. <text>男性</text>
  10. </view>
  11. <view class="sex2" :class="sex == 2?'active':''" style="margin-left: 10rpx;" @click="chkSex(2)">
  12. <image class="photo" src="../../static/me/sex_2.png" mode="widthFix" />
  13. <text>女性</text>
  14. </view>
  15. </view>
  16. <view class="name">给自己取个名字吧:</view>
  17. <view class="item">
  18. <input type="text" class="input" placeholder="请输入昵称" maxlength="10"/>
  19. </view>
  20. <view class="name">你的微信号是:</view>
  21. <view class="item">
  22. <input type="text" class="input" placeholder="请输入微信号" maxlength="32"/>
  23. </view>
  24. <view class="name">选一张你的真实照片作为封面:</view>
  25. <view class="bcenter">
  26. <view class="avator">
  27. <image src="../../static/me/avator.png" mode="widthFix" />
  28. <image class="photo" src="../../static/me/photo.png" mode="widthFix" />
  29. </view>
  30. </view>
  31. </block>
  32. <block v-if="step == 2">
  33. <view class="name">给自己写一个个性签名:</view>
  34. <view class="item">
  35. <input type="text" class="input" placeholder="请输入个性签名" maxlength="64"/>
  36. </view>
  37. <view class="name">职业:</view>
  38. <view class="item">
  39. <input type="text" class="input" placeholder="请输入职业" maxlength="16"/>
  40. </view>
  41. <view class="name">年龄:</view>
  42. <view class="itemSingle">
  43. <slider class="slider" value="30" @change="sliderChange" activeColor="#FF2A95"
  44. background-color="#282828" block-color="#FF2A95" block-size="12" min="18" max="100"
  45. show-value />
  46. </view>
  47. <view class="name">身高(CM):</view>
  48. <view class="itemSingle">
  49. <slider class="slider" value="175" @change="sliderChange" activeColor="#FF2A95"
  50. background-color="#282828" block-color="#FF2A95" block-size="12" min="150" max="220"
  51. show-value />
  52. </view>
  53. <view class="name">体重(KG):</view>
  54. <view class="itemSingle">
  55. <slider class="slider" value="65" @change="sliderChange" activeColor="#FF2A95"
  56. background-color="#282828" block-color="#FF2A95" block-size="12" min="30" max="100"
  57. show-value />
  58. </view>
  59. </block>
  60. <block v-if="step == 3">
  61. <view class="name">学历:</view>
  62. <view class="itemXL">
  63. <picker-view indicator-class="selectLine" :value="XLvalue" @change="bindChange" class="picker-view"
  64. mask-style="background:none;">
  65. <picker-view-column>
  66. <view class="itemXll" v-for="(item,index) in xueli_list" :key="index">{{item}}</view>
  67. </picker-view-column>
  68. </picker-view>
  69. </view>
  70. <view class="name">您的星座是:</view>
  71. <view class="itemXL">
  72. <picker-view indicator-class="selectLine" :value="XZvalue" @change="bindChange" class="picker-view"
  73. mask-style="background:none;">
  74. <picker-view-column>
  75. <view class="itemXll" v-for="(item,index) in xz_list" :key="index">{{item}}</view>
  76. </picker-view-column>
  77. </picker-view>
  78. </view>
  79. </block>
  80. <block v-if="step == 4">
  81. <view class="name">你的兴趣爱好是?</view>
  82. <view class="desc">提示:最多选择10个兴趣爱好标签</view>
  83. <view class="item_tag">
  84. <view @click="chkTag(item)" class="tag" :class="selTags(item)?'active':''"
  85. v-for="(item,index) in list_tag">
  86. {{item}}
  87. </view>
  88. </view>
  89. </block>
  90. <view class="blankHeight"></view>
  91. </view>
  92. <view class="btn_submit" v-if="step == 1" @click="step ++;">下一步</view>
  93. <view class="btn_list" v-if="step == 2 || step == 3">
  94. <view class="btn_submit1" @click="step --;">上一步</view>
  95. <view class="btn_submit2" @click="step ++;">下一步</view>
  96. </view>
  97. <view class="btn_list" v-if="step == 4">
  98. <view class="btn_submit1" @click="step --;">上一步</view>
  99. <view class="btn_submit2">完成</view>
  100. </view>
  101. <!-- 提示框 -->
  102. <DialogBox ref="DialogBox"></DialogBox>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. components: {},
  108. data() {
  109. return {
  110. title: '',
  111. step: 1,
  112. sel: 1,
  113. sex: 1,
  114. xueli_list: [
  115. '小学', '初中', '高中', '大学', '硕士', '博士'
  116. ],
  117. XLvalue: [1],
  118. xz_list: [
  119. '水瓶座', '双鱼座', '白羊座', '金牛座', '双子座', '巨蟹座',
  120. '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座'
  121. ],
  122. XZvalue: [1],
  123. list_tag: [
  124. '篮球', '排球', '足球', '羽毛球', '健身达人', '美食达人'
  125. ],
  126. sel_tags: []
  127. }
  128. },
  129. onLoad() {
  130. // setTimeout(function() {
  131. // uni.setNavigationBarColor({
  132. // frontColor: '#ffffff',
  133. // backgroundColor: '#00000000',
  134. // animation: {
  135. // duration: 400,
  136. // timingFunc: 'easeIn'
  137. // }
  138. // })
  139. // }, 200);
  140. },
  141. onShow() {
  142. this.loadData();
  143. },
  144. methods: {
  145. onBack() {},
  146. chkSel() {
  147. if (this.sel == 1) {
  148. this.sel = 0;
  149. } else {
  150. this.sel = 1;
  151. }
  152. },
  153. chkSex(sex) {
  154. this.sex = sex;
  155. },
  156. bindChange: function(e) {
  157. const val = e.detail.value
  158. // this.XLvalue = this.xueli_list[val[0]]
  159. },
  160. selTags(itm) {
  161. let that = this;
  162. let isIn = false;
  163. for (let entry of this.sel_tags) {
  164. console.log(entry); // 1, "string", false
  165. if (entry == itm) {
  166. isIn = true;
  167. break;
  168. }
  169. }
  170. return isIn;
  171. },
  172. chkTag(itm) {
  173. if (this.selTags(itm)) {
  174. let tmpTags = [];
  175. for (let entry of this.sel_tags) {
  176. console.log(entry); // 1, "string", false
  177. if (entry != itm) {
  178. tmpTags.push(entry);
  179. }
  180. }
  181. this.sel_tags = tmpTags;
  182. } else {
  183. this.sel_tags.push(itm);
  184. }
  185. },
  186. loadData() {
  187. console.log("this.globalData", getApp().globalData);
  188. let obj2 = {
  189. is_first: 0
  190. }
  191. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  192. console.log(postData);
  193. uni.request({
  194. url: this.$apiHost + '/Gushi/getmyinfo', //仅为示例,并非真实接口地址。
  195. data: postData,
  196. method: 'POST',
  197. header: {
  198. 'content-type': 'application/json', //自定义请求头信息
  199. 'Access-Control-Allow-Origin': '*'
  200. },
  201. success: (res) => {
  202. console.log('data:', res.data);
  203. this.myinfo = res.data;
  204. }
  205. });
  206. },
  207. EditNickname() {
  208. let that = this;
  209. this.$refs['DialogBox'].confirm({
  210. title: '更改昵称',
  211. placeholder: '请输入修改的昵称',
  212. value: that.myinfo.nickname,
  213. DialogType: 'input',
  214. animation: 0
  215. }).then((res) => {
  216. if (res.value.length < 1) {
  217. uni.showToast({
  218. title: "请输入有效的昵称",
  219. icon: 'none'
  220. });
  221. return;
  222. }
  223. that.myinfo.nickname = res.value;
  224. let obj2 = {
  225. nickname: res.value
  226. }
  227. const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
  228. uni.request({
  229. url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
  230. data: postData,
  231. method: 'POST',
  232. header: {
  233. 'content-type': 'application/json', //自定义请求头信息
  234. 'Access-Control-Allow-Origin': '*'
  235. },
  236. success: (res) => {
  237. uni.showToast({
  238. title: res.data.str,
  239. icon: 'none'
  240. });
  241. }
  242. });
  243. })
  244. },
  245. }
  246. }
  247. </script>
  248. <style scoped lang="scss">
  249. @import 'normal.scss';
  250. </style>