Yansen 2 years ago
parent
commit
720a5493c4
45 changed files with 500 additions and 33 deletions
  1. 2
    1
      .eslintrc
  2. 6
    27
      config/index.js
  3. 8
    0
      jsconfig.json
  4. 1
    1
      project.config.json
  5. 35
    4
      src/app.config.js
  6. 15
    0
      src/app.less
  7. BIN
      src/assets/tabbar/evaluation click.png
  8. BIN
      src/assets/tabbar/evaluation.png
  9. BIN
      src/assets/tabbar/my click.png
  10. BIN
      src/assets/tabbar/my.png
  11. BIN
      src/assets/tabbar/notice click.png
  12. BIN
      src/assets/tabbar/notice.png
  13. BIN
      src/assets/tabbar/page click.png
  14. BIN
      src/assets/tabbar/page.png
  15. BIN
      src/assets/tabbar/release click.png
  16. BIN
      src/assets/tabbar/release.png
  17. BIN
      src/assets/test/test.jpg
  18. 14
    0
      src/layouts/index.jsx
  19. 24
    0
      src/pages/home/components/BannerCard.jsx
  20. 22
    0
      src/pages/home/components/Head.jsx
  21. 35
    0
      src/pages/home/components/MenuCard.jsx
  22. 44
    0
      src/pages/home/components/banner-card.module.less
  23. 46
    0
      src/pages/home/components/head.module.less
  24. 30
    0
      src/pages/home/components/menu-card.module.less
  25. 3
    0
      src/pages/home/index.config.js
  26. 17
    0
      src/pages/home/index.jsx
  27. 0
    0
      src/pages/home/index.less
  28. 4
    0
      src/pages/index/index.less
  29. 3
    0
      src/pages/index3/index.config.js
  30. 24
    0
      src/pages/index3/index.jsx
  31. 0
    0
      src/pages/index3/index.less
  32. 3
    0
      src/pages/index4/index.config.js
  33. 24
    0
      src/pages/index4/index.jsx
  34. 0
    0
      src/pages/index4/index.less
  35. 3
    0
      src/pages/index5/index.config.js
  36. 24
    0
      src/pages/index5/index.jsx
  37. 0
    0
      src/pages/index5/index.less
  38. 20
    0
      src/pages/reporting/detail/components/Issue.jsx
  39. 21
    0
      src/pages/reporting/detail/components/Map.jsx
  40. 21
    0
      src/pages/reporting/detail/components/issue.module.less
  41. 21
    0
      src/pages/reporting/detail/components/map.module.less
  42. 3
    0
      src/pages/reporting/detail/index.config.js
  43. 15
    0
      src/pages/reporting/detail/index.jsx
  44. 3
    0
      src/pages/reporting/index.config.js
  45. 9
    0
      src/pages/reporting/index.jsx

+ 2
- 1
.eslintrc View File

@@ -2,6 +2,7 @@
2 2
   "extends": ["taro/react"],
3 3
   "rules": {
4 4
     "react/jsx-uses-react": "off",
5
-    "react/react-in-jsx-scope": "off"
5
+    "react/react-in-jsx-scope": "off",
6
+    "no-unused-vars": "warn"
6 7
   }
7 8
 }

+ 6
- 27
config/index.js View File

@@ -1,3 +1,5 @@
1
+const path = require('path');
2
+
1 3
 const config = {
2 4
   projectName: 'civilized-miniapp',
3 5
   date: '2022-12-12',
@@ -20,6 +22,9 @@ const config = {
20 22
   },
21 23
   framework: 'react',
22 24
   compiler: 'webpack4',
25
+  alias: {
26
+    '@': path.resolve(__dirname, '..', 'src'),
27
+  },
23 28
   mini: {
24 29
     postcss: {
25 30
       pxtransform: {
@@ -35,25 +40,7 @@ const config = {
35 40
         }
36 41
       },
37 42
       cssModules: {
38
-        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
39
-        config: {
40
-          namingPattern: 'module', // 转换模式,取值为 global/module
41
-          generateScopedName: '[name]__[local]___[hash:base64:5]'
42
-        }
43
-      }
44
-    }
45
-  },
46
-  h5: {
47
-    publicPath: '/',
48
-    staticDirectory: 'static',
49
-    postcss: {
50
-      autoprefixer: {
51
-        enable: true,
52
-        config: {
53
-        }
54
-      },
55
-      cssModules: {
56
-        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
43
+        enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
57 44
         config: {
58 45
           namingPattern: 'module', // 转换模式,取值为 global/module
59 46
           generateScopedName: '[name]__[local]___[hash:base64:5]'
@@ -61,14 +48,6 @@ const config = {
61 48
       }
62 49
     }
63 50
   },
64
-  rn: {
65
-    appName: 'taroDemo',
66
-    postcss: {
67
-      cssModules: {
68
-        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
69
-      }
70
-    }
71
-  }
72 51
 }
73 52
 
74 53
 module.exports = function (merge) {

+ 8
- 0
jsconfig.json View File

@@ -0,0 +1,8 @@
1
+{
2
+  "compilerOptions": {
3
+    "baseUrl": ".",
4
+    "paths": {
5
+      "@/*": ["./src/*"]
6
+    }
7
+  }
8
+}

+ 1
- 1
project.config.json View File

@@ -2,7 +2,7 @@
2 2
   "miniprogramRoot": "./dist",
3 3
   "projectname": "civilized-miniapp",
4 4
   "description": "文明城市小程序",
5
-  "appid": "touristappid",
5
+  "appid": "wxe44244d1a5ea3364",
6 6
   "setting": {
7 7
     "urlCheck": true,
8 8
     "es6": false,

+ 35
- 4
src/app.config.js View File

@@ -1,11 +1,42 @@
1 1
 export default defineAppConfig({
2 2
   pages: [
3
-    'pages/index/index'
3
+    'pages/index/index',
4
+    'pages/home/index',
5
+    'pages/index3/index',
6
+    'pages/index4/index',
7
+    'pages/index5/index',
8
+    'pages/reporting/index',
9
+    'pages/reporting/detail/index',
4 10
   ],
11
+  tabBar: {
12
+    list: [
13
+      {
14
+        "pagePath": "pages/index/index",
15
+        "text": "首页"
16
+      },
17
+      {
18
+        "pagePath": "pages/home/index",
19
+        "text": "公告"
20
+      },
21
+      {
22
+        "pagePath": "pages/index3/index",
23
+        "text": "发布"
24
+      },
25
+      {
26
+        "pagePath": "pages/index4/index",
27
+        "text": "测评标准"
28
+      },
29
+      {
30
+        "pagePath": "pages/index5/index",
31
+        "text": "我的"
32
+      },
33
+    ],
34
+  },
5 35
   window: {
36
+    // backgroundColor: '#1A7565',
6 37
     backgroundTextStyle: 'light',
7
-    navigationBarBackgroundColor: '#fff',
8
-    navigationBarTitleText: 'WeChat',
9
-    navigationBarTextStyle: 'black'
38
+    navigationBarBackgroundColor: '#1A7565',
39
+    navigationBarTitleText: '文明创城',
40
+    navigationBarTextStyle: 'white'
10 41
   }
11 42
 })

+ 15
- 0
src/app.less View File

@@ -0,0 +1,15 @@
1
+
2
+page {
3
+  box-sizing: border-box;
4
+  background: #f8f8f8;
5
+  --main-bg-color: #1A7565;
6
+  --main-space: 4vw;
7
+}
8
+
9
+view {
10
+  box-sizing: border-box;
11
+}
12
+
13
+.page-wrapper {
14
+
15
+}

BIN
src/assets/tabbar/evaluation click.png View File


BIN
src/assets/tabbar/evaluation.png View File


BIN
src/assets/tabbar/my click.png View File


BIN
src/assets/tabbar/my.png View File


BIN
src/assets/tabbar/notice click.png View File


BIN
src/assets/tabbar/notice.png View File


BIN
src/assets/tabbar/page click.png View File


BIN
src/assets/tabbar/page.png View File


BIN
src/assets/tabbar/release click.png View File


BIN
src/assets/tabbar/release.png View File


BIN
src/assets/test/test.jpg View File


+ 14
- 0
src/layouts/index.jsx View File

@@ -0,0 +1,14 @@
1
+import React from 'react';
2
+import { View } from '@tarojs/components';
3
+
4
+export default (props) => {
5
+  const { className, style } = props;
6
+
7
+  const classNames = `page-wrapper ${className}`;
8
+
9
+  return (
10
+    <View className={classNames} style={style}>
11
+      {props.children}
12
+    </View>
13
+  )
14
+}

+ 24
- 0
src/pages/home/components/BannerCard.jsx View File

@@ -0,0 +1,24 @@
1
+import React from 'react';
2
+import { View } from '@tarojs/components';
3
+import style from './banner-card.module.less';
4
+
5
+export default (props) => {
6
+  return (
7
+    <View className={style['banner-card-box']}>
8
+      <View className={style['banner-card']}>
9
+        <View className={style.item}>
10
+          <View>12</View>
11
+          <View className={style.sub}>已上报</View>
12
+        </View>
13
+        <View className={style.item}>
14
+          <View>8</View>
15
+          <View className={style.sub}>已交办</View>
16
+        </View>
17
+        <View className={style.item}>
18
+          <View>6</View>
19
+          <View className={style.sub}>未交办</View>
20
+        </View>
21
+      </View>
22
+    </View>
23
+  )
24
+}

+ 22
- 0
src/pages/home/components/Head.jsx View File

@@ -0,0 +1,22 @@
1
+import React from 'react';
2
+import { View } from '@tarojs/components';
3
+import style from './head.module.less';
4
+
5
+export default (props) => {
6
+  console.log(style)
7
+
8
+  return (
9
+    <View className={style.head}>
10
+      <View className={style.profile}>
11
+        <View>Hi, 张三!</View>
12
+        <View className={style.badge}>
13
+          <View className={style.icon}></View>
14
+          <View>督察员</View>
15
+        </View>
16
+      </View>
17
+      <View className={style.avatar}>
18
+
19
+      </View>
20
+    </View>
21
+  )
22
+}

+ 35
- 0
src/pages/home/components/MenuCard.jsx View File

@@ -0,0 +1,35 @@
1
+import React from 'react';
2
+import { View } from '@tarojs/components';
3
+import style from './menu-card.module.less';
4
+
5
+export default (props) => {
6
+  
7
+  return (
8
+    <View className={style['menu-card-box']}>
9
+      <View className={style.item}>
10
+        <View>
11
+          <View className={style.icon}></View>
12
+          <View>我要上报</View>
13
+        </View>
14
+      </View>
15
+      <View className={style.item}>
16
+        <View>
17
+          <View className={style.icon}></View>
18
+          <View>我的上报</View>
19
+        </View>
20
+      </View>
21
+      <View className={style.item}>
22
+        <View>
23
+          <View className={style.icon}></View>
24
+          <View>消息通知</View>
25
+        </View>
26
+      </View>
27
+      <View className={style.item}>
28
+        <View>
29
+          <View className={style.icon}></View>
30
+          <View>模拟测评</View>
31
+        </View>
32
+      </View>
33
+    </View>
34
+  )
35
+}

+ 44
- 0
src/pages/home/components/banner-card.module.less View File

@@ -0,0 +1,44 @@
1
+
2
+.banner-card-box {
3
+  width: 100%;
4
+  position: relative;
5
+  padding: 0 var(--main-space);
6
+
7
+  &::before {
8
+    content: '';
9
+    background: var(--main-bg-color);
10
+    position: absolute;
11
+    width: 100%;
12
+    height: 10vw;
13
+    top: 0;
14
+    left: 0;
15
+    z-index: 0;
16
+  }
17
+
18
+  .banner-card {
19
+    position: relative;
20
+    background: #FFFFFF;
21
+    box-shadow: 0px 18px 22px 0px rgba(0,0,0,0.04);
22
+    border-radius: 8px;
23
+    padding: 50px 0;
24
+    display: flex;
25
+    align-items: center;
26
+    justify-content: center;
27
+    z-index: 1;
28
+
29
+    .item {
30
+      flex: 1;
31
+      text-align: center;
32
+      font-size: 48px;
33
+      font-weight: bold;
34
+      color: #202020;
35
+    }
36
+
37
+    .sub {
38
+      margin-top: 20px;
39
+      font-size: 28px;
40
+      font-weight: 500;
41
+      color: #AEAEAE;
42
+    }
43
+  }
44
+}

+ 46
- 0
src/pages/home/components/head.module.less View File

@@ -0,0 +1,46 @@
1
+
2
+.head {
3
+  width: 100vw;
4
+  height: 30vw;
5
+  background: var(--main-bg-color);
6
+  color: #fff;
7
+  display: flex;
8
+  justify-content: space-between;
9
+  align-items: center;
10
+  padding: 0 var(--main-space);
11
+
12
+  .profile {
13
+    flex: none;
14
+    font-size: 42px;
15
+
16
+    .badge {
17
+      position: relative;
18
+      padding-left: 64px;
19
+      margin-top: var(--main-space);
20
+      height: 48px;
21
+      line-height: 48px;
22
+      background: linear-gradient(0, #E36A00, #FFA658);
23
+      border-radius: 22px;
24
+      font-size: 24px;
25
+
26
+      .icon {
27
+        top: -8px;
28
+        left: -8px;
29
+        position: absolute;
30
+        width: 64px;
31
+        height: 64px;
32
+        background: linear-gradient(0, #E36A00, #FFA658);
33
+        border-radius: 50%;
34
+        border: 8px solid rgba(251, 239, 121, 0.2);
35
+      }
36
+    }
37
+  }
38
+
39
+  .avatar {
40
+    flex: none;
41
+    width: 16vw;
42
+    height: 16vw;
43
+    border-radius: 50%;
44
+    border: 4px solid #fff;
45
+  }
46
+}

+ 30
- 0
src/pages/home/components/menu-card.module.less View File

@@ -0,0 +1,30 @@
1
+
2
+.menu-card-box {
3
+  width: 100vw;
4
+  padding: 0 var(--main-space);
5
+  margin-top: var(--main-space);
6
+  display: grid;
7
+  grid-gap: var(--main-space);
8
+  // (100vw - 4 * --main-space) / 3
9
+  grid-template-columns: repeat(3, 28vw);
10
+  grid-auto-rows: 28vw;
11
+  font-size: 30px;
12
+  font-weight: 500;
13
+  color: #202020;
14
+
15
+  .item {
16
+    border-radius: 8px;
17
+    box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.06);
18
+    display: grid;
19
+    place-items: center;
20
+
21
+    .icon {
22
+      width: 100px;
23
+      height: 100px;
24
+      margin: auto;
25
+      margin-bottom: 20px;
26
+      background: rgba(51,218,156,0.2);
27
+      border-radius: 50%;
28
+    }
29
+  }
30
+}

+ 3
- 0
src/pages/home/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '首页'
3
+})

+ 17
- 0
src/pages/home/index.jsx View File

@@ -0,0 +1,17 @@
1
+import React from 'react'
2
+import { View, Text, Image } from '@tarojs/components'
3
+import Page from '@/layouts/index';
4
+import Head from './components/Head';
5
+import BannerCard from './components/BannerCard';
6
+import MenuCard from './components/MenuCard';
7
+import './index.less';
8
+
9
+export default (props) => {
10
+  return (
11
+    <Page className='index'>
12
+      <Head />
13
+      <BannerCard />
14
+      <MenuCard />
15
+    </Page>
16
+  );
17
+}

+ 0
- 0
src/pages/home/index.less View File


+ 4
- 0
src/pages/index/index.less View File

@@ -0,0 +1,4 @@
1
+
2
+.index {
3
+  color: red;
4
+}

+ 3
- 0
src/pages/index3/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '首页'
3
+})

+ 24
- 0
src/pages/index3/index.jsx View File

@@ -0,0 +1,24 @@
1
+import { Component } from 'react'
2
+import { View, Text } from '@tarojs/components'
3
+import './index.less'
4
+
5
+export default class Index extends Component {
6
+
7
+  componentWillMount () { }
8
+
9
+  componentDidMount () { }
10
+
11
+  componentWillUnmount () { }
12
+
13
+  componentDidShow () { }
14
+
15
+  componentDidHide () { }
16
+
17
+  render () {
18
+    return (
19
+      <View className='index'>
20
+        <Text>Hello world!</Text>
21
+      </View>
22
+    )
23
+  }
24
+}

+ 0
- 0
src/pages/index3/index.less View File


+ 3
- 0
src/pages/index4/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '首页'
3
+})

+ 24
- 0
src/pages/index4/index.jsx View File

@@ -0,0 +1,24 @@
1
+import { Component } from 'react'
2
+import { View, Text } from '@tarojs/components'
3
+import './index.less'
4
+
5
+export default class Index extends Component {
6
+
7
+  componentWillMount () { }
8
+
9
+  componentDidMount () { }
10
+
11
+  componentWillUnmount () { }
12
+
13
+  componentDidShow () { }
14
+
15
+  componentDidHide () { }
16
+
17
+  render () {
18
+    return (
19
+      <View className='index'>
20
+        <Text>Hello world!</Text>
21
+      </View>
22
+    )
23
+  }
24
+}

+ 0
- 0
src/pages/index4/index.less View File


+ 3
- 0
src/pages/index5/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '首页'
3
+})

+ 24
- 0
src/pages/index5/index.jsx View File

@@ -0,0 +1,24 @@
1
+import { Component } from 'react'
2
+import { View, Text } from '@tarojs/components'
3
+import './index.less'
4
+
5
+export default class Index extends Component {
6
+
7
+  componentWillMount () { }
8
+
9
+  componentDidMount () { }
10
+
11
+  componentWillUnmount () { }
12
+
13
+  componentDidShow () { }
14
+
15
+  componentDidHide () { }
16
+
17
+  render () {
18
+    return (
19
+      <View className='index'>
20
+        <Text>Hello world!</Text>
21
+      </View>
22
+    )
23
+  }
24
+}

+ 0
- 0
src/pages/index5/index.less View File


+ 20
- 0
src/pages/reporting/detail/components/Issue.jsx View File

@@ -0,0 +1,20 @@
1
+import React from 'react';
2
+import { View } from '@tarojs/components';
3
+import style from './issue.module.less';
4
+
5
+export default (props) => {
6
+  
7
+  return (
8
+    <View className={style['issue-container']}>
9
+      <View class={style.card}>
10
+        <View className={style.title}>状态</View>
11
+      </View>
12
+      <View class={style.card}>
13
+        <View className={style.title}>问题描述</View>
14
+      </View>
15
+      <View class={style.card}>
16
+        <View className={style.title}>拍照</View>
17
+      </View>
18
+    </View>
19
+  )
20
+}

+ 21
- 0
src/pages/reporting/detail/components/Map.jsx View File

@@ -0,0 +1,21 @@
1
+import React from 'react';
2
+import { View, Map } from '@tarojs/components';
3
+import style from './map.module.less';
4
+
5
+export default (props) => {
6
+  const { location = '118.805513,31.969974' } = props;
7
+  const loc = location.split(',')
8
+  
9
+  return (
10
+    <View className={style['map-box']}>
11
+      <Map
12
+        className={style.map}
13
+        longitude={loc[0]}
14
+        latitude={loc[1]}
15
+      ></Map>
16
+      <View className={style.address}>
17
+        阳光丽景小区
18
+      </View>
19
+    </View>
20
+  )
21
+}

+ 21
- 0
src/pages/reporting/detail/components/issue.module.less View File

@@ -0,0 +1,21 @@
1
+
2
+.issue-container {
3
+  margin-top: var(--main-space);
4
+
5
+  .card {
6
+    background: #fff;
7
+    padding: 0 var(--main-space);
8
+
9
+    & + .card {
10
+      margin-top: 2.67vw;
11
+    }
12
+  }
13
+
14
+  .title {
15
+    height: 90px;
16
+    font-size: 32px;
17
+    font-weight: bold;
18
+    color: #202020;
19
+    line-height: 90px;
20
+  }
21
+}

+ 21
- 0
src/pages/reporting/detail/components/map.module.less View File

@@ -0,0 +1,21 @@
1
+
2
+.map-box {
3
+  width: 100vw;
4
+
5
+  .map {
6
+    width: 100%;
7
+    height: 50vw;
8
+  }
9
+
10
+  .address {
11
+    width: 100%;
12
+    background: #fff;
13
+    height: 90px;
14
+    font-size: 24px;
15
+    font-weight: 500;
16
+    color: #202020;
17
+    line-height: 90px;
18
+    padding: 0 var(--main-space);
19
+  }
20
+  
21
+}

+ 3
- 0
src/pages/reporting/detail/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '详情'
3
+})

+ 15
- 0
src/pages/reporting/detail/index.jsx View File

@@ -0,0 +1,15 @@
1
+import React from 'react';
2
+import { View } from '@tarojs/components';
3
+import Page from '@/layouts/index';
4
+import Map from './components/Map';
5
+import Issue from './components/Issue';
6
+
7
+export default (props) => {
8
+  
9
+  return (
10
+    <Page>
11
+      <Map />
12
+      <Issue />
13
+    </Page>
14
+  )
15
+}

+ 3
- 0
src/pages/reporting/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '我的上报'
3
+})

+ 9
- 0
src/pages/reporting/index.jsx View File

@@ -0,0 +1,9 @@
1
+import React from 'react';
2
+import { View } from '@tarojs/components';
3
+
4
+export default (props) => {
5
+  
6
+  return (
7
+    <View></View>
8
+  )
9
+}