├── .gitignore ├── App.vue ├── 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 ├── add-tip │ └── add-tip.vue ├── api-set-tabbar.nvue ├── drag-ball │ └── drag-ball.vue ├── page-foot.vue ├── page-head.vue ├── product.vue ├── s-dial_bg.png ├── s-dial_pointer.png ├── uLink.vue ├── uni-badge │ └── uni-badge.vue ├── uni-icons │ ├── icons.js │ └── uni-icons.vue ├── uni-list-item │ └── uni-list-item.vue ├── uni-list │ ├── uni-list.vue │ ├── uni-refresh.vue │ └── uni-refresh.wxs ├── uni-section │ └── uni-section.vue └── v-tabs │ ├── readme.md │ └── v-tabs.vue ├── examples ├── 7057e518bd7fbb71c3e182bf208aeeda.gif ├── 微信图片_20201107150908.jpg ├── 微信图片_20201107150917.png ├── 微信图片_20201107150923.jpg ├── 微信图片_20201107150932.jpg ├── 微信图片_20201107150944.jpg ├── 微信图片_20201107150950.jpg ├── 微信图片_20201107163539.jpg ├── 微信图片_20201107163546.jpg ├── 微信图片_20201107165410.png └── 微信图片_20201107165417.jpg ├── libs └── qqmap-wx-jssdk.min.js ├── main.js ├── manifest.json ├── pages.json ├── pages ├── eatwhat │ └── eatwhat.vue ├── home │ └── home.vue └── index │ └── index.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 ├── ding.png ├── dytx.png ├── ele.png ├── error.png ├── home-active.png ├── home.png ├── jd.png ├── logo.png ├── meituan.png ├── notify.png ├── person-active.png ├── person.png ├── raise.jpeg ├── s-dial_bg.png ├── s-dial_pointer.png ├── search-active.png ├── search.png ├── share.png ├── share_pic.png ├── to.png ├── uni.ttf ├── vip.png ├── whatwedo-active.png ├── whatwedo.png ├── wx.png └── 订阅提示.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 | node_modules/ -------------------------------------------------------------------------------- /App.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 更新日志 12.31 2 | - 修改个人中心关注公众号按钮点击跳转 3 | - 吃什么页面添加分享功能 4 | 5 | ![功能展示](https://raw.githubusercontent.com/sunjackson/coupons/master/examples/7057e518bd7fbb71c3e182bf208aeeda.gif) 6 | 7 | ### 更新日志 12.30 8 | - 添加吃什么页面 9 | 10 | ### 更新日志 12.28 11 | 12 | - 添加首页排序功能 13 | - 修复订阅功能无法更改发送状态 14 | - 增加缓存openid功能 15 | - 添加个人中心 16 | 17 | ### 更新日志 12.22 18 | 19 | - 新增订阅功能 20 | - 新增右上角提醒收藏 21 | 22 | 本项目基于[zwpro的外卖CPS添加功能开发](https://github.com/zwpro/coupons),如果想要看原始代码请移步[这里](https://github.com/zwpro/coupons) 23 | # 美团饿了吗CPS红包,别人领红包下单,你拿推广佣金 24 | 25 | 26 | 27 | 28 | ### 使用方法 29 | 30 | 源码为uniapp项目,需下载hbuilder导入项目打包,可编译成h5或小程序(跳转地址为小程序路径) 31 | 32 | [在线文档](http://lianghua.wxthe.com/docs/) 33 | 34 | 35 | ### 常见问题 36 | 1. 如何获取美团饿了吗的推广链接 37 | 38 | 美团联盟:https://union.meituan.com/ 39 | 40 | 饿了么、双十一:https://pub.alimama.com/ 41 | 42 | ​ 2.如何打包成小程序 43 | 44 | 编译成小程序的话,需要配置coupons里小程序路径 45 | 46 | 比如跳转饿了么小程序: 47 | 48 | ``` 49 | minapp: { 50 | appid: 'wxece3a9a4c82f58c9', 51 | path: 'pages/sharePid/web/index?scene=https://s.click.ele.me/wR9ecuu' 52 | } 53 | ``` 54 | 55 | 已上线案例: 56 | 57 | 58 | 59 | 60 | 61 | 如有线上案例或疑问,请提issue 62 | -------------------------------------------------------------------------------- /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 = '7fefd*************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 | "bannerPic": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-17414whos6vp2f68cb/a0512780-3dff-11eb-bc56-c9cea619f663.jpg", 6 | "icon": "/static/coupon/meituan.png", 7 | "minapp": { 8 | "appid": "wx2c348cf579062e56", 9 | "path": "outer_packages/r2xinvite/coupon/coupon?inviteCode=NnOIp-QOs8SiYF1dcSlL5r8phPrCf6qkH7evMyjIoup2NXxNCLYcBbd3bqpv2X2It4Fp8SyjX4vMx8up8kOVW0xCPwjoXU7XGcP4Lq1dkR5hoILQ-YCsQHahjErsyVtz5yd8LnmfrBsh9EKQv_PZ-URN2vgnWarzJYx-1l9mOnk" 10 | }, 11 | "name": "美团外卖红包", 12 | "tabId": 2, 13 | "type": "每日领", 14 | "url": "", 15 | "desc": "美团外卖APP大额优惠券,每天都可以领哦!", 16 | "sort": 100 17 | }, 18 | { 19 | "bannerPic": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-17414whos6vp2f68cb/c53faf80-35da-11eb-bd01-97bc1429a9ff.jpg", 20 | "icon": "/static/coupon/meituan.png", 21 | "minapp": { 22 | "appid": "wxde8ac0a21135c07d", 23 | "path": "/index/pages/h5/h5?weburl=https%3A%2F%2Frunion.meituan.com%2Furl%3Fkey%3Dfd7b36ed0793a0fd639ffbaefe8adb78%26url%3Dhttps%253A%252F%252Fi.meituan.com%252Fawp%252Fhfe%252Fblock%252Fc9ff59b58f6f5bf385b6%252F94455%252Findex.html%253Fappkey%253Dfd7b36ed0793a0fd639ffbaefe8adb78%253Asunjiackson%26sid%3Dsunjiackson&lch=cps:waimai:5:fd7b36ed0793a0fd639ffbaefe8adb78:sunjiackson&f_token=1&f_userId=1" 24 | }, 25 | "name": "美团生鲜红包", 26 | "tabId": 2, 27 | "type": "每日领", 28 | "url": "https://runion.meituan.com/url?key=fd7b36ed0793a0fd639ffbaefe8adb78&url=https%3A%2F%2Fi.meituan.com%2Fawp%2Fhfe%2Fblock%2F652c4b9d8a2425a98ca5%2F92207%2Findex.html%3Fappkey%3Dfd7b36ed0793a0fd639ffbaefe8adb78%3Asunjiackson&sid=sunjiackson", 29 | "desc": "美团APP生鲜大额优惠券,每天都可以领哦!", 30 | "sort": 100 31 | }, 32 | { 33 | "bannerPic": "/static/coupon/ele_banner.png", 34 | "icon": "/static/coupon/ele.png", 35 | "minapp": { 36 | "appid": "wxece3a9a4c82f58c9", 37 | "path": "ele-recommend-price/pages/guest/index?inviterId=70bee0b1" 38 | }, 39 | "name": "饿了么红包", 40 | "tabId": 1, 41 | "type": "每日领", 42 | "url": "https://h5.ele.me/ant/qrcode?open_type=miniapp&url_id=35&inviterId=70bee0b1", 43 | "desc": "饿了么APP大额优惠券,每天都可以领哦!", 44 | "sort": 100 45 | }, 46 | { 47 | "bannerPic": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-17414whos6vp2f68cb/06911770-3e06-11eb-bd01-97bc1429a9ff.jpg", 48 | "icon": "/static/coupon/jd.png", 49 | "minapp": { 50 | "appid": "wxca1fe42a16552094", 51 | "path": "pages/events/money_treasure/aggre/index?_i_a=468958&a=undefined&_u_n=%E4%BA%AC%E4%B8%9C%E7%94%A8%E6%88%B7&_s_p=77AF07479631602E04A1876E43B1ACF6&activeId=468958&_m_h=https%253A%252F%252Fimg11.360buyimg.com%252Fjdphoto%252Fs120x120_jfs%252Ft1%252F82031%252F9%252F5133%252F19337%252F5d36bcadE9cdb240c%252Fccc58f73b721ec2d.png" 52 | }, 53 | "name": "京喜一分购", 54 | "tabId": 3, 55 | "type": "新人抢", 56 | "url": "", 57 | "desc": "京东APP新人注册送礼,一分钱抢购商品!", 58 | "sort": 100 59 | }, 60 | { 61 | "bannerPic": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-17414whos6vp2f68cb/eaf1c640-4409-11eb-8a36-ebb87efcf8c0.jpg", 62 | "icon": "/static/coupon/ele.png", 63 | "minapp": { 64 | "appid": "wxece3a9a4c82f58c9", 65 | "path": "taoke/pages/shopping-guide/index?scene=Bp1Dysu" 66 | }, 67 | "name": "饿了么红包", 68 | "tabId": 1, 69 | "type": "每日领", 70 | "url": "", 71 | "desc": "饿了么红包,最高可领66元!", 72 | "sort": 101 73 | }, 74 | { 75 | "bannerPic": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-17414whos6vp2f68cb/ea42e8a0-4409-11eb-bd01-97bc1429a9ff.png", 76 | "icon": "/static/coupon/ele.png", 77 | "minapp": { 78 | "appid": "wxece3a9a4c82f58c9", 79 | "path": "pages/sharePid/web/index?scene=s.click.ele.me%2F5qYH2tu" 80 | }, 81 | "name": "天天抢红包", 82 | "tabId": 1, 83 | "type": "天天抢", 84 | "url": "", 85 | "desc": "饿了么天天抢红包,最高可领36元!", 86 | "sort": 102 87 | }, 88 | { 89 | "bannerPic": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-17414whos6vp2f68cb/de7a6610-4409-11eb-b997-9918a5dda011.png", 90 | "icon": "/static/coupon/ele.png", 91 | "minapp": { 92 | "appid": "wxece3a9a4c82f58c9", 93 | "path": "pages/sharePid/web/index?scene=s.click.ele.me%2FM5ZH2tu" 94 | }, 95 | "name": "果蔬红包", 96 | "tabId": 1, 97 | "type": "每日领", 98 | "url": "", 99 | "desc": "饿了么果蔬红包,每天都可以领哦!", 100 | "sort": 101 101 | } 102 | ], 103 | "schema": { 104 | "bsonType": "object", 105 | "permission": { 106 | ".create": false, 107 | ".delete": false, 108 | ".read": true, 109 | ".update": false 110 | } 111 | } 112 | }, 113 | "tab": { 114 | "data": [ 115 | { 116 | "icon": "/static/meituan.png", 117 | "tabId": 2, 118 | "text": "美团" 119 | }, 120 | { 121 | "icon": "/static/all.png", 122 | "tabId": 0, 123 | "text": "全部" 124 | }, 125 | { 126 | "icon": "/static/ele.png", 127 | "tabId": 1, 128 | "text": "饿了么" 129 | }, 130 | { 131 | "icon": "/static/jd.png", 132 | "tabId": 3, 133 | "text": "京东" 134 | } 135 | ], 136 | "schema": { 137 | "bsonType": "object", 138 | "permission": { 139 | ".create": false, 140 | ".delete": false, 141 | ".read": true, 142 | ".update": false 143 | } 144 | } 145 | } 146 | } -------------------------------------------------------------------------------- /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 | let 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 | let 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 | let date = new Date(); 7 | date.setTime(date.getTime() + ms); 8 | let year = date.getFullYear(); 9 | let month = date.getMonth() + 1; 10 | let 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 | let 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(0), // 创建时间 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 | }; 45 | -------------------------------------------------------------------------------- /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/add-tip/add-tip.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 46 | 47 | 97 | -------------------------------------------------------------------------------- /components/api-set-tabbar.nvue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 145 | 146 | 157 | -------------------------------------------------------------------------------- /components/drag-ball/drag-ball.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 59 | 60 | 77 | -------------------------------------------------------------------------------- /components/page-foot.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 27 | 39 | -------------------------------------------------------------------------------- /components/page-head.vue: -------------------------------------------------------------------------------- 1 | 6 | 17 | -------------------------------------------------------------------------------- /components/product.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 19 | 20 | 67 | -------------------------------------------------------------------------------- /components/s-dial_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/components/s-dial_bg.png -------------------------------------------------------------------------------- /components/s-dial_pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/components/s-dial_pointer.png -------------------------------------------------------------------------------- /components/uLink.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 56 | 57 | 60 | -------------------------------------------------------------------------------- /components/uni-badge/uni-badge.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 67 | 68 | -------------------------------------------------------------------------------- /components/uni-icons/icons.js: -------------------------------------------------------------------------------- 1 | export default { 2 | "pulldown": "\ue588", 3 | "refreshempty": "\ue461", 4 | "back": "\ue471", 5 | "forward": "\ue470", 6 | "more": "\ue507", 7 | "more-filled": "\ue537", 8 | "scan": "\ue612", 9 | "qq": "\ue264", 10 | "weibo": "\ue260", 11 | "weixin": "\ue261", 12 | "pengyouquan": "\ue262", 13 | "loop": "\ue565", 14 | "refresh": "\ue407", 15 | "refresh-filled": "\ue437", 16 | "arrowthindown": "\ue585", 17 | "arrowthinleft": "\ue586", 18 | "arrowthinright": "\ue587", 19 | "arrowthinup": "\ue584", 20 | "undo-filled": "\ue7d6", 21 | "undo": "\ue406", 22 | "redo": "\ue405", 23 | "redo-filled": "\ue7d9", 24 | "bars": "\ue563", 25 | "chatboxes": "\ue203", 26 | "camera": "\ue301", 27 | "chatboxes-filled": "\ue233", 28 | "camera-filled": "\ue7ef", 29 | "cart-filled": "\ue7f4", 30 | "cart": "\ue7f5", 31 | "checkbox-filled": "\ue442", 32 | "checkbox": "\ue7fa", 33 | "arrowleft": "\ue582", 34 | "arrowdown": "\ue581", 35 | "arrowright": "\ue583", 36 | "smallcircle-filled": "\ue801", 37 | "arrowup": "\ue580", 38 | "circle": "\ue411", 39 | "eye-filled": "\ue568", 40 | "eye-slash-filled": "\ue822", 41 | "eye-slash": "\ue823", 42 | "eye": "\ue824", 43 | "flag-filled": "\ue825", 44 | "flag": "\ue508", 45 | "gear-filled": "\ue532", 46 | "reload": "\ue462", 47 | "gear": "\ue502", 48 | "hand-thumbsdown-filled": "\ue83b", 49 | "hand-thumbsdown": "\ue83c", 50 | "hand-thumbsup-filled": "\ue83d", 51 | "heart-filled": "\ue83e", 52 | "hand-thumbsup": "\ue83f", 53 | "heart": "\ue840", 54 | "home": "\ue500", 55 | "info": "\ue504", 56 | "home-filled": "\ue530", 57 | "info-filled": "\ue534", 58 | "circle-filled": "\ue441", 59 | "chat-filled": "\ue847", 60 | "chat": "\ue263", 61 | "mail-open-filled": "\ue84d", 62 | "email-filled": "\ue231", 63 | "mail-open": "\ue84e", 64 | "email": "\ue201", 65 | "checkmarkempty": "\ue472", 66 | "list": "\ue562", 67 | "locked-filled": "\ue856", 68 | "locked": "\ue506", 69 | "map-filled": "\ue85c", 70 | "map-pin": "\ue85e", 71 | "map-pin-ellipse": "\ue864", 72 | "map": "\ue364", 73 | "minus-filled": "\ue440", 74 | "mic-filled": "\ue332", 75 | "minus": "\ue410", 76 | "micoff": "\ue360", 77 | "mic": "\ue302", 78 | "clear": "\ue434", 79 | "smallcircle": "\ue868", 80 | "close": "\ue404", 81 | "closeempty": "\ue460", 82 | "paperclip": "\ue567", 83 | "paperplane": "\ue503", 84 | "paperplane-filled": "\ue86e", 85 | "person-filled": "\ue131", 86 | "contact-filled": "\ue130", 87 | "person": "\ue101", 88 | "contact": "\ue100", 89 | "images-filled": "\ue87a", 90 | "phone": "\ue200", 91 | "images": "\ue87b", 92 | "image": "\ue363", 93 | "image-filled": "\ue877", 94 | "location-filled": "\ue333", 95 | "location": "\ue303", 96 | "plus-filled": "\ue439", 97 | "plus": "\ue409", 98 | "plusempty": "\ue468", 99 | "help-filled": "\ue535", 100 | "help": "\ue505", 101 | "navigate-filled": "\ue884", 102 | "navigate": "\ue501", 103 | "mic-slash-filled": "\ue892", 104 | "search": "\ue466", 105 | "settings": "\ue560", 106 | "sound": "\ue590", 107 | "sound-filled": "\ue8a1", 108 | "spinner-cycle": "\ue465", 109 | "download-filled": "\ue8a4", 110 | "personadd-filled": "\ue132", 111 | "videocam-filled": "\ue8af", 112 | "personadd": "\ue102", 113 | "upload": "\ue402", 114 | "upload-filled": "\ue8b1", 115 | "starhalf": "\ue463", 116 | "star-filled": "\ue438", 117 | "star": "\ue408", 118 | "trash": "\ue401", 119 | "phone-filled": "\ue230", 120 | "compose": "\ue400", 121 | "videocam": "\ue300", 122 | "trash-filled": "\ue8dc", 123 | "download": "\ue403", 124 | "chatbubble-filled": "\ue232", 125 | "chatbubble": "\ue202", 126 | "cloud-download": "\ue8e4", 127 | "cloud-upload-filled": "\ue8e5", 128 | "cloud-upload": "\ue8e6", 129 | "cloud-download-filled": "\ue8e9", 130 | "headphones":"\ue8bf", 131 | "shop":"\ue609" 132 | } 133 | -------------------------------------------------------------------------------- /components/uni-list-item/uni-list-item.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 155 | 156 | -------------------------------------------------------------------------------- /components/uni-list/uni-list.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 52 | -------------------------------------------------------------------------------- /components/uni-list/uni-refresh.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 59 | 60 | -------------------------------------------------------------------------------- /components/uni-list/uni-refresh.wxs: -------------------------------------------------------------------------------- 1 | var pullDown = { 2 | threshold: 95, 3 | maxHeight: 200, 4 | callRefresh: 'onrefresh', 5 | callPullingDown: 'onpullingdown', 6 | refreshSelector: '.uni-refresh' 7 | }; 8 | 9 | function ready(newValue, oldValue, ownerInstance, instance) { 10 | var state = instance.getState() 11 | state.canPullDown = newValue; 12 | // console.log(newValue); 13 | } 14 | 15 | function touchStart(e, instance) { 16 | var state = instance.getState(); 17 | state.refreshInstance = instance.selectComponent(pullDown.refreshSelector); 18 | state.canPullDown = (state.refreshInstance != null && state.refreshInstance != undefined); 19 | if (!state.canPullDown) { 20 | return 21 | } 22 | 23 | // console.log("touchStart"); 24 | 25 | state.height = 0; 26 | state.touchStartY = e.touches[0].pageY || e.changedTouches[0].pageY; 27 | state.refreshInstance.setStyle({ 28 | 'height': 0 29 | }); 30 | state.refreshInstance.callMethod("onchange", true); 31 | } 32 | 33 | function touchMove(e, ownerInstance) { 34 | var instance = e.instance; 35 | var state = instance.getState(); 36 | if (!state.canPullDown) { 37 | return 38 | } 39 | 40 | var oldHeight = state.height; 41 | var endY = e.touches[0].pageY || e.changedTouches[0].pageY; 42 | var height = endY - state.touchStartY; 43 | if (height > pullDown.maxHeight) { 44 | return; 45 | } 46 | 47 | var refreshInstance = state.refreshInstance; 48 | refreshInstance.setStyle({ 49 | 'height': height + 'px' 50 | }); 51 | 52 | height = height < pullDown.maxHeight ? height : pullDown.maxHeight; 53 | state.height = height; 54 | refreshInstance.callMethod(pullDown.callPullingDown, { 55 | height: height 56 | }); 57 | } 58 | 59 | function touchEnd(e, ownerInstance) { 60 | var state = e.instance.getState(); 61 | if (!state.canPullDown) { 62 | return 63 | } 64 | 65 | state.refreshInstance.callMethod("onchange", false); 66 | 67 | var refreshInstance = state.refreshInstance; 68 | if (state.height > pullDown.threshold) { 69 | refreshInstance.callMethod(pullDown.callRefresh); 70 | return; 71 | } 72 | 73 | refreshInstance.setStyle({ 74 | 'height': 0 75 | }); 76 | } 77 | 78 | function propObserver(newValue, oldValue, instance) { 79 | pullDown = newValue; 80 | } 81 | 82 | module.exports = { 83 | touchmove: touchMove, 84 | touchstart: touchStart, 85 | touchend: touchEnd, 86 | propObserver: propObserver 87 | } 88 | -------------------------------------------------------------------------------- /components/uni-section/uni-section.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 58 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /examples/7057e518bd7fbb71c3e182bf208aeeda.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/7057e518bd7fbb71c3e182bf208aeeda.gif -------------------------------------------------------------------------------- /examples/微信图片_20201107150908.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107150908.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150917.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107150917.png -------------------------------------------------------------------------------- /examples/微信图片_20201107150923.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107150923.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150932.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107150932.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150944.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107150944.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107150950.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107150950.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107163539.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107163539.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107163546.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107163546.jpg -------------------------------------------------------------------------------- /examples/微信图片_20201107165410.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107165410.png -------------------------------------------------------------------------------- /examples/微信图片_20201107165417.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/examples/微信图片_20201107165417.jpg -------------------------------------------------------------------------------- /libs/qqmap-wx-jssdk.min.js: -------------------------------------------------------------------------------- 1 | function t(t, e) { 2 | if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); 3 | } 4 | 5 | var e = function () { 6 | function t(t, e) { 7 | for (var i = 0; i < e.length; i++) { 8 | var s = e[i]; 9 | s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(t, s.key, s); 10 | } 11 | } 12 | 13 | return function (e, i, s) { 14 | return i && t(e.prototype, i), s && t(e, s), e; 15 | }; 16 | }(), 17 | i = { 18 | KEY_ERR: 311, 19 | KEY_ERR_MSG: "key格式错误", 20 | PARAM_ERR: 310, 21 | PARAM_ERR_MSG: "请求参数信息有误", 22 | SYSTEM_ERR: 600, 23 | SYSTEM_ERR_MSG: "系统错误", 24 | WX_ERR_CODE: 1e3, 25 | WX_OK_CODE: 200 26 | }, 27 | s = "https://apis.map.qq.com/ws/", 28 | o = s + "place/v1/suggestion", 29 | n = { 30 | driving: "driving", 31 | transit: "transit" 32 | }, 33 | r = { 34 | safeAdd: function (t, e) { 35 | var i = (65535 & t) + (65535 & e); 36 | return (t >> 16) + (e >> 16) + (i >> 16) << 16 | 65535 & i; 37 | }, 38 | bitRotateLeft: function (t, e) { 39 | return t << e | t >>> 32 - e; 40 | }, 41 | md5cmn: function (t, e, i, s, o, n) { 42 | return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(e, t), this.safeAdd(s, n)), o), i); 43 | }, 44 | md5ff: function (t, e, i, s, o, n, r) { 45 | return this.md5cmn(e & i | ~e & s, t, e, o, n, r); 46 | }, 47 | md5gg: function (t, e, i, s, o, n, r) { 48 | return this.md5cmn(e & s | i & ~s, t, e, o, n, r); 49 | }, 50 | md5hh: function (t, e, i, s, o, n, r) { 51 | return this.md5cmn(e ^ i ^ s, t, e, o, n, r); 52 | }, 53 | md5ii: function (t, e, i, s, o, n, r) { 54 | return this.md5cmn(i ^ (e | ~s), t, e, o, n, r); 55 | }, 56 | binlMD5: function (t, e) { 57 | t[e >> 5] |= 128 << e % 32, t[14 + (e + 64 >>> 9 << 4)] = e; 58 | var i, 59 | s, 60 | o, 61 | n, 62 | r, 63 | a = 1732584193, 64 | l = -271733879, 65 | d = -1732584194, 66 | c = 271733878; 67 | 68 | for (i = 0; i < t.length; i += 16) s = a, o = l, n = d, r = c, a = this.md5ff(a, l, d, c, t[i], 7, -680876936), c = this.md5ff(c, a, l, d, t[i + 1], 12, -389564586), d = this.md5ff(d, c, a, l, t[i + 2], 17, 606105819), l = this.md5ff(l, d, c, a, t[i + 3], 22, -1044525330), a = this.md5ff(a, l, d, c, t[i + 4], 7, -176418897), c = this.md5ff(c, a, l, d, t[i + 5], 12, 1200080426), d = this.md5ff(d, c, a, l, t[i + 6], 17, -1473231341), l = this.md5ff(l, d, c, a, t[i + 7], 22, -45705983), a = this.md5ff(a, l, d, c, t[i + 8], 7, 1770035416), c = this.md5ff(c, a, l, d, t[i + 9], 12, -1958414417), d = this.md5ff(d, c, a, l, t[i + 10], 17, -42063), l = this.md5ff(l, d, c, a, t[i + 11], 22, -1990404162), a = this.md5ff(a, l, d, c, t[i + 12], 7, 1804603682), c = this.md5ff(c, a, l, d, t[i + 13], 12, -40341101), d = this.md5ff(d, c, a, l, t[i + 14], 17, -1502002290), l = this.md5ff(l, d, c, a, t[i + 15], 22, 1236535329), a = this.md5gg(a, l, d, c, t[i + 1], 5, -165796510), c = this.md5gg(c, a, l, d, t[i + 6], 9, -1069501632), d = this.md5gg(d, c, a, l, t[i + 11], 14, 643717713), l = this.md5gg(l, d, c, a, t[i], 20, -373897302), a = this.md5gg(a, l, d, c, t[i + 5], 5, -701558691), c = this.md5gg(c, a, l, d, t[i + 10], 9, 38016083), d = this.md5gg(d, c, a, l, t[i + 15], 14, -660478335), l = this.md5gg(l, d, c, a, t[i + 4], 20, -405537848), a = this.md5gg(a, l, d, c, t[i + 9], 5, 568446438), c = this.md5gg(c, a, l, d, t[i + 14], 9, -1019803690), d = this.md5gg(d, c, a, l, t[i + 3], 14, -187363961), l = this.md5gg(l, d, c, a, t[i + 8], 20, 1163531501), a = this.md5gg(a, l, d, c, t[i + 13], 5, -1444681467), c = this.md5gg(c, a, l, d, t[i + 2], 9, -51403784), d = this.md5gg(d, c, a, l, t[i + 7], 14, 1735328473), l = this.md5gg(l, d, c, a, t[i + 12], 20, -1926607734), a = this.md5hh(a, l, d, c, t[i + 5], 4, -378558), c = this.md5hh(c, a, l, d, t[i + 8], 11, -2022574463), d = this.md5hh(d, c, a, l, t[i + 11], 16, 1839030562), l = this.md5hh(l, d, c, a, t[i + 14], 23, -35309556), a = this.md5hh(a, l, d, c, t[i + 1], 4, -1530992060), c = this.md5hh(c, a, l, d, t[i + 4], 11, 1272893353), d = this.md5hh(d, c, a, l, t[i + 7], 16, -155497632), l = this.md5hh(l, d, c, a, t[i + 10], 23, -1094730640), a = this.md5hh(a, l, d, c, t[i + 13], 4, 681279174), c = this.md5hh(c, a, l, d, t[i], 11, -358537222), d = this.md5hh(d, c, a, l, t[i + 3], 16, -722521979), l = this.md5hh(l, d, c, a, t[i + 6], 23, 76029189), a = this.md5hh(a, l, d, c, t[i + 9], 4, -640364487), c = this.md5hh(c, a, l, d, t[i + 12], 11, -421815835), d = this.md5hh(d, c, a, l, t[i + 15], 16, 530742520), l = this.md5hh(l, d, c, a, t[i + 2], 23, -995338651), a = this.md5ii(a, l, d, c, t[i], 6, -198630844), c = this.md5ii(c, a, l, d, t[i + 7], 10, 1126891415), d = this.md5ii(d, c, a, l, t[i + 14], 15, -1416354905), l = this.md5ii(l, d, c, a, t[i + 5], 21, -57434055), a = this.md5ii(a, l, d, c, t[i + 12], 6, 1700485571), c = this.md5ii(c, a, l, d, t[i + 3], 10, -1894986606), d = this.md5ii(d, c, a, l, t[i + 10], 15, -1051523), l = this.md5ii(l, d, c, a, t[i + 1], 21, -2054922799), a = this.md5ii(a, l, d, c, t[i + 8], 6, 1873313359), c = this.md5ii(c, a, l, d, t[i + 15], 10, -30611744), d = this.md5ii(d, c, a, l, t[i + 6], 15, -1560198380), l = this.md5ii(l, d, c, a, t[i + 13], 21, 1309151649), a = this.md5ii(a, l, d, c, t[i + 4], 6, -145523070), c = this.md5ii(c, a, l, d, t[i + 11], 10, -1120210379), d = this.md5ii(d, c, a, l, t[i + 2], 15, 718787259), l = this.md5ii(l, d, c, a, t[i + 9], 21, -343485551), a = this.safeAdd(a, s), l = this.safeAdd(l, o), d = this.safeAdd(d, n), c = this.safeAdd(c, r); 69 | 70 | return [a, l, d, c]; 71 | }, 72 | binl2rstr: function (t) { 73 | var e, 74 | i = "", 75 | s = 32 * t.length; 76 | 77 | for (e = 0; e < s; e += 8) i += String.fromCharCode(t[e >> 5] >>> e % 32 & 255); 78 | 79 | return i; 80 | }, 81 | rstr2binl: function (t) { 82 | var e, 83 | i = []; 84 | 85 | for (i[(t.length >> 2) - 1] = void 0, e = 0; e < i.length; e += 1) i[e] = 0; 86 | 87 | var s = 8 * t.length; 88 | 89 | for (e = 0; e < s; e += 8) i[e >> 5] |= (255 & t.charCodeAt(e / 8)) << e % 32; 90 | 91 | return i; 92 | }, 93 | rstrMD5: function (t) { 94 | return this.binl2rstr(this.binlMD5(this.rstr2binl(t), 8 * t.length)); 95 | }, 96 | rstrHMACMD5: function (t, e) { 97 | var i, 98 | s, 99 | o = this.rstr2binl(t), 100 | n = [], 101 | r = []; 102 | 103 | for (n[15] = r[15] = void 0, o.length > 16 && (o = this.binlMD5(o, 8 * t.length)), i = 0; i < 16; i += 1) n[i] = 909522486 ^ o[i], r[i] = 1549556828 ^ o[i]; 104 | 105 | return s = this.binlMD5(n.concat(this.rstr2binl(e)), 512 + 8 * e.length), this.binl2rstr(this.binlMD5(r.concat(s), 640)); 106 | }, 107 | rstr2hex: function (t) { 108 | var e, 109 | i, 110 | s = ""; 111 | 112 | for (i = 0; i < t.length; i += 1) e = t.charCodeAt(i), s += "0123456789abcdef".charAt(e >>> 4 & 15) + "0123456789abcdef".charAt(15 & e); 113 | 114 | return s; 115 | }, 116 | str2rstrUTF8: function (t) { 117 | return unescape(encodeURIComponent(t)); 118 | }, 119 | rawMD5: function (t) { 120 | return this.rstrMD5(this.str2rstrUTF8(t)); 121 | }, 122 | hexMD5: function (t) { 123 | return this.rstr2hex(this.rawMD5(t)); 124 | }, 125 | rawHMACMD5: function (t, e) { 126 | return this.rstrHMACMD5(this.str2rstrUTF8(t), str2rstrUTF8(e)); 127 | }, 128 | hexHMACMD5: function (t, e) { 129 | return this.rstr2hex(this.rawHMACMD5(t, e)); 130 | }, 131 | md5: function (t, e, i) { 132 | return e ? i ? this.rawHMACMD5(e, t) : this.hexHMACMD5(e, t) : i ? this.rawMD5(t) : this.hexMD5(t); 133 | }, 134 | getSig: function (t, e, i, s) { 135 | var o = null, 136 | n = []; 137 | return Object.keys(t).sort().forEach(function (e) { 138 | n.push(e + "=" + t[e]); 139 | }), "search" == i && (o = "/ws/place/v1/search?" + n.join("&") + e), "suggest" == i && (o = "/ws/place/v1/suggestion?" + n.join("&") + e), "reverseGeocoder" == i && (o = "/ws/geocoder/v1/?" + n.join("&") + e), "geocoder" == i && (o = "/ws/geocoder/v1/?" + n.join("&") + e), "getCityList" == i && (o = "/ws/district/v1/list?" + n.join("&") + e), "getDistrictByCityId" == i && (o = "/ws/district/v1/getchildren?" + n.join("&") + e), "calculateDistance" == i && (o = "/ws/distance/v1/?" + n.join("&") + e), "direction" == i && (o = "/ws/direction/v1/" + s + "?" + n.join("&") + e), o = this.md5(o); 140 | }, 141 | location2query: function (t) { 142 | if ("string" == typeof t) return t; 143 | 144 | for (var e = "", i = 0; i < t.length; i++) { 145 | var s = t[i]; 146 | e && (e += ";"), s.location && (e = e + s.location.lat + "," + s.location.lng), s.latitude && s.longitude && (e = e + s.latitude + "," + s.longitude); 147 | } 148 | 149 | return e; 150 | }, 151 | rad: function (t) { 152 | return t * Math.PI / 180; 153 | }, 154 | getEndLocation: function (t) { 155 | for (var e = t.split(";"), i = [], s = 0; s < e.length; s++) i.push({ 156 | lat: parseFloat(e[s].split(",")[0]), 157 | lng: parseFloat(e[s].split(",")[1]) 158 | }); 159 | 160 | return i; 161 | }, 162 | getDistance: function (t, e, i, s) { 163 | var o = this.rad(t), 164 | n = this.rad(i), 165 | r = o - n, 166 | a = this.rad(e) - this.rad(s), 167 | l = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(r / 2), 2) + Math.cos(o) * Math.cos(n) * Math.pow(Math.sin(a / 2), 2))); 168 | return l *= 6378136.49, l = Math.round(1e4 * l) / 1e4, parseFloat(l.toFixed(0)); 169 | }, 170 | getWXLocation: function (t, e, i) { 171 | uni.getLocation({ 172 | type: "gcj02", 173 | success: t, 174 | fail: e, 175 | complete: i 176 | }); 177 | }, 178 | getLocationParam: function (t) { 179 | return "string" == typeof t && (t = 2 === t.split(",").length ? { 180 | latitude: t.split(",")[0], 181 | longitude: t.split(",")[1] 182 | } : {}), t; 183 | }, 184 | polyfillParam: function (t) { 185 | t.success = t.success || function () {}, t.fail = t.fail || function () {}, t.complete = t.complete || function () {}; 186 | }, 187 | checkParamKeyEmpty: function (t, e) { 188 | if (!t[e]) { 189 | var s = this.buildErrorConfig(i.PARAM_ERR, i.PARAM_ERR_MSG + e + "参数格式有误"); 190 | return t.fail(s), t.complete(s), !0; 191 | } 192 | 193 | return !1; 194 | }, 195 | checkKeyword: function (t) { 196 | return !this.checkParamKeyEmpty(t, "keyword"); 197 | }, 198 | checkLocation: function (t) { 199 | var e = this.getLocationParam(t.location); 200 | 201 | if (!e || !e.latitude || !e.longitude) { 202 | var s = this.buildErrorConfig(i.PARAM_ERR, i.PARAM_ERR_MSG + " location参数格式有误"); 203 | return t.fail(s), t.complete(s), !1; 204 | } 205 | 206 | return !0; 207 | }, 208 | buildErrorConfig: function (t, e) { 209 | return { 210 | status: t, 211 | message: e 212 | }; 213 | }, 214 | handleData: function (t, e, i) { 215 | if ("search" == i) { 216 | for (var s = e.data, o = [], n = 0; n < s.length; n++) o.push({ 217 | id: s[n].id || null, 218 | title: s[n].title || null, 219 | latitude: s[n].location && s[n].location.lat || null, 220 | longitude: s[n].location && s[n].location.lng || null, 221 | address: s[n].address || null, 222 | category: s[n].category || null, 223 | tel: s[n].tel || null, 224 | adcode: s[n].ad_info && s[n].ad_info.adcode || null, 225 | city: s[n].ad_info && s[n].ad_info.city || null, 226 | district: s[n].ad_info && s[n].ad_info.district || null, 227 | province: s[n].ad_info && s[n].ad_info.province || null 228 | }); 229 | 230 | t.success(e, { 231 | searchResult: s, 232 | searchSimplify: o 233 | }); 234 | } else if ("suggest" == i) { 235 | for (var r = e.data, a = [], n = 0; n < r.length; n++) a.push({ 236 | adcode: r[n].adcode || null, 237 | address: r[n].address || null, 238 | category: r[n].category || null, 239 | city: r[n].city || null, 240 | district: r[n].district || null, 241 | id: r[n].id || null, 242 | latitude: r[n].location && r[n].location.lat || null, 243 | longitude: r[n].location && r[n].location.lng || null, 244 | province: r[n].province || null, 245 | title: r[n].title || null, 246 | type: r[n].type || null 247 | }); 248 | 249 | t.success(e, { 250 | suggestResult: r, 251 | suggestSimplify: a 252 | }); 253 | } else if ("reverseGeocoder" == i) { 254 | var l = e.result, 255 | d = { 256 | address: l.address || null, 257 | latitude: l.location && l.location.lat || null, 258 | longitude: l.location && l.location.lng || null, 259 | adcode: l.ad_info && l.ad_info.adcode || null, 260 | city: l.address_component && l.address_component.city || null, 261 | district: l.address_component && l.address_component.district || null, 262 | nation: l.address_component && l.address_component.nation || null, 263 | province: l.address_component && l.address_component.province || null, 264 | street: l.address_component && l.address_component.street || null, 265 | street_number: l.address_component && l.address_component.street_number || null, 266 | recommend: l.formatted_addresses && l.formatted_addresses.recommend || null, 267 | rough: l.formatted_addresses && l.formatted_addresses.rough || null 268 | }; 269 | 270 | if (l.pois) { 271 | for (var c = l.pois, u = [], n = 0; n < c.length; n++) u.push({ 272 | id: c[n].id || null, 273 | title: c[n].title || null, 274 | latitude: c[n].location && c[n].location.lat || null, 275 | longitude: c[n].location && c[n].location.lng || null, 276 | address: c[n].address || null, 277 | category: c[n].category || null, 278 | adcode: c[n].ad_info && c[n].ad_info.adcode || null, 279 | city: c[n].ad_info && c[n].ad_info.city || null, 280 | district: c[n].ad_info && c[n].ad_info.district || null, 281 | province: c[n].ad_info && c[n].ad_info.province || null 282 | }); 283 | 284 | t.success(e, { 285 | reverseGeocoderResult: l, 286 | reverseGeocoderSimplify: d, 287 | pois: c, 288 | poisSimplify: u 289 | }); 290 | } else t.success(e, { 291 | reverseGeocoderResult: l, 292 | reverseGeocoderSimplify: d 293 | }); 294 | } else if ("geocoder" == i) { 295 | var g = e.result, 296 | f = { 297 | title: g.title || null, 298 | latitude: g.location && g.location.lat || null, 299 | longitude: g.location && g.location.lng || null, 300 | adcode: g.ad_info && g.ad_info.adcode || null, 301 | province: g.address_components && g.address_components.province || null, 302 | city: g.address_components && g.address_components.city || null, 303 | district: g.address_components && g.address_components.district || null, 304 | street: g.address_components && g.address_components.street || null, 305 | street_number: g.address_components && g.address_components.street_number || null, 306 | level: g.level || null 307 | }; 308 | t.success(e, { 309 | geocoderResult: g, 310 | geocoderSimplify: f 311 | }); 312 | } else if ("getCityList" == i) { 313 | var h = e.result[0], 314 | m = e.result[1], 315 | p = e.result[2]; 316 | t.success(e, { 317 | provinceResult: h, 318 | cityResult: m, 319 | districtResult: p 320 | }); 321 | } else if ("getDistrictByCityId" == i) { 322 | var y = e.result[0]; 323 | t.success(e, y); 324 | } else if ("calculateDistance" == i) { 325 | for (var _ = e.result.elements, v = [], n = 0; n < _.length; n++) v.push(_[n].distance); 326 | 327 | t.success(e, { 328 | calculateDistanceResult: _, 329 | distance: v 330 | }); 331 | } else if ("direction" == i) { 332 | var R = e.result.routes; 333 | t.success(e, R); 334 | } else t.success(e); 335 | }, 336 | buildWxRequestConfig: function (t, e, s) { 337 | var o = this; 338 | return e.header = { 339 | "content-type": "application/json" 340 | }, e.method = "GET", e.success = function (e) { 341 | var i = e.data; 342 | 0 === i.status ? o.handleData(t, i, s) : t.fail(i); 343 | }, e.fail = function (e) { 344 | e.statusCode = i.WX_ERR_CODE, t.fail(o.buildErrorConfig(i.WX_ERR_CODE, e.errMsg)); 345 | }, e.complete = function (e) { 346 | switch (+e.statusCode) { 347 | case i.WX_ERR_CODE: 348 | t.complete(o.buildErrorConfig(i.WX_ERR_CODE, e.errMsg)); 349 | break; 350 | 351 | case i.WX_OK_CODE: 352 | var s = e.data; 353 | 0 === s.status ? t.complete(s) : t.complete(o.buildErrorConfig(s.status, s.message)); 354 | break; 355 | 356 | default: 357 | t.complete(o.buildErrorConfig(i.SYSTEM_ERR, i.SYSTEM_ERR_MSG)); 358 | } 359 | }, e; 360 | }, 361 | locationProcess: function (t, e, s, o) { 362 | var n = this; 363 | s = s || function (e) { 364 | e.statusCode = i.WX_ERR_CODE, t.fail(n.buildErrorConfig(i.WX_ERR_CODE, e.errMsg)); 365 | }, o = o || function (e) { 366 | e.statusCode == i.WX_ERR_CODE && t.complete(n.buildErrorConfig(i.WX_ERR_CODE, e.errMsg)); 367 | }, t.location ? n.checkLocation(t) && e(r.getLocationParam(t.location)) : n.getWXLocation(e, s, o); 368 | } 369 | }, 370 | a = function () { 371 | function i(e) { 372 | if (t(this, i), !e.key) throw Error("key值不能为空"); 373 | this.key = e.key; 374 | } 375 | 376 | return e(i, [{ 377 | key: "search", 378 | value: function (t) { 379 | var e = this; 380 | 381 | if (t = t || {}, r.polyfillParam(t), r.checkKeyword(t)) { 382 | var i = { 383 | keyword: t.keyword, 384 | orderby: t.orderby || "_distance", 385 | page_size: t.page_size || 10, 386 | page_index: t.page_index || 1, 387 | output: "json", 388 | key: e.key 389 | }; 390 | t.address_format && (i.address_format = t.address_format), t.filter && (i.filter = t.filter); 391 | var s = t.distance || "1000", 392 | o = t.auto_extend || 1, 393 | n = null, 394 | a = null; 395 | t.region && (n = t.region), t.rectangle && (a = t.rectangle); 396 | r.locationProcess(t, function (e) { 397 | n && !a ? (i.boundary = "region(" + n + "," + o + "," + e.latitude + "," + e.longitude + ")", t.sig && (i.sig = r.getSig(i, t.sig, "search"))) : a && !n ? (i.boundary = "rectangle(" + a + ")", t.sig && (i.sig = r.getSig(i, t.sig, "search"))) : (i.boundary = "nearby(" + e.latitude + "," + e.longitude + "," + s + "," + o + ")", t.sig && (i.sig = r.getSig(i, t.sig, "search"))), uni.request(r.buildWxRequestConfig(t, { 398 | url: "https://apis.map.qq.com/ws/place/v1/search", 399 | data: i 400 | }, "search")); 401 | }); 402 | } 403 | } 404 | }, { 405 | key: "getSuggestion", 406 | value: function (t) { 407 | var e = this; 408 | 409 | if (t = t || {}, r.polyfillParam(t), r.checkKeyword(t)) { 410 | var i = { 411 | keyword: t.keyword, 412 | region: t.region || "全国", 413 | region_fix: t.region_fix || 0, 414 | policy: t.policy || 0, 415 | page_size: t.page_size || 10, 416 | page_index: t.page_index || 1, 417 | get_subpois: t.get_subpois || 0, 418 | output: "json", 419 | key: e.key 420 | }; 421 | 422 | if (t.address_format && (i.address_format = t.address_format), t.filter && (i.filter = t.filter), t.location) { 423 | r.locationProcess(t, function (e) { 424 | i.location = e.latitude + "," + e.longitude, t.sig && (i.sig = r.getSig(i, t.sig, "suggest")), uni.request(r.buildWxRequestConfig(t, { 425 | url: o, 426 | data: i 427 | }, "suggest")); 428 | }); 429 | } else t.sig && (i.sig = r.getSig(i, t.sig, "suggest")), uni.request(r.buildWxRequestConfig(t, { 430 | url: o, 431 | data: i 432 | }, "suggest")); 433 | } 434 | } 435 | }, { 436 | key: "reverseGeocoder", 437 | value: function (t) { 438 | var e = this; 439 | t = t || {}, r.polyfillParam(t); 440 | var i = { 441 | coord_type: t.coord_type || 5, 442 | get_poi: t.get_poi || 0, 443 | output: "json", 444 | key: e.key 445 | }; 446 | t.poi_options && (i.poi_options = t.poi_options); 447 | r.locationProcess(t, function (e) { 448 | i.location = e.latitude + "," + e.longitude, t.sig && (i.sig = r.getSig(i, t.sig, "reverseGeocoder")), uni.request(r.buildWxRequestConfig(t, { 449 | url: "https://apis.map.qq.com/ws/geocoder/v1/", 450 | data: i 451 | }, "reverseGeocoder")); 452 | }); 453 | } 454 | }, { 455 | key: "geocoder", 456 | value: function (t) { 457 | var e = this; 458 | 459 | if (t = t || {}, r.polyfillParam(t), !r.checkParamKeyEmpty(t, "address")) { 460 | var i = { 461 | address: t.address, 462 | output: "json", 463 | key: e.key 464 | }; 465 | t.region && (i.region = t.region), t.sig && (i.sig = r.getSig(i, t.sig, "geocoder")), uni.request(r.buildWxRequestConfig(t, { 466 | url: "https://apis.map.qq.com/ws/geocoder/v1/", 467 | data: i 468 | }, "geocoder")); 469 | } 470 | } 471 | }, { 472 | key: "getCityList", 473 | value: function (t) { 474 | var e = this; 475 | t = t || {}, r.polyfillParam(t); 476 | var i = { 477 | output: "json", 478 | key: e.key 479 | }; 480 | t.sig && (i.sig = r.getSig(i, t.sig, "getCityList")), uni.request(r.buildWxRequestConfig(t, { 481 | url: "https://apis.map.qq.com/ws/district/v1/list", 482 | data: i 483 | }, "getCityList")); 484 | } 485 | }, { 486 | key: "getDistrictByCityId", 487 | value: function (t) { 488 | var e = this; 489 | 490 | if (t = t || {}, r.polyfillParam(t), !r.checkParamKeyEmpty(t, "id")) { 491 | var i = { 492 | id: t.id || "", 493 | output: "json", 494 | key: e.key 495 | }; 496 | t.sig && (i.sig = r.getSig(i, t.sig, "getDistrictByCityId")), uni.request(r.buildWxRequestConfig(t, { 497 | url: "https://apis.map.qq.com/ws/district/v1/getchildren", 498 | data: i 499 | }, "getDistrictByCityId")); 500 | } 501 | } 502 | }, { 503 | key: "calculateDistance", 504 | value: function (t) { 505 | var e = this; 506 | 507 | if (t = t || {}, r.polyfillParam(t), !r.checkParamKeyEmpty(t, "to")) { 508 | var i = { 509 | mode: t.mode || "walking", 510 | to: r.location2query(t.to), 511 | output: "json", 512 | key: e.key 513 | }; 514 | 515 | if (t.from && (t.location = t.from), "straight" == i.mode) { 516 | s = function (e) { 517 | for (var s = r.getEndLocation(i.to), o = { 518 | message: "query ok", 519 | result: { 520 | elements: [] 521 | }, 522 | status: 0 523 | }, n = 0; n < s.length; n++) o.result.elements.push({ 524 | distance: r.getDistance(e.latitude, e.longitude, s[n].lat, s[n].lng), 525 | duration: 0, 526 | from: { 527 | lat: e.latitude, 528 | lng: e.longitude 529 | }, 530 | to: { 531 | lat: s[n].lat, 532 | lng: s[n].lng 533 | } 534 | }); 535 | 536 | for (var a = o.result.elements, l = [], n = 0; n < a.length; n++) l.push(a[n].distance); 537 | 538 | return t.success(o, { 539 | calculateResult: a, 540 | distanceResult: l 541 | }); 542 | }; 543 | 544 | r.locationProcess(t, s); 545 | } else { 546 | var s = function (e) { 547 | i.from = e.latitude + "," + e.longitude, t.sig && (i.sig = r.getSig(i, t.sig, "calculateDistance")), uni.request(r.buildWxRequestConfig(t, { 548 | url: "https://apis.map.qq.com/ws/distance/v1/", 549 | data: i 550 | }, "calculateDistance")); 551 | }; 552 | 553 | r.locationProcess(t, s); 554 | } 555 | } 556 | } 557 | }, { 558 | key: "direction", 559 | value: function (t) { 560 | var e = this; 561 | 562 | if (t = t || {}, r.polyfillParam(t), !r.checkParamKeyEmpty(t, "to")) { 563 | var i = { 564 | output: "json", 565 | key: e.key 566 | }; 567 | "string" == typeof t.to ? i.to = t.to : i.to = t.to.latitude + "," + t.to.longitude; 568 | var s = null; 569 | t.mode = t.mode || n.driving, s = "https://apis.map.qq.com/ws/direction/v1/" + t.mode, t.from && (t.location = t.from), t.mode == n.driving && (t.from_poi && (i.from_poi = t.from_poi), t.heading && (i.heading = t.heading), t.speed && (i.speed = t.speed), t.accuracy && (i.accuracy = t.accuracy), t.road_type && (i.road_type = t.road_type), t.to_poi && (i.to_poi = t.to_poi), t.from_track && (i.from_track = t.from_track), t.waypoints && (i.waypoints = t.waypoints), t.policy && (i.policy = t.policy), t.plate_number && (i.plate_number = t.plate_number)), t.mode == n.transit && (t.departure_time && (i.departure_time = t.departure_time), t.policy && (i.policy = t.policy)); 570 | r.locationProcess(t, function (e) { 571 | i.from = e.latitude + "," + e.longitude, t.sig && (i.sig = r.getSig(i, t.sig, "direction", t.mode)), uni.request(r.buildWxRequestConfig(t, { 572 | url: s, 573 | data: i 574 | }, "direction")); 575 | }); 576 | } 577 | } 578 | }]), i; 579 | }(); 580 | 581 | module.exports = a; -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | 4 | Vue.config.productionTip = false 5 | 6 | Vue.mixin({ 7 | methods: { 8 | setData: function(obj, callback) { 9 | let that = this; 10 | const handleData = (tepData, tepKey, afterKey) => { 11 | tepKey = tepKey.split('.'); 12 | tepKey.forEach(item => { 13 | if (tepData[item] === null || tepData[item] === undefined) { 14 | let reg = /^[0-9]+$/; 15 | tepData[item] = reg.test(afterKey) ? [] : {}; 16 | tepData = tepData[item]; 17 | } else { 18 | tepData = tepData[item]; 19 | } 20 | }); 21 | return tepData; 22 | }; 23 | const isFn = function(value) { 24 | return typeof value == 'function' || false; 25 | }; 26 | Object.keys(obj).forEach(function(key) { 27 | let val = obj[key]; 28 | key = key.replace(/\]/g, '').replace(/\[/g, '.'); 29 | let front, after; 30 | let index_after = key.lastIndexOf('.'); 31 | if (index_after != -1) { 32 | after = key.slice(index_after + 1); 33 | front = handleData(that, key.slice(0, index_after), after); 34 | } else { 35 | after = key; 36 | front = that; 37 | } 38 | if (front.$data && front.$data[after] === undefined) { 39 | Object.defineProperty(front, after, { 40 | get() { 41 | return front.$data[after]; 42 | }, 43 | set(newValue) { 44 | front.$data[after] = newValue; 45 | that.$forceUpdate(); 46 | }, 47 | enumerable: true, 48 | configurable: true 49 | }); 50 | front[after] = val; 51 | } else { 52 | that.$set(front, after, val); 53 | } 54 | }); 55 | // this.$forceUpdate(); 56 | isFn(callback) && this.$nextTick(callback); 57 | } 58 | } 59 | }); 60 | 61 | App.mpType = 'app' 62 | 63 | const app = new Vue({ 64 | ...App 65 | }) 66 | app.$mount() 67 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "惠吃会喝", 3 | "appid" : "__UNI__C0FA532", 4 | "description" : "", 5 | "versionName" : "1.0.2", 6 | "versionCode" : 102, 7 | "transformPx" : false, 8 | "app-plus" : { 9 | "nvueCompiler" : "uni-app", 10 | "compilerVersion" : 3, 11 | "modules" : { 12 | "Share" : {} 13 | }, 14 | "distribute" : { 15 | "android" : { 16 | "permissions" : [ 17 | "", 18 | "", 19 | "", 20 | "", 21 | "", 22 | "", 23 | "", 24 | "", 25 | "", 26 | "", 27 | "", 28 | "", 29 | "", 30 | "", 31 | "", 32 | "", 33 | "", 34 | "", 35 | "", 36 | "", 37 | "", 38 | "" 39 | ] 40 | }, 41 | "ios" : {}, 42 | "sdkConfigs" : { 43 | "oauth" : { 44 | "weixin" : { 45 | "appid" : "wx9472d5ad54e879ed", 46 | "appsecret" : "", 47 | "UniversalLinks" : "" 48 | } 49 | }, 50 | "share" : { 51 | "weixin" : { 52 | "appid" : "wx9472d5ad54e879ed", 53 | "UniversalLinks" : "" 54 | } 55 | } 56 | } 57 | } 58 | }, 59 | "quickapp" : {}, 60 | "mp-weixin" : { 61 | "appid" : "wx9472d5ad54e879ed", 62 | "setting" : { 63 | "urlCheck" : true, 64 | "minified" : true, 65 | "postcss" : true, 66 | "es6" : true 67 | }, 68 | "permission" : { 69 | "scope.userLocation" : { 70 | "desc" : "根据地址推荐吃什么" 71 | } 72 | } 73 | }, 74 | "h5" : { 75 | "optimization" : { 76 | "treeShaking" : { 77 | "enable" : true 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /pages.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | { 4 | "path": "pages/index/index", 5 | "style": { 6 | "navigationBarTitleText": "惠吃会喝" 7 | } 8 | }, 9 | { 10 | "path" : "pages/eatwhat/eatwhat", 11 | "style": { 12 | "navigationBarTitleText": "吃什么" 13 | } 14 | }, 15 | { 16 | "path" : "pages/home/home", 17 | "style": { 18 | "navigationBarTitleText": "个人中心" 19 | } 20 | } 21 | ], 22 | // #ifdef MP-WEIXIN 23 | "tabBar": { 24 | "borderStyle": "black", 25 | "backgroundColor": "white", 26 | "color": "#333333", 27 | "fontSize" : "24upx", 28 | "selectedColor": "#f4c242", 29 | "list": [{ 30 | "pagePath": "pages/index/index", 31 | "text": "领券", 32 | "iconPath": "static/home.png", 33 | "selectedIconPath": "static/home-active.png" 34 | }, 35 | { 36 | "pagePath": "pages/eatwhat/eatwhat", 37 | "text": "吃什么", 38 | "iconPath": "static/whatwedo.png", 39 | "selectedIconPath": "static/whatwedo-active.png" 40 | }, 41 | { 42 | "pagePath": "pages/home/home", 43 | "text": "个人中心", 44 | "iconPath": "static/person.png", 45 | "selectedIconPath": "static/person-active.png" 46 | } 47 | ] 48 | 49 | }, 50 | // #endif 51 | "globalStyle": { 52 | "navigationBarTextStyle": "white", 53 | "navigationBarTitleText": "惠吃会喝", 54 | "navigationBarBackgroundColor": "#F0AD4E", 55 | "backgroundColor": "#FFFFFF", 56 | "titleView": false, 57 | "h5": { 58 | "titleNView": false 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /pages/eatwhat/eatwhat.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 336 | -------------------------------------------------------------------------------- /pages/home/home.vue: -------------------------------------------------------------------------------- 1 | 16 | 41 | 257 | 258 | 261 | -------------------------------------------------------------------------------- /pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 290 | 291 | 381 | -------------------------------------------------------------------------------- /static/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/11.png -------------------------------------------------------------------------------- /static/all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/all.png -------------------------------------------------------------------------------- /static/coupon/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/11.jpg -------------------------------------------------------------------------------- /static/coupon/ele.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/ele.png -------------------------------------------------------------------------------- /static/coupon/ele_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/ele_banner.png -------------------------------------------------------------------------------- /static/coupon/ele_guosu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/ele_guosu.png -------------------------------------------------------------------------------- /static/coupon/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/jd.png -------------------------------------------------------------------------------- /static/coupon/meituan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/meituan.png -------------------------------------------------------------------------------- /static/coupon/meituan_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/meituan_banner.png -------------------------------------------------------------------------------- /static/coupon/sanzhisongshu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/sanzhisongshu.png -------------------------------------------------------------------------------- /static/coupon/vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/vip.png -------------------------------------------------------------------------------- /static/coupon/vip_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/coupon/vip_banner.png -------------------------------------------------------------------------------- /static/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/demo.png -------------------------------------------------------------------------------- /static/didi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/didi.jpg -------------------------------------------------------------------------------- /static/ding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/ding.png -------------------------------------------------------------------------------- /static/dytx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/dytx.png -------------------------------------------------------------------------------- /static/ele.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/ele.png -------------------------------------------------------------------------------- /static/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/error.png -------------------------------------------------------------------------------- /static/home-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/home-active.png -------------------------------------------------------------------------------- /static/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/home.png -------------------------------------------------------------------------------- /static/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/jd.png -------------------------------------------------------------------------------- /static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/logo.png -------------------------------------------------------------------------------- /static/meituan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/meituan.png -------------------------------------------------------------------------------- /static/notify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/notify.png -------------------------------------------------------------------------------- /static/person-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/person-active.png -------------------------------------------------------------------------------- /static/person.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/person.png -------------------------------------------------------------------------------- /static/raise.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/raise.jpeg -------------------------------------------------------------------------------- /static/s-dial_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/s-dial_bg.png -------------------------------------------------------------------------------- /static/s-dial_pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/s-dial_pointer.png -------------------------------------------------------------------------------- /static/search-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/search-active.png -------------------------------------------------------------------------------- /static/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/search.png -------------------------------------------------------------------------------- /static/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/share.png -------------------------------------------------------------------------------- /static/share_pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/share_pic.png -------------------------------------------------------------------------------- /static/to.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/to.png -------------------------------------------------------------------------------- /static/uni.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/uni.ttf -------------------------------------------------------------------------------- /static/vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/vip.png -------------------------------------------------------------------------------- /static/whatwedo-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/whatwedo-active.png -------------------------------------------------------------------------------- /static/whatwedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/whatwedo.png -------------------------------------------------------------------------------- /static/wx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/wx.png -------------------------------------------------------------------------------- /static/订阅提示.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunJackson/coupons-ss/c11803b327ac54102fe881570cb709151d3a6804/static/订阅提示.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; --------------------------------------------------------------------------------