listItemC.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view style="background-color: white;">
  3. <view class="titleview ztextfontB1">{{$t('index.toplanmuT')}}</view>
  4. <view class="item_list" style="width: 90%;">
  5. <view class="item_content" v-for="(item, index) in fenleiLst" @click="fenleixuanz(item.id)">
  6. <!--<myImage :mysrc="item.image" mymode="widthFix"></myImage>-->
  7. <image :src="item.image=='/static/logo.png'?item.image:baseUrl+item.image" mode="scaleToFill"
  8. @error="imageError(index)"></image>
  9. <view class="title textfontB5">
  10. <text v-if="lgstate=='zh-Hans'">{{item.name}}</text>
  11. <text v-if="lgstate=='yuenan'">{{item.nameVi}}</text>
  12. <text v-if="lgstate=='zh-Hant'">{{item.name}}</text>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import api from "@/pages/api/api.js"
  20. export default {
  21. data() {
  22. return {
  23. toptitle: "",
  24. baseUrl: this.$baseImagurl,
  25. fenleiLst: [],
  26. lgstate: ''
  27. };
  28. },
  29. created() {
  30. var yszche = uni.getStorageSync('yszche');
  31. if (1 != yszche) {} else {
  32. this.getmendianfenlei();
  33. }
  34. },
  35. methods: {
  36. fenleixuanz(e) {
  37. this.$emit('Efenleixuanze', e);
  38. },
  39. imageError(index) {
  40. this.fenleiLst[index]['image'] = '/static/logo.png'; //默认图片
  41. },
  42. getmendianfenlei() {
  43. this.lgstate = uni.getStorageSync('language');
  44. var that = this;
  45. api('getmendianfenlei', {
  46. pageSize: 40
  47. }, res => {
  48. if (res.data.code == 200) {
  49. that.fenleiLst = res.data.rows;
  50. //console.log('1---------------',that.fenleiLst)
  51. }
  52. }, failc => {
  53. //console.log('2---------------',failc)
  54. uni.showToast({
  55. title: that.$t('api.wangluoshibai'),
  56. icon: 'none',
  57. duration: 2500
  58. })
  59. })
  60. },
  61. }
  62. }
  63. </script>
  64. <style lang="scss">
  65. @font-face {
  66. font-family: zrht;
  67. src: url('/uni_modules/font/zrht.otf');
  68. }
  69. .item_list {
  70. padding: 0 15rpx;
  71. display: flex;
  72. flex-wrap: wrap;
  73. justify-content: flex-start;
  74. .item_content {
  75. width: 20%;
  76. height: 200rpx;
  77. margin: 20rpx 0;
  78. padding: 14rpx;
  79. box-sizing: border-box;
  80. image {
  81. width: 120rpx;
  82. height: 120rpx;
  83. display: block;
  84. background-color: floralwhite;
  85. border: 1rpx solid lightgray;
  86. }
  87. .title {
  88. width: 100%;
  89. text-align: center;
  90. height: 60rpx;
  91. //line-height: 40rpx;
  92. padding-bottom: 10rpx;
  93. padding-top: 4rpx;
  94. }
  95. }
  96. }
  97. .titleview {
  98. padding-left: 40rpx;
  99. padding-top: 22rpx;
  100. line-height: 46rpx;
  101. }
  102. </style>