鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

304 lines
6.1 KiB

3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
  1. <template>
  2. <view class="page__view">
  3. <!-- todo: 轮播图 -->
  4. <view class="bg">
  5. <image class="img" src="@/static/image/bg.png" mode="widthFix"></image>
  6. </view>
  7. <view class="main">
  8. <!-- 搜索栏 -->
  9. <view :class="['flex', 'search', searchStyle.class]">
  10. <uv-search
  11. v-model="keyword"
  12. placeholder="输入关键词搜索"
  13. :color="searchStyle.color"
  14. bgColor="transparent"
  15. :showAction="searchStyle.showAction"
  16. @custom="search"
  17. @search="search"
  18. @focus="isFocusSearch = true"
  19. @blur="isFocusSearch = false"
  20. >
  21. <template #prefix>
  22. <image class="search-icon" :src="searchStyle.icon" mode="widthFix"></image>
  23. </template>
  24. </uv-search>
  25. <view class="border">
  26. <view class="border-left"></view>
  27. </view>
  28. </view>
  29. <view class="section">
  30. <categoryView></categoryView>
  31. </view>
  32. <view class="section">
  33. <recommendView></recommendView>
  34. </view>
  35. <view class="section">
  36. <swiperView></swiperView>
  37. </view>
  38. <view class="section">
  39. <pictureLiveView></pictureLiveView>
  40. </view>
  41. <view class="section reason">
  42. <image class="img" src="@/static/image/temp-19.png" mode="widthFix"></image>
  43. </view>
  44. <view class="section">
  45. <productView :list="list" @categoryChange="onCategoryChange"></productView>
  46. </view>
  47. </view>
  48. <tabber select="home" />
  49. </view>
  50. </template>
  51. <script>
  52. import mixinsList from '@/mixins/list.js'
  53. import tabber from '@/components/base/tabbar.vue'
  54. import categoryView from '@/components/home/categoryView.vue'
  55. import recommendView from '@/components/home/recommendView.vue'
  56. import swiperView from '@/components/home/swiperView.vue'
  57. import pictureLiveView from '@/components/home/pictureLiveView.vue'
  58. import productView from '@/components/home/productView.vue'
  59. export default {
  60. mixins: [mixinsList],
  61. components: {
  62. tabber,
  63. categoryView,
  64. recommendView,
  65. swiperView,
  66. pictureLiveView,
  67. productView,
  68. },
  69. data() {
  70. return {
  71. keyword: '',
  72. isFocusSearch: false,
  73. // todo
  74. mixinsListApi: '',
  75. }
  76. },
  77. onLoad() {
  78. // let id = '1948353988875821058'
  79. // uni.navigateTo({
  80. // url: `/pages_order/thesis/createPdf?id=${id}`
  81. // })
  82. // return
  83. },
  84. computed: {
  85. searchStyle() {
  86. let focusStyle = {
  87. class: 'focus',
  88. color: '#181818',
  89. icon: '/static/image/icon-search-dark.png',
  90. showAction: true,
  91. }
  92. let blurStyle = {
  93. class: 'blur',
  94. color: '#FFFFFF',
  95. icon: '/static/image/icon-search-light.png',
  96. showAction: false,
  97. }
  98. return this.isFocusSearch ? focusStyle : blurStyle
  99. },
  100. },
  101. methods: {
  102. search() {
  103. console.log('search', this.keyword)
  104. uni.navigateTo({
  105. url: '/pages_order/product/search?search=' + this.keyword
  106. })
  107. // this.keyword = ''
  108. },
  109. // todo: delete
  110. getData() {
  111. this.list = [
  112. {
  113. id: '001',
  114. image: '/static/image/temp-20.png',
  115. name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  116. desc: '国内游·7-9天·12岁+',
  117. currentPrice: 688.99,
  118. originalPrice: 1200,
  119. registered: 4168,
  120. },
  121. {
  122. id: '002',
  123. image: '/static/image/temp-21.png',
  124. name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  125. desc: '国内游·7-9天·12岁+',
  126. currentPrice: 688.99,
  127. originalPrice: 1200,
  128. registered: 4168,
  129. },
  130. {
  131. id: '003',
  132. image: '/static/image/temp-22.png',
  133. name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  134. desc: '国内游·7-9天·12岁+',
  135. currentPrice: 688.99,
  136. originalPrice: 1200,
  137. registered: 4168,
  138. },
  139. {
  140. id: '004',
  141. image: '/static/image/temp-23.png',
  142. name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  143. desc: '国内游·7-9天·12岁+',
  144. currentPrice: 688.99,
  145. originalPrice: 1200,
  146. registered: 4168,
  147. },
  148. ]
  149. this.total = this.list.length
  150. },
  151. onCategoryChange(e) {
  152. const { classId } = e || {}
  153. if (classId) {
  154. this.queryParams.classId = classId
  155. } else {
  156. delete this.queryParams.classId
  157. }
  158. this.queryParams.pageNo = 1
  159. this.queryParams.pageSize = 10
  160. this.getData()
  161. },
  162. },
  163. }
  164. </script>
  165. <style scoped lang="scss">
  166. .bg {
  167. width: 100%;
  168. height: auto;
  169. border-bottom-left-radius: 40rpx;
  170. border-bottom-right-radius: 40rpx;
  171. font-size: 0;
  172. overflow: hidden;
  173. .img {
  174. width: 100%;
  175. height: auto;
  176. }
  177. }
  178. .main {
  179. position: absolute;
  180. top: 0;
  181. left: 0;
  182. width: 100%;
  183. padding: 100rpx 32rpx calc(120rpx + env(safe-area-inset-bottom) + 100rpx) 32rpx;
  184. box-sizing: border-box;
  185. }
  186. .search {
  187. $w: 474rpx;
  188. $h: 64rpx;
  189. $radius: 32rpx;
  190. $borderWidth: 4rpx;
  191. width: $w;
  192. height: $h;
  193. position: relative;
  194. border-radius: $radius;
  195. &-icon {
  196. margin: 0 13rpx 0 26rpx;
  197. width: 30rpx;
  198. height: auto;
  199. }
  200. /deep/ .uv-search__content {
  201. padding: 12rpx 0;
  202. border: 4rpx solid transparent;
  203. }
  204. &.blur {
  205. background: #FFFFFF66;
  206. &:before,
  207. &:after {
  208. width: calc(#{$w} - #{$radius});
  209. height: $borderWidth;
  210. position: absolute;
  211. left: $radius;
  212. content: ' ';
  213. background: linear-gradient(to right, #FFFFFF, #FFFFFF00);
  214. }
  215. &:before {
  216. top: 0;
  217. }
  218. &:after {
  219. bottom: 0;
  220. }
  221. .border {
  222. width: $radius;
  223. overflow: hidden;
  224. position: absolute;
  225. top: 0;
  226. left: 0;
  227. &-left {
  228. width: calc(#{$radius} * 2 - #{$borderWidth} * 2);
  229. height: calc(#{$h} - #{$borderWidth} * 2);
  230. border: $borderWidth solid #FFFFFF;
  231. border-radius: $radius;
  232. }
  233. }
  234. }
  235. &.focus {
  236. /deep/ .uv-search__content {
  237. background: #FFFFFF !important;
  238. border-color: #CFEFFF !important;
  239. }
  240. /deep/ .uv-search__action {
  241. padding: 19rpx 24rpx;
  242. font-size: 26rpx;
  243. font-weight: 500;
  244. line-height: 1;
  245. color: #FFFFFF;
  246. background: #00A9FF;
  247. border-radius: 32rpx;
  248. }
  249. }
  250. }
  251. .section {
  252. & + & {
  253. margin-top: 32rpx;
  254. }
  255. }
  256. .reason {
  257. width: 100%;
  258. font-size: 0;
  259. border-radius: 32rpx;
  260. overflow: hidden;
  261. .img {
  262. width: 100%;
  263. height: auto;
  264. }
  265. }
  266. </style>