StrongPhoto.vue 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <!-- <h1>StrongPhoto 精彩集锦</h1> -->
  3. <div class="Photo-box">
  4. <div>
  5. <van-swipe :autoplay="3000">
  6. <van-swipe-item v-for="(image, index) in photoBannerImages" :key="index">
  7. <van-image width="100%" height="100%" :src="image.thumb" />
  8. </van-swipe-item>
  9. </van-swipe>
  10. </div>
  11. <div style="display: flex; aline-itme:center;margin-top: 30px;padding-left: 15px; ">
  12. <!-- <div :class="`${classStyle?'Zhedie-box Donghua':'Zhedie-box'}`"> -->
  13. <div :class="{'Zhedie-box': true, 'expand': classStyle}">
  14. <!-- :class="`${clickStyle?'clickStyle':''}`" -->
  15. <div
  16. v-for="(item,i) in buttList"
  17. :key="i"
  18. @click="SeePhotos(i,item.packId)"
  19. :class="activeNum === i ? 'clickStyle':''"
  20. >{{item.name}}</div>
  21. </div>
  22. <van-icon
  23. v-show="iconShow"
  24. style="left:0; top: 0.6vh;"
  25. :name="`${classStyle?'arrow-up ':'arrow-down'}`"
  26. @click="animations"
  27. />
  28. </div>
  29. <div class="PhotoList-box">
  30. <div class="PhotoList-box-images" v-for="(item, index) in newArrImageList" :key="index">
  31. <div class="PhotoList-box-text">
  32. <div></div>
  33. <span>{{item.createDate}}</span>
  34. </div>
  35. <span v-for="(image, index) in item.res" :key="index">
  36. <van-image width="31vw" :src="image.url" style="padding:0 3px 0 2px" />
  37. </span>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import { getPhotoSotr, getPhotos } from '../util/api'
  44. import { parseTime, SignInTime } from '../util/formattingData'
  45. import { getBanner } from '../util/api'
  46. export default {
  47. data() {
  48. return {
  49. classStyle: false,
  50. clickStyle: false,
  51. iconShow: true,
  52. activeNum: 0, //下标
  53. buttList: [],
  54. photoBannerImages: [],
  55. imageList: [],
  56. newArrImageList: []
  57. }
  58. },
  59. watch: {},
  60. mounted() {
  61. this.onBanner()
  62. this.onLoadSort()
  63. this.dataResort()
  64. // if (this.buttList.length >= 2) {
  65. // this.iconShow = true
  66. // } else {
  67. // this.iconShow = false
  68. // }
  69. },
  70. methods: {
  71. parseTime,
  72. dataResort(arr) {
  73. var newArr = []
  74. this.imageList.forEach(function (oldData, i) {
  75. var index = -1
  76. var createTime = parseTime(oldData.createDate, '{y}-{m}-{d}')
  77. var newTime = parseTime(createTime, '{y}-{m}-{d}')
  78. var alreadyExists = newArr.some(function (newData, j) {
  79. var noData = parseTime(newData.createDate, '{y}-{m}-{d}')
  80. if (newTime === noData) {
  81. index = j
  82. return true
  83. }
  84. })
  85. if (!alreadyExists) {
  86. var res = []
  87. res.push(oldData)
  88. newArr.push({
  89. createDate: createTime,
  90. res: res
  91. })
  92. } else {
  93. newArr[index].res.push(oldData)
  94. }
  95. })
  96. console.log(
  97. '🚀 ~ file: StrongPhoto.vue ~ line 105 ~ dataResort ~ newArr',
  98. newArr
  99. )
  100. this.newArrImageList = newArr
  101. },
  102. onLoadSort() {
  103. getPhotoSotr().then((e) => {
  104. this.buttList = e.records
  105. console.log(e.records)
  106. })
  107. },
  108. animations() {
  109. this.classStyle = !this.classStyle
  110. },
  111. SeePhotos(i, id) {
  112. console.log('🚀 ~ file: StrongPhoto.vue ~ line 94 ~ SeePhotos ~ id', id)
  113. this.activeNum = i
  114. getPhotos(id).then((e) => {
  115. this.imageList = e.records
  116. this.dataResort()
  117. })
  118. // this.clickStyle = !this.clickStyle
  119. },
  120. onBanner() {
  121. getBanner('Wonderful').then((e) => {
  122. this.photoBannerImages = e.records
  123. console.log(e)
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="less" scoped>
  130. .Photo-box {
  131. width: 100vw;
  132. height: 100%;
  133. background-color: #fff;
  134. .van-swipe {
  135. width: 95%;
  136. border-radius: 10px;
  137. margin: 10px auto;
  138. box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.2);
  139. height: 33vh;
  140. }
  141. .Zhedie-box {
  142. width: 90%;
  143. overflow: hidden;
  144. display: flex;
  145. align-items: center;
  146. flex-wrap: wrap;
  147. height: 35px;
  148. transition: height 0.2s ease;
  149. &.expand {
  150. height: 50vh;
  151. }
  152. > div {
  153. padding: 2px 10px;
  154. color: rgb(128, 128, 128);
  155. line-height: 28px;
  156. text-align: center;
  157. font-size: 10px;
  158. }
  159. .clickStyle {
  160. color: #12a89f;
  161. font-weight: 700;
  162. background-color: #f3f3f3;
  163. border-radius: 30px;
  164. }
  165. }
  166. .Donghua {
  167. animation: Donghua 0.2s 1 forwards;
  168. overflow: scroll;
  169. }
  170. .PhotoList-box {
  171. width: 100%;
  172. height: auto;
  173. background-color: #fff;
  174. .PhotoList-box-images {
  175. width: 97%;
  176. margin: 0 auto;
  177. padding-bottom: 10vh;
  178. .PhotoList-box-text {
  179. display: flex;
  180. align-items: center;
  181. margin: 1.2em 0 0.8em 0;
  182. > div {
  183. width: 6px;
  184. height: 6px;
  185. border-radius: 50%;
  186. background-color: #13c0b4;
  187. margin: 0 13px 0 9px;
  188. }
  189. > span {
  190. font-size: 12px;
  191. letter-spacing: 1px;
  192. color: rgb(128, 128, 128);
  193. }
  194. }
  195. }
  196. }
  197. }
  198. </style>