兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

187 lines
3.9 KiB

  1. <template>
  2. <view class="home-pages">
  3. <u-swiper
  4. :list="swpList"
  5. keyName="image"
  6. indicator
  7. height="150"
  8. indicatorActiveColor="#FFFFFF"
  9. indicatorMode="dot"
  10. circular
  11. ></u-swiper>
  12. <view style="color: #707070;
  13. font-size: 28rpx;">
  14. </view>
  15. <view class="home-content">
  16. <u-tabs
  17. :list="tabList"
  18. lineWidth="70"
  19. lineHeight="3"
  20. lineColor= "#00CCCC"
  21. :activeStyle="{
  22. color: '#000000',
  23. fontWeight: 'bold',
  24. transform: 'scale(1.35)'
  25. }"
  26. :inactiveStyle="{
  27. color: '#000000',
  28. transform: 'scale(1)'
  29. }"
  30. itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
  31. @click="tabClick"
  32. >
  33. </u-tabs>
  34. <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  35. <template >
  36. <new-card v-for="(item,i) in houseList" :key="i" :item="item" @seeDetail="newDetail"></new-card>
  37. </template>
  38. </scroll-view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import newCard from '@/components/new-card/index.vue'
  44. export default{
  45. components:{
  46. newCard
  47. },
  48. data(){
  49. return{
  50. current:0,
  51. swpList:[],
  52. tabList: [],
  53. houseList:[],
  54. params:{
  55. classId:'1616491855729131521',//默认未岳麓区租房信息
  56. pageNo:1,
  57. pageSize:10,
  58. total: null,
  59. isLock: true
  60. },
  61. }
  62. },
  63. onLoad() {
  64. this.getbannerList();
  65. this.getHouseClassList();
  66. this.getHouseList();
  67. },
  68. // 隐藏微信h5的标题栏
  69. onReady() {
  70. this.$com.displayNav()
  71. },
  72. methods:{
  73. onPullDownRefresh() {
  74. // TODO: 下拉刷新的回调函数
  75. this.houseList=[];
  76. this.getHouseList();
  77. uni.stopPullDownRefresh();
  78. },
  79. //获取租房信息
  80. getbannerList(){
  81. this.$api('bannerList',{state:'2'})
  82. .then(res=>{
  83. if(res.code == 200){
  84. this.swpList = res.result
  85. }
  86. })
  87. },
  88. //获取分类列表信息
  89. getHouseClassList(){
  90. this.$api('getHouseClassList',{state:"0"})
  91. .then(res=>{
  92. if(res.code == 200){
  93. this.tabList = res.result
  94. }
  95. })
  96. },
  97. //获取
  98. getHouseList(){
  99. uni.showLoading()
  100. this.$api('getHouseList',this.params)
  101. .then(res=>{
  102. uni.hideLoading()
  103. if(res.code == 200){
  104. if(this.params.total== null) {
  105. this.params.total = res.result.total
  106. }
  107. if(this.params.pageNo>1){
  108. uni.hideLoading();
  109. }
  110. this.houseList = this.houseList.concat(res.result.records);
  111. this.params.isLock = true;
  112. }else {
  113. if(this.params.pageNo>1){
  114. uni.hideLoading();
  115. }
  116. this.params.isLock = true;
  117. }
  118. })
  119. },
  120. //点击切换
  121. tabClick(e){
  122. this.params.classId=e.id;
  123. this.houseList=[];
  124. this.current = e.index;
  125. this.params.pageNo = 1;
  126. this.getHouseList()
  127. },
  128. //查看详情
  129. newDetail(item){
  130. this.$api('myInfo')
  131. .then(res=>{
  132. if(res.code == 200){
  133. this.role = res.result.role;
  134. this.userInfo = res.result;
  135. this.$store.commit('set_userInfo',res.result)
  136. //如果不是会员请开通会员
  137. if(this.userInfo.isPay == 1){
  138. uni.navigateTo({
  139. url:`/pages/home/new-detail?id=${item.id}`
  140. })
  141. }else{
  142. this.$Toast("开通会员即可查看")
  143. //跳转到实名认证页面进行实名认证
  144. setTimeout(()=>{ //设置延迟执行
  145. uni.navigateTo({
  146. url:'/pages/my/list-renzhen'
  147. })
  148. },2000);
  149. }
  150. }else{
  151. this.$Toast('请先登录!')
  152. setTimeout(()=>{
  153. uni.navigateTo({
  154. url:'/pages/my/login-kehu'
  155. })
  156. },1000)
  157. return
  158. this.userInfo = null
  159. }
  160. })
  161. },
  162. lower(){
  163. if(this.params.pageNo >= this.pages) return;
  164. this.params.pageNo ++;
  165. this.getHouseList()
  166. },
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .home-pages {
  172. padding: 18rpx 29rpx 0;
  173. background-color: #F7F7F7;
  174. .scroll-Y {
  175. height: calc(100vh - 210rpx);
  176. padding-top: 20rpx;
  177. }
  178. }
  179. </style>