templateD.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 || item.image" ></image>
  5. <view class="cm-cover"></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,2)
  48. }
  49. },
  50. navigaitionTo(item){
  51. if (item.link === '' && item.linkType === -1) {
  52. return
  53. }else if(item.linkType === -1){
  54. const url = `/pages/h5/activity/activity-detail?type=video&videoUrl=${item.link}&title=${item.name}`
  55. return uni.navigateTo({ url })
  56. }else{
  57. caimeiApi.FlooryNavigateTo(item)
  58. }
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. .picture{
  65. width: 100%;
  66. .section{
  67. position: relative;
  68. margin-bottom: 24rpx;
  69. width: 702rpx;
  70. height: 360rpx;
  71. overflow: hidden;
  72. border-radius: 16rpx;
  73. image{
  74. width: 702rpx;
  75. height: 360rpx;
  76. }
  77. &:first-child{
  78. margin-top: 0;
  79. }
  80. .cm-cover{
  81. z-index: 99;
  82. top: 0;
  83. left: 0;
  84. position: absolute;
  85. width: 100%;
  86. height: 100%;
  87. background: url(https://static.caimei365.com/app/img/icon2/cm_player.png) no-repeat center;
  88. background-size: 40rpx 40rpx;
  89. }
  90. }
  91. }
  92. </style>