registerVip.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view>
  3. <view class="u-flex u-row-between" style="height: 80rpx;background-color: #fff;position:fixed;top:0;width: 750rpx;line-height: 80rpx;padding: 0 30rpx;box-sizing: border-box;color: #666666;font-size: 26rpx;">
  4. <view class="u-flex" >
  5. <view class="u-flex" @click="showsex=true">
  6. 性别 <u-icon name="arrow-down-fill" size="10" color="#000"></u-icon>
  7. </view>
  8. <view class="u-flex" style="margin-left: 30rpx;" @click="showage=true">
  9. 年龄 <u-icon name="arrow-down-fill" size="10" color="#000"></u-icon>
  10. </view>
  11. </view>
  12. <view class="u-flex" @click="popup=true">
  13. 筛选 <u-icon name="hourglass" size="20" color="#000"></u-icon>
  14. </view>
  15. </view>
  16. <view class="u-flex u-row-between" style="flex-wrap: wrap;padding: 0 30rpx;">
  17. <view class="" style="background-color: #fff;width: 336rpx;margin:0 0 20rpx;border-radius: 40rpx;position: relative;" v-for="(item,index) in list" :key="index" @click="toinfo(item)">
  18. <view class="">
  19. <image :src="item.headimg" mode="" style="width: 336rpx;
  20. height: 336rpx;
  21. border-radius: 20rpx;"></image>
  22. </view>
  23. <view class="" style="font-size: 32rpx;padding: 20rpx;">
  24. {{item.nickname}} <image src="../../static/index/2@2x.png" mode="" style="width: 36rpx;height: 36rpx;margin:0 20rpx -6rpx" v-show="item.sex==1"></image> <image src="../../static/index/1@2x.png" mode="" style="width: 36rpx;height: 36rpx;margin:0 20rpx -6rpx" v-show="item.sex==2"></image>
  25. </view>
  26. <view class="u-flex u-row-between" style="font-size: 24rpx;padding: 20rpx;color: #888888;">
  27. <text>{{item.province_id?item.province_id+'·':''}}{{item.age?item.age+'·':''}}{{item.height?item.height:''}}</text>
  28. <image src="../../static/index/dazhaohu.png" mode="" style="width: 128rpx;height: 48rpx;vertical-align: middle;position: absolute;top: 24rpx;right: 16rpx;" @click.stop="tomessage(item)"></image>
  29. </view>
  30. </view>
  31. </view>
  32. <u-picker :show="showsex" :columns="sexcolumns" keyName="name" @confirm='changesex' @cancel='showsex=false' :closeOnClickOverlay='true'>
  33. </u-picker>
  34. <u-picker :show="showage" @cancel='showage=false' title="年龄" ref="uPicker" :columns="columns" @confirm="confirm" @change="changeage">
  35. </u-picker>
  36. <u-popup :show="popup" :round="10" mode="bottom" :closeable='true' @close="popup=false" @open="open">
  37. <view style="width: 750rpx;padding: 30rpx;box-sizing: border-box;">
  38. <view class="" style="font-size: 32rpx;color: #000;font-weight: 600;margin: 20rpx 0;">
  39. 工作性质<text style="font-size: 22rpx;color: #888888;font-weight: 400;">/多选</text>
  40. </view>
  41. <view class="u-flex" style="flex-wrap: wrap;">
  42. <view class="item" :class="{'select':item.isSelect}" v-for="(item,index) in workList" @click="workClick(item)" :key="index">
  43. {{item.name}}
  44. </view>
  45. </view>
  46. <view class="" style="font-size: 32rpx;color: #000;font-weight: 600;margin: 20rpx 0;">
  47. 学历<text style="font-size: 22rpx;color: #888888;font-weight: 400;">/多选</text>
  48. </view>
  49. <view class="u-flex" style="flex-wrap: wrap;">
  50. <view class="item1" :class="{'select':item.isSelect}" v-for="(item,index) in educationList" @click="educationClick(item)" :key="index">
  51. {{item.name}}
  52. </view>
  53. </view>
  54. <view class="u-flex u-row-between" style="margin: 60rpx auto 0;width: 690rpx;">
  55. <view class="" style="width: 250rpx;
  56. height: 84rpx;
  57. background: #F6F3FD;
  58. border-radius: 50rpx;line-height: 84rpx;text-align: center;color: #777777;
  59. font-size: 36rpx;box-sizing: border-box;" @click="reset">
  60. <text style="background: linear-gradient(270deg, #A890FE 0%, #FFAEAE 100%);
  61. -webkit-background-clip: text;
  62. -webkit-text-fill-color: transparent;">重置</text>
  63. </view>
  64. <view class="" style="width: 410rpx;
  65. height: 84rpx;
  66. background: linear-gradient(270deg, #A890FE 0%, #FFAEAE 100%);
  67. border-radius: 42rpx;font-size: 36rpx;color: #fff;line-height: 84rpx;text-align: center;" @click="submit">
  68. 确定
  69. </view>
  70. </view>
  71. </view>
  72. </u-popup>
  73. <Showtoast @canceltoast='canceltoast' :showtoast='showtoast' />
  74. </view>
  75. </template>
  76. <script>
  77. import Showtoast from'../../components/Showtoast.vue'
  78. export default {
  79. components:{
  80. Showtoast
  81. },
  82. onLoad() {
  83. var list=this.columns[0]
  84. var list1=this.columns[1]
  85. for( let i=1;i<66;i++){
  86. if(list[list.length-1]<65){
  87. list.push(list[0]+i)
  88. list1.push(list1[0]+i)
  89. }
  90. }
  91. this.getInfo()
  92. this.getList()
  93. this.getWork()
  94. },
  95. data() {
  96. return {
  97. showtoast:false,
  98. columns1:[],
  99. columns: [
  100. [18],
  101. [18]
  102. ],
  103. sexcolumns: [
  104. ['男','女']
  105. ],
  106. showsex:false,
  107. showage:false,
  108. list:[],
  109. page:1,
  110. info:{},
  111. sex:'',
  112. age:[],
  113. popup:false,
  114. workList:[],
  115. educationList:[{name:'高中',isSelect:false},{name:'大专',isSelect:false},{name:'本科',isSelect:false},{name:'研究生',isSelect:false},{name:'博士',isSelect:false}],
  116. work:[],
  117. education:[]
  118. }
  119. },
  120. onReachBottom() {
  121. this.page++
  122. this.getList()
  123. },
  124. methods: {
  125. canceltoast(){
  126. this.showtoast=false
  127. },
  128. submit(){
  129. var arr=this.educationList.filter(item=>{
  130. return item.isSelect==true
  131. })
  132. var arr1=this.workList.filter(item=>{
  133. return item.isSelect==true
  134. })
  135. if(arr.length!=0){
  136. this.educationList.forEach(item=>{
  137. if(item.isSelect){
  138. this.education.push(item.name)
  139. }
  140. })
  141. }else{
  142. this.education=[]
  143. }
  144. if(arr.length!=0){
  145. this.workList.forEach(item=>{
  146. if(item.isSelect){
  147. this.work.push(item.id)
  148. }
  149. })
  150. }else{
  151. this.work=[]
  152. }
  153. this.page=1
  154. this.getList()
  155. this.popup=false
  156. },
  157. reset(){
  158. this.workList.forEach(item=>{
  159. item.isSelect=false
  160. })
  161. this.educationList.forEach(item=>{
  162. item.isSelect=false
  163. })
  164. },
  165. educationClick(item){
  166. item.isSelect=!item.isSelect
  167. },
  168. workClick(item){
  169. item.isSelect=!item.isSelect
  170. },
  171. getWork(){
  172. uni.$u.http.post('/api/index/WorkNature').then(res => {
  173. res.data.forEach(item=>{
  174. item.isSelect=false
  175. })
  176. this.workList=res.data
  177. })
  178. },
  179. confirm(e){
  180. this.age=e.value
  181. this.page=1
  182. this.getList()
  183. this.showage=false
  184. },
  185. changeage(e) {
  186. console.log(11,e)
  187. const {
  188. columnIndex,
  189. value,
  190. values, // values为当前变化列的数组内容
  191. index,
  192. // 微信小程序无法将picker实例传出来,只能通过ref操作
  193. picker = this.$refs.uPicker
  194. } = e
  195. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  196. if (columnIndex === 0) {
  197. this.columns[1]=[...this.columns[0]]
  198. console.log(123,this.columns[1])
  199. // picker为选择器this实例,变化第二列对应的选项
  200. // picker.setColumnValues(1, this.columnData[index])
  201. this.columns[1].splice(0,index)
  202. this.$set(this.columns,1,this.columns[1])
  203. console.log(456,this.columns[1])
  204. }
  205. },
  206. changesex(e){
  207. this.sex=e.indexs[0]*1+1
  208. this.showsex=false
  209. this.page=1
  210. this.getList()
  211. },
  212. getInfo(){
  213. uni.$u.http.post('/api/user/userinfo').then(res => {
  214. if(res.code==1){
  215. this.info=res.data
  216. }
  217. })
  218. },
  219. tomessage(item){
  220. if(this.info.vip_level==0){
  221. this.showtoast=true
  222. return
  223. }
  224. if(this.info.vip_level==2){
  225. this.$u.toast('经用户反馈,您账户存在违规行为,暂不支持使用该功能')
  226. return
  227. }
  228. if(this.info.vip_level==3){
  229. this.$u.toast('您的账户已注销,暂不支持使用该功能')
  230. return
  231. }
  232. uni.navigateTo({
  233. url:'./message?otherid='+item.im_id
  234. })
  235. },
  236. toinfo(item){
  237. if(this.info.vip_level==0){
  238. this.showtoast=true
  239. return
  240. }
  241. if(this.info.vip_level==2){
  242. this.$u.toast('经用户反馈,您账户存在违规行为,暂不支持使用该功能')
  243. return
  244. }
  245. if(this.info.vip_level==3){
  246. this.$u.toast('您的账户已注销,暂不支持使用该功能')
  247. return
  248. }
  249. uni.navigateTo({
  250. url:'../profile/otherPage?id='+item.id
  251. })
  252. },
  253. getList(){
  254. let data={
  255. page:this.page,
  256. age_min:this.age.length==0?'':this.age[0],
  257. age_max:this.age.length==0?'':this.age[1],
  258. nature:this.work.length==0?'':this.work.toString(),
  259. education:this.education.length==0?'':this.education.toString(),
  260. sex:this.sex
  261. }
  262. uni.$u.http.post('/api/Index/registered_user',data).then(res => {
  263. if(this.page==1){
  264. this.list=res.data
  265. }else{
  266. this.list=[...this.list,...res.data]
  267. }
  268. })
  269. },
  270. }
  271. }
  272. </script>
  273. <style lang="scss">
  274. .item{
  275. width: 220rpx;
  276. height: 72rpx;
  277. line-height: 72rpx;
  278. text-align: center;
  279. background: #F0F0F0;
  280. border-radius: 8rpx;
  281. font-size: 28rpx;
  282. color: #777777;
  283. margin-bottom: 20rpx;
  284. }
  285. .item:nth-child(3n-1){
  286. margin: 0 15rpx 20rpx;
  287. }
  288. .item1{
  289. width: 220rpx;
  290. height: 72rpx;
  291. line-height: 72rpx;
  292. text-align: center;
  293. background: #F0F0F0;
  294. border-radius: 8rpx;
  295. font-size: 28rpx;
  296. color: #777777;
  297. margin-bottom: 20rpx;
  298. }
  299. .item1:nth-child(3n-1){
  300. margin: 0 15rpx 20rpx;
  301. }
  302. .select{
  303. background: #F6F3FD;
  304. color: #CEACEA;
  305. }
  306. page{
  307. padding: 100rpx 0;
  308. background-color: #F6F2FD;
  309. }
  310. </style>