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

319 lines
6.2 KiB

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