张涛 1 년 전
부모
커밋
a6bcd5e134
8개의 변경된 파일1995개의 추가작업 그리고 1989개의 파일을 삭제
  1. 9
    9
      babel.config.js
  2. 2
    2
      config/dev.js
  3. 22
    3
      config/index.js
  4. 2
    9
      src/app.js
  5. 0
    2
      src/components/Icon.jsx
  6. 45
    40
      src/layouts/index.jsx
  7. 1
    1
      src/pages/home/index.jsx
  8. 1914
    1923
      yarn.lock

+ 9
- 9
babel.config.js 파일 보기

@@ -8,14 +8,14 @@ module.exports = {
8 8
     }]
9 9
   ],
10 10
   plugins: [
11
-    [
12
-      "import",
13
-      {
14
-        libraryName: "@antmjs/vantui",
15
-        libraryDirectory: "es",
16
-        style: (name) => `${name}/style/less`,
17
-      },
18
-      "@antmjs/vantui"
19
-    ]
11
+    // [
12
+    //   "import",
13
+    //   {
14
+    //     libraryName: "@antmjs/vantui",
15
+    //     libraryDirectory: "es",
16
+    //     style: (name) => `${name}/style/less`,
17
+    //   },
18
+    //   "@antmjs/vantui"
19
+    // ]
20 20
   ]
21 21
 }

+ 2
- 2
config/dev.js 파일 보기

@@ -3,8 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"',
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"http://127.0.0.1:9087"',
7
-    // HOST: '"http://192.168.89.13:9087"',
6
+    // HOST: '"http://127.0.0.1:9087"',
7
+    HOST: '"http://192.168.89.13:9087"',
8 8
     // HOST: '"https://wmcj.huoshannews.com"',
9 9
     AD_IMAGE: '"https://h5.njyunzhi.com/images/citizen_banner.png"',
10 10
     DEFAULT_POS: '"116.3476917447715,31.409912844296578"', // 霍山县人民政府 gcj02

+ 22
- 3
config/index.js 파일 보기

@@ -10,7 +10,13 @@ export default defineConfig(async (merge, { command, mode }) => {
10 10
   const config = {
11 11
     projectName: "civilized-miniapp",
12 12
     date: "2024-03-21",
13
-    designWidth: 750,
13
+    designWidth(input) {
14
+      console.log('---->', input?.file)
15
+      // if (input?.file.replace(/\\+/g, '/').indexOf('@antmjs/vantui') > -1) {
16
+      //   return 750
17
+      // }
18
+      return 750
19
+    },
14 20
     deviceRatio: {
15 21
       640: 2.34 / 2,
16 22
       750: 1,
@@ -61,16 +67,29 @@ export default defineConfig(async (merge, { command, mode }) => {
61 67
       router: {
62 68
         mode: "hash",
63 69
       },
70
+      esnextModules: ['@antmjs'],
71
+      // miniCssExtractPluginOption: {
72
+      //   ignoreOrder: true,
73
+      //   filename: "css/[name].[hash].css",
74
+      //   chunkFilename: "css/[id].css",
75
+      // },
76
+
64 77
       postcss: {
78
+        autoprefixer: {
79
+          enable: true,
80
+          config: {
81
+          }
82
+        },
83
+     
65 84
         pxtransform: {
66 85
           enable: true,
67 86
           config: {
68
-            // // 设置rpx转换为目标单位为rem
87
+            // 设置rpx转换为目标单位为rem
69 88
             // unitToRem: true,
70 89
             // // 设计稿宽度与 rem 基准值,默认设计稿宽度为 750,即 1rem = 75px
71 90
             // designWidth: 750,
72 91
             // // 可选,选择器黑名单
73
-            // selectorBlackList: ["body"],
92
+            // selectorBlackList: [],
74 93
             // // // 可选,替换rpx为其他单位后缀,例如 'px' 或 'rem'
75 94
             // propList: ["*"],
76 95
             // // 可选,媒体查询中是否禁用转换

+ 2
- 9
src/app.js 파일 보기

@@ -3,18 +3,11 @@ import store, { Provider, getState } from "@/store";
3 3
 import "./app.less";
4 4
 import { useEffect, useMemo } from "react";
5 5
 // import wxsdk from "./utils/wx";
6
+import '@antmjs/vantui/lib/index.less'
7
+// import '@antmjs/vantui/lib/index.css'
6 8
 
7 9
 const App = (props) => {
8
-  // useEffect(async() => {
9
-  //   const userState = store.getState("user");
10 10
 
11
-  //   // 等待组件挂载完成
12
-  //   await Promise.resolve();
13
-
14
-  //   // 然后执行异步操作
15
-  //   await userState.login(123);
16
-  //   userState.current();
17
-  // }, []);
18 11
   const init = async () => {
19 12
     console.log(11111111111)
20 13
     const userState = store.getState("user");

+ 0
- 2
src/components/Icon.jsx 파일 보기

@@ -1,6 +1,4 @@
1 1
 import React from 'react';
2
-import Taro from '@tarojs/taro';
3
-import { Image } from '@tarojs/components';
4 2
 import { Icon } from '@antmjs/vantui';
5 3
 import icon1 from '@/assets/icons/icon1.png';
6 4
 import icon2 from '@/assets/icons/icon2.png';

+ 45
- 40
src/layouts/index.jsx 파일 보기

@@ -1,18 +1,20 @@
1
-import React from 'react';
2
-import Taro from '@tarojs/taro';
3
-import { View, Image } from '@tarojs/components';
4
-import { useModel } from '@/store';
5
-import { Loading, Notify, Dialog } from '@antmjs/vantui';
6
-import NavLoading from '@/components/NavLoading';
7
-import Auth from '@/components/Auth';
8
-import TabBar from './TabBar';
9
-import laySty from './layout.module.less';
1
+import React from "react";
2
+import Taro from "@tarojs/taro";
3
+import { View, Image } from "@tarojs/components";
4
+import { useModel } from "@/store";
5
+import { Loading, Notify, Dialog } from "@antmjs/vantui";
6
+import NavLoading from "@/components/NavLoading";
7
+import Auth from "@/components/Auth";
8
+import TabBar from "./TabBar";
9
+import laySty from "./layout.module.less";
10 10
 
11 11
 export default (props) => {
12 12
   const { className, style, roles, tabBar = false, loading } = props;
13 13
 
14
-  const { person, user, duty } = useModel('user');
15
-  const containerClass = `${laySty['page-conatiner']} ${tabBar ? laySty['with-tabbar'] : ''} ${className}`;
14
+  const { person, user, duty } = useModel("user");
15
+  const containerClass = `${laySty["page-conatiner"]} ${
16
+    tabBar ? laySty["with-tabbar"] : ""
17
+  } ${className}`;
16 18
 
17 19
   // React.useEffect(() => {
18 20
   //   if (person && !user) {
@@ -25,40 +27,43 @@ export default (props) => {
25 27
   //   }
26 28
   // }, [person, user]);
27 29
 
30
+  React.useMemo(() => {
31
+    if (person && !user) {
32
+      const currentPage = Taro.getCurrentPages().slice().pop();
33
+      if ("pages/login/index" !== currentPage.route) {
34
+        Taro.navigateTo({
35
+          url: "/pages/login/index",
36
+        });
37
+      }
38
+    }
39
+  }, []);
40
+
28 41
   Taro.useShareAppMessage(() => {
29 42
     return {
30
-      title: '文明霍山'
43
+      title: "文明霍山",
31 44
     };
32 45
   });
33 46
 
34 47
   return (
35
-      <View className={laySty['page-wrapper']}>
36
-        <Notify id="vanNotify" />
37
-        <Dialog id="vanDialog" />
38
-        <NavLoading loading={loading} />
39
-        <View className={containerClass} style={style}>
40
-          {
41
-            !person && (
42
-              <View className={laySty.loading}>
43
-                <Loading size="32px" vertical>
44
-                  加载中...
45
-                </Loading>
46
-              </View>
47
-            )
48
-          }
49
-          <Auth roles={roles}>
50
-            {props.children}
51
-          </Auth>
48
+    <View className={laySty["page-wrapper"]}>
49
+      <Notify id="vanNotify" />
50
+      <Dialog id="vanDialog" />
51
+      <NavLoading loading={loading} />
52
+      <View className={containerClass} style={style}>
53
+        {!person && (
54
+          <View className={laySty.loading}>
55
+            <Loading size="32px" vertical>
56
+              加载中...
57
+            </Loading>
58
+          </View>
59
+        )}
60
+        <Auth roles={roles}>{props.children}</Auth>
52 61
 
53
-          {
54
-            !tabBar && (
55
-              <View className={laySty['pdm-space']}></View>
56
-            )
57
-          }
58
-        </View>
59
-        {
60
-          tabBar && <TabBar className={laySty['page-tabbar']} active={tabBar} duty={duty} />
61
-        }
62
+        {!tabBar && <View className={laySty["pdm-space"]}></View>}
62 63
       </View>
63
-  )
64
-}
64
+      {tabBar && (
65
+        <TabBar className={laySty["page-tabbar"]} active={tabBar} duty={duty} />
66
+      )}
67
+    </View>
68
+  );
69
+};

+ 1
- 1
src/pages/home/index.jsx 파일 보기

@@ -84,7 +84,7 @@ export default (props) => {
84 84
 
85 85
     return menus[duty];
86 86
   }, [duty])
87
-
87
+console.log(menuArr)
88 88
   return (
89 89
     <Page tabBar="home" className="home-page">
90 90
       <Head

+ 1914
- 1923
yarn.lock
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기