├── README.md
├── app.js
├── app.json
├── app.wxss
├── images
├── UI_DEMO
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ └── 6.png
├── ditu.png
├── ico_ditu.png
├── icon
│ ├── ico_gouxuan.png
│ ├── ico_huiyi@2x.png
│ ├── ico_huiyi_.png
│ ├── ico_huiyi_A.png
│ ├── ico_huiyi_B.png
│ ├── ico_weixin@2x.png
│ ├── ico_yuding@2x.png
│ ├── ico_yuding_p@2x.png
│ ├── ico_zuowei_.png
│ ├── ico_zuowei_A.png
│ ├── ico_zuowei_B.png
│ ├── index_A.png
│ ├── index_B.png
│ ├── nav_fanhui_A.png
│ ├── nav_fanhui_B.png
│ ├── nav_xiala_lan_B.png
│ ├── notice_A.png
│ ├── notice_B.png
│ ├── orders_A.png
│ ├── orders_B.png
│ ├── personal_A.png
│ └── personal_B.png
├── index-focus-1.png
├── index-focus-2.png
├── notice-1.png
├── notice-2.png
├── notice-3.png
├── unuserhead.jpg
├── userhead.jpg
├── vankelogo.png
└── zuowei.png
├── pages
├── article
│ ├── article.js
│ ├── article.json
│ ├── article.wxml
│ └── article.wxss
├── booking-detail
│ ├── booking-detail.js
│ ├── booking-detail.json
│ ├── booking-detail.wxml
│ └── booking-detail.wxss
├── booking
│ ├── booking.js
│ ├── booking.json
│ ├── booking.wxml
│ └── booking.wxss
├── conference
│ ├── conference.js
│ ├── conference.json
│ ├── conference.wxml
│ └── conference.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── login
│ ├── login.js
│ ├── login.json
│ ├── login.wxml
│ └── login.wxss
├── notice
│ ├── notice.js
│ └── notice.wxml
├── orders
│ ├── orders.js
│ ├── orders.json
│ ├── orders.wxml
│ └── orders.wxss
├── personal
│ ├── personal.js
│ ├── personal.json
│ ├── personal.wxml
│ └── personal.wxss
├── scanning
│ ├── scanning.js
│ ├── scanning.json
│ ├── scanning.wxml
│ └── scanning.wxss
└── sitting
│ ├── sitting.js
│ ├── sitting.json
│ ├── sitting.wxml
│ └── sitting.wxss
├── template
└── template.wxml
├── utils
└── util.js
└── wxParse
├── html2json.js
├── htmlparser.js
├── showdown.js
├── wxDiscode.js
├── wxParse.js
├── wxParse.wxml
└── wxParse.wxss
/README.md:
--------------------------------------------------------------------------------
1 | ## 此会议室为小程序的一个demo
2 |
3 | ### [我的博客](http://blog.csdn.net/m0_37541331)
4 | ### 现在为大家介绍一下效果图
5 |
6 | 
7 | 
8 | 
9 | 
10 | 
11 | 
12 |
13 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 |
5 | },
6 | getRequest: function(url,callback){
7 | wx.showToast({
8 | title: '加载中',
9 | icon: 'loading',
10 | duration: 10000
11 | })
12 | wx.request({
13 | url: url, //仅为示例,并非真实的接口地址
14 | success: function(res) {
15 | if(callback && typeof callback == 'function'){
16 | callback(res)
17 | wx.hideToast()
18 | }
19 | }
20 | })
21 | },
22 | getScanning: function(){
23 | wx.scanCode({
24 | success: (res) => {
25 | var result = res.result
26 | result = result.replace('http://','')
27 | wx.navigateTo({
28 | url: '../'+result
29 | })
30 | }
31 | })
32 | },
33 | setStorageUser: function(params,callback){
34 | wx.setStorage({
35 | key: params.key,
36 | data: params.data,
37 | success: function(res) {
38 | if(callback && typeof callback == 'function'){
39 | callback(res)
40 | }
41 | }
42 | });
43 | // console.log(params)
44 |
45 | }
46 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages":[
3 | "pages/index/index",
4 | "pages/orders/orders",
5 | "pages/notice/notice",
6 | "pages/personal/personal",
7 | "pages/login/login",
8 | "pages/scanning/scanning",
9 | "pages/booking/booking",
10 | "pages/sitting/sitting",
11 | "pages/conference/conference",
12 | "pages/article/article",
13 | "pages/booking-detail/booking-detail"
14 | ],
15 | "tabBar":{
16 | "selectedColor": "#b02923",
17 | "color": "#666",
18 | "borderStyle": "black",
19 | "backgroundColor": "#fff",
20 | "list": [{
21 | "pagePath": "pages/index/index",
22 | "text": "首页",
23 | "iconPath": "images/icon/index_A.png",
24 | "selectedIconPath": "images/icon/index_B.png"
25 | },{
26 | "pagePath": "pages/orders/orders",
27 | "text": "我的预订",
28 | "iconPath": "images/icon/orders_A.png",
29 | "selectedIconPath": "images/icon/orders_B.png"
30 | },{
31 | "pagePath": "pages/notice/notice",
32 | "text": "公告",
33 | "iconPath": "images/icon/notice_A.png",
34 | "selectedIconPath": "images/icon/notice_B.png"
35 | },{
36 | "pagePath": "pages/personal/personal",
37 | "text": "我的",
38 | "iconPath": "images/icon/personal_A.png",
39 | "selectedIconPath": "images/icon/personal_B.png"
40 | }]
41 | },
42 | "window":{
43 | "backgroundTextStyle":"light",
44 | "navigationBarBackgroundColor": "#b02923",
45 | "navigationBarTitleText": "万科会议室",
46 | "navigationBarTextStyle":"white",
47 | "backgroundColor": "#eeeeee"
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | @import "/wxParse/wxParse.wxss";
3 | page{
4 | background-color: #eee;
5 | font-size: 12px;
6 | font-family:"Helvetica Neue",Helvetica,Arial,sans-serif,"微软雅黑","宋体";
7 | }
8 | view,navigator{
9 | box-sizing: border-box;
10 | }
11 | @font-face {
12 | font-family: 'iconfont'; /* project id 225123 */
13 | src: url('https://at.alicdn.com/t/font_vkd3bl42t0zoajor.eot');
14 | src: url('https://at.alicdn.com/t/font_vkd3bl42t0zoajor.eot?#iefix') format('embedded-opentype'),
15 | url('https://at.alicdn.com/t/font_vkd3bl42t0zoajor.woff') format('woff'),
16 | url('https://at.alicdn.com/t/font_vkd3bl42t0zoajor.ttf') format('truetype'),
17 | url('https://at.alicdn.com/t/font_vkd3bl42t0zoajor.svg#iconfont') format('svg');
18 | }
19 | .iconfont {
20 | font-family:"iconfont" !important;
21 | font-size:16px;
22 | font-style:normal;
23 | -webkit-font-smoothing: antialiased;
24 | -moz-osx-font-smoothing: grayscale;
25 | }
26 | .icon-more:before { content: "\e6a7"; }
27 |
28 | .icon-less:before { content: "\e6a5"; }
29 |
30 | .icon-moreunfold:before { content: "\e6a6"; }
31 |
32 | .icon-account:before { content: "\e6b8"; }
33 |
34 | .icon-clock:before { content: "\e6bb"; }
35 |
36 | .icon-zuowei:before { content: "\e604"; }
37 |
38 | .icon-electronics:before { content: "\e6da"; }
39 |
40 | .icon-qrcode:before { content: "\e631"; }
41 |
42 | .icon-map:before { content: "\e715"; }
43 |
44 | .icon-mobilephone:before { content: "\e72a"; }
45 |
46 | .icon-huiyishi:before { content: "\e603"; }
47 |
48 | .icon-phone:before { content: "\e639"; }
49 |
50 | .icon-floor:before { content: "\e600"; }
51 |
52 | .icon-name:before { content: "\e714"; }
53 |
54 | .icon-seat:before { content: "\e65d"; }
55 |
56 | .icon-time:before { content: "\e88f"; }
57 |
58 | .icon-password:before { content: "\e9af"; }
59 |
60 | .icon-feedback:before { content: "\e62f"; }
61 |
62 | .icon-about:before { content: "\e67a"; }
63 |
64 | .icon-reserve:before { content: "\e716"; }
65 |
66 | .icon-edition:before { content: "\e649"; }
67 |
68 |
69 |
70 | /* 共用的小样式 */
71 | .bg-white{
72 | background-color: #fff;
73 | }
74 | .clearfix:before, .clearfix:after {
75 | content: "";
76 | display: table;
77 | }
78 | .clearfix:after {
79 | clear: both;
80 | }
81 | .pull-left{
82 | float: left;
83 | }
84 | .pull-right{
85 | float: right;
86 | }
87 |
88 | /* 公告列表样式 */
89 | .noticeList{
90 | margin-top: 20rpx;
91 | padding: 0 16rpx;
92 | }
93 | .noticeList-item{
94 | padding: 24rpx 6rpx 16rpx;
95 | border-bottom: 1px solid #f3f3f3;
96 | display: -webkit-box;
97 | display: -webkit-flex;
98 | display: flex;
99 | }
100 | .noticeList-item-r{
101 | padding-left: 8px;
102 | -webkit-box-flex: 1;
103 | -webkit-flex: 1;
104 | flex:1;
105 | overflow: hidden;
106 | }
107 | .noticeList-item-r text{
108 | display: block;
109 | }
110 | .noticeList-item-title{
111 | overflow: hidden;
112 | white-space: nowrap;
113 | text-overflow: ellipsis;
114 | font-weight: bold;
115 | color: #393939;
116 | font-size:28rpx;
117 | }
118 | .noticeList-item-desc{
119 | overflow: hidden;
120 | word-break: break-all;
121 | text-overflow: ellipsis;
122 | text-overflow: -o-ellipsis-lastline;
123 | display: -webkit-box;
124 | -webkit-line-clamp: 3;
125 | -webkit-box-orient: vertical;
126 | color: #999;
127 | line-height: 1.3;
128 | margin-top: 5px;
129 | height: 46px;
130 | font-size:26rpx;
131 | }
132 |
133 | .button-hover {
134 | background-color: #b02923;
135 | }
136 | /** 添加自定义button点击态样式类**/
137 | .other-button-hover {
138 | background-color: #b02923;
139 | color:#fff;
140 | }
141 | button{
142 | background-color: #b02923;
143 | color:#fff;
144 | width:80%;
145 | margin-top:80px;
146 |
147 | }
148 | /* 二维码浮标 */
149 | .qrcode{
150 | position: fixed;
151 | right: 10px;
152 | bottom: 50px;
153 | color: #b02923;
154 | font-size: 30px;
155 | width: 40px;
156 | height: 40px;
157 | background-color: rgba(255, 255, 255, 1);
158 | text-align: center;
159 | line-height: 40px;
160 | }
161 | .qrcode span{
162 | font-size: 30px;
163 | font-weight: bold;
164 | }
--------------------------------------------------------------------------------
/images/UI_DEMO/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/UI_DEMO/1.png
--------------------------------------------------------------------------------
/images/UI_DEMO/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/UI_DEMO/2.png
--------------------------------------------------------------------------------
/images/UI_DEMO/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/UI_DEMO/3.png
--------------------------------------------------------------------------------
/images/UI_DEMO/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/UI_DEMO/4.png
--------------------------------------------------------------------------------
/images/UI_DEMO/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/UI_DEMO/5.png
--------------------------------------------------------------------------------
/images/UI_DEMO/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/UI_DEMO/6.png
--------------------------------------------------------------------------------
/images/ditu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/ditu.png
--------------------------------------------------------------------------------
/images/ico_ditu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/ico_ditu.png
--------------------------------------------------------------------------------
/images/icon/ico_gouxuan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_gouxuan.png
--------------------------------------------------------------------------------
/images/icon/ico_huiyi@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_huiyi@2x.png
--------------------------------------------------------------------------------
/images/icon/ico_huiyi_.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_huiyi_.png
--------------------------------------------------------------------------------
/images/icon/ico_huiyi_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_huiyi_A.png
--------------------------------------------------------------------------------
/images/icon/ico_huiyi_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_huiyi_B.png
--------------------------------------------------------------------------------
/images/icon/ico_weixin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_weixin@2x.png
--------------------------------------------------------------------------------
/images/icon/ico_yuding@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_yuding@2x.png
--------------------------------------------------------------------------------
/images/icon/ico_yuding_p@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_yuding_p@2x.png
--------------------------------------------------------------------------------
/images/icon/ico_zuowei_.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_zuowei_.png
--------------------------------------------------------------------------------
/images/icon/ico_zuowei_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_zuowei_A.png
--------------------------------------------------------------------------------
/images/icon/ico_zuowei_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/ico_zuowei_B.png
--------------------------------------------------------------------------------
/images/icon/index_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/index_A.png
--------------------------------------------------------------------------------
/images/icon/index_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/index_B.png
--------------------------------------------------------------------------------
/images/icon/nav_fanhui_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/nav_fanhui_A.png
--------------------------------------------------------------------------------
/images/icon/nav_fanhui_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/nav_fanhui_B.png
--------------------------------------------------------------------------------
/images/icon/nav_xiala_lan_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/nav_xiala_lan_B.png
--------------------------------------------------------------------------------
/images/icon/notice_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/notice_A.png
--------------------------------------------------------------------------------
/images/icon/notice_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/notice_B.png
--------------------------------------------------------------------------------
/images/icon/orders_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/orders_A.png
--------------------------------------------------------------------------------
/images/icon/orders_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/orders_B.png
--------------------------------------------------------------------------------
/images/icon/personal_A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/personal_A.png
--------------------------------------------------------------------------------
/images/icon/personal_B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/icon/personal_B.png
--------------------------------------------------------------------------------
/images/index-focus-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/index-focus-1.png
--------------------------------------------------------------------------------
/images/index-focus-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/index-focus-2.png
--------------------------------------------------------------------------------
/images/notice-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/notice-1.png
--------------------------------------------------------------------------------
/images/notice-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/notice-2.png
--------------------------------------------------------------------------------
/images/notice-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/notice-3.png
--------------------------------------------------------------------------------
/images/unuserhead.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/unuserhead.jpg
--------------------------------------------------------------------------------
/images/userhead.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/userhead.jpg
--------------------------------------------------------------------------------
/images/vankelogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/vankelogo.png
--------------------------------------------------------------------------------
/images/zuowei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengxianlin/huiyishi/4c182e5a2d7b5e1bafe925fd879ccff91a713838/images/zuowei.png
--------------------------------------------------------------------------------
/pages/article/article.js:
--------------------------------------------------------------------------------
1 | // pages/article/article.js
2 | var WxParse = require('../../wxParse/wxParse.js');
3 | Page({
4 | data:{
5 | article: ''
6 | },
7 | onLoad:function(options){
8 | // 页面初始化 options为页面跳转所带来的参数
9 | var article = '

(万周社7月20日大梅沙电)2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年度1843.18亿元(293.29亿美元)的营收首次跻身《财富》“世界500强”,位列榜单第356位。
“世界500强”(Fortune Global 500)是中国人对《财富》杂志评选的“全球最大五百家公司”排行榜的一种约定俗成的叫法。自1955年开始发布以来,《财富》“世界500强”排行榜一直是衡量全球大型公司的最著名、最权威榜单,是世界知名企业用来判断自身实力、规模和国际竞争力的重要指标。
《财富》“世界500强”的排行榜以企业年度营业收入和利润作为主要评定指标,每年发布一次。根据万科2015年年度报告(按国际财务报告准则),公司在2015年实现营业收入1843.18亿元(293.29亿美元),实现净利润181.19亿元(28.83亿美元)。
万科成立于1984年,1988年进入房地产行业,经过三十余年的发展,已成为世界最大的住宅开发企业。截至2015年底,万科业务覆盖全球71个城市,物业服务住宅社区843个。2015年,万科实现销售面积2067.1万平方米,销售金额2614.7亿元,同比分别增长14.3%和20.7%。在全国商品房市场的占有率进一步上升至3%。无论销售金额还是市场占有率,都创造了行业有史以来的新纪录。
1991年,万科成为深圳证券交易所首批上市公司,持续增长的业绩回报以及规范透明的公司治理结构,使公司赢得了投资者的广泛认可。公司在发展过程中先后入选《福布斯》“全球200家最佳中小企业”、“亚洲最佳上市公司50强”等排行榜;多次获得《投资者关系》等国际权威媒体评出的最佳公司治理、最佳投资者关系等奖项。
万科创始人、董事长王石表示:32年来,万科与中国经济共同成长,是改革开放提供了历史机遇,是深圳特区提供了发展沃土。上榜“世界500强”,要感谢业主客户的信赖,感谢投资者的支持,感谢合作伙伴的信任,感谢万科全体员工的不懈努力,感谢所有关心万科、激励万科不断完善、砥砺前行的人们。
'
10 | var that = this;
11 | WxParse.wxParse('article', 'html', article, that);
12 | }
13 | })
--------------------------------------------------------------------------------
/pages/article/article.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/article/article.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/article/article.wxss:
--------------------------------------------------------------------------------
1 | /* pages/article/article.wxss */
2 | page{
3 | background-color: #fff;
4 | }
5 | .article-content{
6 | padding: 10px;
7 | }
8 | .wxParse-p{
9 | padding-top: 8px;
10 | }
--------------------------------------------------------------------------------
/pages/booking-detail/booking-detail.js:
--------------------------------------------------------------------------------
1 | // pages/booking/booking.js
2 | var util = require('../../utils/util.js');
3 | Page({
4 | data:{
5 | times: ['08:00--12:00','14:00--18:00'],
6 | floor:['上午', '下午'],
7 | bookFloor:'6F',
8 | bookPlan:'A区15',
9 | bookArea:'A区',
10 | index: 0,
11 | first: 0,
12 | picker:true,
13 | type: ''
14 | },
15 | onLoad:function(options){
16 | // 页面初始化 options为页面跳转所带来的参数
17 |
18 | var obtain = wx.getStorageSync(options.type);
19 | if(options.userId == undefined){
20 | this.setData({
21 | picker: false,
22 | date:util.formatTime(new Date)
23 | })
24 | }else{
25 | if(obtain[options.userId]){
26 | this.setData({
27 | picker: true,
28 | type: options.type,
29 | bookFloor: obtain[options.userId].floorNum,
30 | date: obtain[options.userId].date,
31 | first: obtain[options.userId].first
32 | })
33 | if(options.type == 'seat'){
34 | this.setData({
35 | bookPlan: obtain[options.userId].seatNum+obtain[options.userId].userText,
36 | bookArea: obtain[options.userId].seatNum
37 | })
38 | }else{
39 | this.setData({
40 | bookPlan: obtain[options.userId].roomNum,
41 | bookArea: '会议室'
42 | })
43 | }
44 | }
45 | }
46 | },
47 | onReady:function(){
48 | // 页面渲染完成
49 | },
50 | onShow:function(){
51 | // 页面显示
52 | // 读取用户信息
53 | var userInfo = wx.getStorageSync('userInfo');
54 | if(userInfo.length !== 0){
55 | this.setData({
56 | userName: userInfo.userName,
57 | userPhone: userInfo.userPhone,
58 | login: true,
59 | btnSubmit: '确认预定'
60 | })
61 | }else{
62 | this.setData({
63 | userName: '',
64 | userPhone: '',
65 | login: false,
66 | btnSubmit: '登录'
67 | })
68 | }
69 | },
70 | onHide:function(){
71 | // 页面隐藏
72 | },
73 | onUnload:function(){
74 | // 页面关闭
75 | },
76 | bindDateChange: function(e) {
77 | // 日期
78 | console.log(e);
79 | this.setData({
80 | date: e.detail.value
81 | })
82 | },
83 | bindPickerOrder: function(e) {
84 | this.setData({
85 | first: e.detail.value
86 | })
87 | },
88 | btnSubmit:function(){
89 | var _that = this;
90 | if(this.data.login){
91 | wx.showToast({
92 | title: '预定成功',
93 | icon: 'success',
94 | duration: 1000,
95 | success:function(){
96 | setTimeout(function(){
97 | console.log('预定成功')
98 | wx.switchTab({
99 | url: '../orders/orders?type='+_that.data.type
100 | })
101 | },1000)
102 | }
103 | })
104 | }else{
105 | wx.navigateTo({
106 | url: '../login/login'
107 | })
108 | }
109 | }
110 | })
--------------------------------------------------------------------------------
/pages/booking-detail/booking-detail.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/booking-detail/booking-detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 姓名
6 | {{userName}}
7 |
8 |
9 | 手机号
10 | {{userPhone}}
11 |
12 |
13 | 日期筛选
14 |
15 |
16 | {{date}}
17 |
18 |
19 |
20 |
21 | 时间筛选
22 |
23 |
24 | {{floor[first]}}
25 |
26 |
27 |
28 |
29 | 预约楼层
30 | {{bookFloor}}
31 |
32 |
33 | 平面图
34 | {{bookPlan}}
35 |
36 |
37 | {{bookArea}}
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/pages/booking-detail/booking-detail.wxss:
--------------------------------------------------------------------------------
1 | /* pages/booking-detail/booking-detail.wxss */
2 | page{
3 | background-color: #fff;
4 | }
5 | .userDate{
6 | padding:24rpx;
7 | background-color:#fff;
8 | }
9 | .userDate > view{
10 | line-height:70rpx;
11 | font-size:14px;
12 | border-bottom: 1px solid #dcdcdc;
13 | }
14 | .userDate > view text,picker{
15 | float: right;
16 | }
17 | .iconfont:before{
18 | color:#b02923;
19 | font-size:18px;
20 | padding-right: 10rpx;
21 | text-align: center;
22 | vertical-align: top;
23 | font-weight:bold;
24 | display: inline-block;
25 | }
26 | .picker{
27 | position: relative;
28 | padding-right:45rpx;
29 | }
30 | .picker:before{
31 | content:'';
32 | height:8px;
33 | width:8px;
34 | display:block;
35 | border:1px solid #555;
36 | border-left-width:0;
37 | border-bottom-width:0;
38 | position:absolute;
39 | top:10px;
40 | right:6px;
41 | -webkit-transform:rotate(135deg);
42 | -moz-transform:rotate(135deg);
43 | transform:rotate(135deg);
44 | }
45 | button{
46 | background-color:#b02923;
47 | color:#fff;
48 | margin-top:50rpx;
49 | width:80%;
50 | }
51 | .comboRoom{
52 | padding-right:0;
53 | }
54 | .comboRoom:before{
55 | content:'';
56 | border:none;
57 | }
--------------------------------------------------------------------------------
/pages/booking/booking.js:
--------------------------------------------------------------------------------
1 | // pages/booking/booking.js
2 | const app = getApp();
3 | const util = require('../../utils/util.js');
4 | const dataRoom = {
5 | room:[{
6 | id:"10001",
7 | title:"会议室A",
8 | chosen:true,
9 | },{
10 | id:"10002",
11 | title:"会议室B",
12 | chosen:false,
13 | },{
14 | id:"10003",
15 | title:"会议室C",
16 | chosen:false,
17 | },{
18 | id:"10004",
19 | title:"会议室D",
20 | chosen:true,
21 | },{
22 | id:"10005",
23 | title:"会议室E",
24 | chosen:false,
25 | },{
26 | id:"10006",
27 | title:"会议室F",
28 | chosen:false,
29 | }]
30 | };
31 | const dataSeat = {
32 | seat:[{
33 | id:"10001",
34 | title:"A区",
35 | children:[{
36 | id:"20001",
37 | title:"01",
38 | chosen:true,
39 | },{
40 | id:"20002",
41 | title:"02",
42 | chosen:false,
43 | },{
44 | id:"20003",
45 | title:"03",
46 | chosen:true,
47 | },{
48 | id:"20004",
49 | title:"04",
50 | chosen:true,
51 | }]
52 | },{
53 | id:"10002",
54 | title:"B区",
55 | children:[{
56 | id:"20001",
57 | title:"01",
58 | chosen:true,
59 | },{
60 | id:"20002",
61 | title:"02",
62 | chosen:false,
63 | },{
64 | id:"20003",
65 | title:"03",
66 | chosen:false,
67 | },{
68 | id:"20004",
69 | title:"04",
70 | chosen:true,
71 | },{
72 | id:"20005",
73 | title:"05",
74 | chosen:true,
75 | }]
76 | }]
77 | }
78 | Page({
79 | data:{
80 | region: 'seat',
81 | chosens: false,
82 | options: false,
83 | daytime:['上午', '下午'],
84 | floor:['1F', '2F', '3F'],
85 | first: 0,
86 | num: 0,
87 | regionDataSeat:[],
88 | regionDataRoom:[],
89 | userChosen: '',
90 | userId: '',
91 | userTitle: '',
92 | userText: ''
93 | },
94 | onLoad:function(options){
95 | // 页面初始化 options为页面跳转所带来的参数
96 | this.setData({
97 | region: options.type,
98 | date:util.formatTime(new Date)
99 | });
100 | if(options.type == 'seat'){
101 | var seats = dataSeat
102 | seats['userChosen'] = ''
103 | this.setData({
104 | regionDataSeat: seats
105 | });
106 | }else{
107 | var rooms = dataRoom
108 | rooms['userChosen'] = ''
109 | this.setData({
110 | regionDataRoom: rooms
111 | });
112 | };
113 | },
114 | onReady:function(){
115 | // 页面渲染完成
116 | },
117 | onShow:function(){
118 | // 页面显示
119 | },
120 | onHide:function(){
121 | // 页面隐藏
122 | },
123 | onUnload:function(){
124 | // 页面关闭
125 | },
126 | chooseSeat:function(res){
127 | var chosen = res.currentTarget.dataset.chosen;
128 | if(!chosen){
129 | var seats = this.data.regionDataSeat;
130 | this.setData({
131 | userChosen: res.currentTarget.dataset.mark,
132 | regionDataSeat: seats,
133 | userId: res.currentTarget.dataset.userid,
134 | userTitle: res.currentTarget.dataset.title,
135 | userText: res.currentTarget.dataset.usertext
136 | });
137 | };
138 | },
139 | chooseRoom:function(res){
140 | var chosen = res.currentTarget.dataset.chosen;
141 | if(!chosen){
142 | this.setData({
143 | userChosen: res.currentTarget.dataset.mark,
144 | regionDataRoom: this.data.regionDataRoom,
145 | userText: res.currentTarget.dataset.usertext,
146 | userId: res.currentTarget.dataset.mark
147 | });
148 | };
149 | },
150 | bindDateChange: function(e) {
151 | // 日期
152 | this.setData({
153 | date: e.detail.value
154 | });
155 | },
156 | bindPickerOrder: function(e) {
157 | // 时间
158 | this.setData({
159 | first: e.detail.value
160 | });
161 | },
162 | bindPickerFloor: function(e){
163 | // 楼层
164 | this.setData({
165 | num: e.detail.value
166 | });
167 | },
168 | generateMixed: function(n){
169 | // 随机数
170 | var res = "";
171 | var chars = ['0','1','2','3','4','5','6','7','8','9'];
172 | for(var i = 0; i < n ; i ++) {
173 | var id = Math.ceil(Math.random()*9);
174 | res += chars[id];
175 | }
176 | return res;
177 | },
178 | submitBtn: function(e){
179 | let title,data,
180 | type = this.data.region,
181 | obtain = wx.getStorageSync(type) /*获取保存的预定数据*/,
182 | mixed = this.generateMixed(6)+this.data.userId /*获取随机数+预定userId*/;
183 |
184 | if(this.data.userChosen == ''){
185 | type == 'seat' ? title = '请选择座位' : title = '请选择会议室';
186 | wx.showToast({
187 | title: title,
188 | icon: 'loading',
189 | duration: 1000
190 | });
191 | return false
192 | }else{
193 | wx.showToast({
194 | title: '提交预定',
195 | icon: 'loading',
196 | duration: 10000
197 | });
198 | };
199 |
200 | obtain == '' ? obtain = {} : obtain;
201 |
202 | type == 'seat' ? obtain[mixed] = {
203 | date: this.data.date,
204 | daytime: this.data.daytime[this.data.first],
205 | seatNum: this.data.userTitle,
206 | userText: this.data.userText,
207 | floorNum: this.data.floor[this.data.num],
208 | first: this.data.num
209 | } : obtain[mixed] = {
210 | date: this.data.date,
211 | daytime: this.data.daytime[this.data.first],
212 | roomNum: this.data.userText,
213 | floorNum: this.data.floor[this.data.num],
214 | first: this.data.num
215 | };
216 |
217 | app.setStorageUser({key: this.data.region,data: obtain}, function (res){
218 | if(res.errMsg == 'setStorage:ok'){
219 | setTimeout(function(){
220 | wx.hideToast();
221 | wx.navigateTo({
222 | url: '../booking-detail/booking-detail?type='+type+'&userId='+mixed
223 | });
224 | },2000);
225 | }
226 | });
227 | },
228 | getScanning: function () {
229 | app.getScanning()
230 | },
231 | })
--------------------------------------------------------------------------------
/pages/booking/booking.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/booking/booking.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 | 类型:
15 |
16 | 会议室
17 |
18 |
19 |
20 | 座位
21 |
22 | 楼层:
23 |
24 | {{floor[num]}}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | {{item.title}}:
33 | (只能单选当天座位)
34 |
35 |
36 |
37 | {{child.title}}
38 |
39 |
40 |
41 |
42 |
43 |
44 | 会议室:
45 | (只能单选单天会议室)
46 |
47 |
48 |
49 | {{item.title}}
50 |
51 |
52 |
53 |
54 | 楼层平面图:
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/pages/booking/booking.wxss:
--------------------------------------------------------------------------------
1 | /* pages/booking/booking.wxss */
2 | page{
3 | background-color:#fff;
4 | }
5 | .header{
6 | background-color: #b02923;
7 | position: fixed;
8 | top: 0;
9 | left: 0;
10 | width: 100%;
11 | height: 88rpx;
12 | line-height: 88rpx;
13 | z-index:100;
14 | }
15 | .header > view{
16 | display: inline-block;
17 | padding: 0 14rpx;
18 | }
19 | .header-date,.header-time{
20 | background-color: #fff;
21 | border-radius: 4px;
22 | font-size: 28rpx;
23 | color: #b02923;
24 | height: 52rpx;
25 | line-height: 52rpx;
26 | }
27 | .header-time{
28 | margin-left: 30rpx;
29 | }
30 | .header-date{
31 | margin-left: 20rpx;
32 | }
33 | .header-qrcode{
34 | position: absolute;
35 | top: 50%;
36 | right: 20rpx;
37 | margin-top: -48rpx;
38 | float: right;
39 | font-size: 50rpx;
40 | color:#fff;
41 | }
42 | .feather{
43 | padding: 20rpx;
44 | margin-top: 88rpx;
45 | line-height: 80rpx;
46 | font-size: 28rpx;
47 | background-color: #fff;
48 | border-bottom: 1px solid #eee;
49 | }
50 | .feather > view{
51 | display: inline-block;
52 | padding: 0 20rpx;
53 | margin-right: 24rpx;
54 | border-radius: 4px;
55 | }
56 | .feather image{
57 | width: 36rpx;
58 | height: 36rpx;
59 | }
60 | .feather-seats .feather-room,.feather-chosen .feather-seats,.barred{
61 | background-color: #c6c6c6;
62 | color: #999;
63 | }
64 | .feather-seats .feather-seats,.feather-chosen .feather-room,.chosen,.feather-floor.chosen{
65 | background-color: #b02923;
66 | color: #fff;
67 | position: relative;
68 | }
69 | .chosen:after,.feather-seats .feather-seats:after,.feather-chosen .feather-room:after{
70 | content: '';
71 | background-image: url('../../images/icon/ico_gouxuan.png');
72 | background-size: 100%;
73 | width: 26rpx;
74 | height: 26rpx;
75 | position: absolute;
76 | bottom: 0;
77 | right: 0;
78 | }
79 | .feather-room .iconfont{
80 | width:40rpx;
81 | height: 40rpx;
82 | margin-right: 4rpx;
83 | font-size: 36rpx;
84 | }
85 | .feather-floor.choice{
86 | border: 1px solid #d1d1d1;
87 | color: #b02923;
88 | -webkit-box-sizing: border-box;
89 | -moz-box-sizing: border-box;
90 | box-sizing: border-box;
91 | }
92 | /* .feather-floor.chosen{
93 | background-color: #b02923;
94 | color:#fff;
95 | } */
96 | .region {
97 | background-color: #fff;
98 | }
99 | .region-conston{
100 | overflow: hidden;
101 | border-bottom: 1px solid #eee;
102 | }
103 | .region-conston > view{
104 | float: left;
105 | text-align: center;
106 | border-radius: 4px;
107 | background-color:#fff;
108 | color:#000;
109 | border: 1px solid #e1e1e1;
110 | font-size:30rpx;
111 | margin-bottom: 20rpx;
112 | margin-left: 20rpx;
113 | -webkit-box-sizing: border-box;
114 | -moz-box-sizing: border-box;
115 | box-sizing: border-box;
116 | }
117 | .region-title{
118 | font-size: 28rpx;
119 | padding: 20rpx;
120 | line-height:40rpx;
121 | }
122 | .region-title text{
123 | font-size: 26rpx;
124 | color: #999;
125 | }
126 | .region-conston .chosen{
127 | background-color:#b02923;
128 | color:#fff;
129 | border:none;
130 | }
131 | .region-conston .barred{
132 | background-color:#c6c6c6;
133 | color:#999;
134 | border:none;
135 | }
136 | .drawings{
137 | margin: 20rpx;
138 | -webkit-box-sizing: border-box;
139 | -moz-box-sizing: border-box;
140 | box-sizing: border-box;
141 | }
142 | .drawings image{
143 | width:100%;
144 | height: 658rpx;
145 | }
146 | .button-Submit{
147 | margin: 70rpx auto;
148 | }
149 | /* 会议室 */
150 | .region-room .region-conston> view{
151 | width: 25%;
152 | height: 100rpx;
153 | line-height: 100rpx;
154 | }
155 | .region-seat .region-conston> view{
156 | width: 16.666666667%;
157 | height: 70rpx;
158 | line-height: 70rpx;
159 | }
160 | picker{
161 | display: inline-block;
162 | }
163 | .picker{
164 | position: relative;
165 | display: inline-block;
166 | padding-right:36rpx;
167 | font-size:30rpx;
168 | }
169 | .picker:before {
170 | content:'';
171 | height: 8px;
172 | width: 8px;
173 | display: block;
174 | border: 1px solid #b02923;
175 | border-left-width: 0;
176 | border-bottom-width: 0;
177 | position: absolute;
178 | top: 6px;
179 | right: 8rpx;
180 | -webkit-transform: rotate(135deg);
181 | -moz-transform: rotate(135deg);
182 | transform: rotate(135deg);
183 | }
184 | .feather-floor .picker::before{
185 | top:24rpx;
186 | }
--------------------------------------------------------------------------------
/pages/conference/conference.js:
--------------------------------------------------------------------------------
1 | // pages/booking/booking.js
2 | Page({
3 | data:{
4 | times: ['08:00--12:00','14:00--18:00'],
5 | floor:['1F', '2F', '3F'],
6 | index: 0,
7 | first: 0,
8 | picker:true
9 | },
10 | onLoad:function(options){
11 | // 页面初始化 options为页面跳转所带来的参数
12 | if(options.id == undefined){
13 | this.setData({
14 | picker: false
15 | })
16 | }
17 | },
18 | onReady:function(){
19 | // 页面渲染完成
20 | },
21 | onShow:function(){
22 | // 页面显示
23 | // 读取用户信息
24 | var userInfo = wx.getStorageSync('userInfo');
25 | if(userInfo.length !== 0){
26 | this.setData({
27 | userName: userInfo.userName,
28 | userPhone: userInfo.userPhone,
29 | login: true,
30 | btnSubmit: '确认预定'
31 | })
32 | }else{
33 | this.setData({
34 | userName: '',
35 | userPhone: '',
36 | login: false,
37 | btnSubmit: '登录'
38 | })
39 | }
40 | },
41 | onHide:function(){
42 | // 页面隐藏
43 | },
44 | onUnload:function(){
45 | // 页面关闭
46 | },
47 | bindPickerTime: function(e) {
48 | this.setData({
49 | index: e.detail.value
50 | })
51 | },
52 | bindPickerOrder: function(e) {
53 | this.setData({
54 | first: e.detail.value
55 | })
56 | },
57 | btnSubmit:function(){
58 | if(this.data.login){
59 | console.log('预定成功')
60 | }else{
61 | wx.navigateTo({
62 | url: '../login/login'
63 | })
64 | }
65 | }
66 | })
--------------------------------------------------------------------------------
/pages/conference/conference.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "预定详细"
3 | }
4 |
--------------------------------------------------------------------------------
/pages/conference/conference.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 姓名
6 | {{userName}}
7 |
8 |
9 | 手机号
10 | {{userPhone}}
11 |
12 |
13 | 时间筛选
14 |
15 |
16 | {{times[index]}}
17 |
18 |
19 |
20 |
21 | 预约楼层
22 |
23 |
24 | {{floor[first]}}
25 |
26 |
27 |
28 |
29 | 座位平面图{{}}
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/pages/conference/conference.wxss:
--------------------------------------------------------------------------------
1 | /* pages/booking/booking.wxss */
2 | page{
3 | background-color: #fff;
4 | }
5 | .userDate{
6 | padding:24rpx;
7 | background-color:#fff;
8 | }
9 | .userDate > view{
10 | line-height:70rpx;
11 | font-size:14px;
12 | border-bottom: 1px solid #dcdcdc;
13 | }
14 | .userDate > view text,picker{
15 | float: right;
16 | }
17 | .iconfont:before{
18 | color:#b02923;
19 | font-size:18px;
20 | padding-right: 10rpx;
21 | text-align: center;
22 | vertical-align: top;
23 | font-weight:bold;
24 | display: inline-block;
25 | }
26 | .picker{
27 | position: relative;
28 | padding-right:45rpx;
29 | }
30 | .picker:before{
31 | content:'';
32 | height:8px;
33 | width:8px;
34 | display:block;
35 | border:1px solid #555;
36 | border-left-width:0;
37 | border-bottom-width:0;
38 | position:absolute;
39 | top:10px;
40 | right:6px;
41 | -webkit-transform:rotate(135deg);
42 | -moz-transform:rotate(135deg);
43 | transform:rotate(135deg);
44 | }
45 | button{
46 | background-color:#b02923;
47 | color:#fff;
48 | margin-top:200rpx;
49 | width:80%;
50 | }
51 | .comboRoom{
52 | padding-right:0;
53 | }
54 | .comboRoom:before{
55 | content:'';
56 | border:none;
57 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | var app = getApp()
4 | Page({
5 | data: {
6 | banners:["../../images/index-focus-1.png","../../images/index-focus-2.png"],
7 | notice:[
8 | {
9 | "image": "../../images/notice-1.png",
10 | "title": "2016第三季度报告",
11 | "desc": "1.1本公司董事会、监事会及董事、监事、高级管理人员保证本报告所载资料不存在任何虚假记载、误导性陈述或者重大遗漏..."
12 | },{
13 | "image": "../../images/notice-2.png",
14 | "title": "万科首次上榜《财富》世界500强 名列第356位",
15 | "desc": "2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收..."
16 | },{
17 | "image": "../../images/notice-3.png",
18 | "title": "2016中国房企百亿军团出炉!恒大(03333)击败万科(02202)登顶榜首",
19 | "desc": "中国指数研究院发布2016年中国房地产销售额百亿企业榜单,全国共有131家房地产企业跻身百亿军团,其中恒大、万科..."
20 | }
21 | ]
22 | },
23 | onLoad: function () {
24 |
25 |
26 | var that = this
27 | /*app.getRequest('https://hseschool.app360.cn/mingpian/wanke/home.json',function(res){
28 | that.setData({
29 | banners: res.data.banners,
30 | notice: res.data.notice
31 | })
32 | })*/
33 | },
34 | getScanning: function () {
35 | app.getScanning()
36 | }
37 | })
38 |
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
30 |
31 |
32 |
33 |
34 |
35 | {{item.title}}
36 | {{item.desc}}
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .swiper-banner{
3 | height: 400rpx;
4 | }
5 | .menuWrap{
6 | padding: 20rpx;
7 | display: -webkit-box;
8 | display: -webkit-flex;
9 | display: flex;
10 | }
11 | .menuWrap-item{
12 | text-align: center;
13 | -webkit-box-flex: 1;
14 | -webkit-flex: 1;
15 | flex:1;
16 | }
17 | .menuWrap-item-navi{
18 | display: inline-block;
19 | width: 150rpx;
20 | padding: 10rpx 0;
21 | color: #b02923;
22 | }
23 | .menuWrap-item-navi span{
24 | font-size: 30px;
25 | }
26 | .menuWrap-item-navi text{
27 | display: block;
28 | margin-top: 8px;
29 | }
30 | .icon-qrcode{
31 | font-weight:bold;
32 | }
--------------------------------------------------------------------------------
/pages/login/login.js:
--------------------------------------------------------------------------------
1 | // pages/login/login.js
2 | const app = getApp();
3 | Page({
4 | data:{
5 | userName: false,
6 | userPassword: false
7 | },
8 | onLoad:function(options){
9 | // 页面初始化 options为页面跳转所带来的参数
10 | },
11 | onReady:function(){
12 | // 页面渲染完成
13 | },
14 | onShow:function(){
15 | // 页面显示
16 | },
17 | onHide:function(){
18 | // 页面隐藏
19 | },
20 | onUnload:function(){
21 | // 页面关闭
22 | },
23 | confirm: function () {
24 | this.setData({
25 | 'dialog.hidden': true,
26 | 'dialog.title': '',
27 | 'dialog.content': ''
28 | })
29 | },
30 | login:function(params){
31 | wx.showToast({
32 | title: '登录中',
33 | icon: 'loading'
34 | })
35 | app.setStorageUser(params, function (res){
36 | if(res.errMsg == 'setStorage:ok'){
37 | setTimeout(function(){
38 | wx.hideToast();
39 | // 登录
40 | wx.switchTab({
41 | url:'../index/index'
42 | });
43 | },2000);
44 | }
45 | });
46 | },
47 | formSubmit: function(e) {
48 | let that = this;
49 | let userName = e.detail.value.userName;
50 | let userPassword = e.detail.value.userPassword;
51 | if(userName == '' ){
52 | this.setData({
53 | userName: true,
54 | })
55 | return false;
56 | }else{
57 | this.setData({
58 | userName: false,
59 | })
60 | }
61 | if(userPassword == ''){
62 | this.setData({
63 | userPassword: true,
64 | })
65 | return false;
66 | }else{
67 | this.setData({
68 | userPassword: false,
69 | })
70 | }
71 |
72 | if(userName !== 'vanke' && userPassword !== '123456'){
73 | wx.showModal({
74 | title: '登录失败',
75 | content: '账号或密码不正确',
76 | confirmColor: '#b02923',
77 | showCancel: false
78 | })
79 | return false;
80 | }
81 | let params = {
82 | key:'userInfo',
83 | data:{
84 | userName: userName,
85 | userPhone: 13011111111
86 | }
87 | }
88 | console.log(params)
89 |
90 | that.login(params);
91 | }
92 | })
--------------------------------------------------------------------------------
/pages/login/login.json:
--------------------------------------------------------------------------------
1 | {
2 | "window":{
3 | "backgroundTextStyle":"light",
4 | "navigationBarBackgroundColor": "#b02923",
5 | "navigationBarTitleText": "登录",
6 | "navigationBarTextStyle":"white",
7 | "backgroundColor": "#eeeeee"
8 | }
9 |
10 | }
--------------------------------------------------------------------------------
/pages/login/login.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
--------------------------------------------------------------------------------
/pages/login/login.wxss:
--------------------------------------------------------------------------------
1 | /* pages/login/login.wxss */
2 | page{
3 | background-color:#fff;
4 | font-size:40rpx;
5 | }
6 | .login image{
7 | width:80%;
8 | height:100rpx;
9 | margin:20% auto;
10 | display:block;
11 | }
12 | input{
13 | border:1px solid #ddd;
14 | line-height:80rpx;
15 | height:80rpx;
16 | width:80%;
17 | margin:5% auto;
18 | padding-left:20rpx;
19 | -webkit-box-sizing: border-box;
20 | box-sizing: border-box;
21 | }
22 | .button-hover {
23 | background-color: #b02923;
24 | }
25 | /** 添加自定义button点击态样式类**/
26 | .other-button-hover {
27 | background-color: #b02923;
28 | color:#fff;
29 | }
30 | button{
31 | background-color: #b02923;
32 | color:#fff;
33 | top:200rpx;
34 | width:80%;
35 |
36 | }
37 | .userError{
38 | border-color:#b02923;
39 | }
--------------------------------------------------------------------------------
/pages/notice/notice.js:
--------------------------------------------------------------------------------
1 | // pages/notice/notice.js
2 | var app = getApp();
3 | Page({
4 | data:{
5 | notice:[{
6 | image: '../../images/notice-1.png',
7 | title: '2016第三季度报告',
8 | desc: '1.1本公司董事会、监事会及董事、监事、高级管理人员保证本报告所载资料不存在任何虚假记载、误导性陈述或者重大遗漏...'
9 | },{
10 | image: '../../images/notice-2.png',
11 | title: '万科首次上榜《财富》世界500强 名列第356位',
12 | desc: '2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收...'
13 | },{
14 | image: '../../images/notice-3.png',
15 | title: '2016中国房企百亿军团出炉!恒大(03333)击败万科(02202)登顶榜首',
16 | desc: '中国指数研究院发布2016年中国房地产销售额百亿企业榜单,全国共有131家房地产企业跻身百亿军团,其中恒大、万科...'
17 | },{
18 | image: '../../images/notice-2.png',
19 | title: '万科首次上榜《财富》世界500强 名列第356位',
20 | desc: '2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收...'
21 | },{
22 | image: '../../images/notice-2.png',
23 | title: '万科首次上榜《财富》世界500强 名列第356位',
24 | desc: '2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收...'
25 | },{
26 | image: '../../images/notice-2.png',
27 | title: '万科首次上榜《财富》世界500强 名列第356位',
28 | desc: '2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收...'
29 | },{
30 | image: '../../images/notice-2.png',
31 | title: '万科首次上榜《财富》世界500强 名列第356位',
32 | desc: '2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收...'
33 | },{
34 | image: '../../images/notice-2.png',
35 | title: '万科首次上榜《财富》世界500强 名列第356位',
36 | desc: '2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收...'
37 | },{
38 | image: '../../images/notice-2.png',
39 | title: '万科首次上榜《财富》世界500强 名列第356位',
40 | desc: '2016年7月20日,《财富》“世界500强”企业排行榜出炉,万科企业股份有限公司凭借2015年年度1843.18亿元的营收...'
41 | }],
42 | page: 1,
43 | size: 10,
44 | hasMore:true
45 | },
46 | loadMore:function(e) {
47 | // console.log(e)
48 | // if(!this.data.hasMore) return
49 | // this.setData({
50 |
51 | // })
52 | },
53 | scroll:function(e){
54 | // console.log(e);
55 | },
56 | onLoad:function(options){
57 | // 页面初始化 options为页面跳转所带来的参数
58 | },
59 | onReady:function(){
60 | // 页面渲染完成
61 | },
62 | onShow:function(){
63 | // 页面显示
64 | },
65 | onHide:function(){
66 | // 页面隐藏
67 | },
68 | onUnload:function(){
69 | // 页面关闭
70 | },
71 | getScanning: function () {
72 | app.getScanning()
73 | }
74 | })
75 |
--------------------------------------------------------------------------------
/pages/notice/notice.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{item.title}}
9 | {{item.desc}}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
22 |
23 |
--------------------------------------------------------------------------------
/pages/orders/orders.js:
--------------------------------------------------------------------------------
1 | // pages/orders/orders.js
2 | const app = getApp();
3 | Page({
4 | data:{
5 | Left:'5%',
6 | hidden: false,
7 | prompt: true,
8 | ordersCut: true,
9 | region: 'seat',
10 | orderlist: '',
11 | ordersTitle: '暂无预定座位'
12 | },
13 | onLoad:function(options){
14 | // 页面初始化 options为页面跳转所带来的参数
15 | this.dateResults(options);
16 | },
17 | onShow: function(){
18 | this.tabLeft();
19 | },
20 | onHide:function(){
21 | // 页面隐藏
22 | },
23 | tabLeft:function(){
24 | // 点击座位
25 | this.setData({
26 | region: 'seat',
27 | ordersRoom:true,
28 | ordersSeat:false,
29 | ordersCut: true,
30 | colRight:'',
31 | borRight:'',
32 | Left:'5%',
33 | ordersTitle: '暂无预定座位'
34 | });
35 | this.dateResults();
36 | },
37 | tabRight:function(){
38 | // 点击会议室
39 | this.setData({
40 | region: 'room',
41 | ordersRoom:false,
42 | ordersSeat:true,
43 | ordersCut: false,
44 | colLeft:'',
45 | borLeft:'',
46 | Left:'55%',
47 | ordersTitle: '暂无预定会议室'
48 | });
49 | this.dateResults();
50 | },
51 | dateResults:function(options){
52 | if(wx.getStorageSync('userInfo') == ''){
53 | this.setData({
54 | orderlist: '',
55 | prompt: true
56 | });
57 | return false
58 | } ;
59 | var type;
60 | options == undefined || options.type == undefined ? type = this.data.region : type = options.type;
61 | const obtain = wx.getStorageSync(type);
62 | if(obtain == ''){
63 | this.setData({
64 | prompt: true,
65 | orderlist: ''
66 | });
67 | }else{
68 | this.setData({
69 | orderlist: obtain
70 | });
71 | }
72 | },
73 | ordersCancel:function(res){
74 | // 取消订单
75 | var _that = this;
76 | var userId = res.currentTarget.dataset.userid;
77 | var type = res.currentTarget.dataset.region;
78 | wx.showModal({
79 | title: '提示',
80 | content: '确定取消预定订单?',
81 | confirmColor: '#b02923',
82 | success: function(res) {
83 | if (res.confirm) {
84 | var removeID = wx.getStorageSync(type);
85 | delete removeID[userId];
86 | app.setStorageUser({key: _that.data.region,data: removeID}, function (res){
87 | if(res.errMsg == 'setStorage:ok'){
88 | wx.showToast({
89 | title: '取消订单',
90 | icon: 'loading',
91 | duration: 10000
92 | });
93 | setTimeout(function(){
94 | wx.hideToast();
95 | wx.navigateTo({
96 | url: '../orders/orders'
97 | });
98 | _that.dateResults();
99 | },1000);
100 | }
101 | });
102 | }
103 | }
104 | })
105 |
106 |
107 | }
108 | })
--------------------------------------------------------------------------------
/pages/orders/orders.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/orders/orders.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 座位
4 | 会议室
5 |
6 |
7 |
8 |
9 |
10 |
11 |
22 |
23 |
24 |
25 |
26 |
27 | 预定时间: {{item.date}} {{item.daytime}}
28 | 楼层: {{item.floorNum}}
29 | 会议室门号: {{item.roomNum}}
30 |
31 |
32 | 归还
33 | 取消
34 |
35 |
36 |
37 |
38 | {{ordersTitle}}
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/pages/orders/orders.wxss:
--------------------------------------------------------------------------------
1 | /* pages/orders/orders.wxss */
2 | .ordersTab{
3 | position: fixed;
4 | top:0;
5 | font-size: 34rpx;
6 | width: 100%;
7 | height: 80rpx;
8 | background-color: #fff;
9 | line-height: 80rpx;
10 | z-index:10;
11 | margin-bottom: 90rpx;
12 | }
13 | .ordersTab wx-text{
14 | text-align:center;
15 | width:50%;
16 | display:block;
17 | float:left;
18 |
19 | }
20 | .ordersRoom{
21 | margin-bottom: 30rpx;
22 | background-color: #fff;
23 | padding:36rpx;
24 | height:200rpx;
25 | border-top:1px solid #ddd;
26 | border-bottom:1px solid #ddd;
27 | }
28 | .roomLeft{
29 | float:left;
30 | }
31 | .roomLeft wx-text{
32 | display:block;
33 | line-height:46rpx;
34 | }
35 | .roomBut{
36 | float:right;
37 | }
38 | .ordersSeat{
39 | background-color: #fff;
40 | padding:36rpx;
41 | height:200rpx;
42 | margin-bottom:30rpx;
43 | border-top:1px solid #ddd;
44 | border-bottom:1px solid #ddd;
45 |
46 | }
47 | .seatLeft{
48 | float:left;
49 | }
50 | .seatLeft wx-text{
51 | display:block;
52 | line-height:46rpx;
53 | }
54 | .seatBut{
55 | float:right;
56 | }
57 | .roomBut wx-text {
58 | display:block;
59 | box-sizing:border-box;
60 | font-size:13px;
61 | text-align:center;
62 | text-decoration:none;
63 | line-height:60rpx;
64 | border-radius:5px;
65 | -webkit-tap-highlight-color:transparent;
66 | overflow:hidden;
67 | color:#fff;
68 | background-color:#b02923;
69 | width:140rpx;
70 | height:60rpx;
71 | border:1px solid #b02923;
72 | margin-bottom:14rpx;
73 | }
74 | .seatBut wx-text {
75 | display:block;
76 | box-sizing:border-box;
77 | font-size:13px;
78 | text-align:center;
79 | text-decoration:none;
80 | line-height:60rpx;
81 | border-radius:5px;
82 | -webkit-tap-highlight-color:transparent;
83 | overflow:hidden;
84 | color:#fff;
85 | background-color:#b02923;
86 | width:140rpx;
87 | height:60rpx;
88 | border:1px solid #b02923;
89 | margin-bottom:14rpx;
90 | }
91 | .tabCalled{
92 | width:40%;
93 | height:2px;
94 | background-color:#b02923;
95 | position: absolute;
96 | bottom:0;
97 | -webkit-transition:left .35s; /* Safari */
98 | transition:left .35s;
99 | }
100 | .ordersTitle{
101 | text-align: center;
102 | margin-top: 200rpx;
103 | font-size:16px;
104 | color:#666;
105 | }
106 | .ordersLeft text:nth-child(1),.ordersRight text:nth-child(2){
107 | color:#b02923;
108 | }
--------------------------------------------------------------------------------
/pages/personal/personal.js:
--------------------------------------------------------------------------------
1 | // pages/personal/personal.js
2 | const app = getApp();
3 | Page({
4 | data:{
5 | },
6 | onLoad:function(options){
7 | // 页面初始化 options为页面跳转所带来的参数
8 | },
9 | onReady:function(){
10 | // 页面渲染完成
11 | },
12 | onShow:function(){
13 | // 页面显示.
14 | var userInfo = wx.getStorageSync('userInfo');
15 | if(userInfo.length !== 0){
16 | this.setData({
17 | operation: '退出',
18 | login: true,
19 | userName:userInfo.userName,
20 | userPhone:userInfo.userPhone,
21 | userHead: '../../images/userhead.jpg'
22 | })
23 | }else{
24 | this.setData({
25 | userName: '',
26 | userPhone: '',
27 | userHead: '../../images/unuserhead.jpg',
28 | operation:'登录',
29 | login: false
30 | })
31 | }
32 | },
33 | onHide:function(){
34 | // 页面隐藏
35 | },
36 | onUnload:function(){
37 | // 页面关闭
38 | },
39 | defaultLogin:function(e){
40 | let login = e.currentTarget.dataset.login;
41 | if(login == true){
42 | // 点击退出
43 | wx.showToast({
44 | title: '退出中',
45 | icon: 'loading'
46 | })
47 | setTimeout(function(){
48 | wx.hideToast();
49 | wx.removeStorageSync('userInfo');
50 | wx.switchTab({
51 | url: '../index/index'
52 | })
53 | },2000);
54 | }else{
55 | // 点击登录
56 | wx.navigateTo({
57 | url: '../login/login'
58 | })
59 | }
60 | },
61 | listFirst:function(){
62 | // 我的预订
63 | if(this.data.login){
64 | wx.switchTab({
65 | url: '../orders/orders'
66 | })
67 | }else{
68 | wx.showToast({
69 | title: '请登录',
70 | icon: 'loading',
71 | duration: 800
72 | })
73 | }
74 | },
75 | getScanning: function () {
76 | app.getScanning()
77 | }
78 | })
--------------------------------------------------------------------------------
/pages/personal/personal.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/personal/personal.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 姓名: {{userName}}
7 | 电话: {{userPhone}}
8 |
9 |
10 |
11 |
12 | 我的预定
13 | 关于万科
14 | 版本号
15 | 密码修改
16 | 意见反馈
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/pages/personal/personal.wxss:
--------------------------------------------------------------------------------
1 | /* pages/personal/personal.wxss */
2 | /** 修改button默认的点击态样式类**/
3 | page{
4 | /*background-color:#fff;*/
5 | font-size:30rpx;
6 | }
7 |
8 | .personalWrap{
9 | /*margin:10rpx;*/
10 | }
11 | .personalMe{
12 | height:210rpx;
13 | margin:30rpx 0rpx 30rpx 0rpx;
14 | background-color: #fff;
15 | }
16 | .personalInfo{
17 | float:left;
18 | margin: 20rpx 0rpx 0rpx 20rpx;
19 | }
20 | .personalInfo wx-text{
21 | display: block;
22 | line-height:70rpx;
23 | height:70rpx;
24 | }
25 | .personalList{
26 | background-color: #fff;
27 | padding:0rpx 20rpx;
28 | }
29 | .personalList view{
30 | display: block;
31 | line-height:70rpx;
32 | height:70rpx;
33 | border-bottom:1px solid #ddd;
34 | }
35 | .personalList wx-span{
36 | float:right;
37 | font-size:40rpx;
38 | margin-top:-63rpx;
39 | color:#ddd;
40 | }
41 | .personalList view{
42 | position:relative;
43 | }
44 | .iconfont{
45 | font-size:14px;
46 | }
47 | .personalList view:before{
48 | color:#b02923;
49 | font-size:20px !important;
50 | font-weight:bold;
51 | padding-right: 10rpx;
52 | text-align:center;
53 | vertical-align:top;
54 | }
55 | .personalList view:after{
56 | content:'';
57 | height:10px;
58 | width:10px;
59 | display:block;
60 | border:1px solid #ccc;
61 | border-left-width:0;
62 | border-bottom-width:0;
63 | position:absolute;
64 | top:10px;
65 | right:6px;
66 | -webkit-transform:rotate(45deg);
67 | -moz-transform:rotate(45deg);
68 | transform:rotate(45deg);
69 | }
--------------------------------------------------------------------------------
/pages/scanning/scanning.js:
--------------------------------------------------------------------------------
1 | // pages/scanning/scanning.js
2 | Page({
3 | data:{},
4 | onLoad:function(options){
5 | // 页面初始化 options为页面跳转所带来的参数
6 | },
7 | onReady:function(){
8 | // 页面渲染完成
9 | },
10 | onShow:function(){
11 | // 页面显示
12 | },
13 | onHide:function(){
14 | // 页面隐藏
15 | },
16 | onUnload:function(){
17 | // 页面关闭
18 | }
19 | })
--------------------------------------------------------------------------------
/pages/scanning/scanning.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/scanning/scanning.wxml:
--------------------------------------------------------------------------------
1 |
2 | pages/scanning/scanning.wxml
3 |
--------------------------------------------------------------------------------
/pages/scanning/scanning.wxss:
--------------------------------------------------------------------------------
1 | /* pages/scanning/scanning.wxss */
--------------------------------------------------------------------------------
/pages/sitting/sitting.js:
--------------------------------------------------------------------------------
1 | // pages/booking/booking.js
2 | Page({
3 | data:{
4 | times: ['08:00--12:00','14:00--18:00'],
5 | floor:['1F', '2F', '3F'],
6 | index: 0,
7 | first: 0,
8 | picker:true
9 | },
10 | onLoad:function(options){
11 | // 页面初始化 options为页面跳转所带来的参数
12 | if(options.id == undefined){
13 | this.setData({
14 | picker: false
15 | })
16 | }
17 | },
18 | onReady:function(){
19 | // 页面渲染完成
20 | },
21 | onShow:function(){
22 | // 页面显示
23 | // 读取用户信息
24 | var userInfo = wx.getStorageSync('userInfo');
25 | if(userInfo.length !== 0){
26 | this.setData({
27 | userName: userInfo.userName,
28 | userPhone: userInfo.userPhone,
29 | login: true,
30 | btnSubmit: '确认预定'
31 | })
32 | }else{
33 | this.setData({
34 | userName: '',
35 | userPhone: '',
36 | login: false,
37 | btnSubmit: '登录'
38 | })
39 | }
40 | },
41 | onHide:function(){
42 | // 页面隐藏
43 | },
44 | onUnload:function(){
45 | // 页面关闭
46 | },
47 | bindPickerTime: function(e) {
48 | this.setData({
49 | index: e.detail.value
50 | })
51 | },
52 | bindPickerOrder: function(e) {
53 | this.setData({
54 | first: e.detail.value
55 | })
56 | },
57 | btnSubmit:function(){
58 | if(this.data.login){
59 | console.log('预定成功')
60 | }else{
61 | wx.navigateTo({
62 | url: '../login/login'
63 | })
64 | }
65 | }
66 | })
--------------------------------------------------------------------------------
/pages/sitting/sitting.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "预定详细"
3 | }
4 |
--------------------------------------------------------------------------------
/pages/sitting/sitting.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 姓名
6 | {{userName}}
7 |
8 |
9 | 手机号
10 | {{userPhone}}
11 |
12 |
13 | 时间筛选
14 |
15 |
16 | {{times[index]}}
17 |
18 |
19 |
20 |
21 | 预约楼层
22 |
23 |
24 | {{floor[first]}}
25 |
26 |
27 |
28 |
29 | 座位平面图{{}}
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/pages/sitting/sitting.wxss:
--------------------------------------------------------------------------------
1 | /* pages/booking/booking.wxss */
2 | page{
3 | background-color: #fff;
4 | }
5 | .userDate{
6 | padding:24rpx;
7 | background-color:#fff;
8 | }
9 | .userDate > view{
10 | line-height:70rpx;
11 | font-size:14px;
12 | border-bottom: 1px solid #dcdcdc;
13 | }
14 | .userDate > view text,picker{
15 | float: right;
16 | }
17 | .iconfont:before{
18 | color:#b02923;
19 | font-size:18px;
20 | padding-right: 10rpx;
21 | text-align: center;
22 | vertical-align: top;
23 | font-weight:bold;
24 | display: inline-block;
25 | }
26 | .picker{
27 | position: relative;
28 | padding-right:45rpx;
29 | }
30 | .picker:before{
31 | content:'';
32 | height:8px;
33 | width:8px;
34 | display:block;
35 | border:1px solid #555;
36 | border-left-width:0;
37 | border-bottom-width:0;
38 | position:absolute;
39 | top:10px;
40 | right:6px;
41 | -webkit-transform:rotate(135deg);
42 | -moz-transform:rotate(135deg);
43 | transform:rotate(135deg);
44 | }
45 | button{
46 | background-color:#b02923;
47 | color:#fff;
48 | margin-top:200rpx;
49 | width:80%;
50 | }
51 | .comboRoom{
52 | padding-right:0;
53 | }
54 | .comboRoom:before{
55 | content:'';
56 | border:none;
57 | }
--------------------------------------------------------------------------------
/template/template.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | function formatTime(date) {
2 | var year = date.getFullYear()
3 | var month = date.getMonth() + 1
4 | var day = date.getDate()
5 |
6 | var hour = date.getHours()
7 | var minute = date.getMinutes()
8 | var second = date.getSeconds()
9 |
10 | return [year, month, day].map(formatNumber).join('-')
11 | // + ' ' + [hour, minute, second].map(formatNumber).join(':')
12 | }
13 | function formatNumber(n) {
14 | n = n.toString()
15 | return n[1] ? n : '0' + n
16 | }
17 |
18 | module.exports = {
19 | formatTime: formatTime
20 | }
--------------------------------------------------------------------------------
/wxParse/html2json.js:
--------------------------------------------------------------------------------
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 |
57 | function html2json(html, bindName) {
58 | //处理字符串
59 | html = removeDOCTYPE(html);
60 | html = wxDiscode.strDiscode(html);
61 | //生成node节点
62 | var bufArray = [];
63 | var results = {
64 | node: bindName,
65 | nodes: [],
66 | images:[],
67 | imageUrls:[]
68 | };
69 | HTMLParser(html, {
70 | start: function (tag, attrs, unary) {
71 | //debug(tag, attrs, unary);
72 | // node for this element
73 | var node = {
74 | node: 'element',
75 | tag: tag,
76 | };
77 |
78 | if (block[tag]) {
79 | node.tagType = "block";
80 | } else if (inline[tag]) {
81 | node.tagType = "inline";
82 | } else if (closeSelf[tag]) {
83 | node.tagType = "closeSelf";
84 | }
85 |
86 | if (attrs.length !== 0) {
87 | node.attr = attrs.reduce(function (pre, attr) {
88 | var name = attr.name;
89 | var value = attr.value;
90 | if (name == 'class') {
91 | console.dir(value);
92 | // value = value.join("")
93 | node.classStr = value;
94 | }
95 | // has multi attibutes
96 | // make it array of attribute
97 | if (name == 'style') {
98 | console.dir(value);
99 | // value = value.join("")
100 | node.styleStr = value;
101 | }
102 | if (value.match(/ /)) {
103 | value = value.split(' ');
104 | }
105 |
106 |
107 | // if attr already exists
108 | // merge it
109 | if (pre[name]) {
110 | if (Array.isArray(pre[name])) {
111 | // already array, push to last
112 | pre[name].push(value);
113 | } else {
114 | // single value, make it array
115 | pre[name] = [pre[name], value];
116 | }
117 | } else {
118 | // not exist, put it
119 | pre[name] = value;
120 | }
121 |
122 | return pre;
123 | }, {});
124 | }
125 |
126 | //对img添加额外数据
127 | if (node.tag === 'img') {
128 | node.imgIndex = results.images.length;
129 | var imgUrl = node.attr.src;
130 | imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
131 | node.attr.src = imgUrl;
132 | node.from = bindName;
133 | results.images.push(node);
134 | results.imageUrls.push(imgUrl);
135 | }
136 |
137 | if (unary) {
138 | // if this tag dosen't have end tag
139 | // like
140 | // add to parents
141 | var parent = bufArray[0] || results;
142 | if (parent.nodes === undefined) {
143 | parent.nodes = [];
144 | }
145 | parent.nodes.push(node);
146 | } else {
147 | bufArray.unshift(node);
148 | }
149 | },
150 | end: function (tag) {
151 | //debug(tag);
152 | // merge into parent tag
153 | var node = bufArray.shift();
154 | if (node.tag !== tag) console.error('invalid state: mismatch end tag');
155 |
156 | if (bufArray.length === 0) {
157 | results.nodes.push(node);
158 | } else {
159 | var parent = bufArray[0];
160 | if (parent.nodes === undefined) {
161 | parent.nodes = [];
162 | }
163 | parent.nodes.push(node);
164 | }
165 | },
166 | chars: function (text) {
167 | //debug(text);
168 | var node = {
169 | node: 'text',
170 | text: text,
171 | textArray:transEmojiStr(text)
172 | };
173 |
174 | if (bufArray.length === 0) {
175 | results.nodes.push(node);
176 | } else {
177 | var parent = bufArray[0];
178 | if (parent.nodes === undefined) {
179 | parent.nodes = [];
180 | }
181 | parent.nodes.push(node);
182 | }
183 | },
184 | comment: function (text) {
185 | //debug(text);
186 | // var node = {
187 | // node: 'comment',
188 | // text: text,
189 | // };
190 | // var parent = bufArray[0];
191 | // if (parent.nodes === undefined) {
192 | // parent.nodes = [];
193 | // }
194 | // parent.nodes.push(node);
195 | },
196 | });
197 | return results;
198 | };
199 |
200 | function transEmojiStr(str){
201 | // var eReg = new RegExp("["+__reg+' '+"]");
202 | // str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
203 |
204 | var emojiObjs = [];
205 | //如果正则表达式为空
206 | if(__emojisReg.length == 0 || !__emojis){
207 | var emojiObj = {}
208 | emojiObj.node = "text";
209 | emojiObj.text = str;
210 | array = [emojiObj];
211 | return array;
212 | }
213 | //这个地方需要调整
214 | str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
215 | var eReg = new RegExp("[:]");
216 | var array = str.split(eReg);
217 | for(var i = 0; i < array.length; i++){
218 | var ele = array[i];
219 | var emojiObj = {};
220 | if(__emojis[ele]){
221 | emojiObj.node = "element";
222 | emojiObj.tag = "emoji";
223 | emojiObj.text = __emojis[ele];
224 | emojiObj.baseSrc= __emojisBaseSrc;
225 | }else{
226 | emojiObj.node = "text";
227 | emojiObj.text = ele;
228 | }
229 | emojiObjs.push(emojiObj);
230 | }
231 |
232 | return emojiObjs;
233 | }
234 |
235 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
236 | __emojisReg = reg;
237 | __emojisBaseSrc=baseSrc;
238 | __emojis=emojis;
239 | }
240 |
241 | module.exports = {
242 | html2json: html2json,
243 | emojisInit:emojisInit
244 | };
245 |
246 |
--------------------------------------------------------------------------------
/wxParse/htmlparser.js:
--------------------------------------------------------------------------------
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("");
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(/|/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;
193 |
--------------------------------------------------------------------------------
/wxParse/wxDiscode.js:
--------------------------------------------------------------------------------
1 | // HTML 支持的数学符号
2 | function strNumDiscode(str){
3 | str = str.replace(/∀/g, '∀');
4 | str = str.replace(/∂/g, '∂');
5 | str = str.replace(/&exists;/g, '∃');
6 | str = str.replace(/∅/g, '∅');
7 | str = str.replace(/∇/g, '∇');
8 | str = str.replace(/∈/g, '∈');
9 | str = str.replace(/∉/g, '∉');
10 | str = str.replace(/∋/g, '∋');
11 | str = str.replace(/∏/g, '∏');
12 | str = str.replace(/∑/g, '∑');
13 | str = str.replace(/−/g, '−');
14 | str = str.replace(/∗/g, '∗');
15 | str = str.replace(/√/g, '√');
16 | str = str.replace(/∝/g, '∝');
17 | str = str.replace(/∞/g, '∞');
18 | str = str.replace(/∠/g, '∠');
19 | str = str.replace(/∧/g, '∧');
20 | str = str.replace(/∨/g, '∨');
21 | str = str.replace(/∩/g, '∩');
22 | str = str.replace(/∩/g, '∪');
23 | str = str.replace(/∫/g, '∫');
24 | str = str.replace(/∴/g, '∴');
25 | str = str.replace(/∼/g, '∼');
26 | str = str.replace(/≅/g, '≅');
27 | str = str.replace(/≈/g, '≈');
28 | str = str.replace(/≠/g, '≠');
29 | str = str.replace(/≤/g, '≤');
30 | str = str.replace(/≥/g, '≥');
31 | str = str.replace(/⊂/g, '⊂');
32 | str = str.replace(/⊃/g, '⊃');
33 | str = str.replace(/⊄/g, '⊄');
34 | str = str.replace(/⊆/g, '⊆');
35 | str = str.replace(/⊇/g, '⊇');
36 | str = str.replace(/⊕/g, '⊕');
37 | str = str.replace(/⊗/g, '⊗');
38 | str = str.replace(/⊥/g, '⊥');
39 | str = str.replace(/⋅/g, '⋅');
40 | return str;
41 | }
42 |
43 | //HTML 支持的希腊字母
44 | function strGreeceDiscode(str){
45 | str = str.replace(/Α/g, 'Α');
46 | str = str.replace(/Β/g, 'Β');
47 | str = str.replace(/Γ/g, 'Γ');
48 | str = str.replace(/Δ/g, 'Δ');
49 | str = str.replace(/Ε/g, 'Ε');
50 | str = str.replace(/Ζ/g, 'Ζ');
51 | str = str.replace(/Η/g, 'Η');
52 | str = str.replace(/Θ/g, 'Θ');
53 | str = str.replace(/Ι/g, 'Ι');
54 | str = str.replace(/Κ/g, 'Κ');
55 | str = str.replace(/Λ/g, 'Λ');
56 | str = str.replace(/Μ/g, 'Μ');
57 | str = str.replace(/Ν/g, 'Ν');
58 | str = str.replace(/Ξ/g, 'Ν');
59 | str = str.replace(/Ο/g, 'Ο');
60 | str = str.replace(/Π/g, 'Π');
61 | str = str.replace(/Ρ/g, 'Ρ');
62 | str = str.replace(/Σ/g, 'Σ');
63 | str = str.replace(/Τ/g, 'Τ');
64 | str = str.replace(/Υ/g, 'Υ');
65 | str = str.replace(/Φ/g, 'Φ');
66 | str = str.replace(/Χ/g, 'Χ');
67 | str = str.replace(/Ψ/g, 'Ψ');
68 | str = str.replace(/Ω/g, 'Ω');
69 |
70 | str = str.replace(/α/g, 'α');
71 | str = str.replace(/β/g, 'β');
72 | str = str.replace(/γ/g, 'γ');
73 | str = str.replace(/δ/g, 'δ');
74 | str = str.replace(/ε/g, 'ε');
75 | str = str.replace(/ζ/g, 'ζ');
76 | str = str.replace(/η/g, 'η');
77 | str = str.replace(/θ/g, 'θ');
78 | str = str.replace(/ι/g, 'ι');
79 | str = str.replace(/κ/g, 'κ');
80 | str = str.replace(/λ/g, 'λ');
81 | str = str.replace(/μ/g, 'μ');
82 | str = str.replace(/ν/g, 'ν');
83 | str = str.replace(/ξ/g, 'ξ');
84 | str = str.replace(/ο/g, 'ο');
85 | str = str.replace(/π/g, 'π');
86 | str = str.replace(/ρ/g, 'ρ');
87 | str = str.replace(/ς/g, 'ς');
88 | str = str.replace(/σ/g, 'σ');
89 | str = str.replace(/τ/g, 'τ');
90 | str = str.replace(/υ/g, 'υ');
91 | str = str.replace(/φ/g, 'φ');
92 | str = str.replace(/χ/g, 'χ');
93 | str = str.replace(/ψ/g, 'ψ');
94 | str = str.replace(/ω/g, 'ω');
95 | str = str.replace(/ϑ/g, 'ϑ');
96 | str = str.replace(/ϒ/g, 'ϒ');
97 | str = str.replace(/ϖ/g, 'ϖ');
98 | str = str.replace(/·/g, '·');
99 | return str;
100 | }
101 |
102 | //
103 |
104 | function strcharacterDiscode(str){
105 | // 加入常用解析
106 | str = str.replace(/ /g, ' ');
107 | str = str.replace(/"/g, "'");
108 | str = str.replace(/&/g, '&');
109 | // str = str.replace(/</g, '‹');
110 | // str = str.replace(/>/g, '›');
111 |
112 | str = str.replace(/</g, '<');
113 | str = str.replace(/>/g, '>');
114 |
115 | return str;
116 | }
117 |
118 | // HTML 支持的其他实体
119 | function strOtherDiscode(str){
120 | str = str.replace(/Œ/g, 'Œ');
121 | str = str.replace(/œ/g, 'œ');
122 | str = str.replace(/Š/g, 'Š');
123 | str = str.replace(/š/g, 'š');
124 | str = str.replace(/Ÿ/g, 'Ÿ');
125 | str = str.replace(/ƒ/g, 'ƒ');
126 | str = str.replace(/ˆ/g, 'ˆ');
127 | str = str.replace(/˜/g, '˜');
128 | str = str.replace(/ /g, '');
129 | str = str.replace(/ /g, '');
130 | str = str.replace(/ /g, '');
131 | str = str.replace(//g, '');
132 | str = str.replace(//g, '');
133 | str = str.replace(//g, '');
134 | str = str.replace(//g, '');
135 | str = str.replace(/–/g, '–');
136 | str = str.replace(/—/g, '—');
137 | str = str.replace(/‘/g, '‘');
138 | str = str.replace(/’/g, '’');
139 | str = str.replace(/‚/g, '‚');
140 | str = str.replace(/“/g, '“');
141 | str = str.replace(/”/g, '”');
142 | str = str.replace(/„/g, '„');
143 | str = str.replace(/†/g, '†');
144 | str = str.replace(/‡/g, '‡');
145 | str = str.replace(/•/g, '•');
146 | str = str.replace(/…/g, '…');
147 | str = str.replace(/‰/g, '‰');
148 | str = str.replace(/′/g, '′');
149 | str = str.replace(/″/g, '″');
150 | str = str.replace(/‹/g, '‹');
151 | str = str.replace(/›/g, '›');
152 | str = str.replace(/‾/g, '‾');
153 | str = str.replace(/€/g, '€');
154 | str = str.replace(/™/g, '™');
155 |
156 | str = str.replace(/←/g, '←');
157 | str = str.replace(/↑/g, '↑');
158 | str = str.replace(/→/g, '→');
159 | str = str.replace(/↓/g, '↓');
160 | str = str.replace(/↔/g, '↔');
161 | str = str.replace(/↵/g, '↵');
162 | str = str.replace(/⌈/g, '⌈');
163 | str = str.replace(/⌉/g, '⌉');
164 |
165 | str = str.replace(/⌊/g, '⌊');
166 | str = str.replace(/⌋/g, '⌋');
167 | str = str.replace(/◊/g, '◊');
168 | str = str.replace(/♠/g, '♠');
169 | str = str.replace(/♣/g, '♣');
170 | str = str.replace(/♥/g, '♥');
171 |
172 | str = str.replace(/♦/g, '♦');
173 |
174 | return str;
175 | }
176 |
177 | function strMoreDiscode(str){
178 | str = str.replace(/\r\n/g,"");
179 | str = str.replace(/\n/g,"");
180 |
181 | str = str.replace(/code/g,"wxxxcode-style");
182 | return str;
183 | }
184 |
185 | function strDiscode(str){
186 | str = strNumDiscode(str);
187 | str = strGreeceDiscode(str);
188 | str = strcharacterDiscode(str);
189 | str = strOtherDiscode(str);
190 | str = strMoreDiscode(str);
191 | return str;
192 | }
193 | function urlToHttpUrl(url,rep){
194 |
195 | var patt1 = new RegExp("^//");
196 | var result = patt1.test(url);
197 | if(result){
198 | url = rep+":"+url;
199 | }
200 | return url;
201 | }
202 |
203 | module.exports = {
204 | strDiscode:strDiscode,
205 | urlToHttpUrl:urlToHttpUrl
206 | }
--------------------------------------------------------------------------------
/wxParse/wxParse.js:
--------------------------------------------------------------------------------
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 | /**
21 | * 主函数入口区
22 | **/
23 | function wxParse(bindName = 'wxParseData', type='html', data='数据不能为空
', target,imagePadding) {
24 | var that = target;
25 | var transData = {};//存放转化后的数据
26 | if (type == 'html') {
27 | transData = HtmlToJson.html2json(data, bindName);
28 | console.log(JSON.stringify(transData, ' ', ' '));
29 | } else if (type == 'md' || type == 'markdown') {
30 | var converter = new showdown.Converter();
31 | var html = converter.makeHtml(data);
32 | transData = HtmlToJson.html2json(html, bindName);
33 | console.log(JSON.stringify(transData, ' ', ' '));
34 | }
35 | transData.view = {};
36 | transData.view.imagePadding = 0;
37 | if(typeof(imagePadding) != 'undefined'){
38 | transData.view.imagePadding = imagePadding
39 | }
40 | var bindData = {};
41 | bindData[bindName] = transData;
42 | that.setData(bindData)
43 | that.wxParseImgLoad = wxParseImgLoad;
44 | that.wxParseImgTap = wxParseImgTap;
45 | }
46 | // 图片点击事件
47 | function wxParseImgTap(e) {
48 | var that = this;
49 | var nowImgUrl = e.target.dataset.src;
50 | var tagFrom = e.target.dataset.from;
51 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
52 | wx.previewImage({
53 | current: nowImgUrl, // 当前显示图片的http链接
54 | urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
55 | })
56 | }
57 | }
58 |
59 | /**
60 | * 图片视觉宽高计算函数区
61 | **/
62 | function wxParseImgLoad(e) {
63 | var that = this;
64 | var tagFrom = e.target.dataset.from;
65 | var idx = e.target.dataset.idx;
66 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
67 | calMoreImageInfo(e, idx, that, tagFrom)
68 | }
69 | }
70 | // 假循环获取计算图片视觉最佳宽高
71 | function calMoreImageInfo(e, idx, that, bindName) {
72 | var temData = that.data[bindName];
73 | if (temData.images.length == 0) {
74 | return;
75 | }
76 | var temImages = temData.images;
77 | //因为无法获取view宽度 需要自定义padding进行计算,稍后处理
78 | var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName);
79 | temImages[idx].width = recal.imageWidth;
80 | temImages[idx].height = recal.imageheight;
81 | temData.images = temImages;
82 | var bindData = {};
83 | bindData[bindName] = temData;
84 | that.setData(bindData);
85 | }
86 |
87 | // 计算视觉优先的图片宽高
88 | function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
89 | //获取图片的原始长宽
90 | var windowWidth = 0, windowHeight = 0;
91 | var autoWidth = 0, autoHeight = 0;
92 | var results = {};
93 | wx.getSystemInfo({
94 | success: function (res) {
95 | var padding = that.data[bindName].view.imagePadding;
96 | windowWidth = res.windowWidth-2*padding;
97 | windowHeight = res.windowHeight;
98 | //判断按照那种方式进行缩放
99 | console.log("windowWidth" + windowWidth);
100 | if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
101 | autoWidth = windowWidth;
102 | console.log("autoWidth" + autoWidth);
103 | autoHeight = (autoWidth * originalHeight) / originalWidth;
104 | console.log("autoHeight" + autoHeight);
105 | results.imageWidth = autoWidth;
106 | results.imageheight = autoHeight;
107 | } else {//否则展示原来的数据
108 | results.imageWidth = originalWidth;
109 | results.imageheight = originalHeight;
110 | }
111 | }
112 | })
113 | return results;
114 | }
115 |
116 | function wxParseTemArray(temArrayName,bindNameReg,total,that){
117 | var array = [];
118 | var temData = that.data;
119 | var obj = null;
120 | for(var i = 0; i < total; i++){
121 | var simArr = temData[bindNameReg+i].nodes;
122 | array.push(simArr);
123 | }
124 |
125 | temArrayName = temArrayName || 'wxParseTemArray';
126 | obj = JSON.parse('{"'+ temArrayName +'":""}');
127 | obj[temArrayName] = array;
128 | that.setData(obj);
129 | }
130 |
131 | /**
132 | * 配置emojis
133 | *
134 | */
135 |
136 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
137 | HtmlToJson.emojisInit(reg,baseSrc,emojis);
138 | }
139 |
140 | module.exports = {
141 | wxParse: wxParse,
142 | wxParseTemArray:wxParseTemArray,
143 | emojisInit:emojisInit
144 | }
145 |
146 |
147 |
--------------------------------------------------------------------------------
/wxParse/wxParse.wxml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | {{item.text}}
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
--------------------------------------------------------------------------------
/wxParse/wxParse.wxss:
--------------------------------------------------------------------------------
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 | .wxParse-inline{
21 | display: inline;
22 | margin: 0;
23 | padding: 0;
24 | }
25 | /*//标题 */
26 | .wxParse-div{margin: 0;padding: 0;}
27 | .wxParse-h1{ font-size:2em; margin: .67em 0 }
28 | .wxParse-h2{ font-size:1.5em; margin: .75em 0 }
29 | .wxParse-h3{ font-size:1.17em; margin: .83em 0 }
30 | .wxParse-h4{ margin: 1.12em 0}
31 | .wxParse-h5 { font-size:.83em; margin: 1.5em 0 }
32 | .wxParse-h6{ font-size:.75em; margin: 1.67em 0 }
33 |
34 | .wxParse-h1 {
35 | font-size: 18px;
36 | font-weight: 400;
37 | margin-bottom: .9em;
38 | }
39 | .wxParse-h2 {
40 | font-size: 16px;
41 | font-weight: 400;
42 | margin-bottom: .34em;
43 | }
44 | .wxParse-h3 {
45 | font-weight: 400;
46 | font-size: 15px;
47 | margin-bottom: .34em;
48 | }
49 | .wxParse-h4 {
50 | font-weight: 400;
51 | font-size: 14px;
52 | margin-bottom: .24em;
53 | }
54 | .wxParse-h5 {
55 | font-weight: 400;
56 | font-size: 13px;
57 | margin-bottom: .14em;
58 | }
59 | .wxParse-h6 {
60 | font-weight: 400;
61 | font-size: 12px;
62 | margin-bottom: .04em;
63 | }
64 |
65 | .wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong { font-weight: bolder }
66 |
67 | .wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic}
68 | .wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace}
69 | .wxParse-pre{white-space:pre}
70 | .wxParse-big{font-size:1.17em}
71 | .wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em}
72 | .wxParse-sub{vertical-align:sub}
73 | .wxParse-sup{vertical-align:super}
74 | .wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through}
75 | /*wxparse-自定义个性化的css样式*/
76 | /*增加video的css样式*/
77 | .wxParse-strong,.wxParse-s{display: inline}
78 | .wxParse-a{
79 | color: deepskyblue;
80 | word-break:break-all;
81 | overflow:auto;
82 | }
83 |
84 | .wxParse-video{
85 | text-align: center;
86 | margin: 10px 0;
87 | }
88 |
89 | .wxParse-video-video{
90 | width:100%;
91 | }
92 |
93 | .wxParse-img{
94 | background-color: #efefef;
95 | overflow: hidden;
96 | }
97 |
98 | .wxParse-blockquote {
99 | margin: 0;
100 | padding:10px 0 10px 5px;
101 | font-family:Courier, Calibri,"宋体";
102 | background:#f5f5f5;
103 | border-left: 3px solid #dbdbdb;
104 | }
105 |
106 | .wxParse-code,.wxParse-wxxxcode-style{
107 | display: inline;
108 | background:#f5f5f5;
109 | }
110 | .wxParse-ul{
111 | margin: 20rpx 10rpx;
112 | }
113 |
114 | .wxParse-li,.wxParse-li-inner{
115 | display: flex;
116 | align-items: baseline;
117 | margin: 10rpx 0;
118 | }
119 | .wxParse-li-text{
120 |
121 | align-items: center;
122 | line-height: 20px;
123 | }
124 |
125 | .wxParse-li-circle{
126 | display: inline-flex;
127 | width: 5px;
128 | height: 5px;
129 | background-color: #333;
130 | margin-right: 5px;
131 | }
132 |
133 | .wxParse-li-square{
134 | display: inline-flex;
135 | width: 10rpx;
136 | height: 10rpx;
137 | background-color: #333;
138 | margin-right: 5px;
139 | }
140 | .wxParse-li-ring{
141 | display: inline-flex;
142 | width: 10rpx;
143 | height: 10rpx;
144 | border: 2rpx solid #333;
145 | border-radius: 50%;
146 | background-color: #fff;
147 | margin-right: 5px;
148 | }
149 |
150 | /*.wxParse-table{
151 | width: 100%;
152 | height: 400px;
153 | }
154 | .wxParse-thead,.wxParse-tfoot,.wxParse-tr{
155 | display: flex;
156 | flex-direction: row;
157 | }
158 | .wxParse-th,.wxParse-td{
159 | display: flex;
160 | width: 580px;
161 | overflow: auto;
162 | }*/
163 |
164 | .wxParse-u {
165 | text-decoration: underline;
166 | }
167 | .wxParse-hide{
168 | display: none;
169 | }
170 | .WxEmojiView{
171 | align-items: center;
172 | }
173 | .wxEmoji{
174 | width: 16px;
175 | height:16px;
176 | }
177 | .wxParse-tr{
178 | display: flex;
179 | border-right:1px solid #e0e0e0;
180 | border-bottom:1px solid #e0e0e0;
181 | }
182 | .wxParse-th,
183 | .wxParse-td{
184 | flex:1;
185 | padding:5px;
186 | font-size:28rpx;
187 | border-left:1px solid #e0e0e0;
188 | word-break: break-all;
189 | }
190 | .wxParse-td:last{
191 | border-top:1px solid #e0e0e0;
192 | }
193 | .wxParse-th{
194 | background:#f0f0f0;
195 | border-top:1px solid #e0e0e0;
196 | }
197 |
198 |
--------------------------------------------------------------------------------