多租户商城-商户小程序端
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.

341 lines
6.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="hom-page home_page_content">
  3. <!-- 头部 -->
  4. <FixedHead>
  5. <category-list @tabChange="tabChange"></category-list>
  6. </FixedHead>
  7. <!-- 首页画布骨架屏 -->
  8. <Skeleton v-if="isFirst" :loading="loading" :isFirst="isFirst" />
  9. <template v-if="!isFirst">
  10. <!-- 首页画布 -->
  11. <view
  12. id="home_canvas_page"
  13. v-if="activeTab===0"
  14. >
  15. <canvas-page
  16. ref="canvasPage"
  17. :componentsData="componentsData"
  18. :terminal="terminal"
  19. :typeId="1"
  20. />
  21. </view>
  22. <!-- 其他分类 -->
  23. <category-show
  24. ref="categoryShow"
  25. v-else
  26. :classifyId="classifyId"
  27. />
  28. <ListBottomTips
  29. :loading="false"
  30. v-if="activeTab===0 && scrollTop>400"
  31. />
  32. <Agreement />
  33. <global-loading />
  34. <AdWindow
  35. ref="adWindow"
  36. :triggerCondition="1"
  37. />
  38. </template>
  39. </div>
  40. </template>
  41. <script>
  42. import AdWindow from "@/components/adWindow";
  43. import api from '@/components/canvasShow/config/api'
  44. import CategoryList from "@/components/basics/categoryList.vue"
  45. import CategoryShow from "@/components/basics/categoryShow.vue"
  46. import canvasPage from '@/components/canvasShow/canvasShowPage.vue'
  47. import FixedHead from "./component/FixedHead";
  48. import ListBottomTips from "@/components/ListBottomTips";
  49. import Agreement from "./component/Agreement";
  50. import Skeleton from "./component/Skeleton";
  51. const NET = require('@/utils/request')
  52. const API = require('../../../config/api')
  53. export default {
  54. components: {
  55. AdWindow,
  56. CategoryList,
  57. CategoryShow,
  58. canvasPage,
  59. FixedHead,
  60. ListBottomTips,
  61. Agreement,
  62. Skeleton
  63. },
  64. data() {
  65. return {
  66. loading: true,
  67. isFirst: true,
  68. classifyId: 0, // 分类ID
  69. terminal: API.terminal,
  70. activeTab: 0,
  71. componentsData: [],
  72. typeId: 1,
  73. scrollTop: 0
  74. }
  75. },
  76. onReachBottom() {
  77. this.HandleLoadMoreProduct()
  78. },
  79. onLoad() {
  80. this.$nextTick(async () => {
  81. await this.handleGetCanvas()
  82. if(this.$refs.adWindow){
  83. this.$refs.adWindow.getAd()
  84. }
  85. })
  86. },
  87. onPageScroll(e) {
  88. this.scrollTop = e.scrollTop
  89. },
  90. methods: {
  91. // 读取画布
  92. async handleGetCanvas() {
  93. this.loading = true
  94. const apiUrl = api.getCanvas + '?terminal=' + this.terminal + '&type=' + this.typeId
  95. const {data} = await NET.request(apiUrl, {}, 'GET')
  96. if (JSON.stringify(data) !== '{}') {
  97. this.componentsData = JSON.parse(data.json)
  98. this.isFirst = false
  99. this.loading = false
  100. }
  101. },
  102. // 分享到朋友圈
  103. onShareTimeline: function () {
  104. return {
  105. title: this.miniHomeRemark,
  106. imageUrl: this.miniHomeImg,
  107. path: 'pages/tabbar/index/index',
  108. }
  109. },
  110. // 分享好友
  111. onShareAppMessage: function () {
  112. return {
  113. title: this.miniHomeRemark,
  114. imageUrl: this.miniHomeImg,
  115. path: 'pages/tabbar/index/index',
  116. }
  117. },
  118. /**
  119. * 请求非首页的子组件的下一页
  120. * */
  121. HandleLoadMoreProduct() {
  122. if (this.activeTab !== 0) {
  123. let pitchOnPage = this.$refs.categoryShow
  124. if (pitchOnPage.total !== 0 && pitchOnPage.productList.length < pitchOnPage.total) {
  125. pitchOnPage.page++
  126. pitchOnPage.handleGetProductData()
  127. }
  128. }
  129. },
  130. tabChange(index, id) {
  131. this.activeTab = index
  132. this.classifyId = id
  133. },
  134. }
  135. };
  136. </script>
  137. <style
  138. lang="scss"
  139. scoped
  140. >
  141. .header {
  142. background: #fff;
  143. .toLive {
  144. height: 40px;
  145. color: #FFF;
  146. background-color: #333;
  147. }
  148. .topBox {
  149. display: flex;
  150. align-items: center;
  151. justify-content: space-between;
  152. width: 100%;
  153. height: 100%;
  154. }
  155. .logo {
  156. width: 280rpx;
  157. height: 100%;
  158. //margin-top: -40rpx;
  159. // margin-left: 30rpx;
  160. }
  161. .search-btn {
  162. height: 66rpx;
  163. background: rgba(255, 255, 255, 1);
  164. border-radius: 33rpx;
  165. display: flex;
  166. flex-direction: row;
  167. align-items: center;
  168. margin-right: 30rpx;
  169. .search-icon {
  170. width: 60rpx;
  171. height: 60rpx;
  172. // margin-left: 33rpx;
  173. }
  174. .search-word {
  175. font-size: 26rpx;
  176. font-weight: 400;
  177. color: rgba(153, 153, 153, 1);
  178. margin-left: 10rpx;
  179. }
  180. }
  181. .tabs-nav-warp {
  182. margin-top: 20rpx;
  183. padding: 0 30rpx;
  184. }
  185. .tabs-nav {
  186. .ul {
  187. display: flex;
  188. .li {
  189. flex: 1 0 auto;
  190. margin-left: 36rpx;
  191. font-size: 30rpx;
  192. color: #999999;
  193. position: relative;
  194. padding-bottom: 18rpx;
  195. &:first-child {
  196. margin-left: 0;
  197. }
  198. &.on {
  199. &:after {
  200. content: '';
  201. width: 100%;
  202. height: 4rpx;
  203. background: #C5AA7B;
  204. position: absolute;
  205. left: 0;
  206. bottom: 0;
  207. }
  208. font-weight: bold;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. .weiXinBox {
  215. width: 100%;
  216. //position: fixed;
  217. background: #FFFFFF;
  218. //z-index: 99;
  219. }
  220. .wxBtnBg {
  221. padding: 0 20rpx;
  222. .weiXinBoxBtn {
  223. display: flex;
  224. align-items: center;
  225. padding: 10rpx 0 10rpx 15rpx;
  226. width: 100%;
  227. background: #F3F4F5;
  228. opacity: 1;
  229. .search-icon {
  230. width: 50rpx;
  231. height: 50rpx;
  232. margin-right: 20rpx;
  233. }
  234. text {
  235. color: #999999;
  236. }
  237. }
  238. }
  239. .terminal1 {
  240. .header {
  241. .topBox {
  242. // justify-content: left;
  243. .search-btn {
  244. .search-icon {
  245. margin-left: 0rpx;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. .topTitle {
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. height: 100rpx;
  256. width: 100%;
  257. .topText {
  258. text-align: center;
  259. color: #000000;
  260. font-size: 38rpx;
  261. font-weight: bold;
  262. }
  263. }
  264. .topWap {
  265. padding-top: 30rpx;
  266. .logo {
  267. margin-top: 0 !important;
  268. }
  269. }
  270. .terminal2 {
  271. }
  272. .terminal3 {
  273. }
  274. // 触底样式
  275. .reachBottom {
  276. margin-top: 30rpx;
  277. display: flex;
  278. flex-direction: column;
  279. align-items: center;
  280. .reach-icon {
  281. width: 150rpx;
  282. height: 150rpx;
  283. }
  284. .reach-text {
  285. margin: 20rpx 0;
  286. color: #CCCCCC;
  287. }
  288. }
  289. // 优化兼容UI
  290. .home_page_content {
  291. #home_canvas_page {
  292. width: 100%;
  293. position: relative;
  294. }
  295. }
  296. </style>