浏览代码

feat: 小剧场充值页

黎海 2 年之前
当前提交
b06f8d2b26
共有 100 个文件被更改,包括 6387 次插入0 次删除
  1. 7 0
      .gitignore
  2. 20 0
      README.md
  3. 240 0
      app.js
  4. 160 0
      app.json
  5. 28 0
      app.wxs
  6. 147 0
      app.wxss
  7. 106 0
      components/local/change-env/change-env.js
  8. 6 0
      components/local/change-env/change-env.json
  9. 15 0
      components/local/change-env/change-env.wxml
  10. 53 0
      components/local/change-env/change-env.wxss
  11. 103 0
      components/local/couponItem/couponItem.js
  12. 4 0
      components/local/couponItem/couponItem.json
  13. 35 0
      components/local/couponItem/couponItem.wxml
  14. 274 0
      components/local/couponItem/couponItem.wxss
  15. 250 0
      components/local/ec-canvas/ec-canvas.js
  16. 4 0
      components/local/ec-canvas/ec-canvas.json
  17. 9 0
      components/local/ec-canvas/ec-canvas.wxml
  18. 4 0
      components/local/ec-canvas/ec-canvas.wxss
  19. 16 0
      components/local/ec-canvas/echarts.js
  20. 105 0
      components/local/ec-canvas/wx-canvas.js
  21. 63 0
      components/local/home-skeleton/home-skeleton.js
  22. 4 0
      components/local/home-skeleton/home-skeleton.json
  23. 21 0
      components/local/home-skeleton/home-skeleton.wxml
  24. 72 0
      components/local/home-skeleton/home-skeleton.wxss
  25. 25 0
      components/local/navigation/navigation.js
  26. 4 0
      components/local/navigation/navigation.json
  27. 14 0
      components/local/navigation/navigation.wxml
  28. 19 0
      components/local/navigation/navigation.wxss
  29. 303 0
      components/local/wxParse/html2json.js
  30. 192 0
      components/local/wxParse/htmlparser.js
  31. 2532 0
      components/local/wxParse/showdown.js
  32. 207 0
      components/local/wxParse/wxDiscode.js
  33. 157 0
      components/local/wxParse/wxParse.js
  34. 967 0
      components/local/wxParse/wxParse.wxml
  35. 221 0
      components/local/wxParse/wxParse.wxss
  36. 二进制
      images/all_carding.png
  37. 二进制
      images/black_location.png
  38. 二进制
      images/car-icon.png
  39. 二进制
      images/card.png
  40. 二进制
      images/card_img.png
  41. 二进制
      images/clearMessage.png
  42. 二进制
      images/delete-gray.png
  43. 二进制
      images/display.png
  44. 二进制
      images/go_on.png
  45. 二进制
      images/gzh.png
  46. 二进制
      images/home/message.png
  47. 二进制
      images/home/time.png
  48. 二进制
      images/home/喇叭@2x.png
  49. 二进制
      images/home/定位@2x(2).png
  50. 二进制
      images/home/定位@2x.png
  51. 二进制
      images/home/展开@2x(1).png
  52. 二进制
      images/home/展开@2x.png
  53. 二进制
      images/home_popup_close.png
  54. 二进制
      images/icon_01.png
  55. 二进制
      images/icon_02.png
  56. 二进制
      images/icon_03.png
  57. 二进制
      images/icon_04.png
  58. 二进制
      images/icon_05.png
  59. 二进制
      images/icon_06.png
  60. 二进制
      images/icon_07.png
  61. 二进制
      images/icon_08.png
  62. 二进制
      images/icon_09.png
  63. 二进制
      images/icon_10.png
  64. 二进制
      images/icon_11.png
  65. 二进制
      images/icon_12.png
  66. 二进制
      images/icon_13.png
  67. 二进制
      images/icon_14.png
  68. 二进制
      images/icon_15.png
  69. 二进制
      images/icon_16.png
  70. 二进制
      images/icon_17.png
  71. 二进制
      images/icon_18.png
  72. 二进制
      images/icon_19.png
  73. 二进制
      images/icon_20.png
  74. 二进制
      images/icon_21.png
  75. 二进制
      images/icon_arrow_2.png
  76. 二进制
      images/icon_arrow_gray.png
  77. 二进制
      images/icon_avatar_01.png
  78. 二进制
      images/icon_avatar_02.png
  79. 二进制
      images/icon_close_01.png
  80. 二进制
      images/icon_close_02.png
  81. 二进制
      images/icon_gender_1.png
  82. 二进制
      images/icon_gender_2.png
  83. 二进制
      images/icon_location_black.png
  84. 二进制
      images/icon_logo.png
  85. 二进制
      images/icon_logo_white_bg.png
  86. 二进制
      images/icon_nav_01.png
  87. 二进制
      images/icon_no_device.png
  88. 二进制
      images/icon_order_coupon.png
  89. 二进制
      images/icon_order_vip.png
  90. 二进制
      images/icon_radio_01.png
  91. 二进制
      images/icon_radio_02.png
  92. 二进制
      images/icon_radio_03.png
  93. 二进制
      images/icon_record_01.png
  94. 二进制
      images/icon_record_02.png
  95. 二进制
      images/icon_record_03.png
  96. 二进制
      images/icon_record_04.png
  97. 二进制
      images/icon_record_06.png
  98. 二进制
      images/icon_record_07.png
  99. 二进制
      images/icon_record_bg.png
  100. 0 0
      images/icon_record_new_00.png

+ 7 - 0
.gitignore

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

+ 20 - 0
README.md

@@ -0,0 +1,20 @@
1
+一:项目结构
2
+   "pages/index/index",   首页
3
+    "pages/logs/logs",  登录
4
+    "pages/my/index”,我的
5
+    "pages/my/vip", 我的vip
6
+    "pages/index/details", 预约项目详情
7
+    "pages/index/select_shop”,选择其他店铺
8
+    "pages/my/disclaimer”,免责声明
9
+    "pages/indent/unpaid”,订单详情(复用)
10
+    "pages/indent/list”,订单列表
11
+    "pages/my/buy_vip”,已购会员卡
12
+    "pages/my/coupon”我的优惠卷
13
+二:项目架构
14
+	使用npm的 Vant Weapp进行辅助画图,
15
+	使用地址 	https://youzan.github.io/vant-weapp/#/quickstart
16
+	目前使用了van-grid ,van-cell。,van-popup。,van-grid
17
+三:备注
18
+  原型设计稿
19
+  https://v5.modao.cc/app/073ae6dcb639121eb7dc8d1c4af35975f8681a1c?simulator_type=device&sticky
20
+  ui给的是本地文件,需要找相关人员

+ 240 - 0
app.js

@@ -0,0 +1,240 @@
1
+// app.js
2
+const ald = require('./utils/ald-stat.js')
3
+import { post, get, login } from './utils/http'
4
+App({
5
+  globalData: {
6
+    navBarData: {
7
+      navBarHeight: 0, // 导航栏高度
8
+      menuBotton: 0, // 胶囊距底部间距(保持底部间距一致)
9
+      menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
10
+      menuHeight: 0 // 胶囊高度(自定义内容可与胶囊高度保证一致)
11
+    },
12
+    userInfo: null, 
13
+    couponPopup: false,
14
+    coupon: null,
15
+    systemInfo: {},
16
+    sceneData: {},
17
+    memberRules: '', // 会员守则
18
+    storeData: {},
19
+    showGoods:false, //点击商品或者按钮跳转到下单页面是否直接显示美妆产品
20
+    toViewIndex:'', //记录首页跳转到项目页面的滚动下标
21
+  },
22
+  invite_id:"null",//邀请人id
23
+  //记录登录状态相关的配置
24
+  loginConfig: {
25
+    code: '',
26
+    codeTime: ''
27
+  },
28
+  address:{},
29
+  onLaunch(options) {
30
+    
31
+    let WHITE_LIST=['pages/login/login','pages/home/home']
32
+    if(!WHITE_LIST.includes(options.path)){
33
+      if(wx.getStorageSync('userInfo')==''){
34
+        console.log('登录');
35
+        // wx.navigateTo({
36
+        //   url: '/pages/login/login',
37
+        // })
38
+      }
39
+    }
40
+    let that = this
41
+    // this.getPermission(that); //获取当前定位  
42
+    that.setNavBarInfo()
43
+    // 查询是否首次购买
44
+    if (wx.getStorageSync('token')) {
45
+      get('api/order/check_first', {}, (res) => {
46
+        if (res.data.order_status == 1) {
47
+          wx.setStorageSync('agree', true)
48
+        }
49
+      })
50
+    }
51
+    that.initData()
52
+    // this.getPermission()
53
+  },
54
+  onShow(opts) {
55
+    this.globalData.sceneData = {
56
+      path: opts.path,
57
+      query: opts.query
58
+    }
59
+    if (!this.globalData.userInfo) {
60
+      this.initData()
61
+    }
62
+    if (opts.path == 'pages/deviceLogin/deviceLogin') {
63
+      return
64
+    }
65
+    // if (!wx.getStorageSync('token') || !wx.getStorageSync('userInfo')) {
66
+    //   login(opts)
67
+    // }
68
+  },
69
+
70
+  /**
71
+   * 初始化数据
72
+   */
73
+  initData() {
74
+    let that = this
75
+    // 获取用户信息
76
+    if (wx.getStorageSync('token')) {
77
+      get('api/user', {}, (res) => {
78
+        if (res.data) {
79
+          that.globalData.userInfo = res.data
80
+          wx.setStorageSync('userInfo', res.data)
81
+        }
82
+      })
83
+    }
84
+
85
+    return
86
+    // 获取店铺信息
87
+    let storeId = wx.getStorageSync('store_id')
88
+    if (storeId) {
89
+      get(
90
+        'api/store/info',
91
+        {
92
+          store_id: storeId
93
+        },
94
+        (res) => {
95
+          this.globalData.storeData = res.data
96
+        }
97
+      )
98
+    }
99
+  },
100
+
101
+  /**
102
+   * @description 设置导航栏信息
103
+   */
104
+  setNavBarInfo() {
105
+    // 获取系统信息
106
+    const systemInfo = wx.getSystemInfoSync()
107
+    this.globalData.systemInfo = systemInfo
108
+    // 胶囊按钮位置信息
109
+    const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
110
+    this.systemInfo = systemInfo
111
+    // 导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度
112
+    let navBarData = {
113
+      navBarHeight:
114
+        (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 +
115
+        menuButtonInfo.height +
116
+        systemInfo.statusBarHeight,
117
+      menuBotton: menuButtonInfo.top - systemInfo.statusBarHeight,
118
+      menuRight: systemInfo.screenWidth - menuButtonInfo.right,
119
+      menuHeight: menuButtonInfo.height
120
+    }
121
+    this.globalData.navBarData = navBarData
122
+  },
123
+    /**
124
+   * 获取当前定位
125
+   * @param {*} obj 
126
+   */
127
+  getPermission: function (obj) {
128
+    let that = this
129
+    // wx.getLocation({
130
+    //   success: function (res) {
131
+    //     that.getStore()
132
+    //     that.globalData.address = res
133
+    //     // console.log(that.address, 'that.addressthat.address', res);
134
+    //   },
135
+    //   fail: function () {
136
+    //     wx.getSetting({
137
+    //       success: function (res) {
138
+    //         var statu = res.authSetting;
139
+    //         if (!statu['scope.userLocation']) {
140
+    //           wx.showModal({
141
+    //             title: '是否授权当前位置',
142
+    //             content: '需要获取您的地理位置,请确认授权,否则无法定位最近店铺',
143
+    //             success: function (tip) {
144
+    //               if (tip.confirm) {
145
+    //                 wx.openSetting({
146
+    //                   success: function (data) {
147
+    //                     if (data.authSetting["scope.userLocation"] === true) {
148
+    //                       wx.showToast({
149
+    //                         title: '授权成功',
150
+    //                         icon: 'success',
151
+    //                         duration: 1000
152
+    //                       })
153
+    //                       //授权成功之后,再调用chooseLocation选择地方
154
+    //                       wx.getLocation({
155
+    //                         success: function (res) {
156
+    //                           that.getStore()
157
+    //                           app.address = res
158
+    //                         },
159
+    //                       })
160
+    //                     } else {
161
+    //                       wx.showToast({
162
+    //                         title: '授权失败',
163
+    //                         icon: 'success',
164
+    //                         duration: 1000
165
+    //                       })
166
+    //                     }
167
+    //                   }
168
+    //                 })
169
+    //               }
170
+    //             }
171
+    //           })
172
+    //         }
173
+    //       },
174
+    //       fail: function (res) {
175
+    //         wx.showToast({
176
+    //           title: '调用授权窗口失败',
177
+    //           icon: 'success',
178
+    //           duration: 1000
179
+    //         })
180
+    //       }
181
+    //     })
182
+    //   }
183
+    // })
184
+  },
185
+    /**
186
+   * 获取店铺接口
187
+   * /api/store
188
+   */
189
+  getStore() {
190
+    get(
191
+      'api/store', {
192
+        page: 1,
193
+        limit: 100,
194
+        keyword: ""
195
+      },
196
+      (res) => {
197
+        let lat1 = this.globalData.address.latitude,
198
+          lng1 = this.globalData.address.longitude,
199
+          storeList = res.data.list,
200
+          distanceList = []
201
+        //循环遍历计算获取当前定位到各门店的距离
202
+        storeList.forEach(item => {
203
+          let distanceInfo = {}
204
+          distanceInfo["id"] = item.id
205
+          distanceInfo["dist"] = this.getDistance(lat1, lng1, item.latitude, item.longitude)
206
+          distanceList.push(distanceInfo)
207
+        })
208
+        //近到远排序
209
+        let _distanceList = distanceList.sort(function (a, b) {
210
+          return a.dist - b.dist
211
+        })
212
+        // //切换门店
213
+        // this.getStoreInfo(String(_distanceList[0].id))
214
+        wx.setStorageSync('store_id', String(_distanceList[0].id))
215
+      }
216
+    )
217
+  },
218
+    /**
219
+   * 两点之间距离计算
220
+   * @param {*} lat1 
221
+   * @param {*} lng1 
222
+   * @param {*} lat2 
223
+   * @param {*} lng2 
224
+   */
225
+  getDistance(lat1, lng1, lat2, lng2) {
226
+    lat1 = lat1 || 0;
227
+    lng1 = lng1 || 0;
228
+    lat2 = lat2 || 0;
229
+    lng2 = lng2 || 0;
230
+
231
+    var rad1 = lat1 * Math.PI / 180.0;
232
+    var rad2 = lat2 * Math.PI / 180.0;
233
+    var a = rad1 - rad2;
234
+    var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
235
+    var r = 6378137;
236
+    var distance = r * 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(rad1) * Math.cos(rad2) * Math.pow(Math.sin(b / 2), 2)));
237
+
238
+    return distance;
239
+  },
240
+})

+ 160 - 0
app.json

@@ -0,0 +1,160 @@
1
+{
2
+  "pages": [
3
+    "pages/home/home",
4
+    "pages/activePage2/activePage2",
5
+    "pages/couponCenter/couponCenter",
6
+    "pages/faceDetectionDetails/faceDetectionDetails",
7
+    "pages/recommendRule/recommendRule",
8
+    "pages/actDetails/actDetails",
9
+    "pages/authOrder/authOrder",
10
+    "pages/confirmProjectOrder/confirmProjectOrder",
11
+    "pages/orderDetailsProject/orderDetailsProject",
12
+    "pages/orderBySuccess/orderBySuccess",
13
+    "pages/paySuccess/paySuccess",
14
+    "pages/reserveCar/reserveCar",
15
+    "pages/member/member",
16
+    "pages/orderBy/orderBy",
17
+    "pages/vip/vip",
18
+    "pages/vipCard/vipCard",
19
+    "pages/coupon/coupon",
20
+    "pages/disclaimer/disclaimer",
21
+    "pages/order/order",
22
+    "pages/orderDetail/orderDetail",
23
+    "pages/projectDetail/projectDetail",
24
+    "pages/orderConfirm/orderConfirm",
25
+    "pages/goodsOrderConfirm/goodsOrderConfirm",
26
+    "pages/store/store",
27
+    "pages/login/login",
28
+    "pages/agreement/agreement",
29
+    "pages/deviceLogin/deviceLogin",
30
+    "pages/caseList/caseList",
31
+    "pages/article/article",
32
+    "pages/dossier/dossier",
33
+    "pages/phone/phone",
34
+    "pages/contact/contact",
35
+    "pages/caseDetail/caseDetail",
36
+    "pages/articleDetail/articleDetail",
37
+    "pages/name/name",
38
+    "pages/skinRecord/skinRecord",
39
+    "pages/test/test",
40
+    "pages/skinRecordList/skinRecordList",
41
+    "pages/beautyPlan/beautyPlan",
42
+    "pages/beautyPlanList/beautyPlanList",
43
+    "pages/reserveProject/reserveProject",
44
+    "pages/reserveProduct/reserveProduct",
45
+    "pages/feedback/feedback",
46
+    "pages/addFeedback/addFeedback",
47
+    "pages/goods/orderList/orderList",
48
+    "pages/goods/orderDetail/orderDetail",
49
+    "pages/member/investigation/investigation",
50
+    "pages/storedValue/index",
51
+    "pages/rechange/index",
52
+    "pages/toolDetails/index",
53
+    "pages/guildMessage/index",
54
+    "pages/plan/plan",
55
+    "pages/invitationDetails/invitationDetails",
56
+    "pages/invitationDetails/poster/poster",
57
+    "pages/invitees/invitees",
58
+    "pages/sucReception/sucReception",
59
+    "pages/couponHistory/couponHistory",
60
+    "pages/sendFriend/sendFriend",
61
+    "pages/sendGetCoupon/sendGetCoupon",
62
+    "pages/shoppingMall/shoppingMall",
63
+    "pages/payList/payList"
64
+  ],
65
+  "subpackages": [
66
+    {
67
+      "root": "subPackages",
68
+      "name": "分包A",
69
+      "pages": [
70
+        "pages/cardBag/cardBag",
71
+        "pages/subCardDetails/subCardDetails",
72
+        "pages/couponHistory/couponHistory"
73
+      ]
74
+    },{
75
+      "root": "subPackagesB",
76
+      "name": "分包B",
77
+      "pages": [
78
+        "pages/joinGroup/joinGroup",
79
+        "pages/groupRecord/groupRecord",
80
+        "pages/groupOrder/groupOrder",
81
+        "pages/groupFlow/groupFlow",
82
+        "pages/groupDetail/groupDetail",
83
+        "pages/successOrder/successOrder",
84
+        "pages/GroupConfirm/GroupConfirm",
85
+        "pages/groupExplain/groupExplain"
86
+      ]
87
+    },{
88
+      "root": "subPackagesC",
89
+      "name": "分包C",
90
+      "pages": [
91
+        "pages/messageCenter/messageCenter",
92
+        "pages/messageDetail/messageDetail"
93
+      ]
94
+    }    ,{
95
+      "root": "subPackagesD",
96
+      "name": "分包D",
97
+      "pages": [
98
+        "pages/testSkin/testSkin",
99
+        "pages/skinHistory/skinHistory",
100
+        "pages/skinLoading/skinLoading",
101
+        "pages/skinPlan/skinPlan"
102
+      ]
103
+    }
104
+  ],
105
+  "tabBar": {
106
+    "color": "#666666",
107
+    "selectedColor": "#333333",
108
+    "borderStyle": "white",
109
+    "backgroundColor": "#fff",
110
+    "list": [
111
+      {
112
+        "pagePath": "pages/home/home",
113
+        "iconPath": "images/nav/首页-未选中@2x.png",
114
+        "selectedIconPath": "images/nav/首页-选中@2x.png",
115
+        "text": "首页"
116
+      },
117
+      {
118
+        "pagePath": "pages/shoppingMall/shoppingMall",
119
+        "iconPath": "images/nav/商城-未选中@2x.png",
120
+        "selectedIconPath": "images/nav/商城-选中@2x.png",
121
+        "text": "商城"
122
+      },
123
+      {
124
+        "pagePath": "pages/orderBy/orderBy",
125
+        "iconPath": "images/nav/预约-未选中@2x.png",
126
+        "selectedIconPath": "images/nav/预约-选中@2x.png",
127
+        "text": "预约"
128
+      },
129
+      {
130
+        "pagePath": "pages/article/article",
131
+        "iconPath": "images/nav/知识-未选中@2x.png",
132
+        "selectedIconPath": "images/nav/知识-选中@2x.png",
133
+        "text": "知识"
134
+      },
135
+      {
136
+        "pagePath": "pages/member/member",
137
+        "iconPath": "images/nav/我的-未选中@2x.png",
138
+        "selectedIconPath": "images/nav/我的-选中@2x.png",
139
+        "text": "我的"
140
+      }
141
+
142
+    ]
143
+  },
144
+  "window": {
145
+    "backgroundTextStyle": "light",
146
+    "navigationBarBackgroundColor": "#fff",
147
+    "navigationBarTitleText": "Weixin",
148
+    "navigationBarTextStyle": "black"
149
+  },
150
+  "permission": {
151
+    "scope.userLocation": {
152
+      "desc": "你的位置信息将用于小程序位置接口的效果展示"
153
+    }
154
+  },
155
+  "requiredPrivateInfos": [
156
+    "getLocation"
157
+  ],
158
+  "usingComponents": {},
159
+  "sitemapLocation": "sitemap.json"
160
+}

+ 28 - 0
app.wxs

@@ -0,0 +1,28 @@
1
+var replaceStr = function (str) {
2
+  if (str) {
3
+    return str.replace(getRegExp('-', 'g'), '.')
4
+  }
5
+}
6
+
7
+var indexOf = function (args, param) {
8
+  if (args.indexOf(param) > -1) {
9
+    return true
10
+  }
11
+  return false
12
+}
13
+var mysub = function(str,start,length){
14
+  //起始位置
15
+  var offset = start || 0;
16
+  var len=length || 70;
17
+  if(str.length<=len){
18
+    return str;
19
+  }
20
+  return str.substring(offset,len)+'...';
21
+}
22
+
23
+
24
+module.exports = {
25
+  replaceStr: replaceStr,
26
+  indexOf: indexOf,
27
+  mysub:mysub
28
+}

+ 147 - 0
app.wxss

@@ -0,0 +1,147 @@
1
+/**app.wxss**/
2
+page {
3
+  /* background: #F9F9F9; */
4
+  background: #F7F8FA;
5
+  /* background: linear-gradient(180deg, #FA7D22 0%, rgba(255, 202, 224, 0) 100%);
6
+  background-repeat: no-repeat; */
7
+}
8
+
9
+.container {
10
+  height: 100%;
11
+  display: flex;
12
+  flex-direction: column;
13
+  align-items: center;
14
+  justify-content: space-between;
15
+  padding: 200rpx 0;
16
+  box-sizing: border-box;
17
+}
18
+
19
+.flex {
20
+  display: flex;
21
+}
22
+
23
+.flex-start {
24
+  align-items: flex-start;
25
+  justify-content: flex-start;
26
+}
27
+
28
+.flex-align-center {
29
+  display: flex;
30
+  align-items: center;
31
+}
32
+
33
+.flex-align-baseline {
34
+  display: flex;
35
+  align-items: baseline;
36
+}
37
+
38
+.flex-justify-center {
39
+  display: flex;
40
+  justify-content: center;
41
+}
42
+
43
+.flex-justify-space-around {
44
+  display: flex;
45
+  justify-content: space-around;
46
+}
47
+
48
+.flex-justify-space-between {
49
+  display: flex;
50
+  justify-content: space-between;
51
+}
52
+
53
+.flex-center {
54
+  display: flex;
55
+  align-items: center;
56
+  justify-content: center;
57
+}
58
+
59
+.flex-column {
60
+  display: flex;
61
+  flex-direction: column;
62
+  /* align-items: flex-start;
63
+  justify-content: flex-start; */
64
+}
65
+
66
+.flex1 {
67
+  flex: 1;
68
+}
69
+
70
+.radius {
71
+  border-radius: 8rpx;
72
+  box-sizing: border-box;
73
+  overflow: hidden;
74
+}
75
+
76
+.popup-radius .wux-popup__content {
77
+  border-top-left-radius: 40rpx;
78
+  border-top-right-radius: 40rpx;
79
+}
80
+.ellipsis {
81
+  white-space: nowrap;
82
+  overflow: hidden;
83
+  text-overflow: ellipsis;
84
+}
85
+
86
+.ellipsis2 {
87
+  /* overflow: hidden;
88
+  text-overflow: ellipsis;
89
+  display: -webkit-box;
90
+  -webkit-line-clamp: 2;
91
+  -webkit-box-orient: vertical; */
92
+
93
+  text-overflow: ellipsis;
94
+  display: -webkit-box;
95
+  -webkit-line-clamp: 2;
96
+  -webkit-box-orient: vertical;
97
+  display: -moz-box;
98
+  -moz-line-clamp: 2;
99
+  -moz-box-orient: vertical;
100
+  word-wrap: break-word;
101
+  word-break: break-all;
102
+  white-space: normal !important;
103
+  overflow: hidden;
104
+}
105
+
106
+.ellipsis3 {
107
+  overflow: hidden;
108
+  text-overflow: ellipsis;
109
+  display: -webkit-box;
110
+  -webkit-line-clamp: 3;
111
+  -webkit-box-orient: vertical;
112
+}
113
+
114
+text {
115
+  font-size: 32rpx;
116
+  color: #333333;
117
+  /* color: #FFFFFF; */
118
+  font-family: PingFangSC-Regular;
119
+}
120
+
121
+.btm-text {
122
+  font-size: 28rpx;
123
+  color: #999999;
124
+  text-align: center;
125
+  margin: 42rpx 0;
126
+}
127
+
128
+.no-data {
129
+  text-align: center;
130
+  margin-top: 400rpx;
131
+  color: #666;
132
+}
133
+
134
+
135
+.no-more-data {
136
+  text-align: center;
137
+  margin-top: 28rpx;
138
+  color: #666;
139
+}
140
+
141
+rich-text .richImg {
142
+  max-width: 100%;
143
+  max-height: 100%;
144
+  vertical-align: middle;
145
+  height: auto !important;
146
+  width: auto !important;
147
+}

+ 106 - 0
components/local/change-env/change-env.js

@@ -0,0 +1,106 @@
1
+// components/local/change-env/change-env.js
2
+// app.js
3
+import {
4
+  login
5
+} from '../../../utils/http';
6
+Component({
7
+  /**
8
+   * 组件的属性列表
9
+   */
10
+  options: {
11
+    addGlobalClass: true
12
+  },
13
+  properties: {
14
+    visible: {
15
+      type: Boolean,
16
+      value: false,
17
+    },
18
+  },
19
+
20
+  /**
21
+   * 组件的初始数据
22
+   */
23
+  data: {
24
+    inputVal: "",
25
+    env: false,
26
+    items: [{
27
+        value: 'ijolijoli',
28
+        name: '正式环境',
29
+        checked: true
30
+      },
31
+      {
32
+        value: 'dev',
33
+        name: '测试环境',
34
+        checked: false
35
+      },
36
+    ]
37
+  },
38
+
39
+  /**
40
+   * 组件的方法列表
41
+   */
42
+  methods: {
43
+    // 监听输入框
44
+    onChangeInput(e) {
45
+      this.setData({
46
+        inputVal: e.detail.value
47
+      })
48
+    },
49
+
50
+    // 点击确定事件
51
+    onConfirm() {
52
+      let {
53
+        env,
54
+        items
55
+      } = this.data;
56
+      if (env) {
57
+        items.forEach((item, index) => {
58
+          if (item.checked) {
59
+            wx.setStorageSync('env', item.value)
60
+            this.setData({
61
+              visible: false,
62
+              env: false,
63
+            }, () => {
64
+              login()
65
+              wx.reLaunch({
66
+                url: '/pages/home/home',
67
+              })
68
+            })
69
+          }
70
+        })
71
+        return;
72
+      }
73
+      if (this.data.inputVal == 'ijolijoli') {
74
+        this.setData({
75
+          env: true
76
+        })
77
+      } else {
78
+        wx.showToast({
79
+          title: '密码错误',
80
+          icon: 'none'
81
+        })
82
+      }
83
+      console.log(this.data.inputVal)
84
+    },
85
+
86
+    // 点击取消事件
87
+    onCancel() {
88
+      this.setData({
89
+        visible: false,
90
+        env: false
91
+      })
92
+    },
93
+
94
+    // 监听却换环境
95
+    onChangeRadio(e) {
96
+      console.log('radio发生change事件,携带value值为:', e.detail.value)
97
+      const items = this.data.items
98
+      for (let i = 0, len = items.length; i < len; ++i) {
99
+        items[i].checked = items[i].value === e.detail.value
100
+      }
101
+      this.setData({
102
+        items
103
+      })
104
+    },
105
+  }
106
+})

+ 6 - 0
components/local/change-env/change-env.json

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

+ 15 - 0
components/local/change-env/change-env.wxml

@@ -0,0 +1,15 @@
1
+<wux-landscape visible="{{ visible }}"  maskClosable="{{ true }}" closable="{{ false }}" bind:close="onCancelUse">
2
+  <view class="use-popup flex-column" wx:if="{{ visible }}">
3
+    <input wx:if="{{!env}}" class="weui-input" auto-focus placeholder="请输入密码" bindinput="onChangeInput" />
4
+    <radio-group bindchange="onChangeRadio" wx:if="{{env}}">
5
+      <label class="flex" wx:for="{{items}}" wx:key="index">
6
+        <radio value="{{item.value}}" checked="{{item.checked}}"/>
7
+        <view style="margin-left: 30rpx;">{{item.name}}</view>
8
+      </label>
9
+    </radio-group>
10
+    <view class="use-btn flex">
11
+      <view class="btn cancel flex-center" bindtap="onCancel">取消</view>
12
+      <view class="btn confirm flex-center" bindtap="onConfirm">确定</view>
13
+    </view>
14
+  </view>
15
+</wux-landscape>

+ 53 - 0
components/local/change-env/change-env.wxss

@@ -0,0 +1,53 @@
1
+.use-popup {
2
+  width: 558rpx;
3
+  /* height: 350rpx; */
4
+  background: #FFFFFF;
5
+  border-radius: 20rpx;
6
+  overflow: hidden;
7
+  /* justify-content: center; */
8
+  justify-content: space-evenly;
9
+}
10
+
11
+/* .use-popup .red {
12
+  font-size: 24rpx;
13
+  font-family: PingFangSC-Regular, PingFang SC;
14
+  font-weight: 400;
15
+  color: #E95564;
16
+} */
17
+
18
+.use-popup input {
19
+  text-align: left;
20
+  padding: 30rpx;
21
+}
22
+
23
+radio-group {
24
+  padding: 30rpx 30rpx 0;
25
+}
26
+
27
+radio-group label {
28
+  margin-bottom: 30rpx;
29
+}
30
+
31
+.use-btn {
32
+  padding: 30rpx;
33
+  border-top: 1rpx solid #ccc;
34
+}
35
+
36
+.use-btn .btn {
37
+  flex: 1;
38
+  /* width: 208rpx; */
39
+  height: 92rpx;
40
+  /* margin: 0 48rpx; */
41
+  font-size: 36rpx;
42
+  color: #FA7D22;
43
+  border-radius: 52rpx;
44
+  border: 2rpx solid #FA7D22;
45
+}
46
+
47
+
48
+.use-btn .confirm {
49
+  /* margin-top: 28rpx; */
50
+  margin-left: 46rpx;
51
+  background-color: #FA7D22;
52
+  color: #fff;
53
+}

+ 103 - 0
components/local/couponItem/couponItem.js

@@ -0,0 +1,103 @@
1
+// components/local/couponItem/couponItem.js
2
+Component({
3
+  // options: {
4
+  //   addGlobalClass: true
5
+  // },
6
+  /**
7
+   * 组件的属性列表
8
+   */
9
+  properties: {
10
+    source: {
11
+      type: String,
12
+      value: '' // 场景 默认为空(简单的列表),可选值:checkBox(勾选操作)
13
+    },
14
+    item: {
15
+      type: Object,
16
+      value: {}
17
+    },
18
+    couponStatus: {
19
+      type: Number,
20
+      value: 0 // 0待使用,1已使用,2已过期
21
+    },
22
+    checkStatus: {
23
+      type: Boolean,
24
+      value: false // 是否选中 0 未选择, 1选中
25
+    }
26
+  },
27
+
28
+  /**
29
+   * 组件的初始数据
30
+   */
31
+  data: {
32
+    showRuleText: false,
33
+    marks: {
34
+      // 优惠券类型,1直接抵扣券,2满减券,3全额减免券,4卡券
35
+      1: '抵扣券',
36
+      2: '满减券',
37
+      3: '全额减免券',
38
+      4: '项目卡券'
39
+    }
40
+  },
41
+
42
+  /**
43
+   * 组件生命周期函数-在组件实例进入页面节点树时执行)
44
+   */
45
+  attached: function () {
46
+    let { item } = this.data
47
+    // 数据结构不一致,对齐参数
48
+    this.setData({
49
+      'item.coupon_type':
50
+        item.coupon_type == undefined ? item.type : item.coupon_type
51
+    })
52
+  },
53
+
54
+  // /**
55
+  //  * 组件数据字段监听器,用于监听 properties 和 data 的变化
56
+  //  */
57
+  // observers: {
58
+  //   checkStatus: function (checkStatus) {
59
+  //     checkStatus == this.data.checkStatus
60
+  //   }
61
+  // },
62
+
63
+  /**
64
+   * 组件的方法列表
65
+   */
66
+  methods: {
67
+    /**
68
+     * 点击整条优惠券
69
+     */
70
+    clickItem: function (e) {
71
+      let { source } = this.data
72
+      if (source == 'checkbox') {
73
+        this.check(e)
74
+      }
75
+    },
76
+    /**
77
+     * 展开、收起规则
78
+     */
79
+    clickRuleText: function () {
80
+      this.setData({
81
+        showRuleText: !this.data.showRuleText
82
+      })
83
+    },
84
+    /**
85
+     * 点击使用按钮、勾选按钮
86
+     */
87
+    check: function (e) {
88
+      if (this.data.couponStatus != 0) {
89
+        return
90
+      }
91
+      let checkStatus = !this.data.checkStatus
92
+      this.setData(
93
+        {
94
+          checkStatus: checkStatus
95
+        },
96
+        this.triggerEvent('check', {
97
+          id: e.currentTarget.dataset.id,
98
+          checkStatus: checkStatus
99
+        })
100
+      )
101
+    }
102
+  }
103
+})

+ 4 - 0
components/local/couponItem/couponItem.json

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

+ 35 - 0
components/local/couponItem/couponItem.wxml

@@ -0,0 +1,35 @@
1
+<view class="component-coupon-item flex-justify-center flex-column {{couponStatus == 0 ? '' : 'invalid' }}">
2
+  <view class="coupon-item-mark">{{marks[item.coupon_type]}}</view>
3
+  <view class="coupon-item-content" bindtap="clickItem" data-id="{{item.id}}">
4
+    <view class="coupon-item-money">
5
+      <view class="coupon-item-money-detail flex-row justify-between" style="margin-top: 30rpx;" wx:if="{{item.coupon_type == 3 || item.coupon_type == 4}}">
6
+        <text class="yuan" style="font-size: 44rpx">全免</text>
7
+      </view>
8
+      <view class="coupon-item-money-detail flex-row justify-between {{item.coupon_type == 2 ? 'line2' : ''}}" wx:else>
9
+        <text class="currency">¥</text>
10
+        <text class="yuan-price">{{item.price}}</text>
11
+        <!-- <text class="fen">.00</text> -->
12
+      </view>
13
+      <text class="coupon-item-limit-text ellipsis" wx:if="{{item.coupon_type == 2}}">满{{item.full_price}}元可用</text>
14
+    </view>
15
+    <view class="coupon-item-title flex-col justify-between flex1">
16
+      <text class="ellipsis">{{item.coupon_name}}</text>
17
+      <text class="coupon-time ellipsis">有效期{{item.ex_time}}</text>
18
+    </view>
19
+    <view wx:if="{{!source&&couponStatus==0}}" class="coupon-item-btn1 flex-col justify-center align-center" catchtap="check" data-id="{{item.id}}">
20
+      去使用 
21
+    </view>
22
+    <view wx:elif="{{source=='checkbox'}}" class="coupon-item-btn2 flex-col justify-center align-center" catchtap="check" data-id="{{item.id}}">
23
+      <image src="{{checkStatus ? '/images/icon_17.png' : '/images/icon_16.png'}}"></image>
24
+    </view>
25
+  </view>
26
+  <!-- 0待使用,1已使用,2已过期 -->
27
+  <image class="coupon-item-status-icon" wx:if="{{couponStatus == 1 || couponStatus == 2}}" src="{{couponStatus == 1 ? '/images/my/icon_coupon_used.png' : '/images/my/icon_coupon_expired.png'}}"></image>
28
+  <view class="coupon-item-line flex-col"></view>
29
+  <view class="coupon-item-rules flex-row flex-center" bindtap="clickRuleText">
30
+    <text class="coupon-item-rules-text {{showRuleText ? ' rules-show ' : ' ellipsis '}}">{{item.coupon_desc}}</text>
31
+    <view class="flex-center" style="justify-content: flex-end;">
32
+      <image style="{{showRuleText ? 'transform: rotate(180deg);' : ''}}" src="{{couponStatus == 0 ? '/images/icon_arrow_2.png' : '/images/icon_arrow_gray.png'}}"></image>
33
+    </view>
34
+  </view>
35
+</view>

+ 274 - 0
components/local/couponItem/couponItem.wxss

@@ -0,0 +1,274 @@
1
+/* components/local/couponItem/couponItem.wxss */
2
+.flex {
3
+  display: flex;
4
+}
5
+
6
+.flex-start {
7
+  align-items: flex-start;
8
+  justify-content: flex-start;
9
+}
10
+
11
+.flex-align-center {
12
+  display: flex;
13
+  align-items: center;
14
+}
15
+
16
+.flex-align-baseline {
17
+  display: flex;
18
+  align-items: baseline;
19
+}
20
+
21
+.flex-justify-center {
22
+  display: flex;
23
+  justify-content: center;
24
+}
25
+
26
+.flex-justify-space-around {
27
+  display: flex;
28
+  justify-content: space-around;
29
+}
30
+
31
+.flex-justify-space-between {
32
+  display: flex;
33
+  justify-content: space-between;
34
+}
35
+
36
+.flex-center {
37
+  display: flex;
38
+  align-items: center;
39
+  justify-content: center;
40
+}
41
+
42
+.flex-column {
43
+  display: flex;
44
+  flex-direction: column;
45
+  /* align-items: flex-start;
46
+  justify-content: flex-start; */
47
+}
48
+
49
+.flex1 {
50
+  flex: 1;
51
+}
52
+
53
+.ellipsis {
54
+  white-space: nowrap;
55
+  overflow: hidden;
56
+  text-overflow: ellipsis;
57
+}
58
+
59
+.component-coupon-item text {
60
+  font-family: PingFangSC-Medium, PingFang SC;
61
+}
62
+
63
+.component-coupon-item.invalid {
64
+  background: #E6E6E6 !important;
65
+}
66
+
67
+.component-coupon-item.invalid text {
68
+  color: #B1B1B1 !important;
69
+}
70
+
71
+.component-coupon-item.invalid .coupon-item-mark {
72
+  background: #B3B3B3 !important;
73
+}
74
+
75
+.component-coupon-item.invalid .coupon-item-btn1 {
76
+  background: #B3B3B3 !important;
77
+}
78
+
79
+.component-coupon-item.invalid .coupon-item-line {
80
+  border-top: 2rpx dashed #D7D7D7 !important;
81
+}
82
+
83
+.component-coupon-item .flex2 {
84
+  flex: 2;
85
+}
86
+
87
+.component-coupon-item .flex-row {
88
+  display: flex;
89
+  flex-direction: row;
90
+}
91
+
92
+.component-coupon-item .flex-col {
93
+  display: flex;
94
+  flex-direction: column;
95
+}
96
+
97
+.component-coupon-item {
98
+  position: relative;
99
+  background: #FFF4E6;
100
+  border-radius: 24rpx;
101
+  overflow: hidden;
102
+  padding: 20rpx 28rpx 12rpx;
103
+  text-align: left;
104
+}
105
+
106
+.coupon-item-mark {
107
+  position: absolute;
108
+  top: 0;
109
+  left: 0;
110
+  height: 36rpx;
111
+  background: #875617;
112
+  border-radius: 24rpx 0rpx 24rpx 0rpx;
113
+  text-align: center;
114
+  line-height: 36rpx;
115
+  font-size: 20rpx;
116
+  font-weight: 500;
117
+  color: #FFFFFF;
118
+  padding: 0 16rpx;
119
+}
120
+
121
+.coupon-item-content {
122
+  display: flex;
123
+  flex-direction: row;
124
+  align-items: center;
125
+  justify-content: space-between;
126
+}
127
+
128
+.coupon-item-money {
129
+  flex: 1.2;
130
+  overflow: hidden;
131
+}
132
+
133
+.coupon-item-money text {
134
+  font-family: PingFangSC-Medium, PingFang SC;
135
+  font-weight: 500;
136
+  color: #FF3007;
137
+}
138
+
139
+.coupon-item-money-detail {
140
+  align-items: baseline;
141
+  margin-top: 30rpx;
142
+}
143
+
144
+.coupon-item-money-detail.line2 {
145
+  margin-top: 10rpx;
146
+}
147
+
148
+.coupon-item-money-detail.line2 .yuan {
149
+  line-height: 70rpx;
150
+}
151
+
152
+.coupon-item-money-detail .currency {
153
+  font-size: 28rpx;
154
+  font-family: PingFangSC-Medium, PingFang SC;
155
+  line-height: 40rpx;
156
+}
157
+
158
+.coupon-item-money-detail .yuan {
159
+  font-size: 56rpx;
160
+  font-family: PingFangSC-Medium, PingFang SC;
161
+  line-height: 80rpx;
162
+}
163
+.coupon-item-money-detail .yuan-price{
164
+  font-size: 42rpx;
165
+  font-family: PingFangSC-Medium, PingFang SC;
166
+  line-height: 80rpx;
167
+}
168
+
169
+.coupon-item-money-detail .fen {
170
+  font-size: 28rpx;
171
+  font-family: PingFangSC-Medium, PingFang SC;
172
+  font-weight: 500;
173
+  line-height: 40rpx;
174
+}
175
+
176
+.coupon-item-limit-text {
177
+  font-size: 24rpx;
178
+  font-family: PingFangSC-Regular, PingFang SC !important;
179
+  font-weight: 400;
180
+  color: #FF3007;
181
+  line-height: 34rpx;
182
+}
183
+
184
+.coupon-item-btn1 {
185
+  width: 104rpx;
186
+  height: 50rpx;
187
+  background: #FA7D22;
188
+  border-radius: 25rpx;
189
+  font-size: 24rpx;
190
+  font-family: PingFang-SC-Medium, PingFang-SC;
191
+  font-weight: 500;
192
+  color: #FFFFFF;
193
+  line-height: 50rpx;
194
+  text-align: center;
195
+}
196
+
197
+.coupon-item-btn2 {
198
+  width: 48rpx;
199
+  height: 48rpx;
200
+  font-family: PingFang-SC-Medium, PingFang-SC;
201
+  font-weight: 500;
202
+  line-height: 50rpx;
203
+  text-align: right;
204
+}
205
+
206
+.coupon-item-btn2 image {
207
+  width: 48rpx;
208
+  height: 48rpx;
209
+}
210
+
211
+.coupon-item-title {
212
+  margin-top: 10rpx;
213
+  /* margin-left: 36rpx; */
214
+  flex: 2.5;
215
+  overflow: hidden;
216
+}
217
+
218
+.coupon-item-title text {
219
+  width: 100%;
220
+  height: 44rpx;
221
+  line-height: 44rpx;
222
+  font-size: 32rpx;
223
+  font-weight: 500;
224
+  color: #875617;
225
+  margin-top: 16rpx;
226
+}
227
+
228
+.coupon-item-title .coupon-time {
229
+  height: 34rpx;
230
+  line-height: 34rpx;
231
+  font-size: 24rpx;
232
+  font-family: PingFangSC-Regular, PingFang SC;
233
+  font-weight: 400;
234
+  color: #875617;
235
+}
236
+
237
+.coupon-item-line {
238
+  height: 2rpx;
239
+  border: none;
240
+  border-top: 2rpx dashed #FFDFB6;
241
+  margin: 16rpx 0 10rpx;
242
+}
243
+
244
+.coupon-item-rules {
245
+  justify-content: space-between;
246
+}
247
+
248
+.coupon-item-rules image {
249
+  width: 48rpx;
250
+  height: 48rpx;
251
+}
252
+
253
+.coupon-item-rules-text {
254
+  height: 32rpx;
255
+  line-height: 32rpx;
256
+  font-size: 24rpx;
257
+  font-family: PingFangSC-Regular, PingFang SC;
258
+  font-weight: 400;
259
+  color: #C38029;
260
+  margin-right: 56rpx;
261
+}
262
+
263
+.coupon-item-rules-text.rules-show {
264
+  height: auto;
265
+  margin-top: 8rpx;
266
+}
267
+
268
+.coupon-item-status-icon {
269
+  width: 144rpx;
270
+  height: 144rpx;
271
+  position: absolute;
272
+  top: 36rpx;
273
+  right: 28rpx;
274
+}

+ 250 - 0
components/local/ec-canvas/ec-canvas.js

@@ -0,0 +1,250 @@
1
+import WxCanvas from './wx-canvas';
2
+import * as echarts from './echarts';
3
+
4
+let ctx;
5
+
6
+function compareVersion(v1, v2) {
7
+  v1 = v1.split('.')
8
+  v2 = v2.split('.')
9
+  const len = Math.max(v1.length, v2.length)
10
+
11
+  while (v1.length < len) {
12
+    v1.push('0')
13
+  }
14
+  while (v2.length < len) {
15
+    v2.push('0')
16
+  }
17
+
18
+  for (let i = 0; i < len; i++) {
19
+    const num1 = parseInt(v1[i])
20
+    const num2 = parseInt(v2[i])
21
+
22
+    if (num1 > num2) {
23
+      return 1
24
+    } else if (num1 < num2) {
25
+      return -1
26
+    }
27
+  }
28
+  return 0
29
+}
30
+
31
+Component({
32
+  properties: {
33
+    canvasId: {
34
+      type: String,
35
+      value: 'ec-canvas'
36
+    },
37
+
38
+    ec: {
39
+      type: Object
40
+    },
41
+
42
+    forceUseOldCanvas: {
43
+      type: Boolean,
44
+      value: false
45
+    }
46
+  },
47
+
48
+  data: {
49
+    isUseNewCanvas: false
50
+  },
51
+
52
+  ready: function () {
53
+    // Disable prograssive because drawImage doesn't support DOM as parameter
54
+    // See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
55
+    echarts.registerPreprocessor(option => {
56
+      if (option && option.series) {
57
+        if (option.series.length > 0) {
58
+          option.series.forEach(series => {
59
+            series.progressive = 0;
60
+          });
61
+        }
62
+        else if (typeof option.series === 'object') {
63
+          option.series.progressive = 0;
64
+        }
65
+      }
66
+    });
67
+
68
+    if (!this.data.ec) {
69
+      console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
70
+        + 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>');
71
+      return;
72
+    }
73
+
74
+    if (!this.data.ec.lazyLoad) {
75
+      this.init();
76
+    }
77
+  },
78
+
79
+  methods: {
80
+    init: function (callback) {
81
+      const version = wx.getSystemInfoSync().SDKVersion
82
+
83
+      const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0;
84
+      const forceUseOldCanvas = this.data.forceUseOldCanvas;
85
+      const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas;
86
+      this.setData({ isUseNewCanvas });
87
+
88
+      if (forceUseOldCanvas && canUseNewCanvas) {
89
+        console.warn('开发者强制使用旧canvas,建议关闭');
90
+      }
91
+
92
+      if (isUseNewCanvas) {
93
+        // console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>');
94
+        // 2.9.0 可以使用 <canvas type="2d"></canvas>
95
+        this.initByNewWay(callback);
96
+      } else {
97
+        const isValid = compareVersion(version, '1.9.91') >= 0
98
+        if (!isValid) {
99
+          console.error('微信基础库版本过低,需大于等于 1.9.91。'
100
+            + '参见:https://github.com/ecomfe/echarts-for-weixin'
101
+            + '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
102
+          return;
103
+        } else {
104
+          console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能');
105
+          this.initByOldWay(callback);
106
+        }
107
+      }
108
+    },
109
+
110
+    initByOldWay(callback) {
111
+      // 1.9.91 <= version < 2.9.0:原来的方式初始化
112
+      ctx = wx.createCanvasContext(this.data.canvasId, this);
113
+      const canvas = new WxCanvas(ctx, this.data.canvasId, false);
114
+
115
+      echarts.setCanvasCreator(() => {
116
+        return canvas;
117
+      });
118
+      // const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
119
+      const canvasDpr = 1
120
+      var query = wx.createSelectorQuery().in(this);
121
+      query.select('.ec-canvas').boundingClientRect(res => {
122
+        if (typeof callback === 'function') {
123
+          this.chart = callback(canvas, res.width, res.height, canvasDpr);
124
+        }
125
+        else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
126
+          this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
127
+        }
128
+        else {
129
+          this.triggerEvent('init', {
130
+            canvas: canvas,
131
+            width: res.width,
132
+            height: res.height,
133
+            canvasDpr: canvasDpr // 增加了dpr,可方便外面echarts.init
134
+          });
135
+        }
136
+      }).exec();
137
+    },
138
+
139
+    initByNewWay(callback) {
140
+      // version >= 2.9.0:使用新的方式初始化
141
+      const query = wx.createSelectorQuery().in(this)
142
+      query
143
+        .select('.ec-canvas')
144
+        .fields({ node: true, size: true })
145
+        .exec(res => {
146
+          const canvasNode = res[0].node
147
+          this.canvasNode = canvasNode
148
+
149
+          const canvasDpr = wx.getSystemInfoSync().pixelRatio
150
+          const canvasWidth = res[0].width
151
+          const canvasHeight = res[0].height
152
+
153
+          const ctx = canvasNode.getContext('2d')
154
+
155
+          const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode)
156
+          echarts.setCanvasCreator(() => {
157
+            return canvas
158
+          })
159
+
160
+          if (typeof callback === 'function') {
161
+            this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
162
+          } else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
163
+            this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
164
+          } else {
165
+            this.triggerEvent('init', {
166
+              canvas: canvas,
167
+              width: canvasWidth,
168
+              height: canvasHeight,
169
+              dpr: canvasDpr
170
+            })
171
+          }
172
+        })
173
+    },
174
+    canvasToTempFilePath(opt) {
175
+      if (this.data.isUseNewCanvas) {
176
+        // 新版
177
+        const query = wx.createSelectorQuery().in(this)
178
+        query
179
+          .select('.ec-canvas')
180
+          .fields({ node: true, size: true })
181
+          .exec(res => {
182
+            const canvasNode = res[0].node
183
+            opt.canvas = canvasNode
184
+            wx.canvasToTempFilePath(opt)
185
+          })
186
+      } else {
187
+        // 旧的
188
+        if (!opt.canvasId) {
189
+          opt.canvasId = this.data.canvasId;
190
+        }
191
+        ctx.draw(true, () => {
192
+          wx.canvasToTempFilePath(opt, this);
193
+        });
194
+      }
195
+    },
196
+
197
+    touchStart(e) {
198
+      if (this.chart && e.touches.length > 0) {
199
+        var touch = e.touches[0];
200
+        var handler = this.chart.getZr().handler;
201
+        handler.dispatch('mousedown', {
202
+          zrX: touch.x,
203
+          zrY: touch.y
204
+        });
205
+        handler.dispatch('mousemove', {
206
+          zrX: touch.x,
207
+          zrY: touch.y
208
+        });
209
+        handler.processGesture(wrapTouch(e), 'start');
210
+      }
211
+    },
212
+
213
+    touchMove(e) {
214
+      if (this.chart && e.touches.length > 0) {
215
+        var touch = e.touches[0];
216
+        var handler = this.chart.getZr().handler;
217
+        handler.dispatch('mousemove', {
218
+          zrX: touch.x,
219
+          zrY: touch.y
220
+        });
221
+        handler.processGesture(wrapTouch(e), 'change');
222
+      }
223
+    },
224
+
225
+    touchEnd(e) {
226
+      if (this.chart) {
227
+        const touch = e.changedTouches ? e.changedTouches[0] : {};
228
+        var handler = this.chart.getZr().handler;
229
+        handler.dispatch('mouseup', {
230
+          zrX: touch.x,
231
+          zrY: touch.y
232
+        });
233
+        handler.dispatch('click', {
234
+          zrX: touch.x,
235
+          zrY: touch.y
236
+        });
237
+        handler.processGesture(wrapTouch(e), 'end');
238
+      }
239
+    }
240
+  }
241
+});
242
+
243
+function wrapTouch(event) {
244
+  for (let i = 0; i < event.touches.length; ++i) {
245
+    const touch = event.touches[i];
246
+    touch.offsetX = touch.x;
247
+    touch.offsetY = touch.y;
248
+  }
249
+  return event;
250
+}

+ 4 - 0
components/local/ec-canvas/ec-canvas.json

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

+ 9 - 0
components/local/ec-canvas/ec-canvas.wxml

@@ -0,0 +1,9 @@
1
+<!-- 新的:接口对其了H5 -->
2
+<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init"></canvas>
3
+<!-- 旧的 -->
4
+<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init"></canvas>
5
+
6
+<!-- 新的:接口对其了H5 -->
7
+<!-- <canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> -->
8
+<!-- 旧的 -->
9
+<!-- <canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> -->

+ 4 - 0
components/local/ec-canvas/ec-canvas.wxss

@@ -0,0 +1,4 @@
1
+.ec-canvas {
2
+  width: 100%;
3
+  height: 100%;
4
+}

文件差异内容过多而无法显示
+ 16 - 0
components/local/ec-canvas/echarts.js


+ 105 - 0
components/local/ec-canvas/wx-canvas.js

@@ -0,0 +1,105 @@
1
+export default class WxCanvas {
2
+  constructor(ctx, canvasId, isNew, canvasNode) {
3
+    this.ctx = ctx;
4
+    this.canvasId = canvasId;
5
+    this.chart = null;
6
+    this.isNew = isNew
7
+    if (isNew) {
8
+      this.canvasNode = canvasNode;
9
+    }
10
+    else {
11
+      this._initStyle(ctx);
12
+    }
13
+
14
+    // this._initCanvas(zrender, ctx);
15
+
16
+    this._initEvent();
17
+  }
18
+
19
+  getContext(contextType) {
20
+    if (contextType === '2d') {
21
+      return this.ctx;
22
+    }
23
+  }
24
+
25
+  // canvasToTempFilePath(opt) {
26
+  //   if (!opt.canvasId) {
27
+  //     opt.canvasId = this.canvasId;
28
+  //   }
29
+  //   return wx.canvasToTempFilePath(opt, this);
30
+  // }
31
+
32
+  setChart(chart) {
33
+    this.chart = chart;
34
+  }
35
+
36
+  attachEvent() {
37
+    // noop
38
+  }
39
+
40
+  detachEvent() {
41
+    // noop
42
+  }
43
+
44
+  _initCanvas(zrender, ctx) {
45
+    zrender.util.getContext = function () {
46
+      return ctx;
47
+    };
48
+
49
+    zrender.util.$override('measureText', function (text, font) {
50
+      ctx.font = font || '12px sans-serif';
51
+      return ctx.measureText(text);
52
+    });
53
+  }
54
+
55
+  _initStyle(ctx) {
56
+    ctx.createRadialGradient = () => {
57
+      return ctx.createCircularGradient(arguments);
58
+    };
59
+  }
60
+
61
+  _initEvent() {
62
+    this.event = {};
63
+    const eventNames = [{
64
+      wxName: 'touchStart',
65
+      ecName: 'mousedown'
66
+    }, {
67
+      wxName: 'touchMove',
68
+      ecName: 'mousemove'
69
+    }, {
70
+      wxName: 'touchEnd',
71
+      ecName: 'mouseup'
72
+    }, {
73
+      wxName: 'touchEnd',
74
+      ecName: 'click'
75
+    }];
76
+
77
+    eventNames.forEach(name => {
78
+      this.event[name.wxName] = e => {
79
+        const touch = e.touches[0];
80
+        this.chart.getZr().handler.dispatch(name.ecName, {
81
+          zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
82
+          zrY: name.wxName === 'tap' ? touch.clientY : touch.y
83
+        });
84
+      };
85
+    });
86
+  }
87
+
88
+  set width(w) {
89
+    if (this.canvasNode) this.canvasNode.width = w
90
+  }
91
+  set height(h) {
92
+    if (this.canvasNode) this.canvasNode.height = h
93
+  }
94
+
95
+  get width() {
96
+    if (this.canvasNode)
97
+      return this.canvasNode.width
98
+    return 0
99
+  }
100
+  get height() {
101
+    if (this.canvasNode)
102
+      return this.canvasNode.height
103
+    return 0
104
+  }
105
+}

+ 63 - 0
components/local/home-skeleton/home-skeleton.js

@@ -0,0 +1,63 @@
1
+// components/local/homeSkeleton/homeSkeleton.js
2
+Component({
3
+  /**
4
+   * 组件的属性列表
5
+   */
6
+  options: {
7
+    multipleSlots: true
8
+  },
9
+  properties: {
10
+    isLoading: {
11
+      type: Boolean,
12
+      value: true,
13
+      observer(newVal) {
14
+        if(newVal) {
15
+          var animation= wx.createAnimation({}) //创建一个动画实例
16
+          animation.opacity(1).step({
17
+            duration:0
18
+          });
19
+          this.setData({
20
+            showpic:animation.export(),
21
+            hidden:true
22
+          });
23
+          return;
24
+        }
25
+        this.skeletonVis();
26
+      }
27
+    },
28
+  },
29
+
30
+  /**
31
+   * 组件的初始数据
32
+   */
33
+  data: {
34
+    hidden:true
35
+  },
36
+
37
+  /**
38
+   * 组件的方法列表
39
+   */
40
+  methods: {
41
+    skeletonVis() {
42
+      var animation= wx.createAnimation({}) //创建一个动画实例
43
+      animation.opacity(0).step({
44
+        duration:500
45
+      });
46
+      // this.setData({
47
+      //   showpic:animation.export(),
48
+      // });
49
+      
50
+      setTimeout(() => {
51
+        this.setData({
52
+          showpic:animation.export(),
53
+        },() => {
54
+          setTimeout(() => {
55
+            this.setData({
56
+              hidden:false,
57
+            })
58
+          }, 500);
59
+        });
60
+      }, 500);
61
+    }
62
+  }
63
+})

+ 4 - 0
components/local/home-skeleton/home-skeleton.json

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

+ 21 - 0
components/local/home-skeleton/home-skeleton.wxml

@@ -0,0 +1,21 @@
1
+<view class="content">
2
+
3
+  <view class="home-skeleton" animation="{{showpic}}" hidden="{{!hidden}}">
4
+    <view class="home-skeleton-swiper"></view>
5
+    <view class="home-skeleton-magic">
6
+      <view class="item jgc" wx:key="index" wx:for="{{10}}"></view>
7
+    </view>
8
+    <view class="home-skeleton-img"></view>
9
+
10
+    <view class="home-skeleton-magic" style="margin-top: 40rpx;">
11
+      <view class="item hd" wx:key="index" wx:for="{{2}}"></view>
12
+    </view>
13
+    <view class="home-skeleton-magic">
14
+      <view class="item hd" wx:key="index" wx:for="{{2}}"></view>
15
+    </view>
16
+  </view>
17
+  
18
+  <view class="home-page">
19
+    <slot></slot>
20
+  </view>
21
+</view>

+ 72 - 0
components/local/home-skeleton/home-skeleton.wxss

@@ -0,0 +1,72 @@
1
+
2
+.home-skeleton {
3
+  position: fixed;
4
+  background: white;
5
+  height: 100%;
6
+  height: 100%;
7
+  z-index: 1000000000000;
8
+}
9
+
10
+.home-skeleton.hidden {
11
+  z-index: 0;
12
+}
13
+
14
+.home-page {
15
+  position: relative;
16
+  z-index: 1;
17
+}
18
+
19
+.home-skeleton view{
20
+  margin: 20rpx;
21
+  background: #eeeeee;
22
+  /* position: absolute; */
23
+  border-radius: 8rpx;
24
+  animation-duration: 2s;
25
+  animation-name: shine;
26
+  animation-iteration-count: infinite;
27
+}
28
+@keyframes shine {
29
+  0% {
30
+    opacity: .4;
31
+  }
32
+  50% {
33
+    opacity: 1;
34
+  }
35
+  100% {
36
+    opacity: .4;
37
+  }
38
+}
39
+
40
+.home-skeleton-swiper {
41
+  height: 150px;
42
+}
43
+
44
+.home-skeleton-magic {
45
+  display: flex;
46
+  flex-wrap: wrap;
47
+  justify-content: space-around;
48
+}
49
+
50
+.home-skeleton .home-skeleton-magic {
51
+  background: transparent;
52
+}
53
+
54
+.home-skeleton-magic .jgc {
55
+  width: 100rpx;
56
+  height: 100rpx;
57
+  flex-wrap: wrap;
58
+}
59
+
60
+.home-skeleton-img {
61
+  height: 100rpx;
62
+}
63
+
64
+.home-skeleton-magic .hd {
65
+  flex: 1;
66
+  height: 140rpx;
67
+  margin: 0;
68
+}
69
+
70
+.home-skeleton-magic .hd:first-child {
71
+  margin-right: 20rpx;
72
+}

+ 25 - 0
components/local/navigation/navigation.js

@@ -0,0 +1,25 @@
1
+// components/local/navigation/navigation.js
2
+const app = getApp()
3
+Component({
4
+  /**
5
+   * 组件的属性列表
6
+   */
7
+  properties: {},
8
+
9
+  /**
10
+   * 组件的初始数据
11
+   */
12
+  data: {
13
+    version: 'cover_all',
14
+    navBarHeight: app.globalData.navBarData.navBarHeight, //导航栏高度
15
+    menuRight: app.globalData.navBarData.menuRight, // 胶囊距右方间距(方保持左、右间距一致)
16
+    menuBotton: app.globalData.navBarData.menuBotton,
17
+    menuHeight: app.globalData.navBarData.menuHeight,
18
+    navBarBgClass: app.globalData.navBarData.navBarBgClass // 导航栏背景色
19
+  },
20
+
21
+  /**
22
+   * 组件的方法列表
23
+   */
24
+  methods: {}
25
+})

+ 4 - 0
components/local/navigation/navigation.json

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

+ 14 - 0
components/local/navigation/navigation.wxml

@@ -0,0 +1,14 @@
1
+<!-- components/local/navigation/navigation.wxml -->
2
+<cover-view class="nav" style="height:{{navBarHeight}}px;z-index: 999;">
3
+  <cover-view class="nav-main" wx:if="{{version == 'normal'}}">
4
+    <!-- 胶囊区域 -->
5
+    <cover-view class="capsule-box" style="height:{{menuHeight}}px; min-height:{{menuHeight}}px; line-height:{{menuHeight}}px; bottom:{{menuBotton}}px;">
6
+      <!-- 导航内容区域 -->
7
+      <slot></slot>
8
+    </cover-view>
9
+  </cover-view>
10
+  <cover-view class="nav-main" wx:elif="{{version == 'cover_all'}}">
11
+    <!-- 导航内容区域 -->
12
+    <slot></slot>
13
+  </cover-view>
14
+</cover-view>

+ 19 - 0
components/local/navigation/navigation.wxss

@@ -0,0 +1,19 @@
1
+/* components/local/navigation/navigation.wxss */
2
+.nav {
3
+  position: fixed;
4
+  top: 0;
5
+  left: 0;
6
+  width: 100vw;
7
+}
8
+
9
+.nav-main {
10
+  width: 100%;
11
+  height: 100%;
12
+  position: relative;
13
+}
14
+
15
+.nav .capsule-box {
16
+  position: absolute;
17
+  box-sizing: border-box;
18
+  width: 100%;
19
+}

+ 303 - 0
components/local/wxParse/html2json.js

@@ -0,0 +1,303 @@
1
+/**
2
+ * html2Json 改造来自: https://github.com/Jxck/html2json
3
+ * 
4
+ * 
5
+ * author: Di (微信小程序开发工程师)
6
+ * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7
+ *               垂直微信小程序开发交流社区
8
+ * 
9
+ * github地址: https://github.com/icindy/wxParse
10
+ * 
11
+ * for: 微信小程序富文本解析
12
+ * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13
+ */
14
+
15
+var __placeImgeUrlHttps = "https";
16
+var __emojisReg = '';
17
+var __emojisBaseSrc = '';
18
+var __emojis = {};
19
+var wxDiscode = require('./wxDiscode.js');
20
+var HTMLParser = require('./htmlparser.js');
21
+// Empty Elements - HTML 5
22
+var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
23
+// Block Elements - HTML 5
24
+var block = makeMap("br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
25
+
26
+// Inline Elements - HTML 5
27
+var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
28
+
29
+// Elements that you can, intentionally, leave open
30
+// (and which close themselves)
31
+var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
32
+
33
+// Attributes that have their values filled in disabled="disabled"
34
+var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
35
+
36
+// Special Elements (can contain anything)
37
+var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
38
+function makeMap(str) {
39
+    var obj = {}, items = str.split(",");
40
+    for (var i = 0; i < items.length; i++)
41
+        obj[items[i]] = true;
42
+    return obj;
43
+}
44
+
45
+function q(v) {
46
+    return '"' + v + '"';
47
+}
48
+
49
+function removeDOCTYPE(html) {
50
+    return html
51
+        .replace(/<\?xml.*\?>\n/, '')
52
+        .replace(/<.*!doctype.*\>\n/, '')
53
+        .replace(/<.*!DOCTYPE.*\>\n/, '');
54
+}
55
+
56
+function trimHtml(html) {
57
+  return html
58
+        .replace(/\r?\n+/g, '')
59
+        .replace(/<!--.*?-->/ig, '')
60
+        .replace(/\/\*.*?\*\//ig, '')
61
+        .replace(/[ ]+</ig, '<')
62
+}
63
+
64
+
65
+function html2json(html, bindName) {
66
+    //处理字符串
67
+    html = removeDOCTYPE(html);
68
+    html = trimHtml(html);
69
+    html = wxDiscode.strDiscode(html);
70
+    //生成node节点
71
+    var bufArray = [];
72
+    var results = {
73
+        node: bindName,
74
+        nodes: [],
75
+        images:[],
76
+        imageUrls:[]
77
+    };
78
+    var index = 0;
79
+    HTMLParser(html, {
80
+        start: function (tag, attrs, unary) {
81
+            //debug(tag, attrs, unary);
82
+            // node for this element
83
+            var node = {
84
+                node: 'element',
85
+                tag: tag,
86
+            };
87
+
88
+            if (bufArray.length === 0) {
89
+                node.index = index.toString()
90
+                index += 1
91
+            } else {
92
+                var parent = bufArray[0];
93
+                if (parent.nodes === undefined) {
94
+                    parent.nodes = [];
95
+                }
96
+                node.index = parent.index + '.' + parent.nodes.length
97
+            }
98
+
99
+            if (block[tag]) {
100
+                node.tagType = "block";
101
+            } else if (inline[tag]) {
102
+                node.tagType = "inline";
103
+            } else if (closeSelf[tag]) {
104
+                node.tagType = "closeSelf";
105
+            }
106
+
107
+            if (attrs.length !== 0) {
108
+                node.attr = attrs.reduce(function (pre, attr) {
109
+                    var name = attr.name;
110
+                    var value = attr.value;
111
+                    if (name == 'class') {
112
+                        console.dir(value);
113
+                        //  value = value.join("")
114
+                        node.classStr = value;
115
+                    }
116
+                    // has multi attibutes
117
+                    // make it array of attribute
118
+                    if (name == 'style') {
119
+                        // console.dir(value);
120
+                        //  value = value.join("")
121
+                        node.styleStr = value;
122
+                    }
123
+                    if (value.match(/ /)) {
124
+                        value = value.split(' ');
125
+                    }
126
+                    
127
+
128
+                    // if attr already exists
129
+                    // merge it
130
+                    if (pre[name]) {
131
+                        if (Array.isArray(pre[name])) {
132
+                            // already array, push to last
133
+                            pre[name].push(value);
134
+                        } else {
135
+                            // single value, make it array
136
+                            pre[name] = [pre[name], value];
137
+                        }
138
+                    } else {
139
+                        // not exist, put it
140
+                        pre[name] = value;
141
+                    }
142
+
143
+                    return pre;
144
+                }, {});
145
+            }
146
+
147
+            //对img添加额外数据
148
+            if (node.tag === 'img') {
149
+                node.imgIndex = results.images.length;
150
+                var imgUrl = node.attr.src;
151
+                if (imgUrl[0] == '') {
152
+                    imgUrl.splice(0, 1);
153
+                }
154
+                imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
155
+                node.attr.src = imgUrl;
156
+                node.from = bindName;
157
+                results.images.push(node);
158
+                results.imageUrls.push(imgUrl);
159
+            }
160
+            
161
+            // 处理font标签样式属性
162
+            if (node.tag === 'font') {
163
+                var fontSize = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large'];
164
+                var styleAttrs = {
165
+                    'color': 'color',
166
+                    'face': 'font-family',
167
+                    'size': 'font-size'
168
+                };
169
+                if (!node.attr.style) node.attr.style = [];
170
+                if (!node.styleStr) node.styleStr = '';
171
+                for (var key in styleAttrs) {
172
+                    if (node.attr[key]) {
173
+                        var value = key === 'size' ? fontSize[node.attr[key]-1] : node.attr[key];
174
+                        node.attr.style.push(styleAttrs[key]);
175
+                        node.attr.style.push(value);
176
+                        node.styleStr += styleAttrs[key] + ': ' + value + ';';
177
+                    }
178
+                }
179
+            }
180
+
181
+            //临时记录source资源
182
+            if(node.tag === 'source'){
183
+                results.source = node.attr.src;
184
+            }
185
+            
186
+            if (unary) {
187
+                // if this tag doesn't have end tag
188
+                // like <img src="hoge.png"/>
189
+                // add to parents
190
+                var parent = bufArray[0] || results;
191
+                if (parent.nodes === undefined) {
192
+                    parent.nodes = [];
193
+                }
194
+                parent.nodes.push(node);
195
+            } else {
196
+                bufArray.unshift(node);
197
+            }
198
+        },
199
+        end: function (tag) {
200
+            //debug(tag);
201
+            // merge into parent tag
202
+            var node = bufArray.shift();
203
+            if (node.tag !== tag) console.error('invalid state: mismatch end tag');
204
+
205
+            //当有缓存source资源时于于video补上src资源
206
+            if(node.tag === 'video' && results.source){
207
+                node.attr.src = results.source;
208
+                delete results.source;
209
+            }
210
+            
211
+            if (bufArray.length === 0) {
212
+                results.nodes.push(node);
213
+            } else {
214
+                var parent = bufArray[0];
215
+                if (parent.nodes === undefined) {
216
+                    parent.nodes = [];
217
+                }
218
+                parent.nodes.push(node);
219
+            }
220
+        },
221
+        chars: function (text) {
222
+            //debug(text);
223
+            var node = {
224
+                node: 'text',
225
+                text: text,
226
+                textArray:transEmojiStr(text)
227
+            };
228
+            
229
+            if (bufArray.length === 0) {
230
+                node.index = index.toString()
231
+                index += 1
232
+                results.nodes.push(node);
233
+            } else {
234
+                var parent = bufArray[0];
235
+                if (parent.nodes === undefined) {
236
+                    parent.nodes = [];
237
+                }
238
+                node.index = parent.index + '.' + parent.nodes.length
239
+                parent.nodes.push(node);
240
+            }
241
+        },
242
+        comment: function (text) {
243
+            //debug(text);
244
+            // var node = {
245
+            //     node: 'comment',
246
+            //     text: text,
247
+            // };
248
+            // var parent = bufArray[0];
249
+            // if (parent.nodes === undefined) {
250
+            //     parent.nodes = [];
251
+            // }
252
+            // parent.nodes.push(node);
253
+        },
254
+    });
255
+    return results;
256
+};
257
+
258
+function transEmojiStr(str){
259
+  // var eReg = new RegExp("["+__reg+' '+"]");
260
+//   str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
261
+  
262
+  var emojiObjs = [];
263
+  //如果正则表达式为空
264
+  if(__emojisReg.length == 0 || !__emojis){
265
+      var emojiObj = {}
266
+      emojiObj.node = "text";
267
+      emojiObj.text = str;
268
+      array = [emojiObj];
269
+      return array;
270
+  }
271
+  //这个地方需要调整
272
+  str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
273
+  var eReg = new RegExp("[:]");
274
+  var array = str.split(eReg);
275
+  for(var i = 0; i < array.length; i++){
276
+    var ele = array[i];
277
+    var emojiObj = {};
278
+    if(__emojis[ele]){
279
+      emojiObj.node = "element";
280
+      emojiObj.tag = "emoji";
281
+      emojiObj.text = __emojis[ele];
282
+      emojiObj.baseSrc= __emojisBaseSrc;
283
+    }else{
284
+      emojiObj.node = "text";
285
+      emojiObj.text = ele;
286
+    }
287
+    emojiObjs.push(emojiObj);
288
+  }
289
+  
290
+  return emojiObjs;
291
+}
292
+
293
+function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
294
+    __emojisReg = reg;
295
+    __emojisBaseSrc=baseSrc;
296
+    __emojis=emojis;
297
+}
298
+
299
+module.exports = {
300
+    html2json: html2json,
301
+    emojisInit:emojisInit
302
+};
303
+

+ 192 - 0
components/local/wxParse/htmlparser.js

@@ -0,0 +1,192 @@
1
+/**
2
+ * 
3
+ * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
4
+ * 
5
+ * author: Di (微信小程序开发工程师)
6
+ * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7
+ *               垂直微信小程序开发交流社区
8
+ * 
9
+ * github地址: https://github.com/icindy/wxParse
10
+ * 
11
+ * for: 微信小程序富文本解析
12
+ * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13
+ */
14
+// Regular Expressions for parsing tags and attributes
15
+var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
16
+	endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
17
+	attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
18
+
19
+// Empty Elements - HTML 5
20
+var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
21
+
22
+// Block Elements - HTML 5
23
+var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
24
+
25
+// Inline Elements - HTML 5
26
+var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
27
+
28
+// Elements that you can, intentionally, leave open
29
+// (and which close themselves)
30
+var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
31
+
32
+// Attributes that have their values filled in disabled="disabled"
33
+var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
34
+
35
+// Special Elements (can contain anything)
36
+var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
37
+
38
+function HTMLParser(html, handler) {
39
+	var index, chars, match, stack = [], last = html;
40
+	stack.last = function () {
41
+		return this[this.length - 1];
42
+	};
43
+
44
+	while (html) {
45
+		chars = true;
46
+
47
+		// Make sure we're not in a script or style element
48
+		if (!stack.last() || !special[stack.last()]) {
49
+
50
+			// Comment
51
+			if (html.indexOf("<!--") == 0) {
52
+				index = html.indexOf("-->");
53
+
54
+				if (index >= 0) {
55
+					if (handler.comment)
56
+						handler.comment(html.substring(4, index));
57
+					html = html.substring(index + 3);
58
+					chars = false;
59
+				}
60
+
61
+				// end tag
62
+			} else if (html.indexOf("</") == 0) {
63
+				match = html.match(endTag);
64
+
65
+				if (match) {
66
+					html = html.substring(match[0].length);
67
+					match[0].replace(endTag, parseEndTag);
68
+					chars = false;
69
+				}
70
+
71
+				// start tag
72
+			} else if (html.indexOf("<") == 0) {
73
+				match = html.match(startTag);
74
+
75
+				if (match) {
76
+					html = html.substring(match[0].length);
77
+					match[0].replace(startTag, parseStartTag);
78
+					chars = false;
79
+				}
80
+			}
81
+
82
+			if (chars) {
83
+				index = html.indexOf("<");
84
+				var text = ''
85
+				while (index === 0) {
86
+                                  text += "<";
87
+                                  html = html.substring(1);
88
+                                  index = html.indexOf("<");
89
+				}
90
+				text += index < 0 ? html : html.substring(0, index);
91
+				html = index < 0 ? "" : html.substring(index);
92
+
93
+				if (handler.chars)
94
+					handler.chars(text);
95
+			}
96
+
97
+		} else {
98
+
99
+			html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
100
+				text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2");
101
+				if (handler.chars)
102
+					handler.chars(text);
103
+
104
+				return "";
105
+			});
106
+
107
+
108
+			parseEndTag("", stack.last());
109
+		}
110
+
111
+		if (html == last)
112
+			throw "Parse Error: " + html;
113
+		last = html;
114
+	}
115
+
116
+	// Clean up any remaining tags
117
+	parseEndTag();
118
+
119
+	function parseStartTag(tag, tagName, rest, unary) {
120
+		tagName = tagName.toLowerCase();
121
+
122
+		if (block[tagName]) {
123
+			while (stack.last() && inline[stack.last()]) {
124
+				parseEndTag("", stack.last());
125
+			}
126
+		}
127
+
128
+		if (closeSelf[tagName] && stack.last() == tagName) {
129
+			parseEndTag("", tagName);
130
+		}
131
+
132
+		unary = empty[tagName] || !!unary;
133
+
134
+		if (!unary)
135
+			stack.push(tagName);
136
+
137
+		if (handler.start) {
138
+			var attrs = [];
139
+
140
+			rest.replace(attr, function (match, name) {
141
+				var value = arguments[2] ? arguments[2] :
142
+					arguments[3] ? arguments[3] :
143
+						arguments[4] ? arguments[4] :
144
+							fillAttrs[name] ? name : "";
145
+
146
+				attrs.push({
147
+					name: name,
148
+					value: value,
149
+					escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
150
+				});
151
+			});
152
+
153
+			if (handler.start) {
154
+				handler.start(tagName, attrs, unary);
155
+			}
156
+
157
+		}
158
+	}
159
+
160
+	function parseEndTag(tag, tagName) {
161
+		// If no tag name is provided, clean shop
162
+		if (!tagName)
163
+			var pos = 0;
164
+
165
+		// Find the closest opened tag of the same type
166
+		else {
167
+			tagName = tagName.toLowerCase();
168
+			for (var pos = stack.length - 1; pos >= 0; pos--)
169
+				if (stack[pos] == tagName)
170
+					break;
171
+		}
172
+		if (pos >= 0) {
173
+			// Close all the open elements, up the stack
174
+			for (var i = stack.length - 1; i >= pos; i--)
175
+				if (handler.end)
176
+					handler.end(stack[i]);
177
+
178
+			// Remove the open elements from the stack
179
+			stack.length = pos;
180
+		}
181
+	}
182
+};
183
+
184
+
185
+function makeMap(str) {
186
+	var obj = {}, items = str.split(",");
187
+	for (var i = 0; i < items.length; i++)
188
+		obj[items[i]] = true;
189
+	return obj;
190
+}
191
+
192
+module.exports = HTMLParser;

文件差异内容过多而无法显示
+ 2532 - 0
components/local/wxParse/showdown.js


+ 207 - 0
components/local/wxParse/wxDiscode.js

@@ -0,0 +1,207 @@
1
+// HTML 支持的数学符号
2
+function strNumDiscode(str){
3
+    str = str.replace(/&forall;/g, '∀');
4
+    str = str.replace(/&part;/g, '∂');
5
+    str = str.replace(/&exists;/g, '∃');
6
+    str = str.replace(/&empty;/g, '∅');
7
+    str = str.replace(/&nabla;/g, '∇');
8
+    str = str.replace(/&isin;/g, '∈');
9
+    str = str.replace(/&notin;/g, '∉');
10
+    str = str.replace(/&ni;/g, '∋');
11
+    str = str.replace(/&prod;/g, '∏');
12
+    str = str.replace(/&sum;/g, '∑');
13
+    str = str.replace(/&minus;/g, '−');
14
+    str = str.replace(/&lowast;/g, '∗');
15
+    str = str.replace(/&radic;/g, '√');
16
+    str = str.replace(/&prop;/g, '∝');
17
+    str = str.replace(/&infin;/g, '∞');
18
+    str = str.replace(/&ang;/g, '∠');
19
+    str = str.replace(/&and;/g, '∧');
20
+    str = str.replace(/&or;/g, '∨');
21
+    str = str.replace(/&cap;/g, '∩');
22
+    str = str.replace(/&cap;/g, '∪');
23
+    str = str.replace(/&int;/g, '∫');
24
+    str = str.replace(/&there4;/g, '∴');
25
+    str = str.replace(/&sim;/g, '∼');
26
+    str = str.replace(/&cong;/g, '≅');
27
+    str = str.replace(/&asymp;/g, '≈');
28
+    str = str.replace(/&ne;/g, '≠');
29
+    str = str.replace(/&le;/g, '≤');
30
+    str = str.replace(/&ge;/g, '≥');
31
+    str = str.replace(/&sub;/g, '⊂');
32
+    str = str.replace(/&sup;/g, '⊃');
33
+    str = str.replace(/&nsub;/g, '⊄');
34
+    str = str.replace(/&sube;/g, '⊆');
35
+    str = str.replace(/&supe;/g, '⊇');
36
+    str = str.replace(/&oplus;/g, '⊕');
37
+    str = str.replace(/&otimes;/g, '⊗');
38
+    str = str.replace(/&perp;/g, '⊥');
39
+    str = str.replace(/&sdot;/g, '⋅');
40
+    return str;
41
+}
42
+
43
+//HTML 支持的希腊字母
44
+function strGreeceDiscode(str){
45
+    str = str.replace(/&Alpha;/g, 'Α');
46
+    str = str.replace(/&Beta;/g, 'Β');
47
+    str = str.replace(/&Gamma;/g, 'Γ');
48
+    str = str.replace(/&Delta;/g, 'Δ');
49
+    str = str.replace(/&Epsilon;/g, 'Ε');
50
+    str = str.replace(/&Zeta;/g, 'Ζ');
51
+    str = str.replace(/&Eta;/g, 'Η');
52
+    str = str.replace(/&Theta;/g, 'Θ');
53
+    str = str.replace(/&Iota;/g, 'Ι');
54
+    str = str.replace(/&Kappa;/g, 'Κ');
55
+    str = str.replace(/&Lambda;/g, 'Λ');
56
+    str = str.replace(/&Mu;/g, 'Μ');
57
+    str = str.replace(/&Nu;/g, 'Ν');
58
+    str = str.replace(/&Xi;/g, 'Ν');
59
+    str = str.replace(/&Omicron;/g, 'Ο');
60
+    str = str.replace(/&Pi;/g, 'Π');
61
+    str = str.replace(/&Rho;/g, 'Ρ');
62
+    str = str.replace(/&Sigma;/g, 'Σ');
63
+    str = str.replace(/&Tau;/g, 'Τ');
64
+    str = str.replace(/&Upsilon;/g, 'Υ');
65
+    str = str.replace(/&Phi;/g, 'Φ');
66
+    str = str.replace(/&Chi;/g, 'Χ');
67
+    str = str.replace(/&Psi;/g, 'Ψ');
68
+    str = str.replace(/&Omega;/g, 'Ω');
69
+
70
+    str = str.replace(/&alpha;/g, 'α');
71
+    str = str.replace(/&beta;/g, 'β');
72
+    str = str.replace(/&gamma;/g, 'γ');
73
+    str = str.replace(/&delta;/g, 'δ');
74
+    str = str.replace(/&epsilon;/g, 'ε');
75
+    str = str.replace(/&zeta;/g, 'ζ');
76
+    str = str.replace(/&eta;/g, 'η');
77
+    str = str.replace(/&theta;/g, 'θ');
78
+    str = str.replace(/&iota;/g, 'ι');
79
+    str = str.replace(/&kappa;/g, 'κ');
80
+    str = str.replace(/&lambda;/g, 'λ');
81
+    str = str.replace(/&mu;/g, 'μ');
82
+    str = str.replace(/&nu;/g, 'ν');
83
+    str = str.replace(/&xi;/g, 'ξ');
84
+    str = str.replace(/&omicron;/g, 'ο');
85
+    str = str.replace(/&pi;/g, 'π');
86
+    str = str.replace(/&rho;/g, 'ρ');
87
+    str = str.replace(/&sigmaf;/g, 'ς');
88
+    str = str.replace(/&sigma;/g, 'σ');
89
+    str = str.replace(/&tau;/g, 'τ');
90
+    str = str.replace(/&upsilon;/g, 'υ');
91
+    str = str.replace(/&phi;/g, 'φ');
92
+    str = str.replace(/&chi;/g, 'χ');
93
+    str = str.replace(/&psi;/g, 'ψ');
94
+    str = str.replace(/&omega;/g, 'ω');
95
+    str = str.replace(/&thetasym;/g, 'ϑ');
96
+    str = str.replace(/&upsih;/g, 'ϒ');
97
+    str = str.replace(/&piv;/g, 'ϖ');
98
+    str = str.replace(/&middot;/g, '·');
99
+    return str;
100
+}
101
+
102
+// 
103
+
104
+function strcharacterDiscode(str){
105
+    // 加入常用解析
106
+    str = str.replace(/&nbsp;/g, ' ');
107
+    str = str.replace(/&quot;/g, "'");
108
+    str = str.replace(/&amp;/g, '&');
109
+    // str = str.replace(/&lt;/g, '‹');
110
+    // str = str.replace(/&gt;/g, '›');
111
+
112
+    str = str.replace(/&lt;/g, '<');
113
+    str = str.replace(/&gt;/g, '>');
114
+    str = str.replace(/&#8226;/g, '•');
115
+
116
+    return str;
117
+}
118
+
119
+// HTML 支持的其他实体
120
+function strOtherDiscode(str){
121
+    str = str.replace(/&OElig;/g, 'Œ');
122
+    str = str.replace(/&oelig;/g, 'œ');
123
+    str = str.replace(/&Scaron;/g, 'Š');
124
+    str = str.replace(/&scaron;/g, 'š');
125
+    str = str.replace(/&Yuml;/g, 'Ÿ');
126
+    str = str.replace(/&fnof;/g, 'ƒ');
127
+    str = str.replace(/&circ;/g, 'ˆ');
128
+    str = str.replace(/&tilde;/g, '˜');
129
+    str = str.replace(/&ensp;/g, '');
130
+    str = str.replace(/&emsp;/g, '');
131
+    str = str.replace(/&thinsp;/g, '');
132
+    str = str.replace(/&zwnj;/g, '');
133
+    str = str.replace(/&zwj;/g, '');
134
+    str = str.replace(/&lrm;/g, '');
135
+    str = str.replace(/&rlm;/g, '');
136
+    str = str.replace(/&ndash;/g, '–');
137
+    str = str.replace(/&mdash;/g, '—');
138
+    str = str.replace(/&lsquo;/g, '‘');
139
+    str = str.replace(/&rsquo;/g, '’');
140
+    str = str.replace(/&sbquo;/g, '‚');
141
+    str = str.replace(/&ldquo;/g, '“');
142
+    str = str.replace(/&rdquo;/g, '”');
143
+    str = str.replace(/&bdquo;/g, '„');
144
+    str = str.replace(/&dagger;/g, '†');
145
+    str = str.replace(/&Dagger;/g, '‡');
146
+    str = str.replace(/&bull;/g, '•');
147
+    str = str.replace(/&hellip;/g, '…');
148
+    str = str.replace(/&permil;/g, '‰');
149
+    str = str.replace(/&prime;/g, '′');
150
+    str = str.replace(/&Prime;/g, '″');
151
+    str = str.replace(/&lsaquo;/g, '‹');
152
+    str = str.replace(/&rsaquo;/g, '›');
153
+    str = str.replace(/&oline;/g, '‾');
154
+    str = str.replace(/&euro;/g, '€');
155
+    str = str.replace(/&trade;/g, '™');
156
+
157
+    str = str.replace(/&larr;/g, '←');
158
+    str = str.replace(/&uarr;/g, '↑');
159
+    str = str.replace(/&rarr;/g, '→');
160
+    str = str.replace(/&darr;/g, '↓');
161
+    str = str.replace(/&harr;/g, '↔');
162
+    str = str.replace(/&crarr;/g, '↵');
163
+    str = str.replace(/&lceil;/g, '⌈');
164
+    str = str.replace(/&rceil;/g, '⌉');
165
+
166
+    str = str.replace(/&lfloor;/g, '⌊');
167
+    str = str.replace(/&rfloor;/g, '⌋');
168
+    str = str.replace(/&loz;/g, '◊');
169
+    str = str.replace(/&spades;/g, '♠');
170
+    str = str.replace(/&clubs;/g, '♣');
171
+    str = str.replace(/&hearts;/g, '♥');
172
+
173
+    str = str.replace(/&diams;/g, '♦');
174
+    str = str.replace(/&#39;/g, '\'');
175
+    return str;
176
+}
177
+
178
+function strMoreDiscode(str){
179
+    str = str.replace(/\r\n/g,"");  
180
+    str = str.replace(/\n/g,"");
181
+
182
+    str = str.replace(/code/g,"wxxxcode-style");
183
+    return str;
184
+}
185
+
186
+function strDiscode(str){
187
+    str = strNumDiscode(str);
188
+    str = strGreeceDiscode(str);
189
+    str = strcharacterDiscode(str);
190
+    str = strOtherDiscode(str);
191
+    str = strMoreDiscode(str);
192
+    return str;
193
+}
194
+function urlToHttpUrl(url,rep){
195
+    
196
+    var patt1 = new RegExp("^//");
197
+    var result = patt1.test(url);
198
+    if(result){
199
+        url = rep+":"+url;
200
+    }
201
+    return  url;
202
+}
203
+
204
+module.exports = {
205
+    strDiscode:strDiscode,
206
+    urlToHttpUrl:urlToHttpUrl
207
+}

+ 157 - 0
components/local/wxParse/wxParse.js

@@ -0,0 +1,157 @@
1
+/**
2
+ * author: Di (微信小程序开发工程师)
3
+ * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
4
+ *               垂直微信小程序开发交流社区
5
+ * 
6
+ * github地址: https://github.com/icindy/wxParse
7
+ * 
8
+ * for: 微信小程序富文本解析
9
+ * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
10
+ */
11
+
12
+/**
13
+ * utils函数引入
14
+ **/
15
+import showdown from './showdown.js';
16
+import HtmlToJson from './html2json.js';
17
+/**
18
+ * 配置及公有属性
19
+ **/
20
+var realWindowWidth = 0;
21
+var realWindowHeight = 0;
22
+wx.getSystemInfo({
23
+  success: function (res) {
24
+    realWindowWidth = res.windowWidth
25
+    realWindowHeight = res.windowHeight
26
+  }
27
+})
28
+/**
29
+ * 主函数入口区
30
+ **/
31
+function wxParse(bindName = 'wxParseData', type='html', data='<div class="color:red;">数据不能为空</div>', target,imagePadding) {
32
+  var that = target;
33
+  var transData = {};//存放转化后的数据
34
+  if (type == 'html') {
35
+    transData = HtmlToJson.html2json(data, bindName);
36
+  } else if (type == 'md' || type == 'markdown') {
37
+    var converter = new showdown.Converter();
38
+    var html = converter.makeHtml(data);
39
+    transData = HtmlToJson.html2json(html, bindName);
40
+  }
41
+  transData.view = {};
42
+  transData.view.imagePadding = 0;
43
+  if(typeof(imagePadding) != 'undefined'){
44
+    transData.view.imagePadding = imagePadding
45
+  }
46
+  var bindData = {};
47
+  bindData[bindName] = transData;
48
+  that.setData(bindData)
49
+  that.wxParseImgLoad = wxParseImgLoad;
50
+  that.wxParseImgTap = wxParseImgTap;
51
+}
52
+// 图片点击事件
53
+function wxParseImgTap(e) {
54
+  var that = this;
55
+  var nowImgUrl = e.target.dataset.src;
56
+  var tagFrom = e.target.dataset.from;
57
+  if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
58
+    wx.previewImage({
59
+      current: nowImgUrl, // 当前显示图片的http链接
60
+      urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
61
+    })
62
+  }
63
+}
64
+
65
+/**
66
+ * 图片视觉宽高计算函数区 
67
+ **/
68
+function wxParseImgLoad(e) {
69
+  var that = this;
70
+  var tagFrom = e.target.dataset.from;
71
+  var idx = e.target.dataset.idx;
72
+  if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
73
+    calMoreImageInfo(e, idx, that, tagFrom)
74
+  } 
75
+}
76
+// 假循环获取计算图片视觉最佳宽高
77
+function calMoreImageInfo(e, idx, that, bindName) {
78
+  var temData = that.data[bindName];
79
+  if (!temData || temData.images.length == 0) {
80
+    return;
81
+  }
82
+  var temImages = temData.images;
83
+  //因为无法获取view宽度 需要自定义padding进行计算,稍后处理
84
+  var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName); 
85
+  // temImages[idx].width = recal.imageWidth;
86
+  // temImages[idx].height = recal.imageheight; 
87
+  // temData.images = temImages;
88
+  // var bindData = {};
89
+  // bindData[bindName] = temData;
90
+  // that.setData(bindData);
91
+  var index = temImages[idx].index
92
+  var key = `${bindName}`
93
+  for (var i of index.split('.')) key+=`.nodes[${i}]`
94
+  var keyW = key + '.width'
95
+  var keyH = key + '.height'
96
+  that.setData({
97
+    [keyW]: recal.imageWidth,
98
+    [keyH]: recal.imageheight,
99
+  })
100
+}
101
+
102
+// 计算视觉优先的图片宽高
103
+function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
104
+  //获取图片的原始长宽
105
+  var windowWidth = 0, windowHeight = 0;
106
+  var autoWidth = 0, autoHeight = 0;
107
+  var results = {};
108
+  var padding = that.data[bindName].view.imagePadding;
109
+  windowWidth = realWindowWidth-2*padding;
110
+  windowHeight = realWindowHeight;
111
+  //判断按照那种方式进行缩放
112
+  // console.log("windowWidth" + windowWidth);
113
+  if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
114
+    autoWidth = windowWidth;
115
+    // console.log("autoWidth" + autoWidth);
116
+    autoHeight = (autoWidth * originalHeight) / originalWidth;
117
+    // console.log("autoHeight" + autoHeight);
118
+    results.imageWidth = autoWidth;
119
+    results.imageheight = autoHeight;
120
+  } else {//否则展示原来的数据
121
+    results.imageWidth = originalWidth;
122
+    results.imageheight = originalHeight;
123
+  }
124
+  return results;
125
+}
126
+
127
+function wxParseTemArray(temArrayName,bindNameReg,total,that){
128
+  var array = [];
129
+  var temData = that.data;
130
+  var obj = null;
131
+  for(var i = 0; i < total; i++){
132
+    var simArr = temData[bindNameReg+i].nodes;
133
+    array.push(simArr);
134
+  }
135
+
136
+  temArrayName = temArrayName || 'wxParseTemArray';
137
+  obj = JSON.parse('{"'+ temArrayName +'":""}');
138
+  obj[temArrayName] = array;
139
+  that.setData(obj);
140
+}
141
+
142
+/**
143
+ * 配置emojis
144
+ * 
145
+ */
146
+
147
+function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
148
+   HtmlToJson.emojisInit(reg,baseSrc,emojis);
149
+}
150
+
151
+module.exports = {
152
+  wxParse: wxParse,
153
+  wxParseTemArray:wxParseTemArray,
154
+  emojisInit:emojisInit
155
+}
156
+
157
+

+ 967 - 0
components/local/wxParse/wxParse.wxml

@@ -0,0 +1,967 @@
1
+<!--**
2
+ * author: Di (微信小程序开发工程师)
3
+ * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
4
+ *               垂直微信小程序开发交流社区
5
+ * 
6
+ * github地址: https://github.com/icindy/wxParse
7
+ * 
8
+ * for: 微信小程序富文本解析
9
+ * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
10
+ */-->
11
+
12
+<!--基础元素-->
13
+<template name="wxParseVideo">
14
+  <!--增加video标签支持,并循环添加-->
15
+  <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
16
+    <video class="{{item.classStr}} wxParse-{{item.tag}}-video" src="{{item.attr.src}}"></video>
17
+  </view>
18
+</template>
19
+
20
+<template name="wxParseImg">
21
+  <image class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-src="{{item.attr.src}}" data-idx="{{item.imgIndex}}" src="{{item.attr.src}}" mode="aspectFit" bindload="wxParseImgLoad" bindtap="wxParseImgTap" mode="widthFix" style="width:{{item.width}}px;"
22
+  />
23
+</template>
24
+
25
+<template name="WxEmojiView">
26
+  <view class="WxEmojiView wxParse-inline" style="{{item.styleStr}}">
27
+    <block wx:for="{{item.textArray}}" wx:key="index">
28
+      <block class="{{item.text == '\\n' ? 'wxParse-hide':''}}" wx:if="{{item.node == 'text'}}">{{item.text}}</block>
29
+      <block wx:elif="{{item.node == 'element'}}">
30
+        <image class="wxEmoji" src="{{item.baseSrc}}{{item.text}}" />
31
+      </block>
32
+    </block>
33
+  </view>
34
+</template>
35
+
36
+<template name="WxParseBr">
37
+  <text>\n</text>
38
+</template>
39
+<!--入口模版-->
40
+
41
+<template name="wxParse">
42
+  <block wx:for="{{wxParseData}}" wx:key="index">
43
+    <template is="wxParse0" data="{{item}}" />
44
+  </block>
45
+</template>
46
+
47
+
48
+<!--循环模版-->
49
+<template name="wxParse0">
50
+  <!--<template is="wxParse1" data="{{item}}" />-->
51
+  <!--判断是否是标签节点-->
52
+  <block wx:if="{{item.node == 'element'}}">
53
+    <block wx:if="{{item.tag == 'button'}}">
54
+      <button type="default" size="mini">
55
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
56
+          <template is="wxParse1" data="{{item}}" />
57
+        </block>
58
+      </button>
59
+    </block>
60
+    <!--li类型-->
61
+    <block wx:elif="{{item.tag == 'li'}}">
62
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
63
+        <view class="{{item.classStr}} wxParse-li-inner">
64
+          <view class="{{item.classStr}} wxParse-li-text">
65
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
66
+          </view>
67
+          <view class="{{item.classStr}} wxParse-li-text">
68
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
69
+              <template is="wxParse1" data="{{item}}" />
70
+            </block>
71
+          </view>
72
+        </view>
73
+      </view>
74
+    </block>
75
+
76
+    <!--video类型-->
77
+    <block wx:elif="{{item.tag == 'video'}}">
78
+      <template is="wxParseVideo" data="{{item}}" />
79
+    </block>
80
+
81
+    <!--img类型-->
82
+    <block wx:elif="{{item.tag == 'img'}}">
83
+      <template is="wxParseImg" data="{{item}}" />
84
+    </block>
85
+
86
+    <!--a类型-->
87
+    <block wx:elif="{{item.tag == 'a'}}">
88
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
89
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
90
+          <template is="wxParse1" data="{{item}}" />
91
+        </block>
92
+      </view>
93
+    </block>
94
+    <block wx:elif="{{item.tag == 'table'}}">
95
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
96
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
97
+          <template is="wxParse1" data="{{item}}" />
98
+        </block>
99
+      </view>
100
+    </block>
101
+
102
+    <block wx:elif="{{item.tag == 'br'}}">
103
+      <template is="WxParseBr"></template>
104
+    </block>
105
+    <!--其他块级标签-->
106
+    <block wx:elif="{{item.tagType == 'block'}}">
107
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
108
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
109
+          <template is="wxParse1" data="{{item}}" />
110
+        </block>
111
+      </view>
112
+    </block>
113
+
114
+    <!--内联标签-->
115
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
116
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
117
+        <template is="wxParse1" data="{{item}}" />
118
+      </block>
119
+    </view>
120
+
121
+  </block>
122
+
123
+  <!--判断是否是文本节点-->
124
+  <block wx:elif="{{item.node == 'text'}}">
125
+    <!--如果是,直接进行-->
126
+    <template is="WxEmojiView" data="{{item}}" />
127
+  </block>
128
+
129
+</template>
130
+
131
+
132
+
133
+<!--循环模版-->
134
+<template name="wxParse1">
135
+  <!--<template is="wxParse2" data="{{item}}" />-->
136
+  <!--判断是否是标签节点-->
137
+  <block wx:if="{{item.node == 'element'}}">
138
+    <block wx:if="{{item.tag == 'button'}}">
139
+      <button type="default" size="mini">
140
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
141
+          <template is="wxParse2" data="{{item}}" />
142
+        </block>
143
+      </button>
144
+    </block>
145
+    <!--li类型-->
146
+    <block wx:elif="{{item.tag == 'li'}}">
147
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
148
+        <view class="{{item.classStr}} wxParse-li-inner">
149
+          <view class="{{item.classStr}} wxParse-li-text">
150
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
151
+          </view>
152
+          <view class="{{item.classStr}} wxParse-li-text">
153
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
154
+              <template is="wxParse2" data="{{item}}" />
155
+            </block>
156
+          </view>
157
+        </view>
158
+      </view>
159
+    </block>
160
+
161
+    <!--video类型-->
162
+    <block wx:elif="{{item.tag == 'video'}}">
163
+      <template is="wxParseVideo" data="{{item}}" />
164
+    </block>
165
+
166
+    <!--img类型-->
167
+    <block wx:elif="{{item.tag == 'img'}}">
168
+      <template is="wxParseImg" data="{{item}}" />
169
+    </block>
170
+
171
+    <!--a类型-->
172
+    <block wx:elif="{{item.tag == 'a'}}">
173
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
174
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
175
+          <template is="wxParse2" data="{{item}}" />
176
+        </block>
177
+      </view>
178
+    </block>
179
+
180
+    <block wx:elif="{{item.tag == 'br'}}">
181
+      <template is="WxParseBr"></template>
182
+    </block>
183
+    <!--其他块级标签-->
184
+    <block wx:elif="{{item.tagType == 'block'}}">
185
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
186
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
187
+          <template is="wxParse2" data="{{item}}" />
188
+        </block>
189
+      </view>
190
+    </block>
191
+
192
+    <!--内联标签-->
193
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
194
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
195
+        <template is="wxParse2" data="{{item}}" />
196
+      </block>
197
+    </view>
198
+
199
+  </block>
200
+
201
+  <!--判断是否是文本节点-->
202
+  <block wx:elif="{{item.node == 'text'}}">
203
+    <!--如果是,直接进行-->
204
+    <template is="WxEmojiView" data="{{item}}" />
205
+  </block>
206
+
207
+</template>
208
+
209
+
210
+<!--循环模版-->
211
+<template name="wxParse2">
212
+  <!--<template is="wxParse3" data="{{item}}" />-->
213
+  <!--判断是否是标签节点-->
214
+  <block wx:if="{{item.node == 'element'}}">
215
+    <block wx:if="{{item.tag == 'button'}}">
216
+      <button type="default" size="mini">
217
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
218
+          <template is="wxParse3" data="{{item}}" />
219
+        </block>
220
+      </button>
221
+    </block>
222
+    <!--li类型-->
223
+    <block wx:elif="{{item.tag == 'li'}}">
224
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
225
+        <view class="{{item.classStr}} wxParse-li-inner">
226
+          <view class="{{item.classStr}} wxParse-li-text">
227
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
228
+          </view>
229
+          <view class="{{item.classStr}} wxParse-li-text">
230
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
231
+              <template is="wxParse3" data="{{item}}" />
232
+            </block>
233
+          </view>
234
+        </view>
235
+      </view>
236
+    </block>
237
+
238
+    <!--video类型-->
239
+    <block wx:elif="{{item.tag == 'video'}}">
240
+      <template is="wxParseVideo" data="{{item}}" />
241
+    </block>
242
+
243
+    <!--img类型-->
244
+    <block wx:elif="{{item.tag == 'img'}}">
245
+      <template is="wxParseImg" data="{{item}}" />
246
+    </block>
247
+
248
+    <!--a类型-->
249
+    <block wx:elif="{{item.tag == 'a'}}">
250
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
251
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
252
+          <template is="wxParse3" data="{{item}}" />
253
+        </block>
254
+      </view>
255
+    </block>
256
+
257
+    <block wx:elif="{{item.tag == 'br'}}">
258
+      <template is="WxParseBr"></template>
259
+    </block>
260
+    <!--其他块级标签-->
261
+    <block wx:elif="{{item.tagType == 'block'}}">
262
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
263
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
264
+          <template is="wxParse3" data="{{item}}" />
265
+        </block>
266
+      </view>
267
+    </block>
268
+
269
+    <!--内联标签-->
270
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
271
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
272
+        <template is="wxParse3" data="{{item}}" />
273
+      </block>
274
+    </view>
275
+
276
+  </block>
277
+
278
+  <!--判断是否是文本节点-->
279
+  <block wx:elif="{{item.node == 'text'}}">
280
+    <!--如果是,直接进行-->
281
+    <template is="WxEmojiView" data="{{item}}" />
282
+  </block>
283
+
284
+</template>
285
+
286
+<!--循环模版-->
287
+<template name="wxParse3">
288
+  <!--<template is="wxParse4" data="{{item}}" />-->
289
+  <!--判断是否是标签节点-->
290
+  <block wx:if="{{item.node == 'element'}}">
291
+    <block wx:if="{{item.tag == 'button'}}">
292
+      <button type="default" size="mini">
293
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
294
+          <template is="wxParse4" data="{{item}}" />
295
+        </block>
296
+      </button>
297
+    </block>
298
+    <!--li类型-->
299
+    <block wx:elif="{{item.tag == 'li'}}">
300
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
301
+        <view class="{{item.classStr}} wxParse-li-inner">
302
+          <view class="{{item.classStr}} wxParse-li-text">
303
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
304
+          </view>
305
+          <view class="{{item.classStr}} wxParse-li-text">
306
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
307
+              <template is="wxParse4" data="{{item}}" />
308
+            </block>
309
+          </view>
310
+        </view>
311
+      </view>
312
+    </block>
313
+
314
+    <!--video类型-->
315
+    <block wx:elif="{{item.tag == 'video'}}">
316
+      <template is="wxParseVideo" data="{{item}}" />
317
+    </block>
318
+
319
+    <!--img类型-->
320
+    <block wx:elif="{{item.tag == 'img'}}">
321
+      <template is="wxParseImg" data="{{item}}" />
322
+    </block>
323
+
324
+    <!--a类型-->
325
+    <block wx:elif="{{item.tag == 'a'}}">
326
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
327
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
328
+          <template is="wxParse4" data="{{item}}" />
329
+        </block>
330
+      </view>
331
+    </block>
332
+
333
+    <block wx:elif="{{item.tag == 'br'}}">
334
+      <template is="WxParseBr"></template>
335
+    </block>
336
+    <!--其他块级标签-->
337
+    <block wx:elif="{{item.tagType == 'block'}}">
338
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
339
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
340
+          <template is="wxParse4" data="{{item}}" />
341
+        </block>
342
+      </view>
343
+    </block>
344
+
345
+    <!--内联标签-->
346
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
347
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
348
+        <template is="wxParse4" data="{{item}}" />
349
+      </block>
350
+    </view>
351
+
352
+  </block>
353
+
354
+  <!--判断是否是文本节点-->
355
+  <block wx:elif="{{item.node == 'text'}}">
356
+    <!--如果是,直接进行-->
357
+    <template is="WxEmojiView" data="{{item}}" />
358
+  </block>
359
+
360
+</template>
361
+
362
+<!--循环模版-->
363
+<template name="wxParse4">
364
+  <!--<template is="wxParse5" data="{{item}}" />-->
365
+  <!--判断是否是标签节点-->
366
+  <block wx:if="{{item.node == 'element'}}">
367
+    <block wx:if="{{item.tag == 'button'}}">
368
+      <button type="default" size="mini">
369
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
370
+          <template is="wxParse5" data="{{item}}" />
371
+        </block>
372
+      </button>
373
+    </block>
374
+    <!--li类型-->
375
+    <block wx:elif="{{item.tag == 'li'}}">
376
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
377
+        <view class="{{item.classStr}} wxParse-li-inner">
378
+          <view class="{{item.classStr}} wxParse-li-text">
379
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
380
+          </view>
381
+          <view class="{{item.classStr}} wxParse-li-text">
382
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
383
+              <template is="wxParse5" data="{{item}}" />
384
+            </block>
385
+          </view>
386
+        </view>
387
+      </view>
388
+    </block>
389
+
390
+    <!--video类型-->
391
+    <block wx:elif="{{item.tag == 'video'}}">
392
+      <template is="wxParseVideo" data="{{item}}" />
393
+    </block>
394
+
395
+    <!--img类型-->
396
+    <block wx:elif="{{item.tag == 'img'}}">
397
+      <template is="wxParseImg" data="{{item}}" />
398
+    </block>
399
+
400
+    <!--a类型-->
401
+    <block wx:elif="{{item.tag == 'a'}}">
402
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
403
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
404
+          <template is="wxParse5" data="{{item}}" />
405
+        </block>
406
+      </view>
407
+    </block>
408
+
409
+    <block wx:elif="{{item.tag == 'br'}}">
410
+      <template is="WxParseBr"></template>
411
+    </block>
412
+    <!--其他块级标签-->
413
+    <block wx:elif="{{item.tagType == 'block'}}">
414
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
415
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
416
+          <template is="wxParse5" data="{{item}}" />
417
+        </block>
418
+      </view>
419
+    </block>
420
+
421
+    <!--内联标签-->
422
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
423
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
424
+        <template is="wxParse5" data="{{item}}" />
425
+      </block>
426
+    </view>
427
+
428
+  </block>
429
+
430
+  <!--判断是否是文本节点-->
431
+  <block wx:elif="{{item.node == 'text'}}">
432
+    <!--如果是,直接进行-->
433
+    <template is="WxEmojiView" data="{{item}}" />
434
+  </block>
435
+
436
+</template>
437
+
438
+<!--循环模版-->
439
+<template name="wxParse5">
440
+  <!--<template is="wxParse6" data="{{item}}" />-->
441
+  <!--判断是否是标签节点-->
442
+  <block wx:if="{{item.node == 'element'}}">
443
+    <block wx:if="{{item.tag == 'button'}}">
444
+      <button type="default" size="mini">
445
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
446
+          <template is="wxParse6" data="{{item}}" />
447
+        </block>
448
+      </button>
449
+    </block>
450
+    <!--li类型-->
451
+    <block wx:elif="{{item.tag == 'li'}}">
452
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
453
+        <view class="{{item.classStr}} wxParse-li-inner">
454
+          <view class="{{item.classStr}} wxParse-li-text">
455
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
456
+          </view>
457
+          <view class="{{item.classStr}} wxParse-li-text">
458
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
459
+              <template is="wxParse6" data="{{item}}" />
460
+            </block>
461
+          </view>
462
+        </view>
463
+      </view>
464
+    </block>
465
+
466
+    <!--video类型-->
467
+    <block wx:elif="{{item.tag == 'video'}}">
468
+      <template is="wxParseVideo" data="{{item}}" />
469
+    </block>
470
+
471
+    <!--img类型-->
472
+    <block wx:elif="{{item.tag == 'img'}}">
473
+      <template is="wxParseImg" data="{{item}}" />
474
+    </block>
475
+
476
+    <!--a类型-->
477
+    <block wx:elif="{{item.tag == 'a'}}">
478
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
479
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
480
+          <template is="wxParse6" data="{{item}}" />
481
+        </block>
482
+      </view>
483
+    </block>
484
+
485
+    <block wx:elif="{{item.tag == 'br'}}">
486
+      <template is="WxParseBr"></template>
487
+    </block>
488
+    <!--其他块级标签-->
489
+    <block wx:elif="{{item.tagType == 'block'}}">
490
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
491
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
492
+          <template is="wxParse6" data="{{item}}" />
493
+        </block>
494
+      </view>
495
+    </block>
496
+
497
+    <!--内联标签-->
498
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
499
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
500
+        <template is="wxParse6" data="{{item}}" />
501
+      </block>
502
+    </view>
503
+
504
+  </block>
505
+
506
+  <!--判断是否是文本节点-->
507
+  <block wx:elif="{{item.node == 'text'}}">
508
+    <!--如果是,直接进行-->
509
+    <template is="WxEmojiView" data="{{item}}" />
510
+  </block>
511
+
512
+</template>
513
+
514
+<!--循环模版-->
515
+<template name="wxParse6">
516
+  <!--<template is="wxParse7" data="{{item}}" />-->
517
+  <!--判断是否是标签节点-->
518
+  <block wx:if="{{item.node == 'element'}}">
519
+    <block wx:if="{{item.tag == 'button'}}">
520
+      <button type="default" size="mini">
521
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
522
+          <template is="wxParse7" data="{{item}}" />
523
+        </block>
524
+      </button>
525
+    </block>
526
+    <!--li类型-->
527
+    <block wx:elif="{{item.tag == 'li'}}">
528
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
529
+        <view class="{{item.classStr}} wxParse-li-inner">
530
+          <view class="{{item.classStr}} wxParse-li-text">
531
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
532
+          </view>
533
+          <view class="{{item.classStr}} wxParse-li-text">
534
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
535
+              <template is="wxParse7" data="{{item}}" />
536
+            </block>
537
+          </view>
538
+        </view>
539
+      </view>
540
+    </block>
541
+
542
+    <!--video类型-->
543
+    <block wx:elif="{{item.tag == 'video'}}">
544
+      <template is="wxParseVideo" data="{{item}}" />
545
+    </block>
546
+
547
+    <!--img类型-->
548
+    <block wx:elif="{{item.tag == 'img'}}">
549
+      <template is="wxParseImg" data="{{item}}" />
550
+    </block>
551
+
552
+    <!--a类型-->
553
+    <block wx:elif="{{item.tag == 'a'}}">
554
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
555
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
556
+          <template is="wxParse7" data="{{item}}" />
557
+        </block>
558
+      </view>
559
+    </block>
560
+
561
+    <block wx:elif="{{item.tag == 'br'}}">
562
+      <template is="WxParseBr"></template>
563
+    </block>
564
+    <!--其他块级标签-->
565
+    <block wx:elif="{{item.tagType == 'block'}}">
566
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
567
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
568
+          <template is="wxParse7" data="{{item}}" />
569
+        </block>
570
+      </view>
571
+    </block>
572
+
573
+    <!--内联标签-->
574
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
575
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
576
+        <template is="wxParse7" data="{{item}}" />
577
+      </block>
578
+    </view>
579
+
580
+  </block>
581
+
582
+  <!--判断是否是文本节点-->
583
+  <block wx:elif="{{item.node == 'text'}}">
584
+    <!--如果是,直接进行-->
585
+    <template is="WxEmojiView" data="{{item}}" />
586
+  </block>
587
+
588
+</template>
589
+<!--循环模版-->
590
+<template name="wxParse7">
591
+  <!--<template is="wxParse8" data="{{item}}" />-->
592
+  <!--判断是否是标签节点-->
593
+  <block wx:if="{{item.node == 'element'}}">
594
+    <block wx:if="{{item.tag == 'button'}}">
595
+      <button type="default" size="mini">
596
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
597
+          <template is="wxParse8" data="{{item}}" />
598
+        </block>
599
+      </button>
600
+    </block>
601
+    <!--li类型-->
602
+    <block wx:elif="{{item.tag == 'li'}}">
603
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
604
+        <view class="{{item.classStr}} wxParse-li-inner">
605
+          <view class="{{item.classStr}} wxParse-li-text">
606
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
607
+          </view>
608
+          <view class="{{item.classStr}} wxParse-li-text">
609
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
610
+              <template is="wxParse8" data="{{item}}" />
611
+            </block>
612
+          </view>
613
+        </view>
614
+      </view>
615
+    </block>
616
+
617
+    <!--video类型-->
618
+    <block wx:elif="{{item.tag == 'video'}}">
619
+      <template is="wxParseVideo" data="{{item}}" />
620
+    </block>
621
+
622
+    <!--img类型-->
623
+    <block wx:elif="{{item.tag == 'img'}}">
624
+      <template is="wxParseImg" data="{{item}}" />
625
+    </block>
626
+
627
+    <!--a类型-->
628
+    <block wx:elif="{{item.tag == 'a'}}">
629
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
630
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
631
+          <template is="wxParse8" data="{{item}}" />
632
+        </block>
633
+      </view>
634
+    </block>
635
+
636
+    <block wx:elif="{{item.tag == 'br'}}">
637
+      <template is="WxParseBr"></template>
638
+    </block>
639
+    <!--其他块级标签-->
640
+    <block wx:elif="{{item.tagType == 'block'}}">
641
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
642
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
643
+          <template is="wxParse8" data="{{item}}" />
644
+        </block>
645
+      </view>
646
+    </block>
647
+
648
+    <!--内联标签-->
649
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
650
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
651
+        <template is="wxParse8" data="{{item}}" />
652
+      </block>
653
+    </view>
654
+
655
+  </block>
656
+
657
+  <!--判断是否是文本节点-->
658
+  <block wx:elif="{{item.node == 'text'}}">
659
+    <!--如果是,直接进行-->
660
+    <template is="WxEmojiView" data="{{item}}" />
661
+  </block>
662
+
663
+</template>
664
+
665
+<!--循环模版-->
666
+<template name="wxParse8">
667
+  <!--<template is="wxParse9" data="{{item}}" />-->
668
+  <!--判断是否是标签节点-->
669
+  <block wx:if="{{item.node == 'element'}}">
670
+    <block wx:if="{{item.tag == 'button'}}">
671
+      <button type="default" size="mini">
672
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
673
+          <template is="wxParse9" data="{{item}}" />
674
+        </block>
675
+      </button>
676
+    </block>
677
+    <!--li类型-->
678
+    <block wx:elif="{{item.tag == 'li'}}">
679
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
680
+        <view class="{{item.classStr}} wxParse-li-inner">
681
+          <view class="{{item.classStr}} wxParse-li-text">
682
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
683
+          </view>
684
+          <view class="{{item.classStr}} wxParse-li-text">
685
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
686
+              <template is="wxParse9" data="{{item}}" />
687
+            </block>
688
+          </view>
689
+        </view>
690
+      </view>
691
+    </block>
692
+
693
+    <!--video类型-->
694
+    <block wx:elif="{{item.tag == 'video'}}">
695
+      <template is="wxParseVideo" data="{{item}}" />
696
+    </block>
697
+
698
+    <!--img类型-->
699
+    <block wx:elif="{{item.tag == 'img'}}">
700
+      <template is="wxParseImg" data="{{item}}" />
701
+    </block>
702
+
703
+    <!--a类型-->
704
+    <block wx:elif="{{item.tag == 'a'}}">
705
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
706
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
707
+          <template is="wxParse9" data="{{item}}" />
708
+        </block>
709
+      </view>
710
+    </block>
711
+
712
+    <block wx:elif="{{item.tag == 'br'}}">
713
+      <template is="WxParseBr"></template>
714
+    </block>
715
+    <!--其他块级标签-->
716
+    <block wx:elif="{{item.tagType == 'block'}}">
717
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
718
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
719
+          <template is="wxParse9" data="{{item}}" />
720
+        </block>
721
+      </view>
722
+    </block>
723
+
724
+    <!--内联标签-->
725
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
726
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
727
+        <template is="wxParse9" data="{{item}}" />
728
+      </block>
729
+    </view>
730
+
731
+  </block>
732
+
733
+  <!--判断是否是文本节点-->
734
+  <block wx:elif="{{item.node == 'text'}}">
735
+    <!--如果是,直接进行-->
736
+    <template is="WxEmojiView" data="{{item}}" />
737
+  </block>
738
+
739
+</template>
740
+
741
+<!--循环模版-->
742
+<template name="wxParse9">
743
+  <!--<template is="wxParse10" data="{{item}}" />-->
744
+  <!--判断是否是标签节点-->
745
+  <block wx:if="{{item.node == 'element'}}">
746
+    <block wx:if="{{item.tag == 'button'}}">
747
+      <button type="default" size="mini">
748
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
749
+          <template is="wxParse10" data="{{item}}" />
750
+        </block>
751
+      </button>
752
+    </block>
753
+    <!--li类型-->
754
+    <block wx:elif="{{item.tag == 'li'}}">
755
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
756
+        <view class="{{item.classStr}} wxParse-li-inner">
757
+          <view class="{{item.classStr}} wxParse-li-text">
758
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
759
+          </view>
760
+          <view class="{{item.classStr}} wxParse-li-text">
761
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
762
+              <template is="wxParse10" data="{{item}}" />
763
+            </block>
764
+          </view>
765
+        </view>
766
+      </view>
767
+    </block>
768
+
769
+    <!--video类型-->
770
+    <block wx:elif="{{item.tag == 'video'}}">
771
+      <template is="wxParseVideo" data="{{item}}" />
772
+    </block>
773
+
774
+    <!--img类型-->
775
+    <block wx:elif="{{item.tag == 'img'}}">
776
+      <template is="wxParseImg" data="{{item}}" />
777
+    </block>
778
+
779
+    <!--a类型-->
780
+    <block wx:elif="{{item.tag == 'a'}}">
781
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
782
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
783
+          <template is="wxParse10" data="{{item}}" />
784
+        </block>
785
+      </view>
786
+    </block>
787
+
788
+    <block wx:elif="{{item.tag == 'br'}}">
789
+      <template is="WxParseBr"></template>
790
+    </block>
791
+    <!--其他块级标签-->
792
+    <block wx:elif="{{item.tagType == 'block'}}">
793
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
794
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
795
+          <template is="wxParse10" data="{{item}}" />
796
+        </block>
797
+      </view>
798
+    </block>
799
+
800
+    <!--内联标签-->
801
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
802
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
803
+        <template is="wxParse10" data="{{item}}" />
804
+      </block>
805
+    </view>
806
+
807
+  </block>
808
+
809
+  <!--判断是否是文本节点-->
810
+  <block wx:elif="{{item.node == 'text'}}">
811
+    <!--如果是,直接进行-->
812
+    <template is="WxEmojiView" data="{{item}}" />
813
+  </block>
814
+
815
+</template>
816
+
817
+<!--循环模版-->
818
+<template name="wxParse10">
819
+  <!--<template is="wxParse11" data="{{item}}" />-->
820
+  <!--判断是否是标签节点-->
821
+  <block wx:if="{{item.node == 'element'}}">
822
+    <block wx:if="{{item.tag == 'button'}}">
823
+      <button type="default" size="mini">
824
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
825
+          <template is="wxParse11" data="{{item}}" />
826
+        </block>
827
+      </button>
828
+    </block>
829
+    <!--li类型-->
830
+    <block wx:elif="{{item.tag == 'li'}}">
831
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
832
+        <view class="{{item.classStr}} wxParse-li-inner">
833
+          <view class="{{item.classStr}} wxParse-li-text">
834
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
835
+          </view>
836
+          <view class="{{item.classStr}} wxParse-li-text">
837
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
838
+              <template is="wxParse11" data="{{item}}" />
839
+            </block>
840
+          </view>
841
+        </view>
842
+      </view>
843
+    </block>
844
+
845
+    <!--video类型-->
846
+    <block wx:elif="{{item.tag == 'video'}}">
847
+      <template is="wxParseVideo" data="{{item}}" />
848
+    </block>
849
+
850
+    <!--img类型-->
851
+    <block wx:elif="{{item.tag == 'img'}}">
852
+      <template is="wxParseImg" data="{{item}}" />
853
+    </block>
854
+
855
+    <!--a类型-->
856
+    <block wx:elif="{{item.tag == 'a'}}">
857
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
858
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
859
+          <template is="wxParse11" data="{{item}}" />
860
+        </block>
861
+      </view>
862
+    </block>
863
+
864
+    <block wx:elif="{{item.tag == 'br'}}">
865
+      <template is="WxParseBr"></template>
866
+    </block>
867
+    <!--其他块级标签-->
868
+    <block wx:elif="{{item.tagType == 'block'}}">
869
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
870
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
871
+          <template is="wxParse11" data="{{item}}" />
872
+        </block>
873
+      </view>
874
+    </block>
875
+
876
+    <!--内联标签-->
877
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
878
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
879
+        <template is="wxParse11" data="{{item}}" />
880
+      </block>
881
+    </view>
882
+
883
+  </block>
884
+
885
+  <!--判断是否是文本节点-->
886
+  <block wx:elif="{{item.node == 'text'}}">
887
+    <!--如果是,直接进行-->
888
+    <template is="WxEmojiView" data="{{item}}" />
889
+  </block>
890
+
891
+</template>
892
+
893
+<!--循环模版-->
894
+<template name="wxParse11">
895
+  <!--<template is="wxParse12" data="{{item}}" />-->
896
+  <!--判断是否是标签节点-->
897
+  <block wx:if="{{item.node == 'element'}}">
898
+    <block wx:if="{{item.tag == 'button'}}">
899
+      <button type="default" size="mini">
900
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
901
+          <template is="wxParse12" data="{{item}}" />
902
+        </block>
903
+      </button>
904
+    </block>
905
+    <!--li类型-->
906
+    <block wx:elif="{{item.tag == 'li'}}">
907
+      <view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
908
+        <view class="{{item.classStr}} wxParse-li-inner">
909
+          <view class="{{item.classStr}} wxParse-li-text">
910
+            <view class="{{item.classStr}} wxParse-li-circle"></view>
911
+          </view>
912
+          <view class="{{item.classStr}} wxParse-li-text">
913
+            <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
914
+              <template is="wxParse12" data="{{item}}" />
915
+            </block>
916
+          </view>
917
+        </view>
918
+      </view>
919
+    </block>
920
+
921
+    <!--video类型-->
922
+    <block wx:elif="{{item.tag == 'video'}}">
923
+      <template is="wxParseVideo" data="{{item}}" />
924
+    </block>
925
+
926
+    <!--img类型-->
927
+    <block wx:elif="{{item.tag == 'img'}}">
928
+      <template is="wxParseImg" data="{{item}}" />
929
+    </block>
930
+
931
+    <!--a类型-->
932
+    <block wx:elif="{{item.tag == 'a'}}">
933
+      <view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
934
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
935
+          <template is="wxParse12" data="{{item}}" />
936
+        </block>
937
+      </view>
938
+    </block>
939
+
940
+    <block wx:elif="{{item.tag == 'br'}}">
941
+      <template is="WxParseBr"></template>
942
+    </block>
943
+    <!--其他块级标签-->
944
+    <block wx:elif="{{item.tagType == 'block'}}">
945
+      <view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
946
+        <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
947
+          <template is="wxParse12" data="{{item}}" />
948
+        </block>
949
+      </view>
950
+    </block>
951
+
952
+    <!--内联标签-->
953
+    <view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
954
+      <block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="index">
955
+        <template is="wxParse12" data="{{item}}" />
956
+      </block>
957
+    </view>
958
+
959
+  </block>
960
+
961
+  <!--判断是否是文本节点-->
962
+  <block wx:elif="{{item.node == 'text'}}">
963
+    <!--如果是,直接进行-->
964
+    <template is="WxEmojiView" data="{{item}}" />
965
+  </block>
966
+
967
+</template>

+ 221 - 0
components/local/wxParse/wxParse.wxss

@@ -0,0 +1,221 @@
1
+
2
+/**
3
+ * author: Di (微信小程序开发工程师)
4
+ * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
5
+ *               垂直微信小程序开发交流社区
6
+ * 
7
+ * github地址: https://github.com/icindy/wxParse
8
+ * 
9
+ * for: 微信小程序富文本解析
10
+ * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
11
+ */
12
+
13
+.wxParse{
14
+    margin: 0 5px;
15
+    font-family: Helvetica,sans-serif;
16
+    font-size: 28rpx;
17
+    color: #666;
18
+    line-height: 1.8;
19
+}
20
+view{
21
+    word-break:break-all; overflow:auto;
22
+}
23
+.wxParse-inline{
24
+    display: inline;
25
+    margin: 0;
26
+    padding: 0;
27
+}
28
+/*//标题 */
29
+.wxParse-div{margin: 0;padding: 0;}
30
+.wxParse-h1{ font-size:2em; margin: .67em 0 }
31
+.wxParse-h2{ font-size:1.5em; margin: .75em 0 }
32
+.wxParse-h3{ font-size:1.17em; margin: .83em 0 }
33
+.wxParse-h4{ margin: 1.12em 0}
34
+.wxParse-h5 { font-size:.83em; margin: 1.5em 0 }
35
+.wxParse-h6{ font-size:.75em; margin: 1.67em 0 }
36
+
37
+.wxParse-h1 {
38
+  font-size: 18px;
39
+  font-weight: 400;
40
+  margin-bottom: .9em;
41
+}
42
+.wxParse-h2 {
43
+  font-size: 16px;
44
+  font-weight: 400;
45
+  margin-bottom: .34em;
46
+}
47
+.wxParse-h3 {
48
+  font-weight: 400;
49
+  font-size: 15px;
50
+  margin-bottom: .34em;
51
+}
52
+.wxParse-h4 {
53
+  font-weight: 400;
54
+  font-size: 14px;
55
+  margin-bottom: .24em;
56
+}
57
+.wxParse-h5 {
58
+  font-weight: 400;
59
+  font-size: 13px;
60
+  margin-bottom: .14em;
61
+}
62
+.wxParse-h6 {
63
+  font-weight: 400;
64
+  font-size: 12px;
65
+  margin-bottom: .04em;
66
+}
67
+
68
+.wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong  { font-weight: bolder }
69
+
70
+.wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic}
71
+.wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace}
72
+.wxParse-pre{white-space:pre}
73
+.wxParse-big{font-size:1.17em}
74
+.wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em}
75
+.wxParse-sub{vertical-align:sub}
76
+.wxParse-sup{vertical-align:super}
77
+.wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through}
78
+/*wxparse-自定义个性化的css样式*/
79
+/*增加video的css样式*/
80
+.wxParse-strong,.wxParse-s{display: inline}
81
+.wxParse-a{
82
+    color: deepskyblue;
83
+    word-break:break-all;
84
+    overflow:auto;
85
+}
86
+
87
+.wxParse-video{
88
+    text-align: center;
89
+    margin: 10px 0;
90
+}
91
+
92
+.wxParse-video-video{
93
+    width:100%;
94
+}
95
+
96
+.wxParse-img{
97
+    /*background-color: #efefef;*/
98
+    overflow: hidden;
99
+}
100
+
101
+.wxParse-blockquote {
102
+    margin: 0;
103
+    padding:10px 0 10px 5px;
104
+    font-family:Courier, Calibri,"宋体";
105
+    background:#f5f5f5;
106
+    border-left: 3px solid #dbdbdb;
107
+}
108
+
109
+.wxParse-code,.wxParse-wxxxcode-style{
110
+    display: inline;
111
+    background:#f5f5f5;
112
+}
113
+.wxParse-ul{
114
+    margin: 20rpx 10rpx;
115
+}
116
+
117
+.wxParse-li,.wxParse-li-inner{
118
+    display: flex;
119
+    align-items: baseline;
120
+    margin: 10rpx 0;
121
+}
122
+.wxParse-li-text{
123
+    
124
+    align-items: center;
125
+    line-height: 20px;
126
+}
127
+
128
+.wxParse-li-circle{
129
+    display: inline-flex;
130
+    width: 5px;
131
+    height: 5px;
132
+    background-color: #333;
133
+    margin-right: 5px;
134
+}
135
+
136
+.wxParse-li-square{
137
+    display: inline-flex;
138
+    width: 10rpx;
139
+    height: 10rpx;
140
+    background-color: #333;
141
+    margin-right: 5px;
142
+}
143
+.wxParse-li-ring{
144
+    display: inline-flex;
145
+    width: 10rpx;
146
+    height: 10rpx;
147
+    border: 2rpx solid #333;
148
+    border-radius: 50%;
149
+    background-color: #fff;
150
+    margin-right: 5px;
151
+}
152
+
153
+/*.wxParse-table{
154
+    width: 100%;
155
+    height: 400px;
156
+}
157
+.wxParse-thead,.wxParse-tfoot,.wxParse-tr{
158
+    display: flex;
159
+    flex-direction: row;
160
+}
161
+.wxParse-th,.wxParse-td{
162
+    display: flex;
163
+    width: 580px;
164
+    overflow: auto;
165
+}*/
166
+
167
+.wxParse-u {
168
+  text-decoration: underline;
169
+}
170
+.wxParse-hide{
171
+    display: none;
172
+}
173
+.WxEmojiView{
174
+    align-items: center;
175
+}
176
+.wxEmoji{
177
+    width: 16px;
178
+    height:16px;
179
+}
180
+.wxParse-tr{
181
+	display: flex;
182
+	border-right:1px solid #e0e0e0;
183
+	border-bottom:1px solid #e0e0e0;
184
+	border-top:1px solid #e0e0e0;
185
+}
186
+.wxParse-th,
187
+.wxParse-td{
188
+	flex:1;
189
+	padding:5px;
190
+	font-size:28rpx;
191
+	border-left:1px solid #e0e0e0;
192
+	word-break: break-all;
193
+}
194
+.wxParse-td:last{
195
+	border-top:1px solid #e0e0e0;
196
+}
197
+.wxParse-th{
198
+	background:#f0f0f0;
199
+	border-top:1px solid #e0e0e0;
200
+}
201
+.wxParse-del{
202
+    display: inline;
203
+}
204
+.wxParse-figure {
205
+  overflow: hidden;
206
+}
207
+
208
+.wxParse-img{
209
+    display: inline-flex;
210
+    border: none;
211
+    outline: none;
212
+    vertical-align: bottom;
213
+}
214
+image[src=""] {
215
+    opacity: 0;
216
+}
217
+
218
+.wxParse-p {
219
+    text-align: center;
220
+}
221
+  

二进制
images/all_carding.png


二进制
images/black_location.png


二进制
images/car-icon.png


二进制
images/card.png


二进制
images/card_img.png


二进制
images/clearMessage.png


二进制
images/delete-gray.png


二进制
images/display.png


二进制
images/go_on.png


二进制
images/gzh.png


二进制
images/home/message.png


二进制
images/home/time.png


二进制
images/home/喇叭@2x.png


二进制
images/home/定位@2x(2).png


二进制
images/home/定位@2x.png


二进制
images/home/展开@2x(1).png


二进制
images/home/展开@2x.png


二进制
images/home_popup_close.png


二进制
images/icon_01.png


二进制
images/icon_02.png


二进制
images/icon_03.png


二进制
images/icon_04.png


二进制
images/icon_05.png


二进制
images/icon_06.png


二进制
images/icon_07.png


二进制
images/icon_08.png


二进制
images/icon_09.png


二进制
images/icon_10.png


二进制
images/icon_11.png


二进制
images/icon_12.png


二进制
images/icon_13.png


二进制
images/icon_14.png


二进制
images/icon_15.png


二进制
images/icon_16.png


二进制
images/icon_17.png


二进制
images/icon_18.png


二进制
images/icon_19.png


二进制
images/icon_20.png


二进制
images/icon_21.png


二进制
images/icon_arrow_2.png


二进制
images/icon_arrow_gray.png


二进制
images/icon_avatar_01.png


二进制
images/icon_avatar_02.png


二进制
images/icon_close_01.png


二进制
images/icon_close_02.png


二进制
images/icon_gender_1.png


二进制
images/icon_gender_2.png


二进制
images/icon_location_black.png


二进制
images/icon_logo.png


二进制
images/icon_logo_white_bg.png


二进制
images/icon_nav_01.png


二进制
images/icon_no_device.png


二进制
images/icon_order_coupon.png


二进制
images/icon_order_vip.png


二进制
images/icon_radio_01.png


二进制
images/icon_radio_02.png


二进制
images/icon_radio_03.png


二进制
images/icon_record_01.png


二进制
images/icon_record_02.png


二进制
images/icon_record_03.png


二进制
images/icon_record_04.png


二进制
images/icon_record_06.png


二进制
images/icon_record_07.png


二进制
images/icon_record_bg.png


+ 0 - 0
images/icon_record_new_00.png


部分文件因为文件数量过多而无法显示