shai.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="box">
  3. <view class="box_ul">
  4. <view class="box_ul_li " v-for="(item,index) in boxList" :key="index" @click="item.flag = !item.flag">
  5. <view class="s-bt flex">
  6. <view class="s-tx"> <image :src="item.box_tx" mode="aspectFill"></image>
  7. </view>
  8. <view class="s-mc">{{ item.box_mc}}</view>
  9. <!-- <view class="s-sj">{{ item.box_sj}}</view> -->
  10. <view class="s-sj">{{ item.box_sj }}</view>
  11. <view class="s-qc"></view>
  12. </view>
  13. <view class="s-zw">{{ item.box_zw}}</view>
  14. <view class="s-img-list ">
  15. <view class="s-img-box" v-for="(item2,index) in item.box_img" :key="index" @click="item.flag = !item.flag">
  16. <image :src="item2" mode="aspectFill" @click="lookImg(item2)"></image>
  17. </view>
  18. <view class="s-qc"></view>
  19. </view>
  20. </view>
  21. </view>
  22. <div class="shai-btn" @click="shaitu()">
  23. <image src="/static/image/new_home/shaitu.png" mode="widthFix"></image>
  24. </div>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. i:0,//
  32. page:1,
  33. isAll:false,//
  34. pages:null,//
  35. totalNumber:0,//总数量
  36. boxList:[],//盒子列表
  37. };
  38. },
  39. watch:{
  40. boxList:{
  41. handler(val){
  42. let totalNumber = 0
  43. this.isAll = val.every(item=>item.flag)
  44. if (val.length == 0) this.isAll = false
  45. val.forEach(item=>{
  46. if (item.flag) {
  47. totalNumber++
  48. }
  49. })
  50. this.totalNumber = totalNumber
  51. },
  52. deep:true //true 深度监听
  53. }
  54. },
  55. methods:{
  56. lookImg (url) {
  57. uni.previewImage({
  58. urls: [url],
  59. longPressActions: {
  60. itemList: ['发送给朋友', '保存图片', '收藏'],
  61. success: function(data) {
  62. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  63. },
  64. fail: function(err) {
  65. console.log(err.errMsg);
  66. }
  67. }
  68. });
  69. },
  70. //获取晒图集合
  71. getShaiList () {
  72. this.$api.sList({status:this.i + 1,page: this.page, msg:'数据加载中'}).then(res=>{
  73. if (res.code === 1) {
  74. res.data.data.forEach(item=>{
  75. item.flag = false
  76. })
  77. this.pages = res.data.last_page
  78. this.boxList = this.page == 1 ? res.data.data : [...this.boxList,...res.data.data]
  79. }
  80. })
  81. },
  82. shaitu(){
  83. uni.navigateTo({url:'/pages/me/shaitu'})
  84. }
  85. },
  86. onShow () {
  87. this.getShaiList()
  88. },
  89. onReachBottom() {
  90. console.log(121)
  91. if (this.page < this.pages) {
  92. this.page++
  93. this.getShaiList()
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. .shai-btn{
  100. position: fixed;
  101. bottom: 70px;
  102. right: 10px;
  103. $size: 70rpx;
  104. width: $size;
  105. height: $size;
  106. border-radius: 50%;
  107. }
  108. .s-bt { display: block;}
  109. .s-tx{ height:80rpx;
  110. width: 80rpx;
  111. float: left;
  112. image {
  113. border-radius: 40rpx;
  114. }
  115. }
  116. .s-mc {
  117. float: left;
  118. line-height: 80rpx; padding-left: 30rpx;
  119. font-size: 26rpx;
  120. }
  121. .s-sj {
  122. float: right;
  123. line-height: 80rpx;
  124. padding-right:10rpx; color:#999;
  125. }
  126. .s-qc {
  127. clear: both;
  128. }
  129. .s-zw {
  130. padding: 20rpx 0;
  131. -webkit-box-pack: justify;
  132. -webkit-justify-content: space-between;
  133. justify-content: space-between;
  134. color: var(--mainColor);
  135. font-size: 16px;
  136. text-align: justify;
  137. line-height: 1.6;
  138. }
  139. .s-img-box {
  140. float: left;
  141. image {
  142. width: 190rpx;
  143. height: 120rpx;
  144. margin-bottom: 16rpx;
  145. margin-left:16rpx;
  146. }
  147. text {
  148. color: #000000;
  149. font-size: 26rpx;
  150. }
  151. }
  152. .box_head {
  153. position: sticky;
  154. top: 88rpx;
  155. left: 0;
  156. background: #FAFAFA;
  157. z-index: 2021;
  158. width: 100%;
  159. .box_head_li {
  160. flex:1 ;
  161. font-size: 30rpx;
  162. height: 90rpx;
  163. font-weight: bold;
  164. }
  165. .active {
  166. color: #F6AF32;
  167. }
  168. }
  169. .box_ul {
  170. padding: 0 30rpx 98rpx 30rpx;
  171. .box_ul_li {
  172. padding: 30rpx;
  173. margin-bottom: 20rpx;
  174. background: #FFFFFF;
  175. border-radius: 20rpx;
  176. .box_ul_li_img {
  177. image {
  178. width: 168rpx;
  179. height: 168rpx;
  180. border-radius: 10rpx;
  181. }
  182. margin-right: 20rpx;
  183. }
  184. .box_ul_li_main {
  185. flex: 1;
  186. }
  187. .box_ul_li_name {
  188. font-size: 28rpx;
  189. display: -webkit-box;
  190. -webkit-box-orient: vertical;
  191. -webkit-line-clamp: 2;
  192. overflow: hidden;
  193. }
  194. .box_ul_li_price {
  195. text {
  196. color: #CF271B;
  197. font-size: 28rpx;
  198. }
  199. image {
  200. width: 44rpx;
  201. height: 44rpx;
  202. }
  203. margin: 15rpx 0;
  204. }
  205. .box_ul_li_time {
  206. color: #999999;
  207. font-size: 22rpx;
  208. }
  209. }
  210. }
  211. .box_footer {
  212. height: 98rpx;
  213. z-index: 20;
  214. position: fixed;
  215. bottom: 50px;
  216. width: 100%;
  217. padding: 0 30rpx;
  218. background: #FFFFFF;
  219. .box_footer_all {
  220. image {
  221. width: 44rpx;
  222. height: 44rpx;
  223. margin-right: 10rpx;
  224. }
  225. text {
  226. color: #000000;
  227. font-size: 28rpx;
  228. }
  229. }
  230. .box_footer_li {
  231. color: #FFFFFF;
  232. width: 220rpx;
  233. height: 78rpx;
  234. border-radius: 39rpx;
  235. font-size: 30rpx;
  236. margin-left: 30rpx;
  237. &:first-child {
  238. background: #FA7E48;
  239. }
  240. &:last-child {
  241. background: #F6AF32;
  242. }
  243. }
  244. }
  245. </style>