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

303 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. if(uni.getStorageSync('token')){
  92. this.$store.commit('getUserInfo')
  93. }
  94. },
  95. computed: {
  96. searchStyle() {
  97. let focusStyle = {
  98. class: 'focus',
  99. color: '#181818',
  100. icon: '/static/image/icon-search-dark.png',
  101. showAction: true,
  102. }
  103. let blurStyle = {
  104. class: 'blur',
  105. color: '#FFFFFF',
  106. icon: '/static/image/icon-search-light.png',
  107. showAction: false,
  108. }
  109. return this.isFocusSearch ? focusStyle : blurStyle
  110. },
  111. },
  112. methods: {
  113. search() {
  114. console.log('search', this.keyword)
  115. uni.navigateTo({
  116. url: '/pages_order/product/search?search=' + this.keyword
  117. })
  118. // this.keyword = ''
  119. },
  120. },
  121. }
  122. </script>
  123. <style scoped lang="scss">
  124. .bg {
  125. width: 100%;
  126. height: auto;
  127. border-bottom-left-radius: 40rpx;
  128. border-bottom-right-radius: 40rpx;
  129. font-size: 0;
  130. overflow: hidden;
  131. .img {
  132. width: 100%;
  133. height: auto;
  134. }
  135. }
  136. .main {
  137. position: absolute;
  138. top: 0;
  139. left: 0;
  140. width: 100%;
  141. padding: 100rpx 32rpx calc(120rpx + env(safe-area-inset-bottom) + 32rpx) 32rpx;
  142. box-sizing: border-box;
  143. }
  144. .search {
  145. $w: 474rpx;
  146. $h: 64rpx;
  147. $radius: 32rpx;
  148. $borderWidth: 4rpx;
  149. width: $w;
  150. height: $h;
  151. position: relative;
  152. border-radius: $radius;
  153. &-icon {
  154. margin: 0 13rpx 0 26rpx;
  155. width: 30rpx;
  156. height: auto;
  157. }
  158. /deep/ .uv-search__content {
  159. padding: 12rpx 0;
  160. border: 4rpx solid transparent;
  161. }
  162. &.blur {
  163. background: #FFFFFF66;
  164. &:before,
  165. &:after {
  166. width: calc(#{$w} - #{$radius});
  167. height: $borderWidth;
  168. position: absolute;
  169. left: $radius;
  170. content: ' ';
  171. background: linear-gradient(to right, #FFFFFF, #FFFFFF00);
  172. }
  173. &:before {
  174. top: 0;
  175. }
  176. &:after {
  177. bottom: 0;
  178. }
  179. .border {
  180. width: $radius;
  181. overflow: hidden;
  182. position: absolute;
  183. top: 0;
  184. left: 0;
  185. &-left {
  186. width: calc(#{$radius} * 2 - #{$borderWidth} * 2);
  187. height: calc(#{$h} - #{$borderWidth} * 2);
  188. border: $borderWidth solid #FFFFFF;
  189. border-radius: $radius;
  190. }
  191. }
  192. }
  193. &.focus {
  194. /deep/ .uv-search__content {
  195. background: #FFFFFF !important;
  196. border-color: #CFEFFF !important;
  197. }
  198. /deep/ .uv-search__action {
  199. padding: 19rpx 24rpx;
  200. font-size: 26rpx;
  201. font-weight: 500;
  202. line-height: 1;
  203. color: #FFFFFF;
  204. background: #00A9FF;
  205. border-radius: 32rpx;
  206. }
  207. }
  208. }
  209. .section {
  210. & + & {
  211. margin-top: 32rpx;
  212. }
  213. }
  214. .reason {
  215. width: 100%;
  216. font-size: 0;
  217. border-radius: 32rpx;
  218. overflow: hidden;
  219. .img {
  220. width: 100%;
  221. height: auto;
  222. }
  223. }
  224. .movable {
  225. &-view {
  226. position: fixed;
  227. width: auto;
  228. height: auto;
  229. }
  230. &-content {
  231. position: relative;
  232. .btn {
  233. &-service {
  234. column-gap: 4rpx;
  235. padding: 6rpx 6rpx 6rpx 18rpx;
  236. background: linear-gradient(to right, #21FEEC, #019AF9);
  237. border: 2rpx solid #00A9FF;
  238. border-radius: 40rpx;
  239. .label {
  240. white-space: nowrap;
  241. font-size: 24rpx;
  242. font-weight: 500;
  243. color: #FFFFFF;
  244. text-shadow: 0 1px 2px #135A98;
  245. }
  246. .icon {
  247. width: 64rpx;
  248. height: auto;
  249. }
  250. }
  251. &-close {
  252. width: 32rpx;
  253. height: auto;
  254. position: absolute;
  255. top: 0;
  256. left: 0;
  257. transform: translate(-10rpx, -10rpx);
  258. }
  259. }
  260. }
  261. }
  262. </style>