fenleiList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view style="background-color: white;">
  3. <scroll-view scroll-view scroll-x="true" >
  4. <view class="">
  5. <view class="item_list">
  6. <view v-for="(item, index) in objList">
  7. <view class="item_content" @click="fenleixuanz(item.id)">
  8. <netImage width="140" height="140" :mysrc="item.imageUrl" mymode="scaleToFill"></netImage>
  9. <view class="title">
  10. <text >{{item.title}}</text>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </scroll-view>
  17. </view>
  18. </template>
  19. <script>
  20. import api from "@/pages/api/api.js"
  21. export default {
  22. data() {
  23. return {
  24. listsize:0,
  25. objList:[],
  26. fenleiList:[],
  27. };
  28. },
  29. methods:{
  30. getfenleiList(){
  31. api('fwlxlist',{
  32. pageNum:1,
  33. pageSize:20
  34. },res=>{
  35. if(res.data.code!=200){
  36. return;
  37. }
  38. this.initListObj(res.data.rows)
  39. //console.log('1111333333',res);
  40. },failc=>{
  41. //console.log('getadvertis----',failc)
  42. })
  43. },
  44. initListObj(list){
  45. this.listsize=list.length;
  46. this.objList=[];
  47. var tmpList=[];
  48. var language = uni.getStorageSync('language');
  49. if(language=='yuenan'){
  50. for(var i=0;i<this.listsize;i++){
  51. var obj={
  52. id:list[i].id,
  53. imageUrl:list[i].image,
  54. title:list[i].nameVi,
  55. detail:list[i].illustrateVi
  56. };
  57. tmpList.push(obj);
  58. }
  59. }
  60. else if(language=='zh-Hans'){
  61. for(var i=0;i<this.listsize;i++){
  62. var obj={
  63. id:list[i].id,
  64. imageUrl:list[i].image,
  65. title:list[i].nameCn,
  66. detail:list[i].illustrateCn
  67. };
  68. tmpList.push(obj);
  69. }
  70. }
  71. else if(language=='zh-Hant'){
  72. for(var i=0;i<this.listsize;i++){
  73. var obj={
  74. id:list[i].id,
  75. imageUrl:list[i].image,
  76. title:list[i].nameTw,
  77. detail:list[i].illustrateTw
  78. };
  79. tmpList.push(obj);
  80. }
  81. }
  82. this.objList=tmpList;
  83. },
  84. fenleixuanz(e){
  85. this.$emit('Efwflxuanze',e);
  86. },
  87. },
  88. }
  89. </script>
  90. <style lang="scss">
  91. @font-face {
  92. font-family: zrht;
  93. src: url('/uni_modules/font/zrht.otf');
  94. }
  95. .item_list{
  96. padding-left: 40rpx;
  97. display: flex;
  98. flex-direction: row;
  99. justify-content: flex-start;
  100. }
  101. .item_content{
  102. width: 160rpx;
  103. height: 230rpx;
  104. margin: 16rpx 0;
  105. padding: 14rpx;
  106. box-sizing: border-box;
  107. image{
  108. width: 140rpx;
  109. height:140rpx;
  110. background-color:whitesmoke;
  111. display: block;
  112. }
  113. .title{
  114. width: 100%;
  115. text-align: center;
  116. font-size: 24rpx;
  117. line-height: 30rpx;
  118. padding-top: 4rpx;
  119. }
  120. }
  121. .titleview{
  122. padding-left: 40rpx;
  123. padding-top: 22rpx;
  124. font-size: 30rpx;
  125. line-height: 46rpx;
  126. // font-family: zrht;
  127. }
  128. </style>