diff --git a/app.js b/app.js index e190d43..34129a3 100644 --- a/app.js +++ b/app.js @@ -21,12 +21,12 @@ App({ CustomBar: null, bgIndex:null, rpx:null, - bgs: ['https://qrcode-1256486458.cos.ap-chengdu.myqcloud.com/bg/bg1.jpg', - 'https://qrcode-1256486458.cos.ap-chengdu.myqcloud.com/bg/bg2.jpg', - 'https://qrcode-1256486458.cos.ap-chengdu.myqcloud.com/bg/bg3.jpg', - 'https://qrcode-1256486458.cos.ap-chengdu.myqcloud.com/bg/bg4.jpg', - 'https://qrcode-1256486458.cos.ap-chengdu.myqcloud.com/bg/bg5.jpg', - 'https://qrcode-1256486458.cos.ap-chengdu.myqcloud.com/bg/bg6.jpg',], + bgs: ['https://qr.lacus.site/qr/img/bg1.jpg', + 'https://qr.lacus.site/qr/img/bg2.jpg', + 'https://qr.lacus.site/qr/img/bg3.jpg', + 'https://qr.lacus.site/qr/img/bg4.jpg', + 'https://qr.lacus.site/qr/img/bg5.jpg', + 'https://qr.lacus.site/qr/img/bg6.jpg',], is_apple:false, } }) \ No newline at end of file diff --git a/app.json b/app.json index ff9cfdf..fb2e7e5 100644 --- a/app.json +++ b/app.json @@ -12,8 +12,5 @@ "enablePullDownRefresh": false, "navigationStyle": "custom" }, - "sitemapLocation": "sitemap.json", - "navigateToMiniProgramAppIdList": [ - "wx959c8c1fb2d877b5" - ] + "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/lib/api.js b/lib/api.js index 8d5640f..50df79c 100644 --- a/lib/api.js +++ b/lib/api.js @@ -1,5 +1,5 @@ var util = require('./util') -var base_url = 'https://qr.powerrain.cn/' +var base_url = 'https://qr.lacus.site' const getyiyian = callBack => { wx.request({ url: 'https://v1.hitokoto.cn/', @@ -230,12 +230,12 @@ const createCode = (data, callBack) => { if (res.data.errcode !== 200) { wx.hideLoading(); wx.showToast({ - title: "创建订单失败", + title: "创建代码失败", icon: "none" }) console.log(data,res) } else { - callBack && callBack(JSON.parse(res.data.id)['$oid']); + callBack && callBack(res.data.id); } }, }) diff --git a/lib/util.js b/lib/util.js index 6f6feac..cb8a510 100644 --- a/lib/util.js +++ b/lib/util.js @@ -131,13 +131,6 @@ const checkSubmit = (c) => { }) return false } - if(!c.month) { - wx.showToast({ - title: '请输入您的使用时长', - icon: 'none' - }) - return false - } var data = {} data['wxcode'] = c.wxcode data['alcode'] = c.alcode @@ -145,12 +138,7 @@ const checkSubmit = (c) => { data['username'] = c.username data['openId'] = c.openId data['node'] = c.node - data['timeout'] = ((new Date()).getTime() + 1000*60*60*24*30*c.month).toString() - var totalFee = c.month * 0.5 * 100 - return { - data: data, - totalFee: totalFee - } + return data } module.exports = { diff --git a/pages/home/home.js b/pages/home/home.js index 8b93ed0..6c0e4a1 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -32,12 +32,7 @@ Page({ username: '', openId: wx.getStorageSync('openid'), node: '', - timeout: '', - month: 0 }, - orderParams: {}, // 支付发起参数 - preparePay: false, // 控制 payjs 组件的创建与销毁 - paying: false, // 可选:如需知晓用户是否「已经跳转到了 PAYJS 小程序还未返回」的状态则可通过事件处理函数监听事件内的 paying 数据 showBest: false }, @@ -144,12 +139,9 @@ Page({ username: '', openId: wx.getStorageSync('openid'), node: '', - timeout: '', - month: 0 } that.setData({ - createCode: that.data.createCode, - orderParams: {} + createCode: that.data.createCode }) that.data.codeSrc = null let display = that.data.display @@ -177,12 +169,9 @@ Page({ username: '', openId: wx.getStorageSync('openid'), node: '', - timeout: '', - month: 0 } that.setData({ - createCode: that.data.createCode, - orderParams: {} + createCode: that.data.createCode }) that.data.codeSrc = null let display = that.data.display @@ -227,25 +216,6 @@ Page({ this.data.animating = false return } - // 不支持苹果手机的警告 - // if (type == 'start' && g.is_apple) { - // wx.showModal({ - // title: '警告', - // content: '本应用不支持苹果手机', - // showCancel: false - // }) - // this.data.animating = false - // return - // } - if (type == 'start' && this.data.codes.length >= 3) { - wx.showModal({ - title: '警告', - content: '一个人最多持有三个二维码', - showCancel: false - }) - this.data.animating = false - return - } this.setData({ show: true, }) @@ -267,33 +237,11 @@ Page({ //处理数据 manageCodes: function (callBack) { let codes = wx.getStorageSync('codes') - for (let i in codes) { - let end = this.TimeDown(codes[i]['timeout']) - codes[i]['end'] = end; - } this.setData({ codes: codes }) callBack && callBack() }, - //时间处理辅助轮 - TimeDown: function (arg) { - arg = parseInt(arg) - //结束时间 - var endDate = new Date(arg); - //当前时间 - var nowDate = new Date(); - //相差的总秒数 - var totalSeconds = parseInt((endDate - nowDate) / 1000); - //天数 - var days = Math.floor(totalSeconds / (60 * 60 * 24)); - //取模(余数) - var modulo = totalSeconds % (60 * 60 * 24); - //小时数 - var hours = Math.floor(modulo / (60 * 60)); - - return days + "天" + hours + "小时" - }, //删除二维码 delCode: function (e) { @@ -401,7 +349,7 @@ Page({ var canvas = wx.createCanvasContext('qrcode'); canvas.drawImage(canvasimgbg, 0, 0, 632 * rpx, 1054 * rpx); wx.downloadFile({ - url: 'https://api.ooopn.com/qr/api.php?text=https%3A%2F%2Fqr.powerrain.cn%2Fqr%3Fid%3D' + id, + url: 'https://qr.lacus.site/generate?text=https%3A%2F%2Fqr.lacus.site%2Fqr%2Fqrcode.html%3Fid%3D' + id, success: function (res) { canvasimgbg = res.tempFilePath canvas.drawImage(canvasimgbg, 66 * rpx, 66 * rpx, 500 * rpx, 500 * rpx); @@ -412,7 +360,7 @@ Page({ canvas.font = fontSet2; canvas.fillText('本二维码支持以下APP向我付款', 316 * rpx, 760 * rpx) wx.downloadFile({ - url: 'https://qrcode-1256486458.cos.ap-chengdu.myqcloud.com/sprite/sprite1.png', + url: 'https://qr.lacus.site/qr/img/sprite1.png', success: function (res) { canvasimgbg = res.tempFilePath //先画左右,再画中间 @@ -486,7 +434,7 @@ Page({ }) }, - //输入用户名,月份啥的 + //输入用户名,备注 inputChange: function (e) { var type = e.currentTarget.dataset.type var value = e.detail.value @@ -502,12 +450,6 @@ Page({ //提交 submit: function () { - if (Object.keys(this.data.orderParams).length != 0) { - this.setData({ - preparePay: true - }) - return - } var that = this; var res = util.checkSubmit(this.data.createCode) if (!res) return @@ -516,19 +458,11 @@ Page({ title: '疯狂上传中', mask: true }) - // 获取order 然后调起支付接口 - // api.createOrder(res.totalFee, res.data, function (parms) { - // that.setData({ - // preparePay: true, - // orderParams: parms - // }) - // wx.hideLoading() - // }) - api.createCode(res.data,function (order_id) { + api.createCode(res,function (oid) { //重置createCode var data = that.data.createCode data._id = {} - data._id['$oid'] = order_id + data._id['$oid'] = oid that.data.createCode = { wxcode: '', qqcode: '', @@ -536,12 +470,9 @@ Page({ username: '', openId: wx.getStorageSync('openid'), node: '', - timeout: '', - month: 0 } that.setData({ createCode: that.data.createCode, - orderParams: {} }) //调起绘制二维码的界面 //刷新并处理数据 @@ -552,110 +483,6 @@ Page({ wx.hideLoading() that.rouseQRcode(false,data) }) - - - }, - - /** - * 支付成功的事件处理函数 - * - * res.detail 为 PAYJS 小程序返回的订单信息 - * - * 可通过 res.detail.payjsOrderId 拿到 PAYJS 订单号 - * 可通过 res.detail.responseData 拿到详细支付信息 - */ - bindPaySuccess(res) { - wx.showLoading({ - title: '订单查询中', - mask: true - }); - var that = this - console.log('success', res) - console.log('[支付成功] PAYJS 订单号:', res.detail.payjsOrderId) - console.log('outTradeNo', res.detail.outTradeNo) - // 进行checkOrder - api.checkOrder(res.detail.outTradeNo, function (order_id) { - //重置createCode - var data = that.data.createCode - data._id = {} - data._id['$oid'] = order_id - that.data.createCode = { - wxcode: '', - qqcode: '', - alcode: '', - username: '', - openId: wx.getStorageSync('openid'), - node: '', - timeout: '', - month: 0 - } - that.setData({ - createCode: that.data.createCode, - orderParams: {} - }) - //调起绘制二维码的界面 - wx.hideLoading() - that.rouseQRcode(false,data) - }, function () { - if (that.data.show) - that.showUtils() - }) - - //刷新并处理数据 - api.reflash(wx.getStorageSync('openid'), function (info) { - wx.setStorageSync('codes', info); - that.manageCodes() - }) - }, - /** - * 支付失败的事件处理函数 - * - * res.detail.error 为 true 代表传入小组件的参数存在问题 - * res.detail.navigateSuccess 代表了是否成功跳转到 PAYJS 小程序 - * res.detail.info 可能存有失败的原因 - * - * 如果下单成功但是用户取消支付则可在 res.detail.info.payjsOrderId 拿到 payjs 订单号 - */ - bindPayFail(res) { - console.log('fail', res) - if (res.detail.error) { - // 后端订单生成完成 - // !!!!苹果手机会卡在这里!!! - console.error('发起支付失败', res.detail.info) - - } else if (res.detail.navigateSuccess) { - // 跳转到了付款界面但是没付款 - console.log('[取消支付] PAYJS 订单号:', res.detail.info.payjsOrderId) - - } else { - // 用户放弃了付款,没跳转,再次跳转还可以进行支付 - // 目测啥都不用干 - } - }, - /** - * 支付完毕的事件处理函数 - * - * 无论支付成功或失败均会执行 - * 应当在此销毁 payjs 组件 - */ - bindPayComplete() { - console.log('complete') - this.setData({ - preparePay: false, // 销毁 payjs 组件 - }) - }, - /** - * 【可选】组件内部数据被修改时的事件 - * - * 当前仅用于监听 paying 数据 - * 当用户跳转到 PAYJS 小程序并等待返回的过程中 paying 值为 true - */ - bindDataChange(res) { - if (res.detail.paying) { - this.setData({ - paying: res.detail.paying - }) - } }, showQrcode() { diff --git a/pages/home/home.wxml b/pages/home/home.wxml index b66a564..01b2276 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -40,7 +40,6 @@ 名称:{{item.username}} 备注:{{item.node?item.node:'您没写呀'}} - 剩余时间:{{item.end}} @@ -59,7 +58,7 @@ 轻松创建属于自己的三合一收款码 1.合并后的收款码有扫码次数和时间限制嘛? - 在你填写的时间之内完全没有限制,随便扫,放开了扫 + 完全没有限制,随便扫,放开了扫 2.合并后的收款码安全嘛? 怎么说呢,别人拿到了这个收款码,唯一能做的事情就是给你付钱。你说它安不安全~hhh 3.钱收完去哪了 @@ -108,11 +107,6 @@ - - 使用时长/月 - - - 确认合并 @@ -130,5 +124,4 @@ {{codes.length}} 个 - - \ No newline at end of file + \ No newline at end of file diff --git a/project.config.json b/project.config.json index 91b7b82..af98248 100644 --- a/project.config.json +++ b/project.config.json @@ -1,55 +1,60 @@ { - "description": "项目配置文件", - "packOptions": { - "ignore": [] - }, - "setting": { - "urlCheck": true, - "es6": true, - "postcss": true, - "minified": true, - "newFeature": true, - "coverView": true, - "autoAudits": false, - "showShadowRootInWxmlPanel": true, - "scopeDataCheck": false, - "checkInvalidKey": true, - "checkSiteMap": false, - "uploadWithSourceMap": true, - "babelSetting": { - "ignore": [], - "disablePlugins": [], - "outputPath": "" - }, - "useCompilerModule": false, - "userConfirmedUseCompilerModuleSwitch": false - }, - "compileType": "miniprogram", - "libVersion": "2.9.2", - "appid": "wx0df150c438e4c8f0", - "projectname": "%E4%BA%8C%E7%BB%B4%E7%A0%81%E5%90%88%E5%B9%B6", - "debugOptions": { - "hidedInDevtools": [] - }, - "isGameTourist": false, - "simulatorType": "wechat", - "simulatorPluginLibVersion": {}, - "condition": { - "search": { - "current": -1, - "list": [] - }, - "conversation": { - "current": -1, - "list": [] - }, - "game": { - "currentL": -1, - "list": [] - }, - "miniprogram": { - "current": -1, - "list": [] - } - } + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "urlCheck": true, + "es6": true, + "postcss": true, + "minified": true, + "newFeature": true, + "coverView": true, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "checkInvalidKey": true, + "checkSiteMap": false, + "uploadWithSourceMap": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "useIsolateContext": true, + "useCompilerModule": false, + "userConfirmedUseCompilerModuleSwitch": false, + "userConfirmedBundleSwitch": false, + "packNpmManually": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "useMultiFrameRuntime": false, + "useApiHook": true, + "bundle": false + }, + "compileType": "miniprogram", + "libVersion": "2.9.2", + "appid": "wx0df150c438e4c8f0", + "projectname": "%E4%BA%8C%E7%BB%B4%E7%A0%81%E5%90%88%E5%B9%B6", + "debugOptions": { + "hidedInDevtools": [] + }, + "isGameTourist": false, + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "currentL": -1, + "list": [] + }, + "miniprogram": { + "list": [] + } + } } \ No newline at end of file