step3.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view>
  3. <u-navbar :background="background" :border-bottom="false"></u-navbar>
  4. <view class="jpLogin">
  5. <view class="jpLogin-title">
  6. <h2>我的择偶标准 <span>3</span>/4</h2>
  7. <p>完善择偶信息,能显著提升成功率哦~</p>
  8. </view>
  9. <view class="jpLogin-main">
  10. <u-form :model="form" ref="uForm">
  11. <view class="jpLogin-input">
  12. <u-form-item required="true">
  13. <u-input v-model="form.age_range" type="select" placeholder="Ta的年龄段范围" @click="ageChange"/>
  14. </u-form-item>
  15. </view>
  16. <view class="jpLogin-input">
  17. <u-form-item>
  18. <u-input v-model="form.education" type="select" placeholder="Ta的学历是" @click="show_education = true" >
  19. </u-input>
  20. <u-select v-model="show_education" mode="single-column" :list="education_ranges_by_names" @confirm="educationConfirm"></u-select>
  21. </u-form-item>
  22. </view>
  23. <view class="jpLogin-input">
  24. <u-form-item>
  25. <u-input v-model="form.salary_range" type="select" placeholder="Ta的收入范围" @click="show_salary = true"/>
  26. <u-select v-model="show_salary" mode="single-column" :list="salary_ranges_by_names" @confirm="salaryRangeConfirm"></u-select>
  27. </u-form-item>
  28. </view>
  29. <view class="jpLogin-input">
  30. <u-form-item>
  31. <u-input v-model="form.profession" placeholder="Ta的职业要求" />
  32. </u-form-item>
  33. </view>
  34. <view class="jpLogin-input">
  35. <u-form-item>
  36. <u-input v-model="form.work_address" type="select" placeholder="Ta的工作所在地" @click="workAddressChange"/>
  37. </u-form-item>
  38. </view>
  39. <view class="form-tit">
  40. 其他要求
  41. </view>
  42. <view class="jpLogin-textarea">
  43. <u-form-item>
  44. <u-input v-model="form.other" type="textarea" height="140" placeholder="" />
  45. </u-form-item>
  46. </view>
  47. </u-form>
  48. </view>
  49. <view style="margin-top: 60px;">
  50. <u-button type="error" shape="circle" :custom-style="customStyle" @click="next">下一步</u-button>
  51. <view class="step-btn" @click="previous">返回上一步</view>
  52. </view>
  53. </view>
  54. <mpvue-city-picker themeColor="#007AFF" ref="mpvueWorkCityPicker" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onWorkCityConfirm"></mpvue-city-picker>
  55. <mpvue-age-picker themeColor="#007AFF" ref="mpvueAgePicker" :pickerValueDefault="agePickerValueDefault" @onConfirm="onAgeConfirm"></mpvue-age-picker>
  56. </view>
  57. </template>
  58. <script>
  59. import mpvueCityPicker from "../../components/mpvue-citypicker/mpvueCityPicker.vue";
  60. import mpvueAgePicker from "../../components/mpvue-agepicker/mpvueAgePicker.vue"
  61. let _self;
  62. export default {
  63. components:{
  64. mpvueCityPicker,
  65. mpvueAgePicker
  66. },
  67. data() {
  68. return {
  69. personal_info:{},
  70. education_index:0,
  71. show_age_ranges:false,
  72. show_education:false,
  73. show_salary:false,
  74. show_work_address:false,
  75. form: {
  76. age_range:'',
  77. height_range:'',
  78. education:'',
  79. salary_range:'',
  80. profession:'',
  81. work_address:'',
  82. other:'',
  83. },
  84. age_ranges:[],
  85. height_ranges:[],
  86. education_ranges_by_names:[],
  87. education_ranges:['不限','高中中专及以下','大专','本科','双学士','硕士','博士'],
  88. salary_ranges_by_names:[],
  89. salary_ranges:['不限','2000元以下','2000-5000元','5000-10000元','10000-20000元','20000-50000元','50000元以上'],
  90. value: '0',
  91. customStyle: {
  92. background: '#FF5E5E'
  93. },
  94. background:{
  95. background: 'none'
  96. }
  97. }
  98. },
  99. methods:{
  100. get_options(){
  101. console.log('get options')
  102. // #ifdef APP-NVUE
  103. const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
  104. // #endif
  105. // #ifndef APP-NVUE
  106. const eventChannel = this.getOpenerEventChannel();
  107. // #endif
  108. eventChannel.on('acceptDataFromOpenerPage', function(data) {
  109. _self.personal_info = data;
  110. console.log('options'+JSON.stringify(data))
  111. });
  112. },
  113. bindPickerChange: function(e) {
  114. console.log('picker发送选择改变,携带值为:' + e.detail.value)
  115. //this.index = e.detail.value
  116. },
  117. previous(){
  118. uni.navigateBack({
  119. deta:1
  120. })
  121. },
  122. next(){
  123. _self.personal_info.step3= _self.form;
  124. uni.navigateTo({
  125. url:'./step4',
  126. success:function(res){
  127. res.eventChannel.emit('acceptDataFromOpenerPage', _self.personal_info);
  128. console.log('send options'+JSON.stringify(_self.personal_info));
  129. }
  130. })
  131. },
  132. salaryRangeConfirm(e){
  133. console.log('e'+JSON.stringify(e))
  134. this.form.salary_range = '';
  135. e.map((val, index) => {
  136. // this.result += this.result == '' ? val.label : '-' + val.label;
  137. let result = val.label
  138. this.form.salary_range += result;
  139. })
  140. },
  141. educationConfirm(e){
  142. console.log('e'+JSON.stringify(e))
  143. this.form.education = '';
  144. e.map((val, index) => {
  145. // this.result += this.result == '' ? val.label : '-' + val.label;
  146. let result = val.label
  147. this.form.education += result;
  148. })
  149. },
  150. onWorkCityConfirm(e) {
  151. _self.form.work_address = e.label;
  152. console.log('地址选择'+_self.work_address)
  153. },
  154. onAgeConfirm(e) {
  155. _self.form.age_range = e.label;
  156. console.log('地址选择'+_self.work_address)
  157. },
  158. workAddressChange(){
  159. this.$refs.mpvueWorkCityPicker.show()
  160. },
  161. ageChange(){
  162. this.$refs.mpvueAgePicker.show()
  163. },
  164. educationPickerShow(){
  165. //this.$refs.educationPicker.show();
  166. }
  167. },
  168. onLoad(){
  169. _self = this;
  170. for(let i = 18;i<=99;i++)
  171. {
  172. this.age_ranges.push(i);
  173. }
  174. for(let i = 130;i<=220;i++)
  175. {
  176. this.height_ranges.push(i);
  177. }
  178. for(let i = 0;i< _self.education_ranges.length;i++)
  179. {
  180. let education = {value:i, label:_self.education_ranges[i]};
  181. _self.education_ranges_by_names.push(education);
  182. }
  183. for(let i = 0;i< _self.salary_ranges.length;i++)
  184. {
  185. let salary_range = {value:i, label:_self.salary_ranges[i]};
  186. _self.salary_ranges_by_names.push(salary_range);
  187. }
  188. console.log('salary ranges'+JSON.stringify(_self.salary_ranges_by_names))
  189. _self.get_options();
  190. },
  191. onReady(){
  192. _self.get_options();
  193. },
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .form-tit{
  198. color: #999;
  199. margin-bottom: 8px;
  200. }
  201. .jpLogin-textarea{
  202. background: #fff;
  203. border-radius: 12px;
  204. border: 1px #EEDCDC solid;
  205. padding:0 15px;
  206. }
  207. .jpLogin {
  208. background: url(/static/img/loginBg.png) top center no-repeat;
  209. background-size: 100%;
  210. min-height: 100vh;
  211. padding: 50px;
  212. margin-top: -44px;
  213. }
  214. .step-btn {
  215. text-align: center;
  216. margin-top: 20px;
  217. color: #444953;
  218. }
  219. .jpLogin-title {
  220. h2 {
  221. font-size: 24px;
  222. font-weight: normal;
  223. }
  224. span {
  225. color: #FF5E5E;
  226. margin-left: 5px;
  227. }
  228. p {
  229. color: #777;
  230. font-size: 14px;
  231. margin-top: 3px;
  232. }
  233. }
  234. .jpLogin-main {
  235. margin-top: 40px;
  236. }
  237. .jpLogin-input {
  238. height: 48px;
  239. background-color: #fff;
  240. border: 1px solid #EEDCDC;
  241. border-radius: 50px;
  242. display: flex;
  243. width: 100%;
  244. padding: 0 20px;
  245. margin-bottom: 20px;
  246. position: relative;
  247. .u-form-item {
  248. flex: 1;
  249. }
  250. .jpLogin-icon {
  251. font-size: 20px;
  252. color: #FFC1C1;
  253. margin-right: 20px;
  254. position: relative;
  255. &:after {
  256. content: '';
  257. width: 1px;
  258. height: 16px;
  259. background-color: #E6D6D6;
  260. position: absolute;
  261. right: -10px;
  262. top: 15px;
  263. }
  264. }
  265. .jpLogin-warn {
  266. position: absolute;
  267. right: 20px;
  268. top: 14px;
  269. font-size: 20px;
  270. color: #FFC1C1;
  271. }
  272. }
  273. .jpLogin-link {
  274. display: flex;
  275. justify-content: space-between;
  276. align-items: center;
  277. font-size: 14px;
  278. .jpLogin-link-l {
  279. display: flex;
  280. align-items: center;
  281. p {
  282. color: #4f4646;
  283. }
  284. }
  285. span {
  286. color: #1677FF;
  287. }
  288. }
  289. .jpLogin-radio {
  290. margin-top: 16px;
  291. text-align: center;
  292. p {
  293. font-size: 14px;
  294. color: #a0a4b8;
  295. }
  296. span {
  297. color: #ff5e5e;
  298. font-size: 14px;
  299. }
  300. }
  301. </style>