plantList.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view v-if="plantList.length > 0" :style="'margin-top:'+mbConfig+'rpx;'">
  3. <view class="plant-count skeleton-rect" :style="'margin: 0 '+prConfig+'rpx;border-radius:'+bgStyle+'rpx'">
  4. <block v-if="community_status">
  5. <view class="spike-bd plant_bg" :style="{ 'background-image': `url(${domain}/static/images/plant_bg.png)`}">
  6. <view class="title line1"><image class="title-img" :src="`${domain}/static/images/plant_title.png`"></image></view>
  7. <navigator v-if="!merId" :open-type="open_grass ? 'switchTab' : 'navigate'" url="/pages/plant_grass/index" class="more-btn" hover-class="none">
  8. 好物分享
  9. <text class="iconfont icon-jiantou" hover-class="none"></text>
  10. </navigator>
  11. </view>
  12. <view class="live-wrapper plant" style="border-radius: 0;">
  13. <scroll-view :class="'colum'+styleType" :scroll-x="styleType == 0 ? true : false" >
  14. <view
  15. v-for="(item, index) in plantList"
  16. :key="index"
  17. class="item"
  18. :class="'plant-item'+styleType"
  19. :style="'border-radius:'+conStyle+'rpx'"
  20. @click="goDetail(item)"
  21. >
  22. <view :class="'img-box'+conStyle">
  23. <easy-loadimage mode="widthFix" :image-src="item.image[0]"></easy-loadimage>
  24. <view class="item_text">
  25. <text v-if="titleShow" class="text_name line1">{{item.title}}</text>
  26. <view v-if="avatarShow || nicknameShow" class="text_count acea-row">
  27. <image v-if="avatarShow" :src="(item.author && item.author.avatar) || '/static/images/f.png'" ></image>
  28. <text v-if="nicknameShow" class="name line1">{{(item.author && item.author.nickname) || ''}}</text>
  29. </view>
  30. <view class="like_count" v-if="styleType == 1">
  31. <text class="iconfont" :class="item.relevance_id ? 'icon-shoucang1' : 'icon-dianzan'"></text>
  32. <text class="collect">{{item.count_start}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </block>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. // +----------------------------------------------------------------------
  45. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  46. // +----------------------------------------------------------------------
  47. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  48. // +----------------------------------------------------------------------
  49. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  50. // +----------------------------------------------------------------------
  51. // | Author: CRMEB Team <admin@crmeb.com>
  52. // +----------------------------------------------------------------------
  53. import { HTTP_REQUEST_URL } from '@/config/app';
  54. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
  55. import { graphicLstData } from '@/api/api.js';
  56. import { openPlantGrass } from "@/config/app.js";
  57. import { mapGetters } from 'vuex';
  58. import { configMap } from '@/utils';
  59. export default {
  60. computed: configMap(['community_status']),
  61. components:{
  62. easyLoadimage
  63. },
  64. name: 'plantList',
  65. props: {
  66. dataConfig: {
  67. type: Object,
  68. default: () => {}
  69. },
  70. merId: {
  71. type: String || Number,
  72. default: ''
  73. }
  74. },
  75. data() {
  76. return {
  77. plantList: [],
  78. open_grass: openPlantGrass,
  79. mbConfig: this.dataConfig.mbConfig.val*2, //页面间距
  80. styleType: this.dataConfig.tabConfig.tabVal, //单行,多行,板块
  81. prConfig: this.dataConfig.prConfig.val*2, //背景间距
  82. bgStyle: this.dataConfig.bgStyle.type ? 16 : 0,
  83. conStyle: this.dataConfig.conStyle.type ? 16 : 0,
  84. titleShow: this.dataConfig.titleShow.val,
  85. avatarShow: this.dataConfig.avatarShow.val,
  86. nicknameShow: this.dataConfig.nicknameShow.val,
  87. domain: HTTP_REQUEST_URL,
  88. diy_id: this.dataConfig.did,
  89. unique: this.dataConfig.timestamp,
  90. };
  91. },
  92. created() {},
  93. mounted() {
  94. this.getPlantList()
  95. },
  96. methods: {
  97. // 种草
  98. getPlantList(){
  99. let that = this;
  100. graphicLstData({
  101. diy_id: that.diy_id,
  102. unique: that.unique,
  103. mer_id: that.merId,
  104. limit: 6
  105. }).then(res => {
  106. that.plantList = res.data.list;
  107. }).catch(e => {});
  108. },
  109. goDetail(item){
  110. if(item.is_type == 1){
  111. uni.navigateTo({
  112. url: '/pages/plantGrass/plant_detail/index?id='+item.community_id
  113. });
  114. }else{
  115. uni.navigateTo({
  116. //#ifdef APP
  117. url: '/pages/short_video/appSwiper/index?id='+item.community_id
  118. //#endif
  119. //#ifndef APP
  120. url: '/pages/short_video/nvueSwiper/index?id='+item.community_id
  121. //#endif
  122. });
  123. }
  124. }
  125. }
  126. };
  127. </script>
  128. <style scoped lang="scss">
  129. @import '../style/main.scss';
  130. .plant-count{
  131. background: #ffffff;
  132. box-shadow: 4rpx 2rpx 12rpx 2rpx rgba(0, 0, 0, 0.03);
  133. }
  134. .plant_bg{
  135. margin-bottom: 0;
  136. border-radius: 0;
  137. padding: 24rpx 20rpx 27rpx 30rpx;
  138. background-size: 100% 100%;
  139. background-repeat: no-repeat;
  140. .more-btn{
  141. top: 22rpx;
  142. }
  143. }
  144. .live-wrapper {
  145. position: relative;
  146. width: 100%;
  147. box-sizing: border-box;
  148. overflow: hidden;
  149. border-radius: 16rpx;
  150. padding: 20rpx 20rpx 0;
  151. image {
  152. width: 100%;
  153. height: 400rpx;
  154. }
  155. .item{
  156. position: relative;
  157. width: 280rpx;
  158. height: 280rpx;
  159. display: inline-block;
  160. overflow: hidden;
  161. margin-right: 20rpx;
  162. /deep/image,.easy-loadimage,uni-image {
  163. width: 280rpx;
  164. height: 280rpx;
  165. }
  166. .img-box16{
  167. /deep/image,.easy-loadimage,uni-image {
  168. border-radius: 16rpx;
  169. }
  170. }
  171. .img-box0{
  172. /deep/image,.easy-loadimage,uni-image {
  173. border-radius: 0;
  174. }
  175. }
  176. &::before{
  177. content: "";
  178. display: block;
  179. width: 280rpx;
  180. height: 280rpx;
  181. background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 100%);
  182. position: absolute;
  183. top: 0;
  184. left: 0;
  185. z-index: 9;
  186. }
  187. .item_text{
  188. width: 260rpx;
  189. padding: 17rpx 15rpx;
  190. position: absolute;
  191. left: 0;
  192. bottom: 0;
  193. color: #ffffff;
  194. z-index: 9;
  195. image {
  196. width: 34rpx;
  197. height: 34rpx;
  198. border-radius: 100%;
  199. }
  200. .text_name{
  201. font-size: 24rpx;
  202. width: 260rpx;
  203. word-break: normal;
  204. word-wrap: break-word;
  205. display: block;
  206. }
  207. .text_count{
  208. margin-top: 12rpx;
  209. align-items: center;
  210. .name{
  211. font-size: 18rpx;
  212. margin-left: 10rpx;
  213. max-width: 200rpx;
  214. }
  215. }
  216. }
  217. &.plant-item1{
  218. width: 324rpx;
  219. height: 440rpx;
  220. margin-bottom: 20rpx;
  221. &:nth-child(2n){
  222. margin-right: 0;
  223. }
  224. /deep/image,.easy-loadimage,uni-image {
  225. width: 324rpx;
  226. height: 334rpx;
  227. }
  228. &::before{
  229. width: 324rpx;
  230. height: 334rpx;
  231. }
  232. .item_text{
  233. position: static;
  234. color: #282828;
  235. position: relative;
  236. width: 100%;
  237. height: 110rpx;
  238. .text_name {
  239. font-size: 28rpx;
  240. font-weight: bold;
  241. }
  242. .text_count{
  243. width: 100%;
  244. display: flex;
  245. align-items: center;
  246. .name{
  247. max-width: 160rpx;
  248. }
  249. }
  250. .like_count{
  251. position: absolute;
  252. bottom: 10rpx;
  253. right: 20rpx;
  254. font-size: 24rpx;
  255. display: flex;
  256. align-items: center;
  257. .iconfont{
  258. margin-right: 6rpx;
  259. }
  260. .icon-shoucang1{
  261. color: #E93323;
  262. }
  263. }
  264. image {
  265. width: 34rpx;
  266. height: 34rpx;
  267. border-radius: 100%;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. </style>