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

215 lines
4.3 KiB

  1. <template>
  2. <view class="home-pages">
  3. <u-swiper
  4. :list="swpList"
  5. keyName="image"
  6. indicator
  7. height="250"
  8. indicatorActiveColor="#FFFFFF"
  9. indicatorMode="dot"
  10. circular
  11. @click="swpClick"
  12. ></u-swiper>
  13. <view class="home-content">
  14. <u-tabs
  15. :list="tabList"
  16. lineWidth="70"
  17. lineHeight="3"
  18. lineColor= "#00CCCC"
  19. :activeStyle="{
  20. color: '#000000',
  21. fontWeight: 'bold',
  22. transform: 'scale(1.35)'
  23. }"
  24. :inactiveStyle="{
  25. color: '#000000',
  26. transform: 'scale(1)'
  27. }"
  28. itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
  29. @click="tabClick"
  30. >
  31. </u-tabs>
  32. <scroll-view scroll-y="true" class="scroll-y"
  33. <template>
  34. <active-card v-for="(item,i) in studyList" :item="item" :key="i" :i="i" @seeDetail="seeDetail"></active-card>
  35. </template>
  36. </scroll-view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import activeCard from '@/components/active-card/index.vue'
  42. import newCard from '@/components/new-card/index.vue'
  43. export default{
  44. components:{
  45. activeCard,
  46. newCard
  47. },
  48. data(){
  49. return{
  50. params:{
  51. pageNo:1,
  52. labelClass:'1636755993901731841',
  53. pageSize:10,
  54. total: null,
  55. isLock: true
  56. },
  57. current:0,
  58. studyList:[],
  59. swpList: [],
  60. tabList: []
  61. }
  62. },
  63. onLoad() {
  64. this.studyList = [];
  65. this.params.pageNo = 1;
  66. this.params.total = null;
  67. this.params.isLock = true;
  68. this.getstudy();
  69. // this.getknowledge();
  70. this.getbannerList()
  71. this.getJobAddressList();
  72. },
  73. // 隐藏微信h5的标题栏
  74. onReady() {
  75. this.$com.displayNav()
  76. },
  77. onPullDownRefresh() {
  78. this.studyList = [];
  79. this.params.pageNo = 1;
  80. this.params.total = null;
  81. this.params.isLock = true;
  82. this.getstudy();
  83. uni.stopPullDownRefresh();
  84. },
  85. onReachBottom() {
  86. if(this.params.isLock){
  87. this.params.isLock = false;
  88. if(this.params.total !== null && this.params.pageNo * this.params.pageSize >= this.params.total){
  89. this.$Toast('没有更多数据了哦!');
  90. setTimeout(()=>{
  91. this.params.isLock = true;
  92. },3000)
  93. return
  94. }
  95. this.params.pageNo+=1;
  96. //this.$Toast('数据加载成功!');
  97. this.getstudy();
  98. }
  99. },
  100. methods:{
  101. lower(){
  102. },
  103. getbannerList(){
  104. this.$api('bannerList',{state:'0'})
  105. .then(res=>{
  106. if(res.code == 200){
  107. this.swpList = res.result
  108. }
  109. })
  110. },
  111. //得到兼职地区分类
  112. getJobAddressList(){
  113. this.$api('IndexJobAddress').then(res=>{
  114. if(res.code == 200){
  115. this.tabList = res.result;
  116. }
  117. })
  118. },
  119. getstudy(){//学习列表
  120. uni.showLoading()
  121. this.$api('JobList',this.params)
  122. .then(res=>{
  123. uni.hideLoading();
  124. if(res.code == 200){
  125. if(this.params.total== null) {
  126. this.params.total = res.result.total
  127. }
  128. if(this.params.pageNo>1){
  129. uni.hideLoading();
  130. }
  131. this.studyList = this.studyList.concat(res.result.records);
  132. this.params.isLock = true;
  133. }else {
  134. if(this.params.pageNo>1){
  135. uni.hideLoading();
  136. }
  137. this.params.isLock = true;
  138. }
  139. })
  140. },
  141. swpClick(){
  142. },
  143. tabClick(e){
  144. this.params.labelClass = e.id;
  145. this.params.pageNo =1;
  146. console.log(this.params.labelClass)
  147. this.studyList = [];
  148. this.getstudy();
  149. },
  150. seeDetail(item){//查看详情
  151. this.$api('myInfo')
  152. .then(res=>{
  153. if(res.code == 200){
  154. this.role = res.result.role;
  155. this.userInfo = res.result;
  156. this.$store.commit('set_userInfo',res.result)
  157. uni.navigateTo({
  158. url:`/pages/home/course-detial?id=${item.id}`
  159. })
  160. }else{
  161. this.$Toast('请先登录!')
  162. setTimeout(()=>{
  163. uni.navigateTo({
  164. url:'/pages/my/login-kehu'
  165. })
  166. },1000)
  167. return
  168. this.userInfo = null
  169. }
  170. })
  171. },
  172. newDetail(item){//知识查看详情
  173. uni.navigateTo({
  174. url:`/pages/home/new-detail?id=${item.id}`
  175. })
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .home-pages {
  182. padding: 28rpx 29rpx 0;
  183. background-color: #F7F7F7;
  184. .swiper{
  185. position: relative;
  186. height: calc(100% -7vh);
  187. width: 100%;
  188. height: 1800px;
  189. }
  190. .scroll-Y {
  191. height: calc(300vh - 660rpx);
  192. padding-top: 20rpx;
  193. }
  194. .home-content {
  195. .active-card{
  196. margin-top: 20rpx;;
  197. border-radius: 0;
  198. border: none;
  199. border-style: none;
  200. box-shadow: none;
  201. }
  202. }
  203. }
  204. </style>