张涛 1 year ago
parent
commit
3b8e039bcf

+ 1
- 0
config/dev.js View File

6
     // HOST: '"http://127.0.0.1:9087"',
6
     // HOST: '"http://127.0.0.1:9087"',
7
     HOST: '""',
7
     HOST: '""',
8
     // HOST: '"https://wmcj.huoshannews.com"',
8
     // HOST: '"https://wmcj.huoshannews.com"',
9
+    MAPHOST: '"/api2"',
9
     AD_IMAGE: '"https://h5.njyunzhi.com/images/citizen_banner.png"',
10
     AD_IMAGE: '"https://h5.njyunzhi.com/images/citizen_banner.png"',
10
     DEFAULT_POS: '"116.34761502876347,31.40974743425614"', // 霍山县人民政府 gcj02
11
     DEFAULT_POS: '"116.34761502876347,31.40974743425614"', // 霍山县人民政府 gcj02
11
     VERSION: '"1.1.13-20230325"',
12
     VERSION: '"1.1.13-20230325"',

+ 3
- 2
config/index.js View File

61
     //   },
61
     //   },
62
     // },
62
     // },
63
     h5: {
63
     h5: {
64
-      // publicPath: "/",
64
+      publicPath: "/h5",
65
       // staticDirectory: "static",
65
       // staticDirectory: "static",
66
       // outputDir: "dist",
66
       // outputDir: "dist",
67
+      // uglify:false,
67
       router: {
68
       router: {
68
-        // mode: "hash",
69
+        mode: "browser",
69
         basename:"/h5"
70
         basename:"/h5"
70
       },
71
       },
71
       esnextModules: ["@antmjs"],
72
       esnextModules: ["@antmjs"],

+ 26
- 28
config/prod.js View File

6
     // HOST: '"http://192.168.89.147:9087"',
6
     // HOST: '"http://192.168.89.147:9087"',
7
     // HOST: '"https://wmcj.ycjcjy.com"',
7
     // HOST: '"https://wmcj.ycjcjy.com"',
8
     HOST: '""',
8
     HOST: '""',
9
+    MAPHOST: '"/api2"',
9
     AD_IMAGE: '"https://h5.njyunzhi.com/images/citizen_banner.png"',
10
     AD_IMAGE: '"https://h5.njyunzhi.com/images/citizen_banner.png"',
10
     DEFAULT_POS: '"116.34761502876347,31.40974743425614"', // 霍山县人民政府 gcj02
11
     DEFAULT_POS: '"116.34761502876347,31.40974743425614"', // 霍山县人民政府 gcj02
11
     VERSION: '"1.1.29-20240224"',
12
     VERSION: '"1.1.29-20240224"',
17
      * @docs https://github.com/neutrinojs/webpack-chain
18
      * @docs https://github.com/neutrinojs/webpack-chain
18
      */
19
      */
19
     // webpackChain(chain) {
20
     // webpackChain(chain) {
20
-      /**
21
-       * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
22
-       * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
23
-       */
24
-      // chain
25
-      //   .plugin("analyzer")
26
-      //   .use(require("webpack-bundle-analyzer").BundleAnalyzerPlugin, []);
27
-
28
-      /**
29
-       * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
30
-       * @docs https://github.com/chrisvfritz/prerender-spa-plugin
31
-       */
32
-      // const path = require("path");
33
-      // const Prerender = require("prerender-spa-plugin");
34
-      // const staticDir = path.join(__dirname, "..", "dist");
35
-      // chain.plugin("prerender").use(
36
-      //   new Prerender({
37
-      //     staticDir,
38
-      //     routes: ["/pages/index/index"],
39
-      //     postProcess: (context) => ({
40
-      //       ...context,
41
-      //       outputPath: path.join(staticDir, "index.html"),
42
-      //     }),
43
-      //   })
44
-      // );
45
-    },
21
+    /**
22
+     * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
23
+     * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
24
+     */
25
+    // chain
26
+    //   .plugin("analyzer")
27
+    //   .use(require("webpack-bundle-analyzer").BundleAnalyzerPlugin, []);
28
+    /**
29
+     * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
30
+     * @docs https://github.com/chrisvfritz/prerender-spa-plugin
31
+     */
32
+    // const path = require("path");
33
+    // const Prerender = require("prerender-spa-plugin");
34
+    // const staticDir = path.join(__dirname, "..", "dist");
35
+    // chain.plugin("prerender").use(
36
+    //   new Prerender({
37
+    //     staticDir,
38
+    //     routes: ["/pages/index/index"],
39
+    //     postProcess: (context) => ({
40
+    //       ...context,
41
+    //       outputPath: path.join(staticDir, "index.html"),
42
+    //     }),
43
+    //   })
44
+    // );
45
+  },
46
   // },
46
   // },
47
-
48
-
49
 };
47
 };

+ 6
- 1
src/components/Auth.jsx View File

16
   console.log("roles", roles);
16
   console.log("roles", roles);
17
   console.log("!roles.length || hasRights", !roles.length || hasRights);
17
   console.log("!roles.length || hasRights", !roles.length || hasRights);
18
 
18
 
19
+
20
+  const filteredChildren = React.Children.toArray(props.children).filter(
21
+    child => React.isValidElement(child)
22
+  );
23
+
19
   return !roles.length || hasRights ? (
24
   return !roles.length || hasRights ? (
20
-   <div>{props.children}</div>
25
+   <div>{filteredChildren}</div>
21
   ) : (
26
   ) : (
22
     <View
27
     <View
23
       style={{
28
       style={{

+ 6
- 3
src/layouts/index.jsx View File

16
     tabBar ? laySty["with-tabbar"] : ""
16
     tabBar ? laySty["with-tabbar"] : ""
17
   } ${className}`;
17
   } ${className}`;
18
 
18
 
19
-  // const userRef = useRef();
19
+  const userRef = useRef();
20
   // const personRef = useRef();
20
   // const personRef = useRef();
21
 
21
 
22
   // React.useEffect(() => {
22
   // React.useEffect(() => {
50
     console.log("userRef******************");
50
     console.log("userRef******************");
51
     console.log(user);
51
     console.log(user);
52
     console.log(!user);
52
     console.log(!user);
53
+    if (!userRef.current&&user) {
54
+      userRef.current = user;
55
+    }
53
 
56
 
54
-    if (!user) {
57
+    if (!userRef.current) {
55
       const currentPage = Taro.getCurrentPages().slice().pop();
58
       const currentPage = Taro.getCurrentPages().slice().pop();
56
       if (!currentPage.route.includes("pages/login/index")) {
59
       if (!currentPage.route.includes("pages/login/index")) {
57
         Taro.navigateTo({
60
         Taro.navigateTo({
80
             </Loading>
83
             </Loading>
81
           </View>
84
           </View>
82
         )} */}
85
         )} */}
83
-        <Auth roles={roles} >{props.children}</Auth>
86
+        <Auth roles={roles}>{props.children}</Auth>
84
 
87
 
85
         {!tabBar && <View className={laySty["pdm-space"]}></View>}
88
         {!tabBar && <View className={laySty["pdm-space"]}></View>}
86
       </View>
89
       </View>

+ 6
- 10
src/pages/issue/components/Issue/index.jsx View File

1
 import React, { useEffect } from "react";
1
 import React, { useEffect } from "react";
2
 import Taro from "@tarojs/taro";
2
 import Taro from "@tarojs/taro";
3
-import { View } from "@tarojs/components";
3
+import { Textarea, View } from "@tarojs/components";
4
 import { Field, Cell, CellGroup } from "@antmjs/vantui";
4
 import { Field, Cell, CellGroup } from "@antmjs/vantui";
5
 import LocType from "@/components/LocType";
5
 import LocType from "@/components/LocType";
6
 import IssueType from "@/components/IssueType";
6
 import IssueType from "@/components/IssueType";
116
     if (loc) {
116
     if (loc) {
117
       // 交换经纬度位置
117
       // 交换经纬度位置
118
       const [x, y] = loc.split(",");
118
       const [x, y] = loc.split(",");
119
-      const location = [y,x].join(",");
119
+      const location = [y, x].join(",");
120
       geocoder(location)
120
       geocoder(location)
121
         .then((e) => {
121
         .then((e) => {
122
           console.log(e?.address_component?.street_number || e?.address);
122
           console.log(e?.address_component?.street_number || e?.address);
141
     }
141
     }
142
   }, [issue]);
142
   }, [issue]);
143
 
143
 
144
-  useEffect(() => {
145
-    container;
146
-  }, []);
147
   return (
144
   return (
148
     <View>
145
     <View>
149
       <LocType
146
       <LocType
183
         onChange={onLocationChange}
180
         onChange={onLocationChange}
184
       />
181
       />
185
 
182
 
186
-
187
       <CellGroup>
183
       <CellGroup>
188
         {issue?.issueId && <Cell title="ID" value={issue.issueId} />}
184
         {issue?.issueId && <Cell title="ID" value={issue.issueId} />}
189
         <Cell
185
         <Cell
217
         />
213
         />
218
         <Cell title="问题描述" border={false} />
214
         <Cell title="问题描述" border={false} />
219
 
215
 
220
-        <Field
221
-          type="textarea"
216
+        <Textarea 
217
+          // type="textarea"
222
           placeholder="请输入问题描述"
218
           placeholder="请输入问题描述"
223
-          readonly={readOnly}
219
+          disabled={readOnly}
224
           autosize={{ minHeight: "120px" }}
220
           autosize={{ minHeight: "120px" }}
225
           value={formData.content}
221
           value={formData.content}
226
-          onChange={(e) => setFieldChange("content", e.detail)}
222
+          onInput={(e) => setFieldChange("content", e.detail.value)}
227
         />
223
         />
228
       </CellGroup>
224
       </CellGroup>
229
 
225
 

+ 1
- 1
src/utils/authorize.js View File

47
 const key = "HTPBZ-HHJA7-XD2XD-PRS37-H3HVJ-U5BAA";
47
 const key = "HTPBZ-HHJA7-XD2XD-PRS37-H3HVJ-U5BAA";
48
 export const h5GetLocation = () => {
48
 export const h5GetLocation = () => {
49
   return new Promise((resolve, reject) => {
49
   return new Promise((resolve, reject) => {
50
-    const url = `/api2/ws/location/v1/ip?key=${key}`;
50
+    const url = `${MAPHOST}/ws/location/v1/ip?key=${key}`;
51
     const res = Taro.request({
51
     const res = Taro.request({
52
       url: url,
52
       url: url,
53
       method: "GET",
53
       method: "GET",

+ 1
- 1
src/utils/map.js View File

11
   }
11
   }
12
 
12
 
13
   return new Promise((resolve, reject) => {
13
   return new Promise((resolve, reject) => {
14
-    const url = `/api2/ws/geocoder/v1/?location=${location}&key=${QMAP_WEBSERVICE_KEY}&get_poi=${getPoi}`
14
+    const url = `${MAPHOST}/ws/geocoder/v1/?location=${location}&key=${QMAP_WEBSERVICE_KEY}&get_poi=${getPoi}`
15
 
15
 
16
     Taro.request({ url }).then(({ data }) => {
16
     Taro.request({ url }).then(({ data }) => {
17
       const { status, message, result } = data || {};
17
       const { status, message, result } = data || {};