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

300 lines
5.9 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
  1. <template>
  2. <movable-area 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"></productView>
  46. </view>
  47. </view>
  48. <movable-view v-if="showBtnService" class="movable-view" :x="273" :y="628" direction="all">
  49. <view class="movable-content">
  50. <button class="flex btn btn-service" open-type="contact">
  51. <view class="label">联系客服</view>
  52. <image class="icon" src="@/static/image/icon-service.png" mode="widthFix"></image>
  53. </button>
  54. <button class="flex btn btn-close" @click.stop="showBtnService = false">
  55. <image class="icon" src="@/static/image/icon-close.png" mode="widthFix"></image>
  56. </button>
  57. </view>
  58. </movable-view>
  59. <tabber select="home" />
  60. </movable-area>
  61. </template>
  62. <script>
  63. import mixinsList from '@/mixins/list.js'
  64. import tabber from '@/components/base/tabbar.vue'
  65. import bgSwiperView from '@/components/home/bgSwiperView.vue'
  66. import categoryView from '@/components/home/categoryView.vue'
  67. import recommendView from '@/components/home/recommendView.vue'
  68. import swiperView from '@/components/home/swiperView.vue'
  69. import pictureLiveView from '@/components/home/pictureLiveView.vue'
  70. import productView from '@/components/home/productView.vue'
  71. export default {
  72. mixins: [mixinsList],
  73. components: {
  74. tabber,
  75. bgSwiperView,
  76. categoryView,
  77. recommendView,
  78. swiperView,
  79. pictureLiveView,
  80. productView,
  81. },
  82. data() {
  83. return {
  84. keyword: '',
  85. isFocusSearch: false,
  86. mixinsListApi: 'queryActivityList',
  87. showBtnService: true,
  88. }
  89. },
  90. onLoad() {
  91. },
  92. computed: {
  93. searchStyle() {
  94. let focusStyle = {
  95. class: 'focus',
  96. color: '#181818',
  97. icon: '/static/image/icon-search-dark.png',
  98. showAction: true,
  99. }
  100. let blurStyle = {
  101. class: 'blur',
  102. color: '#FFFFFF',
  103. icon: '/static/image/icon-search-light.png',
  104. showAction: false,
  105. }
  106. return this.isFocusSearch ? focusStyle : blurStyle
  107. },
  108. },
  109. methods: {
  110. search() {
  111. console.log('search', this.keyword)
  112. uni.navigateTo({
  113. url: '/pages_order/product/search?search=' + this.keyword
  114. })
  115. // this.keyword = ''
  116. },
  117. },
  118. }
  119. </script>
  120. <style scoped lang="scss">
  121. .bg {
  122. width: 100%;
  123. height: auto;
  124. border-bottom-left-radius: 40rpx;
  125. border-bottom-right-radius: 40rpx;
  126. font-size: 0;
  127. overflow: hidden;
  128. .img {
  129. width: 100%;
  130. height: auto;
  131. }
  132. }
  133. .main {
  134. position: absolute;
  135. top: 0;
  136. left: 0;
  137. width: 100%;
  138. padding: 100rpx 32rpx calc(120rpx + env(safe-area-inset-bottom) + 100rpx) 32rpx;
  139. box-sizing: border-box;
  140. }
  141. .search {
  142. $w: 474rpx;
  143. $h: 64rpx;
  144. $radius: 32rpx;
  145. $borderWidth: 4rpx;
  146. width: $w;
  147. height: $h;
  148. position: relative;
  149. border-radius: $radius;
  150. &-icon {
  151. margin: 0 13rpx 0 26rpx;
  152. width: 30rpx;
  153. height: auto;
  154. }
  155. /deep/ .uv-search__content {
  156. padding: 12rpx 0;
  157. border: 4rpx solid transparent;
  158. }
  159. &.blur {
  160. background: #FFFFFF66;
  161. &:before,
  162. &:after {
  163. width: calc(#{$w} - #{$radius});
  164. height: $borderWidth;
  165. position: absolute;
  166. left: $radius;
  167. content: ' ';
  168. background: linear-gradient(to right, #FFFFFF, #FFFFFF00);
  169. }
  170. &:before {
  171. top: 0;
  172. }
  173. &:after {
  174. bottom: 0;
  175. }
  176. .border {
  177. width: $radius;
  178. overflow: hidden;
  179. position: absolute;
  180. top: 0;
  181. left: 0;
  182. &-left {
  183. width: calc(#{$radius} * 2 - #{$borderWidth} * 2);
  184. height: calc(#{$h} - #{$borderWidth} * 2);
  185. border: $borderWidth solid #FFFFFF;
  186. border-radius: $radius;
  187. }
  188. }
  189. }
  190. &.focus {
  191. /deep/ .uv-search__content {
  192. background: #FFFFFF !important;
  193. border-color: #CFEFFF !important;
  194. }
  195. /deep/ .uv-search__action {
  196. padding: 19rpx 24rpx;
  197. font-size: 26rpx;
  198. font-weight: 500;
  199. line-height: 1;
  200. color: #FFFFFF;
  201. background: #00A9FF;
  202. border-radius: 32rpx;
  203. }
  204. }
  205. }
  206. .section {
  207. & + & {
  208. margin-top: 32rpx;
  209. }
  210. }
  211. .reason {
  212. width: 100%;
  213. font-size: 0;
  214. border-radius: 32rpx;
  215. overflow: hidden;
  216. .img {
  217. width: 100%;
  218. height: auto;
  219. }
  220. }
  221. .movable {
  222. &-view {
  223. position: fixed;
  224. width: auto;
  225. height: auto;
  226. }
  227. &-content {
  228. position: relative;
  229. .btn {
  230. &-service {
  231. column-gap: 4rpx;
  232. padding: 6rpx 6rpx 6rpx 18rpx;
  233. background: linear-gradient(to right, #21FEEC, #019AF9);
  234. border: 2rpx solid #00A9FF;
  235. border-radius: 40rpx;
  236. .label {
  237. white-space: nowrap;
  238. font-size: 24rpx;
  239. font-weight: 500;
  240. color: #FFFFFF;
  241. text-shadow: 0 1px 2px #135A98;
  242. }
  243. .icon {
  244. width: 64rpx;
  245. height: auto;
  246. }
  247. }
  248. &-close {
  249. width: 32rpx;
  250. height: auto;
  251. position: absolute;
  252. top: 0;
  253. left: 0;
  254. transform: translate(-10rpx, -10rpx);
  255. }
  256. }
  257. }
  258. }
  259. </style>