diff --git a/alipay/components/goods-category-nav/goods-category-nav.acss b/alipay/components/goods-category-nav/goods-category-nav.acss
new file mode 100755
index 000000000..af09be533
--- /dev/null
+++ b/alipay/components/goods-category-nav/goods-category-nav.acss
@@ -0,0 +1,22 @@
+.category-list {
+ overflow: hidden;
+}
+.category-list .items {
+ width: 25%;
+ padding-bottom: 20rpx;
+ float: left;
+}
+.items-content {
+ margin: 20rpx;
+}
+.category-list .items:nth-child(4n+1) {
+
+}
+.category-list .items image {
+ width: 50px !important;
+ height: 50px !important;
+}
+.category-list .items .title {
+ margin-top: 10rpx;
+ font-size: 32rpx;
+}
\ No newline at end of file
diff --git a/alipay/components/goods-category-nav/goods-category-nav.axml b/alipay/components/goods-category-nav/goods-category-nav.axml
new file mode 100644
index 000000000..bd5d58153
--- /dev/null
+++ b/alipay/components/goods-category-nav/goods-category-nav.axml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+
diff --git a/alipay/components/goods-category-nav/goods-category-nav.js b/alipay/components/goods-category-nav/goods-category-nav.js
new file mode 100644
index 000000000..e0cb56c05
--- /dev/null
+++ b/alipay/components/goods-category-nav/goods-category-nav.js
@@ -0,0 +1,62 @@
+const app = getApp();
+Component({
+ mixins: [],
+ props: {},
+ data: {
+ data_list_loding_status: 1,
+ data_bottom_line_status: false,
+ category_list: [],
+ },
+ didMount() {
+ this.init();
+ },
+ didUpdate(){},
+ didUnmount(){},
+ methods:{
+ init() {
+ // 加载loding
+ this.setData({
+ data_list_loding_status: 1,
+ });
+
+ // 加载loding
+ my.httpRequest({
+ url: app.get_request_url("GoodsCategoryNav", "Index"),
+ method: "POST",
+ data: {},
+ dataType: "json",
+ success: res => {
+ if (res.data.code == 0) {
+ var data = res.data.data;
+ this.setData({
+ category_list: data,
+ data_list_loding_status: data.length == 0 ? 0 : 3,
+ data_bottom_line_status: true,
+ });
+ } else {
+ this.setData({
+ data_list_loding_status: 0,
+ data_bottom_line_status: true,
+ });
+
+ my.showToast({
+ type: "fail",
+ content: res.data.msg
+ });
+ }
+ },
+ fail: () => {
+ this.setData({
+ data_list_loding_status: 2,
+ data_bottom_line_status: true,
+ });
+
+ my.showToast({
+ type: "fail",
+ content: "服务器请求出错"
+ });
+ }
+ });
+ },
+ }
+});
diff --git a/alipay/components/goods-category-nav/goods-category-nav.json b/alipay/components/goods-category-nav/goods-category-nav.json
new file mode 100644
index 000000000..32640e0dc
--- /dev/null
+++ b/alipay/components/goods-category-nav/goods-category-nav.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/alipay/components/home-banner/home-banner.acss b/alipay/components/home-banner/home-banner.acss
new file mode 100755
index 000000000..c3a6ff6f0
--- /dev/null
+++ b/alipay/components/home-banner/home-banner.acss
@@ -0,0 +1,3 @@
+.banner {
+ height: 320rpx!important;
+}
\ No newline at end of file
diff --git a/alipay/components/home-banner/home-banner.axml b/alipay/components/home-banner/home-banner.axml
new file mode 100644
index 000000000..114ef3804
--- /dev/null
+++ b/alipay/components/home-banner/home-banner.axml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/alipay/components/home-banner/home-banner.js b/alipay/components/home-banner/home-banner.js
new file mode 100644
index 000000000..ab98f5c1e
--- /dev/null
+++ b/alipay/components/home-banner/home-banner.js
@@ -0,0 +1,94 @@
+const app = getApp();
+Component({
+ mixins: [],
+ data: {
+ indicator_dots: false,
+ indicator_color: 'rgba(0, 0, 0, .3)',
+ indicator_active_color: '#e31c55',
+ autoplay: true,
+ circular: true,
+ data_list_loding_status: 1,
+ data_bottom_line_status: false,
+ banner_list: [],
+ },
+ props: {},
+ didMount() {
+ this.init();
+ },
+ didUpdate() {},
+ didUnmount() {},
+ methods: {
+ // 获取数
+ init() {
+ // 加载loding
+ this.setData({
+ data_list_loding_status: 1,
+ });
+
+ // 加载loding
+ my.httpRequest({
+ url: app.get_request_url("Banner", "Index"),
+ method: "POST",
+ data: {},
+ dataType: "json",
+ success: res => {
+ if (res.data.code == 0) {
+ var data = res.data.data;
+ this.setData({
+ banner_list: data,
+ indicator_dots: (data.length > 1),
+ autoplay: (data.length > 1),
+ data_list_loding_status: data.length == 0 ? 0 : 3,
+ data_bottom_line_status: true,
+ });
+ } else {
+ this.setData({
+ data_list_loding_status: 0,
+ data_bottom_line_status: true,
+ });
+
+ my.showToast({
+ type: "fail",
+ content: res.data.msg
+ });
+ }
+ },
+ fail: () => {
+ this.setData({
+ data_list_loding_status: 2,
+ data_bottom_line_status: true,
+ });
+
+ my.showToast({
+ type: "fail",
+ content: "服务器请求出错"
+ });
+ }
+ });
+ },
+
+ // 轮播图事件
+ banner_event(e) {
+ var value = e.target.dataset.value || null;
+ var type = parseInt(e.target.dataset.type);
+ if (value != null) {
+ switch(type) {
+ // web
+ case 0 :
+ my.navigateTo({url: '/pages/web-view/web-view?url='+value});
+ break;
+
+ // 内部页面
+ case 1 :
+ my.navigateTo({url: value});
+ break;
+
+ // 跳转到外部小程序
+ case 2 :
+ my.navigateToMiniProgram({appId: value});
+ break;
+ }
+ }
+ },
+ },
+});
diff --git a/alipay/components/home-banner/home-banner.json b/alipay/components/home-banner/home-banner.json
new file mode 100644
index 000000000..32640e0dc
--- /dev/null
+++ b/alipay/components/home-banner/home-banner.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
\ No newline at end of file
diff --git a/alipay/pages/index/index.acss b/alipay/pages/index/index.acss
index f692cf192..e69de29bb 100755
--- a/alipay/pages/index/index.acss
+++ b/alipay/pages/index/index.acss
@@ -1,27 +0,0 @@
-/* 轮播图片 */
-.banner {
- height: 320rpx!important;
-}
-
-/* 商品分类 */
-.category-list {
- overflow: hidden;
-}
-.category-list .items {
- width: calc(50% - 5rpx);
- margin-bottom: 10rpx;
- padding-bottom: 20rpx;
-}
-.category-list .items:nth-child(2n) {
- float: right;
-}
-.category-list .items:nth-child(2n+1) {
- float: left;
-}
-.category-list .items image {
- height: 200px !important;
-}
-.category-list .items .title {
- margin-top: 10rpx;
- font-size: 32rpx;
-}
\ No newline at end of file
diff --git a/alipay/pages/index/index.axml b/alipay/pages/index/index.axml
index 7befbb79d..f6002432e 100755
--- a/alipay/pages/index/index.axml
+++ b/alipay/pages/index/index.axml
@@ -1,20 +1,8 @@
-
-
-
-
-
-
-
+
+
-
-
+
+
+
diff --git a/alipay/pages/index/index.json b/alipay/pages/index/index.json
index c96031fd7..b910a1e4f 100755
--- a/alipay/pages/index/index.json
+++ b/alipay/pages/index/index.json
@@ -1,3 +1,7 @@
{
- "pullRefresh": true
+ "pullRefresh": true,
+ "usingComponents": {
+ "component-goods-category-nav": "/components/goods-category-nav/goods-category-nav",
+ "component-home-banner": "/components/home-banner/home-banner"
+ }
}
\ No newline at end of file
diff --git a/service/Application/Api/Controller/IndexController.class.php b/service/Application/Api/Controller/IndexController.class.php
index c214caf19..3a0286e96 100755
--- a/service/Application/Api/Controller/IndexController.class.php
+++ b/service/Application/Api/Controller/IndexController.class.php
@@ -72,5 +72,31 @@ class IndexController extends CommonController
// 返回数据
$this->ajaxReturn(L('common_operation_success'), 0, $result);
}
+
+ /**
+ * [GoodsCategoryNav 商品分类导航]
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @datetime 2018-05-25T11:03:59+0800
+ */
+ public function GoodsCategoryNav()
+ {
+ // 返回数据
+ $this->ajaxReturn(L('common_operation_success'), 0, GoodsService::GoodsCategoryList());
+ }
+
+ /**
+ * [Banner 首页轮播]
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @datetime 2018-05-25T11:03:59+0800
+ */
+ public function Banner()
+ {
+ // 返回数据
+ $this->ajaxReturn(L('common_operation_success'), 0, BannerService::Home());
+ }
}
?>
\ No newline at end of file
diff --git a/service/Application/Service/BannerService.class.php b/service/Application/Service/BannerService.class.php
index 22be02335..e0d07a6d6 100755
--- a/service/Application/Service/BannerService.class.php
+++ b/service/Application/Service/BannerService.class.php
@@ -33,7 +33,6 @@ class BannerService
$v['images_url'] = $images_host.$v['images_url'];
$v['jump_url'] = empty($v['jump_url']) ? null : $v['jump_url'];
}
- $result['banner'] = $banner;
}
return $banner;
}