diff --git a/api/api.js b/api/api.js
new file mode 100644
index 0000000..3e056e1
--- /dev/null
+++ b/api/api.js
@@ -0,0 +1,8 @@
+const url_ = "http://lhc.pi.sa0.online:81";
+let url_array = {};
+url_array['YO'] = `${url_}/api/yo`;
+const api = (mark) => {
+ if (mark === '') return url_;
+ return url_array[mark];
+}
+export default api;
diff --git a/api/index.js b/api/index.js
index 8642ecb..5c74e83 100644
--- a/api/index.js
+++ b/api/index.js
@@ -1,11 +1,20 @@
+import $post from "../lu/post.js"
+import $res from "../lu/response.js"
+import $api from "./api.js"
+
export function yo(then) {
- lto.post({url: `${API_URL}/api/yo`, data: {}}).then((response) => {
- $store.api_loading--
- if (response.data.code === API_CODE) then(response.data)
- }).catch(() => {
- $store.api_loading--
- layer.msg(ERROR_MESSAGE)
- })
+ $post({
+ url: $api('YO'),
+ then: (response) => {
+ $res({
+ response,
+ then: (response) => {
+ then(response)
+ },
+ error: (res) => {
+ uni.$lu.toast(res.message);
+ }
+ })
+ }
+ })
}
-
-
diff --git a/lu/response.js b/lu/response.js
new file mode 100644
index 0000000..9f06113
--- /dev/null
+++ b/lu/response.js
@@ -0,0 +1,10 @@
+const response = (e) => {
+ const response = e.response
+ const then = typeof e.then === 'undefined' ? (response) => console.log(response) : e.then
+ const done = typeof e.done === 'undefined' ? (response) => console.log(response) : e.done
+ const error = typeof e.error === 'undefined' ? (response) => console.log(response) : e.error
+ done(response)
+ if (response.code === 200) then(response)
+ if (response.code !== 200) error(response)
+}
+export default response;
diff --git a/pages/dev/dev/Api/Api.vue b/pages/dev/dev/Api/Api.vue
index bce639f..b473368 100644
--- a/pages/dev/dev/Api/Api.vue
+++ b/pages/dev/dev/Api/Api.vue
@@ -1,10 +1,30 @@
-
-
- Yo
+
+
+
+ 接口请求
+
+ {{ res }}
+
+
+ YO !
+
+
diff --git a/pages/dev/dev/RouterPush/RouterPush.vue b/pages/dev/dev/RouterPush/RouterPush.vue
new file mode 100644
index 0000000..44447f7
--- /dev/null
+++ b/pages/dev/dev/RouterPush/RouterPush.vue
@@ -0,0 +1,21 @@
+
+
+
+ 路由推送
+
+
+ 首页
+
+
+
diff --git a/pages/dev/dev/Vuex/Vuex.vue b/pages/dev/dev/Vuex/Vuex.vue
new file mode 100644
index 0000000..d9e8bfe
--- /dev/null
+++ b/pages/dev/dev/Vuex/Vuex.vue
@@ -0,0 +1,40 @@
+
+
+
+ Vuex
+
+ {{ $store.state.count }}
+
+
+
+ 增加
+ |
+ 减少
+
+
+
+
+
diff --git a/pages/dev/dev/dev.vue b/pages/dev/dev/dev.vue
index ff11303..4d17aa1 100644
--- a/pages/dev/dev/dev.vue
+++ b/pages/dev/dev/dev.vue
@@ -5,7 +5,10 @@
* date:2022-04-19 15:23:08
*/
import NavbarComponent from './Navbar/Navbar.vue' // Navbar
- import RouterQueryComponent from './RouterQuery/RouterQuery.vue' // 路由参数
+ import RouterQueryComponent from './RouterQuery/RouterQuery.vue' // 路由参数
+ import ApiComponent from './Api/Api.vue' // 接口
+ import VuexComponent from './Vuex/Vuex.vue' // Vuex
+ import RouterPushComponent from './RouterPush/RouterPush.vue' // 路由跳转
// 路由参数
// 平台特殊性 下层组件 URL 参数只能从最高层下传
@@ -25,6 +28,9 @@
内容
操作
-
+
+
+
+
diff --git a/tool/member.js b/tool/member.js
new file mode 100644
index 0000000..e04d24b
--- /dev/null
+++ b/tool/member.js
@@ -0,0 +1,16 @@
+const TokenKey = 'Token';
+const getToken = () => {
+ return uni.getStorageSync(TokenKey);
+}
+const setToken = (token) => {
+ uni.setStorageSync(TokenKey, token);
+}
+const delToken = () => {
+ uni.removeStorageSync(TokenKey);
+}
+export default {
+ TokenKey,
+ setToken,
+ getToken,
+ delToken
+};