兼兼街公众号代码
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.

322 lines
7.0 KiB

2 years ago
2 years ago
  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 v-if="current == 0">
  36. <active-card v-for="(item,i) in jobList" :item="item" :key="i" :i="i" @seeDetail="seeDetail"></active-card>
  37. </template>
  38. <template v-if="current == 1">
  39. <new-card v-for="(item,i) in houseList" :key="i" :item="item" @seeDetail="newDetail"></new-card>
  40. </template>
  41. <template v-if="current == 2">
  42. <shopCard v-for="(item,i) in shopList" :key="i" :item="item" @seeDetail="jianHuaNewDetail"></shopCard>
  43. </template>
  44. </scroll-view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import newCard from '@/components/new-card/index.vue'
  50. import activeCard from '@/components/active-card/index.vue'
  51. import shopCard from '@/components/jianghua-card/shop-card.vue'
  52. export default{
  53. components:{
  54. activeCard,
  55. newCard,
  56. shopCard
  57. },
  58. data(){
  59. return{
  60. current:0,
  61. swpList:[],
  62. tabList: [
  63. {
  64. id:'1623505640888492033',
  65. name:'江华招聘',
  66. },
  67. {
  68. id:'1685924287505633281',
  69. name:'江华房源',
  70. },
  71. {
  72. id:'1685924287505633281',
  73. name:'积分商城',
  74. }
  75. ],
  76. houseList:[],
  77. jobList:[],
  78. shopList:[],
  79. params:{
  80. classId:'1623505640888492033',
  81. labelClass:'1623505640888492033',
  82. pageNo:1,
  83. pageSize:10,
  84. total: null,
  85. isLock: true
  86. },
  87. }
  88. },
  89. onLoad() {
  90. this.getbannerList();
  91. this.getJobList();
  92. },
  93. // 隐藏微信h5的标题栏
  94. onReady() {
  95. this.$com.displayNav()
  96. },
  97. methods:{
  98. seeDetail(item){//查看详情
  99. this.$api('myInfo')
  100. .then(res=>{
  101. if(res.code == 200){
  102. this.role = res.result.role;
  103. this.userInfo = res.result;
  104. this.$store.commit('set_userInfo',res.result)
  105. uni.navigateTo({
  106. url:`/pages/home/course-detial?id=${item.id}`
  107. })
  108. }else{
  109. this.$Toast('请先登录!')
  110. setTimeout(()=>{
  111. uni.navigateTo({
  112. url:'/pages/my/login-kehu'
  113. })
  114. },1000)
  115. return
  116. this.userInfo = null
  117. }
  118. })
  119. },
  120. onPullDownRefresh() {
  121. this.houseList=[];
  122. this.jobList=[];
  123. this.shopList=[];
  124. this.params.pageNo = 1;
  125. this.params.total = null;
  126. this.params.isLock = true;
  127. if(this.current == 0){
  128. this.getJobList();
  129. }else if(this.current == 1){
  130. this.getHouseList()
  131. }else{
  132. this.getShopList();
  133. }
  134. uni.stopPullDownRefresh();
  135. },
  136. //获取租房信息
  137. getbannerList(){
  138. this.$api('bannerList',{state:'1'})
  139. .then(res=>{
  140. if(res.code == 200){
  141. this.swpList = res.result
  142. }
  143. })
  144. },
  145. //获取兼职信息
  146. getShopList(){
  147. uni.showLoading()
  148. this.$api('getJobShopList',{
  149. labelClass:'1623505640888492033',
  150. pageNo:this.params.pageNo,
  151. pageSize:this.params.pageSize,
  152. })
  153. .then(res=>{
  154. uni.hideLoading();
  155. if(res.code == 200){
  156. if(this.params.total== null) {
  157. this.params.total = res.result.total
  158. }
  159. if(this.params.pageNo>1){
  160. uni.hideLoading();
  161. }
  162. this.shopList = this.shopList.concat(res.result.records);
  163. this.params.isLock = true;
  164. }else {
  165. if(this.params.pageNo>1){
  166. uni.hideLoading();
  167. }
  168. this.params.isLock = true;
  169. }
  170. })
  171. },
  172. //获取兼职信息
  173. getJobList(){
  174. uni.showLoading()
  175. this.$api('JobList',this.params)
  176. .then(res=>{
  177. uni.hideLoading();
  178. if(res.code == 200){
  179. if(this.params.total== null) {
  180. this.params.total = res.result.total
  181. }
  182. if(this.params.pageNo>1){
  183. uni.hideLoading();
  184. }
  185. this.jobList = this.jobList.concat(res.result.records);
  186. this.params.isLock = true;
  187. }else {
  188. if(this.params.pageNo>1){
  189. uni.hideLoading();
  190. }
  191. this.params.isLock = true;
  192. }
  193. })
  194. },
  195. //获取房源信息
  196. getHouseList(){
  197. uni.showLoading()
  198. this.$api('getHouseList',this.params)
  199. .then(res=>{
  200. uni.hideLoading()
  201. if(res.code == 200){
  202. if(this.params.total== null) {
  203. this.params.total = res.result.total
  204. }
  205. if(this.params.pageNo>1){
  206. uni.hideLoading();
  207. }
  208. this.houseList = this.houseList.concat(res.result.records);
  209. this.params.isLock = true;
  210. }else {
  211. if(this.params.pageNo>1){
  212. uni.hideLoading();
  213. }
  214. this.params.isLock = true;
  215. }
  216. })
  217. },
  218. //点击切换
  219. tabClick(e){
  220. this.params.classId=e.id;
  221. this.houseList=[];
  222. this.jobList=[];
  223. this.shopList=[];
  224. this.current = e.index;
  225. this.params.pageNo = 1;
  226. if(this.current == 0){
  227. this.getJobList();
  228. }else if(this.current == 1){
  229. this.getHouseList()
  230. }else{
  231. this.getShopList();
  232. }
  233. },
  234. jianHuaNewDetail(item){
  235. this.$api('myInfo')
  236. .then(res=>{
  237. if(res.code == 200){
  238. this.role = res.result.role;
  239. this.userInfo = res.result;
  240. this.$store.commit('set_userInfo',res.result)
  241. //如果不是会员请开通会员
  242. uni.navigateTo({
  243. url:`/pages/jianhua/course-detial?id=${item.id}`
  244. })
  245. }else{
  246. this.$Toast('请先登录!')
  247. setTimeout(()=>{
  248. uni.navigateTo({
  249. url:'/pages/my/login-kehu'
  250. })
  251. },1000)
  252. return
  253. this.userInfo = null
  254. }
  255. })
  256. },
  257. //查看详情
  258. newDetail(item){
  259. this.$api('myInfo')
  260. .then(res=>{
  261. if(res.code == 200){
  262. this.role = res.result.role;
  263. this.userInfo = res.result;
  264. this.$store.commit('set_userInfo',res.result)
  265. //如果不是会员请开通会员
  266. if(this.userInfo.isPay == 1){
  267. uni.navigateTo({
  268. url:`/pages/home/new-detail?id=${item.id}`
  269. })
  270. }else{
  271. this.$Toast("开通会员即可查看")
  272. //跳转到实名认证页面进行实名认证
  273. setTimeout(()=>{ //设置延迟执行
  274. uni.navigateTo({
  275. url:'/pages/my/list-renzhen'
  276. })
  277. },2000);
  278. }
  279. }else{
  280. this.$Toast('请先登录!')
  281. setTimeout(()=>{
  282. uni.navigateTo({
  283. url:'/pages/my/login-kehu'
  284. })
  285. },1000)
  286. return
  287. this.userInfo = null
  288. }
  289. })
  290. },
  291. lower(){
  292. if(this.params.pageNo >= this.pages) return;
  293. this.params.pageNo ++;
  294. this.getHouseList();
  295. },
  296. }
  297. }
  298. </script>
  299. <style lang="scss" scoped>
  300. .home-pages {
  301. padding: 18rpx 29rpx 0;
  302. background-color: #F7F7F7;
  303. .scroll-Y {
  304. height: calc(100vh - 210rpx);
  305. padding-top: 20rpx;
  306. }
  307. }
  308. </style>