diff --git a/app.json b/app.json index fc91782..d46fb7d 100644 --- a/app.json +++ b/app.json @@ -4,7 +4,8 @@ "pages/index/index", "pages/login/index", "pages/privacy/index", - "pages/detail/index" + "pages/detail/index", + "pages/scanCode/index" ], "window": { "navigationStyle": "custom", @@ -19,4 +20,4 @@ "desc": "你的位置信息将用于小程序位置接口的效果展示" } } -} +} \ No newline at end of file diff --git a/getMapData.js b/getMapData.js index ad6fc61..2162b11 100644 --- a/getMapData.js +++ b/getMapData.js @@ -8,7 +8,7 @@ export const cdnUrl = "https://test-598d.1000my.com"; const baseUrl = "https://project-iot.test.1000my.com"; export const code = "project-skcn0gk6yb2xutkcsmjtra"; export const post = (url, data) => - new Promise((resolve) => { + new Promise((resolve, reject) => { wx.request({ url: baseUrl + url, method: "POST", diff --git a/pages/scanCode/back.svg b/pages/scanCode/back.svg new file mode 100644 index 0000000..3a2dcd6 --- /dev/null +++ b/pages/scanCode/back.svg @@ -0,0 +1,4 @@ + + + + diff --git a/pages/scanCode/border.svg b/pages/scanCode/border.svg new file mode 100644 index 0000000..0533ee6 --- /dev/null +++ b/pages/scanCode/border.svg @@ -0,0 +1,3 @@ + + + diff --git a/pages/scanCode/close.svg b/pages/scanCode/close.svg new file mode 100644 index 0000000..5a04b4a --- /dev/null +++ b/pages/scanCode/close.svg @@ -0,0 +1,4 @@ + + + + diff --git a/pages/scanCode/index.js b/pages/scanCode/index.js new file mode 100644 index 0000000..78f885b --- /dev/null +++ b/pages/scanCode/index.js @@ -0,0 +1,80 @@ +import { post } from "../../getMapData"; +Page({ + /** + * 页面的初始数据 + */ + data: {}, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) {}, + async handleCode(e) { + try { + const memberID = getApp().globalData.memberID; + const { code, msg } = await post("/api/ar/v1/applet/writeoffcoupon", { + orderNo: e.detail.result, + memberID, + }); + if (code === 200) { + wx.showToast({ + icon: "none", + title: "核销成功", + }); + setTimeout(() => { + wx.redirectTo({ + url: "/pages/h5map/index?e=writeoff", + }); + }, 1000); + } else { + wx.showToast({ + icon: "none", + title: msg, + }); + return false; + } + } catch (error) { + return false; + } + }, + back() { + wx.redirectTo({ + url: "/pages/h5map/index?e=writeoff", + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/pages/scanCode/index.json b/pages/scanCode/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/scanCode/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/scanCode/index.wxml b/pages/scanCode/index.wxml new file mode 100644 index 0000000..961a0ba --- /dev/null +++ b/pages/scanCode/index.wxml @@ -0,0 +1,9 @@ + + + + + + 手动输入券码 + + + \ No newline at end of file diff --git a/pages/scanCode/index.wxss b/pages/scanCode/index.wxss new file mode 100644 index 0000000..ee523b5 --- /dev/null +++ b/pages/scanCode/index.wxss @@ -0,0 +1,71 @@ +.scanCode { + position: relative; + width: 100vw; + height: 100vh; + background: #353230; +} + +.back { + position: absolute; + bottom: 48px; + left: 0; + right: 0; + margin: auto; + width: 48px; + height: 48px; +} +.btn { + position: absolute; + height: 56px; + left: 29px; + right: 28px; + bottom: 130px; + background: #ffffff; + border-radius: 10px; + font-weight: 600; + font-size: 16px; + line-height: 22px; + color: #437af7; + display: flex; + justify-content: center; + align-items: center; +} +@keyframes scaner { + 0% { + top: 10px; + } + 100% { + top: 340px; + } +} +.border { + position: absolute; + top: 94px; + left: 0; + right: 0; + margin: auto; + width: 320px; + height: 320px; + z-index: 1; +} +.scaner { + position: absolute; + left: 0; + right: 0; + margin: auto; + width: 320px; + height: 74px; + animation: 1s scaner infinite ease-in-out; + z-index: 3; + pointer-events: none; +} +.camera { + position: absolute; + top: 114px; + left: 0; + right: 0; + margin: auto; + width: 280px; + height: 280px; + z-index: 2; +} diff --git a/pages/scanCode/scaner.svg b/pages/scanCode/scaner.svg new file mode 100644 index 0000000..0184e9b --- /dev/null +++ b/pages/scanCode/scaner.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/project.config.json b/project.config.json index cd8b0c1..4d2113e 100644 --- a/project.config.json +++ b/project.config.json @@ -36,7 +36,8 @@ "showES6CompileOption": false, "useCompilerPlugins": false, "ignoreUploadUnusedFiles": true, - "useStaticServer": true + "useStaticServer": true, + "condition": false }, "compileType": "miniprogram", "condition": { diff --git a/project.private.config.json b/project.private.config.json index 952a2b1..6d123af 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -18,6 +18,13 @@ "query": "e=activities026eb3c7-41a7-4e07-bd4a-07e3d9dc3af1", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/scanCode/index", + "query": "", + "launchMode": "default", + "scene": null } ] }