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

391 lines
7.5 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
1 year 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
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. .home_page_content{
  189. background: #FAFAFA;
  190. }
  191. .header {
  192. background: #FAFAFA;
  193. .toLive {
  194. height: 40px;
  195. color: #FFF;
  196. background-color: #333;
  197. }
  198. .topBox {
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. width: 100%;
  203. height: 100%;
  204. }
  205. .logo {
  206. width: 280rpx;
  207. height: 100%;
  208. //margin-top: -40rpx;
  209. // margin-left: 30rpx;
  210. }
  211. .search-btn {
  212. height: 66rpx;
  213. background: rgba(255, 255, 255, 1);
  214. border-radius: 33rpx;
  215. display: flex;
  216. flex-direction: row;
  217. align-items: center;
  218. margin-right: 30rpx;
  219. .search-icon {
  220. width: 60rpx;
  221. height: 60rpx;
  222. // margin-left: 33rpx;
  223. }
  224. .search-word {
  225. font-size: 26rpx;
  226. font-weight: 400;
  227. color: rgba(153, 153, 153, 1);
  228. margin-left: 10rpx;
  229. }
  230. }
  231. .tabs-nav-warp {
  232. margin-top: 20rpx;
  233. padding: 0 30rpx;
  234. }
  235. .tabs-nav {
  236. .ul {
  237. display: flex;
  238. .li {
  239. flex: 1 0 auto;
  240. margin-left: 36rpx;
  241. font-size: 30rpx;
  242. color: #999999;
  243. position: relative;
  244. padding-bottom: 18rpx;
  245. &:first-child {
  246. margin-left: 0;
  247. }
  248. &.on {
  249. &:after {
  250. content: '';
  251. width: 100%;
  252. height: 4rpx;
  253. background: #C5AA7B;
  254. position: absolute;
  255. left: 0;
  256. bottom: 0;
  257. }
  258. font-weight: bold;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. .weiXinBox {
  265. width: 100%;
  266. //position: fixed;
  267. background: #FFFFFF;
  268. //z-index: 99;
  269. }
  270. .wxBtnBg {
  271. padding: 0 20rpx;
  272. .weiXinBoxBtn {
  273. display: flex;
  274. align-items: center;
  275. padding: 10rpx 0 10rpx 15rpx;
  276. width: 100%;
  277. background: #F3F4F5;
  278. opacity: 1;
  279. .search-icon {
  280. width: 50rpx;
  281. height: 50rpx;
  282. margin-right: 20rpx;
  283. }
  284. text {
  285. color: #999999;
  286. }
  287. }
  288. }
  289. .terminal1 {
  290. .header {
  291. .topBox {
  292. // justify-content: left;
  293. .search-btn {
  294. .search-icon {
  295. margin-left: 0rpx;
  296. }
  297. }
  298. }
  299. }
  300. }
  301. .topTitle {
  302. display: flex;
  303. justify-content: center;
  304. align-items: center;
  305. height: 100rpx;
  306. width: 100%;
  307. .topText {
  308. text-align: center;
  309. color: #000000;
  310. font-size: 38rpx;
  311. font-weight: bold;
  312. }
  313. }
  314. .topWap {
  315. padding-top: 30rpx;
  316. .logo {
  317. margin-top: 0 !important;
  318. }
  319. }
  320. .terminal2 {
  321. }
  322. .terminal3 {
  323. }
  324. // 触底样式
  325. .reachBottom {
  326. margin-top: 30rpx;
  327. display: flex;
  328. flex-direction: column;
  329. align-items: center;
  330. .reach-icon {
  331. width: 150rpx;
  332. height: 150rpx;
  333. }
  334. .reach-text {
  335. margin: 20rpx 0;
  336. color: #CCCCCC;
  337. }
  338. }
  339. // 优化兼容UI
  340. .home_page_content {
  341. #home_canvas_page {
  342. width: 100%;
  343. position: relative;
  344. }
  345. }
  346. </style>