diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/README.md b/README.md index 9ba5b7f..f398597 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # five - +![截图](./food.jpg) diff --git a/app.js b/app.js new file mode 100644 index 0000000..1ed57c4 --- /dev/null +++ b/app.js @@ -0,0 +1,19 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + } + }) + }, + globalData: { + userInfo: null + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..b3cb4aa --- /dev/null +++ b/app.json @@ -0,0 +1,14 @@ +{ + "pages": [ + "pages/shoplist/shoplist" + ], + "window": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "Weixin", + "navigationBarBackgroundColor": "#ffffff" + }, + "style": "v2", + "componentFramework": "glass-easel", + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents" +} diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..06c6fc9 --- /dev/null +++ b/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/food.jpg b/food.jpg new file mode 100644 index 0000000..0dcfc6a Binary files /dev/null and b/food.jpg differ diff --git a/pages/shoplist/shoplist.js b/pages/shoplist/shoplist.js new file mode 100644 index 0000000..5073ebd --- /dev/null +++ b/pages/shoplist/shoplist.js @@ -0,0 +1,126 @@ +// pages/shoplist/shoplist.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopList:[], + }, + listData:{ + page:1, + pageSize:10, + total:0 + }, + + getShopList:function(cb){ + this.isLoading=true + wx.showLoading({ + title: '数据加载中...', + }) + + wx.request({ + url: 'http://127.0.0.1:3000/data', + method:'GET', + data:{ + page:this.listData.page, + pageSize:this.listData.pageSize + }, + success:res=>{ + console.log(res) + this.setData({ + shopList:[...this.data.shopList,...res.data] + }) + this.listData.total=res.header['X-Total-Count']-0 + }, + complete:()=>{ + wx.hideLoading() + this.isLoading=false + cb&&cb() + } + }) + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad:function() { + this.getShopList() + }, + onReachBottom:function(){ + if(this.listData.page*this.listData.pagesize>=this.listData.total){ + return wx.showToast({ + title: '数据加载完毕', + icon:'none' + }) + } + if(this.isLoading){ + return + } + ++this.listData.page + this.getShopList() + }, + isLoading:false, + + onPullDownRefresh:function(){ + this.setData({ + shopList:[] + }) + this.listData.page=1 + this.listData.total=0 + this.getShopList(()=>{ + wx.stopPullDownRefresh() + }) + }, + + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/shoplist/shoplist.json b/pages/shoplist/shoplist.json new file mode 100644 index 0000000..458ba23 --- /dev/null +++ b/pages/shoplist/shoplist.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "美食", + "onReachBottomDistance": 200 +} \ No newline at end of file diff --git a/pages/shoplist/shoplist.wxml b/pages/shoplist/shoplist.wxml new file mode 100644 index 0000000..111789a --- /dev/null +++ b/pages/shoplist/shoplist.wxml @@ -0,0 +1,13 @@ + + + + + + + + {{item.name}} + 电话:{{tools.splitPhone(item.phone)}} + 地址:{{item.address}} + 营业时间:{{item.businessHours}} + + \ No newline at end of file diff --git a/pages/shoplist/shoplist.wxss b/pages/shoplist/shoplist.wxss new file mode 100644 index 0000000..7a3ae4d --- /dev/null +++ b/pages/shoplist/shoplist.wxss @@ -0,0 +1,28 @@ +/* pages/shoplist/shoplist.wxss */ +/* pages/shoplist/shoplist.wxss */ +.shop-item { + display: flex; + padding: 15rpx; + border: 1rpx solid #efefef; + border-radius: 8rpx; + margin: 15rpx; + box-shadow: 1rpx 1rpx 15rpx #ddd; +} + +.thumb image { + width: 250rpx; + height: 250rpx; + display: block; + margin-right: 15rpx; +} + +.info { + display: flex; + flex-direction: column; + justify-content: space-around; + font-size: 24rpx; +} + +.shop-title { + font-weight: bold; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..686e8d3 --- /dev/null +++ b/project.config.json @@ -0,0 +1,28 @@ +{ + "compileType": "miniprogram", + "libVersion": "trial", + "packOptions": { + "ignore": [], + "include": [] + }, + "setting": { + "coverView": true, + "es6": true, + "postcss": true, + "minified": true, + "enhance": true, + "showShadowRootInWxmlPanel": true, + "packNpmRelationList": [], + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + } + }, + "condition": {}, + "editorSetting": { + "tabIndent": "auto", + "tabSize": 2 + }, + "appid": "wxc15fead6ca65fb7b" +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..33d8f19 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,8 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "study", + "setting": { + "compileHotReLoad": true, + "urlCheck": false + } +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/utils/tools.wxs b/utils/tools.wxs new file mode 100644 index 0000000..84e34af --- /dev/null +++ b/utils/tools.wxs @@ -0,0 +1,13 @@ +function splitPhone(str){ + if(str.length!==11){ + return str + } + var arr=str.split('') + arr.splice(3,0,'-') + arr.splice(8,0,'-') + return arr.join('') +} + +module.exports={ + splitPhone:splitPhone +} \ No newline at end of file diff --git a/服务器端/data.json b/服务器端/data.json new file mode 100644 index 0000000..f3a1e02 --- /dev/null +++ b/服务器端/data.json @@ -0,0 +1 @@ +[{"id":1,"image":"http://127.0.0.1:3000/deal/2846ed948e95eef4c4d50edaf52a483432023.jpg","name":"宫廷月亮虾饼","phone":"15530710686","address":"任丘市裕华中路与会战道交叉口东南角蕾莎汇生活4层","businessHours":"周一至周日10:00-21:00"},{"id":2,"image":"http://127.0.0.1:3000/deal/c23c7c29e74602f9939158c3f3e21fda141581.jpg","name":"第1佳大鸡排(蕾莎店)","phone":"18732727277","address":"任丘市裕华西路与会战北道路口东南角蕾莎汇生活4楼小吃街","businessHours":"周一至周日08:30-22:30"},{"id":3,"image":"http://127.0.0.1:3000/deal/4e01539cd10265284b7b895746aea54836686.jpg","name":"口袋鸡排","phone":"13582628110","address":"任丘市裕华中路与会战北道东南角,蕾莎汇生活4层小吃街","businessHours":"周一至周日08:30-22:30"},{"id":4,"image":"http://127.0.0.1:3000/deal/ecfae46d44390d0fad40b4dacbd04213334496.jpg","name":"好食客自助","phone":"0317-8565866","address":"南皮县光明中路烈士陵园北200米路西","businessHours":"周一至周日08:30-22:30"},{"id":5,"image":"http://127.0.0.1:3000/deal/c40ee7af26d65a44626f7cc905e2c7c3117336.jpg","name":"好再来蛋糕房","phone":"13011996119","address":"东光县老十字街南30米路西","businessHours":"周一至周日08:30-22:30"},{"id":6,"image":"http://127.0.0.1:3000/deal/8ce591879123fe1dcf6d48c022c7bd8f260331.jpg","name":"食客大王(泰昌店)","phone":"13343175919","address":"献县新华路泰昌购物中心一楼二期西侧","businessHours":"周一至周日08:30-22:30"},{"id":7,"image":"http://127.0.0.1:3000/deal/c23c7c29e74602f9939158c3f3e21fda141581.jpg","name":"d第1佳大鸡排(渤海路店)","phone":"15832782698","address":"任丘市渤海中路新绿洲时代广场对面","businessHours":"周一至周日09:30-20:00"},{"id":8,"image":"http://127.0.0.1:3000/apiback/9f7fc7c9e7dca62deb8c8e297ca4686b70710.jpg","name":"Shen寿司(颐和新世界店)","phone":"0317-3061878","address":"运河区市场街道水月寺街1号南颐和新世界A2-185号(近新华路老华北商厦颐和新世界)","businessHours":"每天10:30-20:30"},{"id":9,"image":"http://127.0.0.1:3000/deal/a684723c1ccbb89675ac14c89ce203a513606.jpg","name":"酒窝甜品","phone":"0317-5699886","address":"任丘市会战北道与裕华中路交叉口蕾莎汇生活5层","businessHours":"周一至周日09:00-21:00"},{"id":10,"image":"http://127.0.0.1:3000/deal/8d154dd60be1cb05d7aef075a3e46765121513.jpg","name":"韩式石锅拌饭","phone":"15350777649","address":"泊头市解放西路上河城B区13-10号底商(信誉楼西南方向100米,清真海鲜城东100米)","businessHours":"周一至周日08:30-22:30"},{"id":11,"image":"http://127.0.0.1:3000/deal/0f6bbcb4b9f37de4b4a875d314175d25109824.jpg","name":"福源祥黄焖鸡米饭","phone":"13785770681","address":"运河区黄河路33号荣盛广场5楼美食广场内","businessHours":"周一至周日08:30-22:30"},{"id":12,"image":"http://127.0.0.1:3000/deal/39ac88a1f8ef7c4686019c206da0766536494.jpg","name":"N多寿司(任丘店)","phone":"0317-2212595","address":"任丘市京开道新华路办事处对过(京开购物商城南300米)","businessHours":"周一至周日08:00-21:00"},{"id":13,"image":"http://127.0.0.1:3000/deal/2f6a1aae6e6a72c05b89b65b3c0d90f446665.jpg","name":"昆仑时代天街铁板烧","phone":"0317-2912222","address":"任丘市燕山南道与泰山南道交叉口东南方向600米(东风美食街后街昆仑时代天街)","businessHours":"周一至周日10:00-22:00"},{"id":90,"image":"http://127.0.0.1:3000/deal/0339a1bb9e5e3bb59350d15af9847bd0147857.jpg","name":"重庆秦妈火锅店(御河路店)","phone":"0317-2038777","address":"运河区御河路新天厨东面(近新天厨)","businessHours":"周一至周日10:00-20:30"},{"id":91,"image":"http://127.0.0.1:3000/deal/e724e21efcaa3219e38497b340e08d01153620.jpg","name":"食点伴","phone":"0317-3593666","address":"运河区解放东路南湖公园对过(云顶KTV2楼)","businessHours":"周一至周日08:30-22:30"},{"id":92,"image":"http://127.0.0.1:3000/deal/0de97931592d5f006a713ce2f22b41a826964.jpg","name":"陈阿婆重庆绿色鱼火锅","phone":"0317-7950777","address":"吴桥县太行道百盛庄园对面","businessHours":"周一至周日08:30-22:30"},{"id":93,"image":"http://127.0.0.1:3000/deal/169bab75ef27222be4b56f8229c213cb128037.jpg","name":"巫山烤全鱼(解放西路店)","phone":"0317-2040401","address":"运河区解放西路颐和文园门市六区1层1231铺","businessHours":"11:00-14:0016:30-20:30"},{"id":94,"image":"http://127.0.0.1:3000/deal/484a437d64fff67e051fe254d7395cad121490.jpg","name":"蜀哈哈麻辣香锅","phone":"18732731713","address":"运河区荣盛广场5楼","businessHours":"周一至周日08:30-22:30"},{"id":95,"image":"http://127.0.0.1:3000/deal/__46146569__6411830.jpg","name":"渔家瓦舍(荣盛店)","phone":"0317-2135757/18631709788","address":"运河区黄河西路33号荣盛广场5楼D区","businessHours":"周一至周日11:00-21:00"},{"id":96,"image":"http://127.0.0.1:3000/deal/ea766dbba77f00bd37643c9697bc01c8153096.jpg","name":"魔锅坊麻辣香锅(沧州旗舰店)","phone":"0317-5690200","address":"运河区御河路御河新城103号门市","businessHours":"周一至周日09:30-14:00"},{"id":97,"image":"http://127.0.0.1:3000/deal/91c1f50b978a6b5c2850c7b4f4577fe637117.jpg","name":"夹层客汉堡","phone":"0317-2711010","address":"任丘市华油商业街前街东头往西20米路北(原川合顺麻辣香锅地点)","businessHours":"周一至周日08:30-22:30"},{"id":98,"image":"http://127.0.0.1:3000/deal/8286612e525aee2cc83760bbe2ff3c7b106503.jpg","name":"辣有道麻辣香锅","phone":"15720487955","address":"运河区朝阳西路颐和文园中街1236号","businessHours":"周一至周日08:30-22:30"},{"id":99,"image":"http://127.0.0.1:3000/deal/__45049923__6050023.jpg","name":"金利来蛋糕店(颐和文园第一总店)","phone":"0317-2041379/15532769273","address":"运河区解放西路颐和文园南侧","businessHours":"周一至周日08:00-21:00"},{"id":100,"image":"http://127.0.0.1:3000/deal/99b0a33bff1190385b53405dfd5fcc8628228.jpg","name":"多味蛋糕店","phone":"0317-2255071","address":"任丘市裕华西路4号","businessHours":"周一至周日08:30-22:30"},{"id":101,"image":"http://127.0.0.1:3000/deal/32a178b1a223a52301be30287aaa9bc136898.jpg","name":"串串厨房","phone":"0317-3333221","address":"任丘市裕华中路与会战北道交叉口蕾莎汇生活4层","businessHours":"周一至周日08:30-22:30"},{"id":102,"image":"http://127.0.0.1:3000/deal/acb1b6e571229803ddcbc48708020f38147357.jpg","name":"富华肥牛城","phone":"0317-8266665","address":"泊头市红旗大街北段","businessHours":"周一至周日08:30-22:30"},{"id":103,"image":"http://127.0.0.1:3000/deal/e5d43f4230aec5444fe72160de740f31119005.jpg","name":"福面道","phone":"18232760805","address":"运河区御河路御河新城南门天厨饭店东150米路北","businessHours":"周一至周日08:30-22:30"},{"id":104,"image":"http://127.0.0.1:3000/deal/3057d6e185181f1a4819424b2a3fa56f118050.jpg","name":"京小面","phone":"13082179139","address":"运河区颐和新世界A1-159,华北商厦东后门对面","businessHours":"周一至周日08:30-22:30"},{"id":105,"image":"http://127.0.0.1:3000/deal/e88d92d039eb53d084a307a886d04611102578.jpg","name":"玛格利塔现烤批萨(泊头店)","phone":"0317-5666066","address":"泊头市建设街泊信商厦西门斜对过","businessHours":"周一至周日08:30-22:30"},{"id":106,"image":"http://127.0.0.1:3000/deal/2ebad3638ae63edd7c4c1d8033d578ec119900.jpg","name":"部落格干锅鸡","phone":"18732718098","address":"泊头市八粮站十字路口东行200米路北","businessHours":"周一至周日08:30-22:30"},{"id":107,"image":"http://127.0.0.1:3000/deal/a56133247578dadd95f444ff6315f0e134886.jpg","name":"后街时光咖啡","phone":"0317-2885988","address":"任丘市东风美食街后街乐库KTV北正对面","businessHours":"周一至周日08:30-22:30"},{"id":108,"image":"http://127.0.0.1:3000/deal/f69589ef518f9b264b21005bdcf683b4102030.jpg","name":"麦德客欢乐餐厅(吴桥店)","phone":"0317-7279176","address":"吴桥县长江路信发商厦东侧门市","businessHours":"周一至周日08:30-22:30"},{"id":109,"image":"http://127.0.0.1:3000/deal/c0609cbcfd1f1a95256fe25dc30d9238119711.jpg","name":"玛格利塔现烤披萨(水月寺店)","phone":"0317-3567772","address":"运河区水月寺大街刺绣厂门市楼A座2号(金豪大饭店南侧,德善饭庄对面)","businessHours":"周一至周日08:30-22:30"},{"id":110,"image":"http://127.0.0.1:3000/deal/843f3a97e4c2ec24888a0501b3ccda9198016.jpg","name":"N多寿司(道东店)","phone":"0317-5697626","address":"新华区千童大道与黄河路交叉口东南角","businessHours":"周一至周日09:30-20:00"},{"id":111,"image":"http://127.0.0.1:3000/deal/aa3906333aed718ad8cf3c2a9ca4a7c3346489.jpg","name":"味好美烘焙店","phone":"0317-8570588","address":"黄骅市信誉楼大街南段华贸商厦一楼","businessHours":"周一至周日08:30-22:30"},{"id":112,"image":"http://127.0.0.1:3000/deal/db80ebddd202b27bba28d7cd1ae9273629749.jpg","name":"爱情麻辣烫","phone":"13513485984","address":"肃宁县清源街与武垣路交叉口南30米路西(耀华商厦西侧德克士正对过)","businessHours":"周一至周日11:00-20:30"},{"id":113,"image":"http://127.0.0.1:3000/deal/c274f0927931d6be76b156cccf14ab7c252781.jpg","name":"晶晶奶糕店","phone":"15031717124","address":"任丘市文化道与裕华中路十字路口南行100米路东","businessHours":"周一至周日08:30-22:30"},{"id":114,"image":"http://127.0.0.1:3000/deal/f78bc7c15702b7f3fe7021ebf17494ef357509.jpg","name":"大街小巷","phone":"0317-8071777","address":"运河区水月寺街9-12号(8路公交站牌处)","businessHours":"周一至周日08:30-22:30"},{"id":115,"image":"http://127.0.0.1:3000/deal/ffead6264d34e3c0f0ba3b33e55e57ed109930.jpg","name":"德克士(建新店)","phone":"0317-3165832","address":"运河区清池大道建新大厦正门底商","businessHours":"周一至周日08:30-22:30"},{"id":116,"image":"http://127.0.0.1:3000/deal/a8b49f497c9b7fc68449000711f587c5117154.jpg","name":"和米堂","phone":"0317-2023765","address":"新华区新华路华北商厦9楼(华北商厦)","businessHours":"周一至周日09:00-21:00"},{"id":117,"image":"http://127.0.0.1:3000/deal/1a71f6f0fc3370fe061d0894b530e71d94674.jpg","name":"提拉米酥烘培坊","phone":"0317-3370111","address":"任丘市会战北道蕾莎儿童海洋馆一楼底商","businessHours":"周一至周日08:30-22:30"},{"id":118,"image":"http://127.0.0.1:3000/deal/35a158f022bc41433fb2a94ef7b81477127695.jpg","name":"大嘴巴酸辣粉","phone":"15373386311/15373386211","address":"运河区老华北后身颐和新世界商业街","businessHours":"周一至周日08:30-22:30"},{"id":119,"image":"http://127.0.0.1:3000/poi/cc9138c67cf7cec2789a5b13bb7132dc43167.jpg","name":"N多寿司(千童购物中心店)","phone":"0317-6299882","address":"盐山县北大街17号(千童购物中心1层化妆品东侧)","businessHours":"周一至周日08:30-20:00"},{"id":120,"image":"http://127.0.0.1:3000/deal/2cd60840a9952e6366e99202881d1c57152524.jpg","name":"乐堡士(交河店)","phone":"0317-5660936","address":"泊头市交河镇钟楼街移动南侧","businessHours":"周一至周日09:00-22:00"},{"id":121,"image":"http://127.0.0.1:3000/deal/4cbf9155ddf4075df7c442945de5277e396004.jpg","name":"美丽年华蛋糕坊","phone":"0317-4626693","address":"献县东大街工商银行东行50米路南(春天药房西邻)","businessHours":"周一至周日08:30-22:30"},{"id":122,"image":"http://127.0.0.1:3000/deal/6b41b8ef2edb71df237dc84ad97793fe484797.jpg","name":"咕噜咕噜涮涮锅(盐百商厦店)","phone":"15175852679/15028782192","address":"运河区南门步行街盐百南门商厦西侧","businessHours":"周一至周日08:30-22:30"},{"id":123,"image":"http://127.0.0.1:3000/deal/e68910d95f9c4056e2066a23e708f35b43639.jpg","name":"DF冰激凌(蕾莎店)","phone":"13473125087","address":"任丘市裕华中路与会战北道交叉口蕾莎城市广场5楼(裕华中路与会战北道交叉口往南50米路东)","businessHours":"周一至周日08:30-22:30"},{"id":124,"image":"http://127.0.0.1:3000/deal/99a6e8bb98bed7c724ca63e091693d94139085.jpg","name":"爵士牛排","phone":"0317-4618168","address":"献县乐寿镇泰昌购物广场2期楼下","businessHours":"周一至周日08:30-22:30"},{"id":125,"image":"http://127.0.0.1:3000/deal/b4e94fa5cdb1838bc362ea5b985ba1ae92457.jpg","name":"广州味道面包工坊","phone":"0317-7630802","address":"东光县府前大街81号","businessHours":"周一至周日11:30-23:00"},{"id":126,"image":"http://127.0.0.1:3000/deal/0306a219ae56c2a8bd93fb91a9b034e6336340.jpg","name":"米斯韦尔烘焙坊","phone":"0317-4616877/18732782826","address":"献县平安大街泰昌路口曲美往东50米","businessHours":"周一至周日07:00-20:30"},{"id":127,"image":"http://127.0.0.1:3000/deal/__47190232__7563879.jpg","name":"顶好蛋糕(千童大道店)","phone":"13313178393/13784769718","address":"新华区千童大道43号(原东安商厦对面)","businessHours":"周一至周日09:00-18:00"},{"id":128,"image":"http://127.0.0.1:3000/deal/9dc80616b6178221cf61df4b9dc0d1d929640.jpg","name":"阿姨奶茶(蕾莎店)","phone":"15632709694","address":"任丘市裕华路与会战道交叉口东南角蕾莎汇生活四层","businessHours":"周一至周日09:00-21:00"},{"id":129,"image":"http://127.0.0.1:3000/deal/b7a446c030060222597d454ccb3e29b2136826.jpg","name":"一绝冒菜","phone":"18733766101","address":"运河区荣盛广场5楼大地影院北侧(原伊堤湾)","businessHours":"周一至周日10:30-21:00"},{"id":130,"image":"http://127.0.0.1:3000/deal/bf53d96ec2272d19d087d72d67df565f37970.jpg","name":"第1佳大鸡排","phone":"13785736435","address":"河间市长卿路北街长青网吧对面(东北烧烤南面)","businessHours":"周一至周日08:30-22:30"},{"id":131,"image":"http://127.0.0.1:3000/deal/bfeb6437bbb3a125bee67473c52de9a978845.jpg","name":"N多寿司(老华北店)","phone":"15226754177","address":"运河区老华北商厦八楼(近水月大街红达小牛)","businessHours":"周一至周日09:30-21:00"},{"id":132,"image":"http://127.0.0.1:3000/deal/e6ddb4f0532fc1e028e5d3b5a62ef71535980.jpg","name":"荣兴斋(迎宾店)","phone":"0317-5021239/6121788","address":"肃宁县武垣路57号","businessHours":"周一至周日08:30-22:30"},{"id":133,"image":"http://127.0.0.1:3000/deal/3e028a516f458b38485205acb1412de435804.jpg","name":"玛格利塔现烤批萨","phone":"0317-5335899","address":"黄骅市信誉楼大街96号(西五金正对面)","businessHours":"周一至周日09:00-21:00"},{"id":134,"image":"http://127.0.0.1:3000/deal/9f2b7f9e012fcbdfeac7933183c33517135253.jpg","name":"御膳鸡煲(颐和文园店)","phone":"15227537375/15175714745","address":"运河区解放西路颐和文园东街东门往南20米","businessHours":"周一至周日08:30-22:30"},{"id":135,"image":"http://127.0.0.1:3000/deal/f077a13f324aaf0db0b75163eaf29f3d110649.jpg","name":"惠民重庆老火锅","phone":"0317-2360688/3390100","address":"任丘市渤海东路惠民酒店东侧(战前小区旁边)","businessHours":"周一至周日08:30-22:30"},{"id":136,"image":"http://127.0.0.1:3000/deal/7d9cd35c3e1815830cd1376e71faa686108274.jpg","name":"川町家","phone":"13333076371","address":"新华区新华东路老华北八楼","businessHours":"周一至周日全天;"},{"id":137,"image":"http://127.0.0.1:3000/deal/9aa8f3d00cd6caae6bd506ba1d9a1e69117204.jpg","name":"德克士聪明兔餐厅(新华中路店)","phone":"0317-2123156","address":"运河区新华中路181号(第八中学对面)","businessHours":"周一至周日06:30-22:00"},{"id":138,"image":"http://127.0.0.1:3000/shaitu/71143bedc401441202d6cab04a04cf85108784.jpg","name":"三清洞摩西韩国年糕火锅(荣盛店)","phone":"15632786900","address":"运河区黄河路与开元大道交叉口向西200米路南荣盛国际购物广场五楼5576铺","businessHours":"周一至周日08:30-22:30"},{"id":139,"image":"http://127.0.0.1:3000/deal/e72d342d802c410f6622f5e36f265176312462.jpg","name":"红苹果烘焙坊","phone":"0317-6010899","address":"献县本斋路增琪幼儿园斜对面","businessHours":"周一至周日08:30-22:30"},{"id":140,"image":"http://127.0.0.1:3000/deal/76eb2d45ecdf7c82e0e5fb94059d7ed927134.jpg","name":"麦德客欢乐餐厅(泊头店)","phone":"0317-8262656","address":"泊头市解放西路376号(信誉楼西行100米路南)","businessHours":"周一至周日08:30-21:30"},{"id":141,"image":"http://127.0.0.1:3000/deal/__45042322__1416996.jpg","name":"盛客莱火锅","phone":"0317-3077766","address":"运河区光荣路与金街步行街交叉口(盐百商厦南门对面)","businessHours":"周一至周日10:00-22:00"},{"id":142,"image":"http://127.0.0.1:3000/deal/c2ce13dc00d3a99551c4ceed3a335b60136735.jpg","name":"王品火锅城","phone":"0317-2371946","address":"任丘市燕山南道五洲酒店东门南行20米路东","businessHours":"周一至周日09:00-22:00"},{"id":143,"image":"http://127.0.0.1:3000/deal/5a66ad072d784e828172c6ac23df9f26112275.jpg","name":"巴莉蜜语","phone":"0317-8288860/15127789063","address":"泊头市红旗大街与解放东路交叉口(农业银行对面)","businessHours":"周一至周日08:30-22:30"},{"id":144,"image":"http://127.0.0.1:3000/deal/2a4ca81a2a6e43649c815a9a44ce891f362231.jpg","name":"亚马逊自助主题餐厅(颐和店)","phone":"0317-2206788/2209788","address":"运河区解放西路颐和国际B座底商(全聚德左侧)","businessHours":"周一至周日08:30-22:30"},{"id":145,"image":"http://127.0.0.1:3000/deal/d7377b700bd01dfcfdcf3bb20be32949112265.jpg","name":"乐克汉堡","phone":"15369836770","address":"泊头市建设街与解放西路交叉口西北角(泊信商厦西门对过)","businessHours":"周一至周日08:30-22:30"},{"id":146,"image":"http://127.0.0.1:3000/deal/37628d111617d3b7a1565996ed059927131383.jpg","name":"尚客火锅鸡","phone":"18333016868","address":"任丘市东凉道口西行100米路南","businessHours":"周一至周日11:00-14:3016:30-23:30"},{"id":147,"image":"http://127.0.0.1:3000/deal/ac106e3c34373dbeb7ecdb11d0a9938337722.jpg","name":"状元烤猪蹄","phone":"0317-2862686","address":"任丘市会战北道与裕华中路交叉口东南角蕾莎汇生活4层小吃街","businessHours":"9:00-21:00"},{"id":148,"image":"http://127.0.0.1:3000/deal/fcc7c3ec2ba903cb4b75232e2b35db6650472.jpg","name":"肆月天时尚自选餐厅","phone":"0317-2106966","address":"运河区荣盛购物广场5楼","businessHours":"11:30-14:00,17:30-21:00"},{"id":149,"image":"http://127.0.0.1:3000/deal/0b4003327bef5c16677d26b904b3f3f0129083.jpg","name":"优乐自动餐厅(献县店)","phone":"18231758173","address":"献县泰昌路口南80米路西(泰昌家园斜对面泰昌购物一期北30米路西)","businessHours":"周一至周日11:00-21:00"},{"id":150,"image":"http://127.0.0.1:3000/deal/c9f1c341821b4656f81bfb976cbfa55c32496.jpg","name":"最高鸡密","phone":"15631772290","address":"任丘市裕华东路与文化道交口南行200米东侧","businessHours":"周一至周日08:30-21:30"},{"id":151,"image":"http://127.0.0.1:3000/deal/ad87ab62a9daeb88e67e4e9a2ec97323141365.jpg","name":"黄记煌三汁焖锅(荣盛国际店)","phone":"0317-2135399","address":"运河区黄河西路与开元大道交口荣盛国际购物广场5楼","businessHours":"周一至周日10:30-21:30"},{"id":152,"image":"http://127.0.0.1:3000/deal/__48385594__1448848.jpg","name":"日月潭(华北店)","phone":"15369794957","address":"新华区华北商厦新华路店地下超市东入口","businessHours":"周一至周日08:00-20:00"},{"id":153,"image":"http://127.0.0.1:3000/deal/e94d919267508bfcfb1b629d8727c17f106610.jpg","name":"韩釜宫(新华路店)","phone":"0317-3770888","address":"新华区新华路老华北西侧国贸大厦6楼","businessHours":"周一至周日11:00-14:0017:00-21:00"},{"id":154,"image":"http://127.0.0.1:3000/deal/68405bb25b7510424aa45b36016e2dcf124862.jpg","name":"T3在首尔","phone":"13832712808","address":"运河区老华北后身一中前街,颐和新世界东侧,一幼对面A1-128号","businessHours":"周一至周日08:30-22:30"},{"id":155,"image":"http://127.0.0.1:3000/deal/55feb9a557b54ab5594b3efdc51b6e8f277046.jpg","name":"富丽园自助烤肉城","phone":"0317-7577888/7971818","address":"运河区新华路老华北往南300米好伦哥对面(佰顺隆数码广场4楼)","businessHours":"周一至周日08:30-22:30"},{"id":156,"image":"http://127.0.0.1:3000/deal/9cdf099d87d0dbc027fe8c1ccae6017d104798.jpg","name":"风情汉斯(东光店)","phone":"0317-7777799","address":"东光县东光镇茧城大街富翔大酒店院内二楼","businessHours":"周一至周日08:30-22:30"}] \ No newline at end of file diff --git a/服务器端/index.js b/服务器端/index.js new file mode 100644 index 0000000..c3a91f3 --- /dev/null +++ b/服务器端/index.js @@ -0,0 +1,26 @@ +let fs = require('fs'); +var express = require('express') + +// 读取JSON数据 +let jsonStr = fs.readFileSync('./data.json', { + encoding: 'utf8' +}); + +let data = JSON.parse(jsonStr); + +// 创建Web服务器对象 +var app = express(); + +// 静态资源处理 +app.use(express.static('public')); + +app.get('/data', (req, res) => { + let [ ...arr ] = data + let start = (req.query.page - 1) * req.query.pageSize; + res.setHeader('X-Total-Count', data.length); + res.send(arr.splice(start, req.query.pageSize)); +}); + +app.listen(3000, () => { + console.log('服务器启动成功,地址为:http://127.0.0.1:3000'); +});