templateF.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="picture">
  3. <view class="section" v-for="(item,index) in productList" :key="index" @click="navigaitionTo(item)">
  4. <image :src="item.appletsImage" ></image>
  5. <view class="cm-cover" v-if="pageData.floorContent.templateClassify === 4"></view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import caimeiApi from '@/common/config/caimeiApi.js'
  11. export default{
  12. data(){
  13. return{
  14. productList:[]
  15. }
  16. },
  17. props:{
  18. pageData: {
  19. type: Object
  20. },
  21. userIdentity: {
  22. type: Number
  23. },
  24. flag:{
  25. type:Boolean,
  26. default:false
  27. }
  28. },
  29. created() {
  30. this.initData(this.pageData)
  31. },
  32. watch: {
  33. pageData: {
  34. handler: function(el) {
  35. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  36. this.pageData = el
  37. this.initData(this.pageData)
  38. },
  39. deep: true
  40. }
  41. },
  42. methods:{
  43. initData(data){
  44. if(this.flag){
  45. this.productList = data.floorImageList
  46. }else{
  47. this.productList = data.floorImageList.slice(0,1)
  48. }
  49. },
  50. navigaitionTo(item){
  51. console.log(item.linkType)
  52. if (item.adsImage === '' && item.linkType === -1) {
  53. return
  54. }else if(item.linkType === -1){
  55. uni.navigateTo({
  56. url:`/pages/h5/activity/activity-detail?adsImage=${item.adsImage}&title=${item.name}`
  57. })
  58. }else{
  59. caimeiApi.FlooryNavigateTo(item)
  60. }
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss">
  66. .picture{
  67. .section{
  68. position: relative;
  69. width: 702rpx;
  70. height: 340rpx;
  71. overflow: hidden;
  72. border-radius: 16rpx;
  73. margin-top: 24rpx;
  74. &:first-child{
  75. margin-top: 0;
  76. }
  77. image{
  78. width: 702rpx;
  79. height: 340rpx;
  80. }
  81. .cm-cover{
  82. z-index: 99;
  83. top: 0;
  84. left: 0;
  85. position: absolute;
  86. width: 100%;
  87. height: 100%;
  88. background: url(https://static.caimei365.com/app/img/icon2/cm_player.png) no-repeat center;
  89. background-size: 40rpx 40rpx;
  90. }
  91. }
  92. }
  93. </style>