listitemB.vue 2.5 KB

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