diff --git a/app.js b/app.js index d27dc5b..53e31aa 100644 --- a/app.js +++ b/app.js @@ -3,8 +3,8 @@ var restAjax = require('utils/restAjax.js'); var dialog = require('utils/dialog.js'); // + 'https://www.xzszwhy.cn/usercenter' App({ - loginUrl:restAjax.baseUrl, - usercenterUrl:restAjax.baseUrl, + loginUrl: restAjax.baseUrl, + usercenterUrl: restAjax.baseUrl, newsUrl: restAjax.baseUrl, newsContentUrl: restAjax.baseUrl, libraryUrl: restAjax.baseUrl, @@ -16,7 +16,9 @@ App({ liveUrl: restAjax.baseUrl, liveRecordUrl: restAjax.baseUrl, socialUrl: restAjax.baseUrl, + shopUrl: restAjax.url + "xzshop", restAjax: restAjax, + shopImgUrl: restAjax.url + "xzshop/route/file/download/true/", dialog: dialog, onLaunch: function () { // 展示本地存储能力 @@ -53,7 +55,7 @@ App({ }, globalData: { userInfo: null, - curLat:-1, - curLng:-1, + curLat: -1, + curLng: -1, } }) \ No newline at end of file diff --git a/app.json b/app.json index 7f0eea5..0fbed9d 100644 --- a/app.json +++ b/app.json @@ -37,8 +37,15 @@ "pages/myActivity/myActivity", "pages/myVolunteerTeam/myVolunteerTeam", "pages/myVolunteerActivity/myVolunteerActivity", - "pages/serviceActivityDetail/serviceActivityDetail" + "pages/serviceActivityDetail/serviceActivityDetail", + "pages/shop/shopcategory" ], + "subPackages": [{ + "root": "subpages/goodslist", + "pages": [ + "goodslist" + ] + }], "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#9F1512", @@ -68,9 +75,9 @@ "selectedIconPath": "images/venue-on.png" }, { - "pagePath": "pages/heritage/heritage", + "pagePath": "pages/shop/shopcategory", "iconPath": "images/culture.png", - "text": "文化", + "text": "商城", "selectedIconPath": "images/culture-on.png" }, { @@ -81,6 +88,9 @@ } ] }, + "usingComponents": { + "page-loading": "/components/loading/pageloading" + }, "permission": { "scope.userLocation": { "desc": "你的位置信息将用于您当前所在位置" diff --git a/components/loading/pageloading.js b/components/loading/pageloading.js new file mode 100644 index 0000000..7c20516 --- /dev/null +++ b/components/loading/pageloading.js @@ -0,0 +1,23 @@ +// components/loading/pageloading.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/components/loading/pageloading.json b/components/loading/pageloading.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/loading/pageloading.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/loading/pageloading.wxml b/components/loading/pageloading.wxml new file mode 100644 index 0000000..2115a2b --- /dev/null +++ b/components/loading/pageloading.wxml @@ -0,0 +1,5 @@ + + + + 加载中... + \ No newline at end of file diff --git a/components/loading/pageloading.wxss b/components/loading/pageloading.wxss new file mode 100644 index 0000000..f192973 --- /dev/null +++ b/components/loading/pageloading.wxss @@ -0,0 +1,23 @@ +/* components/loading/pageloading.wxss */ +.page-loading-box { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 1); + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.page-loading-box image { + width: 128rpx; + height: 128rpx; +} + +.page-loading-box .text { + margin-top: 20rpx; + font-size: 28rpx; +} \ No newline at end of file diff --git a/images/ic_empty_data.png b/images/ic_empty_data.png new file mode 100644 index 0000000..791e76e Binary files /dev/null and b/images/ic_empty_data.png differ diff --git a/images/loading-small.gif b/images/loading-small.gif new file mode 100644 index 0000000..5ea92d7 Binary files /dev/null and b/images/loading-small.gif differ diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 115657e..1cd2470 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -85,7 +85,7 @@ - + {{item.newsContentTitle}} @@ -104,13 +104,13 @@ - + {{item.newsContentTitle}} - + 来源:{{item.newsContentResource}} diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 64d5f2b..3c1f6b8 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -94,6 +94,7 @@ } .news-big-pic image{ width: 100%; + height: 380rpx; } .news-small-pic image{ width: 30%; diff --git a/pages/newsList/newsList.wxml b/pages/newsList/newsList.wxml index 575348a..a8c8f75 100644 --- a/pages/newsList/newsList.wxml +++ b/pages/newsList/newsList.wxml @@ -38,7 +38,7 @@ - + {{item.newsContentTitle}} @@ -57,13 +57,13 @@ - + {{item.newsContentTitle}} - + 来源:{{item.newsContentResource}} diff --git a/pages/newsList/newsList.wxss b/pages/newsList/newsList.wxss index a876635..b27cd4d 100644 --- a/pages/newsList/newsList.wxss +++ b/pages/newsList/newsList.wxss @@ -131,6 +131,7 @@ } .news-big-pic image{ width: 100%; + height: 380rpx; } .news-big-pic image.play-btn{ position: absolute; diff --git a/pages/shop/shopcategory.js b/pages/shop/shopcategory.js new file mode 100644 index 0000000..833d7a7 --- /dev/null +++ b/pages/shop/shopcategory.js @@ -0,0 +1,57 @@ +// pages/shop/shopcat.js +var app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + categoryOneList: [], + categorySeconList: [], + currentIndex: 0, + isHidePageLoading: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getCategroyList(); + }, + getCategroyList() { + var _self = this + app.restAjax.get(app.restAjax.path('{shopUrl}/app/category/listztreerelease', [app.shopUrl]), null, null, function (code, data) { + if (data.length == 0) { + app.dialog.msg('暂无数据'); + return; + } + console.log(data) + _self.setData({ + categoryOneList: data, + categorySeconList: data[0].subList, + isHidePageLoading: true + }) + }, function (code, data) { + app.dialog.msg(data.msg); + _self.setData({ + isHidePageLoading: true + }) + }, function () { + wx.hideLoading(); + }) + }, + chooseOne(event) { + var index = event.currentTarget.dataset.index + var _self = this; + this.setData({ + currentIndex: index, + categorySeconList: _self.data.categoryOneList[index].subList + }) + }, + goList(e) { + var id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/subpages/goodslist/goodslist?id=' + id, + }) + } +}) \ No newline at end of file diff --git a/pages/shop/shopcategory.json b/pages/shop/shopcategory.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/shop/shopcategory.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/shop/shopcategory.wxml b/pages/shop/shopcategory.wxml new file mode 100644 index 0000000..e6eddb5 --- /dev/null +++ b/pages/shop/shopcategory.wxml @@ -0,0 +1,27 @@ + + + + + {{item.name}} + + + + + + {{item.name}} + > + + + + + {{it.name}} + + + + + 暂无数据 + + + + + \ No newline at end of file diff --git a/pages/shop/shopcategory.wxss b/pages/shop/shopcategory.wxss new file mode 100644 index 0000000..d40b742 --- /dev/null +++ b/pages/shop/shopcategory.wxss @@ -0,0 +1,112 @@ +/* pages/shop/shopcat.wxss */ +page { + height: 100%; + background: #f6f6f6; +} + +.container-box { + display: flex; + flex-direction: row; + width: 100%; + height: 100%; +} + +.container-box .left { + display: flex; + flex-direction: column; + width: 35%; + height: 100%; + margin-top: 10rpx; +} + +.category-item-default { + display: flex; + flex-direction: row; + padding: 10rpx 0rpx 5rpx 2rpx; + width: 100%; +} + + + +.category-item-active { + display: flex; + flex-direction: row; + padding: 10rpx 0rpx 5rpx 2rpx; + background: white; + width: 100%; +} + +.category-one-name { + margin-left: 20rpx; + padding: 10rpx 0rpx; + flex: 1; +} + + + + +.line { + background: #e70101; + width: 10rpx; + height: 100%; +} + +.container-box .right { + display: flex; + flex-direction: column; + width: 65%; +} + +.category-card { + margin: 10rpx 10rpx 10rpx 0rpx; + border-radius: 20rpx; + min-height: 300rpx; + background-color: white; + box-shadow: 5rpx 5rpx 5rpx 5rpx rgba(0, 0, 0, 0, 1); + padding: 10rpx; +} + +.category-two-name { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 10rpx; +} + +.category-thrid-box { + display: flex; + flex-direction: row; + margin-top: 20rpx; + justify-content: flex-start; + align-items: center; +} + +.category-thrid-item { + width: 33%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 30rpx; +} + +.category-thrid-item image { + width: 96rpx; + height: 96rpx; +} + +.category-empty { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + text-align: center; + align-self: center; + font-size: 30rpx; +} + +.category-empty image { + width: 96rpx; + height: 66rpx; +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..76b974f --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,4 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "libVersion": "2.30.0" +} \ No newline at end of file diff --git a/subpages/goodslist/goodslist.js b/subpages/goodslist/goodslist.js new file mode 100644 index 0000000..ee5b782 --- /dev/null +++ b/subpages/goodslist/goodslist.js @@ -0,0 +1,73 @@ +// pages/goodslist/goodslist.js +var app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + id: "" + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + id: options.id, + page: 1, + rows: 10, + keywords: "", + goodsList: [], + imgUrl: app.shopImgUrl, + hidePageLoading: false + }) + this.getGoodsList(); + }, + getGoodsList() { + var _self = this + var info = { + 'page': _self.data.page, + 'rows': _self.data.rows, + 'categoryId': _self.data.id, + 'keywords': _self.data.keywords + }; + app.restAjax.get(app.restAjax.path('{shopUrl}/app/shopgoods/solrrelease', [app.shopUrl]), info, null, function (code, data) { + if (data.rows.length == 0) { + app.dialog.msg('暂无数据'); + return; + } + _self.setData({ + goodsList: _self.data.goodsList.concat(data.rows), + hidePageLoading: true + }) + console.log(_self.data.goodsList) + wx.stopPullDownRefresh() + }, function (code, data) { + app.dialog.msg(data.msg); + wx.stopPullDownRefresh() + _self.setData({ + hidePageLoading: true + }) + }, function () { + wx.hideLoading(); + wx.stopPullDownRefresh() + }) + }, + //下拉刷新 + onPullDownRefresh() { + this.setData({ + page: 1, + goodsList: [] + }) + this.getGoodsList() + }, + //加载更多 + onReachBottom() { + var _self = this; + _self.setData({ + page: _self.data.page += 1 + }) + _self.getGoodsList() + } +}) \ No newline at end of file diff --git a/subpages/goodslist/goodslist.json b/subpages/goodslist/goodslist.json new file mode 100644 index 0000000..2f12723 --- /dev/null +++ b/subpages/goodslist/goodslist.json @@ -0,0 +1,8 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "商品", + "enablePullDownRefresh": true, + "backgroundColor": "#efefef", + "backgroundTextStyle": "dark", + "onReachBottomDistance": 150 +} \ No newline at end of file diff --git a/subpages/goodslist/goodslist.wxml b/subpages/goodslist/goodslist.wxml new file mode 100644 index 0000000..c681407 --- /dev/null +++ b/subpages/goodslist/goodslist.wxml @@ -0,0 +1,26 @@ + + + + + 搜索 + + + + + + {{item.goodsName}} + ¥ {{item.goodsPrice}} + + 销量:{{item.goodsSalesVolume}} + 评分:{{item.goodStar}} + {{item.goodsNotFreight ==1 ? '不包邮':'包邮'}} + + + {{item.shopName}} + + + + + + + \ No newline at end of file diff --git a/subpages/goodslist/goodslist.wxss b/subpages/goodslist/goodslist.wxss new file mode 100644 index 0000000..4323fd5 --- /dev/null +++ b/subpages/goodslist/goodslist.wxss @@ -0,0 +1,96 @@ +/* pages/goodslist/goodslist.wxss */ +.search-box { + position: fixed; + top: 0; + left: 0; + width: 100%; + padding: 20rpx 15rpx; + display: flex; + flex-direction: row; + background: #ffffff; +} + +.search-box input { + padding: 10rpx; + background: #f2f2f2; + border-radius: 20rpx; + width: 80%; + font-size: 28rpx; +} + +.search-box .btn { + padding: 10rpx; + color: black; +} + +.container-box { + margin-top: 110rpx; +} + +.goods-item { + display: flex; + flex-direction: row; + margin: 20rpx; +} + +.goods-content { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + padding: 0rpx 10rpx; +} + +.goods-name { + font-size: 28rpx; + color: #000000; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.goods-price { + font-size: 40rpx; + color: #e70606; + margin-top: 20rpx; +} + +.goods-type { + display: flex; + flex-direction: row; + margin-top: 10rpx; + +} + +.type-item { + background: #f2f2f2; + color: #e70606; + padding: 10rpx; + font-size: 20rpx; +} + +.type-item:nth-of-type(n+2) { + margin-left: 20rpx; +} + +.shop-name { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + font-size: 28rpx; + color: #5a5a5a; + margin-top: 20rpx; +} + +.shop-name .shop-icon { + width: 30rpx; + height: 30rpx; +} + +.goods-item image { + width: 240rpx; + height: 200rpx; +} \ No newline at end of file diff --git a/utils/restAjax.js b/utils/restAjax.js index 90eab16..80afdde 100644 --- a/utils/restAjax.js +++ b/utils/restAjax.js @@ -225,4 +225,5 @@ module.exports.params = getParamsArg; module.exports.path = buildPath; module.exports.escape = escape; module.exports.file = postFile; -module.exports.baseUrl='http://49.233.36.36:58099/xzszwhy'; \ No newline at end of file +module.exports.baseUrl='http://v3.xzszwhy.cn/xzszwhy'; +module.exports.url="http://v3.xzszwhy.cn/" \ No newline at end of file