xcx 4 vuotta sitten
commit
24571febaa
100 muutettua tiedostoa jossa 3020 lisäystä ja 0 poistoa
  1. 12
    0
      .editorconfig
  2. 5
    0
      .eslintrc.js
  3. 16
    0
      .gitignore
  4. 4
    0
      .npmrc
  5. 10
    0
      babel.config.js
  6. 10
    0
      config/dev.js
  7. 77
    0
      config/index.js
  8. 19
    0
      config/prod.js
  9. 60
    0
      package.json
  10. 37
    0
      project.config.json
  11. 56
    0
      src/app.config.js
  12. 45
    0
      src/app.js
  13. 57
    0
      src/app.scss
  14. 52
    0
      src/assets/img/bars.svg
  15. BIN
      src/assets/img/tabicon1-.png
  16. BIN
      src/assets/img/tabicon1.png
  17. BIN
      src/assets/img/tabicon2-.png
  18. BIN
      src/assets/img/tabicon2.png
  19. BIN
      src/assets/img/tabicon3-.png
  20. BIN
      src/assets/img/tabicon3.png
  21. BIN
      src/assets/img/tabicon4-.png
  22. BIN
      src/assets/img/tabicon4.png
  23. BIN
      src/assets/img/tabicon5-.png
  24. BIN
      src/assets/img/tabicon5.png
  25. 39
    0
      src/components/NavHeader/index.vue
  26. 13
    0
      src/components/NavHeader/page.scss
  27. 108
    0
      src/iconfont.scss
  28. 20
    0
      src/index.html
  29. 3
    0
      src/pages/FuLi/index.config.js
  30. 39
    0
      src/pages/FuLi/index.vue
  31. 6
    0
      src/pages/FuLi/page.scss
  32. 3
    0
      src/pages/HuoDong/index.config.js
  33. 39
    0
      src/pages/HuoDong/index.vue
  34. 6
    0
      src/pages/HuoDong/page.scss
  35. 5
    0
      src/pages/ShouYe/index.config.js
  36. 168
    0
      src/pages/ShouYe/index.vue
  37. 334
    0
      src/pages/ShouYe/page.scss
  38. 3
    0
      src/pages/SignIn/index.config.js
  39. 39
    0
      src/pages/SignIn/index.vue
  40. 6
    0
      src/pages/SignIn/page.scss
  41. 3
    0
      src/pages/WoDe/index.config.js
  42. 39
    0
      src/pages/WoDe/index.vue
  43. 6
    0
      src/pages/WoDe/page.scss
  44. 3
    0
      src/pages/WuYe/index.config.js
  45. 39
    0
      src/pages/WuYe/index.vue
  46. 6
    0
      src/pages/WuYe/page.scss
  47. 33
    0
      src/store.js
  48. 26
    0
      src/store/index.js
  49. 13
    0
      src/store/index/index.js
  50. 35
    0
      src/store/user/index.js
  51. 290
    0
      src/towxml/config.js
  52. 26
    0
      src/towxml/decode.js
  53. 9
    0
      src/towxml/decode.json
  54. 1
    0
      src/towxml/decode.wxml
  55. 0
    0
      src/towxml/decode.wxss
  56. 98
    0
      src/towxml/img/img.js
  57. 3
    0
      src/towxml/img/img.json
  58. 1
    0
      src/towxml/img/img.wxml
  59. 0
    0
      src/towxml/img/img.wxss
  60. 19
    0
      src/towxml/index.js
  61. 107
    0
      src/towxml/parse/index.js
  62. 55
    0
      src/towxml/parse/markdown/index.js
  63. 4
    0
      src/towxml/parse/markdown/markdown.js
  64. 2
    0
      src/towxml/parse/markdown/plugins/emoji.js
  65. 1
    0
      src/towxml/parse/markdown/plugins/ins.js
  66. 1
    0
      src/towxml/parse/markdown/plugins/mark.js
  67. 1
    0
      src/towxml/parse/markdown/plugins/sub.js
  68. 1
    0
      src/towxml/parse/markdown/plugins/sup.js
  69. 147
    0
      src/towxml/parse/markdown/plugins/todo.js
  70. 2
    0
      src/towxml/parse/parse2/Parser.js
  71. 2
    0
      src/towxml/parse/parse2/Tokenizer.js
  72. 2
    0
      src/towxml/parse/parse2/domhandler/index.js
  73. 2
    0
      src/towxml/parse/parse2/domhandler/node.js
  74. 2
    0
      src/towxml/parse/parse2/entities/decode.js
  75. 2
    0
      src/towxml/parse/parse2/entities/decode_codepoint.js
  76. 2
    0
      src/towxml/parse/parse2/entities/encode.js
  77. 2
    0
      src/towxml/parse/parse2/entities/index.js
  78. 2
    0
      src/towxml/parse/parse2/entities/maps/decode.js
  79. 2
    0
      src/towxml/parse/parse2/entities/maps/entities.js
  80. 2
    0
      src/towxml/parse/parse2/entities/maps/legacy.js
  81. 2
    0
      src/towxml/parse/parse2/entities/maps/xml.js
  82. 2
    0
      src/towxml/parse/parse2/index.js
  83. 377
    0
      src/towxml/style/main.wxss
  84. 73
    0
      src/towxml/style/theme/dark.wxss
  85. 62
    0
      src/towxml/style/theme/light.wxss
  86. 11
    0
      src/towxml/table/table.js
  87. 6
    0
      src/towxml/table/table.json
  88. 24
    0
      src/towxml/table/table.wxml
  89. 0
    0
      src/towxml/table/table.wxss
  90. 20
    0
      src/towxml/todogroup/todogroup.js
  91. 6
    0
      src/towxml/todogroup/todogroup.json
  92. 13
    0
      src/towxml/todogroup/todogroup.wxml
  93. 3
    0
      src/towxml/todogroup/todogroup.wxss
  94. 16
    0
      src/towxml/towxml.js
  95. 6
    0
      src/towxml/towxml.json
  96. 5
    0
      src/towxml/towxml.wxml
  97. 8
    0
      src/towxml/towxml.wxss
  98. 11
    0
      src/util/Api/index.js
  99. 93
    0
      src/util/PublicMethod/index.js
  100. 0
    0
      src/util/auth-plugin.js

+ 12
- 0
.editorconfig Näytä tiedosto

@@ -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

+ 5
- 0
.eslintrc.js Näytä tiedosto

@@ -0,0 +1,5 @@
1
+// ESLint 检查 .vue 文件需要单独配置编辑器:
2
+// https://eslint.vuejs.org/user-guide/#editor-integrations
3
+module.exports = {
4
+  'extends': ['taro/vue']
5
+}

+ 16
- 0
.gitignore Näytä tiedosto

@@ -0,0 +1,16 @@
1
+.DS_Store
2
+node_modules/
3
+dist/
4
+npm-debug.log*
5
+yarn-debug.log*
6
+yarn-error.log*
7
+package-lock.json
8
+tests/**/coverage/
9
+
10
+# Editor directories and files
11
+.idea
12
+.vscode
13
+*.suo
14
+*.ntvs*
15
+*.njsproj
16
+*.sln

+ 4
- 0
.npmrc Näytä tiedosto

@@ -0,0 +1,4 @@
1
+registry=https://r.cnpmjs.org
2
+disturl=https://r.cnpmjs.org/node
3
+sass_binary_site=https://r.cnpmjs.org/node-sass/
4
+fse_binary_host_mirror=https://r.cnpmjs.org/fsevents

+ 10
- 0
babel.config.js Näytä tiedosto

@@ -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: 'vue',
7
+      ts: false
8
+    }]
9
+  ]
10
+}

+ 10
- 0
config/dev.js Näytä tiedosto

@@ -0,0 +1,10 @@
1
+module.exports = {
2
+  env: {
3
+    NODE_ENV: '"development"'
4
+  },
5
+  defineConstants: {
6
+    SERVER_API: '"https://dev.fangdeal.cn/liyuanhui/api/wx"'
7
+  },
8
+  mini: {},
9
+  h5: {}
10
+}

+ 77
- 0
config/index.js Näytä tiedosto

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

+ 19
- 0
config/prod.js Näytä tiedosto

@@ -0,0 +1,19 @@
1
+module.exports = {
2
+  env: {
3
+    NODE_ENV: '"production"'
4
+  },
5
+  defineConstants: {
6
+    SERVER_API: '"https://outer.fangdeal.cn/liyuanhui/api/wx"'
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
+}

+ 60
- 0
package.json Näytä tiedosto

@@ -0,0 +1,60 @@
1
+{
2
+  "name": "myApp",
3
+  "version": "1.0.0",
4
+  "private": true,
5
+  "description": "",
6
+  "templateInfo": {
7
+    "name": "vuex",
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:quickapp": "taro build --type quickapp",
20
+    "dev:weapp": "npm run build:weapp -- --watch",
21
+    "dev:swan": "npm run build:swan -- --watch",
22
+    "dev:alipay": "npm run build:alipay -- --watch",
23
+    "dev:tt": "npm run build:tt -- --watch",
24
+    "dev:h5": "npm run build:h5 -- --watch",
25
+    "dev:rn": "npm run build:rn -- --watch",
26
+    "dev:qq": "npm run build:qq -- --watch",
27
+    "dev:quickapp": "npm run build:quickapp -- --watch"
28
+  },
29
+  "browserslist": [
30
+    "last 3 versions",
31
+    "Android >= 4.1",
32
+    "ios >= 8"
33
+  ],
34
+  "author": "",
35
+  "license": "MIT",
36
+  "dependencies": {
37
+    "@babel/runtime": "^7.7.7",
38
+    "@tarojs/cli": "^3.0.7",
39
+    "@tarojs/components": "3.0.7",
40
+    "@tarojs/mini-runner": "^3.0.7",
41
+    "@tarojs/runtime": "3.0.7",
42
+    "@tarojs/taro": "3.0.7",
43
+    "qs": "^6.9.4",
44
+    "vue": "^2.5.0",
45
+    "vue-template-compiler": "^2.5.0",
46
+    "vuex": "^3.5.1"
47
+  },
48
+  "devDependencies": {
49
+    "@babel/core": "^7.8.0",
50
+    "@tarojs/mini-runner": "3.0.7",
51
+    "@tarojs/webpack-runner": "3.0.7",
52
+    "@types/webpack-env": "^1.13.6",
53
+    "babel-preset-taro": "3.0.7",
54
+    "eslint": "^6.8.0",
55
+    "eslint-config-taro": "3.0.7",
56
+    "eslint-plugin-vue": "^6.x",
57
+    "stylelint": "9.3.0",
58
+    "vue-loader": "^15.9.2"
59
+  }
60
+}

+ 37
- 0
project.config.json Näytä tiedosto

@@ -0,0 +1,37 @@
1
+{
2
+	"miniprogramRoot": "dist/",
3
+	"projectname": "myApp",
4
+	"description": "",
5
+	"appid": "wxd9ee3a9480a4e544",
6
+	"setting": {
7
+		"urlCheck": false,
8
+		"es6": false,
9
+		"enhance": false,
10
+		"postcss": false,
11
+		"preloadBackgroundData": false,
12
+		"minified": false,
13
+		"newFeature": false,
14
+		"coverView": true,
15
+		"nodeModules": false,
16
+		"autoAudits": false,
17
+		"showShadowRootInWxmlPanel": true,
18
+		"scopeDataCheck": false,
19
+		"uglifyFileName": false,
20
+		"checkInvalidKey": true,
21
+		"checkSiteMap": true,
22
+		"uploadWithSourceMap": true,
23
+		"compileHotReLoad": false,
24
+		"babelSetting": {
25
+			"ignore": [],
26
+			"disablePlugins": [],
27
+			"outputPath": ""
28
+		},
29
+		"useIsolateContext": true,
30
+		"useCompilerModule": false,
31
+		"userConfirmedUseCompilerModuleSwitch": false
32
+	},
33
+	"compileType": "miniprogram",
34
+	"simulatorType": "wechat",
35
+	"simulatorPluginLibVersion": {},
36
+	"condition": {}
37
+}

+ 56
- 0
src/app.config.js Näytä tiedosto

@@ -0,0 +1,56 @@
1
+
2
+export default {
3
+  pages: [
4
+    'pages/ShouYe/index', // 首页
5
+    'pages/WuYe/index', // 物业
6
+    'pages/HuoDong/index', // 活动
7
+    'pages/FuLi/index', // 福利
8
+    'pages/WoDe/index', // 我的
9
+    'pages/SignIn/index' // 登录页
10
+  ],
11
+  tabBar: {
12
+    color: '#666666',
13
+    selectedColor: '#971C21',
14
+    list: [
15
+      {
16
+        iconPath: 'assets/img/tabicon1.png',
17
+        selectedIconPath: 'assets/img/tabicon1-.png',
18
+        pagePath: 'pages/ShouYe/index',
19
+        text: '首页'
20
+      },
21
+      {
22
+        iconPath: 'assets/img/tabicon2.png',
23
+        selectedIconPath: 'assets/img/tabicon2-.png',
24
+        pagePath: 'pages/WuYe/index',
25
+        text: '物业'
26
+      },
27
+      {
28
+        iconPath: 'assets/img/tabicon3.png',
29
+        selectedIconPath: 'assets/img/tabicon3-.png',
30
+        pagePath: 'pages/HuoDong/index',
31
+        text: '活动'
32
+      },
33
+      {
34
+        iconPath: 'assets/img/tabicon4.png',
35
+        selectedIconPath: 'assets/img/tabicon4-.png',
36
+        pagePath: 'pages/FuLi/index',
37
+        text: '福利'
38
+      },
39
+      {
40
+        iconPath: 'assets/img/tabicon5.png',
41
+        selectedIconPath: 'assets/img/tabicon5-.png',
42
+        pagePath: 'pages/WoDe/index',
43
+        text: '我的'
44
+      }
45
+    ]
46
+  },
47
+  window: {
48
+    backgroundTextStyle: 'light',
49
+    navigationBarBackgroundColor: '#fff',
50
+    navigationBarTitleText: 'WeChat',
51
+    navigationBarTextStyle: 'black'
52
+  },
53
+  usingComponents: {
54
+    'towxml': '/towxml/towxml'
55
+  }
56
+}

+ 45
- 0
src/app.js Näytä tiedosto

@@ -0,0 +1,45 @@
1
+import Taro from '@tarojs/taro'
2
+import Vue from 'vue'
3
+import { vueAuthPlugin } from '@/util/auth-plugin'
4
+import store from './store/index'
5
+
6
+import './app.scss'
7
+import './iconfont.scss'
8
+
9
+// Vue.config.productionTip = false
10
+
11
+// 引入项目通用(顶层)方法对象
12
+import ToolClass from './util/PublicMethod/index'
13
+Vue.prototype.ToolClass = ToolClass
14
+
15
+Vue.use(vueAuthPlugin)
16
+
17
+const App = new Vue({
18
+  store,
19
+  onLaunch (options) {
20
+    this.login(options)
21
+  },
22
+  render (h) {
23
+    // this.$slots.default 是将要会渲染的页面
24
+    return h('block', this.$slots.default)
25
+  },
26
+  methods: {
27
+    login (options) {
28
+      Taro.login({
29
+        success (res) {
30
+          if (res.code) {
31
+            console.log(`登录成功,登录信息${res}`)
32
+          } else {
33
+            Taro.showToast({
34
+              title: '初始化失败, 请退出重试',
35
+              icon: 'none',
36
+              duration: 3000
37
+            })
38
+          }
39
+        }
40
+      })
41
+    }
42
+  }
43
+})
44
+
45
+export default App

+ 57
- 0
src/app.scss Näytä tiedosto

@@ -0,0 +1,57 @@
1
+page {
2
+  width: 100%;
3
+  height: 100%;
4
+  background: #eee;
5
+
6
+  .centerLabel {
7
+    display: block;
8
+    position: absolute;
9
+    left: 50%;
10
+    top: 50%;
11
+    transform: translate(-50%, -50%);
12
+    -webkit-transform: translate(-50%, -50%);
13
+  }
14
+
15
+  .flex-h {
16
+    display: flex;
17
+    display: -webkit-flex;
18
+  }
19
+
20
+  .flex-v {
21
+    display: flex;
22
+    display: -webkit-flex;
23
+    flex-direction: column;
24
+    -webkit-flex-direction: column;
25
+  }
26
+
27
+  .flex-item {
28
+    flex: 1;
29
+    -webkit-flex: 1;
30
+    position: relative;
31
+    overflow: hidden;
32
+  }
33
+
34
+  .text-overflow-line2 {
35
+    overflow: hidden;
36
+    text-overflow: ellipsis;
37
+    display: -webkit-box;
38
+    -webkit-box-orient: vertical;
39
+    -webkit-line-clamp: 2;
40
+  }
41
+
42
+  image {
43
+    &.centerLabel {
44
+      &[mode=aspectFill] {
45
+        min-width: 100%;
46
+        min-height: 100%;
47
+      }
48
+    }
49
+  }
50
+
51
+  .MainLoading {
52
+    width: 100%;
53
+    height: 300px;
54
+    background: url('../src/assets/img/bars.svg') no-repeat center center;
55
+    background-size: 100px auto;
56
+  }
57
+}

+ 52
- 0
src/assets/img/bars.svg Näytä tiedosto

@@ -0,0 +1,52 @@
1
+<svg width="135" height="140" viewBox="0 0 135 140" xmlns="http://www.w3.org/2000/svg" fill="#ccc">
2
+    <rect y="10" width="15" height="120" rx="6">
3
+        <animate attributeName="height"
4
+             begin="0.5s" dur="1s"
5
+             values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear"
6
+             repeatCount="indefinite" />
7
+        <animate attributeName="y"
8
+             begin="0.5s" dur="1s"
9
+             values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear"
10
+             repeatCount="indefinite" />
11
+    </rect>
12
+    <rect x="30" y="10" width="15" height="120" rx="6">
13
+        <animate attributeName="height"
14
+             begin="0.25s" dur="1s"
15
+             values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear"
16
+             repeatCount="indefinite" />
17
+        <animate attributeName="y"
18
+             begin="0.25s" dur="1s"
19
+             values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear"
20
+             repeatCount="indefinite" />
21
+    </rect>
22
+    <rect x="60" width="15" height="140" rx="6">
23
+        <animate attributeName="height"
24
+             begin="0s" dur="1s"
25
+             values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear"
26
+             repeatCount="indefinite" />
27
+        <animate attributeName="y"
28
+             begin="0s" dur="1s"
29
+             values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear"
30
+             repeatCount="indefinite" />
31
+    </rect>
32
+    <rect x="90" y="10" width="15" height="120" rx="6">
33
+        <animate attributeName="height"
34
+             begin="0.25s" dur="1s"
35
+             values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear"
36
+             repeatCount="indefinite" />
37
+        <animate attributeName="y"
38
+             begin="0.25s" dur="1s"
39
+             values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear"
40
+             repeatCount="indefinite" />
41
+    </rect>
42
+    <rect x="120" y="10" width="15" height="120" rx="6">
43
+        <animate attributeName="height"
44
+             begin="0.5s" dur="1s"
45
+             values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear"
46
+             repeatCount="indefinite" />
47
+        <animate attributeName="y"
48
+             begin="0.5s" dur="1s"
49
+             values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear"
50
+             repeatCount="indefinite" />
51
+    </rect>
52
+</svg>

BIN
src/assets/img/tabicon1-.png Näytä tiedosto


BIN
src/assets/img/tabicon1.png Näytä tiedosto


BIN
src/assets/img/tabicon2-.png Näytä tiedosto


BIN
src/assets/img/tabicon2.png Näytä tiedosto


BIN
src/assets/img/tabicon3-.png Näytä tiedosto


BIN
src/assets/img/tabicon3.png Näytä tiedosto


BIN
src/assets/img/tabicon4-.png Näytä tiedosto


BIN
src/assets/img/tabicon4.png Näytä tiedosto


BIN
src/assets/img/tabicon5-.png Näytä tiedosto


BIN
src/assets/img/tabicon5.png Näytä tiedosto


+ 39
- 0
src/components/NavHeader/index.vue Näytä tiedosto

@@ -0,0 +1,39 @@
1
+<template>
2
+  <view class="NavHeader" :style="{background: BgColor}">
3
+    <text>{{Title}}</text>
4
+  </view>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: 'NavHeader',
10
+  props: {
11
+    Title: {
12
+      default: '香颂蔚澜',
13
+      type: String
14
+    },
15
+    BgColor: {
16
+      default: '#fff',
17
+      type: String
18
+    }
19
+  },
20
+  data () {
21
+    return {
22
+    }
23
+  },
24
+  computed: {
25
+  },
26
+  components: {
27
+  },
28
+  created () {
29
+  },
30
+  methods: {
31
+    Init () {
32
+    }
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss">
38
+@import "page.scss";
39
+</style>

+ 13
- 0
src/components/NavHeader/page.scss Näytä tiedosto

@@ -0,0 +1,13 @@
1
+.NavHeader {
2
+  width: 100%;
3
+  position: relative;
4
+  overflow: hidden;
5
+  > text {
6
+    display: block;
7
+    font-size: 32px;
8
+    color: #fff;
9
+    text-indent: 30px;
10
+    margin-top: 60px;
11
+    padding-bottom: 20px;
12
+  }
13
+}

+ 108
- 0
src/iconfont.scss
File diff suppressed because it is too large
Näytä tiedosto


+ 20
- 0
src/index.html Näytä tiedosto

@@ -0,0 +1,20 @@
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
+  <link rel="stylesheet" href="//at.alicdn.com/t/font_1998922_g8nkn1klezi.css">
12
+  <title></title>
13
+  <script>
14
+    !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);
15
+  </script>
16
+</head>
17
+<body>
18
+  <div id="app"></div>
19
+</body>
20
+</html>

+ 3
- 0
src/pages/FuLi/index.config.js Näytä tiedosto

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '香颂蔚澜'
3
+}

+ 39
- 0
src/pages/FuLi/index.vue Näytä tiedosto

@@ -0,0 +1,39 @@
1
+<template>
2
+  <view class="page FuLi">
3
+    福利
4
+  </view>
5
+</template>
6
+
7
+<script>
8
+import { createNamespacedHelpers } from 'vuex'
9
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
10
+export default {
11
+  name: 'FuLi',
12
+  data () {
13
+    return {
14
+      DataLock: false
15
+    }
16
+  },
17
+  computed: {
18
+    ...mapUserState({
19
+      UserInfo: x => x.UserInfo // 用户信息
20
+    })
21
+  },
22
+  components: {
23
+  },
24
+  created () {
25
+  },
26
+  methods: {
27
+    ...mapUserActions([
28
+    ]),
29
+    ...mapUserMutations([
30
+    ]),
31
+    Init () {
32
+    }
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss">
38
+@import "page.scss";
39
+</style>

+ 6
- 0
src/pages/FuLi/page.scss Näytä tiedosto

@@ -0,0 +1,6 @@
1
+.page.FuLi {
2
+  width: 100%;
3
+  height: 100%;
4
+  overflow-y: scroll;
5
+  background: #fff;
6
+}

+ 3
- 0
src/pages/HuoDong/index.config.js Näytä tiedosto

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '香颂蔚澜'
3
+}

+ 39
- 0
src/pages/HuoDong/index.vue Näytä tiedosto

@@ -0,0 +1,39 @@
1
+<template>
2
+  <view class="page HuoDong">
3
+    活动
4
+  </view>
5
+</template>
6
+
7
+<script>
8
+import { createNamespacedHelpers } from 'vuex'
9
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
10
+export default {
11
+  name: 'HuoDong',
12
+  data () {
13
+    return {
14
+      DataLock: false
15
+    }
16
+  },
17
+  computed: {
18
+    ...mapUserState({
19
+      UserInfo: x => x.UserInfo // 用户信息
20
+    })
21
+  },
22
+  components: {
23
+  },
24
+  created () {
25
+  },
26
+  methods: {
27
+    ...mapUserActions([
28
+    ]),
29
+    ...mapUserMutations([
30
+    ]),
31
+    Init () {
32
+    }
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss">
38
+@import "page.scss";
39
+</style>

+ 6
- 0
src/pages/HuoDong/page.scss Näytä tiedosto

@@ -0,0 +1,6 @@
1
+.page.HuoDong {
2
+  width: 100%;
3
+  height: 100%;
4
+  overflow-y: scroll;
5
+  background: #fff;
6
+}

+ 5
- 0
src/pages/ShouYe/index.config.js Näytä tiedosto

@@ -0,0 +1,5 @@
1
+export default {
2
+  navigationBarTitleText: '香颂蔚澜',
3
+  navigationStyle: 'custom',
4
+  navigationBarTextStyle: 'white'
5
+}

+ 168
- 0
src/pages/ShouYe/index.vue Näytä tiedosto

@@ -0,0 +1,168 @@
1
+<template>
2
+  <view class="page ShouYe flex-v">
3
+    <NavHeader Title="首页" BgColor="#f35844"></NavHeader>
4
+    <view class="flex-item">
5
+      <view class="PageContainer">
6
+        <scroll-view scroll-y="true" style="height: 100%;" :refresher-enabled="true" @refresherrefresh="OnRefresh" :refresher-triggered="IsPull" refresher-background="none">
7
+          <view class="Content">
8
+
9
+            <view class="TopBg"></view>
10
+
11
+            <view>
12
+              <!-- 欢迎词 -->
13
+              <text class="Welcome">欢迎来到远道智慧社区!</text>
14
+
15
+              <!-- banner -->
16
+              <view class="BannerContainer">
17
+                <view>
18
+                  <view>
19
+                    <swiper class="BannerSwiper" :autoplay="true" :circular="true" :indicator-dots="true" indicator-color="rgba(0,0,0,0.4)" indicator-active-color="rgba(255,255,255,0.8)">
20
+                      <swiper-item v-for="(item, index) in BannerList" :key="index">
21
+                        <view class="BannerItem">
22
+                          <image mode="aspectFill" :src="item.img"></image>
23
+                        </view>
24
+                      </swiper-item>
25
+                    </swiper>
26
+                  </view>
27
+                </view>
28
+              </view>
29
+
30
+              <!-- 导航 -->
31
+              <view class="NavContainer flex-h">
32
+                <view v-for="(item, index) in NavList" :key="index" class="flex-item">
33
+                  <view>
34
+                    <view class="centerLabel">
35
+                      <text class="iconfont" :class="item.icon"></text>
36
+                      <text>{{item.name}}</text>
37
+                    </view>
38
+                  </view>
39
+                </view>
40
+              </view>
41
+
42
+              <!-- 热门活动 -->
43
+              <view class="HotActivityContainer">
44
+                <view>
45
+                  <view class="Title">
46
+                    <text>热门活动</text>
47
+                    <text class="iconfont icongengduo"></text>
48
+                  </view>
49
+                  <view class="Activity">
50
+                    <image class="centerLabel" mode="aspectFill" :src="TestImg"></image>
51
+                  </view>
52
+                </view>
53
+              </view>
54
+
55
+              <!-- 业主专区 -->
56
+              <view class="OwnerContainer">
57
+                <view>
58
+                  <view class="Title">
59
+                    <text>业主专区</text>
60
+                  </view>
61
+                  <view class="OwnerList flex-h">
62
+                    <view class="flex-item" v-for="(item, index) in OwnerList" :key="index">
63
+                      <text class="iconfont" :class="item.icon"></text>
64
+                      <text>{{item.name}}</text>
65
+                    </view>
66
+                  </view>
67
+                </view>
68
+              </view>
69
+
70
+              <!-- 热门资讯 -->
71
+              <view class="NewsContainer">
72
+                <view>
73
+                  <view class="Title flex-h">
74
+                    <text class="flex-item">热门资讯</text>
75
+                    <text>查看全部</text>
76
+                    <text class="iconfont iconjiantouright"></text>
77
+                  </view>
78
+                  <view class="List">
79
+                    <view v-for="(item, index) in NewsList" :key="index" class="flex-h">
80
+                      <view class="Img">
81
+                        <image mode="aspectFill" :src="item.img" class="centerLabel"></image>
82
+                      </view>
83
+                      <view class="flex-item">
84
+                        <text>{{item.title}}</text>
85
+                        <text>{{item.desc}}</text>
86
+                      </view>
87
+                    </view>
88
+                  </view>
89
+                </view>
90
+              </view>
91
+
92
+              <view class="PageBottom"></view>
93
+            </view>
94
+
95
+          </view>
96
+        </scroll-view>
97
+      </view>
98
+    </view>
99
+  </view>
100
+</template>
101
+
102
+<script>
103
+import NavHeader from '../../components/NavHeader'
104
+import { createNamespacedHelpers } from 'vuex'
105
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
106
+export default {
107
+  name: 'ShouYe',
108
+  data () {
109
+    return {
110
+      IsPull: false,
111
+      NewsList: [
112
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=8610f1678b51e26de6d4c6af39d1cf63&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2F201503%2F19%2F211608ztcq7higicydxhsy.jpg', title: '标题', desc: '描述' },
113
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=8610f1678b51e26de6d4c6af39d1cf63&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2F201503%2F19%2F211608ztcq7higicydxhsy.jpg', title: '标题', desc: '描述' },
114
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=8610f1678b51e26de6d4c6af39d1cf63&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2F201503%2F19%2F211608ztcq7higicydxhsy.jpg', title: '标题', desc: '描述' },
115
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=8610f1678b51e26de6d4c6af39d1cf63&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2F201503%2F19%2F211608ztcq7higicydxhsy.jpg', title: '标题', desc: '描述' }
116
+      ],
117
+      OwnerList: [
118
+        { icon: 'iconjiaofei', name: '物业缴费', id: 1 },
119
+        { icon: 'icontongzhi', name: '物业通知', id: 2 },
120
+        { icon: 'iconbaoxiu', name: '物业报修', id: 3 },
121
+        { icon: 'iconrenzheng', name: '业主认证', id: 4 }
122
+      ],
123
+      NavList: [
124
+        { icon: 'iconhuodong1', name: '活动', id: 1 },
125
+        { icon: 'iconfuli', name: '福利', id: 2 },
126
+        { icon: 'iconfuwu', name: '服务', id: 3 },
127
+        { icon: 'iconxinwen', name: '资讯', id: 4 }
128
+      ],
129
+      TestImg: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=8610f1678b51e26de6d4c6af39d1cf63&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2F201503%2F19%2F211608ztcq7higicydxhsy.jpg',
130
+      BannerList: [
131
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=8610f1678b51e26de6d4c6af39d1cf63&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2F201503%2F19%2F211608ztcq7higicydxhsy.jpg' },
132
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=16024dc7edcdbb6c325d40cdff6373a1&imgtype=0&src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201408%2F07%2F213601f2xz7usscm2z1mjh.jpg' },
133
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989360&di=3f54f5330ec21728ecb02352fbb6af90&imgtype=0&src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201205%2F15%2F152011zser9o5oa9ee9xx6.jpg' },
134
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989359&di=46ae1d0f0d4f1f3740139191398f2a81&imgtype=0&src=http%3A%2F%2Fpic.baike.soso.com%2Fp%2F20131230%2F20131230165604-1960511167.jpg' },
135
+        { img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606120989359&di=2ec3fe46fb98c01055601cece86f111f&imgtype=0&src=http%3A%2F%2Fbenyouhuifile.it168.com%2Fforum%2Fday_100429%2F1004291840008539c8ac02cd5c.jpg' }
136
+      ]
137
+    }
138
+  },
139
+  computed: {
140
+    ...mapUserState({
141
+      UserInfo: x => x.UserInfo // 用户信息
142
+    })
143
+  },
144
+  components: {
145
+    NavHeader
146
+  },
147
+  created () {
148
+  },
149
+  methods: {
150
+    ...mapUserActions([
151
+    ]),
152
+    ...mapUserMutations([
153
+    ]),
154
+    Init () {
155
+    },
156
+    OnRefresh (e) {
157
+      this.IsPull = true
158
+      window.setTimeout(() => {
159
+        this.IsPull = false
160
+      }, 1000)
161
+    }
162
+  }
163
+}
164
+</script>
165
+
166
+<style lang="scss">
167
+@import "page.scss";
168
+</style>

+ 334
- 0
src/pages/ShouYe/page.scss Näytä tiedosto

@@ -0,0 +1,334 @@
1
+.page.ShouYe {
2
+  width: 100%;
3
+  height: 100%;
4
+  overflow: hidden;
5
+  background: #f8f8f8;
6
+  > view {
7
+    position: relative;
8
+    &.flex-item {
9
+      > .PageContainer {
10
+        width: 100%;
11
+        position: relative;
12
+        z-index: 2;
13
+        height: 100%;
14
+        overflow: hidden;
15
+        .Content {
16
+          position: relative;
17
+          overflow: hidden;
18
+          > view {
19
+            position: relative;
20
+            z-index: 2;
21
+            &.TopBg {
22
+              width: 100%;
23
+              position: absolute;
24
+              z-index: 1;
25
+              left: 0;
26
+              top: 0;
27
+              padding-bottom: 60%;
28
+              border-radius: 0 0 100px 100px;
29
+              background-image: linear-gradient(#f35844, #ff8d61);
30
+              z-index: 1;
31
+            }
32
+            > .Welcome {
33
+              display: block;
34
+              font-size: 30px;
35
+              color: #fff;
36
+              margin-top: 60px;
37
+              text-indent: 30px;
38
+            }
39
+            > .BannerContainer {
40
+              padding: 0 30px;
41
+              position: relative;
42
+              overflow: hidden;
43
+              margin-top: 50px;
44
+              > view {
45
+                width: 100%;
46
+                position: relative;
47
+                overflow: hidden;
48
+                padding-bottom: 50%;
49
+                background: #f8f8f8;
50
+                border-radius: 24px;
51
+                height: 0;
52
+                > view {
53
+                  width: 100%;
54
+                  position: absolute;
55
+                  left: 0;
56
+                  top: 0;
57
+                  bottom: 0;
58
+                  overflow: hidden;
59
+                  > .BannerSwiper {
60
+                    width: 100%;
61
+                    height: 100%;
62
+                    position: relative;
63
+                    overflow: hidden;
64
+                    .BannerItem {
65
+                      width: 100%;
66
+                      height: 100%;
67
+                      position: relative;
68
+                      overflow: hidden;
69
+                      > image {
70
+                        width: 100%;
71
+                        height: 100%;
72
+                      }
73
+                    }
74
+                  }
75
+                }
76
+              }
77
+            }
78
+            > .NavContainer {
79
+              position: relative;
80
+              overflow: hidden;
81
+              align-items: center;
82
+              padding: 0 30px;
83
+              margin-top: 40px;
84
+              > view {
85
+                margin-left: 30px;
86
+                position: relative;
87
+                overflow: hidden;
88
+                &:first-child {
89
+                  margin-left: 0;
90
+                }
91
+                &:nth-child(1) {
92
+                  > view {
93
+                    > view {
94
+                      > text {
95
+                        &:first-child {
96
+                          color: #ffc412;
97
+                        }
98
+                      }
99
+                    }
100
+                  }
101
+                }
102
+                &:nth-child(2) {
103
+                  > view {
104
+                    > view {
105
+                      > text {
106
+                        &:first-child {
107
+                          color: #fb3fc8;
108
+                        }
109
+                      }
110
+                    }
111
+                  }
112
+                }
113
+                &:nth-child(3) {
114
+                  > view {
115
+                    > view {
116
+                      > text {
117
+                        &:first-child {
118
+                          color: #fb7820;
119
+                        }
120
+                      }
121
+                    }
122
+                  }
123
+                }
124
+                &:nth-child(4) {
125
+                  > view {
126
+                    > view {
127
+                      > text {
128
+                        &:first-child {
129
+                          color: #586ff8;
130
+                        }
131
+                      }
132
+                    }
133
+                  }
134
+                }
135
+                > view {
136
+                  width: 100%;
137
+                  padding-bottom: 100%;
138
+                  background: #fff;
139
+                  position: relative;
140
+                  overflow: hidden;
141
+                  border-radius: 12px;
142
+                  > view {
143
+                    width: 100%;
144
+                    > text {
145
+                      display: block;
146
+                      text-align: center;
147
+                      line-height: 40px;
148
+                      color: #333;
149
+                      font-size: 26px;
150
+                      &:first-child {
151
+                        font-size: 50px;
152
+                        line-height: 60px;
153
+                        margin-bottom: 10px;
154
+                      }
155
+                    }
156
+                  }
157
+                }
158
+              }
159
+            }
160
+            > .HotActivityContainer {
161
+              padding: 0 30px;
162
+              position: relative;
163
+              overflow: hidden;
164
+              margin-top: 30px;
165
+              > view {
166
+                width: 100%;
167
+                position: relative;
168
+                overflow: hidden;
169
+                border-radius: 40px;
170
+                background: #fff;
171
+                > .Title {
172
+                  font-size: 0;
173
+                  white-space: nowrap;
174
+                  text-align: center;
175
+                  padding: 30px 0;
176
+                  > text {
177
+                    display: inline-block;
178
+                    vertical-align: middle;
179
+                    font-size: 24px;
180
+                    color: #999;
181
+                    &:first-child {
182
+                      font-size: 34px;
183
+                      color: #333;
184
+                      line-height: 40px;
185
+                      font-weight: bold;
186
+                      margin-right: 20px;
187
+                    }
188
+                  }
189
+                }
190
+                > .Activity {
191
+                  width: 100%;
192
+                  padding-bottom: 33.33%;
193
+                  position: relative;
194
+                  overflow: hidden;
195
+                  > image {
196
+                    width: 100%;
197
+                    height: 100%;
198
+                  }
199
+                }
200
+              }
201
+            }
202
+            > .OwnerContainer {
203
+              padding: 0 30px;
204
+              position: relative;
205
+              overflow: hidden;
206
+              margin-top: 30px;
207
+              > view {
208
+                width: 100%;
209
+                position: relative;
210
+                overflow: hidden;
211
+                border-radius: 40px;
212
+                background: #fff;
213
+                > .Title {
214
+                  font-size: 0;
215
+                  white-space: nowrap;
216
+                  text-align: center;
217
+                  padding: 30px 0;
218
+                  > text {
219
+                    display: inline-block;
220
+                    vertical-align: middle;
221
+                    font-size: 24px;
222
+                    color: #999;
223
+                    &:first-child {
224
+                      font-size: 34px;
225
+                      color: #333;
226
+                      line-height: 40px;
227
+                      font-weight: bold;
228
+                      margin-right: 20px;
229
+                    }
230
+                  }
231
+                }
232
+                > .OwnerList {
233
+                  border-top: 2px solid #f8f8f8;
234
+                  align-items: center;
235
+                  padding: 30px 0;
236
+                  > view {
237
+                    > text {
238
+                      display: block;
239
+                      width: 100%;
240
+                      text-align: center;
241
+                      font-size: 26px;
242
+                      color: #333;
243
+                      line-height: 40px;
244
+                      &:first-child {
245
+                        color: #f35844;
246
+                        font-size: 60px;
247
+                        line-height: 70px;
248
+                        margin-bottom: 10px;
249
+                      }
250
+                    }
251
+                  }
252
+                }
253
+              }
254
+            }
255
+            > .NewsContainer {
256
+              padding: 0 30px;
257
+              position: relative;
258
+              overflow: hidden;
259
+              margin-top: 30px;
260
+              > view {
261
+                position: relative;
262
+                overflow: hidden;
263
+                background: #fff;
264
+                border-radius: 40px;
265
+                > .Title {
266
+                  align-items: center;
267
+                  padding: 0 20px;
268
+                  > text {
269
+                    font-size: 24px;
270
+                    color: #666;
271
+                    line-height: 98px;
272
+                    margin-left: 10px;
273
+                    &:first-child {
274
+                      font-size: 30px;
275
+                      color: #333;
276
+                    }
277
+                  }
278
+                }
279
+                > .List {
280
+                  > view {
281
+                    align-items: center;
282
+                    border-top: 2px solid #f8f8f8;
283
+                    padding: 30px 20px;
284
+                    position: relative;
285
+                    overflow: hidden;
286
+                    &:first-child {
287
+                      border-top: none;
288
+                    }
289
+                    > .Img {
290
+                      width: 160px;
291
+                      height: 128px;
292
+                      position: relative;
293
+                      overflow: hidden;
294
+                      background: #f8f8f8;
295
+                      margin-right: 20px;
296
+                      > image {
297
+                        width: 100%;
298
+                        height: 100%;
299
+                      }
300
+                    }
301
+                    > .flex-item {
302
+                      position: relative;
303
+                      overflow: hidden;
304
+                      > text {
305
+                        display: block;
306
+                        font-size: 26px;
307
+                        color: #666;
308
+                        line-height: 40px;
309
+                        &:first-child {
310
+                          font-size: 30px;
311
+                          color: #333;
312
+                          margin-bottom: 10px;
313
+                        }
314
+                        &:last-child {
315
+                          white-space: nowrap;
316
+                          overflow: hidden;
317
+                          text-overflow: ellipsis;
318
+                        }
319
+                      }
320
+                    }
321
+                  }
322
+                }
323
+              }
324
+            }
325
+            > .PageBottom {
326
+              width: 100%;
327
+              height: 30px;
328
+            }
329
+          }
330
+        }
331
+      }
332
+    }
333
+  }
334
+}

+ 3
- 0
src/pages/SignIn/index.config.js Näytä tiedosto

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '香颂蔚澜'
3
+}

+ 39
- 0
src/pages/SignIn/index.vue Näytä tiedosto

@@ -0,0 +1,39 @@
1
+<template>
2
+  <view class="page DengLu">
3
+    登录页
4
+  </view>
5
+</template>
6
+
7
+<script>
8
+import { createNamespacedHelpers } from 'vuex'
9
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
10
+export default {
11
+  name: 'DengLu',
12
+  data () {
13
+    return {
14
+      DataLock: false
15
+    }
16
+  },
17
+  computed: {
18
+    ...mapUserState({
19
+      UserInfo: x => x.UserInfo // 用户信息
20
+    })
21
+  },
22
+  components: {
23
+  },
24
+  created () {
25
+  },
26
+  methods: {
27
+    ...mapUserActions([
28
+    ]),
29
+    ...mapUserMutations([
30
+    ]),
31
+    Init () {
32
+    }
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss">
38
+@import "page.scss";
39
+</style>

+ 6
- 0
src/pages/SignIn/page.scss Näytä tiedosto

@@ -0,0 +1,6 @@
1
+.page.DengLu {
2
+  width: 100%;
3
+  height: 100%;
4
+  overflow-y: scroll;
5
+  background: #fff;
6
+}

+ 3
- 0
src/pages/WoDe/index.config.js Näytä tiedosto

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '香颂蔚澜'
3
+}

+ 39
- 0
src/pages/WoDe/index.vue Näytä tiedosto

@@ -0,0 +1,39 @@
1
+<template>
2
+  <view class="page WoDe">
3
+    我的
4
+  </view>
5
+</template>
6
+
7
+<script>
8
+import { createNamespacedHelpers } from 'vuex'
9
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
10
+export default {
11
+  name: 'WoDe',
12
+  data () {
13
+    return {
14
+      DataLock: false
15
+    }
16
+  },
17
+  computed: {
18
+    ...mapUserState({
19
+      UserInfo: x => x.UserInfo // 用户信息
20
+    })
21
+  },
22
+  components: {
23
+  },
24
+  created () {
25
+  },
26
+  methods: {
27
+    ...mapUserActions([
28
+    ]),
29
+    ...mapUserMutations([
30
+    ]),
31
+    Init () {
32
+    }
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss">
38
+@import "page.scss";
39
+</style>

+ 6
- 0
src/pages/WoDe/page.scss Näytä tiedosto

@@ -0,0 +1,6 @@
1
+.page.WoDe {
2
+  width: 100%;
3
+  height: 100%;
4
+  overflow-y: scroll;
5
+  background: #fff;
6
+}

+ 3
- 0
src/pages/WuYe/index.config.js Näytä tiedosto

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '香颂蔚澜'
3
+}

+ 39
- 0
src/pages/WuYe/index.vue Näytä tiedosto

@@ -0,0 +1,39 @@
1
+<template>
2
+  <view class="page WuYe">
3
+    物业
4
+  </view>
5
+</template>
6
+
7
+<script>
8
+import { createNamespacedHelpers } from 'vuex'
9
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
10
+export default {
11
+  name: 'WuYe',
12
+  data () {
13
+    return {
14
+      DataLock: false
15
+    }
16
+  },
17
+  computed: {
18
+    ...mapUserState({
19
+      UserInfo: x => x.UserInfo // 用户信息
20
+    })
21
+  },
22
+  components: {
23
+  },
24
+  created () {
25
+  },
26
+  methods: {
27
+    ...mapUserActions([
28
+    ]),
29
+    ...mapUserMutations([
30
+    ]),
31
+    Init () {
32
+    }
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss">
38
+@import "page.scss";
39
+</style>

+ 6
- 0
src/pages/WuYe/page.scss Näytä tiedosto

@@ -0,0 +1,6 @@
1
+.page.WuYe {
2
+  width: 100%;
3
+  height: 100%;
4
+  overflow-y: scroll;
5
+  background: #fff;
6
+}

+ 33
- 0
src/store.js Näytä tiedosto

@@ -0,0 +1,33 @@
1
+import Vue from 'vue'
2
+import Vuex from 'vuex'
3
+
4
+Vue.use(Vuex)
5
+
6
+const state = {
7
+  numbers: [1, 2, 3]
8
+}
9
+
10
+const mutations = {
11
+  ADD_NUMBER(state, payload) {
12
+    state.numbers.push(payload)
13
+  }
14
+}
15
+
16
+const actions = {
17
+  addNumber(context, number) {
18
+    context.commit('ADD_NUMBER', number)
19
+  }
20
+}
21
+
22
+const getters = {
23
+  getNumbers(state) {
24
+    return state.numbers
25
+  }
26
+}
27
+
28
+export default new Vuex.Store({
29
+  state,
30
+  mutations,
31
+  actions,
32
+  getters
33
+})

+ 26
- 0
src/store/index.js Näytä tiedosto

@@ -0,0 +1,26 @@
1
+import Vue from 'vue'
2
+import Vuex from 'vuex'
3
+import { storeAuthPlugin } from '@/util/auth-plugin'
4
+
5
+Vue.use(Vuex)
6
+
7
+const store = new Vuex.Store({
8
+  plugins: [storeAuthPlugin],
9
+  state: {
10
+  },
11
+  mutations: {
12
+  }
13
+})
14
+
15
+export const modules = {
16
+  user: () => require('./user/index').default,
17
+  index: () => require('./index/index').default
18
+}
19
+
20
+Object.keys(modules).forEach(modKey => {
21
+  const modNS = modKey.split('/')
22
+  const getMod = modules[modKey]
23
+  store.registerModule(...modNS, getMod())
24
+})
25
+
26
+export default store

+ 13
- 0
src/store/index/index.js Näytä tiedosto

@@ -0,0 +1,13 @@
1
+
2
+// import Api from '../../util/Api/index'
3
+// import ToolClass from '../../util/PublicMethod/index'
4
+
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+  },
9
+  mutations: {
10
+  },
11
+  actions: {
12
+  }
13
+}

+ 35
- 0
src/store/user/index.js Näytä tiedosto

@@ -0,0 +1,35 @@
1
+
2
+// import Api from '../../util/Api/index'
3
+// import ToolClass from '../../util/PublicMethod/index'
4
+
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+    UserInfo: null // 用户信息
9
+  },
10
+  mutations: {
11
+    EditUserInfo (state, data) { // 编辑用户信息
12
+      state.UserInfo = {
13
+        ...state.UserInfo || {},
14
+        [data.name]: data.value
15
+      }
16
+    }
17
+  },
18
+  actions: {
19
+    // UpdateUserInfo (context, payload) { // 更新用户信息
20
+    //   return new Promise((resolve, reject) => {
21
+    //     ToolClass.WxRequest({
22
+    //       url: Api.UpdateUserInfo.url,
23
+    //       method: Api.UpdateUserInfo.method,
24
+    //       ...payload,
25
+    //       success (res) {
26
+    //         resolve(res)
27
+    //       },
28
+    //       error (res) {
29
+    //         reject(res)
30
+    //       }
31
+    //     })
32
+    //   })
33
+    // }
34
+  }
35
+}

+ 290
- 0
src/towxml/config.js Näytä tiedosto

@@ -0,0 +1,290 @@
1
+module.exports = {
2
+    // LaTex公式、yuml解析服务架设参见 https://github.com/sbfkcel/markdown-server
3
+
4
+    // // 数学公式解析API
5
+    // latex:{
6
+    //     api:'http://towxml.vvadd.com/?tex'
7
+    // },
8
+
9
+    // // yuml图解析APPI
10
+    // yuml:{
11
+    //     api:'http://towxml.vvadd.com/?yuml'
12
+    // },
13
+
14
+    // markdown解析配置,保留需要的选项即可
15
+    markdown:[
16
+        'sub',                      // 下标支持
17
+        'sup',                      // 上标支持
18
+        'ins',                      // 文本删除线支持
19
+        'mark',                     // 文本高亮支持
20
+        'emoji',                    // emoji表情支持
21
+        'todo'                      // todo支持
22
+    ],
23
+
24
+    // 代码高亮配置,保留需要的选项即可(尽量越少越好,不要随意调整顺序。部分高亮有顺序依赖)
25
+    highlight:[
26
+        // 'c-like',
27
+        // 'c',
28
+        // 'bash',
29
+        // 'css',
30
+        // 'dart',
31
+        // 'go',
32
+        // 'java',
33
+        // 'javascript',
34
+        // 'json',
35
+        // 'less',
36
+        // 'scss',
37
+        // 'shell',
38
+        // 'xml',
39
+        // 'htmlbars',
40
+        // 'nginx',
41
+        // 'php',
42
+        // 'python',
43
+        // 'python-repl',
44
+        // 'typescript',
45
+        
46
+        // 'csharp',
47
+        // 'http',
48
+        // 'swift',
49
+        // 'yaml',
50
+        // 'markdown',
51
+        // 'powershell',
52
+        // 'ruby',
53
+        // 'makefile',
54
+        // 'lua',
55
+        // 'stylus',
56
+        // 'basic',
57
+        // '1c',
58
+        // 'abnf',
59
+        // 'accesslog',
60
+        // 'actionscript',
61
+        // 'ada',
62
+        // 'angelscript',
63
+        // 'apache',
64
+        // 'applescript',
65
+        // 'arcade',
66
+        // 'cpp',
67
+        // 'arduino',
68
+        // 'armasm',
69
+        // 'asciidoc',
70
+        // 'aspectj',
71
+        // 'autohotkey',
72
+        // 'autoit',
73
+        // 'avrasm',
74
+        // 'awk',
75
+        // 'axapta',
76
+        // 'bnf',
77
+        // 'brainfuck',
78
+        // 'cal',
79
+        // 'capnproto',
80
+        // 'ceylon',
81
+        // 'clean',
82
+        // 'clojure-repl',
83
+        // 'clojure',
84
+        // 'cmake',
85
+        // 'coffeescript',
86
+        // 'coq',
87
+        // 'cos',
88
+        // 'crmsh',
89
+        // 'crystal',
90
+        // 'csp',
91
+        // 'd',
92
+        // 'delphi',
93
+        // 'diff',
94
+        // 'django',
95
+        // 'dns',
96
+        // 'dockerfile',
97
+        // 'dos',
98
+        // 'dsconfig',
99
+        // 'dts',
100
+        // 'dust',
101
+        // 'ebnf',
102
+        // 'elixir',
103
+        // 'elm',
104
+        // 'erb',
105
+        // 'erlang-repl',
106
+        // 'erlang',
107
+        // 'excel',
108
+        // 'fix',
109
+        // 'flix',
110
+        // 'fortran',
111
+        // 'fsharp',
112
+        // 'gams',
113
+        // 'gauss',
114
+        // 'gcode',
115
+        // 'gherkin',
116
+        // 'glsl',
117
+        // 'gml',
118
+        // 'golo',
119
+        // 'gradle',
120
+        // 'groovy',
121
+        // 'haml',
122
+        // 'handlebars',
123
+        // 'haskell',
124
+        // 'haxe',
125
+        // 'hsp',
126
+        // 'hy',
127
+        // 'inform7',
128
+        // 'ini',
129
+        // 'irpf90',
130
+        // 'isbl',
131
+        // 'jboss-cli',
132
+        // 'julia-repl',
133
+        // 'julia',
134
+        // 'kotlin',
135
+        // 'lasso',
136
+        // 'latex',
137
+        // 'ldif',
138
+        // 'leaf',
139
+        // 'lisp',
140
+        // 'livecodeserver',
141
+        // 'livescript',
142
+        // 'llvm',
143
+        // 'lsl',
144
+        // 'mathematica',
145
+        // 'matlab',
146
+        // 'maxima',
147
+        // 'mel',
148
+        // 'mercury',
149
+        // 'mipsasm',
150
+        // 'mizar',
151
+        // 'mojolicious',
152
+        // 'monkey',
153
+        // 'moonscript',
154
+        // 'n1ql',
155
+        // 'nim',
156
+        // 'nix',
157
+        // 'nsis',
158
+        // 'objectivec',
159
+        // 'ocaml',
160
+        // 'openscad',
161
+        // 'oxygene',
162
+        // 'parser3',
163
+        // 'perl',
164
+        // 'pf',
165
+        // 'pgsql',
166
+        // 'php-template',
167
+        // 'plaintext',
168
+        // 'pony',
169
+        // 'processing',
170
+        // 'profile',
171
+        // 'prolog',
172
+        // 'properties',
173
+        // 'protobuf',
174
+        // 'puppet',
175
+        // 'purebasic',
176
+        // 'q',
177
+        // 'qml',
178
+        // 'r',
179
+        // 'reasonml',
180
+        // 'rib',
181
+        // 'roboconf',
182
+        // 'routeros',
183
+        // 'rsl',
184
+        // 'ruleslanguage',
185
+        // 'rust',
186
+        // 'sas',
187
+        // 'scala',
188
+        // 'scheme',
189
+        // 'scilab',
190
+        // 'smali',
191
+        // 'smalltalk',
192
+        // 'sml',
193
+        // 'sqf',
194
+        // 'sql',
195
+        // 'stan',
196
+        // 'stata',
197
+        // 'step21',
198
+        // 'subunit',
199
+        // 'taggerscript',
200
+        // 'tap',
201
+        // 'tcl',
202
+        // 'thrift',
203
+        // 'tp',
204
+        // 'twig',
205
+        // 'vala',
206
+        // 'vbnet',
207
+        // 'vbscript-html',
208
+        // 'vbscript',
209
+        // 'verilog',
210
+        // 'vhdl',
211
+        // 'vim',
212
+        // 'x86asm',
213
+        // 'xl',
214
+        // 'xquery',
215
+        // 'zephir'
216
+    ],
217
+
218
+    // wxml原生标签,该系列标签将不会被转换
219
+    wxml:[
220
+        'view',
221
+        'video',
222
+        'text',
223
+        'image',
224
+        'navigator',
225
+        'swiper',
226
+        'swiper-item',
227
+        'block',
228
+        'form',
229
+        'input',
230
+        'textarea',
231
+        'button',
232
+        'checkbox-group',
233
+        'checkbox',
234
+        'radio-group',
235
+        'radio',
236
+
237
+        // 可以解析的标签(html或markdown中会很少使用)
238
+        // 'canvas',
239
+        // 'map',
240
+        // 'slider',
241
+        // 'scroll-view',
242
+        // 'movable-area',
243
+        // 'movable-view',
244
+        // 'progress',
245
+        // 'label',
246
+        // 'switch',
247
+        // 'picker',
248
+        // 'picker-view',
249
+        // 'switch',
250
+        // 'contact-button'
251
+    ],
252
+
253
+    // 自定义组件
254
+    components:[
255
+        // 'audio-player',             // 音频组件,建议保留,由于小程序原生audio存在诸多问题,towxml解决了原生音频播放器的相关问题
256
+        // 'echarts',                  // echarts图表支持
257
+        // 'latex',                    // 数学公式支持
258
+        'table',                    // 表格支持
259
+        'todogroup',                // todo支持
260
+        // 'yuml',                     // yuml图表支持
261
+        'img'                       // 图片解析组件
262
+    ],
263
+
264
+    // 保留原本的元素属性(建议不要变动)
265
+    attrs:[
266
+        'class',
267
+        'data',
268
+        'id',
269
+        'style'
270
+    ],
271
+
272
+    // 事件绑定方式(catch或bind),catch 会阻止事件向上冒泡。更多请参考:https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/event.html
273
+    bindType:'catch',
274
+
275
+    // 需要激活的事件
276
+    events:[
277
+        // 'touchstart',
278
+        // 'touchmove',
279
+        // 'touchcancel',
280
+        // 'touchend',
281
+        'tap',                      // 用于元素的点击事件
282
+        'change',                   // 用于todoList的change事件
283
+    ],
284
+
285
+    // 图片倍数
286
+    dpr:1,
287
+
288
+    // 代码块显示行号
289
+    showLineNumber:true
290
+}

+ 26
- 0
src/towxml/decode.js Näytä tiedosto

@@ -0,0 +1,26 @@
1
+const config = require('./config');
2
+
3
+Component({
4
+	options: {
5
+		styleIsolation: 'apply-shared'
6
+	},
7
+	properties: {
8
+		nodes: {
9
+			type: Object,
10
+			value: {}
11
+		}
12
+	},
13
+	lifetimes: {
14
+		attached: function () {
15
+			const _ts = this;
16
+
17
+			config.events.forEach(item => {
18
+				_ts['_' + item] = function (...arg) {
19
+					if (global._events && typeof global._events[item] === 'function') {
20
+						global._events[item](...arg);
21
+					}
22
+				};
23
+			});
24
+		}
25
+	}
26
+})

+ 9
- 0
src/towxml/decode.json Näytä tiedosto

@@ -0,0 +1,9 @@
1
+{
2
+  "component": true,
3
+  "usingComponents": {
4
+    "decode": "/towxml/decode",
5
+    "table": "/towxml/table/table",
6
+    "todogroup": "/towxml/todogroup/todogroup",
7
+    "img": "/towxml/img/img"
8
+  }
9
+}

+ 1
- 0
src/towxml/decode.wxml Näytä tiedosto

@@ -0,0 +1 @@
1
+<block wx:for="{{nodes.child}}" wx:for-index="i" wx:for-item="item" wx:key="i"><block wx:if="{{item.tag===undefined}}">{{item.text}}</block><view wx:if="{{item.tag==='view'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></view><video wx:if="{{item.tag==='video'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap" poster="{{item.attr.poster}}" src="{{item.attr.src}}"><decode wx:if="{{item.child}}" nodes="{{item}}"/></video><text wx:if="{{item.tag==='text'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></text><image wx:if="{{item.tag==='image'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap" src="{{item.attr.src}}" mode="{{item.attr.mode ? item.attr.mode : 'widthFix'}}" lazy-load="{{item.attr['lazy-load']}}"><decode wx:if="{{item.child}}" nodes="{{item}}"/></image><navigator wx:if="{{item.tag==='navigator'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap" url="{{item.attr.href}}"><decode wx:if="{{item.child}}" nodes="{{item}}"/></navigator><swiper wx:if="{{item.tag==='swiper'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></swiper><swiper-item wx:if="{{item.tag==='swiper-item'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></swiper-item><block wx:if="{{item.tag==='block'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></block><form wx:if="{{item.tag==='form'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></form><input wx:if="{{item.tag==='input'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></input><textarea wx:if="{{item.tag==='textarea'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></textarea><button wx:if="{{item.tag==='button'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></button><checkbox-group wx:if="{{item.tag==='checkbox-group'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap" catch:change="_change" bindchange="{{item.attr.bindchange}}"><decode wx:if="{{item.child}}" nodes="{{item}}"/></checkbox-group><checkbox wx:if="{{item.tag==='checkbox'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap" checked="{{item.attr.checked}}" value="{{item.attr.value}}"><decode wx:if="{{item.child}}" nodes="{{item}}"/></checkbox><radio-group wx:if="{{item.tag==='radio-group'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap"><decode wx:if="{{item.child}}" nodes="{{item}}"/></radio-group><radio wx:if="{{item.tag==='radio'}}" data-data="{{item}}" class="{{item.attr.class}}" data="{{item.attr.data}}" id="{{item.attr.id}}" style="{{item.attr.style}}" catch:tap="_tap" checked="{{item.attr.checked}}"><decode wx:if="{{item.child}}" nodes="{{item}}"/></radio><block wx:if="{{item.tag==='table'}}"><table data="{{item}}" data-data="{{item}}" catch:tap="_tap"/></block><block wx:if="{{item.tag==='todogroup'}}"><todogroup data="{{item}}" data-data="{{item}}" catch:tap="_tap"/></block><block wx:if="{{item.tag==='img'}}"><img data="{{item}}" data-data="{{item}}" catch:tap="_tap"/></block></block>

+ 0
- 0
src/towxml/decode.wxss Näytä tiedosto


+ 98
- 0
src/towxml/img/img.js Näytä tiedosto

@@ -0,0 +1,98 @@
1
+const config = require('../config');
2
+Component({
3
+	options: {
4
+		styleIsolation: 'shared'
5
+	},
6
+	properties: {
7
+		data: {
8
+			type: Object,
9
+			value: {}
10
+		}
11
+	},
12
+	data: {
13
+		attr:{
14
+			src:'',
15
+			class:'',
16
+			style:''
17
+		},
18
+		size:{
19
+			w:0,
20
+			h:0
21
+		},
22
+		styleObj:{}
23
+	},
24
+	lifetimes:{
25
+		attached:function(){
26
+			const _ts = this;
27
+			let dataAttr = this.data.data.attr;
28
+
29
+			// 将图片大小处理到对象中
30
+			if(dataAttr.width){
31
+				_ts.data.size.w = +dataAttr.width / config.dpr;
32
+			};
33
+
34
+			if(dataAttr.height){
35
+				_ts.data.size.h = +dataAttr.height / config.dpr;
36
+			};
37
+
38
+			// 将样式合并到样式对象中
39
+			if(dataAttr.style){
40
+				let re = /;\s{0,}/ig;
41
+				dataAttr.style = dataAttr.style.replace(re,';');
42
+				dataAttr.style.split(';').forEach(item => {
43
+					let itemArr = item.split(':');
44
+					if(/^(width|height)$/i.test(itemArr[0])){
45
+						let num = parseInt(itemArr[1]) || 0,
46
+							key = '';
47
+						// itemArr[1] = num / config.dpr + itemArr[1].replace(num,'');
48
+						switch (itemArr[0].toLocaleLowerCase()) {
49
+							case 'width':
50
+								key = 'w';
51
+							break;
52
+							case 'height':
53
+								key = 'h';
54
+							break;
55
+						};
56
+						_ts.data.size[key] = num / config.dpr;
57
+					}else{
58
+						_ts.data.styleObj[itemArr[0]] = itemArr[1];
59
+					};
60
+				});
61
+			};
62
+
63
+			// 设置公式图片
64
+			_ts.setData({
65
+				attr:{
66
+					src:dataAttr.src,
67
+					class:dataAttr.class,
68
+					style:_ts.setStyle(_ts.data.styleObj)
69
+				},
70
+				size:_ts.data.size
71
+			});
72
+		}
73
+	},
74
+	methods: {
75
+		// 设置图片样式
76
+		setStyle:function(o){
77
+			let str = ``;
78
+			for(let key in o){
79
+				str += `${key}:${o[key]};`;
80
+			};
81
+			return str;
82
+		},
83
+
84
+		// 图片加载完成设置图片大小
85
+		load:function(e){
86
+			const _ts = this;
87
+
88
+			if(!_ts.data.size.w || !_ts.data.size.h){
89
+				_ts.setData({
90
+					size:{
91
+						w:e.detail.width / config.dpr,
92
+						h:e.detail.height / config.dpr
93
+					}
94
+				});
95
+			};
96
+		}
97
+	}
98
+})

+ 3
- 0
src/towxml/img/img.json Näytä tiedosto

@@ -0,0 +1,3 @@
1
+{
2
+  "component": true
3
+}

+ 1
- 0
src/towxml/img/img.wxml Näytä tiedosto

@@ -0,0 +1 @@
1
+<image class="{{attr.class}}" lazy-load="true" mode="{{attr.mode || 'widthFix'}}" src="{{attr.src}}" style="{{attr.style}} width:{{size.w}}px;height:{{size.h}}px;" bindload="load"></image>

+ 0
- 0
src/towxml/img/img.wxss Näytä tiedosto


+ 19
- 0
src/towxml/index.js Näytä tiedosto

@@ -0,0 +1,19 @@
1
+const md = require('./parse/markdown/index'),
2
+    parse = require('./parse/index')
3
+
4
+module.exports = (str,type,option)=>{
5
+    option = option || {};
6
+    let result;
7
+    switch (type) {
8
+        case 'markdown':
9
+            result = parse(md(str),option);
10
+        break;
11
+        case 'html':
12
+            result = parse(str,option);
13
+        break;
14
+        default:
15
+            throw new Error('Invalid type, only markdown and html are supported');
16
+        break;
17
+    };
18
+    return result;
19
+};

+ 107
- 0
src/towxml/parse/index.js Näytä tiedosto

@@ -0,0 +1,107 @@
1
+const parse2 = require('./parse2/index'),
2
+    // parse5 = require('./parse5/index').parse,
3
+    config = require('../config'),
4
+
5
+    // html与wxml转换关系
6
+    correspondTag = (()=>{
7
+        let result = {
8
+                a:'navigator',
9
+                todogroup:'checkbox-group',
10
+                audio:'audio-player'
11
+            };
12
+        
13
+        // // 该系列的标签都转换为text
14
+        // ['span','b','strong','i','em','code','sub','sup','g-emoji','mark','ins'].forEach(item => {
15
+        //     result[item] = 'text';
16
+        // });
17
+
18
+        // 该系列小程序原生tag,不需转换
19
+        [...config.wxml,...config.components].forEach(item => {
20
+            result[item] = item;
21
+        });
22
+        return result;
23
+    })(),
24
+
25
+    // 元素与html对应的wxml标签名
26
+    getWxmlTag = tagStr => !tagStr ? undefined : correspondTag[tagStr] || 'view',
27
+
28
+    // 精简数据,并初始化相关事件等
29
+    initObj = (obj,option)=>{
30
+        const result = {
31
+                theme:option.theme || 'light',
32
+                _e:{}
33
+            },
34
+            events = global._events = {},
35
+            base = option.base;
36
+
37
+        // 主题保存到全局
38
+        global._theme = result.theme;
39
+
40
+        // 事件添加到全局中,各个组件在触发事件时会从全局调用
41
+        if(option.events){
42
+            for(let key in option.events){
43
+                events[key] = option.events[key];
44
+            };
45
+        };
46
+
47
+        // 遍历原始数据,处理成能解析的数据
48
+        let eachFn;
49
+        (eachFn = (arr,obj,_e) => {
50
+            obj.child = obj.child || [];
51
+            _e.child = _e.child || [];
52
+
53
+            arr.forEach(item => {
54
+                if(item.type === 'comment'){
55
+                    return;
56
+                };
57
+                let o = {},
58
+                    e = {};
59
+                o.type = e.type = item.type;
60
+                o._e = e;
61
+                if(item.type === 'text'){
62
+                    o.text = e.text = item.data;
63
+                }else{
64
+                    o.tag = getWxmlTag(item.name);      // 转换之后的标签
65
+                    // o.tag = o.tag === 'text' ? 'view' : o.tag;
66
+                    e.tag = item.name;                  // 原始
67
+                    o.attr = item.attribs;
68
+                    e.attr = JSON.parse(JSON.stringify(item.attribs));
69
+
70
+                    o.attr.class = o.attr.class ? `h2w__${item.name} ${o.attr.class}` : `h2w__${item.name}`;
71
+
72
+                    // 处理资源相对路径
73
+                    if(base && o.attr.src){
74
+                        let src = o.attr.src;
75
+                        switch (src.indexOf('//')) {
76
+                            case 0:
77
+                                o.attr.src = `https:${src}`;
78
+                            break;
79
+                            case -1:
80
+                                o.attr.src = `${base}${src}`;
81
+                            break;
82
+                        };
83
+                    };
84
+
85
+                    if(item.children){
86
+                        eachFn(item.children,o,e);
87
+                    };
88
+                };
89
+                _e.child.push(e);
90
+                obj.child.push(o);
91
+            });
92
+        })(obj,result,result._e);
93
+        return result;
94
+    };
95
+
96
+module.exports = (str,option) => {
97
+    str = (()=>{
98
+        let re = /<body[^>]*>([\s\S]*)<\/body>/i;
99
+        if(re.test(str)){
100
+            let result = re.exec(str);
101
+            return result[1] || str;
102
+        }else{
103
+            return str;
104
+        };
105
+    })();
106
+    return initObj(parse2(str,{decodeEntities:true}),option);
107
+};

+ 55
- 0
src/towxml/parse/markdown/index.js Näytä tiedosto

@@ -0,0 +1,55 @@
1
+let hljs;
2
+// hljs = require('../highlight/index');
3
+
4
+const config = require('../../config'),
5
+    mdOption = (()=>{
6
+        let result = {
7
+            html: true,
8
+            xhtmlOut: true,
9
+            typographer: true,
10
+            breaks: true,
11
+        };
12
+
13
+        if(config.highlight.length && hljs){
14
+            result.highlight = (code,lang,callback)=>{
15
+                let lineLen = code.split(/\r|\n/ig).length,
16
+                    result = hljs.highlightAuto(code).value;
17
+
18
+                    result = result.replace(/\r|\n/g,'<br/>').replace(/ /g,'&nbsp;').replace(/\t/g,'&nbsp;&nbsp;&nbsp;&nbsp;');
19
+
20
+                if(config.showLineNumber){
21
+                    let lineStr = (()=>{
22
+                        let str = `<ul class="h2w__lineNum">`;
23
+                        for(let i=0;i<lineLen-1;i++){
24
+                            str += `<li class="h2w__lineNumLine">${i+1}</li>`
25
+                        };
26
+
27
+                        str += `</ul>`;
28
+                        return str;
29
+                    })();
30
+                    return lineStr + result;
31
+                };
32
+                return result;
33
+            }
34
+        };
35
+        return result;
36
+    })(),
37
+    md = require('./markdown')(mdOption);
38
+
39
+// 应用Markdown解析扩展,包括自定义组件(['sub','sup','ins','mark','emoji','todo','latex','yuml','echarts'])
40
+[...config.markdown,...config.components].forEach(item => {
41
+    if(!/^audio-player|table|todogroup|img$/.test(item)){
42
+        md.use(require(`./plugins/${item}`));
43
+    };
44
+});
45
+
46
+// 定义emoji渲染规则
47
+md.renderer.rules.emoji = (token,index)=>{
48
+    let item = token[index];
49
+    return `<g-emoji class="h2w__emoji h2w__emoji--${item.markup}">${item.content}</g-emoji>`;
50
+};
51
+
52
+// 导出模块
53
+module.exports = str => {
54
+    return md.render(str);
55
+};

+ 4
- 0
src/towxml/parse/markdown/markdown.js
File diff suppressed because it is too large
Näytä tiedosto


+ 2
- 0
src/towxml/parse/markdown/plugins/emoji.js
File diff suppressed because it is too large
Näytä tiedosto


+ 1
- 0
src/towxml/parse/markdown/plugins/ins.js Näytä tiedosto

@@ -0,0 +1 @@
1
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.markdownitIns=e()}}(function(){return function e(n,t,o){function r(s,f){if(!t[s]){if(!n[s]){var u="function"==typeof require&&require;if(!f&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var p=t[s]={exports:{}};n[s][0].call(p.exports,function(e){var t=n[s][1][e];return r(t?t:e)},p,p.exports,e,n,t,o)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,n,t){"use strict";n.exports=function(e){function n(e,n){var t,o,r,i,s,f=e.pos,u=e.src.charCodeAt(f);if(n)return!1;if(43!==u)return!1;if(o=e.scanDelims(e.pos,!0),i=o.length,s=String.fromCharCode(u),2>i)return!1;for(i%2&&(r=e.push("text","",0),r.content=s,i--),t=0;i>t;t+=2)r=e.push("text","",0),r.content=s+s,e.delimiters.push({marker:u,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function t(e){var n,t,o,r,i,s=[],f=e.delimiters,u=e.delimiters.length;for(n=0;u>n;n++)o=f[n],43===o.marker&&-1!==o.end&&(r=f[o.end],i=e.tokens[o.token],i.type="ins_open",i.tag="ins",i.nesting=1,i.markup="++",i.content="",i=e.tokens[r.token],i.type="ins_close",i.tag="ins",i.nesting=-1,i.markup="++",i.content="","text"===e.tokens[r.token-1].type&&"+"===e.tokens[r.token-1].content&&s.push(r.token-1));for(;s.length;){for(n=s.pop(),t=n+1;t<e.tokens.length&&"ins_close"===e.tokens[t].type;)t++;t--,n!==t&&(i=e.tokens[t],e.tokens[t]=e.tokens[n],e.tokens[n]=i)}}e.inline.ruler.before("emphasis","ins",n),e.inline.ruler2.before("emphasis","ins",t)}},{}]},{},[1])(1)});

+ 1
- 0
src/towxml/parse/markdown/plugins/mark.js Näytä tiedosto

@@ -0,0 +1 @@
1
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.markdownitMark=e()}}(function(){return function e(n,t,o){function r(s,f){if(!t[s]){if(!n[s]){var u="function"==typeof require&&require;if(!f&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var p=t[s]={exports:{}};n[s][0].call(p.exports,function(e){var t=n[s][1][e];return r(t?t:e)},p,p.exports,e,n,t,o)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,n,t){"use strict";n.exports=function(e){function n(e,n){var t,o,r,i,s,f=e.pos,u=e.src.charCodeAt(f);if(n)return!1;if(61!==u)return!1;if(o=e.scanDelims(e.pos,!0),i=o.length,s=String.fromCharCode(u),2>i)return!1;for(i%2&&(r=e.push("text","",0),r.content=s,i--),t=0;i>t;t+=2)r=e.push("text","",0),r.content=s+s,e.delimiters.push({marker:u,jump:t,token:e.tokens.length-1,level:e.level,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function t(e){var n,t,o,r,i,s=[],f=e.delimiters,u=e.delimiters.length;for(n=0;u>n;n++)o=f[n],61===o.marker&&-1!==o.end&&(r=f[o.end],i=e.tokens[o.token],i.type="mark_open",i.tag="mark",i.nesting=1,i.markup="==",i.content="",i=e.tokens[r.token],i.type="mark_close",i.tag="mark",i.nesting=-1,i.markup="==",i.content="","text"===e.tokens[r.token-1].type&&"="===e.tokens[r.token-1].content&&s.push(r.token-1));for(;s.length;){for(n=s.pop(),t=n+1;t<e.tokens.length&&"mark_close"===e.tokens[t].type;)t++;t--,n!==t&&(i=e.tokens[t],e.tokens[t]=e.tokens[n],e.tokens[n]=i)}}e.inline.ruler.before("emphasis","mark",n),e.inline.ruler2.before("emphasis","mark",t)}},{}]},{},[1])(1)});

+ 1
- 0
src/towxml/parse/markdown/plugins/sub.js Näytä tiedosto

@@ -0,0 +1 @@
1
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.markdownitSub=e()}}(function(){return function e(r,o,n){function t(i,u){if(!o[i]){if(!r[i]){var f="function"==typeof require&&require;if(!u&&f)return f(i,!0);if(s)return s(i,!0);var p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}var a=o[i]={exports:{}};r[i][0].call(a.exports,function(e){var o=r[i][1][e];return t(o?o:e)},a,a.exports,e,r,o,n)}return o[i].exports}for(var s="function"==typeof require&&require,i=0;i<n.length;i++)t(n[i]);return t}({1:[function(e,r){"use strict";function o(e,r){var o,t,s,i=e.posMax,u=e.pos;if(126!==e.src.charCodeAt(u))return!1;if(r)return!1;if(u+2>=i)return!1;for(e.pos=u+1;e.pos<i;){if(126===e.src.charCodeAt(e.pos)){o=!0;break}e.md.inline.skipToken(e)}return o&&u+1!==e.pos?(t=e.src.slice(u+1,e.pos),t.match(/(^|[^\\])(\\\\)*\s/)?(e.pos=u,!1):(e.posMax=e.pos,e.pos=u+1,s=e.push("sub_open","sub",1),s.markup="~",s=e.push("text","",0),s.content=t.replace(n,"$1"),s=e.push("sub_close","sub",-1),s.markup="~",e.pos=e.posMax+1,e.posMax=i,!0)):(e.pos=u,!1)}var n=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;r.exports=function(e){e.inline.ruler.after("emphasis","sub",o)}},{}]},{},[1])(1)});

+ 1
- 0
src/towxml/parse/markdown/plugins/sup.js Näytä tiedosto

@@ -0,0 +1 @@
1
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.markdownitSup=e()}}(function(){return function e(r,o,n){function t(i,p){if(!o[i]){if(!r[i]){var u="function"==typeof require&&require;if(!p&&u)return u(i,!0);if(s)return s(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var a=o[i]={exports:{}};r[i][0].call(a.exports,function(e){var o=r[i][1][e];return t(o?o:e)},a,a.exports,e,r,o,n)}return o[i].exports}for(var s="function"==typeof require&&require,i=0;i<n.length;i++)t(n[i]);return t}({1:[function(e,r){"use strict";function o(e,r){var o,t,s,i=e.posMax,p=e.pos;if(94!==e.src.charCodeAt(p))return!1;if(r)return!1;if(p+2>=i)return!1;for(e.pos=p+1;e.pos<i;){if(94===e.src.charCodeAt(e.pos)){o=!0;break}e.md.inline.skipToken(e)}return o&&p+1!==e.pos?(t=e.src.slice(p+1,e.pos),t.match(/(^|[^\\])(\\\\)*\s/)?(e.pos=p,!1):(e.posMax=e.pos,e.pos=p+1,s=e.push("sup_open","sup",1),s.markup="^",s=e.push("text","",0),s.content=t.replace(n,"$1"),s=e.push("sup_close","sup",-1),s.markup="^",e.pos=e.posMax+1,e.posMax=i,!0)):(e.pos=p,!1)}var n=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;r.exports=function(e){e.inline.ruler.after("emphasis","sup",o)}},{}]},{},[1])(1)});

+ 147
- 0
src/towxml/parse/markdown/plugins/todo.js Näytä tiedosto

@@ -0,0 +1,147 @@
1
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownitTaskLists = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
2
+    // Markdown-it plugin to render GitHub-style task lists; see
3
+    //
4
+    // https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments
5
+    // https://github.com/blog/1825-task-lists-in-all-markdown-documents
6
+    
7
+    var disableCheckboxes = true;
8
+    var useLabelWrapper = false;
9
+    var useLabelAfter = false;
10
+    
11
+    module.exports = function(md, options) {
12
+        if (options) {
13
+            disableCheckboxes = !options.enabled;
14
+            useLabelWrapper = !!options.label;
15
+            useLabelAfter = !!options.labelAfter;
16
+        }
17
+    
18
+        md.core.ruler.after('inline', 'github-task-lists', function(state) {
19
+            var tokens = state.tokens;
20
+
21
+            // 用于寻找关闭标签的数组
22
+            let tagPaired = (index)=>{
23
+                let targetItem,
24
+                    item = tokens[index],
25
+                    tag = item.tag,
26
+                    level = item.level,
27
+                    targetType = item.type === 'list_item_open' ? 'list_item_close' : 'bullet_list_close';
28
+                for(let i = index,len=tokens.length; i<len; i++){
29
+                    let _item = tokens[i];
30
+
31
+                    if(_item.tag === tag && level === _item.level && _item.type === targetType){
32
+                        targetItem = _item;
33
+                        break;
34
+                    };
35
+                };
36
+                return targetItem;
37
+
38
+            };
39
+
40
+            for (var i = 2; i < tokens.length; i++) {
41
+                if (isTodoItem(tokens, i)) {
42
+                    todoify(tokens[i], state.Token);
43
+                    attrSet(tokens[i-2], 'class', 'task-list-item' + (!disableCheckboxes ? ' enabled' : ''));
44
+                    attrSet(tokens[parentToken(tokens, i-2)], 'class', 'contains-task-list');
45
+
46
+                    tagPaired(parentToken(tokens, i-2)).tag = 'todogroup';
47
+                    tokens[parentToken(tokens, i-2)].tag = 'todogroup';
48
+
49
+                    tagPaired(i-2).tag = 'todolist';
50
+                    tokens[i-2].tag = 'todolist';
51
+                };
52
+            };
53
+        });
54
+    };
55
+    
56
+    function attrSet(token, name, value) {
57
+        var index = token.attrIndex(name);
58
+        var attr = [name, value];
59
+    
60
+        if (index < 0) {
61
+            token.attrPush(attr);
62
+        } else {
63
+            token.attrs[index] = attr;
64
+        }
65
+    }
66
+    
67
+    function parentToken(tokens, index) {
68
+        var targetLevel = tokens[index].level - 1;
69
+        for (var i = index - 1; i >= 0; i--) {
70
+            if (tokens[i].level === targetLevel) {
71
+                return i;
72
+            }
73
+        }
74
+        return -1;
75
+    }
76
+    
77
+    function isTodoItem(tokens, index) {
78
+        return isInline(tokens[index]) &&
79
+               isParagraph(tokens[index - 1]) &&
80
+               isListItem(tokens[index - 2]) &&
81
+               startsWithTodoMarkdown(tokens[index]);
82
+    }
83
+    
84
+    function todoify(token, TokenConstructor) {
85
+        token.children.unshift(makeCheckbox(token, TokenConstructor));
86
+        token.children[1].content = token.children[1].content.slice(3);
87
+        token.content = token.content.slice(3);
88
+    
89
+        if (useLabelWrapper) {
90
+            if (useLabelAfter) {
91
+                token.children.pop();
92
+    
93
+                // Use large random number as id property of the checkbox.
94
+                var id = 'task-item-' + Math.ceil(Math.random() * (10000 * 1000) - 1000);
95
+                token.children[0].content = token.children[0].content.slice(0, -1) + ' id="' + id + '">';
96
+                token.children.push(afterLabel(token.content, id, TokenConstructor));
97
+            } else {
98
+                token.children.unshift(beginLabel(TokenConstructor));
99
+                token.children.push(endLabel(TokenConstructor));
100
+            }
101
+        }
102
+    }
103
+    
104
+    function makeCheckbox(token, TokenConstructor) {
105
+        var checkbox = new TokenConstructor('html_inline', '', 0);
106
+        var disabledAttr = disableCheckboxes ? ' disabled="" ' : '';
107
+        var value = ' value="' + token.content + '" ';
108
+        if (token.content.indexOf('[ ] ') === 0) {
109
+            checkbox.content = '<checkbox class="h2w__todoCheckbox task-list-item-checkbox"' + disabledAttr + value + '/>';
110
+        } else if (token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0) {
111
+            checkbox.content = '<checkbox class="h2w__todoCheckbox task-list-item-checkbox" checked="true"' + disabledAttr + value + '/>';
112
+        }
113
+        return checkbox;
114
+    }
115
+    
116
+    // these next two functions are kind of hacky; probably should really be a
117
+    // true block-level token with .tag=='label'
118
+    function beginLabel(TokenConstructor) {
119
+        var token = new TokenConstructor('html_inline', '', 0);
120
+        token.content = '<label>';
121
+        return token;
122
+    }
123
+    
124
+    function endLabel(TokenConstructor) {
125
+        var token = new TokenConstructor('html_inline', '', 0);
126
+        token.content = '</label>';
127
+        return token;
128
+    }
129
+    
130
+    function afterLabel(content, id, TokenConstructor) {
131
+        var token = new TokenConstructor('html_inline', '', 0);
132
+        token.content = '<label class="task-list-item-label" for="' + id + '">' + content + '</label>';
133
+        token.attrs = [{for: id}];
134
+        return token;
135
+    }
136
+    
137
+    function isInline(token) { return token.type === 'inline'; }
138
+    function isParagraph(token) { return token.type === 'paragraph_open'; }
139
+    function isListItem(token) { return token.type === 'list_item_open'; }
140
+    
141
+    function startsWithTodoMarkdown(token) {
142
+        // leading whitespace in a list item is already trimmed off by markdown-it
143
+        return token.content.indexOf('[ ] ') === 0 || token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0;
144
+    }
145
+    
146
+    },{}]},{},[1])(1)
147
+    });

+ 2
- 0
src/towxml/parse/parse2/Parser.js
File diff suppressed because it is too large
Näytä tiedosto


+ 2
- 0
src/towxml/parse/parse2/Tokenizer.js
File diff suppressed because it is too large
Näytä tiedosto


+ 2
- 0
src/towxml/parse/parse2/domhandler/index.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var node_1=require("./node");exports.Node=node_1.Node,exports.Element=node_1.Element,exports.DataNode=node_1.DataNode,exports.NodeWithChildren=node_1.NodeWithChildren;var reWhitespace=/\s+/g,defaultOpts={normalizeWhitespace:!1,withStartIndices:!1,withEndIndices:!1},DomHandler=function(){function t(t,e,o){this.dom=[],this._done=!1,this._tagStack=[],this._lastNode=null,this._parser=null,"function"==typeof e&&(o=e,e=defaultOpts),"object"==typeof t&&(e=t,t=undefined),this._callback=t||null,this._options=e||defaultOpts,this._elementCB=o||null}return t.prototype.onparserinit=function(t){this._parser=t},t.prototype.onreset=function(){this.dom=[],this._done=!1,this._tagStack=[],this._lastNode=null,this._parser=this._parser||null},t.prototype.onend=function(){this._done||(this._done=!0,this._parser=null,this.handleCallback(null))},t.prototype.onerror=function(t){this.handleCallback(t)},t.prototype.onclosetag=function(){this._lastNode=null;var t=this._tagStack.pop();t&&this._parser&&(this._options.withEndIndices&&(t.endIndex=this._parser.endIndex),this._elementCB&&this._elementCB(t))},t.prototype.onopentag=function(t,e){var o=new node_1.Element(t,e);this.addNode(o),this._tagStack.push(o)},t.prototype.ontext=function(t){var e=this._options.normalizeWhitespace,o=this._lastNode;if(o&&"text"===o.type)e?o.data=(o.data+t).replace(reWhitespace," "):o.data+=t;else{e&&(t=t.replace(reWhitespace," "));var n=new node_1.DataNode("text",t);this.addNode(n),this._lastNode=n}},t.prototype.oncomment=function(t){if(this._lastNode&&"comment"===this._lastNode.type)return void(this._lastNode.data+=t);var e=new node_1.DataNode("comment",t);this.addNode(e),this._lastNode=e},t.prototype.oncommentend=function(){this._lastNode=null},t.prototype.oncdatastart=function(){var t=new node_1.DataNode("text",""),e=new node_1.NodeWithChildren("cdata",[t]);this.addNode(e),t.parent=e,this._lastNode=t},t.prototype.oncdataend=function(){this._lastNode=null},t.prototype.onprocessinginstruction=function(t,e){var o=new node_1.ProcessingInstruction(t,e);this.addNode(o)},t.prototype.handleCallback=function(t){if("function"==typeof this._callback)this._callback(t,this.dom);else if(t)throw t},t.prototype.addNode=function(t){var e=this._tagStack[this._tagStack.length-1],o=e?e.children:this.dom,n=o[o.length-1];this._parser&&(this._options.withStartIndices&&(t.startIndex=this._parser.startIndex),this._options.withEndIndices&&(t.endIndex=this._parser.endIndex)),o.push(t),n&&(t.prev=n,n.next=t),e&&(t.parent=e),this._lastNode=null},t.prototype.addDataNode=function(t){this.addNode(t),this._lastNode=t},t}();exports.DomHandler=DomHandler,exports["default"]=DomHandler;

+ 2
- 0
src/towxml/parse/parse2/domhandler/node.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+"use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(exports,"__esModule",{value:!0});var nodeTypes=new Map([["tag",1],["script",1],["style",1],["directive",1],["text",3],["cdata",4],["comment",8]]),Node=function(){function e(e){this.type=e,this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return nodeTypes.get(this.type)||1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent||null},set:function(e){this.parent=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev||null},set:function(e){this.prev=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next||null},set:function(e){this.next=e},enumerable:!0,configurable:!0}),e}();exports.Node=Node;var DataNode=function(e){function t(t,n){var r=e.call(this,t)||this;return r.data=n,r}return __extends(t,e),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!0,configurable:!0}),t}(Node);exports.DataNode=DataNode;var ProcessingInstruction=function(e){function t(t,n){var r=e.call(this,"directive",n)||this;return r.name=t,r}return __extends(t,e),t}(DataNode);exports.ProcessingInstruction=ProcessingInstruction;var NodeWithChildren=function(e){function t(t,n){var r=e.call(this,t)||this;return r.children=n,r}return __extends(t,e),Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.children[0]||null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!0,configurable:!0}),t}(Node);exports.NodeWithChildren=NodeWithChildren;var Element=function(e){function t(t,n){var r=e.call(this,"script"===t?"script":"style"===t?"style":"tag",[])||this;return r.name=t,r.attribs=n,r.attribs=n,r}return __extends(t,e),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!0,configurable:!0}),t}(NodeWithChildren);exports.Element=Element;

+ 2
- 0
src/towxml/parse/parse2/entities/decode.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+"use strict";function getStrictDecoder(e){var t=Object.keys(e).join("|"),r=getReplacer(e);t+="|#[xX][\\da-fA-F]+|#\\d+";var o=new RegExp("&(?:"+t+");","g");return function(e){return String(e).replace(o,r)}}function getReplacer(e){return function(t){return"#"===t.charAt(1)?"X"===t.charAt(2)||"x"===t.charAt(2)?decode_codepoint_1["default"](parseInt(t.substr(3),16)):decode_codepoint_1["default"](parseInt(t.substr(2),10)):e[t.slice(1,-1)]}}var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var entities_json_1=__importDefault(require("./maps/entities.json")),legacy_json_1=__importDefault(require("./maps/legacy.json")),xml_json_1=__importDefault(require("./maps/xml.json")),decode_codepoint_1=__importDefault(require("./decode_codepoint"));exports.decodeXML=getStrictDecoder(xml_json_1["default"]),exports.decodeHTMLStrict=getStrictDecoder(entities_json_1["default"]);var sorter=function(e,t){return e<t?1:-1};exports.decodeHTML=function(){function e(e){return";"!==e.substr(-1)&&(e+=";"),s(e)}for(var t=Object.keys(legacy_json_1["default"]).sort(sorter),r=Object.keys(entities_json_1["default"]).sort(sorter),o=0,n=0;o<r.length;o++)t[n]===r[o]?(r[o]+=";?",n++):r[o]+=";";var i=new RegExp("&(?:"+r.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),s=getReplacer(entities_json_1["default"]);return function(t){return String(t).replace(i,e)}}();

+ 2
- 0
src/towxml/parse/parse2/entities/decode_codepoint.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+"use strict";function decodeCodePoint(e){if(e>=55296&&e<=57343||e>1114111)return"�";e in decode_json_1["default"]&&(e=decode_json_1["default"][e]);var o="";return e>65535&&(e-=65536,o+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),o+=String.fromCharCode(e)}var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var decode_json_1=__importDefault(require("./maps/decode"));exports["default"]=decodeCodePoint;

+ 2
- 0
src/towxml/parse/parse2/entities/encode.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+"use strict";function getInverseObj(e){return Object.keys(e).sort().reduce(function(r,t){return r[e[t]]="&"+t+";",r},{})}function getInverseReplacer(e){var r=[],t=[];return Object.keys(e).forEach(function(e){return 1===e.length?r.push("\\"+e):t.push(e)}),t.unshift("["+r.join("")+"]"),new RegExp(t.join("|"),"g")}function singleCharReplacer(e){return"&#x"+e.charCodeAt(0).toString(16).toUpperCase()+";"}function astralReplacer(e,r){return"&#x"+(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536).toString(16).toUpperCase()+";"}function getInverse(e,r){return function(t){return t.replace(r,function(r){return e[r]}).replace(reAstralSymbols,astralReplacer).replace(reNonASCII,singleCharReplacer)}}function escape(e){return e.replace(reXmlChars,singleCharReplacer).replace(reAstralSymbols,astralReplacer).replace(reNonASCII,singleCharReplacer)}var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var xml_json_1=__importDefault(require("./maps/xml.json")),inverseXML=getInverseObj(xml_json_1["default"]),xmlReplacer=getInverseReplacer(inverseXML);exports.encodeXML=getInverse(inverseXML,xmlReplacer);var entities_json_1=__importDefault(require("./maps/entities.json")),inverseHTML=getInverseObj(entities_json_1["default"]),htmlReplacer=getInverseReplacer(inverseHTML);exports.encodeHTML=getInverse(inverseHTML,htmlReplacer);var reNonASCII=/[^\0-\x7F]/g,reAstralSymbols=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,reXmlChars=getInverseReplacer(inverseXML);exports.escape=escape;

+ 2
- 0
src/towxml/parse/parse2/entities/index.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+"use strict";function decode(e,d){return(!d||d<=0?decode_1.decodeXML:decode_1.decodeHTML)(e)}function decodeStrict(e,d){return(!d||d<=0?decode_1.decodeXML:decode_1.decodeHTMLStrict)(e)}function encode(e,d){return(!d||d<=0?encode_1.encodeXML:encode_1.encodeHTML)(e)}Object.defineProperty(exports,"__esModule",{value:!0});var decode_1=require("./decode"),encode_1=require("./encode");exports.decode=decode,exports.decodeStrict=decodeStrict,exports.encode=encode;var encode_2=require("./encode");exports.encodeXML=encode_2.encodeXML,exports.encodeHTML=encode_2.encodeHTML,exports.escape=encode_2.escape,exports.encodeHTML4=encode_2.encodeHTML,exports.encodeHTML5=encode_2.encodeHTML;var decode_2=require("./decode");exports.decodeXML=decode_2.decodeXML,exports.decodeHTML=decode_2.decodeHTML,exports.decodeHTMLStrict=decode_2.decodeHTMLStrict,exports.decodeHTML4=decode_2.decodeHTML,exports.decodeHTML5=decode_2.decodeHTML,exports.decodeHTML4Strict=decode_2.decodeHTMLStrict,exports.decodeHTML5Strict=decode_2.decodeHTMLStrict,exports.decodeXMLStrict=decode_2.decodeXML;

+ 2
- 0
src/towxml/parse/parse2/entities/maps/decode.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+module.exports={0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376};

+ 2
- 0
src/towxml/parse/parse2/entities/maps/entities.js
File diff suppressed because it is too large
Näytä tiedosto


+ 2
- 0
src/towxml/parse/parse2/entities/maps/legacy.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+module.exports={Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"};

+ 2
- 0
src/towxml/parse/parse2/entities/maps/xml.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+module.exports={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};

+ 2
- 0
src/towxml/parse/parse2/index.js Näytä tiedosto

@@ -0,0 +1,2 @@
1
+/*! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */ 
2
+function parseDOM(r,e){var a=new domhandler_1.DomHandler(void 0,e);return new Parser_1.Parser(a,e).end(r),a.dom}var domhandler_1=require("./domhandler/index"),Parser_1=require("./Parser");module.exports=parseDOM;

+ 377
- 0
src/towxml/style/main.wxss Näytä tiedosto

@@ -0,0 +1,377 @@
1
+/*正文样式*/
2
+.h2w {
3
+    font-family: PingFang SC, Lantinghei SC, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif;
4
+    font-weight:300;
5
+    font-size: 32rpx;
6
+    line-height: 1.8;
7
+    word-wrap: break-word;
8
+    word-break: normal;
9
+    text-align:justify;
10
+}
11
+
12
+.h2w__main {
13
+    margin: 0 40rpx 40rpx 40rpx;
14
+    padding-top: 40rpx;
15
+}
16
+
17
+/**标题**/
18
+.h2w__h1,
19
+.h2w__h2,
20
+.h2w__h3,
21
+.h2w__h4,
22
+.h2w__h5,
23
+.h2w__h6 {
24
+    font-weight: bold;
25
+}
26
+
27
+/**设置行间元素样式**/
28
+.h2w__span,
29
+.h2w__b,
30
+.h2w__strong,
31
+.h2w__i,
32
+.h2w__em,
33
+.h2w__code,
34
+.h2w__sub,
35
+.h2w__sup,
36
+.h2w__g-emoji,
37
+.h2w__mark,
38
+.h2w__ins {
39
+    display:inline;
40
+}
41
+
42
+.h2w__h1 {
43
+    border-bottom-style: double;
44
+    border-bottom-width: 6rpx;
45
+    font-size: 42rpx;
46
+    padding-bottom: 10rpx;
47
+    margin-bottom: 20rpx;
48
+}
49
+
50
+.h2w__h2 {
51
+    border-bottom-style: solid;
52
+    border-bottom-width: 1rpx;
53
+    font-size: 40rpx;
54
+    padding-bottom: 8rpx;
55
+    margin-bottom: 18rpx;
56
+}
57
+
58
+.h2w__h3 {
59
+    font-size: 38rpx;
60
+    padding-bottom: 6rpx;
61
+    margin-bottom: 12rpx;
62
+}
63
+
64
+.h2w__h4 {
65
+    font-size: 36rpx;
66
+    padding-bottom: 4rpx;
67
+    margin-bottom: 12rpx;
68
+}
69
+
70
+.h2w__h5 {
71
+    font-size: 34rpx;
72
+    padding-bottom: 2rpx;
73
+    margin-bottom: 12rpx;
74
+}
75
+
76
+.h2w__h6 {
77
+    margin-bottom: 12rpx;
78
+}
79
+
80
+
81
+/**表格**/
82
+.h2w__tableParent {
83
+    width:100%;
84
+    overflow-x:auto;
85
+}
86
+
87
+.h2w__table {
88
+    width: 100%;
89
+    border-collapse: collapse;
90
+    border-spacing: 0;
91
+    display: table;
92
+    margin-bottom: 40rpx;
93
+    white-space: nowrap;
94
+}
95
+
96
+.h2w__table .h2w__tr:nth-child(2n) {
97
+    background-color: red;
98
+}
99
+
100
+.h2w__colgroup {
101
+    display: table-column-group;
102
+}
103
+
104
+.h2w__col {
105
+    display: table-column;
106
+}
107
+
108
+.h2w__thead {
109
+    display: table-header-group;
110
+}
111
+
112
+.h2w__tbody {
113
+    display: table-row-group;
114
+}
115
+
116
+.h2w__tfoot {
117
+    display: table-footer-group;
118
+}
119
+
120
+.h2w__tr {
121
+    display: table-row;
122
+}
123
+
124
+.h2w__th,
125
+.h2w__td {
126
+    padding: 8rpx 16rpx;
127
+    font-size: 28rpx;
128
+    border-width: 1rpx;
129
+    border-style: solid;
130
+    display: table-cell;
131
+}
132
+
133
+.h2w__th {
134
+    font-weight: bold;
135
+}
136
+
137
+/**代码块**/
138
+.h2w__pre {
139
+    /*white-space:nowrap;*/
140
+    padding: 10rpx 14rpx 10rpx 10rpx;
141
+    font-size: 28rpx;
142
+    word-break: normal;
143
+    border-width: 1rpx;
144
+    border-style: solid;
145
+    margin-bottom: 40rpx;
146
+    white-space: nowrap;
147
+    overflow-x: auto;
148
+    tab-size:4;
149
+}
150
+
151
+.h2w__pre .h2w__code {
152
+    padding: 0;
153
+    border: 0;
154
+    font-size: 100%;
155
+}
156
+
157
+.h2w__pre,
158
+.h2w__code {
159
+    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace, "STHeitiTC-Light", "Microsoft YaHei Light", -apple-system, system-ui, BlinkMacSystemFont;
160
+}
161
+
162
+.h2w__code {
163
+    padding: 4rpx 8rpx;
164
+    margin: 0 4rpx;
165
+    border-width: 1rpx;
166
+    border-style: solid;
167
+    border-radius: 8rpx;
168
+    font-size: 80%;
169
+    overflow-x: auto;
170
+}
171
+
172
+.h2w__pre .h2w__span,
173
+.h2w__pre .h2w__a,
174
+.h2w__pre .h2w__span,
175
+.h2w__pre .h2w__b,
176
+.h2w__pre .h2w__strong,
177
+.h2w__pre .h2w__i,
178
+.h2w__pre .h2w__em {
179
+    display: inline;
180
+}
181
+
182
+.h2w__pre {
183
+    white-space: pre;
184
+    display: block;
185
+}
186
+
187
+.h2w__pre .h2w__code {
188
+    white-space:nowrap;
189
+    /* width: 9999px; */
190
+    display: block;
191
+    font-size: 80%;
192
+}
193
+
194
+/**列表**/
195
+.h2w__ul,
196
+.h2w__ol {
197
+    margin-bottom: 40rpx;
198
+    padding-left: 1rem;
199
+}
200
+
201
+.h2w__ul .h2w__ol,
202
+.h2w__ol .h2w__ul {
203
+    margin-bottom: 0;
204
+}
205
+
206
+.h2w__li {
207
+    display: list-item;
208
+}
209
+
210
+/**todo**/
211
+.h2w__todogroup {
212
+    margin-bottom: 40rpx;
213
+}
214
+
215
+.h2w__todogroup .h2w__todogroup {
216
+    padding-left: 1.6rem;
217
+}
218
+
219
+/**一级ol样式**/
220
+.h2w__ol {
221
+    list-style-type: decimal;
222
+}
223
+
224
+/**二级ol样式**/
225
+.h2w__ul .h2w__ol,
226
+.h2w__ol .h2w__ol {
227
+    list-style-type: lower-roman;
228
+}
229
+
230
+/**三级ol样式**/
231
+.h2w__ul .h2w__ul .h2w__ol,
232
+.h2w__ul .h2w__ol .h2w__ol,
233
+.h2w__ol .h2w__ul .h2w__ol,
234
+.h2w__ol .h2w__ol .h2w__ol {
235
+    list-style-type: lower-alpha;
236
+}
237
+
238
+/**一级ul样式**/
239
+.h2w__ul {
240
+    list-style-type: disc;
241
+}
242
+
243
+/**二级ul样式**/
244
+.h2w__ul .h2w__ul,
245
+.h2w__ol .h2w__ul {
246
+    list-style-type: circle;
247
+}
248
+
249
+/**三级样式**/
250
+.h2w__ol .h2w__ol .h2w__ul,
251
+.h2w__ol .h2w__ul .h2w__ul,
252
+.h2w__ul .h2w__ol .h2w__ul,
253
+.h2w__ul .h2w__ul .h2w__ul {
254
+    list-style-type: square;
255
+}
256
+
257
+/**块元素**/
258
+.h2w__p {
259
+    margin: 20rpx 0 20rpx 0;
260
+}
261
+
262
+.h2w__blockquote {
263
+    border-left-width: 8rpx;
264
+    border-left-style: solid;
265
+    padding: 0 20rpx;
266
+}
267
+
268
+/**内连元素**/
269
+.h2w__a,
270
+.h2w__span,
271
+.h2w__b,
272
+.h2w__strong,
273
+.h2w__i,
274
+.h2w__em {
275
+    display: inline;
276
+}
277
+
278
+.h2w__b,
279
+.h2w__strong {
280
+    font-weight: bold;
281
+}
282
+
283
+.h2w__i,
284
+.h2w__em {
285
+    font-style: italic;
286
+}
287
+
288
+/**文本删除线**/
289
+.h2w__s,
290
+.h2w__strike,
291
+.h2w__del {
292
+    text-decoration: line-through;
293
+}
294
+
295
+/**文本下划线**/
296
+.h2w__ins,
297
+.h2w__u {
298
+    text-decoration: underline;
299
+}
300
+
301
+/**链接**/
302
+.h2w__a {
303
+    margin: 0 8rpx;
304
+    border-bottom-width: 1rpx;
305
+    border-bottom-style: solid;
306
+    line-height: 1;
307
+}
308
+
309
+.h2w__hr {
310
+    height: 8rpx;
311
+    margin: 40rpx 0;
312
+}
313
+
314
+/**荧光标记**/
315
+.h2w__mark {
316
+    border-radius: 4rpx;
317
+}
318
+
319
+/**上标、下标**/
320
+.h2w__sup,
321
+.h2w__sub {
322
+    font-size: 75%;
323
+    position: relative;
324
+}
325
+
326
+.h2w__sup {
327
+    top: -0.5em;
328
+}
329
+
330
+.h2w__sub {
331
+    bottom: -0.25em;
332
+}
333
+
334
+/**emoji表情**/
335
+.h2w__g-emoji {
336
+    margin: 0 0.1em;
337
+    font-family: "Apple Color Emoji", "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol";
338
+}
339
+
340
+/**内置元素**/
341
+image,video {
342
+    max-width: 100%;
343
+}
344
+
345
+
346
+video {
347
+    width:100%; margin: 10rpx auto;
348
+}
349
+
350
+image {
351
+    height:auto; vertical-align:middle;
352
+}
353
+
354
+video {
355
+    height:220px; font-size:0;
356
+}
357
+
358
+.h2w__latex--line {margin:4rpx 8rpx; vertical-align:middle;}
359
+.h2w__latex--block {display:block; margin:1em auto;} 
360
+
361
+.h2w__yuml {display:block;}
362
+
363
+.h2w__yumlBox {
364
+    width:100%;
365
+    overflow-x:auto;
366
+}
367
+.h2w__yumlView {
368
+    margin:0 auto; padding-bottom:40rpx;
369
+}
370
+
371
+/**代码行号**/
372
+.h2w__lineNum {
373
+    text-align:right; float:left; padding:0; margin:0 1em 0 0;
374
+}
375
+.h2w__lineNumLine {
376
+    list-style:none;
377
+}

+ 73
- 0
src/towxml/style/theme/dark.wxss Näytä tiedosto

@@ -0,0 +1,73 @@
1
+/*正文样式*/
2
+.h2w-dark {
3
+  color:#ddd;
4
+  background-color:#000;
5
+}
6
+
7
+/**标题**/
8
+.h2w-dark .h2w__h1,
9
+.h2w-dark .h2w__h2 {
10
+    border-color:#3d3d3d;
11
+}
12
+
13
+
14
+/**表格**/
15
+.h2w-dark .h2w__thead .h2w__tr {
16
+    background-color:#1f1f1f;
17
+}
18
+.h2w-dark .h2w__table .h2w__tr:nth-child(2n){
19
+    background-color:#090909;
20
+}
21
+.h2w-dark .h2w__th,
22
+.h2w-dark .h2w__td {
23
+    border-color:#333;
24
+}
25
+
26
+
27
+/**代码块**/
28
+.h2w-dark .h2w__pre,
29
+.h2w-dark .h2w__pre .h2w__code {
30
+    background-color:#1b1b1b;
31
+    border-color:#262626;
32
+}
33
+
34
+.h2w-dark .h2w__code {
35
+    background-color:#272822;
36
+    border-color:#1b1c18;
37
+}
38
+
39
+
40
+/**块元素**/
41
+.h2w-dark .h2w__blockquote {
42
+    border-left-color:#10230f;
43
+}
44
+
45
+/**内连元素**/
46
+.h2w-dark .h2w__a {
47
+    color:#1aad16; border-color:#4d804b;
48
+}
49
+
50
+.h2w-dark .h2w__hr {
51
+    background-color:#242424;
52
+}
53
+
54
+.h2w-dark .h2w__mark {
55
+    background:yellow;
56
+    color:black;
57
+}
58
+
59
+.h2w-dark .h2w__todoCheckbox .wx-checkbox-input {
60
+    background:#2e2e2e; border-color:#494949;
61
+}
62
+.h2w-dark .h2w__todoCheckbox .wx-checkbox-input.wx-checkbox-input-checked {
63
+    background:green; border-color:#4d804b;
64
+}
65
+.h2w-dark .h2w__todoCheckbox .wx-checkbox-input.wx-checkbox-input-checked::before {
66
+    color:white;
67
+}
68
+.h2w-dark .h2w__lineNum {
69
+    color:#494949;
70
+}
71
+
72
+/**代码高亮样式**/
73
+

+ 62
- 0
src/towxml/style/theme/light.wxss Näytä tiedosto

@@ -0,0 +1,62 @@
1
+/*正文样式*/
2
+.h2w-light {
3
+  color:#333;
4
+  background-color:white;
5
+}
6
+
7
+/**标题**/
8
+.h2w-light .h2w__h1,
9
+.h2w-light .h2w__h2 {
10
+    border-color:#eee;
11
+}
12
+
13
+
14
+/**表格**/
15
+.h2w-light .h2w__thead .h2w__tr {
16
+    background-color:#f6f8fa;
17
+}
18
+.h2w-light .h2w__table .h2w__tr:nth-child(2n){
19
+    background-color:#fbfcfd;
20
+}
21
+.h2w-light .h2w__th,
22
+.h2w-light .h2w__td {
23
+    border-color:#dfe2e5;
24
+}
25
+
26
+
27
+/**代码块**/
28
+.h2w-light .h2w__pre {
29
+    background-color:#f6f8fa;
30
+    border-color:#eaedf0;
31
+}
32
+
33
+.h2w-light .h2w__code {
34
+    background-color:#f6f8fa;
35
+    border-color:#eaedf0;
36
+}
37
+
38
+
39
+/**块元素**/
40
+.h2w-light .h2w__blockquote {
41
+    border-left-color:#dfe2e5;
42
+}
43
+
44
+/**内连元素**/
45
+.h2w-light .h2w__a {
46
+    color:#1aad16; border-color:#b9d9b8;
47
+}
48
+
49
+.h2w-light .h2w__hr {
50
+    background-color:#eee;
51
+}
52
+
53
+.h2w-light .h2w__mark {
54
+    background:yellow;
55
+    color:black;
56
+}
57
+
58
+.h2w-light .h2w__lineNum {
59
+    color:#ccc;
60
+}
61
+
62
+/**代码高亮样式**/

+ 11
- 0
src/towxml/table/table.js Näytä tiedosto

@@ -0,0 +1,11 @@
1
+Component({
2
+	options: {
3
+		styleIsolation: 'shared'
4
+	},
5
+	properties: {
6
+		data: {
7
+			type: Object,
8
+			value: {}
9
+		}
10
+	}
11
+})

+ 6
- 0
src/towxml/table/table.json Näytä tiedosto

@@ -0,0 +1,6 @@
1
+{
2
+  "component": true,
3
+  "usingComponents": {
4
+    "decode": "../decode"
5
+  }
6
+}

+ 24
- 0
src/towxml/table/table.wxml Näytä tiedosto

@@ -0,0 +1,24 @@
1
+<!--table-->
2
+<block wx:if="{{data.tag === 'table'}}">
3
+    <view class="h2w__tableParent">
4
+        <view class="{{data.attr.class}}" width="{{data.attr.width}}" style="{{data.attr.style}}">
5
+            <!--thead、tbody、tfoot-->
6
+            <block wx:if="{{data.child}}" wx:for="{{data.child}}" wx:for-item="item" wx:key="i">
7
+                <view wx:if="{{item.tag}}" class="{{item.attr.class}}">
8
+                    <!--tr-->
9
+                    <block wx:if="{{item.child}}" wx:for="{{item.child}}" wx:for-item="item" wx:key="i">
10
+                        <view wx:if="{{item.tag}}" class="{{item.attr.class}}">
11
+                            <!--td-->
12
+                            <block wx:if="{{item.child}}" wx:for="{{item.child}}" wx:for-item="item" wx:key="i">
13
+                                <view wx:if="{{item.tag}}" class="{{item.attr.class}}" width="{{data.attr.width}}" style="{{data.attr.style}}">
14
+                                    <!--content-->
15
+                                    <decode wx:if="{{item.child}}" nodes="{{item}}"/>
16
+                                </view>
17
+                            </block>
18
+                        </view>
19
+                    </block>
20
+                </view>
21
+            </block>
22
+        </view>
23
+    </view>
24
+</block>

+ 0
- 0
src/towxml/table/table.wxss Näytä tiedosto


+ 20
- 0
src/towxml/todogroup/todogroup.js Näytä tiedosto

@@ -0,0 +1,20 @@
1
+Component({
2
+	options: {
3
+		styleIsolation: 'shared'
4
+	},
5
+	properties: {
6
+		data: {
7
+			type: Object,
8
+			value: {}
9
+		}
10
+	},
11
+	data: {
12
+	},
13
+	methods: {
14
+		_change:function(...arg){
15
+			if(global._events && typeof global._events.change === 'function'){
16
+				global._events.change(...arg);
17
+			}
18
+		}
19
+	}
20
+})

+ 6
- 0
src/towxml/todogroup/todogroup.json Näytä tiedosto

@@ -0,0 +1,6 @@
1
+{
2
+  "component": true,
3
+  "usingComponents": {
4
+    "decode": "../decode"
5
+  }
6
+}

+ 13
- 0
src/towxml/todogroup/todogroup.wxml Näytä tiedosto

@@ -0,0 +1,13 @@
1
+<checkbox-group wx:if="{{data.tag === 'todogroup'}}" class="{{data.attr.class}}" bindchange="_change">
2
+    <block wx:if="{{data.child}}" wx:for="{{data.child}}" wx:for-item="item" wx:key="i">
3
+        <label wx:if="{{item.tag}}" class="{{item.attr.class}}">
4
+            <block wx:if="{{item.child}}" wx:for="{{item.child}}" wx:for-item="item" wx:key="i">
5
+                <!--解析选择框-->
6
+                <checkbox wx:if="{{item.tag === 'checkbox'}}" class="{{item.attr.class}}" value="{{item.attr.value}}" data-_e="{{item}}" checked="{{item.attr.checked}}" disabled="{{item.attr.disabled}}"/>
7
+
8
+                <!--解析文字-->
9
+                <decode wx:if="{{item.child}}" nodes="{{item}}"/>
10
+            </block>
11
+        </label>
12
+    </block>
13
+</checkbox-group>

+ 3
- 0
src/towxml/todogroup/todogroup.wxss Näytä tiedosto

@@ -0,0 +1,3 @@
1
+.h2w__todolist {
2
+    display:block;
3
+}

+ 16
- 0
src/towxml/towxml.js Näytä tiedosto

@@ -0,0 +1,16 @@
1
+Component({
2
+  options:{
3
+    styleIsolation:'shared'
4
+  },
5
+  properties:{
6
+    nodes:{
7
+      type:Object,
8
+      value:{}
9
+    }
10
+  },
11
+  data:{
12
+    someData:{
13
+      
14
+    }
15
+  }
16
+})

+ 6
- 0
src/towxml/towxml.json Näytä tiedosto

@@ -0,0 +1,6 @@
1
+{
2
+  "component": true,
3
+  "usingComponents": {
4
+    "decode": "./decode"
5
+  }
6
+}

+ 5
- 0
src/towxml/towxml.wxml Näytä tiedosto

@@ -0,0 +1,5 @@
1
+<view class="h2w h2w-{{nodes.theme}}">
2
+	<view class="h2w__main">
3
+		<decode nodes="{{nodes}}"/>
4
+	</view>
5
+</view>

+ 8
- 0
src/towxml/towxml.wxss Näytä tiedosto

@@ -0,0 +1,8 @@
1
+/**基础风格样式**/
2
+@import './style/main.wxss';
3
+
4
+/**主题配色(浅色样式)**/
5
+@import './style/theme/light.wxss';
6
+
7
+/**主题配色(深色样式)**/
8
+@import './style/theme/dark.wxss';

+ 11
- 0
src/util/Api/index.js Näytä tiedosto

@@ -0,0 +1,11 @@
1
+
2
+const prefix = process.env.NODE_ENV === 'production' ? '' : ''
3
+
4
+const Api = {
5
+  UpdateUserInfo: { // 更新用户信息
6
+    method: 'post',
7
+    url: `${prefix}/person/:id`
8
+  }
9
+}
10
+
11
+export default Api

+ 93
- 0
src/util/PublicMethod/index.js Näytä tiedosto

@@ -0,0 +1,93 @@
1
+import qs from 'qs'
2
+const ToolClass = {
3
+  DateFormat (timestamp) { // 格式化时间
4
+    if (timestamp) {
5
+      let YY = new Date(timestamp).getFullYear()
6
+      let MM = new Date(timestamp).getMonth() + 1
7
+      let DD = new Date(timestamp).getDate()
8
+      let hh = new Date(timestamp).getHours()
9
+      let mm = new Date(timestamp).getMinutes()
10
+      return `${YY}-${MM > 9 ? MM : '0' + MM}-${DD > 9 ? DD : '0' + DD} ${hh > 9 ? hh : '0' + hh}:${mm > 9 ? mm : '0' + mm}`
11
+    }
12
+  },
13
+  ReplaceURLParams (url, params) {
14
+    const args = { ...(params || {}), org: 'MQ' }
15
+    return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
16
+      const re = new RegExp(`:${k}(?!w)`, 'i')
17
+      return acc.replace(re, args[k])
18
+    }, url)
19
+  },
20
+  WxRequest (config) { // 网络请求
21
+    let _that = this
22
+    let urlData = qs.stringify(config.urlData)
23
+    let queryData = qs.stringify(config.queryData)
24
+    if (config.url.indexOf(':') > -1) {
25
+      if (typeof config.urlData === 'object') {
26
+        config.url = this.ReplaceURLParams(config.url, config.urlData)
27
+      } else {
28
+        config.url = config.url.slice(0, config.url.indexOf(':')) + urlData
29
+      }
30
+    }
31
+    if (queryData) {
32
+      config.url += '?' + queryData
33
+    }
34
+    let Header = {}
35
+    if (wx.getStorageSync('token') !== '' && wx.getStorageSync('tokentime') !== '' && wx.getStorageSync('tokentime') - 0 + 24 * 60 * 60 * 1000 >= Date.now()) { // 本地获取token
36
+      Header['X-Authorization-Jwt'] = wx.getStorageSync('token')
37
+    }
38
+    wx.request({
39
+      url: `${SERVER_API}${config.url}`,
40
+      method: config.method,
41
+      ...(config.data || {}),
42
+      header: { ...Header },
43
+      success: (res) => {
44
+        const token = res.header['X-Authorization-Jwt'] || res.header['X-Authorization-JWT']
45
+        if (token) { // 更新本地存储token
46
+          wx.setStorageSync('token', token)
47
+          wx.setStorageSync('tokentime', Date.now())
48
+        }
49
+        if (res.data.code - 0 === 1001) { // token失效
50
+          // wx.login({ // 微信获取code
51
+          //   success (subRes) {
52
+          //     wx.request({ // 登录获取token
53
+          //       url: `${SERVER_API}/login?code=${subRes.code}`,
54
+          //       method: `post`,
55
+          //       success: (cRes) => {
56
+          //         const token = cRes.header['X-Authorization-Jwt'] || cRes.header['X-Authorization-JWT']
57
+          //         if (token) { // 更新本地存储token
58
+          //           wx.setStorageSync('token', token)
59
+          //           _that.WxRequest(config) // 获得token之后重新请求接口
60
+          //         }
61
+          //       }
62
+          //     })
63
+          //   }
64
+          // })
65
+        }
66
+        if (config.success !== undefined && res.data.code - 0 === 1000) {
67
+          config.success(res)
68
+        }
69
+        if (config.error !== undefined && res.data.code - 0 !== 1000) {
70
+          config.error(res)
71
+          wx.showToast({
72
+            title: res.data.message,
73
+            icon: 'none',
74
+            duration: 2000
75
+          })
76
+        }
77
+      },
78
+      fail: (res) => {
79
+        if (res.header['X-Authorization-Jwt'] !== undefined) { // 更新本地存储token
80
+          wx.setStorageSync('token', res.header['X-Authorization-Jwt'])
81
+        }
82
+        if (res.data.code - 0 === 1001) { // token失效
83
+          wx.navigateTo({ url: '../../pages/SignIn/index' })
84
+        }
85
+        if (config.error !== undefined) {
86
+          config.error(res)
87
+        }
88
+      }
89
+    })
90
+  }
91
+}
92
+
93
+export default ToolClass

+ 0
- 0
src/util/auth-plugin.js Näytä tiedosto


Some files were not shown because too many files changed in this diff