shai.vue 5.1 KB

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