diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..413c7ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +*unpackage \ No newline at end of file diff --git a/api/index.js b/api/index.js new file mode 100644 index 0000000..835cbd0 --- /dev/null +++ b/api/index.js @@ -0,0 +1,44 @@ +import http from "./interface"; + +const sendCode = (data) => { + return http.request({ + url: "/api/staff/send", + method: "POST", + data, + }); +}; +const login = (data) => { + return http.request({ + url: "/api/staff/login", + method: "POST", + data, + }); +}; +const qrCodeInfo = (data) => { + return http.request({ + url: "/api/smart/appointment/get/ticket/info", + method: "POST", + data, + }); +}; +const checkQr = (data) => { + return http.request({ + url: "/api/smart/check/verify/qrCode", + method: "POST", + data, + }); +}; +const openPicUrl = (data) => { + return http.request({ + url: "/api/smart/check/start/camera", + method: "POST", + data, + }); +}; +export default { + sendCode, + login, + qrCodeInfo, + checkQr, + openPicUrl, +}; diff --git a/api/interface.js b/api/interface.js new file mode 100644 index 0000000..f5d61cf --- /dev/null +++ b/api/interface.js @@ -0,0 +1,169 @@ +/** + * 通用uni-app网络请求 + * 基于 Promise 对象实现更简单的 request 使用方式,支持请求和响应拦截 + */ +export default { + config: { + baseUrl: "https://warehouse.szjixun.cn/ticket", //"http://172.16.100.93:9051", //"http://192.168.88.175:9021",//'https://warehouse.szjixun.cn' + header: { + "Content-Type": "application/json;charset=UTF-8", + // 'Content-Type':'application/x-www-form-urlencoded' + }, + data: {}, + method: "GET", + dataType: "json" /* 如设为json,会对返回的数据做一次 JSON.parse */, + responseType: "text", + success() {}, + fail() {}, + complete() {}, + }, + interceptor: { + request: null, + response: null, + }, + request(options) { + if (!options) { + options = {}; + } + options.baseUrl = options.baseUrl || this.config.baseUrl; + options.dataType = options.dataType || this.config.dataType; + options.url = options.baseUrl + options.url; + options.data = options.data || {}; + options.method = options.method || this.config.method; + //TODO 加密数据 + options.header = options.header || this.config.header; + //TODO 数据签名 + let _token = { + StaffAuthorization: uni.getStorageSync("token") || "undefined", + }; + options.header = Object.assign({}, options.header, _token); + /* + _sign = {'sign': sign(JSON.stringify(options.data))} + options.header = Object.assign({}, options.header, _token,_sign) + */ + + return new Promise((resolve, reject) => { + let _config = null; + + options.complete = (response) => { + let statusCode = response.statusCode; + response.config = _config; + if (process.env.NODE_ENV === "development") { + if (statusCode === 200) { + // console.log("【" + _config.requestId + "】 结果:" + JSON.stringify(response.data)) + } + } + if (this.interceptor.response) { + let newResponse = this.interceptor.response(response); + if (newResponse) { + response = newResponse; + } + } + if (response.data?.status === 401) { + let curPage = getCurrentPages(); + let route = curPage[curPage.length - 1].route; //获取当前页面的路由 + if (route !== "pages/login/index") { + uni.navigateTo({ + url: "/pages/login/index", + }); + } + } + // 统一的响应日志记录 + _reslog(response); + if (statusCode === 200) { + //成功 + resolve(response.data); + } else { + reject(response); + } + }; + + _config = Object.assign({}, this.config, options); + _config.requestId = new Date().getTime(); + + if (this.interceptor.request) { + this.interceptor.request(_config); + } + + // 统一的请求日志记录 + _reqlog(_config); + + uni.request(_config); + }); + }, + get(url, data, options) { + if (!options) { + options = {}; + } + options.url = url; + options.data = data; + options.method = "GET"; + return this.request(options); + }, + post(url, data, options, header) { + if (!options) { + options = {}; + } + options.url = url; + options.data = data; + options.header = header; + options.method = "POST"; + return this.request(options); + }, + put(url, data, options) { + if (!options) { + options = {}; + } + options.url = url; + options.data = data; + options.method = "PUT"; + return this.request(options); + }, + delete(url, data, options) { + if (!options) { + options = {}; + } + options.url = url; + options.data = data; + options.method = "DELETE"; + return this.request(options); + }, +}; + +/** + * 请求接口日志记录 + */ +function _reqlog(req) { + if (process.env.NODE_ENV === "development") { + // console.log("【" + req.requestId + "】 地址:" + req.url) + if (req.data) { + // console.log("【" + req.requestId + "】 请求参数:" + JSON.stringify(req.data)) + } + } + //TODO 调接口异步写入日志数据库 +} + +/** + * 响应接口日志记录 + */ +function _reslog(res) { + let _statusCode = res.statusCode; + if (process.env.NODE_ENV === "development") { + // console.log("【" + res.config.requestId + "】 地址:" + res.config.url) + if (res.config.data) { + // console.log("【" + res.config.requestId + "】 请求参数:" + JSON.stringify(res.config.data)) + } + // console.log("【" + res.config.requestId + "】 响应结果:" + JSON.stringify(res)) + } + //TODO 除了接口服务错误外,其他日志调接口异步写入日志数据库 + switch (_statusCode) { + case 200: + break; + case 401: + break; + case 404: + break; + default: + break; + } +} diff --git a/components/card/index.vue b/components/card/index.vue index 91a2740..d662ca1 100644 --- a/components/card/index.vue +++ b/components/card/index.vue @@ -1,39 +1,36 @@ - diff --git a/components/card/moreDataCard.vue b/components/card/moreDataCard.vue new file mode 100644 index 0000000..c6d9ef8 --- /dev/null +++ b/components/card/moreDataCard.vue @@ -0,0 +1,92 @@ + + + + + \ No newline at end of file diff --git a/main.js b/main.js index e620f2a..f0fef08 100644 --- a/main.js +++ b/main.js @@ -1,10 +1,15 @@ import App from "./App"; import uView from "uview-ui"; +import request from "@/api/index.js"; +// import Vconsole from "vconsole"; + +// new Vconsole(); // #ifndef VUE3 import Vue from "vue"; import "./uni.promisify.adaptor"; Vue.config.productionTip = false; Vue.use(uView); +Vue.prototype.$request = request; App.mpType = "app"; const app = new Vue({ ...App, diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..7533451 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,99 @@ +{ + "name": "museum-H5-V2", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "vconsole": "^3.15.1" + } + }, + "node_modules/@babel/runtime": { + "version": "7.23.6", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.23.6.tgz", + "integrity": "sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/copy-text-to-clipboard": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz", + "integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==", + "engines": { + "node": ">=12" + } + }, + "node_modules/core-js": { + "version": "3.34.0", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.34.0.tgz", + "integrity": "sha512-aDdvlDder8QmY91H88GzNi9EtQi2TjvQhpCX6B1v/dAZHU1AuLgHvRh54RiOerpEhEW46Tkf+vgAViB/CWC0ag==", + "hasInstallScript": true + }, + "node_modules/mutation-observer": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz", + "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==" + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "node_modules/vconsole": { + "version": "3.15.1", + "resolved": "https://registry.npmmirror.com/vconsole/-/vconsole-3.15.1.tgz", + "integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==", + "dependencies": { + "@babel/runtime": "^7.17.2", + "copy-text-to-clipboard": "^3.0.1", + "core-js": "^3.11.0", + "mutation-observer": "^1.0.3" + } + } + }, + "dependencies": { + "@babel/runtime": { + "version": "7.23.6", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.23.6.tgz", + "integrity": "sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==", + "requires": { + "regenerator-runtime": "^0.14.0" + } + }, + "copy-text-to-clipboard": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz", + "integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==" + }, + "core-js": { + "version": "3.34.0", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.34.0.tgz", + "integrity": "sha512-aDdvlDder8QmY91H88GzNi9EtQi2TjvQhpCX6B1v/dAZHU1AuLgHvRh54RiOerpEhEW46Tkf+vgAViB/CWC0ag==" + }, + "mutation-observer": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz", + "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==" + }, + "regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "vconsole": { + "version": "3.15.1", + "resolved": "https://registry.npmmirror.com/vconsole/-/vconsole-3.15.1.tgz", + "integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==", + "requires": { + "@babel/runtime": "^7.17.2", + "copy-text-to-clipboard": "^3.0.1", + "core-js": "^3.11.0", + "mutation-observer": "^1.0.3" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..647136a --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "vconsole": "^3.15.1" + } +} diff --git a/pages.json b/pages.json index 2726ad3..7b93476 100644 --- a/pages.json +++ b/pages.json @@ -3,16 +3,46 @@ "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" }, "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - { - "path": "pages/index/index", - "style": { - "navigationBarTitleText": "藏品活动详情页", - "enablePullDownRefresh": false, - "app-plus": { - "titleNView": false // 禁用原生导航 - } + { + "path": "pages/login/index", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": false // 禁用原生导航 } } + }, + { + "path": "pages/check/index", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": false // 禁用原生导航 + } + } + }, + { + "path": "pages/scan/index", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": false // 禁用原生导航 + } + } + }, + { + "path": "pages/persomInfo/index", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": false // 禁用原生导航 + } + } + } ], "globalStyle": { "navigationBarTextStyle": "black", diff --git a/pages/check/index.vue b/pages/check/index.vue new file mode 100644 index 0000000..9a751be --- /dev/null +++ b/pages/check/index.vue @@ -0,0 +1,42 @@ + + + + diff --git a/pages/login/index.vue b/pages/login/index.vue new file mode 100644 index 0000000..b6ab272 --- /dev/null +++ b/pages/login/index.vue @@ -0,0 +1,128 @@ + + + + + \ No newline at end of file diff --git a/pages/persomInfo/index.vue b/pages/persomInfo/index.vue new file mode 100644 index 0000000..d29ddd5 --- /dev/null +++ b/pages/persomInfo/index.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/pages/index/index.vue b/pages/scan/index.vue similarity index 72% rename from pages/index/index.vue rename to pages/scan/index.vue index 5e3d0a3..de7c9f1 100644 --- a/pages/index/index.vue +++ b/pages/scan/index.vue @@ -12,24 +12,20 @@ import mumuGetQrcode from "../../components/mumu-getQrcode/mumu-getQrcode.vue"; export default { components: { mumuGetQrcode - }, - data() { - return { - title: 'Hello' - } - }, - onLoad() { - }, methods: { qrcodeSucess(res) { - uni.showModal({ - title: res, - content: res, - }); + uni.navigateTo({ url: '/pages/persomInfo/index?qrcode=' + res }) }, - qrcodeError(res) { - console.log(res); + qrcodeError(err) { + console.log(err); + uni.showModal({ + title: "摄像头授权失败", + content: "摄像头授权失败,请检测当前浏览器是否有摄像头权限。", + success: () => { + uni.navigateBack({}); + }, + }); } } } diff --git a/static/33@2x.png b/static/33@2x.png new file mode 100644 index 0000000..655dda5 Binary files /dev/null and b/static/33@2x.png differ diff --git a/static/bg.png b/static/bg.png new file mode 100644 index 0000000..1ca3df2 Binary files /dev/null and b/static/bg.png differ diff --git a/static/bg2.png b/static/bg2.png new file mode 100644 index 0000000..9ea65d8 Binary files /dev/null and b/static/bg2.png differ diff --git a/static/logo.png b/static/logo.png deleted file mode 100644 index b5771e2..0000000 Binary files a/static/logo.png and /dev/null differ