Articleclass.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false"><view class="div container">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar title="文章分类" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class="div class-list">
  13. <view class="div" v-for="item in articleclass_list" v-bind:key="item.ac_id" @click="goHomeArticlelist(item.ac_id)">
  14. <flex-line :is-link="true" :show-border="true">
  15. <text class="span">{{item.ac_name}}</text>
  16. </flex-line>
  17. </view>
  18. </view>
  19. <empty-record v-if="articleclass_list && !articleclass_list.length"></empty-record>
  20. </view></home-base>
  21. </template>
  22. <script>
  23. import {getFontSize} from '@/util/common'
  24. import TitleHeader from '../../TitleHeader'
  25. import { urlencode } from '@/util/common'
  26. import HomeBase from '../HomeBase'
  27. import { getArticleclassList } from '../../../api/homeArticle'
  28. import EmptyRecord from '../../EmptyRecord'
  29. import flexLine from '../../flexLine'
  30. export default {
  31. components:{
  32. TitleHeader,
  33. HomeBase,
  34. flexLine,
  35. EmptyRecord
  36. },
  37. name: 'Articleclass',
  38. mounted(){
  39. // #ifdef MP-WEIXIN
  40. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  41. // #endif
  42. },
  43. computed:{
  44. fontSize(){
  45. return getFontSize()
  46. },
  47. },
  48. data(){
  49. return {
  50. navHeight: 0,
  51. articleclass_list: false
  52. }
  53. },
  54. created: function () {
  55. this.getArticleclassList()
  56. },
  57. methods:{
  58. goBack(){uni.navigateBack({delta:1})},
  59. getArticleclassList () {
  60. uni.showLoading({ title: '加载中' })
  61. getArticleclassList().then(res => {
  62. uni.hideLoading()
  63. this.articleclass_list = res.result.article_class
  64. }).catch(function (error) {
  65. uni.hideLoading()
  66. uni.showToast({icon:'none',title: error.message})
  67. })
  68. },
  69. goHomeArticlelist (acId) {
  70. uni.navigateTo({ url: '/pages/home/article/Articlelist'+'?'+urlencode( { ac_id: acId } )})
  71. }
  72. }
  73. }
  74. </script>
  75. <style scoped lang="scss">
  76. .class-list{padding:0 $pageSpace;background: #fff}
  77. </style>