鸿宇研学生前端代码
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.

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