diff --git a/src/App.vue b/src/App.vue
index 32967bb..10b9e45 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,8 @@
+
+
\ No newline at end of file
diff --git a/src/core/libs/utils.js b/src/core/libs/utils.js
index c763718..9550eab 100644
--- a/src/core/libs/utils.js
+++ b/src/core/libs/utils.js
@@ -1,3 +1,5 @@
+import Vue from 'vue'
+
function time() {
return parseInt(Math.round(new Date() / 1000));
};
@@ -142,7 +144,17 @@ function debounce(func, wait = 500, immediate = false) {
}
}
-export {
+function px2rpx(px) {
+ const { windowWidth } = uni.getStorageSync('system_config');
+ return 750 * (px / windowWidth);
+}
+
+function rpx2px(rpx) {
+ const { windowWidth } = uni.getStorageSync('system_config');
+ return (rpx / 750) * windowWidth;
+}
+
+export default {
time,
datetime,
timeDifference,
@@ -150,4 +162,6 @@ export {
randomString,
throttle,
debounce,
+ px2rpx,
+ rpx2px,
}
diff --git a/src/pages/service/cate.vue b/src/pages/service/cate.vue
index aa3c93d..d29a69c 100644
--- a/src/pages/service/cate.vue
+++ b/src/pages/service/cate.vue
@@ -1,5 +1,5 @@
-
+
@@ -16,7 +16,7 @@
.search {
width: 100%;
- height: 120rpx;
+ height: auto;
display: flex;
align-items: center;
justify-content: center;
+ padding-bottom: 30rpx;
.input-box {
width: 670rpx;
height: auto;
diff --git a/src/pages/service/list.vue b/src/pages/service/list.vue
index bb71522..d12af44 100644
--- a/src/pages/service/list.vue
+++ b/src/pages/service/list.vue
@@ -1,7 +1,20 @@
-
+
+
+
+
+
+
+
+
+ 99
+
+
+
+ 去下单
+
@@ -9,6 +22,7 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/store/index.js b/src/store/index.js
index 55a4bfb..c00c554 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,13 +1,13 @@
import Vue from 'vue'
import Vuex from 'vuex'
-import moduleA from '@/store/modules/moduleA'
import user from "@/store/modules/user"
+import system from "@/store/modules/system"
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
- moduleA,
user,
+ system,
}
})
diff --git a/src/store/modules/system.js b/src/store/modules/system.js
new file mode 100644
index 0000000..e1d80e1
--- /dev/null
+++ b/src/store/modules/system.js
@@ -0,0 +1,34 @@
+export default {
+ namespaced: true,
+ state: {
+ config: {},
+ bodyPaddingTop: 0,
+ },
+ getters: {
+ config(state) {
+ return state.config;
+ },
+ bodyPaddingTop(state) {
+ return bodyPaddingTop;
+ }
+ },
+ mutations: {
+ setConfig(state, data) {
+ state.config = data;
+ },
+ setBodyPaddingTop(state, data) {
+ state.bodyPaddingTop = data;
+ }
+ },
+ actions: {
+ initConfig(context) {
+ let config = uni.getStorageSync('system_config');
+ if (!config) {
+ let { windowWidth, windowHeight, statusBarHeight, safeAreaInsets } = uni.getSystemInfoSync();
+ config = { windowWidth, windowHeight, statusBarHeight, safeAreaInsets };
+ uni.setStorageSync('system_config', config);
+ }
+ context.commit('setConfig', config);
+ }
+ }
+}