├── .gitignore ├── App.vue ├── LICENSE ├── README.md ├── cloudfunctions-aliyun ├── api │ ├── index.js │ ├── models │ │ ├── home.js │ │ └── openid.js │ ├── package-lock.json │ └── package.json ├── common │ ├── response │ │ ├── index.js │ │ └── package.json │ └── utils │ │ ├── index.js │ │ └── package.json ├── db_init.json ├── send │ ├── config.json │ ├── index.js │ ├── package-lock.json │ └── package.json └── subscribe │ ├── index.js │ ├── package-lock.json │ └── package.json ├── components └── v-tabs │ ├── readme.md │ └── v-tabs.vue ├── docs ├── .vuepress │ ├── config.js │ └── public │ │ └── hero.png ├── README.md └── guide │ ├── README.md │ ├── cloud.md │ ├── ready.md │ └── static.md ├── examples ├── 微信图片_20201107150908.jpg ├── 微信图片_20201107150917.png ├── 微信图片_20201107150923.jpg ├── 微信图片_20201107150932.jpg ├── 微信图片_20201107150944.jpg ├── 微信图片_20201107150950.jpg ├── 微信图片_20201107163539.jpg ├── 微信图片_20201107163546.jpg ├── 微信图片_20201107165410.png └── 微信图片_20201107165417.jpg ├── main.js ├── manifest.json ├── pages.json ├── pages ├── index │ └── index.vue └── user │ └── user.vue ├── static ├── 11.png ├── all.png ├── coupon │ ├── 11.jpg │ ├── ele.png │ ├── ele_banner.png │ ├── ele_guosu.png │ ├── jd.png │ ├── meituan.png │ ├── meituan_banner.png │ ├── sanzhisongshu.png │ ├── vip.png │ └── vip_banner.png ├── demo.png ├── didi.jpg ├── ele.png ├── error.png ├── jd.png ├── meituan.png ├── right_h.png ├── tabbar │ ├── fuli.png │ ├── fuli_fill.png │ ├── home.png │ ├── home_fill.png │ ├── user.png │ └── user_fill.png ├── uni.ttf ├── user_hezuo.png ├── user_kefu.png ├── user_share.png ├── vip.png └── wx.png └── uni.scss /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | unpackage/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | 9 | # Editor directories and files 10 | .idea 11 | .vscode 12 | *.suo 13 | *.ntvs* 14 | *.njsproj 15 | *.sln 16 | manifest.json -------------------------------------------------------------------------------- /App.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [新]微信红包封面领取小程序:https://github.com/zwpro/redCover 2 | 3 | ### 更新日志 12.26 4 | 5 | 新增订阅功能 6 | 7 | 修改 cloudfunctions-aliyun/common/utils/index.js 中的 appid和secret参数,上传代码到云服务器即可 8 | 9 | 10 | ### 更新日志 11-30 11 | 新增uniCloud云开发,小程序数据可通过api更改。 12 | (如只需要数据写死在前端,可切换到静态数据分支 [no-api](https://github.com/zwpro/coupons/tree/no-api)) 13 | 14 | # 美团饿了吗CPS红包,别人领红包下单,你拿推广佣金 15 | 16 | 17 | 18 | 19 | ### 使用方法 20 | 21 | 源码为uniapp项目,需下载hbuilder导入项目打包,可编译成h5或小程序(跳转地址为小程序路径) 22 | 23 | [在线文档](http://lianghua.wxthe.com/docs/) 24 | 25 | 26 | ### 常见问题 27 | 1. 如何获取美团饿了吗的推广链接 28 | 29 | 美团联盟:https://union.meituan.com/ 30 | 31 | 饿了么、双十一:https://pub.alimama.com/ 32 | 33 | ​ 2.如何打包成小程序 34 | 35 | 编译成小程序的话,需要配置coupons里小程序路径 36 | 37 | 比如跳转饿了么小程序: 38 | 39 | ``` 40 | minapp: { 41 | appid: 'wxece3a9a4c82f58c9', 42 | path: 'pages/sharePid/web/index?scene=https://s.click.ele.me/wR9ecuu' 43 | } 44 | ``` 45 | 46 | 已上线案例: 47 | 48 | 49 | 50 | 51 | 52 | 如有线上案例或疑问,请提issue 53 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/api/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const response = require('response') 3 | const homeModel = require('./models/home') 4 | const getOpenId = require('./models/openid') 5 | exports.main = async (event, context) => { 6 | //event为客户端上传的参数 7 | console.log('event : ', event) 8 | var resp = {} 9 | //简单路由判断 10 | switch (event.path) { 11 | //首页 12 | case '/home': 13 | var homeModelTabs = await homeModel.tabs() 14 | resp.tabs = homeModelTabs.data 15 | var homeModelCoupons = await homeModel.coupons() 16 | resp.coupons = homeModelCoupons.data 17 | return response.success(resp) 18 | break; 19 | case '/openid': 20 | var openid = await getOpenId(event.queryStringParameters.jsCode) 21 | resp.openid = openid 22 | return response.success(resp) 23 | break; 24 | default: 25 | 26 | } 27 | //返回数据给客户端 28 | return response.success() 29 | }; 30 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/api/models/home.js: -------------------------------------------------------------------------------- 1 | const db = uniCloud.database(); 2 | 3 | var home = { 4 | tabs: () => { 5 | let tabs = db.collection('tab').get(); 6 | return tabs 7 | }, 8 | coupons: () => { 9 | let coupons = db.collection('coupon').orderBy("sort", "desc").get(); 10 | return coupons 11 | }, 12 | } 13 | 14 | module.exports = home; 15 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/api/models/openid.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // 后台获取openid 3 | const utils = require('utils') 4 | async function getOpenId(jsCode){ 5 | const appid = utils.APPID; 6 | const secret = utils.SECREAT; 7 | const url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appid + '&secret=' + secret + '&js_code=' + jsCode + '&grant_type=authorization_code'; 8 | console.log(url) 9 | const sendres = await uniCloud.httpclient.request(url, 10 | { 11 | data: {}, 12 | method: 'GET', 13 | contentType: 'json', 14 | dataType:"json", 15 | } 16 | ); 17 | console.log(sendres.data.openid); 18 | return sendres.data.openid; 19 | }; 20 | 21 | module.exports = getOpenId; -------------------------------------------------------------------------------- /cloudfunctions-aliyun/api/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "response": { 8 | "version": "file:../common/response" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "response": "file:../common/response", 14 | "utils": "file:../common/utils" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/common/response/index.js: -------------------------------------------------------------------------------- 1 | exports.success = (data = null, msg = 'success', code = 200) => { 2 | return { 3 | data, 4 | msg, 5 | code, 6 | } 7 | } 8 | exports.error = (data = null, msg = 'fail', code = 400) => { 9 | return { 10 | data, 11 | msg, 12 | code, 13 | } 14 | } -------------------------------------------------------------------------------- /cloudfunctions-aliyun/common/response/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "response", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/common/utils/index.js: -------------------------------------------------------------------------------- 1 | exports.APPID = 'wx9472d5ad54e879ed'; //这里是我的appid,需要改成你自己的 2 | exports.SECREAT = '7fefd4********65778a'; //密钥也要改成你自己的 3 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/common/utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "utils", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/db_init.json: -------------------------------------------------------------------------------- 1 | { 2 | "coupon": { 3 | "data": [ 4 | { 5 | "_id": { 6 | "$oid": "5fe62b3eee98e30001cb59d0" 7 | }, 8 | "bannerPic": "/static/coupon/meituan_banner.png", 9 | "icon": "/static/coupon/meituan.png", 10 | "minapp": { 11 | "appid": "wxde8ac0a21135c07d", 12 | "path": "/index/pages/h5/h5?weburl=https%3A%2F%2Frunion.meituan.com%2Furl%3Fkey%3D591ec05930c57331c1212b936e6785c1%26url%3Dhttps%253A%252F%252Fi.meituan.com%252Fawp%252Fhfe%252Fblock%252Fa13b87919a9ace9cfab4%252F89400%252Findex.html%253Fappkey%253D591ec05930c57331c1212b936e6785c1%253A000001%26sid%3D000001&lch=cps:waimai:5:591ec05930c57331c1212b936e6785c1:000001&f_token=1&f_userId=1" 13 | }, 14 | "name": "美团外卖红包", 15 | "tabId": 2, 16 | "type": 1, 17 | "url": "https://runion.meituan.com/url?key=cd23768d09c339d1641b2738df39aa67&url=https%3A%2F%2Fi.meituan.com%2Fawp%2Fhfe%2Fblock%2Fa945391288b790d558b7%2F78716%2Findex.html%3Fappkey%3Dcd23768d09c339d1641b2738df39aa67%3Ajuhe&sid=juhe", 18 | "sort": 100 19 | }, 20 | { 21 | "_id": { 22 | "$oid": "5fe62b3eee98e30001cb59cf" 23 | }, 24 | "bannerPic": "/static/coupon/ele_banner.png", 25 | "icon": "/static/coupon/ele.png", 26 | "minapp": { 27 | "appid": "wxece3a9a4c82f58c9", 28 | "path": "pages/sharePid/web/index?scene=https://s.click.ele.me/wR9ecuu" 29 | }, 30 | "name": "饿了么红包", 31 | "tabId": 1, 32 | "type": 1, 33 | "url": "https://s.click.ele.me/frZOjvu", 34 | "sort": 99 35 | }, 36 | { 37 | "_id": { 38 | "$oid": "5fe62b3eee98e30001cb59d1" 39 | }, 40 | "bannerPic": "/static/coupon/sanzhisongshu.png", 41 | "icon": "/static/coupon/jd.png", 42 | "minapp": { 43 | "appid": "wx91d27dbf599dff74", 44 | "path": "pages/proxy/union/union" 45 | }, 46 | "name": "三只松鼠大礼包", 47 | "tabId": 3, 48 | "type": 0, 49 | "url": "https://u.jd.com/tFDejq", 50 | "sort": 110 51 | } 52 | ], 53 | "schema": { 54 | "bsonType": "object", 55 | "permission": { 56 | ".create": false, 57 | ".delete": false, 58 | ".read": true, 59 | ".update": false 60 | } 61 | } 62 | }, 63 | "messages": { 64 | "data": [ 65 | { 66 | "_id": { 67 | "$oid": "5fe63c00646351000153d6a8" 68 | }, 69 | "touser": "o8Pqo5Ac9_ntJ7cOdhYVcF5QaAVg", 70 | "page": "pages/index/index", 71 | "data": "外卖领券提醒, 快来领优惠券啦!", 72 | "templateId": "hLV31-w38lq0yq8p6GEQUtBU7brtMrCFmaCCyxbU4xI", 73 | "subscribeDate": "2020-12-26", 74 | "sendDate": "2020-12-27", 75 | "send": true 76 | }, 77 | { 78 | "_id": { 79 | "$oid": "5fe8a6c9fb0f85000120f7ee" 80 | }, 81 | "touser": "o8Pqo5B3v9GtB3lCx0EujzSUs-v4", 82 | "page": "pages/index/index", 83 | "data": "外卖领券提醒, 快来领优惠券啦!", 84 | "templateId": "hLV31-w38lq0yq8p6GEQUtBU7brtMrCFmaCCyxbU4xI", 85 | "subscribeDate": "2020-12-28", 86 | "sendDate": "2020-12-27", 87 | "send": true 88 | } 89 | ] 90 | }, 91 | "tab": { 92 | "data": [ 93 | { 94 | "icon": "/static/all.png", 95 | "text": "全部", 96 | "tabId": 0 97 | }, 98 | { 99 | "icon": "/static/ele.png", 100 | "text": "饿了么", 101 | "tabId": 1 102 | }, 103 | { 104 | "icon": "/static/meituan.png", 105 | "text": "美团", 106 | "tabId": 2 107 | }, 108 | { 109 | "icon": "/static/jd.png", 110 | "text": "京东", 111 | "tabId": 3 112 | } 113 | ], 114 | "schema": { 115 | "bsonType": "object", 116 | "permission": { 117 | ".read": true, 118 | ".create": false, 119 | ".update": false, 120 | ".delete": false 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/send/config.json: -------------------------------------------------------------------------------- 1 | // 阿里云 2 | [ 3 | "cron:0 0 11 * * *" 4 | ] -------------------------------------------------------------------------------- /cloudfunctions-aliyun/send/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const utils = require('utils'); 3 | 4 | function getFormatDate(ms) { 5 | let date = new Date(); 6 | date.setTime(date.getTime() + ms); 7 | const year = date.getFullYear(); 8 | let month = date.getMonth() + 1; 9 | let strDate = date.getDate(); 10 | if (month >= 1 && month <= 9) { 11 | month = '0' + month; 12 | } 13 | if (strDate >= 0 && strDate <= 9) { 14 | strDate = '0' + strDate; 15 | } 16 | const currentdate = year + '-' + month + '-' + strDate; 17 | return currentdate; 18 | }; 19 | 20 | 21 | exports.main = async (event, context) => { 22 | const appid = utils.APPID; 23 | const secret = utils.SECREAT; 24 | const tokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + appid + '&secret=' + secret; 25 | // uniCloud.httpclient 发起请求 26 | const res = await uniCloud.httpclient.request(tokenUrl, 27 | { 28 | method: 'GET', 29 | dataType:"json" 30 | }); 31 | //返回数据给客户端 32 | const access_token = res.data.access_token; 33 | const db = uniCloud.database(); 34 | console.log('access_token:' + access_token); 35 | // 从云开发数据库中查询等待发送的消息列表 36 | const messages = await db 37 | .collection('messages') 38 | .where({ 39 | send: false, 40 | }) 41 | .get(); 42 | const now_date = getFormatDate(0); 43 | let sendArr = []; 44 | // 循环消息列表 45 | const sendPromises = messages.data.map(async message => { 46 | // 发送订阅消息 47 | try{ 48 | if (sendArr.includes(message.touser)){ 49 | console.log('该用户已发送!') 50 | }else 51 | { 52 | sendArr.push(message.touser); 53 | const sendUrl = 'https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=' + access_token; 54 | let send_data = { 55 | touser: message.touser, 56 | page: "pages/index/index", 57 | data: { 58 | thing1: { 59 | value: "记得领红包哦!", 60 | }, 61 | thing4: { 62 | value: message.data, 63 | }, 64 | thing5: { 65 | value: now_date, 66 | } 67 | }, 68 | template_id: message.templateId, 69 | }; 70 | console.log(send_data); 71 | 72 | // uniCloud.httpclient 发起请求 73 | const sendres = await uniCloud.httpclient.request(sendUrl, 74 | { 75 | data: send_data, 76 | method: 'POST', 77 | contentType: 'json', 78 | dataType:"json", 79 | }); 80 | console.log('发送成功'); 81 | console.log(message); 82 | // 发送成功后将消息的状态改为已发送 83 | return await db.collection('messages') 84 | .doc(message._id) 85 | .update({ 86 | send: true, 87 | sendDate: now_date, 88 | } 89 | ) 90 | } 91 | }catch(e){ 92 | //TODO handle the exception 93 | console.log('发送失败'); 94 | console.log(message); 95 | } 96 | }); 97 | return Promise.all(sendPromises) 98 | 99 | }; 100 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/send/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "send", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "utils": { 8 | "version": "file:../common/utils" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/send/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "send", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "utils": "file:../common/utils" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/subscribe/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const db = uniCloud.database(); 3 | const response = require('response') 4 | 5 | function getFormatDate(ms) { 6 | var date = new Date(); 7 | date.setTime(date.getTime() + ms); 8 | var year = date.getFullYear(); 9 | var month = date.getMonth() + 1; 10 | var strDate = date.getDate(); 11 | if (month >= 1 && month <= 9) { 12 | month = '0' + month; 13 | } 14 | if (strDate >= 0 && strDate <= 9) { 15 | strDate = '0' + strDate; 16 | } 17 | var currentdate = year + '-' + month + '-' + strDate; 18 | return currentdate; 19 | } 20 | 21 | exports.main = async (event, context) => { 22 | 23 | console.log(event); 24 | if (event.queryStringParameters) { 25 | try { 26 | const result = await db.collection('messages').add({ 27 | touser: event.queryStringParameters.openid, // 订阅者的openid 28 | page: 'pages/index/index', // 订阅消息卡片点击后会打开小程序的哪个页面 29 | data: event.queryStringParameters.data, // 订阅消息的数据 30 | templateId: event.queryStringParameters.templateId, // 订阅消息模板ID 31 | subscribeDate: getFormatDate(24*60*60*1000), // 创建时间 32 | sendDate: '', //发送时间 33 | send: false 34 | }); 35 | return result; 36 | } catch (err) { 37 | console.log(err); 38 | return response.error('订阅失败!'); 39 | } 40 | 41 | }else{ 42 | return response.error('未入传参数!'); 43 | } 44 | }; -------------------------------------------------------------------------------- /cloudfunctions-aliyun/subscribe/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "subscribe", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "response": { 8 | "version": "file:../common/response" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /cloudfunctions-aliyun/subscribe/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "subscribe", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "response": "file:../common/response" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /components/v-tabs/readme.md: -------------------------------------------------------------------------------- 1 | ## 插件说明 2 | 3 | > 这是 `v-tabs` 插件的升级版本,参数上有很大变动,支持 `H5` `小程序` `手机端`,如果是在之前的插件上升级的话,请注意参数的变更,触发的事件没有变更。 4 | 5 | ## 使用说明 6 | 7 | ### 1、最基本用法 8 | 9 | - 视图文件 10 | 11 | ```html 12 | 13 | ``` 14 | 15 | - 脚本文件 16 | 17 | ```js 18 | export default { 19 | data() { 20 | return { 21 | current: 0, 22 | tabs: ['军事', '国内', '新闻新闻', '军事', '国内', '新闻', '军事', '国内', '新闻'] 23 | } 24 | }, 25 | methods: { 26 | changeTab(index) { 27 | console.log('当前选中的项:' + index) 28 | } 29 | } 30 | } 31 | ``` 32 | 33 | ### 2、平铺整个屏幕 34 | 35 | - 视图文件 36 | 37 | ```html 38 | 39 | ``` 40 | 41 | - 脚本文件 42 | 43 | ```js 44 | export default { 45 | data() { 46 | return { 47 | activeTab: 0 48 | } 49 | } 50 | } 51 | ``` 52 | 53 | ### 3、胶囊用法 54 | 55 | - 视图文件 56 | 57 | ```html 58 | 59 | ``` 60 | 61 | - 脚本文件 62 | 63 | ```js 64 | data() { 65 | return { 66 | current: 2, 67 | tabs: [ 68 | '军事', 69 | '国内', 70 | '新闻新闻', 71 | '军事', 72 | '国内', 73 | '新闻', 74 | '军事', 75 | '国内', 76 | '新闻', 77 | ], 78 | }, 79 | methods: { 80 | changeTab(index) { 81 | console.log('当前选中索引:' + index) 82 | } 83 | } 84 | } 85 | ``` 86 | 87 | ## 文档说明 88 | 89 | ### 1、属性说明 90 | 91 | | 参数 | 类型 | 默认值 | 说明 | 92 | | :---------------: | :-----: | :-------: | :----------------------------------------: | 93 | | value | Number | 0 | 必传(双向绑定的值) | 94 | | color | String | '#333' | 默认文字颜色 | 95 | | activeColor | String | '#2979ff' | 选中文字的颜色 | 96 | | fontSize | String | '28rpx' | 默认文字大小(rpx 或 px) | 97 | | bold | Boolean | true | 是否加粗选中项 | 98 | | scroll | Boolean | true | 是否显示滚动条,平铺设置 false | 99 | | height | String | '70rpx' | tab 高度(rpx 或 px) | 100 | | lineHeight | String | '10rpx' | 滑块高度(rpx 或 px) | 101 | | lineColor | String | '#2979ff' | 滑块的颜色 | 102 | | lineScale | Number | 0.5 | 滑块宽度缩放值 | 103 | | lineRadius | String | '10rpx' | 滑块圆角宽度(rpx 或 px) | 104 | | pills | Boolean | false | 是否开启胶囊 | 105 | | pillsColor | String | '#2979ff' | 胶囊背景颜色(rpx 或 px) | 106 | | pillsBorderRadius | String | '10rpx' | 胶囊圆角宽度(rpx 或 px) | 107 | | field | String | '' | 如果 tabs 子项是对象,输入需要展示的键名 | 108 | | bgColor | String | '#fff' | 背景色,支持 linear-gradient 渐变 | 109 | | padding | String | '0' | 整个 tab padding 属性 | 110 | | fixed | Boolean | false | 是否固定在顶部 | 111 | | paddingItem | String | '0 22rpx' | 选项的边距(设置上下不生效,需要设置高度) | 112 | 113 | ### 2、事件说明 114 | 115 | | 名称 | 参数 | 说明 | 116 | | :----: | :---: | :--------------------------------: | 117 | | change | index | 改变选中项触发, index 选中项的下标 | 118 | 119 | ## 更新日志 120 | 121 | ### 2020-09-21 122 | 123 | 1. 修复添加 `fixed` 属性后,滚动条无效 124 | 2. 修复选项很少的情况下,下划线计算计算错误 125 | 3. 新增 `paddingItem` 属性,设置选项左右边距(上下边距需要设置 `height` 属性,或者设置 `padding` 属性) 126 | 127 | **写在最后:** 128 | 欢迎各位老铁反馈 bug ,本人后端 PHP 一枚,只是应为感兴趣前端,自己琢磨,自己搞。如果你在使用的过程中有什么不合理,需要优化的,都可以在下面评论(或加我 QQ: 1207791534),本人看见后回复、修正,感谢。 129 | 130 | ### 2020-09-17 131 | 132 | 1. 紧急修复 bug,横向滑动不了的情况 133 | 134 | ### 2020-09-16 135 | 136 | 1. 新增 `fixed` 属性,是否固定在顶部,示例地址:`pages/tabs/tabs-static` 137 | 2. 优化之前的页面结构 138 | 139 | **注意:** 140 | 141 | 1. 使用 `padding` 属性的时候,尽量不要左右边距,会导致下划线位置不对 142 | 2. 如果不绑定 `v-model` 会导致 `change` 事件改变的时候,下划线不跟随问题 143 | 144 | ### 2020-09-09 145 | 146 | 1. 修复 `width` 错误,dom 加载的时候没有及时获取到 `data` 属性导致的。 147 | 148 | ### 2020-08-29 149 | 150 | 1. 优化异步改变 `tabs` 后,下划线不初始化问题 151 | 2. `github` 地址上有图 2 的源码,需要的自行下载,页面路径:`pages/tabs/order` 152 | 153 | ### 2020-08-20 154 | 155 | 1. 优化 `节点查询` 和 `选中渲染` 156 | 2. 优化支付宝中 `createSelectorQuery()` 的影响 157 | 158 | ### 2020-08-19 159 | 160 | 1. 优化 `change` 事件触发机制 161 | 162 | ### 2020-08-16 163 | 164 | 1. 修改默认高度为 `70rpx` 165 | 2. 新增属性 `bgColor`,可设置背景颜色,默认 `#fff` 166 | 3. 新增整个 `tab` 的 `padding` 属性,默认 `0` 167 | 168 | ### 2020-08-13 169 | 170 | 1. 全新的 `v-tabs 2.0` 171 | 2. 支持 `H5` `小程序` `APP` 172 | 3. 属性高度可配置 173 | 174 | ## 预览 175 | 176 | ![v-tabs 2.0.1.gif](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghsv40mj76g30ai0i2tsd.gif) 177 | ![v-tabs 2.0.2.gif](https://img-cdn-aliyun.dcloud.net.cn/stream/plugin_screens/42f3a920-a674-11ea-8a24-ffee00625e2e_1.png?v=1597912963) 178 | -------------------------------------------------------------------------------- /components/v-tabs/v-tabs.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 291 | 292 | 351 | -------------------------------------------------------------------------------- /docs/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | title: 'Coupons', 3 | description: '外卖红包开源项目', 4 | // plugins: { 5 | // "vuepress-plugin-auto-sidebar": { 6 | // titleMap: { 7 | // "guide": "基础", 8 | // } 9 | // } 10 | // } 11 | themeConfig: { 12 | repo: 'zwpro/coupons', 13 | docsDir: 'docs', 14 | editLinks: true, 15 | sidebarDepth: 3, 16 | nav: [ 17 | { text: '首页', link: '/' }, 18 | { text: '快速开始', link: '/guide/' }, 19 | ], 20 | sidebar: { 21 | '/guide/': [{ 22 | title: '基础', 23 | collapsable: false, 24 | children: [ 25 | { title: '前序准备', path:'/guide/ready'}, 26 | { title: '云开发版', path:'/guide/cloud'}, 27 | { title: '静态版', path:'/guide/static'} 28 | ] 29 | }], 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /docs/.vuepress/public/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/docs/.vuepress/public/hero.png -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | home: true 3 | heroImage: /hero.png 4 | heroText: 外卖红包项目使用教程 5 | tagline: 外卖优惠券部署上线流程 6 | actionText: 快速上手 → 7 | actionLink: /guide/ 8 | features: 9 | - title: 代码开源 10 | details: 全部代码在github开源,遵循开源协议,可自行修改拓展。 11 | - title: 多平台编译 12 | details: 支持网站h5,微信小程序编译,App打包,扩平台兼容。 13 | - title: 云开发 14 | details: 无需服务器、数据库、域名,以最少的配置帮助你部署上线运营,快速实现推广优惠券赚佣金。 15 | footer: MIT Licensed | Copyright © 2020-present zwpro 16 | --- 17 | 18 | -------------------------------------------------------------------------------- /docs/guide/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | pageClass: getting-started 3 | --- 4 | 5 | # 介绍 6 | 7 | [![uniapp](https://img.shields.io/badge/uniapp-2.0.0-brightgreen.svg)](https://uniapp.dcloud.io/) 8 | [![GitHub stars](https://img.shields.io/github/stars/zwpro/coupons.svg?style=social&label=Stars)](https://github.com/zwpro/coupons) 9 | 10 | [coupons](https://github.com/zwpro/coupons) 是一个美团饿了么外卖优惠券红包cps推广的项目,它基于 [uniapp](https://uniapp.dcloud.io/) 实现多平台编译。快速接入美团联盟、饿了么推广,实现推广优惠券赚佣金。 11 | 12 | 目前最新版支持云开发,配置信息可在云数据库修改;静态版配置信息写在前端,可切换到 [静态分支](https://github.com/zwpro/coupons/tree/no-api) 13 | 14 | 15 | 16 | 17 | 18 | 19 | ## 贡献 20 | 21 | 有任何修改和建议都可以提项目 pr 和 (https://github.com/zwpro/coupons/issues) 22 | 23 | [coupons](https://github.com/zwpro/coupons) 还在持续迭代中,逐步沉淀和总结出更多功能和相应的实现代码,总结中后台产品模板/组件/业务场景的最佳实践。本项目也十分期待你的参与和[issues](https://github.com/zwpro/coupons/issues)。 24 | 25 | ## 赞赏 26 | 27 | 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :heart: 28 | 29 | 30 | ## 其它 31 | 32 | 群主圈子会经常分享一些有意思的小项目,有兴趣的可以加微信 sanxungo拉你进群,备注:圈子 33 | -------------------------------------------------------------------------------- /docs/guide/cloud.md: -------------------------------------------------------------------------------- 1 | 最新版即为云开发版,配置数据来自云数据库,需开通unicloud云开发 2 | 3 | ## 创建云服务空间 4 | 5 | 右键 cloudfunctions-aliyun,选择 创建云服务空间,会自动打开 [云开发首页](https://unicloud.dcloud.net.cn/home),选择阿里云,填写信息创建。 6 | ## 云函数域名绑定 7 | 创建完成后,点击左侧云函数->函数列表->云函数域名绑定 ->启用域名,此处的域名即为你的api接口域名。 8 | ## 关联云服务空间 9 | 回到hbuilderx,右键 cloudfunctions-aliyun 关联云服务空间,选择刚刚创建的云服务空间。 10 | ## 上传云函数 11 | 右键 cloudfunctions-aliyun 上传所有云函数(如提示请在manifest.json文件中获取新的AppID,打开manifest.json重新获取appid)。 12 | ## 云函数URL化 13 | 去云服务空间,云点击左侧云函数->函数列表->刷新,可以看到刚刚上传的api函数, 点击详情->云函数URL化->编辑,填写路径 /http/api,确定后复制路径,即为你的api接口地址。 14 | ## 初始化云数据库 15 | 回到hbuilderx,右键 cloudfunctions-aliyun 目录下的 db_init.json ,初始化云数据库。初始化后可在云服务空间->云数据库 看到有两个数据表,tab是导航栏,coupon是优惠券列表,后续可直接在这更改数据。 16 | ## 修改前端请求域名 17 | App.vue 中修改globalData.api.home为你的云函数域名。 -------------------------------------------------------------------------------- /docs/guide/ready.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebarDepth: 0 3 | --- 4 | 5 | ## 前序准备 6 | 7 | 1. 注册美团联盟和淘宝联盟 8 | ::: tip 9 | 美团联盟个人无法注册,可以挂靠在企业帐号下。 10 | 11 | 淘宝联盟:[https://pub.alimama.com/](https://pub.alimama.com/) 12 | ::: 13 | 2. 你需要在本地安装 [hbuilderx](https://www.dcloud.io/hbuilderx.html)。如使用云开发版本还需开通 [云开发](https://unicloud.dcloud.net.cn/),如使用静态版本,无需云开发。 14 | 15 | 3. 拉取代码并导入hbuilderx 16 | ```bash 17 | # 克隆项目 18 | git clone https://github.com/zwpro/coupons 19 | 20 | # 静态版使用以下命令 21 | git clone -b no-api https://github.com/zwpro/coupons 22 | ``` 23 | 24 | 其他贡献者提供的入门教程: 25 | 26 | [0成本搭建外卖返利cps小程序](https://mp.weixin.qq.com/s/kLY7nKYmchYAMKNNmOFxdw) 27 | 28 | [零基础快速搭建一个能够获利的小程序](https://mp.weixin.qq.com/s/u4JWJEp6Aynl3KDH9o3e4g) -------------------------------------------------------------------------------- /docs/guide/static.md: -------------------------------------------------------------------------------- 1 | 静态版需切换到静态分支[no-api](https://github.com/zwpro/coupons/tree/no-api) 2 | 3 | 优惠券数据在pages/index/index里的coupons数组里修改 -------------------------------------------------------------------------------- /examples/微信图片_20201107150908.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107150908.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150917.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107150917.png -------------------------------------------------------------------------------- /examples/微信图片_20201107150923.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107150923.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150932.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107150932.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150944.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107150944.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150950.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107150950.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107163539.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107163539.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107163546.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107163546.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107165410.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107165410.png -------------------------------------------------------------------------------- /examples/微信图片_20201107165417.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/examples/微信图片_20201107165417.jpg -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | 4 | Vue.config.productionTip = false 5 | 6 | App.mpType = 'app' 7 | 8 | const app = new Vue({ 9 | ...App 10 | }) 11 | app.$mount() 12 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "外卖专享优惠", 3 | "appid" : "", 4 | "description" : "", 5 | "versionName" : "1.0.0", 6 | "versionCode" : "100", 7 | "transformPx" : false, 8 | "app-plus" : { 9 | "nvueCompiler" : "uni-app", 10 | "compilerVersion" : 3, 11 | "modules" : {}, 12 | "distribute" : { 13 | "android" : { 14 | "permissions" : [ 15 | "", 16 | "", 17 | "", 18 | "", 19 | "", 20 | "", 21 | "", 22 | "", 23 | "", 24 | "", 25 | "", 26 | "", 27 | "", 28 | "", 29 | "", 30 | "", 31 | "", 32 | "", 33 | "", 34 | "", 35 | "", 36 | "" 37 | ] 38 | }, 39 | "ios" : {}, 40 | "sdkConfigs" : {} 41 | } 42 | }, 43 | "quickapp" : {}, 44 | "mp-weixin" : { 45 | "appid" : "", 46 | "setting" : { 47 | "urlCheck" : true, 48 | "minified" : true 49 | } 50 | }, 51 | "h5" : { 52 | "optimization" : { 53 | "treeShaking" : { 54 | "enable" : true 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /pages.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [{ 3 | "path": "pages/index/index" 4 | }, { 5 | "path": "pages/user/user", 6 | "style": { 7 | "navigationBarTitleText": "我的", 8 | "enablePullDownRefresh": false 9 | } 10 | 11 | }], 12 | "tabBar": { 13 | "backgroundColor": "#F7F7FA", 14 | "color": "#707070", 15 | "selectedColor": "#ffad00", 16 | "list": [{ 17 | "pagePath": "pages/index/index", 18 | "text": "首页", 19 | "iconPath": "/static/tabbar/home.png", 20 | "selectedIconPath": "/static/tabbar/home_fill.png" 21 | }, 22 | { 23 | "pagePath": "pages/user/user", 24 | "text": "我的", 25 | "iconPath": "/static/tabbar/user.png", 26 | "selectedIconPath": "/static/tabbar/user_fill.png" 27 | } 28 | ] 29 | }, 30 | "globalStyle": { 31 | "navigationBarTextStyle": "white", 32 | "navigationBarTitleText": "外卖专享优惠", 33 | "navigationBarBackgroundColor": "#007AFF", 34 | "backgroundColor": "#FFFFFF", 35 | "titleView": false, 36 | "h5": { 37 | "titleNView": false 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 281 | 282 | 371 | -------------------------------------------------------------------------------- /pages/user/user.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 63 | 64 | 189 | -------------------------------------------------------------------------------- /static/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/11.png -------------------------------------------------------------------------------- /static/all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/all.png -------------------------------------------------------------------------------- /static/coupon/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/11.jpg -------------------------------------------------------------------------------- /static/coupon/ele.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/ele.png -------------------------------------------------------------------------------- /static/coupon/ele_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/ele_banner.png -------------------------------------------------------------------------------- /static/coupon/ele_guosu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/ele_guosu.png -------------------------------------------------------------------------------- /static/coupon/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/jd.png -------------------------------------------------------------------------------- /static/coupon/meituan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/meituan.png -------------------------------------------------------------------------------- /static/coupon/meituan_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/meituan_banner.png -------------------------------------------------------------------------------- /static/coupon/sanzhisongshu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/sanzhisongshu.png -------------------------------------------------------------------------------- /static/coupon/vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/vip.png -------------------------------------------------------------------------------- /static/coupon/vip_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/coupon/vip_banner.png -------------------------------------------------------------------------------- /static/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/demo.png -------------------------------------------------------------------------------- /static/didi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/didi.jpg -------------------------------------------------------------------------------- /static/ele.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/ele.png -------------------------------------------------------------------------------- /static/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/error.png -------------------------------------------------------------------------------- /static/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/jd.png -------------------------------------------------------------------------------- /static/meituan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/meituan.png -------------------------------------------------------------------------------- /static/right_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/right_h.png -------------------------------------------------------------------------------- /static/tabbar/fuli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/tabbar/fuli.png -------------------------------------------------------------------------------- /static/tabbar/fuli_fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/tabbar/fuli_fill.png -------------------------------------------------------------------------------- /static/tabbar/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/tabbar/home.png -------------------------------------------------------------------------------- /static/tabbar/home_fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/tabbar/home_fill.png -------------------------------------------------------------------------------- /static/tabbar/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/tabbar/user.png -------------------------------------------------------------------------------- /static/tabbar/user_fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/tabbar/user_fill.png -------------------------------------------------------------------------------- /static/uni.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/uni.ttf -------------------------------------------------------------------------------- /static/user_hezuo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/user_hezuo.png -------------------------------------------------------------------------------- /static/user_kefu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/user_kefu.png -------------------------------------------------------------------------------- /static/user_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/user_share.png -------------------------------------------------------------------------------- /static/vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/vip.png -------------------------------------------------------------------------------- /static/wx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zwpro/coupons/36a9de069cd10910ab35825d3e22ccbf7653a3f6/static/wx.png -------------------------------------------------------------------------------- /uni.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * 这里是uni-app内置的常用样式变量 3 | * 4 | * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 5 | * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App 6 | * 7 | */ 8 | 9 | /** 10 | * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 11 | * 12 | * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 13 | */ 14 | 15 | /* 颜色变量 */ 16 | 17 | /* 行为相关颜色 */ 18 | $uni-color-primary: #007aff; 19 | $uni-color-success: #4cd964; 20 | $uni-color-warning: #f0ad4e; 21 | $uni-color-error: #dd524d; 22 | 23 | /* 文字基本颜色 */ 24 | $uni-text-color:#333;//基本色 25 | $uni-text-color-inverse:#fff;//反色 26 | $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 27 | $uni-text-color-placeholder: #808080; 28 | $uni-text-color-disable:#c0c0c0; 29 | 30 | /* 背景颜色 */ 31 | $uni-bg-color:#ffffff; 32 | $uni-bg-color-grey:#f8f8f8; 33 | $uni-bg-color-hover:#f1f1f1;//点击状态颜色 34 | $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 35 | 36 | /* 边框颜色 */ 37 | $uni-border-color:#e5e5e5; 38 | 39 | /* 尺寸变量 */ 40 | 41 | /* 文字尺寸 */ 42 | $uni-font-size-sm:24rpx; 43 | $uni-font-size-base:28rpx; 44 | $uni-font-size-lg:32rpx; 45 | 46 | /* 图片尺寸 */ 47 | $uni-img-size-sm:40rpx; 48 | $uni-img-size-base:52rpx; 49 | $uni-img-size-lg:80rpx; 50 | 51 | /* Border Radius */ 52 | $uni-border-radius-sm: 4rpx; 53 | $uni-border-radius-base: 6rpx; 54 | $uni-border-radius-lg: 12rpx; 55 | $uni-border-radius-circle: 50%; 56 | 57 | /* 水平间距 */ 58 | $uni-spacing-row-sm: 10px; 59 | $uni-spacing-row-base: 20rpx; 60 | $uni-spacing-row-lg: 30rpx; 61 | 62 | /* 垂直间距 */ 63 | $uni-spacing-col-sm: 8rpx; 64 | $uni-spacing-col-base: 16rpx; 65 | $uni-spacing-col-lg: 24rpx; 66 | 67 | /* 透明度 */ 68 | $uni-opacity-disabled: 0.3; // 组件禁用态的透明度 69 | 70 | /* 文章场景相关 */ 71 | $uni-color-title: #2C405A; // 文章标题颜色 72 | $uni-font-size-title:40rpx; 73 | $uni-color-subtitle: #555555; // 二级标题颜色 74 | $uni-font-size-subtitle:36rpx; 75 | $uni-color-paragraph: #3F536E; // 文章段落颜色 76 | $uni-font-size-paragraph:30rpx; --------------------------------------------------------------------------------