Browse Source

first commit

zlisen 4 years ago
commit
a4d316500b
82 changed files with 22669 additions and 0 deletions
  1. 12
    0
      .editorconfig
  2. 3
    0
      .eslintrc.js
  3. 6
    0
      .gitignore
  4. 10
    0
      babel.config.js
  5. 33
    0
      config/dev.js
  6. 70
    0
      config/index.js
  7. 19
    0
      config/prod.js
  8. 1
    0
      debug.log
  9. 19421
    0
      package-lock.json
  10. 66
    0
      package.json
  11. 23
    0
      project.config.json
  12. BIN
      shigonglih5.rar
  13. 22
    0
      src/app.config.js
  14. 49
    0
      src/app.js
  15. 58
    0
      src/app.scss
  16. BIN
      src/assets/editicon.png
  17. BIN
      src/assets/icon.png
  18. BIN
      src/assets/locationicon.png
  19. BIN
      src/assets/menuicon.png
  20. BIN
      src/assets/more.png
  21. BIN
      src/assets/radio.png
  22. BIN
      src/assets/upload.png
  23. BIN
      src/assets/uploadicon.png
  24. BIN
      src/assets/usericon.png
  25. 12
    0
      src/compents/container/index.jsx
  26. 6
    0
      src/compents/container/index.scss
  27. 42
    0
      src/compents/tab/index.jsx
  28. 32
    0
      src/compents/tab/index.scss
  29. 48
    0
      src/compents/tags/index.jsx
  30. 21
    0
      src/compents/tags/index.scss
  31. 21
    0
      src/index.html
  32. 14
    0
      src/layout/index.jsx
  33. 5
    0
      src/layout/index.scss
  34. 3
    0
      src/pages/account/edit/index.config.js
  35. 172
    0
      src/pages/account/edit/index.jsx
  36. 50
    0
      src/pages/account/edit/index.scss
  37. 4
    0
      src/pages/account/index.config.js
  38. 80
    0
      src/pages/account/index.jsx
  39. 54
    0
      src/pages/account/index.scss
  40. 98
    0
      src/pages/adminUser/index.jsx
  41. 30
    0
      src/pages/adminUser/index.scss
  42. 4
    0
      src/pages/batchimport/index.config.js
  43. 147
    0
      src/pages/batchimport/index.jsx
  44. 37
    0
      src/pages/batchimport/index.scss
  45. 4
    0
      src/pages/imglist/index.config.js
  46. 219
    0
      src/pages/imglist/index.jsx
  47. 85
    0
      src/pages/imglist/index.scss
  48. 3
    0
      src/pages/index/index.config.js
  49. 54
    0
      src/pages/index/index.jsx
  50. 0
    0
      src/pages/index/index.scss
  51. 4
    0
      src/pages/label/edit/index.config.js
  52. 165
    0
      src/pages/label/edit/index.jsx
  53. 50
    0
      src/pages/label/edit/index.scss
  54. 4
    0
      src/pages/label/index.config.js
  55. 95
    0
      src/pages/label/index.jsx
  56. 54
    0
      src/pages/label/index.scss
  57. 4
    0
      src/pages/mateTag/edit/index.config.js
  58. 140
    0
      src/pages/mateTag/edit/index.jsx
  59. 50
    0
      src/pages/mateTag/edit/index.scss
  60. 4
    0
      src/pages/mateTag/index.config.js
  61. 99
    0
      src/pages/mateTag/index.jsx
  62. 54
    0
      src/pages/mateTag/index.scss
  63. 0
    0
      src/pages/material/importimg/index.jsx
  64. 4
    0
      src/pages/material/index.config.js
  65. 127
    0
      src/pages/material/index.jsx
  66. 58
    0
      src/pages/material/index.scss
  67. 3
    0
      src/pages/shop/edit/index.config.js
  68. 153
    0
      src/pages/shop/edit/index.jsx
  69. 50
    0
      src/pages/shop/edit/index.scss
  70. 4
    0
      src/pages/shop/index.config.js
  71. 150
    0
      src/pages/shop/index.jsx
  72. 54
    0
      src/pages/shop/index.scss
  73. 31
    0
      src/reducers/guide.js
  74. 10
    0
      src/reducers/index.js
  75. 27
    0
      src/reducers/page.js
  76. 28
    0
      src/reducers/user.js
  77. 28
    0
      src/store/index.js
  78. 25
    0
      src/store/user.js
  79. 16
    0
      src/util/getCode.js
  80. 18
    0
      src/util/getCodeUrl.js
  81. 16
    0
      src/util/getQueryValue.js
  82. 106
    0
      src/util/request.js

+ 12
- 0
.editorconfig View File

@@ -0,0 +1,12 @@
1
+# http://editorconfig.org
2
+root = true
3
+
4
+[*]
5
+indent_style = space
6
+indent_size = 2
7
+charset = utf-8
8
+trim_trailing_whitespace = true
9
+insert_final_newline = true
10
+
11
+[*.md]
12
+trim_trailing_whitespace = false

+ 3
- 0
.eslintrc.js View File

@@ -0,0 +1,3 @@
1
+module.exports = {
2
+  'extends': ['taro/react']
3
+}

+ 6
- 0
.gitignore View File

@@ -0,0 +1,6 @@
1
+dist/
2
+deploy_versions/
3
+.temp/
4
+.rn_temp/
5
+node_modules/
6
+.DS_Store

+ 10
- 0
babel.config.js View File

@@ -0,0 +1,10 @@
1
+// babel-preset-taro 更多选项和默认值:
2
+// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
3
+module.exports = {
4
+  presets: [
5
+    ['taro', {
6
+      framework: 'react',
7
+      ts: false
8
+    }]
9
+  ]
10
+}

+ 33
- 0
config/dev.js View File

@@ -0,0 +1,33 @@
1
+module.exports = {
2
+  env: {
3
+    NODE_ENV: '"development"'
4
+  },
5
+  defineConstants: {
6
+    APPID:'"wx74db171e5f6524ad"'
7
+    // HOST: '"http://localhost:7080"',
8
+    // WSS_HOST: '"ws://localhost:7080"',
9
+    // OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
10
+    // OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",
11
+  },
12
+  mini: {},
13
+  h5: {
14
+    publicPath: '/',
15
+    staticDirectory: 'static',
16
+    postcss: {
17
+      autoprefixer: {
18
+        enable: true
19
+      }
20
+    },
21
+    // 自定义 Webpack 配置
22
+    // webpackChain: {},
23
+    devServer: {
24
+      proxy: {
25
+        '/api': {
26
+          // target: 'https://sgl.ycjcjy.com',
27
+          target: 'http://localhost:7080',
28
+          changeOrigin: true
29
+        }
30
+      }
31
+    }
32
+  }
33
+}

+ 70
- 0
config/index.js View File

@@ -0,0 +1,70 @@
1
+const config = {
2
+  projectName: 'shigongliserverh5',
3
+  date: '2020-12-19',
4
+  designWidth: 750,
5
+  deviceRatio: {
6
+    640: 2.34 / 2,
7
+    750: 1,
8
+    828: 1.81 / 2
9
+  },
10
+  sourceRoot: 'src',
11
+  outputRoot: 'dist',
12
+  plugins: [],
13
+  defineConstants: {
14
+  },
15
+  copy: {
16
+    patterns: [
17
+    ],
18
+    options: {
19
+    }
20
+  },
21
+  framework: 'react',
22
+  mini: {
23
+    postcss: {
24
+      pxtransform: {
25
+        enable: true,
26
+        config: {
27
+
28
+        }
29
+      },
30
+      url: {
31
+        enable: true,
32
+        config: {
33
+          limit: 1024 // 设定转换尺寸上限
34
+        }
35
+      },
36
+      cssModules: {
37
+        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
38
+        config: {
39
+          namingPattern: 'module', // 转换模式,取值为 global/module
40
+          generateScopedName: '[name]__[local]___[hash:base64:5]'
41
+        }
42
+      }
43
+    }
44
+  },
45
+  h5: {
46
+    publicPath: '/',
47
+    staticDirectory: 'static',
48
+    postcss: {
49
+      autoprefixer: {
50
+        enable: true,
51
+        config: {
52
+        }
53
+      },
54
+      cssModules: {
55
+        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
56
+        config: {
57
+          namingPattern: 'module', // 转换模式,取值为 global/module
58
+          generateScopedName: '[name]__[local]___[hash:base64:5]'
59
+        }
60
+      }
61
+    }
62
+  }
63
+}
64
+
65
+module.exports = function (merge) {
66
+  if (process.env.NODE_ENV === 'development') {
67
+    return merge({}, config, require('./dev'))
68
+  }
69
+  return merge({}, config, require('./prod'))
70
+}

+ 19
- 0
config/prod.js View File

@@ -0,0 +1,19 @@
1
+module.exports = {
2
+  env: {
3
+    NODE_ENV: '"production"'
4
+  },
5
+  defineConstants: {
6
+    APPID:'"wx74db171e5f6524ad"'
7
+  },
8
+  mini: {},
9
+  h5: {
10
+    /**
11
+     * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
12
+     * 参考代码如下:
13
+     * webpackChain (chain) {
14
+     *   chain.plugin('analyzer')
15
+     *     .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
16
+     * }
17
+     */
18
+  }
19
+}

+ 1
- 0
debug.log View File

@@ -0,0 +1 @@
1
+[1226/120058.409:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)

+ 19421
- 0
package-lock.json
File diff suppressed because it is too large
View File


+ 66
- 0
package.json View File

@@ -0,0 +1,66 @@
1
+{
2
+  "name": "shigongliserverh5",
3
+  "version": "1.0.0",
4
+  "private": true,
5
+  "description": "十公里h5",
6
+  "templateInfo": {
7
+    "name": "taro-ui",
8
+    "typescript": false,
9
+    "css": "sass"
10
+  },
11
+  "scripts": {
12
+    "build:weapp": "taro build --type weapp",
13
+    "build:swan": "taro build --type swan",
14
+    "build:alipay": "taro build --type alipay",
15
+    "build:tt": "taro build --type tt",
16
+    "build:h5": "taro build --type h5",
17
+    "build:rn": "taro build --type rn",
18
+    "build:qq": "taro build --type qq",
19
+    "build:jd": "taro build --type jd",
20
+    "build:quickapp": "taro build --type quickapp",
21
+    "dev:weapp": "npm run build:weapp -- --watch",
22
+    "dev:swan": "npm run build:swan -- --watch",
23
+    "dev:alipay": "npm run build:alipay -- --watch",
24
+    "dev:tt": "npm run build:tt -- --watch",
25
+    "dev:h5": "npm run build:h5 -- --watch",
26
+    "dev:rn": "npm run build:rn -- --watch",
27
+    "dev:qq": "npm run build:qq -- --watch",
28
+    "dev:jd": "npm run build:jd -- --watch",
29
+    "dev:quickapp": "npm run build:quickapp -- --watch"
30
+  },
31
+  "browserslist": [
32
+    "last 3 versions",
33
+    "Android >= 4.1",
34
+    "ios >= 8"
35
+  ],
36
+  "author": "",
37
+  "dependencies": {
38
+    "@babel/runtime": "^7.7.7",
39
+    "@tarojs/cli": "3.0.13",
40
+    "@tarojs/components": "3.0.13",
41
+    "@tarojs/react": "3.0.13",
42
+    "@tarojs/runtime": "3.0.13",
43
+    "@tarojs/taro": "3.0.13",
44
+    "lodash": "4.17.15",
45
+    "lodash.groupby": "^4.6.0",
46
+    "react": "^16.10.0",
47
+    "react-dom": "^16.10.0",
48
+    "react-redux": "^7.2.2",
49
+    "redux": "^4.0.5",
50
+    "taro-ui": "^3.0.0-alpha.7"
51
+  },
52
+  "devDependencies": {
53
+    "@babel/core": "^7.8.0",
54
+    "@tarojs/mini-runner": "3.0.13",
55
+    "@tarojs/webpack-runner": "3.0.13",
56
+    "@types/webpack-env": "^1.13.6",
57
+    "babel-preset-taro": "3.0.13",
58
+    "eslint": "^6.8.0",
59
+    "eslint-config-taro": "3.0.13",
60
+    "stylelint": "9.3.0",
61
+    "@types/react": "^16.0.0",
62
+    "eslint-plugin-react": "^7.8.2",
63
+    "eslint-plugin-import": "^2.12.0",
64
+    "eslint-plugin-react-hooks": "^1.6.1"
65
+  }
66
+}

+ 23
- 0
project.config.json View File

@@ -0,0 +1,23 @@
1
+{
2
+	"miniprogramRoot": ".dist",
3
+	"projectname": "shigongliserverh5",
4
+	"description": "十公里h5",
5
+	"appid": "wx74db171e5f6524ad",
6
+	"setting": {
7
+		"urlCheck": true,
8
+		"es6": false,
9
+		"postcss": false,
10
+		"preloadBackgroundData": false,
11
+		"minified": false,
12
+		"newFeature": true,
13
+		"autoAudits": false,
14
+		"coverView": true,
15
+		"showShadowRootInWxmlPanel": false,
16
+		"scopeDataCheck": false,
17
+		"useCompilerModule": false
18
+	},
19
+	"compileType": "miniprogram",
20
+	"simulatorType": "wechat",
21
+	"simulatorPluginLibVersion": {},
22
+	"condition": {}
23
+}

BIN
shigonglih5.rar View File


+ 22
- 0
src/app.config.js View File

@@ -0,0 +1,22 @@
1
+export default {
2
+  pages: [
3
+    'pages/index/index',
4
+    'pages/account/index',
5
+    'pages/account/edit/index',
6
+    'pages/material/index',
7
+    'pages/label/index',
8
+    'pages/label/edit/index',
9
+    'pages/imglist/index',
10
+    'pages/batchimport/index',
11
+    'pages/shop/index',
12
+    'pages/shop/edit/index',
13
+    'pages/mateTag/index',
14
+    'pages/mateTag/edit/index',
15
+  ],
16
+  window: {
17
+    backgroundTextStyle: 'light',
18
+    navigationBarBackgroundColor: '#fff',
19
+    navigationBarTitleText: 'WeChat',
20
+    navigationBarTextStyle: 'black'
21
+  }
22
+}

+ 49
- 0
src/app.js View File

@@ -0,0 +1,49 @@
1
+
2
+import 'taro-ui/dist/style/index.scss'
3
+import React, { Component, useEffect } from 'react'
4
+import { Provider } from 'react-redux'
5
+import configStore from './store'
6
+import useUser from './store/user'
7
+import { getCode, setCode } from './util/getCode'
8
+import getCodeUrl from './util/getCodeUrl' 
9
+import request from './util/request'
10
+import './app.scss'
11
+
12
+const store = configStore()
13
+
14
+const App = (props)=> {
15
+  const {user, getUser} = useUser()
16
+  const code = getCode()
17
+
18
+  useEffect(() => {
19
+    // if (!user || !user.userId) {
20
+    //   if (!code) {
21
+    //     // 跳转
22
+    //     window.location.href=getCodeUrl(); 
23
+    //   } else {
24
+    //     // 请求 user
25
+    //     getUser(code)
26
+    //   }
27
+    // }
28
+
29
+    // return () => setCode(code)
30
+
31
+  }, [])
32
+
33
+// console.log(getCodeUrl(),'getCodeUrl')
34
+
35
+// window.location.href=getCodeUrl(); 
36
+
37
+  // 在 App 类中的 render() 函数没有实际作用
38
+  // 请勿修改此函数
39
+ 
40
+    return (
41
+      <Provider store={store}>
42
+        {props.children}
43
+      </Provider>
44
+    )
45
+  
46
+}
47
+
48
+export default App
49
+

+ 58
- 0
src/app.scss View File

@@ -0,0 +1,58 @@
1
+body {
2
+    background-color: #f4f4f4;
3
+    letter-spacing: 4px;
4
+ 
5
+ 
6
+ }
7
+ .page-container {
8
+    padding: 0 41.3px 0;
9
+    width: 667.33px;
10
+  
11
+    
12
+  
13
+  
14
+    color: #181818;
15
+  }
16
+ 
17
+ 
18
+  .title{
19
+    color: #7b7b7b;
20
+    font-size: 30px;
21
+    font-weight: 500;
22
+    margin-left: 40px;
23
+  }
24
+ 
25
+ 
26
+  .inputstyle {
27
+    // padding:13.33px;
28
+    &-view {
29
+      margin: 50px 0 0;
30
+  
31
+      &-card {
32
+        // height: 106px;
33
+        // line-height: 106px;
34
+        padding: 0 40px;
35
+        // color:#181818;
36
+        font-size: 24px;
37
+        // font-weight: 600;
38
+        margin-top: 26.67px;
39
+        border-radius: 30px;
40
+        border-radius: 20px;
41
+        .input{
42
+          font-size: 28px;
43
+          padding:30px 0;
44
+          line-height: 106px;
45
+          // color: red;
46
+        }
47
+        .placeholderinput{
48
+          // line-height: 106px;
49
+          color: #d2d2d2;
50
+          font-size: 28px;
51
+        }
52
+      }
53
+      
54
+      // style={{width:'48.4rpx',height:'48.4rpx'}}
55
+    }
56
+  
57
+  }
58
+ 

BIN
src/assets/editicon.png View File


BIN
src/assets/icon.png View File


BIN
src/assets/locationicon.png View File


BIN
src/assets/menuicon.png View File


BIN
src/assets/more.png View File


BIN
src/assets/radio.png View File


BIN
src/assets/upload.png View File


BIN
src/assets/uploadicon.png View File


BIN
src/assets/usericon.png View File


+ 12
- 0
src/compents/container/index.jsx View File

@@ -0,0 +1,12 @@
1
+import React from 'react'
2
+import { View,  } from '@tarojs/components'
3
+import './index.scss'
4
+
5
+const container = (props) => {
6
+    const { className,children, ...prop } = props
7
+    // let { className, ...prop } = props
8
+    return  <View className={`container ${className}`} {...prop} >{children}</View>;
9
+    // <view className={`container,${className}`} props >{children}</view>;
10
+}
11
+
12
+export default container

+ 6
- 0
src/compents/container/index.scss View File

@@ -0,0 +1,6 @@
1
+.container{
2
+ 
3
+    background-color: #fff;
4
+    border-radius: 56px;
5
+    // padding: 40px;
6
+}

+ 42
- 0
src/compents/tab/index.jsx View File

@@ -0,0 +1,42 @@
1
+import React, { useEffect, useState } from 'react'
2
+import Taro from "@tarojs/taro";
3
+import { Button, View } from '@tarojs/components'
4
+
5
+import './index.scss'
6
+
7
+// const getColor = (role) => {
8
+//     switch (role) {
9
+//         case roleList.landlord: return '#274291'
10
+//         case roleList.adminuser: return '#274291'
11
+//         // landlord: 'landlord',
12
+//         case roleList.customer: return '#fed12f'
13
+//     }
14
+// }
15
+
16
+
17
+const tab = (props) => {
18
+    // formType="submit"
19
+
20
+    const { value, pageState, formType, color, ...prop } = props
21
+
22
+    const [state, setState] = useState(1)
23
+    // console.log(props)
24
+    useEffect(() => {
25
+
26
+    }, [])
27
+    //  &-on{
28
+    //     color: #fed12f; style={{ backgroundColor:'#274291' ,color}}
29
+    // }${props.className}
30
+    return <View className='tab'>
31
+        {value.length == 1 && <View className={`tab tab1 ${props.className}`} onClick={() => props.onClick('2')}>{value[0]}
32
+        </View>}
33
+        {value.length == 2 && <View className={`tab tab2 ${props.className}`} style={{ display: 'flex', }}>
34
+            <View style={{ width: '50%' }} style={pageState == '2' ? { color: '#274291', width: '50%' } : { width: '50%' }} onClick={props.onClick[0]}>{value[0]}</View>
35
+           { !formType? 
36
+            <View formType={formType} style={{ width: '50%' }} style={pageState == '3' ? { color: '#274291', width: '50%' } : { width: '50%' }} onClick={props.onClick[1]}>{value[1]}</View>
37
+            :<Button className='tab-btn' formType={formType} plain={true} style={{ width: '50%' }} style={pageState == '3' ? { color: '#274291', width: '50%',border:'none' } : { width: '50%',border:'none' }} onClick={props.onClick[1]}>{value[1]}</Button>}
38
+        </View>}
39
+    </View>
40
+};
41
+
42
+export default tab

+ 32
- 0
src/compents/tab/index.scss View File

@@ -0,0 +1,32 @@
1
+.tab{
2
+    
3
+    position:absolute;
4
+    bottom: 0;
5
+    width: 100%;
6
+    height: 173.33px;
7
+    border-radius:40px 40px 0 0;
8
+    text-align: center;
9
+    line-height: 173px;
10
+    z-index:999;
11
+    background-color: #274291;
12
+&-btn{
13
+    line-height: unset;
14
+}
15
+    .tab1 {
16
+        background-color: #274291;
17
+        font-size: 44px;
18
+        font-weight: 600;
19
+        letter-spacing: 14px;
20
+        color: #fff;
21
+    }
22
+
23
+    .tab2 {
24
+        background-color: #ffffff;
25
+        font-size: 34px;
26
+        color: #d2d2d2;
27
+        font-weight: 500;
28
+        line-height: unset;
29
+    }
30
+
31
+    
32
+}

+ 48
- 0
src/compents/tags/index.jsx View File

@@ -0,0 +1,48 @@
1
+import React, { useEffect, useState } from 'react'
2
+import Taro from "@tarojs/taro";
3
+import { useSelector } from 'react-redux'
4
+import { View, Text } from '@tarojs/components'
5
+import './index.scss'
6
+
7
+const tags = (props) => {
8
+
9
+
10
+    const { value, list, onChange, ...prop } = props
11
+
12
+    const [state, setState] = useState(1)
13
+    const [key, setKey] = useState(value)
14
+    const [keyList, setKeyList] = useState([])
15
+    console.log(props)
16
+    useEffect(() => {
17
+
18
+    }, [])
19
+    const onClick = (item) => {
20
+       
21
+        
22
+        let  newkeyList= keyList
23
+        console.log(newkeyList.find(x => x.tagId === item.tagId),'333')
24
+        if (newkeyList.find(x => x.tagId === item.tagId)) {
25
+            newkeyList =  newkeyList.filter((x) => x.tagId != item.tagId )
26
+        } else {
27
+            newkeyList.push(item)
28
+        }
29
+
30
+console.log(newkeyList,keyList)
31
+        setKeyList([...newkeyList])
32
+        onChange([...newkeyList])
33
+    }
34
+    return <View className='tags'>
35
+        <View className='at-row at-row--wrap' style={{ marginTop: '10rpx' }}>
36
+            {
37
+                list.map((item) => {
38
+                    return <View className='at-col at-col-4 ' >
39
+                        <View className={`tags-btn tags-btn${keyList.find(x => x.tagId === item.tagId) ? '-on' : ''}`} onClick={() => onClick(item)} >{item.name}</View>
40
+                    </View>
41
+                })
42
+            }
43
+
44
+        </View>
45
+    </View>
46
+};
47
+
48
+export default tags

+ 21
- 0
src/compents/tags/index.scss View File

@@ -0,0 +1,21 @@
1
+.tags {
2
+
3
+
4
+
5
+  &-btn {
6
+    background-color: #ffffff;
7
+    color: #acacac;
8
+    margin: 10px;
9
+    font-size: 22px;
10
+    height: 50px;
11
+    line-height: 50px;
12
+    border-radius: 25px;
13
+
14
+    &-on {
15
+      background-color: #274291;
16
+      color: #ffffff;
17
+    }
18
+  }
19
+
20
+
21
+}

+ 21
- 0
src/index.html View File

@@ -0,0 +1,21 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
5
+  <meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
6
+  <meta name="apple-mobile-web-app-capable" content="yes">
7
+  <meta name="apple-touch-fullscreen" content="yes">
8
+  <meta name="format-detection" content="telephone=no,address=no">
9
+  <meta name="apple-mobile-web-app-status-bar-style" content="white">
10
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
11
+  <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
12
+ 
13
+  <title></title>
14
+  <script>
15
+    !function(x){function w(){var v,u,t,tes,s=x.document,r=s.documentElement,a=r.getBoundingClientRect().width;if(!v&&!u){var n=!!x.navigator.appVersion.match(/AppleWebKit.*Mobile.*/);v=x.devicePixelRatio;tes=x.devicePixelRatio;v=n?v:1,u=1/v}if(a>=640){r.style.fontSize="40px"}else{if(a<=320){r.style.fontSize="20px"}else{r.style.fontSize=a/320*20+"px"}}}x.addEventListener("resize",function(){w()});w()}(window);
16
+  </script>
17
+</head>
18
+<body>
19
+  <div id="app"></div>
20
+</body>
21
+</html>

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

@@ -0,0 +1,14 @@
1
+import React from 'react';
2
+import { View, ScrollView } from '@tarojs/components'
3
+import './index.scss'
4
+
5
+const Layout = ({ children }) => {
6
+    return <ScrollView scrollY className='scrolllayout' >
7
+        <View className='page-container' >
8
+            {children}
9
+        </View>
10
+    </ScrollView>
11
+}
12
+
13
+
14
+export default Layout;

+ 5
- 0
src/layout/index.scss View File

@@ -0,0 +1,5 @@
1
+.scrolllayout{
2
+    
3
+    height: calc(100vh - 173.33px)
4
+    
5
+}

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

@@ -0,0 +1,3 @@
1
+export default {
2
+ 
3
+}

+ 172
- 0
src/pages/account/edit/index.jsx View File

@@ -0,0 +1,172 @@
1
+import React, { useEffect, useState } from 'react'
2
+import Taro ,{useDidShow}from "@tarojs/taro";
3
+import { View, Input, Text, Image, Form, Button } from '@tarojs/components'
4
+import Layout from '../../../layout/index'
5
+import Tab from '../../../compents/tab/index'
6
+import Container from '../../../compents/container/index'
7
+import './index.scss'
8
+import request from '../../../util/request'
9
+
10
+
11
+import getQueryValue from '../../../util/getQueryValue'
12
+
13
+const index = (props) => {
14
+
15
+    const { id, keeperId } = getQueryValue()
16
+
17
+    const [data, setData] = useState({})
18
+    const [pageState, setPageState] = useState('1')
19
+    const [list, setList] = useState([])
20
+    useDidShow(() => {
21
+        console.log('useDidShow')
22
+        if (keeperId) {
23
+            getShopKeeperDetail()
24
+        }else{
25
+            setData({})
26
+        }
27
+    })
28
+
29
+
30
+    const getShopKeeperDetail = () => {
31
+        request({ url: `/taShopKeeper/${keeperId}`, method: 'get' }).then((res) => {
32
+            console.log(res,'getDetail')
33
+            setData(res.data.data)
34
+        })
35
+    }
36
+
37
+    const onRegisterChange = (e) => {
38
+        console.log(e, '111')
39
+    }
40
+    const onSave = () => {
41
+        console.log(333)
42
+
43
+        // Taro.showModal({
44
+        //     title: '修改成功',
45
+        //     content: '点击确认按钮,返回上级菜单',
46
+        //     showCancel: false,
47
+        //     success: function (res) {
48
+        //         if (res.confirm) {
49
+        //             console.log('用户点击确定')
50
+
51
+        //             Taro.navigateBack({
52
+        //                 delta: 1
53
+        //             })
54
+        //         } else if (res.cancel) {
55
+        //             console.log('用户点击取消')
56
+        //         }
57
+        //     }
58
+        // })
59
+    }
60
+
61
+    const editShopKeeper = (value) => {
62
+        console.log(value, 333)
63
+
64
+        if(keeperId){
65
+            Taro.showModal({
66
+                title: '确定修改该老板信息吗',
67
+                cancelColor: '#d2d2d2',
68
+                confirmColor: "#274191",
69
+                success: (res) => {
70
+                  if (res.confirm) {
71
+                    request({ url: `/taShopKeeper/${keeperId}`, data: {...data, ...value }, method: 'put' }).then((res) => {
72
+                        Taro.navigateBack({
73
+                            delta: 1
74
+                        })
75
+                    })
76
+          
77
+          
78
+                  } else if (res.cancel) {
79
+                    console.log('用户点击取消')
80
+                  }
81
+                }
82
+              })
83
+        }else{
84
+            request({ url: "/taShopKeeper", data: { ...value, shopId: id }, method: 'post' }).then((res) => {
85
+                Taro.navigateBack({
86
+                    delta: 1
87
+                })
88
+            })
89
+        }
90
+
91
+        
92
+
93
+    }
94
+    function formSubmit(e) {
95
+        console.log(e.detail, 'formSubmit')
96
+        editShopKeeper(e.detail.value)
97
+
98
+
99
+    }
100
+
101
+    const formReset = () => {
102
+        console.log('formReset')
103
+    }
104
+
105
+    return <View className='addnewhouse'>
106
+
107
+        {/* "createDate": "2020-12-24T11:57:16.851Z",
108
+  "keeperId": "string",
109
+  "name": "string",
110
+  "personId": "string",
111
+  "phone": "string",
112
+  "shopId": "string",
113
+  "status": 0 */}
114
+        <Form onSubmit={formSubmit} onReset={formReset}>
115
+            <Layout>
116
+
117
+                {/* <View className='inputstyle-view'>
118
+                    <Text className='title'>系统账号</Text>
119
+                    <Container className='inputstyle-view-card '  >
120
+                        <Input name='keeperId' placeholderClass='placeholderinput' placeholder='' className='input' />
121
+                    </Container>
122
+                </View> */}
123
+                <View className='inputstyle-view'>
124
+                    <Text className='title'>姓名</Text>
125
+                    <Container className='inputstyle-view-card '  >
126
+                        <Input name='name' value={data.name} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
127
+                    </Container>
128
+                </View>
129
+                <View className='inputstyle-view'>
130
+                    <Text className='title'>电话</Text>
131
+                    <Container className='inputstyle-view-card '  >
132
+                        <Input name='phone'  value={data.phone} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
133
+                    </Container>
134
+                </View>
135
+                {/* <View className='inputstyle-view'>
136
+                    <Text className='title'>微信号</Text>
137
+                    <Container className='inputstyle-view-card '  >
138
+                        <Input name='personId' placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
139
+                    </Container>
140
+                </View>
141
+               <View className='inputstyle-view'>
142
+                    <Text className='title'>房源数</Text>
143
+                    <Container className='inputstyle-view-card '  >
144
+                        <Input name='nnn' placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
145
+                    </Container>
146
+                </View>
147
+                <View className='inputstyle-view'>
148
+                    <Text className='title'>logo</Text>
149
+                    <Container className='inputstyle-view-card ' style={{padding:'0.6rem',width:'2rem',height:'2rem'}} >
150
+                        <Image className='guide-view-img'  style={{width:'100%',height:'100%'}} src={uploadicon || "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1657471424,2319316184&fm=26&gp=0.jpg"}></Image>
151
+                    </Container>
152
+                </View> */}
153
+
154
+
155
+
156
+            </Layout>
157
+            {/* <Input formType="submit" > */}
158
+            <Tab formType="submit" className='addhousetab' pageState='3' value={['取消', '保存']} onClick={[(e) => {
159
+                Taro.navigateBack({
160
+                    delta: 1
161
+                })
162
+            }, () => onSave()]}></Tab>
163
+
164
+            {/* </Input> */}
165
+
166
+        </Form>
167
+
168
+
169
+    </View>
170
+}
171
+
172
+export default index

+ 50
- 0
src/pages/account/edit/index.scss View File

@@ -0,0 +1,50 @@
1
+.map {
2
+  // padding:13.33px;
3
+  &-view {
4
+    margin: 50px 0 0;
5
+
6
+    &-card {
7
+      // height: 106px;
8
+      // line-height: 106px;
9
+      padding: 0 40px;
10
+      // color:#181818;
11
+      font-size: 24px;
12
+      // font-weight: 600;
13
+      margin-top: 26.67px;
14
+      border-radius: 30px;
15
+      border-radius: 20px;
16
+      .input{
17
+        font-size: 28px;
18
+        padding:30px 0;
19
+        line-height: 106px;
20
+        // color: red;
21
+      }
22
+      .placeholderinput{
23
+        // line-height: 106px;
24
+        color: #d2d2d2;
25
+        font-size: 28px;
26
+      }
27
+    }
28
+    &-icon {
29
+      margin-left: 40px;
30
+      // padding: 20px 30px;
31
+      // color:#181818;
32
+      width: 150px;
33
+      height: 106.67px;
34
+      // font-size: 36px;
35
+      // // font-weight: 600;
36
+      margin-top: 26.67px;
37
+      border-radius: 20px;
38
+      background-color: #274291;
39
+      padding: 0;
40
+      text-align: center;
41
+      line-height:120.67px;
42
+      .icon {
43
+        
44
+        // width: 100%;
45
+      }
46
+    }
47
+    // style={{width:'48.4rpx',height:'48.4rpx'}}
48
+  }
49
+
50
+}

+ 4
- 0
src/pages/account/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 80
- 0
src/pages/account/index.jsx View File

@@ -0,0 +1,80 @@
1
+import React, { useEffect, useMemo, useState, useRef } from 'react'
2
+import Taro, { useDidShow, useRouter } from '@tarojs/taro'
3
+import './index.scss'
4
+import { View, Text, Input, Image } from '@tarojs/components'
5
+import ContainerLayout from '../../compents/container/index'
6
+import Tab from '../../compents/tab/index'
7
+import Layout from '../../layout/index'
8
+import request from '../../util/request'
9
+import getQueryValue from '../../util/getQueryValue'
10
+
11
+
12
+const account = (props) => {
13
+
14
+  const { id } = getQueryValue()
15
+  const [list, setList] = useState([])
16
+
17
+
18
+  useDidShow(() => {
19
+    console.log('useDidShow')
20
+    getShopKepperList({ pageNum: 1, pageSize:10 })
21
+  })
22
+
23
+  function getShopKepperList() {
24
+    request({ url: '/taShopKeeper',params:{shopId:id}, method: 'get', }).then((res)=>{
25
+      const { records, ...page} = res.data.data
26
+      setList(records)
27
+    })
28
+  }
29
+
30
+  const onDelete = (keeperId) => {
31
+    Taro.showModal({
32
+      title: '确定删除该老板账号吗',
33
+      content: '确定后,该老板房源信息将一并删除',
34
+      cancelColor: '#d2d2d2',
35
+      confirmColor: "#274191",
36
+      success: (res) => {
37
+        if (res.confirm) {
38
+          console.log('用户点击确定')
39
+          request({ url: `/taShopKeeper/${keeperId}`, method: 'delete', }).then((res)=>{
40
+            getShopKepperList({ pageNum: 1, pageSize:10 })
41
+          })
42
+
43
+        } else if (res.cancel) {
44
+          console.log('用户点击取消')
45
+        }
46
+      }
47
+    })
48
+  }
49
+
50
+
51
+
52
+
53
+  return <View className='account'>
54
+    <Layout>
55
+      {list.map((item, index) => {
56
+        return <View className='account-view'>
57
+          {/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
58
+          <ContainerLayout className='account-view-card'>
59
+            <View className='top' >
60
+              <View>姓名:{item.name}</View>
61
+              <View>电话:{item.phone}</View>
62
+              {/* <View>微信号:{x.user.name}</View>
63
+              <View>房源数:{x.user.name}</View> */}
64
+            </View>
65
+            <View className='bottom'>
66
+              <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?keeperId=${item.keeperId}` }) }}>编辑</Text>
67
+              <Text onClick={()=>onDelete(item.keeperId)}>删除</Text>
68
+            </View>
69
+          </ContainerLayout>
70
+
71
+        </View>
72
+
73
+      })}
74
+    </Layout>
75
+    {/* onClick={(e)=>(e) */}
76
+    <Tab value={['+新增名宿老板账号']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?id=${id}` }) }} ></Tab>
77
+  </View>
78
+}
79
+
80
+export default account

+ 54
- 0
src/pages/account/index.scss View File

@@ -0,0 +1,54 @@
1
+.account {
2
+
3
+  // padding: 13.33px 0;
4
+  &-view {
5
+    margin: 40px 0 0;
6
+
7
+    // padding: 0;
8
+    &-title {
9
+      color: #7b7b7b;
10
+      font-size: 30px;
11
+      font-weight: 500;
12
+      margin-left: 40px;
13
+
14
+    }
15
+
16
+    &-card {
17
+      padding: 0;
18
+      color: #181818;
19
+      font-size: 24px;
20
+      font-weight: 600;
21
+      margin-top: 26.67px;
22
+      position: relative;
23
+
24
+      &-radio {
25
+          width: 50px;
26
+          height: 50px;
27
+        background-color: #274291;
28
+        text-align: center;
29
+        line-height: 50px;
30
+        position: absolute;
31
+        border-radius: 25px;
32
+        top: -12.5px;
33
+        right: -12.5px;
34
+      }
35
+
36
+      .top {
37
+        padding: 40px 40px;
38
+        border-bottom: 1px solid #f4f4f4;
39
+        line-height: 32px;
40
+        font-weight: 500;
41
+        // font-size: ;
42
+        // min-height: 120px;
43
+      }
44
+
45
+      .bottom {
46
+        display: flex;
47
+        justify-content: space-around;
48
+        padding: 20px
49
+      }
50
+
51
+
52
+    }
53
+  }
54
+}

+ 98
- 0
src/pages/adminUser/index.jsx View File

@@ -0,0 +1,98 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import Taro, { } from "@tarojs/taro";
3
+import { View, Text, Image } from '@tarojs/components'
4
+import Layout from '../../layout/index'
5
+import ContainerLayout from '../../compents/container/index'
6
+import usericon from '../../assets/usericon.png'
7
+import editicon from '../../assets/editicon.png'
8
+import upload from '../../assets/upload.png'
9
+import menuicon from '../../assets/menuicon.png'
10
+
11
+import './index.scss'
12
+
13
+const menuList = [
14
+  {
15
+    title: '店铺管理',
16
+    icon: usericon,
17
+    url: '/pages/shop/index'
18
+  },{
19
+//   title: '名宿老板账号管理',
20
+//   icon: usericon,
21
+//   url: '/pages/account/index'
22
+// }, {
23
+  title: '素材编辑与查询',
24
+  icon: editicon,
25
+  url: '/pages/material/index'
26
+}, {
27
+  title: '素材批量录入',
28
+  icon: upload,
29
+  url: '/pages/batchimport/index'
30
+}, {
31
+  title: '素材标签管理',
32
+  icon: menuicon,
33
+  url: '/pages/label/index'
34
+}]
35
+
36
+const index = (props) => {
37
+
38
+  const [isOpened, setIsOpened] = useState(false)
39
+  const [userRole, setUserRole] = useState('1')
40
+  const [pageState, setPageState] = useState('1')
41
+  const [list, setList] = useState([])
42
+  const [radioHouseData, setRadioHouseData] = useState()
43
+  const [radioHouseState, setRadioHouseState] = useState(false)
44
+
45
+  useEffect(() => {
46
+
47
+   
48
+
49
+  }, [])
50
+
51
+
52
+
53
+  const handleClose = () => {
54
+    setIsOpened(false)
55
+  }
56
+  const onTabClick = (e) => {
57
+    console.log(e, '111')
58
+    setUserRole(e)
59
+
60
+  }
61
+
62
+  const onRegisterChange = (e) => {
63
+    console.log(e, '111')
64
+  }
65
+  const onClick = (row) => {
66
+
67
+
68
+    Taro.navigateTo({ url: row.url })
69
+
70
+
71
+
72
+  }
73
+
74
+
75
+  return <View className='adminuser'>
76
+
77
+
78
+
79
+
80
+    <View className='page-container'>
81
+      {menuList.map((row) => {
82
+        return <ContainerLayout className='adminuser-menu' onClick={() => onClick(row)}>
83
+          <Text>{row.title}</Text>
84
+          <View className='adminuser-menu-img' >
85
+            <Image className='image' src={row.icon}></Image>
86
+          </View>
87
+
88
+        </ContainerLayout>
89
+      })}
90
+    </View>
91
+
92
+
93
+
94
+
95
+  </View>
96
+}
97
+
98
+export default index

+ 30
- 0
src/pages/adminUser/index.scss View File

@@ -0,0 +1,30 @@
1
+.adminuser{
2
+  
3
+  &-menu{
4
+    margin-top: 40px;
5
+    padding: 60px;
6
+    font-size: 32px;
7
+    font-weight: 600;
8
+    border-radius: 50px;
9
+    position: relative;
10
+    background-color: #fff;
11
+    border-radius: 56px;
12
+    padding: 40px;
13
+    &-img{
14
+      background-color:#274291 ;
15
+      position: absolute;
16
+      width: 60px;
17
+      height: 60px;
18
+      right: 40px;
19
+      top: 40px;
20
+      border-radius: 30px;
21
+      text-align: center;
22
+      // line-height: 0px;
23
+      .image{
24
+        margin-top: 15px;
25
+        width: 30px;
26
+        height: 30px;
27
+      }
28
+    }
29
+  }
30
+}

+ 4
- 0
src/pages/batchimport/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 147
- 0
src/pages/batchimport/index.jsx View File

@@ -0,0 +1,147 @@
1
+import React, { useEffect, useMemo, useState, useRef } from 'react'
2
+import Taro, { useDidShow } from '@tarojs/taro'
3
+import './index.scss'
4
+import { View, Text, Input, Image } from '@tarojs/components'
5
+import ContainerLayout from '../../compents/container/index'
6
+import Tab from '../../compents/tab/index'
7
+import Layout from '../../layout/index'
8
+import Tags from '../../compents/tags/index'
9
+import { AtImagePicker } from 'taro-ui'
10
+import request, { uploadFiles } from '../../util/request'
11
+import uploadicon from '../../assets/uploadicon.png'
12
+
13
+const batchimport = (props) => {
14
+    const [pageState, setPageState] = useState('1')
15
+    const [labelList, setLabelList] = useState([])
16
+    const [imgUrl, setImgUrl] = useState({})
17
+    const [tagList, setTagList] = useState([])
18
+    const [radioHouse, setRadioHouse] = useState()
19
+    let [arrList, setArrList] = useState([[], [], []])
20
+    useDidShow(() => {
21
+        getMateTagGroupList()
22
+    })
23
+
24
+
25
+    const getMateTagGroupList = () => {
26
+        request({ url: '/taMateTagGroup', params: { pageSize: 1, pageSize: 9999 }}).then((res) => {
27
+            const { records, ...page } = res.data.data
28
+            setTagList(records)
29
+        })
30
+    }
31
+
32
+
33
+    const onSave = (e) => {
34
+        // console.log(labelList,imgUrl, 'onSave')
35
+        const data = labelList.map((x) => { return { tagId: x.tagId, imageId: imgUrl.imageId } })
36
+        // console.log(, 'onSave333')
37
+
38
+        request({ url: "/taMetaImageTag", data: data, method: 'post' }).then((res) => {
39
+            Taro.showModal({
40
+                title: '上传成功',
41
+                content: '点击确认按钮,返回上级菜单',
42
+                showCancel: false,
43
+                success: function (res) {
44
+                    if (res.confirm) {
45
+                        console.log('用户点击确定')
46
+                        setImgUrl({})
47
+                    } else if (res.cancel) {
48
+                        console.log('用户点击取消')
49
+                    }
50
+                }
51
+            })
52
+        })
53
+    }
54
+
55
+    const onFail = (e) => {
56
+        console.log(e, 'w')
57
+    }
58
+    const onImageClick = (e) => {
59
+        console.log(e, 'w')
60
+    }
61
+
62
+    const onLabelChange = (e, index) => {
63
+        console.log(e, index, 'onLabelChange')
64
+
65
+        arrList[index] = e
66
+        // const [arrList, setArrList] = useState([[],[],[]])
67
+        setLabelList(arrList.flat())
68
+
69
+        console.log(arrList.flat(), 'labelList')
70
+    }
71
+
72
+
73
+    const onUpImage = () => {
74
+        console.log('onUpImage')
75
+
76
+
77
+
78
+        Taro.chooseImage({
79
+            sourceType: ['album'],
80
+            success: (res) => {
81
+                const tempFilePaths = res.tempFilePaths
82
+                uploadFiles(tempFilePaths, '/api/mp/taMetaImage').then((res) => {
83
+                    console.log(res, 'uploadFiles')
84
+                    setImgUrl(res[0])
85
+                })
86
+            }
87
+        })
88
+    }
89
+
90
+    return <View className='batchimport'>
91
+        {pageState == 1 && <View>
92
+            <Text>标签</Text>
93
+            <View style={{ padding: '0 20px' }}>
94
+
95
+                <View className='at-row  at-row--wrap at-row__justify--center' style={{ marginTop: '0.15rem' }}>
96
+
97
+                    {
98
+                        labelList.map((item) => {
99
+                            return <View className='at-col at-col-4 ' >
100
+                                <View className='tags-btn' >{item.name}</View>
101
+                            </View>
102
+                        })
103
+
104
+                    }
105
+                    <View className='at-col at-col-4 ' >
106
+                        <View className='tags-btn tags-btn-on' onClick={() => setPageState('2')} >添加</View>
107
+                    </View>
108
+                </View>
109
+            </View>
110
+
111
+            <Text>照片</Text>
112
+            < View style={{ padding: '30px' }}>
113
+                {/* <AtImagePicker
114
+                    // multiple={true}
115
+                    length={4}
116
+                    files={imgList}
117
+                    onChange={onImgChange}
118
+                    onFail={onFail}
119
+                    onImageClick={onImageClick}
120
+                /> */}
121
+                <Image className='guide-view-img' style={{ width: imgUrl.image ? '100%' : '10%', height: '100%' }} onClick={() => onUpImage()} src={imgUrl.image || uploadicon}></Image>
122
+            </View>
123
+
124
+            {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
125
+            <Tab pageState='3' value={['取消', '上传']} onClick={[(e) => { setLabelList([]); setPageState('2') }, (e) => onSave(e)]}></Tab>
126
+        </View>
127
+        }
128
+        {pageState == 2 && <View>
129
+            <View style={{ padding: '0 20px' }}>
130
+
131
+                {
132
+                    tagList.map((item, index) => {
133
+                        return <View className='material-card'>
134
+                            <Text>{item.name}</Text>
135
+                            <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} style={{ marginTop: '90rpx' }}> </Tags>
136
+                        </View>
137
+                    })
138
+                }
139
+            </View>
140
+            {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
141
+            <Tab pageState='3' value={['取消', '选择']} onClick={[(e) => setPageState('1'), (e) => setPageState('1')]}></Tab>
142
+        </View>
143
+        }
144
+    </View >
145
+}
146
+
147
+export default batchimport

+ 37
- 0
src/pages/batchimport/index.scss View File

@@ -0,0 +1,37 @@
1
+// @import "~taro-ui/dist/style/components/image-picker.scss";
2
+// @import "~taro-ui/dist/style/components/icon.scss";
3
+
4
+.batchimport {
5
+  padding-top: 30rpx;
6
+
7
+
8
+  text-align: center;
9
+
10
+  &-card {
11
+    background-color: #fff;
12
+    text-align: center;
13
+    color: #fff;
14
+    margin-top: 30px;
15
+    padding: 0;
16
+
17
+    &-tags {
18
+      font-size: 28px;
19
+
20
+      .tag {
21
+       
22
+          background-color: #ffffff;
23
+          color: #acacac;
24
+          margin: 10px;
25
+          font-size: 22px;
26
+          height: 50px;
27
+          line-height: 50px;
28
+          border-radius: 25px;
29
+
30
+      padding: 0 30px;
31
+            background-color: #274291;
32
+            color: #ffffff;
33
+         
34
+      }
35
+    }
36
+  }
37
+}

+ 4
- 0
src/pages/imglist/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 219
- 0
src/pages/imglist/index.jsx View File

@@ -0,0 +1,219 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+// import { useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo } from '@tarojs/taro'
3
+import Taro, { useDidShow } from "@tarojs/taro";
4
+import { useSelector, } from 'react-redux'
5
+import { View, Text, Button, Image } from '@tarojs/components'
6
+import Layout from '../../layout/index'
7
+import Tab from '../../compents/tab/index'
8
+import Container from '../../compents/container/index'
9
+import locationicon from '../../assets/locationicon.png'
10
+import Tags from '../../compents/tags/index'
11
+import './index.scss'
12
+import { AtFloatLayout } from "taro-ui"
13
+import getQueryValue from '../../util/getQueryValue';
14
+import request, { uploadFiles } from '../../util/request';
15
+import groupby from 'lodash.groupby';
16
+
17
+// Page({
18
+//     data: {
19
+//         text: 'init data',
20
+//         array: [{ msg: '1' }, { msg: '2' }]
21
+//     }
22
+// })
23
+
24
+const index = (props) => {
25
+
26
+    const { query } = getQueryValue()
27
+
28
+    const [isOpened, setIsOpened] = useState(false)
29
+    const [labelState, setLabelState] = useState(false)
30
+    const [list, setList] = useState({})
31
+    const [labelList, setLabelList] = useState([])
32
+    const [data, setData] = useState({})
33
+    const [tagList, setTagList] = useState([])
34
+
35
+    let [arrList, setArrList] = useState([[]])
36
+    useDidShow(() => {
37
+        console.log(query)
38
+        getImageList()
39
+        getMateTagGroupList()
40
+    })
41
+
42
+
43
+    const getMateTagGroupList = () => {
44
+        request({ url: '/taMateTagGroup', params: { pageSize: 1, pageSize: 9999 }}).then((res) => {
45
+            const { records, ...page } = res.data.data
46
+            setTagList(records)
47
+        })
48
+    }
49
+
50
+    const getImageList = () => {
51
+        request({ url: '/taMetaImageTag', params: { tagIds: query } }).then((res) => {
52
+            const { records, ...page } = res.data.data
53
+            console.log(groupby(records, item => item.imageId))
54
+            // _.groupBy([6.1, 4.2, 6.3], Math.floor);
55
+            setList(groupby(records, item => item.imageId))
56
+
57
+        })
58
+
59
+    }
60
+    const updateImage = () => {
61
+        // console.log('onUpImage')
62
+
63
+        console.log(data, 'onUpImage')
64
+
65
+        Taro.chooseImage({
66
+            sourceType: ['album'],
67
+            success: (res) => {
68
+                const tempFilePaths = res.tempFilePaths
69
+                uploadFiles(tempFilePaths, '/api/mp/taMetaImage',).then((res) => {
70
+                    console.log(res, 'uploadFiles')
71
+                    const newInfo = {
72
+                        newImage: res[0].imageId,
73
+                        newTags: data.map((x) => x.tagId)
74
+                    }
75
+                    updatainfo(newInfo)
76
+
77
+
78
+                })
79
+            }
80
+        })
81
+
82
+
83
+        setIsOpened(false);
84
+    }
85
+
86
+    const ontagsClick = () => {
87
+        // console.log('onUpImage')
88
+
89
+     
90
+
91
+        const newInfo = {
92
+            newImage: data[0].imageId,
93
+            newTags: labelList.map((x) => x.tagId)
94
+        }
95
+        updatainfo(newInfo)
96
+        console.log(newInfo,labelList, 'onUpImage')
97
+        // setIsOpened(false);
98
+    }
99
+
100
+    
101
+
102
+    //     "newImage": "string",
103
+    //   "newTags": [
104
+    //     "string"
105
+    //   ],
106
+    //   "originImage": "string",
107
+    //   "originTags": [
108
+    //     "string"
109
+    //   ]
110
+
111
+    const updatainfo = (newInfo) => {
112
+        const oldinfo = {
113
+            originImage: data[0].imageId,
114
+            originTags: data.map((x) => x.tagId)
115
+        }
116
+        request({ url: "/taMetaImageTag", data: { ...oldinfo, ...newInfo }, method: "put" }).then(() => {
117
+            getImageList()
118
+            setLabelState(false)
119
+        })
120
+    }
121
+
122
+
123
+    const updateLabel = (e) => {
124
+
125
+        setIsOpened(false)
126
+        setLabelState(true)
127
+        // Taro.navigateTo({ url: "/pages/material/index?type=uplabel" })
128
+    }
129
+    const handleClose = (e) => {
130
+        console.log(e, '111')
131
+
132
+        setIsOpened(false)
133
+    }
134
+    const onSave = () => {
135
+        console.log(333)
136
+
137
+        Taro.showModal({
138
+            title: '修改成功',
139
+            content: '点击确认按钮,返回上级菜单',
140
+            showCancel: false,
141
+            success: function (res) {
142
+                if (res.confirm) {
143
+                    console.log('用户点击确定')
144
+
145
+                    Taro.navigateBack({
146
+                        delta: 1
147
+                    })
148
+                } else if (res.cancel) {
149
+                    console.log('用户点击取消')
150
+                }
151
+            }
152
+        })
153
+    }
154
+
155
+    const onLabelChange = (e, index) => {
156
+        console.log(e, index, 'onLabelChange')
157
+
158
+        arrList[index] = e
159
+        // const [arrList, setArrList] = useState([[],[],[]])
160
+        setLabelList(arrList.flat())
161
+
162
+        console.log(arrList.flat(), 'labelList')
163
+    }
164
+
165
+    return <View className='imglist'>
166
+
167
+
168
+
169
+
170
+        {!labelState&&<View style={{ padding: '0 30px' }}>
171
+            {
172
+
173
+                Object.keys(list).map((item) => {
174
+                    console.log(list[item], item, 'list[item]11')
175
+
176
+                    return <View className='imglist-card'>
177
+                        <View className='imglist-card-tags' style={{ display: 'flex' }}>
178
+                            {/* imageimageimageimage34 */}
179
+                            {list[item].map((x) => {
180
+                                return <View className='tag' s>{x.tagName}</View>
181
+                            })}
182
+                        </View>
183
+                        <Image src={list[item][0].image} style={{ width: '100%' }} onClick={() => { setData(list[item]); setIsOpened(true) }}></Image>
184
+                    </View>
185
+                })
186
+            }
187
+        </View>}
188
+
189
+        {labelState&&
190
+            <View style={{textAlign:'center'}}> 
191
+            <View style={{ padding: '0 20px' }}>
192
+
193
+                {
194
+                    tagList.map((item, index) => {
195
+                        return <View className='imglist-tagcard'>
196
+                            <Text>{item.name}</Text>
197
+                            <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} style={{ marginTop: '90rpx' }}> </Tags>
198
+                        </View>
199
+                    })
200
+                }
201
+            </View>
202
+            {/* <Tab value={['取消','']}  onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab> */}
203
+            <Tab pageState='3' value={['取消', '选择']} onClick={[(e) => setPageState('1'), (e) => ontagsClick()]}></Tab>
204
+        </View>
205
+        }
206
+
207
+        <AtFloatLayout isOpened={isOpened} onClose={() => handleClose()} style={{ zIndex: '1000' }}>
208
+            <View className='floatmodel' >
209
+                <View onClick={() => updateLabel()}>更改标签</View>
210
+                <View onClick={() => updateImage()}>更换图片</View>
211
+                <View onClick={() => { setIsOpened(false); setRadioHouseState(true) }}>删除</View>
212
+                <View style={{ color: '#d2d2d2' }} onClick={() => setIsOpened(false)}>取消</View>
213
+            </View>
214
+
215
+        </AtFloatLayout>
216
+    </View>
217
+}
218
+
219
+export default index

+ 85
- 0
src/pages/imglist/index.scss View File

@@ -0,0 +1,85 @@
1
+.imglist {
2
+  padding-top: 30rpx;
3
+
4
+  &-card {
5
+    background-color: #fff;
6
+    text-align: center;
7
+    color: #fff;
8
+    margin-top: 30px;
9
+    padding: 0;
10
+
11
+    &-tags {
12
+      font-size: 28px;
13
+
14
+      .tag {
15
+       
16
+          background-color: #ffffff;
17
+          color: #acacac;
18
+          margin: 10px;
19
+          font-size: 22px;
20
+          height: 50px;
21
+          line-height: 50px;
22
+          border-radius: 25px;
23
+
24
+      padding: 0 30px;
25
+            background-color: #274291;
26
+            color: #ffffff;
27
+         
28
+      }
29
+    }
30
+  }
31
+
32
+  
33
+  &-tagcard {
34
+    // background-color: #fff;
35
+    text-align: center;
36
+    // color: #fff;
37
+    margin-top: 30px;
38
+    padding: 0;
39
+
40
+    &-tags {
41
+      font-size: 28px;
42
+
43
+      .tag {
44
+       
45
+          background-color: #ffffff;
46
+          color: #acacac;
47
+          margin: 10px;
48
+          font-size: 22px;
49
+          height: 50px;
50
+          line-height: 50px;
51
+          border-radius: 25px;
52
+
53
+      padding: 0 30px;
54
+            background-color: #274291;
55
+            color: #ffffff;
56
+         
57
+      }
58
+    }
59
+  }
60
+}
61
+
62
+
63
+.floatmodel {
64
+  height: 500px;
65
+  display: flex;
66
+  flex-direction: column;
67
+  justify-content: space-around;
68
+  align-items: center;
69
+  font-size: 32px;
70
+}
71
+
72
+.at-float-layout__container {
73
+  min-height: 100px;
74
+  color: #274291;
75
+  font-weight: 600;
76
+  border-radius: 50px 50px 0 0;
77
+}
78
+
79
+.at-float-layout {
80
+  .layout-page {
81
+    padding: 0;
82
+  }
83
+
84
+}
85
+

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

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

+ 54
- 0
src/pages/index/index.jsx View File

@@ -0,0 +1,54 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import { View } from '@tarojs/components'
3
+
4
+import AdminUser from '../adminUser/index'
5
+
6
+import './index.scss'
7
+
8
+const index = (props) => {
9
+
10
+
11
+
12
+  const [userRole, setUserRole] = useState('1')
13
+  const [pageState, SetPageState] = useState('1')
14
+  const [list, setList] = useState([])
15
+  useEffect(() => {
16
+
17
+    
18
+    setList([
19
+      {
20
+        name: 'zhou',
21
+        phone: '177'
22
+      },
23
+      {
24
+        name: 'zhou',
25
+        phone: '177'
26
+      },
27
+      {
28
+        name: 'zhou',
29
+        phone: '177'
30
+      }
31
+    ])
32
+  }, [])
33
+
34
+
35
+  const onTabClick = (e) => {
36
+    console.log(e, '111')
37
+    setUserRole(e)
38
+  }
39
+
40
+  const onRegisterChange = (e) => {
41
+    console.log(e, '111')
42
+  }
43
+
44
+
45
+
46
+ 
47
+  return <View className='index'>
48
+{/* 432 */}
49
+      <AdminUser></AdminUser>  
50
+     
51
+  </View>
52
+}
53
+
54
+export default index

+ 0
- 0
src/pages/index/index.scss View File


+ 4
- 0
src/pages/label/edit/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 165
- 0
src/pages/label/edit/index.jsx View File

@@ -0,0 +1,165 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import { useSelector } from 'react-redux'
4
+import { View, Input, Text, Image, Form } from '@tarojs/components'
5
+import Layout from '../../../layout/index'
6
+import Tab from '../../../compents/tab/index'
7
+import Container from '../../../compents/container/index'
8
+import './index.scss'
9
+import getQueryValue from '../../../util/getQueryValue'
10
+import request from '../../../util/request';
11
+
12
+const index = (props) => {
13
+
14
+    const { id } = getQueryValue()
15
+
16
+    const [name, setName] = useState('')
17
+    const [data, setData] = useState({})
18
+    const [pageState, setPageState] = useState('1')
19
+    const [list, setList] = useState([])
20
+
21
+
22
+    useDidShow(() => {
23
+        if (id) {
24
+            getMateTagGroupDetail()
25
+        }
26
+
27
+    })
28
+    const getMateTagGroupDetail = () => {
29
+        request({ url: `/taMateTagGroup/${id}`, }).then((res) => {
30
+            setName(res.data.data.name)
31
+            setData(res.data.data)
32
+        })
33
+    }
34
+
35
+
36
+    const onSave = () => {
37
+        console.log(333)
38
+
39
+        if (id) {
40
+
41
+            Taro.showModal({
42
+                title: '确定修改该标签组吗?',
43
+                // content: row.name,
44
+                cancelColor: '#d2d2d2',
45
+                confirmColor: "#274191",
46
+                success: function (res) {
47
+                  if (res.confirm) {
48
+                    console.log('用户点击确定')
49
+          
50
+                    request({url: `/taMateTagGroup/${id}`, data: { ...data, name: name }, method: 'put' }).then((res) => {
51
+                        Taro.showModal({
52
+                            title: '修改成功',
53
+                            content: '点击确认按钮,返回上级菜单',
54
+                            showCancel: false,
55
+                            success: function (res) {
56
+                                if (res.confirm) {
57
+                                    console.log('用户点击确定')
58
+        
59
+                                    Taro.navigateBack({
60
+                                        delta: 1
61
+                                    })
62
+                                } else if (res.cancel) {
63
+                                    console.log('用户点击取消')
64
+                                }
65
+                            }
66
+                        })
67
+        
68
+                    })
69
+          
70
+                  } else if (res.cancel) {
71
+                    console.log('用户点击取消')
72
+                  }
73
+                }
74
+              })
75
+
76
+            
77
+        } else {
78
+            request({ url: '/taMateTagGroup', data: { name }, method: 'post' }).then((res) => {
79
+                Taro.navigateBack({
80
+                    delta: 1
81
+                })
82
+            })
83
+        }
84
+
85
+
86
+
87
+        // Taro.showModal({
88
+        //     title: '修改成功',
89
+        //     content: '点击确认按钮,返回上级菜单',
90
+        //     showCancel: false,
91
+        //     success: function (res) {
92
+        //         if (res.confirm) {
93
+        //             console.log('用户点击确定')
94
+
95
+        //             Taro.navigateBack({
96
+        //                 delta: 1
97
+        //             })
98
+        //         } else if (res.cancel) {
99
+        //             console.log('用户点击取消')
100
+        //         }
101
+        //     }
102
+        // })
103
+    }
104
+
105
+    const onChooseLocation = () => {
106
+        console.log(333)
107
+        wx.chooseLocation({
108
+            success: (res) => {
109
+                console.log(res)
110
+            }
111
+        })
112
+    }
113
+    function handNameChange(e) {
114
+
115
+        setName(e.detail.value)
116
+
117
+
118
+
119
+    }
120
+
121
+    return <View className='addnewhouse'>
122
+
123
+
124
+        {/* <Form onSubmit={this.formSubmit} onReset={this.formReset} >
125
+        <View className='example-body'>
126
+          <Switch name='switch' className='form-switch'></Switch>
127
+        </View>
128
+      </Form> */}
129
+
130
+        <Layout>
131
+            {/* <Form onSubmit={formSubmit} onReset={formReset}> */}
132
+            {/* <View className='inputstyle-view'>
133
+                    <Text className='title'>标签组编号</Text>
134
+                    <Container className='inputstyle-view-card ' >
135
+                        <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
136
+                    </Container>
137
+                </View> */}
138
+            <View className='inputstyle-view'>
139
+                <Text className='title'>标签组名称</Text>
140
+                <Container className='inputstyle-view-card ' >
141
+                    <Input placeholderClass='placeholderinput' value={name} onInput={handNameChange} className='input' type='text' placeholder='' />
142
+                </Container>
143
+            </View>
144
+            {/* <View className='inputstyle-view'>
145
+                    <Text className='title'>标签数量</Text>
146
+                    <Container className='inputstyle-view-card ' >
147
+                        <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
148
+                    </Container>
149
+                </View> */}
150
+
151
+            {/* </Form> */}
152
+
153
+        </Layout>
154
+        <Tab className='addhousetab' pageState='3' value={['取消', id ? '确认修改' : '确认添加']} onClick={[(e) => Taro.navigateBack({
155
+            delta: 1
156
+        }), () => onSave()]}></Tab>
157
+
158
+
159
+
160
+
161
+
162
+    </View>
163
+}
164
+
165
+export default index

+ 50
- 0
src/pages/label/edit/index.scss View File

@@ -0,0 +1,50 @@
1
+.map {
2
+  // padding:13.33px;
3
+  &-view {
4
+    margin: 50px 0 0;
5
+
6
+    &-card {
7
+      // height: 106px;
8
+      // line-height: 106px;
9
+      padding: 0 40px;
10
+      // color:#181818;
11
+      font-size: 24px;
12
+      // font-weight: 600;
13
+      margin-top: 26.67px;
14
+      border-radius: 30px;
15
+      border-radius: 20px;
16
+      .input{
17
+        font-size: 28px;
18
+        padding:30px 0;
19
+        line-height: 106px;
20
+        // color: red;
21
+      }
22
+      .placeholderinput{
23
+        // line-height: 106px;
24
+        color: #d2d2d2;
25
+        font-size: 28px;
26
+      }
27
+    }
28
+    &-icon {
29
+      margin-left: 40px;
30
+      // padding: 20px 30px;
31
+      // color:#181818;
32
+      width: 150px;
33
+      height: 106.67px;
34
+      // font-size: 36px;
35
+      // // font-weight: 600;
36
+      margin-top: 26.67px;
37
+      border-radius: 20px;
38
+      background-color: #274291;
39
+      padding: 0;
40
+      text-align: center;
41
+      line-height:120.67px;
42
+      .icon {
43
+        
44
+        // width: 100%;
45
+      }
46
+    }
47
+    // style={{width:'48.4rpx',height:'48.4rpx'}}
48
+  }
49
+
50
+}

+ 4
- 0
src/pages/label/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 95
- 0
src/pages/label/index.jsx View File

@@ -0,0 +1,95 @@
1
+import React, { useEffect, useMemo, useState, useRef } from 'react'
2
+import Taro, { useDidShow } from '@tarojs/taro'
3
+import './index.scss'
4
+import { View, Text, Input, Image } from '@tarojs/components'
5
+import ContainerLayout from '../../compents/container/index'
6
+import Tab from '../../compents/tab/index'
7
+import Layout from '../../layout/index'
8
+import request from '../../util/request'
9
+
10
+const house = (props) => {
11
+
12
+  const [list, setList] = useState([])
13
+  const [radioHouse, setRadioHouse] = useState()
14
+
15
+  const ref = useRef();
16
+
17
+
18
+  useDidShow(() => {
19
+    getMateTagGroupList()
20
+  })
21
+
22
+
23
+  const getMateTagGroupList = () => {
24
+    request({ url: '/taMateTagGroup' }).then((res) => {
25
+      const { records, ...page} = res.data.data
26
+      setList(records)
27
+    })
28
+  }
29
+
30
+
31
+  const onDelete = (row) => {
32
+    Taro.showModal({
33
+      title: '确定删除该标签组吗?',
34
+      content: row.name,
35
+      cancelColor: '#d2d2d2',
36
+      confirmColor: "#274191",
37
+      success: function (res) {
38
+        if (res.confirm) {
39
+          console.log('用户点击确定')
40
+
41
+          request({ url: `/taMateTagGroup/${row.groupId}`, method: 'delete', }).then((res)=>{
42
+            getMateTagGroupList({ pageNum: 1, pageSize:10 })
43
+          })
44
+          // Taro.showModal({
45
+          //   title: `改标签组有${row.user.number}个标签仍在使用。请先清空标签,再删除标签组`,
46
+          //   showCancel: false,
47
+          //   // cancelColor:'#d2d2d2',
48
+          //   confirmColor: "#274191",
49
+          //   success: function (res) {
50
+          //     if (res.confirm) {
51
+          //       console.log('用户点击确定')
52
+
53
+
54
+          //     } else if (res.cancel) {
55
+          //       console.log('用户点击取消')
56
+          //     }
57
+          //   }
58
+          // })
59
+
60
+        } else if (res.cancel) {
61
+          console.log('用户点击取消')
62
+        }
63
+      }
64
+    })
65
+  }
66
+
67
+
68
+
69
+
70
+  return <View className='account'>
71
+    <Layout>
72
+      {list.map((x, index) => {
73
+        return <View className='account-view'>
74
+          {/* <Text className='account-view-title'>标签组编号:{index + 1}</Text> */}
75
+          <ContainerLayout className='account-view-card'>
76
+            <View className='top' onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/index?id=${x.groupId}` }) }}>
77
+              <View>标签组名称:{x.name}</View>
78
+
79
+            </View>
80
+            <View className='bottom'>
81
+              <Text onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index?id=${x.groupId}` }) }}>编辑</Text>
82
+              <Text onClick={() => onDelete(x)}>删除</Text>
83
+            </View>
84
+          </ContainerLayout>
85
+
86
+        </View>
87
+
88
+      })}
89
+    </Layout>
90
+    {/* onClick={(e)=>(e) */}
91
+    <Tab value={['+新增标签组']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/label/edit/index` }) }} ></Tab>
92
+  </View>
93
+}
94
+
95
+export default house

+ 54
- 0
src/pages/label/index.scss View File

@@ -0,0 +1,54 @@
1
+.account {
2
+
3
+  // padding: 13.33px 0;
4
+  &-view {
5
+    margin: 40px 0 0;
6
+
7
+    // padding: 0;
8
+    &-title {
9
+      color: #7b7b7b;
10
+      font-size: 30px;
11
+      font-weight: 500;
12
+      margin-left: 40px;
13
+
14
+    }
15
+
16
+    &-card {
17
+      padding: 0;
18
+      color: #181818;
19
+      font-size: 24px;
20
+      font-weight: 600;
21
+      margin-top: 26.67px;
22
+      position: relative;
23
+
24
+      &-radio {
25
+          width: 50px;
26
+          height: 50px;
27
+        background-color: #274291;
28
+        text-align: center;
29
+        line-height: 50px;
30
+        position: absolute;
31
+        border-radius: 25px;
32
+        top: -12.5px;
33
+        right: -12.5px;
34
+      }
35
+
36
+      .top {
37
+        padding: 40px 40px;
38
+        border-bottom: 1px solid #f4f4f4;
39
+        line-height: 32px;
40
+        font-weight: 500;
41
+        // font-size: ;
42
+        // min-height: 120px;
43
+      }
44
+
45
+      .bottom {
46
+        display: flex;
47
+        justify-content: space-around;
48
+        padding: 20px
49
+      }
50
+
51
+
52
+    }
53
+  }
54
+}

+ 4
- 0
src/pages/mateTag/edit/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 140
- 0
src/pages/mateTag/edit/index.jsx View File

@@ -0,0 +1,140 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import Taro, { useDidShow } from "@tarojs/taro";
3
+import { useSelector } from 'react-redux'
4
+import { View, Input, Text, Image, Form } from '@tarojs/components'
5
+import Layout from '../../../layout/index'
6
+import Tab from '../../../compents/tab/index'
7
+import Container from '../../../compents/container/index'
8
+import './index.scss'
9
+import getQueryValue from '../../../util/getQueryValue'
10
+import request from '../../../util/request';
11
+
12
+const index = (props) => {
13
+
14
+    const { id,tagId } = getQueryValue()
15
+
16
+    const [name, setName] = useState('')
17
+    const [data, setData] = useState({})
18
+    const [pageState, setPageState] = useState('1')
19
+    const [list, setList] = useState([])
20
+
21
+
22
+    useDidShow(() => {
23
+        if (tagId) {
24
+            getMateTagGroupDetail()
25
+        }
26
+
27
+    })
28
+    const getMateTagGroupDetail = () => {
29
+        request({ url: `/taMateTag/${tagId}` }).then((res) => {
30
+            setName(res.data.data.name)
31
+            setData(res.data.data)
32
+        })
33
+    }
34
+
35
+
36
+    const onSave = () => {
37
+        console.log(333)
38
+
39
+        if (tagId) {
40
+
41
+            Taro.showModal({
42
+                title: '确定修改该标签吗?',
43
+                // content: row.name,
44
+                cancelColor: '#d2d2d2',
45
+                confirmColor: "#274191",
46
+                success: function (res) {
47
+                  if (res.confirm) {
48
+                    console.log('用户点击确定')
49
+          
50
+                    request({url: `/taMateTag/${tagId}`, data: { ...data, name: name }, method: 'put' }).then((res) => {
51
+                        Taro.showModal({
52
+                            title: '修改成功',
53
+                            content: '点击确认按钮,返回上级菜单',
54
+                            showCancel: false,
55
+                            success: function (res) {
56
+                                if (res.confirm) {
57
+                                    console.log('用户点击确定')
58
+        
59
+                                    Taro.navigateBack({
60
+                                        delta: 1
61
+                                    })
62
+                                } else if (res.cancel) {
63
+                                    console.log('用户点击取消')
64
+                                }
65
+                            }
66
+                        })
67
+        
68
+                    })
69
+          
70
+                  } else if (res.cancel) {
71
+                    console.log('用户点击取消')
72
+                  }
73
+                }
74
+              })
75
+
76
+            
77
+        } else {
78
+            request({ url: '/taMateTag', data: { name:name,groupId: id}, method: 'post' }).then((res) => {
79
+                Taro.navigateBack({
80
+                    delta: 1
81
+                })
82
+            })
83
+        }
84
+
85
+
86
+
87
+        // Taro.showModal({
88
+        //     title: '修改成功',
89
+        //     content: '点击确认按钮,返回上级菜单',
90
+        //     showCancel: false,
91
+        //     success: function (res) {
92
+        //         if (res.confirm) {
93
+        //             console.log('用户点击确定')
94
+
95
+        //             Taro.navigateBack({
96
+        //                 delta: 1
97
+        //             })
98
+        //         } else if (res.cancel) {
99
+        //             console.log('用户点击取消')
100
+        //         }
101
+        //     }
102
+        // })
103
+    }
104
+
105
+    function handNameChange(e) {
106
+
107
+        setName(e.detail.value)
108
+
109
+
110
+
111
+    }
112
+
113
+    return <View className='addnewhouse'>
114
+
115
+
116
+        {/* <Form onSubmit={this.formSubmit} onReset={this.formReset} >
117
+        <View className='example-body'>
118
+          <Switch name='switch' className='form-switch'></Switch>
119
+        </View>
120
+      </Form> */}
121
+
122
+        <Layout>
123
+   
124
+            <View className='inputstyle-view'>
125
+                <Text className='title'>标签名称</Text>
126
+                <Container className='inputstyle-view-card ' >
127
+                    <Input placeholderClass='placeholderinput' value={name} onInput={handNameChange} className='input' type='text' placeholder='' />
128
+                </Container>
129
+            </View>
130
+   
131
+        </Layout>
132
+        <Tab className='addhousetab' pageState='3' value={['取消', tagId ? '确认修改' : '确认添加']} onClick={[(e) => Taro.navigateBack({
133
+            delta: 1
134
+        }), () => onSave()]}></Tab>
135
+
136
+
137
+    </View>
138
+}
139
+
140
+export default index

+ 50
- 0
src/pages/mateTag/edit/index.scss View File

@@ -0,0 +1,50 @@
1
+.map {
2
+  // padding:13.33px;
3
+  &-view {
4
+    margin: 50px 0 0;
5
+
6
+    &-card {
7
+      // height: 106px;
8
+      // line-height: 106px;
9
+      padding: 0 40px;
10
+      // color:#181818;
11
+      font-size: 24px;
12
+      // font-weight: 600;
13
+      margin-top: 26.67px;
14
+      border-radius: 30px;
15
+      border-radius: 20px;
16
+      .input{
17
+        font-size: 28px;
18
+        padding:30px 0;
19
+        line-height: 106px;
20
+        // color: red;
21
+      }
22
+      .placeholderinput{
23
+        // line-height: 106px;
24
+        color: #d2d2d2;
25
+        font-size: 28px;
26
+      }
27
+    }
28
+    &-icon {
29
+      margin-left: 40px;
30
+      // padding: 20px 30px;
31
+      // color:#181818;
32
+      width: 150px;
33
+      height: 106.67px;
34
+      // font-size: 36px;
35
+      // // font-weight: 600;
36
+      margin-top: 26.67px;
37
+      border-radius: 20px;
38
+      background-color: #274291;
39
+      padding: 0;
40
+      text-align: center;
41
+      line-height:120.67px;
42
+      .icon {
43
+        
44
+        // width: 100%;
45
+      }
46
+    }
47
+    // style={{width:'48.4rpx',height:'48.4rpx'}}
48
+  }
49
+
50
+}

+ 4
- 0
src/pages/mateTag/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 99
- 0
src/pages/mateTag/index.jsx View File

@@ -0,0 +1,99 @@
1
+import React, { useEffect, useMemo, useState, useRef } from 'react'
2
+import Taro, { useDidShow } from '@tarojs/taro'
3
+import './index.scss'
4
+import { View, Text, Input, Image } from '@tarojs/components'
5
+import ContainerLayout from '../../compents/container/index'
6
+import Tab from '../../compents/tab/index'
7
+import Layout from '../../layout/index'
8
+import request from '../../util/request'
9
+import getQueryValue from '../../util/getQueryValue'
10
+
11
+const house = (props) => {
12
+
13
+  const {id} = getQueryValue()
14
+
15
+  const [list, setList] = useState([])
16
+
17
+
18
+  useDidShow(() => {
19
+    getMateTagList()
20
+  })
21
+
22
+  // request({ url: '/taShopKeeper',params:{shopId:id}, method: 'get', }).then((res)=>{
23
+  //   const { records, ...page} = res.data.data
24
+  //   setList(records)
25
+  // })
26
+  const getMateTagList = () => {
27
+    console.log(id,'getMateTagList')
28
+    request({ url: '/api/mp/taMateTag',params:{groupId:id},method: 'get', }).then((res) => {
29
+      const { records, ...page} = res.data.data
30
+      setList(records)
31
+    })
32
+  }
33
+
34
+
35
+  const onDelete = (row) => {
36
+    Taro.showModal({
37
+      title: '确定删除该标签组吗?',
38
+      content: row.name,
39
+      cancelColor: '#d2d2d2',
40
+      confirmColor: "#274191",
41
+      success: function (res) {
42
+        if (res.confirm) {
43
+          console.log('用户点击确定')
44
+
45
+          request({ url: `/taMateTag/${row.tagId}`, method: 'delete', }).then((res)=>{
46
+            getMateTagList({ pageNum: 1, pageSize:10 })
47
+          })
48
+          // Taro.showModal({
49
+          //   title: `改标签组有${row.user.number}个标签仍在使用。请先清空标签,再删除标签组`,
50
+          //   showCancel: false,
51
+          //   // cancelColor:'#d2d2d2',
52
+          //   confirmColor: "#274191",
53
+          //   success: function (res) {
54
+          //     if (res.confirm) {
55
+          //       console.log('用户点击确定')
56
+
57
+
58
+          //     } else if (res.cancel) {
59
+          //       console.log('用户点击取消')
60
+          //     }
61
+          //   }
62
+          // })
63
+
64
+        } else if (res.cancel) {
65
+          console.log('用户点击取消')
66
+        }
67
+      }
68
+    })
69
+  }
70
+
71
+
72
+
73
+
74
+  return <View className='account'>
75
+    <Layout>
76
+      {list.map((x, index) => {
77
+        return <View className='account-view'>
78
+  
79
+          <ContainerLayout className='account-view-card'>
80
+            <View className='top' >
81
+              <View>标签名称:{x.name}</View>
82
+
83
+            </View>
84
+            <View className='bottom'>
85
+              <Text onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/edit/index?tagId=${x.tagId}` }) }}>编辑</Text>
86
+              <Text onClick={() => onDelete(x)}>删除</Text>
87
+            </View>
88
+          </ContainerLayout>
89
+
90
+        </View>
91
+
92
+      })}
93
+    </Layout>
94
+    {/* onClick={(e)=>(e) */}
95
+    <Tab value={['+新增标签']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/mateTag/edit/index?id=${id}` }) }} ></Tab>
96
+  </View>
97
+}
98
+
99
+export default house

+ 54
- 0
src/pages/mateTag/index.scss View File

@@ -0,0 +1,54 @@
1
+.account {
2
+
3
+  // padding: 13.33px 0;
4
+  &-view {
5
+    margin: 40px 0 0;
6
+
7
+    // padding: 0;
8
+    &-title {
9
+      color: #7b7b7b;
10
+      font-size: 30px;
11
+      font-weight: 500;
12
+      margin-left: 40px;
13
+
14
+    }
15
+
16
+    &-card {
17
+      padding: 0;
18
+      color: #181818;
19
+      font-size: 24px;
20
+      font-weight: 600;
21
+      margin-top: 26.67px;
22
+      position: relative;
23
+
24
+      &-radio {
25
+          width: 50px;
26
+          height: 50px;
27
+        background-color: #274291;
28
+        text-align: center;
29
+        line-height: 50px;
30
+        position: absolute;
31
+        border-radius: 25px;
32
+        top: -12.5px;
33
+        right: -12.5px;
34
+      }
35
+
36
+      .top {
37
+        padding: 40px 40px;
38
+        border-bottom: 1px solid #f4f4f4;
39
+        line-height: 32px;
40
+        font-weight: 500;
41
+        // font-size: ;
42
+        // min-height: 120px;
43
+      }
44
+
45
+      .bottom {
46
+        display: flex;
47
+        justify-content: space-around;
48
+        padding: 20px
49
+      }
50
+
51
+
52
+    }
53
+  }
54
+}

+ 0
- 0
src/pages/material/importimg/index.jsx View File


+ 4
- 0
src/pages/material/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 127
- 0
src/pages/material/index.jsx View File

@@ -0,0 +1,127 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+// import { useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo } from '@tarojs/taro'
3
+import Taro, { useDidShow, useShareAppMessage } from "@tarojs/taro";
4
+import { useSelector, } from 'react-redux'
5
+import { View, Input, Text, Image } from '@tarojs/components'
6
+import Layout from '../../layout/index'
7
+import Tab from '../../compents/tab/index'
8
+import Container from '../../compents/container/index'
9
+import locationicon from '../../assets/locationicon.png'
10
+import Tags from '../../compents/tags/index'
11
+import request from '../../util/request'
12
+import './index.scss'
13
+
14
+// Page({
15
+//     data: {
16
+//         text: 'init data',
17
+//         array: [{ msg: '1' }, { msg: '2' }]
18
+//     }
19
+// })
20
+
21
+const index = (props) => {
22
+
23
+
24
+
25
+    let [arrList, setArrList] = useState([[]])
26
+    const [labelList, setLabelList] = useState([])
27
+    const [list, setList] = useState([])
28
+    useEffect(() => {
29
+
30
+        // console.log(page, 'page')
31
+
32
+    }, [])
33
+
34
+    useDidShow(() => {
35
+        getMateTagGroupList()
36
+    })
37
+
38
+
39
+    const getMateTagGroupList = () => {
40
+        request({ url: '/taMateTagGroup', params: { pageSize: 1, pageSize: 9999 } }).then((res) => {
41
+            const { records, ...page } = res.data.data
42
+            setList(records)
43
+        })
44
+    }
45
+    const onTabClick = (e) => {
46
+        console.log(e, '111')
47
+        setUserRole(e)
48
+    }
49
+
50
+    const onLabelChange = (e, index) => {
51
+        console.log(e, index, 'onLabelChange')
52
+
53
+        arrList[index] = e
54
+        // const [arrList, setArrList] = useState([[],[],[]])
55
+        setLabelList(arrList.flat())
56
+
57
+        console.log(arrList.flat(), 'labelList')
58
+    }
59
+
60
+
61
+    const onClick = () => {
62
+        
63
+
64
+        const query = labelList.map(x=>x.tagId).join(',')
65
+        console.log(query, '', 'eeee')
66
+        Taro.navigateTo({
67
+            url: `/pages/imglist/index?query=${query}`
68
+        })
69
+        // Taro.showModal({
70
+        //     title: '修改成功',
71
+        //     content: '点击确认按钮,返回上级菜单',
72
+        //     showCancel: false,
73
+        //     success: function (res) {
74
+        //         if (res.confirm) {
75
+        //             console.log('用户点击确定')
76
+
77
+        //             Taro.navigateBack({
78
+        //                 delta: 1
79
+        //             })
80
+        //         } else if (res.cancel) {
81
+        //             console.log('用户点击取消')
82
+        //         }
83
+        //     }
84
+        // })
85
+    }
86
+
87
+    return <View className='material'>
88
+
89
+
90
+
91
+
92
+        <Layout>
93
+            {
94
+                list.map((item,index) => {
95
+                    return <View className='material-card'>
96
+                        <Text>{item.name}</Text>
97
+                        <Tags list={item.taMateTagList} onChange={(e) => onLabelChange(e, index)} > </Tags>
98
+                    </View>
99
+                })
100
+            }
101
+
102
+            {/* <View className='inputstyle-view'>
103
+                <Text className='title'>入住人数</Text>
104
+                <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
105
+                    <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
106
+                </Container>
107
+            </View>
108
+            <View className='inputstyle-view'>
109
+                <Text className='title'>入住日期</Text>
110
+                <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
111
+                    <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
112
+                </Container>
113
+            </View>
114
+
115
+            <View className='inputstyle-view'>
116
+                <Text className='title'>离店日期</Text>
117
+                <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
118
+                    <Input placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
119
+                </Container>
120
+            </View> */}
121
+        </Layout>
122
+        {/* className='addhousetab' */}
123
+        <Tab pageState='3' value={['取消', '开始查询']} onClick={[(e) => setPageState('2'), (e) => onClick(e)]}></Tab>
124
+    </View>
125
+}
126
+
127
+export default index

+ 58
- 0
src/pages/material/index.scss View File

@@ -0,0 +1,58 @@
1
+.material {
2
+  padding-top: 30rpx;
3
+  &-card {
4
+    text-align: center;
5
+color: #7b7b7b;
6
+margin-top: 30px;
7
+
8
+  }
9
+
10
+  // // padding:13.33px;
11
+  // &-view {
12
+  //   margin: 50px 0 0;
13
+
14
+  //   &-card {
15
+  //     // height: 106px;
16
+  //     // line-height: 106px;
17
+  //     padding: 0 40px;
18
+  //     // color:#181818;
19
+  //     font-size: 24px;
20
+  //     // font-weight: 600;
21
+  //     margin-top: 26.67px;
22
+  //     border-radius: 30px;
23
+  //     border-radius: 20px;
24
+  //     .input{
25
+  //       font-size: 28px;
26
+  //       padding:30px 0;
27
+  //       line-height: 106px;
28
+  //       // color: red;
29
+  //     }
30
+  //     .placeholderinput{
31
+  //       // line-height: 106px;
32
+  //       color: #d2d2d2;
33
+  //       font-size: 28px;
34
+  //     }
35
+  //   }
36
+  //   &-icon {
37
+  //     margin-left: 40px;
38
+  //     // padding: 20px 30px;
39
+  //     // color:#181818;
40
+  //     width: 150px;
41
+  //     height: 106.67px;
42
+  //     // font-size: 36px;
43
+  //     // // font-weight: 600;
44
+  //     margin-top: 26.67px;
45
+  //     border-radius: 20px;
46
+  //     background-color: #274291;
47
+  //     padding: 0;
48
+  //     text-align: center;
49
+  //     line-height:120.67px;
50
+  //     .icon {
51
+
52
+  //       // width: 100%;
53
+  //     }
54
+  //   }
55
+  //   // style={{width:'48.4rpx',height:'48.4rpx'}}
56
+  // }
57
+
58
+}

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

@@ -0,0 +1,3 @@
1
+export default {
2
+ 
3
+}

+ 153
- 0
src/pages/shop/edit/index.jsx View File

@@ -0,0 +1,153 @@
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import Taro from "@tarojs/taro";
3
+import { View, Input, Text, Image, Form, Button } from '@tarojs/components'
4
+import Layout from '../../../layout/index'
5
+import Tab from '../../../compents/tab/index'
6
+import Container from '../../../compents/container/index'
7
+import locationicon from '../../../assets/locationicon.png'
8
+import uploadicon from '../../../assets/uploadicon.png'
9
+import './index.scss'
10
+import request, { uploadFiles } from '../../../util/request'
11
+const index = (props) => {
12
+
13
+
14
+    const [userRole, setUserRole] = useState('1')
15
+
16
+    const [name, setName] = useState('')
17
+    const [imgUrl, setImgUrl] = useState('')
18
+    useEffect(() => {
19
+
20
+
21
+    }, [])
22
+
23
+
24
+    const onTabClick = (e) => {
25
+        console.log(e, '111')
26
+        setUserRole(e)
27
+    }
28
+
29
+    const onRegisterChange = (e) => {
30
+        console.log(e, '111')
31
+    }
32
+    const onSave = () => {
33
+        console.log(333)
34
+
35
+        // Taro.showModal({
36
+        //     title: '修改成功',
37
+        //     content: '点击确认按钮,返回上级菜单',
38
+        //     showCancel: false,
39
+        //     success: function (res) {
40
+        //         if (res.confirm) {
41
+        //             console.log('用户点击确定')
42
+
43
+        //             Taro.navigateBack({
44
+        //                 delta: 1
45
+        //             })
46
+        //         } else if (res.cancel) {
47
+        //             console.log('用户点击取消')
48
+        //         }
49
+        //     }
50
+        // })
51
+    }
52
+    // /api/taShopKeeper
53
+    const editShopKeeper = () => {
54
+
55
+
56
+        if (!name) {
57
+
58
+            Taro.showToast({
59
+                title: '请输入名称',
60
+                icon: 'none',
61
+                duration: 2000
62
+              })
63
+            return
64
+        }
65
+        if (!imgUrl) {
66
+            Taro.showToast({
67
+                title: '请上传图片',
68
+                icon: 'none',
69
+                duration: 2000
70
+              })
71
+            return
72
+        }
73
+        request({ url: "/taShop", data: { name: name, logo: imgUrl }, method: 'post' }).then((res) => {
74
+            Taro.showModal({
75
+                title: '新增成功',
76
+                content: '点击确认按钮,返回上级菜单',
77
+                showCancel: false,
78
+                success: function (res) {
79
+                    if (res.confirm) {
80
+                        console.log('用户点击确定')
81
+
82
+                        Taro.navigateBack({
83
+                            delta: 1
84
+                        })
85
+                    } else if (res.cancel) {
86
+                        console.log('用户点击取消')
87
+                    }
88
+                }
89
+            })
90
+        })
91
+
92
+    }
93
+    function handNameChange(e) {
94
+        console.log(e.detail, 'handNameChange')
95
+        setName(e.detail.value)
96
+        // editShopKeeper(e.detail.value)
97
+
98
+
99
+    }
100
+
101
+    const onUpImage = () => {
102
+        console.log('onUpImage')
103
+
104
+
105
+
106
+        Taro.chooseImage({
107
+            sourceType: ['album'],
108
+            success: (res) => {
109
+                const tempFilePaths = res.tempFilePaths
110
+                uploadFiles(tempFilePaths).then((res) => {
111
+                    console.log(res, 'uploadFiles')
112
+                    setImgUrl(res[0])
113
+                })
114
+            }
115
+        })
116
+    }
117
+
118
+    return <View className='addnewhouse'>
119
+
120
+        <Layout>
121
+
122
+            <View className='inputstyle-view'>
123
+                <Text className='title'>店铺名称</Text>
124
+                <Container className='inputstyle-view-card '  >
125
+                    <Input name='keeperId' value={name} placeholderClass='placeholderinput' onInput={handNameChange} placeholder='' className='input' />
126
+                </Container>
127
+            </View>
128
+
129
+
130
+            <View className='inputstyle-view'>
131
+                <Text className='title'>logo</Text>
132
+                <Container className='inputstyle-view-card ' style={{ padding: '0.6rem', width: '2rem', height: '2rem' }} >
133
+                    <Image className='guide-view-img' style={{ width: '100%', height: '100%' }} onClick={() => onUpImage()} src={imgUrl || uploadicon}></Image>
134
+                </Container>
135
+            </View>
136
+
137
+        </Layout>
138
+        {/* <Input formType="submit" > */}
139
+        <Tab className='addhousetab' pageState='3' value={['取消', '确认添加']} onClick={[(e) => {
140
+            Taro.navigateBack({
141
+                delta: 1
142
+            })
143
+        }, () => editShopKeeper()]}></Tab>
144
+
145
+        {/* </Input> */}
146
+
147
+
148
+
149
+
150
+    </View>
151
+}
152
+
153
+export default index

+ 50
- 0
src/pages/shop/edit/index.scss View File

@@ -0,0 +1,50 @@
1
+.map {
2
+  // padding:13.33px;
3
+  &-view {
4
+    margin: 50px 0 0;
5
+
6
+    &-card {
7
+      // height: 106px;
8
+      // line-height: 106px;
9
+      padding: 0 40px;
10
+      // color:#181818;
11
+      font-size: 24px;
12
+      // font-weight: 600;
13
+      margin-top: 26.67px;
14
+      border-radius: 30px;
15
+      border-radius: 20px;
16
+      .input{
17
+        font-size: 28px;
18
+        padding:30px 0;
19
+        line-height: 106px;
20
+        // color: red;
21
+      }
22
+      .placeholderinput{
23
+        // line-height: 106px;
24
+        color: #d2d2d2;
25
+        font-size: 28px;
26
+      }
27
+    }
28
+    &-icon {
29
+      margin-left: 40px;
30
+      // padding: 20px 30px;
31
+      // color:#181818;
32
+      width: 150px;
33
+      height: 106.67px;
34
+      // font-size: 36px;
35
+      // // font-weight: 600;
36
+      margin-top: 26.67px;
37
+      border-radius: 20px;
38
+      background-color: #274291;
39
+      padding: 0;
40
+      text-align: center;
41
+      line-height:120.67px;
42
+      .icon {
43
+        
44
+        // width: 100%;
45
+      }
46
+    }
47
+    // style={{width:'48.4rpx',height:'48.4rpx'}}
48
+  }
49
+
50
+}

+ 4
- 0
src/pages/shop/index.config.js View File

@@ -0,0 +1,4 @@
1
+export default {
2
+
3
+  
4
+}

+ 150
- 0
src/pages/shop/index.jsx View File

@@ -0,0 +1,150 @@
1
+import React, { useEffect, useMemo, useState, useRef } from 'react'
2
+import Taro, { useDidShow } from '@tarojs/taro'
3
+import './index.scss'
4
+import { View, Text, Input, Image } from '@tarojs/components'
5
+import VirtualList from '@tarojs/components/virtual-list'
6
+import ContainerLayout from '../../compents/container/index'
7
+import Tab from '../../compents/tab/index'
8
+import Layout from '../../layout/index'
9
+import request from '../../util/request'
10
+
11
+
12
+// const Row = React.memo(({ id, index, style, data }) => {
13
+//   console.log({ id, index, style, data },'444')
14
+//   return (
15
+//     <View className='account-view' id={index}>
16
+//       {/* <Text className='account-view-title'>店铺编号:{index}</Text> */}
17
+//       <ContainerLayout className='account-view-card'>
18
+//         <View className='top' >
19
+//           <View>店铺名称:{data[index]?.name||''}</View>
20
+//           {/* <View>电话:{x.user.name}</View>
21
+//         <View>微信号:{x.user.name}</View>
22
+//         <View>房源数:{x.user.name}</View> */}
23
+//         </View>
24
+//         <View className='bottom'>
25
+//           <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?=${data.shopId}` }) }}>编辑</Text>
26
+//           <Text >删除</Text>
27
+//         </View>
28
+//       </ContainerLayout>
29
+
30
+//     </View>
31
+//   );
32
+// })
33
+
34
+const account = (props) => {
35
+
36
+  const [list, setList] = useState([])
37
+  const [page, setPage] = useState({ total: 0, pageNum: 0 })
38
+  const [radioHouse, setRadioHouse] = useState()
39
+  const [loading, setLoading] = useState(false)
40
+
41
+  const radioHouseState = useMemo(() => props.radioHouseState, [props.radioHouseState])
42
+
43
+  console.log(props, radioHouseState)
44
+  useEffect(() => {
45
+
46
+
47
+  }, [])
48
+
49
+  useDidShow(() => {
50
+    getShopList({ pageNum: 1, pageSize:10 })
51
+  })
52
+
53
+  function getShopList(params) {
54
+    setLoading(true)
55
+    request({ url: "/taShop",params,  method: 'get' })
56
+      .then((res) => {
57
+        const { records, ...page} = res.data.data
58
+
59
+        setLoading(false)
60
+        setPage({
61
+          ...page,
62
+          pageNum: page.current
63
+        })
64
+
65
+        setList(list.concat(records || []))
66
+
67
+      }).catch(() => setLoading(false))
68
+  }
69
+
70
+  const onDelete = (shopId) => {
71
+    Taro.showModal({
72
+      title: '确定删除该店铺吗',
73
+      // content: '确定后,该老板房源信息将一并删除',
74
+      cancelColor: '#d2d2d2',
75
+      confirmColor: "#274191",
76
+      success: function (res) {
77
+        if (res.confirm) {
78
+         
79
+          request({ url: `/taShop/${shopId}`,  method: 'delete' })
80
+          .then((res) => {
81
+          })
82
+
83
+
84
+        } else if (res.cancel) {
85
+          console.log('用户点击取消')
86
+        }
87
+      }
88
+    })
89
+  }
90
+
91
+  // const listReachBottom = () => {
92
+  //   getShopList({ pageNum: page.pageNum + 1 })
93
+  // }
94
+  
95
+
96
+  return <View className='account'>
97
+    <Layout>
98
+      {/* <VirtualList
99
+        className='List'
100
+        height={500}
101
+        itemData={list}
102
+        itemCount={list.length}
103
+        itemSize={100}
104
+        width='100%'
105
+        onScroll={({ scrollDirection, scrollOffset }) => {
106
+          console.log(scrollDirection, scrollOffset, 'onScroll')
107
+          if (
108
+          
109
+            !loading &&
110
+          
111
+            scrollDirection === 'forward' &&
112
+          
113
+            scrollOffset > ((list.length - 6) * 100 + 50)
114
+          ) {
115
+            console.log('listReachBottom')
116
+            listReachBottom()
117
+          }
118
+        }}
119
+      >
120
+        {Row}
121
+      </VirtualList> */}
122
+
123
+      {
124
+        list.map((item)=>{
125
+        return  <View className='account-view' >
126
+          {/* <Text className='account-view-title'>店铺编号:{index}</Text> */}
127
+          <ContainerLayout className='account-view-card'>
128
+            <View className='top' >
129
+              <View>店铺名称:{item.name||''}</View>
130
+              {/* <View>电话:{x.user.name}</View>
131
+            <View>微信号:{x.user.name}</View>
132
+            <View>房源数:{x.user.name}</View> */}
133
+            </View>
134
+            <View className='bottom'>
135
+              <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/index?id=${item.shopId}` }) }}>详情</Text>
136
+              <Text onClick={()=>onDelete(item.shopId)}>删除</Text>
137
+            </View>
138
+          </ContainerLayout>
139
+    
140
+        </View>
141
+        })
142
+      }
143
+
144
+    </Layout>
145
+    {/* onClick={(e)=>(e) */}
146
+    <Tab value={['+新增店铺']} color='#ffffff' onClick={() => { Taro.navigateTo({ url: `/pages/shop/edit/index` }) }} ></Tab>
147
+  </View>
148
+}
149
+
150
+export default account

+ 54
- 0
src/pages/shop/index.scss View File

@@ -0,0 +1,54 @@
1
+.account {
2
+
3
+  // padding: 13.33px 0;
4
+  &-view {
5
+    margin: 40px 0 0;
6
+
7
+    // padding: 0;
8
+    &-title {
9
+      color: #7b7b7b;
10
+      font-size: 30px;
11
+      font-weight: 500;
12
+      margin-left: 40px;
13
+
14
+    }
15
+
16
+    &-card {
17
+      padding: 0;
18
+      color: #181818;
19
+      font-size: 24px;
20
+      font-weight: 600;
21
+      margin-top: 26.67px;
22
+      position: relative;
23
+
24
+      &-radio {
25
+          width: 50px;
26
+          height: 50px;
27
+        background-color: #274291;
28
+        text-align: center;
29
+        line-height: 50px;
30
+        position: absolute;
31
+        border-radius: 25px;
32
+        top: -12.5px;
33
+        right: -12.5px;
34
+      }
35
+
36
+      .top {
37
+        padding: 40px 40px;
38
+        border-bottom: 1px solid #f4f4f4;
39
+        line-height: 32px;
40
+        font-weight: 500;
41
+        // font-size: ;
42
+        // min-height: 120px;
43
+      }
44
+
45
+      .bottom {
46
+        display: flex;
47
+        justify-content: space-around;
48
+        padding: 20px
49
+      }
50
+
51
+
52
+    }
53
+  }
54
+}

+ 31
- 0
src/reducers/guide.js View File

@@ -0,0 +1,31 @@
1
+// import { ADD, MINUS } from '../constants/user'
2
+
3
+// // landlord: 'landlord',
4
+// //     customer:'customer'
5
+
6
+// const INITIAL_STATE = {
7
+//   house:{},
8
+//   Park:{},
9
+//   wifi:{
10
+//       name:'234',
11
+//       passward:'432'
12
+//   },
13
+//   image:''
14
+// }
15
+
16
+// export default function counter (state = INITIAL_STATE, action) {
17
+//   switch (action.type) {
18
+//     case ADD:
19
+//       return {
20
+//         ...state,
21
+//         num: state.num + 1
22
+//       }
23
+//      case MINUS:
24
+//        return {
25
+//          ...state,
26
+//          num: state.num - 1
27
+//        }
28
+//      default:
29
+//        return state
30
+//   }
31
+// }

+ 10
- 0
src/reducers/index.js View File

@@ -0,0 +1,10 @@
1
+import { combineReducers } from 'redux'
2
+// import user from './user'
3
+// import page from './page'
4
+// import guide from './guide'
5
+
6
+export default combineReducers({
7
+  // user,
8
+  // page,
9
+  // guide,
10
+})

+ 27
- 0
src/reducers/page.js View File

@@ -0,0 +1,27 @@
1
+// import { ADD, MINUS } from '../constants/user'
2
+
3
+// // landlord: 'landlord',
4
+// //     customer:'customer'
5
+
6
+// const INITIAL_STATE = {
7
+//   link:'index',
8
+//   id:String,
9
+//   params:Object
10
+// }
11
+
12
+// export default function counter (state = INITIAL_STATE, action) {
13
+//   switch (action.type) {
14
+//     case ADD:
15
+//       return {
16
+//         ...state,
17
+//         num: state.num + 1
18
+//       }
19
+//      case MINUS:
20
+//        return {
21
+//          ...state,
22
+//          num: state.num - 1
23
+//        }
24
+//      default:
25
+//        return state
26
+//   }
27
+// }

+ 28
- 0
src/reducers/user.js View File

@@ -0,0 +1,28 @@
1
+import {
2
+  ADD,
3
+  MINUS
4
+} from '../constants/user'
5
+
6
+// landlord: 'landlord',
7
+//     customer:'customer'
8
+// adminuser
9
+const INITIAL_STATE = {
10
+  user:'22'
11
+}
12
+
13
+export default function counter(state = INITIAL_STATE, action) {
14
+  switch (action.type) {
15
+    case ADD:
16
+      return {
17
+        ...state,
18
+        num: state.num + 1
19
+      }
20
+      case MINUS:
21
+        return {
22
+          ...state,
23
+          num: state.num - 1
24
+        }
25
+        default:
26
+          return state
27
+  }
28
+}

+ 28
- 0
src/store/index.js View File

@@ -0,0 +1,28 @@
1
+import { createStore, applyMiddleware, compose } from 'redux'
2
+// import thunkMiddleware from 'redux-thunk'
3
+import rootReducer from '../reducers'
4
+
5
+// const composeEnhancers =
6
+//   typeof window === 'object' &&
7
+//   window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?   
8
+//     window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
9
+//       // Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
10
+//     }) : compose
11
+
12
+// const middlewares = [
13
+//   thunkMiddleware
14
+// ]
15
+
16
+// if (process.env.NODE_ENV === 'development' && process.env.TARO_ENV !== 'quickapp') {
17
+//   // middlewares.push(require('redux-logger').createLogger())
18
+// }
19
+
20
+// const enhancer = composeEnhancers(
21
+//   applyMiddleware(...middlewares),
22
+//   // other store enhancers if any
23
+// ), enhancer
24
+
25
+export default function configStore () {
26
+  const store = createStore(rootReducer)
27
+  return store
28
+}

+ 25
- 0
src/store/user.js View File

@@ -0,0 +1,25 @@
1
+import { useState } from "react";
2
+import Taro from '@tarojs/taro'
3
+
4
+import request from '../util/request'
5
+
6
+export default function useUser() {
7
+    const [user, setUser] = useState()
8
+
9
+    const getUser = code => {
10
+        request({url:`/login?code=${code}`,method:"POST"}).then((res)=>{
11
+          console.log(res.data.data,'res')
12
+          setUser(res.data.data)
13
+
14
+          Taro.setStorage({
15
+            key:"token",
16
+            data:res.data.data.token
17
+          })
18
+        })
19
+    }
20
+
21
+    return {
22
+        user,
23
+        getUser,
24
+    }
25
+}

+ 16
- 0
src/util/getCode.js View File

@@ -0,0 +1,16 @@
1
+
2
+export function getCode() {
3
+    const m = /code=([^&]+)/.exec(window.location.search)
4
+    const codeFromQuery = m ? m[1] : false
5
+    const codeFromCash = window.localStorage.getItem('code')
6
+
7
+    if (codeFromQuery !== codeFromCash) {
8
+        return codeFromQuery
9
+    }
10
+
11
+    return false;
12
+}
13
+
14
+export function setCode(code) {
15
+    window.localStorage.setItem('code', code)
16
+}

+ 18
- 0
src/util/getCodeUrl.js View File

@@ -0,0 +1,18 @@
1
+
2
+import Taro from '@tarojs/taro'
3
+const appid = APPID
4
+
5
+export default function(path) {
6
+
7
+    console.log(window.location,'window.location')
8
+  const  redirect_uri = `${window.location.origin}/#/${window.location.hash}`
9
+
10
+
11
+//   window.location.origin = `${window.location.protocol}//${Taro.Current.router.path
12
+//       window.location.hostname
13
+//     }${window.location.port ? ':' + window.location.port : ''}`;
14
+    console.log(APPID,redirect_uri,'')
15
+
16
+    const url=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(redirect_uri)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
17
+    return url
18
+}

+ 16
- 0
src/util/getQueryValue.js View File

@@ -0,0 +1,16 @@
1
+export default function () {
2
+
3
+  let [page, query=''] = decodeURI(window.location.hash.substring(1)).split('?')
4
+  let params = {}
5
+  let vars = query.split("&");
6
+  console.log(vars, 'query')
7
+  for (let i = 0; i < vars.length; i++) {
8
+    let pair = vars[i].split("=");
9
+    params = {
10
+      ...params,
11
+      [pair[0]]: pair[1]
12
+    }
13
+   
14
+  }
15
+  return params;
16
+}

+ 106
- 0
src/util/request.js View File

@@ -0,0 +1,106 @@
1
+import React from 'react'
2
+import Taro from '@tarojs/taro'
3
+
4
+// const baseURL = HOST
5
+
6
+export default async (options) => {
7
+  const opts = optionBuilder(options)
8
+  console.log(opts, "optsoptsoptsoptsoptsoptsoptsoptsoptsopts")
9
+
10
+  return Taro.request(opts)
11
+    .then((res) => {
12
+      console.log('3322');
13
+      return res
14
+    })
15
+    .catch((err) => {
16
+      console.log(err, '333221');
17
+      return err
18
+    })
19
+}
20
+// import useUser from './store/user'
21
+// const {user} = useUser()
22
+
23
+export function optionBuilder(options) {
24
+  const {
25
+    url,
26
+    data = {},
27
+    method = 'get',
28
+    params = {},
29
+    header
30
+  } = options
31
+  // console.log(user,'user')
32
+  let api = `/api/mp${url}`
33
+
34
+  if (method == 'get'&&JSON.stringify(params) != "{}") {
35
+    api = `${api}?${paramsToString(params)}`
36
+  } 
37
+  const token = Taro.getStorageSync('token')||''
38
+  return {
39
+    url: api,
40
+    method,
41
+    data,
42
+    header: {
43
+      'content-type': 'application/json',
44
+      'authorization': `X-Authorization-JWT ${token}`,
45
+      // 'appId': appId,
46
+      // 'x-action': 'miniapp',
47
+      // 'x-version': Version,
48
+      // 'x-consultant': consultant,
49
+      // 'x-recommender': recommender,
50
+
51
+      ...header || {},
52
+    },
53
+    mode: 'cors',
54
+  }
55
+
56
+}
57
+
58
+
59
+function paramsToString(params) {
60
+  return Object.keys(params).map((key) => {
61
+    const val = params[key]
62
+    return Array.isArray(val) ? val.map((x) => {
63
+      return composeKeyValue(key, x)
64
+    }).join('&') : composeKeyValue(key, val)
65
+
66
+  }).join('&')
67
+}
68
+
69
+function composeKeyValue(k, v, encode) {
70
+
71
+  return encode === false ? `${k}=${v}` : `${encodeURIComponent(k)}=${encodeURIComponent(v)}`
72
+}
73
+
74
+
75
+export const uploadFiles = async (files,url) => {
76
+  const uploads = []
77
+  const token = Taro.getStorageSync('token')||''
78
+  for (var i = 0; i < files.length; i++) {
79
+    uploads[i] = new Promise((resolve, reject) => {
80
+      Taro.uploadFile({
81
+        url:  url||`/api/mp/image`,
82
+        filePath: files[i],
83
+        header: {
84
+          'authorization': `X-Authorization-JWT ${token}`,
85
+
86
+          // 'x-action': 'miniapp'
87
+        },
88
+        name: 'file',
89
+        success: function (res) {
90
+          // debugger
91
+          const _data = JSON.parse(res.data)
92
+          // if (_data.code !== CODE_SUCCESS) {
93
+          //   reject(new Error(_data.message))
94
+          // }
95
+
96
+          resolve(_data.data)
97
+        },
98
+        fail(err) {
99
+          reject(err)
100
+        }
101
+      })
102
+    })
103
+  }
104
+
105
+  return Promise.all(uploads)
106
+}