listItemC.vue 2.4 KB

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