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

388 lines
7.4 KiB

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