From 786066cbfb1b4d8949eac293a30501d844a492a8 Mon Sep 17 00:00:00 2001
From: CTP <630182278@qq.com>
Date: Wed, 10 May 2023 22:26:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85=E8=AF=B7=E6=B1=82=E6=8B=A6?=
=?UTF-8?q?=E6=88=AA=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jsconfig.json | 10 ++--
src/components/Navbar.vue | 87 +++++++++++++++++++++++++++++++++
src/pages.json | 5 +-
src/pages/information/index.vue | 47 ++++--------------
src/store/index.js | 4 +-
src/utils/http.js | 36 ++++++++++++++
6 files changed, 144 insertions(+), 45 deletions(-)
create mode 100644 src/components/Navbar.vue
create mode 100644 src/utils/http.js
diff --git a/jsconfig.json b/jsconfig.json
index 730626d..ff47b88 100644
--- a/jsconfig.json
+++ b/jsconfig.json
@@ -1,9 +1,9 @@
{
"compilerOptions": {
- "types": [
- "@dcloudio/types",
- "miniprogram-api-typings",
- "mini-types"
- ]
+ "types": ["@dcloudio/types", "miniprogram-api-typings", "mini-types"],
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["src/*"]
+ }
}
}
diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue
new file mode 100644
index 0000000..15b9418
--- /dev/null
+++ b/src/components/Navbar.vue
@@ -0,0 +1,87 @@
+
+
+
+
+
+ {{ title }}
+
+
+
+ UDI码信息查询
+
+
+
+
+
+
+
+
+
diff --git a/src/pages.json b/src/pages.json
index aab9e50..c96f06c 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -14,7 +14,10 @@
},
{
"path": "pages/information/index",
- "style": {}
+ "style": {
+ "navigationStyle": "custom",
+ "navigationBarTextStyle": "white"
+ }
},
{
"path": "pages/exist/index",
diff --git a/src/pages/information/index.vue b/src/pages/information/index.vue
index 3b96eb5..6726b43 100644
--- a/src/pages/information/index.vue
+++ b/src/pages/information/index.vue
@@ -1,26 +1,9 @@
-
-
-
+
+
+
+
@@ -41,27 +24,15 @@
-
+
diff --git a/src/store/index.js b/src/store/index.js
index 7adf63e..9bac878 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -7,7 +7,9 @@ Vue.use(Vuex); //vue的插件机制
//Vuex.Store 构造器选项
const store = new Vuex.Store({
// 使用模块
- state: {},
+ state: {
+ safeArea: uni.getSystemInfoSync().safeArea,
+ },
getters: {},
modules: {},
plugins: [persistence()], //持久化插件
diff --git a/src/utils/http.js b/src/utils/http.js
new file mode 100644
index 0000000..5532326
--- /dev/null
+++ b/src/utils/http.js
@@ -0,0 +1,36 @@
+const baseURL = ''; //基地址
+const request = {
+ invoke(args) {
+ uni.showLoading({ title: '加载中' });
+ if (!args.url.startsWith('http')) {
+ args.url = baseURL + args.url;
+ }
+ args.header = {
+ ...args.header, // 保留原本的 header
+ 'source-client': 'miniapp', // 添加小程序端调用标识
+ };
+ },
+ complete(res) {
+ uni.hideLoading();
+ },
+};
+uni.addInterceptor('request', request);
+uni.addInterceptor('uploadFile', request);
+
+export default (options) => {
+ return new Promise((resolve, reject) => {
+ uni.request({
+ ...options,
+ success(res) {
+ if (res.statusCode >= 200 && res.statusCode < 300) {
+ resolve(res.data);
+ } else {
+ reject(res);
+ }
+ },
+ fail(err) {
+ reject(res);
+ },
+ });
+ });
+};