├── README.md ├── app.js ├── app.json ├── app.wxss ├── project.config.json └── src ├── page ├── home │ ├── index │ │ ├── index-model.js │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ └── login │ │ ├── index-model.js │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss ├── order │ ├── create │ │ ├── lecture │ │ │ └── index │ │ │ │ ├── index.js │ │ │ │ ├── index.json │ │ │ │ ├── index.wxml │ │ │ │ └── index.wxss │ │ ├── seat │ │ │ ├── confirm │ │ │ │ ├── index.js │ │ │ │ ├── index.json │ │ │ │ ├── index.wxml │ │ │ │ └── index.wxss │ │ │ └── index │ │ │ │ ├── index.js │ │ │ │ ├── index.json │ │ │ │ ├── index.wxml │ │ │ │ └── index.wxss │ │ └── space │ │ │ └── index │ │ │ ├── index.js │ │ │ ├── index.json │ │ │ ├── index.wxml │ │ │ └── index.wxss │ ├── index │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── list │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── listCurrent │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ └── remind │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss └── user │ ├── auth │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss │ ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss │ ├── money │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss │ ├── qrcode │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss │ └── service │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss └── resource ├── components └── toast │ ├── toast.js │ ├── toast.wxml │ └── toast.wxss ├── images ├── bind.jpg ├── chair1.png ├── chair2.png ├── chair3.png ├── changeCount.jpg ├── change_password.jpg ├── jiangzuo.png ├── lock1.png ├── lock2.png ├── lock3.png ├── login-top.jpg ├── login_bottom.jpg ├── nostatus1.png ├── seat.png ├── seat1.png ├── seat2.png ├── seat3.png ├── smile.png ├── space.png ├── space1.png ├── space2.png ├── space3.png ├── success.png ├── tabbarIcon │ ├── head-active.png │ ├── head.png │ ├── home-active.png │ ├── home.png │ ├── message-active.png │ ├── message.png │ ├── myreser-active.png │ └── myreser.png ├── user-bg1.png ├── user-bg2.png ├── user-default.png └── warn.png ├── js ├── base64.js ├── htmlToWxml.js ├── md5.js ├── underscore.js └── util.js ├── template └── complete.wxml └── utils ├── base.js ├── comment.js ├── connect.js └── store.js /README.md: -------------------------------------------------------------------------------- 1 | # H5-MUI-jquery-css(仓库系统) 2 | 下面是部分展示效果 3 | 喜欢前端的小伙伴们可以加入我们,喜欢ui的小伙伴也欢迎加入(781027167) 4 | # MindMap 5 | 以下是部分截图 想要全部代码的小伙伴可以加入(781027167)分享是一种美德 如有商用的小伙伴请告知 6 | 图书馆预约管理系统 7 | 8 | # View 9 | ![](http://wx2.sinaimg.cn/mw690/0060lm7Tly1fuwd39n9nvj30ku11241v.jpg) 10 | ![](http://wx1.sinaimg.cn/mw690/0060lm7Tly1fuwd4zdyn3j30ku17c4c2.jpg) 11 | ![](http://wx4.sinaimg.cn/mw690/0060lm7Tly1fuwd5r9aeqj30ku112wi2.jpg) 12 | ![](http://wx3.sinaimg.cn/mw690/0060lm7Tly1fuwd8qsx11j30ku112af5.jpg) 13 | ![](http://wx1.sinaimg.cn/mw690/0060lm7Tly1fuwd9a5o3cj30ku112wky.jpg) 14 | ![](http://wx2.sinaimg.cn/mw690/0060lm7Tly1fuwd9onoy6j30ku112agr.jpg) 15 | ![](http://wx3.sinaimg.cn/mw690/0060lm7Tly1fuwda2uqtaj30ku112gqs.jpg) 16 | ![](http://wx3.sinaimg.cn/mw690/0060lm7Tly1fuwdae8r5fj30ku112tar.jpg) 17 | ![](http://wx1.sinaimg.cn/mw690/0060lm7Tly1fuwdap7eyaj30ku15o42o.jpg) 18 | ![](http://wx1.sinaimg.cn/mw690/0060lm7Tly1fuwdb2hnhyj30ku15on1m.jpg) 19 | ![](http://wx1.sinaimg.cn/mw690/0060lm7Tly1fuwdbihypzj30ku11278q.jpg) 20 | ![](http://wx1.sinaimg.cn/mw690/0060lm7Tly1fuwdbwb7bqj30ku112dhq.jpg) 21 | ![](http://wx2.sinaimg.cn/mw690/0060lm7Tly1fuwdcey8m0j30ku112jxc.jpg) 22 | ![](http://wx4.sinaimg.cn/mw690/0060lm7Tly1fuwddqgx63j30ku112acg.jpg) 23 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdq9ttq4j30ku112wgj.jpg) 24 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdqymnkdj30ku112wi6.jpg) 25 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdt43zkuj30ku112aca.jpg) 26 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdui9fefj30ku112q5e.jpg) 27 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwduifokcj30ku112435.jpg) 28 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwduinkfoj30ku112n1c.jpg) 29 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwduistunj30ku112dic.jpg) 30 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwduiyqt6j30ku112did.jpg) 31 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwduj46ujj30ku15ogoq.jpg) 32 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdujb8glj30ku112gno.jpg) 33 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdwpyifhj30ku112wi6.jpg) 34 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdwprva2j30ku1120tr.jpg) 35 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdwpftjzj30ku112dje.jpg) 36 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdwp9zzqj30ku112wib.jpg) 37 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdwp30h1j30ku112n2v.jpg) 38 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdwova8mj30ku11276z.jpg) 39 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdwopwq3j30ku112acg.jpg) 40 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwdujb8glj30ku112gno.jpg) 41 | ![](https://ws1.sinaimg.cn/large/0065kWRKgy1fuwduistunj30ku112dic.jpg) 42 | # h5-weixin-library-all 43 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | // import { ToastPannel } from './resource/components/toast/toast' 2 | App({ 3 | onLaunch: function () { 4 | 5 | }, 6 | onShow: function () { 7 | // console.log(getCurrentPages()) 8 | }, 9 | onHide: function () { 10 | // console.log(getCurrentPages()) 11 | }, 12 | onError: function (msg) { 13 | console.log(msg) 14 | }, 15 | sq_acid: '', // 系统有默认对应的公众号id,运营多公众号才需要修改, 16 | // 小程序同步哪个公众号的id, 17 | // 如复制手机端链接https://yun.0418it.com/app/index.php?i=43&c=entry&do=index&m=yc_youliao , 18 | // 那么43就是要同步公众号的id 19 | util: require('src/resource/js/util.js'), 20 | url: 'wss://tang.eternalstop.com/wss', 21 | siteInfo : { 22 | "name": "", 23 | "uniacid": "2", 24 | "acid": "2", 25 | "multiid": "2", 26 | "version": "1.0", 27 | "siteroot": "https://tongcheng.iweiji.cc/app/index.php", 28 | "design_method": "3" 29 | }, 30 | 31 | }) -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | 4 | "src/page/home/login/index", 5 | "src/page/home/index/index", 6 | "src/page/order/remind/index", 7 | "src/page/order/index/index", 8 | "src/page/user/index/index", 9 | "src/page/user/msg/index", 10 | "src/page/user/service/index", 11 | "src/page/user/serviceOnline/index", 12 | "src/page/user/noticeList/index", 13 | "src/page/user/noticeDetail/index", 14 | "src/page/user/auth/index", 15 | "src/page/user/money/index", 16 | "src/page/user/qrcode/index", 17 | "src/page/user/bindWechat/index", 18 | "src/page/user/changeCount/index", 19 | "src/page/user/passwordReset/index", 20 | "src/page/user/passwordForget/index", 21 | "src/page/order/create/seat/index/index", 22 | "src/page/order/create/seat/confirm/index", 23 | "src/page/order/create/space/index/index", 24 | "src/page/order/create/lecture/index/index", 25 | "src/page/order/listCurrent/index", 26 | "src/page/order/list/index" 27 | 28 | ], 29 | "window": { 30 | "backgroundTextStyle": "light", 31 | "backgroundColor":"#fff", 32 | "navigationBarBackgroundColor": "#fff", 33 | "navigationBarTextStyle": "black", 34 | "navigationBarTitleText": "图书馆座位预约", 35 | "enablePullDownRefresh": true 36 | }, 37 | "networkTimeout": { 38 | "request": 10000, 39 | "connectSocket": 10000, 40 | "uploadFile": 10000, 41 | "downloadFile": 10000 42 | }, 43 | "tabBar": { 44 | "color": "#333", 45 | "selectedColor": "#3d667a", 46 | "borderStyle": "black", 47 | "backgroundColor": "#f4f4f4", 48 | "list": [ 49 | { 50 | "pagePath": "src/page/home/index/index", 51 | "iconPath": "src/resource/images/tabbarIcon/home.png", 52 | "selectedIconPath": "src/resource/images/tabbarIcon/home-active.png", 53 | "text": "首页" 54 | }, 55 | { 56 | "pagePath": "src/page/order/remind/index", 57 | "iconPath": "src/resource/images/tabbarIcon/message.png", 58 | "selectedIconPath": "src/resource/images/tabbarIcon/message-active.png", 59 | "text": "消息提醒" 60 | }, 61 | { 62 | "pagePath": "src/page/order/index/index", 63 | "iconPath": "src/resource/images/tabbarIcon/myreser.png", 64 | "selectedIconPath": "src/resource/images/tabbarIcon/myreser-active.png", 65 | "text": "我的预约" 66 | }, 67 | { 68 | "pagePath": "src/page/user/index/index", 69 | "iconPath": "src/resource/images/tabbarIcon/head.png", 70 | "selectedIconPath": "src/resource/images/tabbarIcon/head-active.png", 71 | "text": "个人" 72 | } 73 | ] 74 | }, 75 | "debug": false 76 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | 2 | 3 | /**app.wxss**/ 4 | 5 | @font-face { 6 | font-family: 'iconfont'; /* project id 697305 */ 7 | src: url('//at.alicdn.com/t/font_697305_srr7iknb6dr.eot'); 8 | src: url('//at.alicdn.com/t/font_697305_srr7iknb6dr.eot?#iefix') format('embedded-opentype'), 9 | url('//at.alicdn.com/t/font_697305_srr7iknb6dr.woff') format('woff'), 10 | url('//at.alicdn.com/t/font_697305_srr7iknb6dr.ttf') format('truetype'), 11 | url('//at.alicdn.com/t/font_697305_srr7iknb6dr.svg#iconfont') format('svg'); 12 | } 13 | .iconfont { 14 | font-family:"iconfont" !important; 15 | font-size:60rpx; 16 | font-style:normal; 17 | -webkit-font-smoothing: antialiased; 18 | -moz-osx-font-smoothing: grayscale; 19 | } 20 | 21 | /*本项目使用的18个图标 */ 22 | .icon-right:before{content: '\e605';} 23 | .icon-right2:before{content: '\e603';} 24 | .icon-left:before{content: '\e602';} 25 | .icon-down:before{content: '\e604';} 26 | .icon-top:before{content: '\e619';} 27 | .icon-lock:before{content: '\e788';} 28 | .icon-lock2:before{content: '\e6d2';} 29 | .icon-money:before{content: '\e61f';} 30 | .icon-qrcode:before{content: '\e601';} 31 | .icon-notice:before{content: '\e62d';} 32 | .icon-crown:before{content: '\e63d';} 33 | .icon-source:before{content: '\e600';} 34 | .icon-reset:before{content: '\e6e9';} 35 | .icon-wechat:before{content: '\e60e';} 36 | .icon-change:before{content: '\e60d';} 37 | .icon-headset:before{content: '\e62f';} 38 | .icon-headimg:before{content: '\e639';} 39 | .icon-scan:before{content: '\e620';} 40 | .icon-circle:before{content: '\e64e';} 41 | .icon-circle-checked:before{content: '\e64c';} 42 | .icon-triangle:before{content: '\e686';} 43 | .icon-date:before{content: '\e606';} 44 | 45 | .col999 { 46 | color: #999; 47 | } 48 | 49 | .col666 { 50 | color: #666; 51 | } 52 | 53 | .col222 { 54 | color: #222; 55 | } 56 | 57 | .clearfix:after, .clearfix:before { 58 | content: ""; 59 | display: table; 60 | } 61 | 62 | .clearfix:after { 63 | clear: both; 64 | } 65 | 66 | .newItem { 67 | padding: 30rpx 20rpx 16rpx; 68 | margin-bottom: 10rpx; 69 | } 70 | 71 | .newItem .top { 72 | line-height: 30px; 73 | font-size: 28rpx; 74 | margin-bottom: 16rpx; 75 | display: flex; 76 | position: relative; 77 | } 78 | .newItem .top .wechat{ 79 | color: #fb5100; 80 | position: absolute; 81 | width: 140rpx; 82 | height: 40rpx; 83 | line-height: 40rpx; 84 | right: 0; 85 | bottom: 45rpx; 86 | border: 1px solid #fb5100; 87 | border-radius: 4px; 88 | text-align: center; 89 | font-size: 26rpx; 90 | vertical-align: top; 91 | } 92 | .newItem .top .wechat .img{ 93 | display: inline-block; 94 | vertical-align: top; 95 | width: 40rpx; 96 | height: 30rpx; 97 | padding-right: 5rpx; 98 | z-index: 10; 99 | padding-top:7rpx; 100 | } 101 | .newItem .contentTxt{ 102 | font-size: 28rpx; 103 | line-height: 50rpx; 104 | } 105 | .newItem .top .avatar{ 106 | width: 42px; 107 | height: 42px; 108 | overflow: hidden; 109 | border-radius: 50%; 110 | } 111 | .newItem .top .topRight{ 112 | flex: 1; 113 | line-height: 24px; 114 | padding-left: 20rpx; 115 | } 116 | .newItem .top .topRight .txt1{ 117 | font-size: 28rpx; 118 | } 119 | .newItem .top .topRight .txt2{ 120 | font-size: 24rpx; 121 | line-height: 46rpx; 122 | } 123 | .newItem .top .topRight .ding{ 124 | margin-left: 20rpx; 125 | font-size: 24rpx; 126 | padding: 0 16rpx; 127 | border-radius: 4px; 128 | border: 1rpx solid #fb5100; 129 | color: #fb5100; 130 | } 131 | .newItem .top .type { 132 | margin-left: 0; 133 | padding: 10rpx 16rpx; 134 | background-color: #b884c1; 135 | color: #fff; 136 | border-radius: 10rpx; 137 | } 138 | .newItem .address { 139 | font-size: 24rpx; 140 | color: #999; 141 | line-height: 60rpx; 142 | padding-top: 20rpx; 143 | } 144 | .newItem .address text{ 145 | display: inline-block; 146 | line-height:60rpx; 147 | padding-top:20rpx; 148 | } 149 | .newItem .address .img{ 150 | width: 30rpx; 151 | height: 30rpx; 152 | vertical-align: top; 153 | padding-top: 15rpx; 154 | } 155 | .newItem .info { 156 | margin-top: 16rpx; 157 | height: 50rpx; 158 | line-height: 66rpx; 159 | font-size: 26rpx; 160 | padding-left: 16rpx; 161 | color: #333; 162 | border-top: 1rpx solid #eee; 163 | padding: 10rpx 0; 164 | } 165 | .newItem .info .module{ 166 | color: #fb5100; 167 | line-height: 66rpx; 168 | float: left; 169 | } 170 | .newItem text { 171 | font-size: 24rpx; 172 | } 173 | .newItem .info .img { 174 | padding-top: 16rpx; 175 | padding-right: 6rpx; 176 | width: 30rpx; 177 | height: 30rpx; 178 | vertical-align: top; 179 | } 180 | 181 | .newItem .images { 182 | padding-top: 30rpx; 183 | } 184 | 185 | .newItem .images image { 186 | width: 200rpx; 187 | height: 200rpx; 188 | float: left; 189 | padding-right: 20rpx; 190 | } 191 | .emptyData{ 192 | padding-top: 20rpx; 193 | line-height: 50rpx; 194 | font-size: 26rpx; 195 | text-align: center; 196 | } 197 | .titleWrapper{ 198 | display: flex; 199 | padding: 20rpx 50rpx; 200 | } 201 | .titleWrapper .line2{ 202 | flex: 1; 203 | border-bottom: 1rpx solid #ccc; 204 | transform: translateY(-28rpx); 205 | } 206 | .titleWrapper .text{ 207 | font-size: 24rpx; 208 | color: #666; 209 | line-height: 60rpx; 210 | padding: 0 20rpx; 211 | } 212 | .container { 213 | display: flex; 214 | flex-direction: column; 215 | align-items: center; 216 | box-sizing: border-box; 217 | overflow-x:hidden; 218 | } 219 | .border-bottom{ 220 | border-bottom: 0.5rpx solid #dedede; 221 | } 222 | .bg_line{ 223 | width: 100%; 224 | height: 15rpx; 225 | background: #f0f0f0; 226 | } 227 | .bg_white{ 228 | background: #fff; 229 | } 230 | .image_pic{ 231 | background-image: url('https://picabstract-preview-ftn.weiyun.com:8443/ftn_pic_abs_v2/1bdae2493f0b41efd60d332182122a587c93c9dd02873143c1b3b55525b1f7457b1b15d4269b3312762696af307d1795?pictype=scale&from=30113&version=2.0.0.2&uin=371801080&fname=zzt_logo2%281%29.png&size=1024'); 232 | background-size:contain; 233 | background-repeat: no-repeat; 234 | background-position: center center; 235 | } 236 | .score-box .score-list .icon-star1{ 237 | font-size:25rpx; 238 | } 239 | .noStatus{ 240 | width: 45%; 241 | margin: 30% auto 30%; 242 | } 243 | .noStatus .pic-box{ 244 | width: 100%; 245 | height: 350rpx; 246 | margin-bottom: 30rpx; 247 | } 248 | .noStatus .pic{ 249 | width: 100%; 250 | height: 100%; 251 | } 252 | .noStatus .text{ 253 | color: #333; 254 | font-size: 26rpx; 255 | margin-top: 10rpx; 256 | text-align: center; 257 | } 258 | 259 | 260 | /*没有更多了*/ 261 | .no-more{ 262 | position: relative; 263 | color: #cdcdcd; 264 | margin: 24rpx 0 64rpx; 265 | font-size: 24rpx; 266 | text-align: center; 267 | font-weight: 300; 268 | } 269 | .no-more:before{ 270 | content: ''; 271 | display: inline-block; 272 | height: 129rpx; 273 | height: 2rpx; 274 | background: #cdcdcd; 275 | } -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件。", 3 | "setting": { 4 | "urlCheck": true, 5 | "es6": true, 6 | "postcss": true, 7 | "minified": true, 8 | "newFeature": true 9 | }, 10 | "compileType": "miniprogram", 11 | "libVersion": "1.5.3", 12 | "appid": "wx849eb6cd057975a1", 13 | "projectname": "%E5%9B%BE%E4%B9%A6%E9%A6%86%E5%BA%A7%E4%BD%8D%E9%A2%84%E7%BA%A6before", 14 | "condition": { 15 | "search": { 16 | "current": -1, 17 | "list": [] 18 | }, 19 | "conversation": { 20 | "current": -1, 21 | "list": [] 22 | }, 23 | "miniprogram": { 24 | "current": -1, 25 | "list": [] 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/page/home/index/index-model.js: -------------------------------------------------------------------------------- 1 | import { Base } from '../../../resource/utils/base.js' 2 | const app = getApp() 3 | class Index extends Base { 4 | constructor() { 5 | super() 6 | } 7 | 8 | // 获取首页信息 9 | getIndexData(callback) { 10 | callback && callback(res.data.data) 11 | } 12 | } 13 | 14 | export { Index } -------------------------------------------------------------------------------- /src/page/home/index/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo, getImageSocket, getLocation } from '../../resource/utils/comment.js' 2 | import { Index } from 'index-model.js' 3 | 4 | var index = new Index() 5 | let app = getApp(); 6 | let animationShowHeight = 300; 7 | const LENGTH = 10; 8 | 9 | Page({ 10 | data: { 11 | advs: ['https://m.360buyimg.com/babel/jfs/t20695/118/711678007/159042/81b387b2/5b157234Na31baa10.png', 12 | 'https://m.360buyimg.com/babel/jfs/t20887/304/737271706/39873/327236a2/5b166eb7Nba515084.png', 13 | 'https://m.360buyimg.com/babel/jfs/t22222/31/459858983/48865/8768dca/5b0e5419N0855116e.jpg', 14 | 'https://m.360buyimg.com/babel/jfs/t21301/283/505859890/95478/7f6a9596/5b0f9953Nd4ac7ccc.jpg' 15 | ], 16 | noticeList: [{ 17 | id: 1, 18 | content: '1、2018年5月18日,图书馆一楼会议室在上午08:00- 12:00,暂停对外开放,请各位注意调整预约。' 19 | },{ 20 | id: 2, 21 | content: '2、2018年5月19日,图书馆因检查更换设备,暂停对外开放使用,请各位注意调整预约时间。' 22 | }], 23 | orderList: [{ 24 | id: 1, 25 | content: '图书馆一楼A区阅读区', 26 | time: "2018/5/18 09:00-13:00", 27 | status: 0 28 | },{ 29 | id: 1, 30 | content: '图书馆三楼C区多功能区', 31 | time: "2018/5/18 09:00-13:00", 32 | status: 1 33 | },{ 34 | id: 1, 35 | content: '图书馆二楼D区多功能区 ', 36 | time: "2018/5/18 09:00-13:00", 37 | status: 0 38 | },{ 39 | id: 1, 40 | content: '图书馆二楼D区多功能区', 41 | time: "2018/5/18 09:00-13:00", 42 | status: 0 43 | }] 44 | }, 45 | 46 | onLoad: function(){ 47 | 48 | }, 49 | 50 | // 扫描二维码 51 | scanCode() { 52 | wx.scanCode({ 53 | success: (res) => { 54 | console.log('res:',res) 55 | // wx.redirectTo({ 56 | // url: `/yc_youliao/page/coupon/detail/index?id=${res.result}` 57 | // }) 58 | }, 59 | fail: (res) => { 60 | wx.showModal({ 61 | title: '扫描错误', 62 | content: res, 63 | showCancel: false, 64 | confirmColor: '#333', 65 | success: function (res) { 66 | if (res.confirm) { 67 | console.log('用户点击确定') 68 | } else if (res.cancel) { 69 | console.log('用户点击取消') 70 | } 71 | } 72 | }) 73 | } 74 | }) 75 | }, 76 | 77 | createOrder(e){ 78 | let name = e.currentTarget.dataset.name, url = ''; 79 | switch (name) { 80 | case 'space': 81 | url = "/src/page/order/create/space/index/index" 82 | break; 83 | case 'seat': 84 | url = "/src/page/order/create/seat/index/index" 85 | break; 86 | case 'lecture': 87 | url = "/src/page/order/create/lecture/index/index" 88 | break; 89 | } 90 | wx.navigateTo({ 91 | url: url 92 | }) 93 | } 94 | 95 | }) -------------------------------------------------------------------------------- /src/page/home/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "图书馆座位预约" 7 | } -------------------------------------------------------------------------------- /src/page/home/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 扫一扫 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 空间预约 37 | 38 | 39 | 44 | 座位预约 45 | 46 | 47 | 52 | 讲座预约 53 | 54 | 55 | 56 | 57 | 公告 58 | 59 | 60 | {{item.content}} 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 今日使用 71 | 72 | 73 | 74 | {{item.content}} 75 | 已生效 76 | 77 | {{item.time}} 78 | 79 | 没有更多了 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/page/home/index/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4; 3 | display: flex; 4 | flex-direction: column; 5 | justify-content: flex-start; 6 | font-family: PingFangSC-Regular; 7 | } 8 | .container-home{ 9 | width: 100%; 10 | box-sizing: border-box; 11 | } 12 | 13 | /*轮播图*/ 14 | .swiper-contain{ 15 | width: 100%; 16 | position: relative; 17 | } 18 | .swiper { 19 | height: 300rpx; 20 | width: 100%; 21 | } 22 | .swiper image { 23 | height: 100%; 24 | width: 100%; 25 | } 26 | .swiper-btn{ 27 | position: absolute; 28 | top: 15rpx; 29 | display: flex; 30 | right: 30rpx; 31 | font-size: 12pt; 32 | color: #3d667a; 33 | } 34 | .swiper-btn .iconfont{ 35 | font-size: 18pt; 36 | vertical-align: -7%; 37 | margin-right: 3rpx; 38 | } 39 | 40 | /*订单链接*/ 41 | .order-link-contain{ 42 | display: flex; 43 | margin-top: 15rpx; 44 | } 45 | .order-link-contain .item{ 46 | width: 33.33%; 47 | height: 210rpx; 48 | text-align: center; 49 | } 50 | .order-link-contain .item .img{ 51 | width: 63rpx; 52 | height: 63rpx; 53 | margin: 55rpx 0 15rpx 0; 54 | } 55 | .order-link-contain .item .text{ 56 | font-size: 24rpx; 57 | color: #fff; 58 | } 59 | .order-link-contain .space{ 60 | background-color: #3d667a; 61 | } 62 | .order-link-contain .seat{ 63 | background-color: #c6bb9d; 64 | color: #4b4b4b; 65 | } 66 | .order-link-contain .lecture{ 67 | background-color: #fcd667; 68 | color: #2f586c; 69 | } 70 | 71 | /*公告*/ 72 | .notice-contain{ 73 | margin: 41rpx 0 34rpx 0; 74 | padding: 0 24rpx; 75 | color: #4b4b4b; 76 | } 77 | .notice-contain .title{ 78 | text-align: center; 79 | font-size: 30rpx; 80 | margin-bottom: 34rpx; 81 | } 82 | .notice-contain .list{ 83 | padding: 24rpx 30rpx; 84 | font-size: 25rpx; 85 | line-height: 32rpx; 86 | position: relative; 87 | } 88 | 89 | .list-border{ 90 | position: absolute; 91 | height: 31rpx; 92 | width: 31rpx; 93 | border-radius: 5rpx; 94 | } 95 | 96 | .border1{ 97 | left: 0; 98 | top: 0; 99 | border-left: 0.5rpx solid #c6c6c6; 100 | border-top: 0.5rpx solid #c6c6c6; 101 | } 102 | .border2{ 103 | right: 0; 104 | top: 0; 105 | border-right: 0.5rpx solid #c6c6c6; 106 | border-top: 0.5rpx solid #c6c6c6; 107 | } 108 | .border3{ 109 | right: 0; 110 | bottom: 0; 111 | border-right: 0.5rpx solid #c6c6c6; 112 | border-bottom: 0.5rpx solid #c6c6c6; 113 | } 114 | .border4{ 115 | left: 0; 116 | bottom: 0; 117 | border-left: 0.5rpx solid #c6c6c6; 118 | border-bottom: 0.5rpx solid #c6c6c6; 119 | } 120 | 121 | .notice-contain .list .item{ 122 | margin-bottom: 30rpx; 123 | } 124 | .notice-contain .list .item:last-child{ 125 | margin-bottom: 0; 126 | } 127 | 128 | /*预约订单列表*/ 129 | .order-contain{ 130 | padding: 0 24rpx; 131 | font-size: 30rpx; 132 | color: #4b4b4b; 133 | } 134 | .order-contain .title{ 135 | position: relative; 136 | text-align: center; 137 | width: 170rpx; 138 | border-bottom: 1rpx solid #4b4b4b; 139 | height: 50rpx; 140 | line-height: 50rpx; 141 | margin: 0 auto 21rpx; 142 | font-size: 30rpx; 143 | } 144 | .order-contain .item{ 145 | padding: 14rpx 34rpx; 146 | } 147 | .order-contain .item:nth-child(2n+1){ 148 | background-color: #eaf2f6; 149 | } 150 | .order-contain .item .content{ 151 | display: flex; 152 | justify-content: space-between; 153 | font-size: 24rpx; 154 | } 155 | .order-contain .item .time{ 156 | font-size: 22rpx; 157 | color: #979797; 158 | margin-top: 8rpx; 159 | } -------------------------------------------------------------------------------- /src/page/home/login/index-model.js: -------------------------------------------------------------------------------- 1 | import { Base } from '../../../resource/utils/base.js' 2 | const app = getApp() 3 | class Index extends Base { 4 | constructor() { 5 | super() 6 | } 7 | 8 | // 获取首页信息 9 | getIndexData(callback) { 10 | callback && callback(res.data.data) 11 | } 12 | } 13 | 14 | export { Index } -------------------------------------------------------------------------------- /src/page/home/login/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo, getImageSocket, getLocation } from '../../resource/utils/comment.js' 2 | import { Index } from 'index-model.js' 3 | 4 | var index = new Index() 5 | let app = getApp(); 6 | let animationShowHeight = 300; 7 | const LENGTH = 10; 8 | 9 | Page({ 10 | data: { 11 | casArray: [], 12 | casIndex: 0, 13 | code: '', 14 | schoolList: [], 15 | userName: '', 16 | password: '', 17 | ready: false 18 | }, 19 | 20 | onLoad: function(){ 21 | var socketOpen = false 22 | var socketMsgQueue = [] 23 | let data = { 24 | flag: 1 25 | } 26 | 27 | //建立连接 28 | wx.connectSocket({ 29 | url: app.url 30 | }) 31 | 32 | //连接成功 33 | wx.onSocketOpen((res) => { 34 | socketOpen = true 35 | sendSocketMessage(data) 36 | socketMsgQueue = [] 37 | }) 38 | 39 | const sendSocketMessage = (msg)=> { 40 | if (socketOpen) { 41 | wx.sendSocketMessage({ 42 | data:JSON.stringify(msg) 43 | }) 44 | } else { 45 | socketMsgQueue.push(msg) 46 | } 47 | } 48 | 49 | //接收数据 50 | wx.onSocketMessage((res) => { 51 | let _this = this 52 | if(res && res.data){ 53 | var jsonStr= res.data; 54 | jsonStr = jsonStr.replace(" ",""); 55 | if(typeof jsonStr!= 'object'){ 56 | jsonStr= jsonStr.replace(/\ufeff/g,""); //重点 57 | var obj = JSON.parse(jsonStr); 58 | 59 | let arr = [] 60 | obj.list.forEach((item,index)=>{ 61 | arr.push(item.school) 62 | }) 63 | _this.setData({ 64 | casArray: arr, 65 | schoolList: obj.list, 66 | code: obj.list[0].code 67 | }) 68 | } 69 | } 70 | }) 71 | 72 | 73 | //连接失败 74 | wx.onSocketError((e) => { 75 | console.log('e:',e) 76 | console.log('websocket连接失败!'); 77 | }) 78 | }, 79 | 80 | forgetPassword(){ 81 | wx.navigateTo({ 82 | url: "/src/page/user/passwordForget/index", 83 | }) 84 | }, 85 | 86 | bindCasPickerChange: function (e) { 87 | let code = ""; 88 | this.schoolList.forEach((ele, index) => { 89 | if(ele.school == casArray[e.detail.value]){ 90 | code = ele.code 91 | } 92 | }); 93 | this.setData({ 94 | casIndex: e.detail.value, 95 | code: code 96 | }) 97 | }, 98 | 99 | listenerPasswordInput(e){ 100 | this.setData({ 101 | password: e.detail.value 102 | }) 103 | if(this.data.userName && this.data.userName.trim()){ 104 | this.setData({ 105 | ready: e.detail.value && e.detail.value.trim().length ? true : false 106 | }) 107 | } 108 | }, 109 | 110 | listenerUserNameInput(e){ 111 | this.setData({ 112 | userName: e.detail.value 113 | }) 114 | if(this.data.password && this.data.password.trim()){ 115 | this.setData({ 116 | ready: e.detail.value && e.detail.value.trim().length ? true : false 117 | }) 118 | } 119 | }, 120 | 121 | login(){ 122 | wx.switchTab({ 123 | url: "/src/page/home/index/index", 124 | }) 125 | if(!this.data.code){ 126 | wx.showToast({ 127 | title:'请选择学校', 128 | image: '../../../resource/images/warn.png', 129 | }) 130 | return 131 | } 132 | if(!this.data.userName || !this.data.userName.trim()){ 133 | wx.showToast({ 134 | title:'请输入账号', 135 | image: '../../../resource/images/warn.png', 136 | }) 137 | return 138 | } 139 | if(!this.data.password || !this.data.password.trim()){ 140 | wx.showToast({ 141 | title:'请输入密码', 142 | image: '../../../resource/images/warn.png', 143 | }) 144 | return 145 | } 146 | 147 | let data = { 148 | flag: 2, 149 | code: this.data.code, 150 | UserName: this.data.userName, 151 | password: this.data.password 152 | } 153 | 154 | // 发送数据 155 | wx.sendSocketMessage({ 156 | data: JSON.stringify(data) 157 | }) 158 | 159 | // 接收数据 160 | wx.onSocketMessage((res) => { 161 | if(res && res.data){ 162 | var jsonStr = res.data; 163 | jsonStr = jsonStr.replace(" ",""); 164 | if(typeof jsonStr != 'object'){ 165 | jsonStr= jsonStr.replace(/\ufeff/g,""); //重点 166 | var obj = JSON.parse(jsonStr); 167 | 168 | if(obj.status == 200){ 169 | wx.showToast({ 170 | title:'登录成功', 171 | icon: 'success', 172 | duration: 2000, 173 | success: () => { 174 | wx.setStorage({ 175 | key:"userCode", 176 | data: this.data.code 177 | }) 178 | setTimeout(()=>{ 179 | wx.switchTab({ 180 | url: "/src/page/home/index/index", 181 | }) 182 | },2000) 183 | } 184 | }) 185 | } 186 | } 187 | } 188 | }) 189 | 190 | //连接失败 191 | wx.onSocketError(() => { 192 | console.log('websocket连接失败!'); 193 | }) 194 | } 195 | }) -------------------------------------------------------------------------------- /src/page/home/login/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarBackgroundColor": "#3d667a", 3 | "navigationBarTextStyle": "#fff", 4 | "navigationBarTitleText": "图书馆预约管理平台", 5 | "backgroundColor": "#000", 6 | "backgroundTextStyle": "light", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/home/login/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 选择学校: 11 | 12 | 13 | {{casArray[casIndex]}} 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 忘记密码? 30 | 登录 31 | 32 | 36 | 37 | -------------------------------------------------------------------------------- /src/page/home/login/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #fafafa; 3 | } 4 | .container{ 5 | height: 100vh; 6 | font-size: 30rpx; 7 | color: #3d667a; 8 | } 9 | .topImg{ 10 | width: 100%; 11 | height: 274rpx; 12 | } 13 | 14 | .bottomImg{ 15 | width: 100%; 16 | height: 176rpx; 17 | position: fixed; 18 | bottom: 0; 19 | left: 0; 20 | } 21 | 22 | .list{ 23 | width: 620rpx; 24 | margin-top: 100rpx; 25 | } 26 | 27 | .item{ 28 | height: 100rpx; 29 | line-height: 100rpx; 30 | display: flex; 31 | border-bottom: .5rpx solid #3d667a; 32 | position: relative; 33 | } 34 | .picker{ 35 | flex: 1; 36 | } 37 | .item .iconfont{ 38 | font-size: 42rpx; 39 | margin-right: 20rpx; 40 | vertical-align: 1%; 41 | } 42 | .item .icon-triangle{ 43 | position: absolute; 44 | right: 0; 45 | top: 50%; 46 | transform: translateY(-50%); 47 | margin: 0; 48 | } 49 | .item input{ 50 | height: 100%; 51 | width: 100%; 52 | } 53 | 54 | .forget{ 55 | height: 70rpx; 56 | line-height: 70rpx; 57 | text-align: right; 58 | width: 100%; 59 | padding-right: 58rpx; 60 | } 61 | 62 | .btn{ 63 | width: 620rpx; 64 | height: 66rpx; 65 | line-height: 66rpx; 66 | text-align: center; 67 | margin-top: 58rpx; 68 | border: solid 1rpx rgba(224, 199, 136, 0.46); 69 | color: #e0c788; 70 | } 71 | .active{ 72 | background: #3d667a; 73 | color: #fff; 74 | border: none; 75 | } -------------------------------------------------------------------------------- /src/page/order/create/lecture/index/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | 5 | }, 6 | 7 | onLoad: function (options) { 8 | 9 | } 10 | }) -------------------------------------------------------------------------------- /src/page/order/create/lecture/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "讲座预约", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/order/create/lecture/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 暂未开通! 3 | -------------------------------------------------------------------------------- /src/page/order/create/lecture/index/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4 3 | } 4 | 5 | .none{ 6 | color: #3d667a; 7 | font-size: 36rpx; 8 | position: absolute; 9 | left: 50%; 10 | top: 50%; 11 | transform: translate(-50%,-50%); 12 | width: 100%; 13 | text-align: center; 14 | } -------------------------------------------------------------------------------- /src/page/order/create/seat/confirm/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | date: '2018-06-22 星期二', 5 | floor: '1F', 6 | room: '阅览室A103', 7 | seat: '001号桌 A座', 8 | startTime: '08:30', 9 | endTime: '10:30', 10 | }, 11 | 12 | onLoad: function (options) { 13 | 14 | } 15 | }) -------------------------------------------------------------------------------- /src/page/order/create/seat/confirm/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "座位预约", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/order/create/seat/confirm/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 预约日期: 5 | {{date}} 6 | 7 | 8 | 9 | 选择楼层: 10 | {{floor}} 11 | 12 | 13 | 14 | 选择房间: 15 | {{room}} 16 | 17 | 18 | 19 | 选择座位: 20 | {{seat}} 21 | 22 | 23 | 24 | 预约时间(开始时间): 25 | {{startTime}} 26 | 27 | 28 | 29 | 预约时间(结束时间): 30 | {{endTime}} 31 | 32 | 33 | 34 | 35 | 确认 36 | -------------------------------------------------------------------------------- /src/page/order/create/seat/confirm/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4 3 | } 4 | 5 | .serverConfirm{ 6 | border-top: 0.5rpx solid #3d667a; 7 | } 8 | .list{ 9 | background: #fff; 10 | padding: 0 28rpx; 11 | margin-top: 20rpx; 12 | } 13 | .item{ 14 | display: flex; 15 | height: 90rpx; 16 | line-height: 90rpx; 17 | border-bottom: 0.5rpx solid #dedede; 18 | color: #535353; 19 | font-size: 30rpx; 20 | } 21 | .item:last-child{ 22 | border-bottom: none; 23 | } 24 | .item i{ 25 | color: #6c6c6c; 26 | font-size: 26rpx; 27 | } 28 | .content{ 29 | flex: 1; 30 | } 31 | .btn{ 32 | height: 70rpx; 33 | line-height: 70rpx; 34 | text-align: center; 35 | width: 94%; 36 | margin: 130rpx auto 0; 37 | border: solid 1px rgba(61, 102, 122, 0.46); 38 | color: #3d667a; 39 | font-size: 30rpx; 40 | } -------------------------------------------------------------------------------- /src/page/order/create/seat/index/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | let animationShowHeight = 300; 3 | Page({ 4 | data: { 5 | floor: ['1F','2F','3F','4F','5F','6F'], 6 | floorIndex: 0, 7 | room: ['阅览室A103','阅览室B102','阅览室C105','阅览室D106'], 8 | roomIndex: 0, 9 | tableList: [{ 10 | name: '01', 11 | id: 1, 12 | seatList: [{ 13 | name: 'A', 14 | id: 1, 15 | status: 0 // 0有人, 1空闲, 2已预约 16 | },{ 17 | name: 'B', 18 | id: 2, 19 | status: 1 // 0有人, 1空闲, 2已预约 20 | },{ 21 | name: 'C', 22 | id: 3, 23 | status: 2 // 0有人, 1空闲, 2已预约 24 | },{ 25 | name: 'D', 26 | id: 4, 27 | status: 0 // 0有人, 1空闲, 2已预约 28 | }] 29 | },{ 30 | name: '02', 31 | id: 2, 32 | seatList: [{ 33 | name: 'A', 34 | id: 5, 35 | status: 0 // 0有人, 1空闲, 2已预约 36 | },{ 37 | name: 'B', 38 | id: 6, 39 | status: 1 // 0有人, 1空闲, 2已预约 40 | },{ 41 | name: 'C', 42 | id: 7, 43 | status: 2 // 0有人, 1空闲, 2已预约 44 | },{ 45 | name: 'D', 46 | id: 8, 47 | status: 0 // 0有人, 1空闲, 2已预约 48 | }] 49 | },{ 50 | name: '03', 51 | id: 3, 52 | seatList: [{ 53 | name: 'A', 54 | id: 9, 55 | status: 0 // 0有人, 1空闲, 2已预约 56 | },{ 57 | name: 'B', 58 | id: 10, 59 | status: 1 // 0有人, 1空闲, 2已预约 60 | },{ 61 | name: 'C', 62 | id: 11, 63 | status: 2 // 0有人, 1空闲, 2已预约 64 | },{ 65 | name: 'D', 66 | id: 12, 67 | status: 0 // 0有人, 1空闲, 2已预约 68 | }] 69 | },{ 70 | name: '04', 71 | id: 4, 72 | seatList: [{ 73 | name: 'A', 74 | id: 13, 75 | status: 0 // 0有人, 1空闲, 2已预约 76 | },{ 77 | name: 'B', 78 | id: 14, 79 | status: 1 // 0有人, 1空闲, 2已预约 80 | },{ 81 | name: 'C', 82 | id: 15, 83 | status: 2 // 0有人, 1空闲, 2已预约 84 | },{ 85 | name: 'D', 86 | id: 16, 87 | status: 0 // 0有人, 1空闲, 2已预约 88 | }] 89 | },{ 90 | name: '05', 91 | id: 5, 92 | seatList: [{ 93 | name: 'A', 94 | id: 17, 95 | status: 0 96 | },{ 97 | name: 'B', 98 | id: 18, 99 | status: 1 100 | },{ 101 | name: 'C', 102 | id: 19, 103 | status: 2 104 | },{ 105 | name: 'D', 106 | id: 20, 107 | status: 0 108 | }] 109 | },{ 110 | name: '06', 111 | id: 6, 112 | seatList: [{ 113 | name: 'A', 114 | id: 21, 115 | status: 0 116 | },{ 117 | name: 'B', 118 | id: 22, 119 | status: 1 120 | },{ 121 | name: 'C', 122 | id: 23, 123 | status: 2 124 | },{ 125 | name: 'D', 126 | id: 24, 127 | status: 0 128 | }] 129 | },{ 130 | name: '07', 131 | id: 7, 132 | seatList: [{ 133 | name: 'A', 134 | id: 25, 135 | status: 0 136 | },{ 137 | name: 'B', 138 | id: 26, 139 | status: 1 140 | },{ 141 | name: 'C', 142 | id: 27, 143 | status: 2 144 | },{ 145 | name: 'D', 146 | id: 28, 147 | status: 0 148 | }] 149 | }], 150 | dates: '', 151 | showDate: false, 152 | weekList: ['一','二','三','四','五','六','日'], // 星期池 153 | dayList: [], // 日期池 154 | year: '', // 当前年 155 | currentMonth: '', // 当前月 156 | month: '', // 当前月 157 | day: '', // 选中日 158 | today: '', // 当前日 159 | chooseDay: '', // 选中日 160 | WeekDay: '1', // 当前日期是本周几 161 | eventList:[], // 事件池 162 | currentMonthList:[], // 当月日历 163 | }, 164 | 165 | onLoad: function (options) { 166 | let arr = this.data.tableList; 167 | 168 | arr.forEach((item, index) => { 169 | var arr1 = [], 170 | arr2 = []; 171 | if(item.seatList && item.seatList.length){ 172 | item.seatList.forEach((ele,i)=>{ 173 | if(i< item.seatList.length/2){ 174 | arr1.push(ele) 175 | }else{ 176 | arr2.push(ele) 177 | } 178 | }) 179 | } 180 | 181 | item.arr1 = arr1 182 | item.arr2 = arr2 183 | }); 184 | console.log('arr:',arr) 185 | this.setData({ 186 | tableList: arr 187 | }) 188 | 189 | var today = new Date(); // 获取当日日历 190 | var year = today.getFullYear(), 191 | month = today.getMonth() + 1, 192 | day = today.getDate(); 193 | 194 | this.setData({ 195 | year: year, 196 | month: month, 197 | currentMonth: month, 198 | day: day, 199 | today: day, 200 | dates: year + '-' + month + '-' + day 201 | }) 202 | this.fetchMonthData(year, month) // 获取本月日历 203 | }, 204 | 205 | bindFloorPickerChange: function (e) { 206 | this.data.floor.forEach((ele, index) => { 207 | // if(ele == casArray[e.detail.value]){ 208 | // code = ele.code 209 | // } 210 | }); 211 | this.setData({ 212 | floorIndex: e.detail.value, 213 | }) 214 | }, 215 | 216 | bindRoomPickerChange: function (e) { 217 | this.data.room.forEach((ele, index) => { 218 | // if(ele.school == casArray[e.detail.value]){ 219 | // code = ele.code 220 | // } 221 | }); 222 | this.setData({ 223 | roomIndex: e.detail.value, 224 | }) 225 | }, 226 | 227 | // 阻止蒙层下滚动 228 | preventD(){ 229 | 230 | }, 231 | 232 | showDate(){ 233 | var _this = this; 234 | 235 | var animation = wx.createAnimation({ 236 | duration: 200, 237 | timingFunction: "linear", 238 | delay: 0 239 | }); 240 | _this.animation = animation; 241 | animation.translateY(animationShowHeight).step(); 242 | 243 | _this.setData({ 244 | animationData: animation.export(), 245 | showDate: !this.data.showDate 246 | }); 247 | 248 | setTimeout(function () { 249 | animation.translateY(0).step() 250 | _this.setData({ 251 | animationData: animation.export() 252 | }) 253 | }.bind(_this), 200); 254 | }, 255 | 256 | closeDateMask(){ 257 | var _this = this; 258 | var animation = wx.createAnimation({ 259 | duration: 200, 260 | timingFunction: "linear", 261 | delay: 0 262 | }); 263 | 264 | _this.animation = animation; 265 | animation.translateY(animationShowHeight).step(); 266 | 267 | _this.setData({ 268 | animationData: animation.export(), 269 | }); 270 | 271 | setTimeout(function () { 272 | animation.translateY(0).step(); 273 | _this.setData({ 274 | animationData: animation.export(), 275 | showDate: false 276 | }) 277 | }.bind(_this), 200); 278 | }, 279 | 280 | // 获取月日历 281 | fetchMonthData(year, month) { 282 | var year = year ? year : this.data.year; 283 | var month = month ? month : this.data.month; 284 | 285 | var ret = [] 286 | 287 | var firstDay = new Date(year, month -1, 1) 288 | var firstDayWeekDay = firstDay.getDay() 289 | if(firstDayWeekDay === 0) firstDayWeekDay = 7 290 | 291 | var lastDayLastMonth = new Date(year , month -1, 0) 292 | var lastDayOfLastMonth = lastDayLastMonth.getDate() 293 | 294 | var preMonthDayCount = firstDayWeekDay - 1 295 | 296 | var lastDay = new Date(year, month , 0); 297 | var lastDate = lastDay.getDate() 298 | 299 | for(var i=0; i<7*6; i++){ 300 | var date = i + 1 - preMonthDayCount; 301 | var showDate = date 302 | var thisMonth = month 303 | 304 | // 上一月 305 | if(date <= 0){ 306 | thisMonth = month -1 307 | showDate = lastDayOfLastMonth + date 308 | } 309 | // 下一月 310 | else if (date > lastDate) { 311 | thisMonth = month + 1 312 | showDate = showDate - lastDate 313 | }; 314 | 315 | if(thisMonth === 0) thisMonth = 12 316 | if(thisMonth === 13) thisMonth = 1 317 | 318 | ret.push(showDate) 319 | } 320 | 321 | var arr = [] 322 | 323 | // 去除非本月日历 324 | ret.forEach((element, index) =>{ 325 | if(index < preMonthDayCount){ 326 | element = '' 327 | }else if(index >20 && element <15){ 328 | element = '' 329 | } 330 | arr.push(element) 331 | }) 332 | 333 | this.setData({ 334 | currentMonthList: arr 335 | }) 336 | }, 337 | 338 | chooseDay(e){ 339 | let item = e.currentTarget.dataset.choosed 340 | if(item < this.data.day && this.data.currentMonth == this.data.month){ 341 | return 342 | }else{ 343 | this.setData({ 344 | day: item 345 | }) 346 | } 347 | }, 348 | 349 | changeMonth(e){ 350 | let type = e.currentTarget.dataset.type 351 | 352 | if(type-0){ 353 | this.setData({ 354 | year: this.data.month == 12 ? this.data.year + 1 : this.data.year, 355 | month: this.data.month == 12 ? 1 : this.data.month + 1, 356 | day: 1 357 | }) 358 | this.fetchMonthData() 359 | }else{ 360 | if(this.data.currentMonth < this.data.month){ 361 | this.setData({ 362 | month: this.data.month - 1, 363 | day: 1 364 | }) 365 | this.fetchMonthData() 366 | } 367 | } 368 | }, 369 | 370 | bindDateChange: function (e) { 371 | this.setData({ 372 | dates: e.detail.value 373 | }) 374 | }, 375 | 376 | confirm(e){ 377 | wx.navigateTo({ 378 | url: "/src/page/order/create/seat/confirm/index" 379 | }) 380 | } 381 | }) -------------------------------------------------------------------------------- /src/page/order/create/seat/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "座位预约", 7 | "enablePullDownRefresh": false 8 | } 9 | -------------------------------------------------------------------------------- /src/page/order/create/seat/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{dates}} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 选择楼层: 19 | 20 | 21 | 22 | {{floor[floorIndex]}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 选择房间: 30 | 31 | 32 | 33 | {{room[roomIndex]}} 34 | 35 | 36 | 37 | 38 | 39 | 40 | 座位预约情况: 41 | 42 | 有人空闲已预约 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {{i.name}} 57 | 58 | {{item.name}} 59 | 60 | {{j.name}} 67 | 68 | 69 | 70 | 71 | 72 | 92 | 93 | -------------------------------------------------------------------------------- /src/page/order/create/seat/index/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4 3 | } 4 | 5 | .createSeatIndex{ 6 | padding-top: 110rpx; 7 | } 8 | .top-date{ 9 | display: flex; 10 | height: 89rpx; 11 | line-height: 89rpx; 12 | text-align: center; 13 | background: #fff; 14 | border-top: 0.5rpx solid #3d667a; 15 | position: fixed; 16 | left: 0; 17 | top: 0; 18 | width: 100%; 19 | opacity: 1; 20 | z-index: 999; 21 | } 22 | .top-date .icon-left, .top-date .icon-right2{ 23 | width: 79rpx; 24 | height: 100%; 25 | font-size: 28rpx; 26 | color: #6c6c6c; 27 | } 28 | .top-date .icon-disable{ 29 | color: #aeaeae; 30 | } 31 | .top-date-title{ 32 | flex: 1; 33 | font-size: 36rpx; 34 | color: #535353; 35 | display: flex; 36 | justify-content: center; 37 | } 38 | .top-date-title .icon-date{ 39 | font-size: 32rpx; 40 | color: #3d667a; 41 | margin-right: 10rpx; 42 | vertical-align: 3%; 43 | } 44 | .top-date-title .icon-down,.top-date-title .icon-top{ 45 | font-size: 28rpx; 46 | color: #6c6c6c; 47 | margin-left: 10rpx; 48 | } 49 | 50 | .pick-contain{ 51 | background: #fff; 52 | padding: 20rpx 28rpx 25rpx 28rpx; 53 | color: #535353; 54 | font-size: 30rpx; 55 | } 56 | .floor, .room{ 57 | display: flex; 58 | height: 66rpx; 59 | line-height: 66rpx; 60 | margin-bottom: 25rpx; 61 | } 62 | .room{ 63 | margin-bottom: 41rpx; 64 | } 65 | .label{ 66 | margin-right: 39rpx; 67 | color: #535353; 68 | font-size: 30rpx; 69 | } 70 | .pick-result{ 71 | border: solid 1px #d1d1d1; 72 | width: 310rpx; 73 | padding: 0 20rpx; 74 | border-radius: 5rpx; 75 | box-sizing: border-box; 76 | position: relative; 77 | } 78 | .pick-result .iconfont{ 79 | position: absolute; 80 | right: 20rpx; 81 | top: 50%; 82 | transform: translateY(-50%); 83 | color: #3f3f3f; 84 | font-size: 24rpx; 85 | } 86 | 87 | .color-box{ 88 | text-align: center; 89 | height: 50rpx; 90 | line-height: 50rpx; 91 | font-size: 24rpx; 92 | color: #868686; 93 | } 94 | .color-box i{ 95 | height: 50rpx; 96 | width: 50rpx; 97 | border-radius: 5rpx; 98 | vertical-align: -30%; 99 | display: inline-block; 100 | } 101 | .color-box i:first-child{ 102 | margin: 0 20rpx 0 8rpx; 103 | } 104 | .color-box i:nth-child(2){ 105 | margin: 0 20rpx 0 8rpx; 106 | } 107 | .color-box i:last-child{ 108 | margin-left: 8rpx; 109 | } 110 | 111 | .situation .label{ 112 | height: 30rpx; 113 | line-height: 30rpx; 114 | margin-bottom: 20rpx; 115 | } 116 | 117 | .picker{ 118 | height: 100%; 119 | } 120 | 121 | .status0{ 122 | background-color: #77c499; 123 | border: solid 1px #5ba57b; 124 | } 125 | .status1{ 126 | background-color: rgba(246, 208, 106, 0.7); 127 | border: solid 1px rgba(218, 186, 101, 0.7); 128 | } 129 | .status2{ 130 | background-color: rgba(75, 144, 177, 0.7); 131 | border: solid 1px rgba(80, 135, 161, 0.7); 132 | } 133 | 134 | .seat-contain{ 135 | padding: 0 55rpx 97rpx 55rpx; 136 | display: flex; 137 | flex-wrap: wrap; 138 | } 139 | .seat-contain .item{ 140 | width: 47%; 141 | text-align: center; 142 | margin-top: 57rpx; 143 | } 144 | .seat-contain .item:nth-child(2n+1){ 145 | margin-right: 6%; 146 | } 147 | .seat-contain .item .table{ 148 | height: 110rpx; 149 | line-height: 110rpx; 150 | background: #fff; 151 | border: solid .5rpx #b2b2b2; 152 | border-radius: 6rpx; 153 | margin: 20rpx 0; 154 | font-size: 36rpx; 155 | color: #868686; 156 | } 157 | .top, .bottom{ 158 | display: flex; 159 | justify-content: space-between; 160 | padding: 0 35rpx; 161 | box-sizing: border-box; 162 | } 163 | .seat-item{ 164 | height: 35rpx; 165 | line-height: 35rpx; 166 | width: 80rpx; 167 | text-align: center; 168 | color: #fff; 169 | font-size: 24rpx; 170 | } 171 | 172 | 173 | .date-mask{ 174 | position: fixed; 175 | left: 0; 176 | top: 90rpx; 177 | width: 100%; 178 | height: 120%; 179 | z-index: 20000; 180 | background-color:rgba(15, 15, 26, 0.7); 181 | text-align: center; 182 | } 183 | .date-contain{ 184 | background: #fff; 185 | } 186 | .week-box{ 187 | height: 48rpx; 188 | line-height: 48rpx; 189 | background: #F9F9F9; 190 | width: 100%; 191 | } 192 | .week-item{ 193 | display: inline-block; 194 | width: 14.286%; 195 | text-align: center; 196 | font-size: 12pt; 197 | color: #333; 198 | } 199 | .on{ 200 | background: #FD834B; 201 | color: #fff; 202 | } 203 | .month{ 204 | background: #fff; 205 | margin-top: 60rpx; 206 | } 207 | .month-title{ 208 | font-weight: 300; 209 | font-family: PingFangSC-Medium; 210 | font-size: 1rem; 211 | color: #000; 212 | text-align: right; 213 | padding: 0 .43rem .26rem 0; 214 | line-height: 1.4rem; 215 | box-sizing: border-box; 216 | } 217 | .month-title:after{ 218 | left: 85%; 219 | width: 15%; 220 | } 221 | .month-item .month-item-box{ 222 | margin-top: .175rem; 223 | display: inline-block; 224 | width: 14.286%; 225 | text-align: center; 226 | font-size: .6rem; 227 | color: #333; 228 | padding-bottom: .15rem; 229 | } 230 | .num{ 231 | font-size: 1.3rem; 232 | line-height: 1.7rem; 233 | margin-top: .25rem; 234 | color: #000; 235 | height: 80rpx; 236 | position: relative; 237 | } 238 | .num-item{ 239 | width: 1.7rem; 240 | border-radius: 50%; 241 | margin: 0 auto; 242 | } 243 | .disable{ 244 | color: #dedede; 245 | } -------------------------------------------------------------------------------- /src/page/order/create/space/index/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | let animationShowHeight = 300; 3 | Page({ 4 | data: { 5 | floor: ['1F','2F','3F','4F','5F','6F'], 6 | floorIndex: 0, 7 | spaceList: [{ 8 | id: 1, 9 | name: '阅览室C101', 10 | timeList: [{ 11 | id: 1, 12 | time: '8:00', 13 | status: 0 // 0过期/关闭, 1未预约, 2已预约 14 | },{ 15 | id: 1, 16 | time: '9:00', 17 | status: 0 // 0过期/关闭, 1未预约, 2已预约 18 | },{ 19 | id: 1, 20 | time: '10:00', 21 | status: 0 // 0过期/关闭, 1未预约, 2已预约 22 | },{ 23 | id: 1, 24 | time: '11:00', 25 | status: 0 // 0过期/关闭, 1未预约, 2已预约 26 | },{ 27 | id: 1, 28 | time: '12:00', 29 | status: 2 // 0过期/关闭, 1未预约, 2已预约 30 | },{ 31 | id: 1, 32 | time: '13:00', 33 | status: 2 // 0过期/关闭, 1未预约, 2已预约 34 | },{ 35 | id: 1, 36 | time: '14:00', 37 | status: 2 // 0过期/关闭, 1未预约, 2已预约 38 | },{ 39 | id: 1, 40 | time: '15:00', 41 | status: 2 // 0过期/关闭, 1未预约, 2已预约 42 | },{ 43 | id: 1, 44 | time: '16:00', 45 | status: 2 // 0过期/关闭, 1未预约, 2已预约 46 | },{ 47 | id: 1, 48 | time: '17:00', 49 | status: 0 // 0过期/关闭, 1未预约, 2已预约 50 | },{ 51 | id: 1, 52 | time: '18:00', 53 | status: 0 // 0过期/关闭, 1未预约, 2已预约 54 | },{ 55 | id: 1, 56 | time: '19:00', 57 | status: 1 // 0过期/关闭, 1未预约, 2已预约 58 | },{ 59 | id: 1, 60 | time: '20:00', 61 | status: 1 // 0过期/关闭, 1未预约, 2已预约 62 | },{ 63 | id: 1, 64 | time: '21:00', 65 | status: 1 // 0过期/关闭, 1未预约, 2已预约 66 | }] 67 | },{ 68 | id: 1, 69 | name: '阅览室B103', 70 | timeList: [{ 71 | id: 1, 72 | time: '8:00', 73 | status: 0 // 0过期/关闭, 1未预约, 2已预约 74 | },{ 75 | id: 1, 76 | time: '9:00', 77 | status: 0 // 0过期/关闭, 1未预约, 2已预约 78 | },{ 79 | id: 1, 80 | time: '10:00', 81 | status: 0 // 0过期/关闭, 1未预约, 2已预约 82 | },{ 83 | id: 1, 84 | time: '11:00', 85 | status: 0 // 0过期/关闭, 1未预约, 2已预约 86 | },{ 87 | id: 1, 88 | time: '12:00', 89 | status: 1 // 0过期/关闭, 1未预约, 2已预约 90 | },{ 91 | id: 1, 92 | time: '13:00', 93 | status: 1 // 0过期/关闭, 1未预约, 2已预约 94 | },{ 95 | id: 1, 96 | time: '14:00', 97 | status: 0 // 0过期/关闭, 1未预约, 2已预约 98 | },{ 99 | id: 1, 100 | time: '15:00', 101 | status: 0 // 0过期/关闭, 1未预约, 2已预约 102 | },{ 103 | id: 1, 104 | time: '16:00', 105 | status: 1 // 0过期/关闭, 1未预约, 2已预约 106 | },{ 107 | id: 1, 108 | time: '17:00', 109 | status: 1 // 0过期/关闭, 1未预约, 2已预约 110 | },{ 111 | id: 1, 112 | time: '18:00', 113 | status: 1 // 0过期/关闭, 1未预约, 2已预约 114 | },{ 115 | id: 1, 116 | time: '19:00', 117 | status: 2 // 0过期/关闭, 1未预约, 2已预约 118 | },{ 119 | id: 1, 120 | time: '20:00', 121 | status: 2 // 0过期/关闭, 1未预约, 2已预约 122 | },{ 123 | id: 1, 124 | time: '21:00', 125 | status: 2 // 0过期/关闭, 1未预约, 2已预约 126 | }] 127 | }], 128 | dates: '', 129 | }, 130 | 131 | onLoad: function (options) { 132 | var today = new Date(); // 获取当日日历 133 | var year = today.getFullYear(), 134 | month = today.getMonth() + 1, 135 | day = today.getDate(); 136 | 137 | this.setData({ 138 | dates: year + '-' + month + '-' + day 139 | }) 140 | }, 141 | 142 | bindFloorPickerChange: function (e) { 143 | this.data.floor.forEach((ele, index) => { 144 | // if(ele == casArray[e.detail.value]){ 145 | // code = ele.code 146 | // } 147 | }); 148 | this.setData({ 149 | floorIndex: e.detail.value, 150 | }) 151 | }, 152 | 153 | bindDateChange: function (e) { 154 | this.setData({ 155 | dates: e.detail.value 156 | }) 157 | }, 158 | }) -------------------------------------------------------------------------------- /src/page/order/create/space/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "空间预约", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/order/create/space/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{dates}} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 选择楼层: 19 | 20 | 21 | 22 | {{floor[floorIndex]}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 空间预约情况: 31 | 32 | 过期/关闭未预约已预约 33 | 34 | 35 | 36 | 37 | 38 | 39 | /{{item.name}}/ 40 | 41 | {{i.time}} 47 | 48 | 49 | 预约 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/page/order/create/space/index/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4 3 | } 4 | 5 | .createSeatIndex{ 6 | padding-top: 110rpx; 7 | } 8 | .top-date{ 9 | display: flex; 10 | height: 89rpx; 11 | line-height: 89rpx; 12 | text-align: center; 13 | background: #fff; 14 | border-top: 0.5rpx solid #3d667a; 15 | position: fixed; 16 | left: 0; 17 | top: 0; 18 | width: 100%; 19 | opacity: 1; 20 | z-index: 999; 21 | } 22 | .top-date .icon-left, .top-date .icon-right2{ 23 | width: 79rpx; 24 | height: 100%; 25 | font-size: 28rpx; 26 | color: #6c6c6c; 27 | } 28 | .top-date .icon-disable{ 29 | color: #aeaeae; 30 | } 31 | .top-date-title{ 32 | flex: 1; 33 | font-size: 36rpx; 34 | color: #535353; 35 | display: flex; 36 | justify-content: center; 37 | } 38 | .top-date-title .icon-date{ 39 | font-size: 32rpx; 40 | color: #3d667a; 41 | margin-right: 10rpx; 42 | vertical-align: 3%; 43 | } 44 | .top-date-title .icon-down,.top-date-title .icon-top{ 45 | font-size: 28rpx; 46 | color: #6c6c6c; 47 | margin-left: 10rpx; 48 | } 49 | 50 | .pick-contain{ 51 | background: #fff; 52 | padding: 20rpx 28rpx 25rpx 28rpx; 53 | color: #535353; 54 | font-size: 30rpx; 55 | } 56 | .floor, .room{ 57 | display: flex; 58 | height: 66rpx; 59 | line-height: 66rpx; 60 | margin-bottom: 25rpx; 61 | } 62 | .room{ 63 | margin-bottom: 41rpx; 64 | } 65 | .label{ 66 | margin-right: 39rpx; 67 | color: #535353; 68 | font-size: 30rpx; 69 | } 70 | .pick-result{ 71 | border: solid 1px #d1d1d1; 72 | width: 310rpx; 73 | padding: 0 20rpx; 74 | border-radius: 5rpx; 75 | box-sizing: border-box; 76 | position: relative; 77 | } 78 | .pick-result .iconfont{ 79 | position: absolute; 80 | right: 20rpx; 81 | top: 50%; 82 | transform: translateY(-50%); 83 | color: #3f3f3f; 84 | font-size: 24rpx; 85 | } 86 | 87 | .color-box{ 88 | text-align: center; 89 | height: 50rpx; 90 | line-height: 50rpx; 91 | font-size: 24rpx; 92 | color: #868686; 93 | } 94 | .color-box i{ 95 | height: 50rpx; 96 | width: 50rpx; 97 | border-radius: 5rpx; 98 | vertical-align: -30%; 99 | display: inline-block; 100 | } 101 | .color-box i:first-child{ 102 | margin: 0 20rpx 0 8rpx; 103 | } 104 | .color-box i:nth-child(2){ 105 | margin: 0 20rpx 0 8rpx; 106 | } 107 | .color-box i:last-child{ 108 | margin-left: 8rpx; 109 | } 110 | 111 | .situation .label{ 112 | height: 30rpx; 113 | line-height: 30rpx; 114 | margin-bottom: 20rpx; 115 | } 116 | 117 | .picker{ 118 | height: 100%; 119 | } 120 | 121 | .status0{ 122 | background-color: #f4f4f4; 123 | border: solid 1px #d9d9d9; 124 | } 125 | .status1{ 126 | background-color: rgba(246, 208, 106, 0.7); 127 | border: solid 1px rgba(218, 186, 101, 0.7); 128 | } 129 | .status2{ 130 | background-color: rgba(75, 144, 177, 0.7); 131 | border: solid 1px rgba(80, 135, 161, 0.7); 132 | } 133 | 134 | .seat-contain{ 135 | background: #fff; 136 | padding-bottom: 59rpx; 137 | } 138 | .item{ 139 | border-top: solid .5rpx #ddd; 140 | } 141 | .item .title{ 142 | height: 65rpx; 143 | line-height: 65rpx; 144 | text-align: center; 145 | background: #fff; 146 | font-size: 30rpx; 147 | color: #353535; 148 | } 149 | .item .title i{ 150 | color: #81b1c8; 151 | font-weight: 800; 152 | } 153 | .item .title i:first-child{ 154 | margin-right: 17rpx; 155 | } 156 | .item .title i:last-child{ 157 | margin-left: 17rpx; 158 | } 159 | .item .time{ 160 | display: flex; 161 | flex-wrap: wrap; 162 | padding: 0 24rpx; 163 | } 164 | .item .time .time-item{ 165 | width: 16.15%; 166 | height: 0; 167 | padding-bottom: 16.15%; 168 | color: #3f3f3f; 169 | font-size: 24rpx; 170 | border: solid .5rpx #d9d9d9; 171 | position: relative; 172 | } 173 | .time-item-text{ 174 | position: absolute; 175 | left: 10rpx; 176 | top: 10rpx; 177 | } 178 | 179 | .btn{ 180 | width: 200rpx; 181 | height: 66rpx; 182 | line-height: 66rpx; 183 | text-align: center; 184 | font-size: 24rpx; 185 | color: #c9c9c9; 186 | border: solid 1px #c9c9c9; 187 | margin: 26rpx auto; 188 | } 189 | .item .time .time-item{ 190 | border-right: none; 191 | border-bottom: none; 192 | } 193 | .item .time .time-item:nth-child(6n),.item .time .time-item:last-child{ 194 | border-right: solid .5rpx #d9d9d9; 195 | } 196 | .item .time .time-item:nth-child(9), 197 | .item .time .time-item:nth-child(10), 198 | .item .time .time-item:nth-child(11), 199 | .item .time .time-item:nth-child(12), 200 | .item .time .time-item:nth-child(13), 201 | .item .time .time-item:nth-child(14){ 202 | border-bottom: solid .5rpx #d9d9d9; 203 | } 204 | 205 | /*.item .time .status0{ 206 | border-color: #f4f4f4; 207 | } 208 | .item .time .status1{ 209 | border-color: rgba(218, 186, 101, 0.7); 210 | } 211 | .item .time .status2{ 212 | border-color: rgba(75, 144, 177, 0.7); 213 | }*/ 214 | 215 | .disable{ 216 | color: #dedede; 217 | } -------------------------------------------------------------------------------- /src/page/order/index/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | 4 | }, 5 | 6 | onLoad: function (options) { 7 | 8 | }, 9 | 10 | goToDetail(e){ 11 | // type 1为当前预约, 2为历史预约, 3为违纪预约 12 | // status 1为所有预约, 2为座位预约, 3为空间预约, 4为讲座预约 13 | let type = e.currentTarget.dataset.type; 14 | let status = e.currentTarget.dataset.status; 15 | 16 | let url = '' 17 | switch (type) { 18 | case 1: 19 | url = `/src/page/order/listCurrent/index?type=${type}&status=${status}` 20 | break; 21 | default: 22 | url = `/src/page/order/list/index?type=${type}&status=${status}` 23 | break; 24 | } 25 | 26 | wx.navigateTo({ 27 | url: url 28 | }) 29 | } 30 | }) -------------------------------------------------------------------------------- /src/page/order/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "我的预约", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/order/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 当前预约 4 | 5 | 6 | 10 | 所有预约 11 | 12 | 13 | 17 | 座位预约 18 | 19 | 20 | 24 | 空间预约 25 | 26 | 27 | 31 | 讲座预约 32 | 33 | 34 | 35 | 36 | 37 | 历史预约 38 | 39 | 40 | 44 | 所有预约 45 | 46 | 47 | 51 | 座位预约 52 | 53 | 54 | 58 | 空间预约 59 | 60 | 61 | 65 | 讲座预约 66 | 67 | 68 | 69 | 70 | 71 | 违纪预约 72 | 73 | 74 | 78 | 所有预约 79 | 80 | 81 | 85 | 座位预约 86 | 87 | 88 | 92 | 空间预约 93 | 94 | 95 | 99 | 讲座预约 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/page/order/index/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f7f7f7; 3 | } 4 | .myOrder{ 5 | padding-top: 20rpx; 6 | border-top: 0.5rpx solid #3d667a; 7 | } 8 | 9 | .item{ 10 | padding: 25rpx 24rpx 0 24rpx; 11 | background: #fff; 12 | text-align: center; 13 | font-size: 24rpx; 14 | } 15 | 16 | .title{ 17 | height: 56rpx; 18 | line-height: 56rpx; 19 | width: 140rpx; 20 | color: #fff; 21 | border-radius: 5px 27px 27px 10px; 22 | margin-bottom: 29rpx; 23 | } 24 | 25 | .item:first-child .title{ 26 | background-color: #76a5bd; 27 | } 28 | .item:nth-child(2) .title{ 29 | background-color: #e0c788; 30 | } 31 | .item:last-child .title{ 32 | background-color: #e09a88; 33 | } 34 | 35 | .item-content{ 36 | display: flex; 37 | border-bottom: 0.5rpx solid #ddd; 38 | padding-bottom: 24rpx; 39 | } 40 | 41 | .item:last-child .item-content{ 42 | border-bottom: none; 43 | } 44 | .item-detail{ 45 | width: 25%; 46 | color: #535353; 47 | } 48 | 49 | .img{ 50 | width: 40rpx; 51 | height: 40rpx; 52 | } -------------------------------------------------------------------------------- /src/page/order/list/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | type: null, 5 | num: null, 6 | list: [] 7 | }, 8 | 9 | onLoad: function (options) { 10 | let type = options.type, 11 | status = options.status; 12 | 13 | let list = [{ 14 | type: 0, // 0空间预约, 1座位预约, 2讲座预约 15 | cutOffTime: '10:20:35', 16 | address: '巴南校区图书馆2F阅览室C202-015D', 17 | time: '2018-05-15 12:00-15:30', 18 | number: 'sqxqtsg220180515C202015D24', 19 | status: 0, // 0已完成, 1取消预约成功, 2已违规 20 | reason: '未签离' 21 | },{ 22 | type: 1, // 0空间预约, 1座位预约, 2讲座预约 23 | cutOffTime: '10:20:35', 24 | address: '巴南校区图书馆2F阅览室C202-015D', 25 | time: '2018-05-15 12:00-15:30', 26 | number: 'sqxqtsg220180515C202015D24', 27 | status: 1, // 0已完成, 1取消预约成功, 2已违规 28 | reason: '未签离' 29 | },{ 30 | type: 2, // 0空间预约, 1座位预约, 2讲座预约 31 | cutOffTime: '10:20:35', 32 | address: '巴南校区图书馆2F阅览室C202-015D', 33 | time: '2018-05-15 12:00-15:30', 34 | number: 'sqxqtsg220180515C202015D24', 35 | status: 2, // 0已完成, 1取消预约成功, 2已违规 36 | reason: '未签离' 37 | },{ 38 | type: 0, // 0空间预约, 1座位预约, 2讲座预约 39 | cutOffTime: '10:20:35', 40 | address: '巴南校区图书馆2F阅览室C202-015D', 41 | time: '2018-05-15 12:00-15:30', 42 | number: 'sqxqtsg220180515C202015D24', 43 | status: 1, // 0已完成, 1取消预约成功, 2已违规 44 | reason: '未签离' 45 | },{ 46 | type: 0, // 0空间预约, 1座位预约, 2讲座预约 47 | cutOffTime: '10:20:35', 48 | address: '巴南校区图书馆2F阅览室C202-015D', 49 | time: '2018-05-15 12:00-15:30', 50 | number: 'sqxqtsg220180515C202015D24', 51 | status: 2, // 0已完成, 1取消预约成功, 2已违规 52 | reason: '未签离' 53 | }] 54 | 55 | this.setData({ 56 | list : list, 57 | type: options.type || 2, 58 | status: options.status || 1, 59 | num: 12 60 | }) 61 | } 62 | }) -------------------------------------------------------------------------------- /src/page/order/list/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "我的预约" 7 | } -------------------------------------------------------------------------------- /src/page/order/list/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{['当前预约','历史预约','违纪预约'][type-1]}}>{{['所有预约','座位预约','空间预约','讲座预约'][status-1]}} 4 | {{num}}条预约信息 5 | 6 | 7 | 8 | 9 | 10 | {{['空间预约','座位预约','讲座预约'][item.type]}} 11 | 12 | 距签离205045 13 | 14 | 15 | 16 | 17 | 预约位置:{{item.address}} 18 | 预约时间:{{item.time}} 19 | 预约编号:{{item.number}} 20 | 预约状态:{{['已完成','取消预约成功','已违规'][item.status]}} 21 | 预约原因:{{item.reason}} 22 | 23 | 24 | 25 | 26 | 签到 27 | 取消预约 28 | 29 | 30 | 签离 31 | 32 | 33 | 完成 34 | 35 | 36 | 签到 37 | 签离 38 | 39 | 40 | 完成 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/page/order/list/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f7f7f7; 3 | } 4 | 5 | .orderListAll{ 6 | border-top: 0.5rpx solid #3d667a; 7 | } 8 | 9 | .title{ 10 | margin: 20rpx 0; 11 | padding: 0 24rpx; 12 | height: 77rpx; 13 | line-height: 77rpx; 14 | display: flex; 15 | justify-content: space-between; 16 | font-size: 30rpx; 17 | color: #4b4b4b; 18 | background: #fff; 19 | } 20 | 21 | .num{ 22 | color: #727272; 23 | font-size: 24rpx; 24 | } 25 | 26 | .num i{ 27 | color: #dc2121; 28 | } 29 | 30 | .item{ 31 | padding: 0 24rpx 41rpx 24rpx; 32 | margin-bottom: 20rpx; 33 | background: #fff; 34 | } 35 | .item-title{ 36 | display: flex; 37 | justify-content: space-between; 38 | margin-bottom: 19rpx; 39 | } 40 | 41 | .item-title-type{ 42 | width: 170rpx; 43 | height: 59rpx; 44 | line-height: 59rpx; 45 | border-radius: 0px 10px 25px 5px; 46 | color: #fff; 47 | font-size: 30rpx; 48 | text-align: center; 49 | } 50 | 51 | .item-title-type0{ 52 | background-color: #418a61; 53 | } 54 | .item-title-type1{ 55 | background-color: #3d667a; 56 | } 57 | .item-title-type2{ 58 | background-color: #fcd667; 59 | } 60 | 61 | .item-title-countDown{ 62 | color: #535353; 63 | font-size: 28rpx; 64 | margin-top: 8rpx; 65 | } 66 | .item-title-countDown i{ 67 | width: 44rpx; 68 | height: 44rpx; 69 | line-height: 44rpx; 70 | text-align: center; 71 | display: inline-block; 72 | border-radius: 50%; 73 | font-size: 24rpx; 74 | color: #fff; 75 | margin-left: 18rpx; 76 | position: relative; 77 | } 78 | .item-title-countDown i:after{ 79 | position: absolute; 80 | right: -14rpx; 81 | top: 50%; 82 | transform: translateY(-50%); 83 | content: ':'; 84 | color: #3d667a; 85 | } 86 | 87 | .item-title-countDown i:last-child:after{ 88 | position: absolute; 89 | right: -14rpx; 90 | top: 50%; 91 | transform: translateY(-50%); 92 | content: ''; 93 | } 94 | 95 | .content-item{ 96 | font-size: 28rpx; 97 | color: #7d7d7d; 98 | margin-bottom: 5rpx; 99 | padding: 0 20rpx; 100 | } 101 | 102 | .content-item i{ 103 | color: #4b4b4b; 104 | } 105 | 106 | .content-item .reason{ 107 | color: #dc2121; 108 | } 109 | 110 | .content-item i{ 111 | color: #e0c788; 112 | } 113 | 114 | .btn{ 115 | display: flex; 116 | justify-content: space-between; 117 | width: 400rpx; 118 | margin: 37rpx auto 0; 119 | } 120 | 121 | .btn-item{ 122 | height: 66rpx; 123 | line-height: 66rpx; 124 | width: 180rpx; 125 | text-align: center; 126 | color: #3d667a; 127 | font-size: 24rpx; 128 | border: solid 1px #3d667a; 129 | } 130 | 131 | .btn-item2{ 132 | width: 100%; 133 | } 134 | 135 | .btn-item3{ 136 | border: solid 1px #c9c9c9; 137 | color: #c9c9c9; 138 | } -------------------------------------------------------------------------------- /src/page/order/listCurrent/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | type: null, 5 | num: null, 6 | list: [] 7 | }, 8 | 9 | onLoad: function (options) { 10 | let type = options.type, 11 | status = options.status; 12 | 13 | let list = [{ 14 | type: 0, // 0空间预约, 1座位预约, 2讲座预约 15 | cutOffTime: '10:20:35', 16 | address: '巴南校区图书馆2F阅览室C202-015D', 17 | time: '2018-05-15 12:00-15:30', 18 | number: 'sqxqtsg220180515C202015D24', 19 | status: 0, // 0预约成功, 1签到成功, 2取消预约成功, 3被动暂离, 4签离成功 20 | },{ 21 | type: 1, // 0空间预约, 1座位预约, 2讲座预约 22 | cutOffTime: '10:20:35', 23 | address: '巴南校区图书馆2F阅览室C202-015D', 24 | time: '2018-05-15 12:00-15:30', 25 | number: 'sqxqtsg220180515C202015D24', 26 | status: 1, // 0预约成功, 1签到成功, 2取消预约成功, 3被动暂离, 4签离成功 27 | },{ 28 | type: 2, // 0空间预约, 1座位预约, 2讲座预约 29 | cutOffTime: '10:20:35', 30 | address: '巴南校区图书馆2F阅览室C202-015D', 31 | time: '2018-05-15 12:00-15:30', 32 | number: 'sqxqtsg220180515C202015D24', 33 | status: 2, // 0预约成功, 1签到成功, 2取消预约成功, 3被动暂离, 4签离成功 34 | },{ 35 | type: 0, // 0空间预约, 1座位预约, 2讲座预约 36 | cutOffTime: '10:20:35', 37 | address: '巴南校区图书馆2F阅览室C202-015D', 38 | time: '2018-05-15 12:00-15:30', 39 | number: 'sqxqtsg220180515C202015D24', 40 | status: 3, // 0预约成功, 1签到成功, 2取消预约成功, 3被动暂离, 4签离成功 41 | },{ 42 | type: 0, // 0空间预约, 1座位预约, 2讲座预约 43 | cutOffTime: '10:20:35', 44 | address: '巴南校区图书馆2F阅览室C202-015D', 45 | time: '2018-05-15 12:00-15:30', 46 | number: 'sqxqtsg220180515C202015D24', 47 | status: 4, // 0预约成功, 1签到成功, 2取消预约成功, 3被动暂离, 4签离成功 48 | }] 49 | 50 | this.setData({ 51 | list : list, 52 | type: options.type || 1, 53 | status: options.status || 1, 54 | num: 12 55 | }) 56 | } 57 | }) -------------------------------------------------------------------------------- /src/page/order/listCurrent/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "我的预约" 7 | } -------------------------------------------------------------------------------- /src/page/order/listCurrent/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{['当前预约','历史预约','违纪预约'][type-1]}}>{{['所有预约','座位预约','空间预约','讲座预约'][status-1]}} 4 | {{num}}条预约信息 5 | 6 | 7 | 8 | 9 | 10 | {{['空间预约','座位预约','讲座预约'][item.type]}} 11 | 12 | 距签离205045 13 | 14 | 15 | 16 | 17 | 预约位置:{{item.address}} 18 | 预约时间:{{item.time}} 19 | 预约编号:{{item.number}} 20 | 预约状态:{{['预约成功','签到成功','取消预约成功','被动暂离','签离成功'][item.status]}} 21 | 22 | 23 | 24 | 25 | 签到 26 | 取消预约 27 | 28 | 29 | 签离 30 | 31 | 32 | 完成 33 | 34 | 35 | 签到 36 | 签离 37 | 38 | 39 | 完成 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/page/order/listCurrent/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f7f7f7; 3 | } 4 | 5 | .orderListAll{ 6 | border-top: 0.5rpx solid #3d667a; 7 | } 8 | 9 | .title{ 10 | margin: 20rpx 0; 11 | padding: 0 24rpx; 12 | height: 77rpx; 13 | line-height: 77rpx; 14 | display: flex; 15 | justify-content: space-between; 16 | font-size: 30rpx; 17 | color: #4b4b4b; 18 | background: #fff; 19 | } 20 | 21 | .num{ 22 | color: #727272; 23 | font-size: 24rpx; 24 | } 25 | 26 | .num i{ 27 | color: #dc2121; 28 | } 29 | 30 | .item{ 31 | padding: 0 24rpx 41rpx 24rpx; 32 | margin-bottom: 20rpx; 33 | background: #fff; 34 | } 35 | .item-title{ 36 | display: flex; 37 | justify-content: space-between; 38 | margin-bottom: 19rpx; 39 | } 40 | 41 | .item-title-type{ 42 | width: 170rpx; 43 | height: 59rpx; 44 | line-height: 59rpx; 45 | border-radius: 0px 10px 25px 5px; 46 | color: #fff; 47 | font-size: 30rpx; 48 | text-align: center; 49 | } 50 | 51 | .item-title-type0{ 52 | background-color: #418a61; 53 | } 54 | .item-title-type1{ 55 | background-color: #3d667a; 56 | } 57 | .item-title-type2{ 58 | background-color: #fcd667; 59 | } 60 | 61 | .item-title-countDown{ 62 | color: #535353; 63 | font-size: 28rpx; 64 | margin-top: 8rpx; 65 | } 66 | .item-title-countDown i{ 67 | width: 44rpx; 68 | height: 44rpx; 69 | line-height: 44rpx; 70 | text-align: center; 71 | display: inline-block; 72 | border-radius: 50%; 73 | font-size: 24rpx; 74 | color: #fff; 75 | margin-left: 18rpx; 76 | position: relative; 77 | } 78 | .item-title-countDown i:after{ 79 | position: absolute; 80 | right: -14rpx; 81 | top: 50%; 82 | transform: translateY(-50%); 83 | content: ':'; 84 | color: #3d667a; 85 | } 86 | 87 | .item-title-countDown i:last-child:after{ 88 | position: absolute; 89 | right: -14rpx; 90 | top: 50%; 91 | transform: translateY(-50%); 92 | content: ''; 93 | } 94 | 95 | .content-item{ 96 | font-size: 28rpx; 97 | color: #7d7d7d; 98 | margin-bottom: 5rpx; 99 | padding: 0 20rpx; 100 | } 101 | 102 | .content-item i{ 103 | color: #4b4b4b; 104 | } 105 | 106 | .content-item:last-child i{ 107 | color: #e0c788; 108 | } 109 | 110 | .btn{ 111 | display: flex; 112 | justify-content: space-between; 113 | width: 400rpx; 114 | margin: 37rpx auto 0; 115 | } 116 | 117 | .btn-item{ 118 | height: 66rpx; 119 | line-height: 66rpx; 120 | width: 180rpx; 121 | text-align: center; 122 | color: #3d667a; 123 | font-size: 24rpx; 124 | border: solid 1px #3d667a; 125 | } 126 | 127 | .btn-item2{ 128 | width: 100%; 129 | } 130 | 131 | .btn-item3{ 132 | border: solid 1px #c9c9c9; 133 | color: #c9c9c9; 134 | } -------------------------------------------------------------------------------- /src/page/order/remind/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | var app = getApp(); 3 | Page({ 4 | data:{ 5 | winHeight:"",//窗口高度 6 | currentTab:0, //预设当前项的值 7 | scrollLeft:0, //tab标题的滚动条位置 8 | list: [], 9 | isAllChecked: false, 10 | hiddenModal: true 11 | }, 12 | 13 | onLoad: function() { 14 | var that = this; 15 | // 高度自适应 16 | wx.getSystemInfo( { 17 | success: function( res ) { 18 | var clientHeight=res.windowHeight, 19 | clientWidth=res.windowWidth, 20 | rpxR=750/clientWidth; 21 | var calc=clientHeight*rpxR-180; 22 | that.setData( { 23 | winHeight: calc 24 | }); 25 | } 26 | }); 27 | 28 | let list = [{ 29 | id: 1, 30 | title: '巴南校区图书馆1F阅览室A103-001A', 31 | time: '5月14日 12:00-15:30', 32 | countDown: '00:20:45' 33 | },{ 34 | id: 2, 35 | title: '巴南校区图书馆1F阅览室A103-001A', 36 | time: '5月14日 12:00-15:30', 37 | countDown: '00:20:45' 38 | },{ 39 | id: 3, 40 | title: '巴南校区图书馆1F阅览室A103-001A', 41 | time: '5月14日 12:00-15:30', 42 | countDown: '00:20:45' 43 | },{ 44 | id: 4, 45 | title: '巴南校区图书馆1F阅览室A103-001A', 46 | time: '5月14日 12:00-15:30', 47 | countDown: '00:20:45' 48 | },{ 49 | id: 5, 50 | title: '巴南校区图书馆1F阅览室A103-001A', 51 | time: '5月14日 12:00-15:30', 52 | countDown: '00:20:45' 53 | }]; 54 | 55 | list.forEach((item,index) => { 56 | item.isChecked = false 57 | }) 58 | 59 | this.setData({ 60 | list: list 61 | }) 62 | 63 | console.log('this.data.list:',this.data.list) 64 | 65 | }, 66 | 67 | // 滚动切换标签样式 68 | switchTab:function(e){ 69 | this.setData({ 70 | currentTab:e.detail.current 71 | }); 72 | this.checkCor(); 73 | }, 74 | 75 | // 点击标题切换当前页时改变样式 76 | swichNav:function(e){ 77 | var cur=e.target.dataset.current; 78 | if(this.data.currentTaB==cur){ 79 | return 80 | }else{ 81 | this.setData({ 82 | currentTab:cur 83 | }) 84 | } 85 | }, 86 | 87 | //判断当前滚动超过一屏时,设置tab标题滚动条。 88 | checkCor:function(){ 89 | if (this.data.currentTab>4){ 90 | this.setData({ 91 | scrollLeft:300 92 | }) 93 | }else{ 94 | this.setData({ 95 | scrollLeft:0 96 | }) 97 | } 98 | }, 99 | 100 | checkItem(e){ 101 | let id = e.currentTarget.dataset.id; 102 | let list = this.data.list 103 | list.forEach((item,index)=>{ 104 | if(id == item.id){ 105 | item.isChecked = !item.isChecked 106 | } 107 | }) 108 | 109 | this.setData({ 110 | list: list 111 | }) 112 | }, 113 | 114 | // 全选 & 取消全选 115 | checkAllItem(){ 116 | let list = this.data.list 117 | let arr = list.filter((ele,i)=> ele.isChecked == true) 118 | 119 | list.forEach((item,index)=>{ 120 | item.isChecked = arr.length == list.length ? false : true 121 | }) 122 | 123 | this.setData({ 124 | list: list, 125 | isAllChecked: arr.length == list.length ? false : true 126 | }) 127 | }, 128 | 129 | cancelAllItem(){ 130 | let arr = this.data.list.filter((ele,i)=> ele.isChecked == true) 131 | if(!arr.length){ 132 | wx.showToast({ 133 | title:'请选择预约单', 134 | image: '../../../resource/images/warn.png', 135 | }) 136 | return 137 | }else{ 138 | this.setData({ 139 | hiddenModal: false 140 | }) 141 | } 142 | }, 143 | 144 | listenerConfirm(){ 145 | wx.showToast({ 146 | title:'取消成功', 147 | icon: 'success', 148 | duration: 2000, 149 | complete: () => { 150 | 151 | } 152 | }) 153 | this.setData({ 154 | hiddenModal: true 155 | }) 156 | }, 157 | 158 | listenerCancel(){ 159 | this.setData({ 160 | hiddenModal: true 161 | }) 162 | }, 163 | 164 | }) -------------------------------------------------------------------------------- /src/page/order/remind/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "消息提醒" 7 | } -------------------------------------------------------------------------------- /src/page/order/remind/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 座位预约 4 | 空间预约 5 | 讲座预约 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | {{item.title}} 23 | {{item.time}} 24 | 距离签到:{{item.countDown}} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{isAllChecked ? '取消全选' : '全选'}} 36 | 37 | 一键取消 38 | 39 | 40 | 41 | 49 | -------------------------------------------------------------------------------- /src/page/order/remind/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4; 3 | } 4 | .remind{ 5 | 6 | } 7 | .tab-h{ 8 | border-top: solid 0.5rpx #3d667a; 9 | height: 93rpx; 10 | line-height: 93rpx; 11 | width: 100%; 12 | box-sizing: border-box; 13 | overflow: hidden; 14 | background: #fff; 15 | font-size: 16px; 16 | white-space: nowrap; 17 | position: fixed; 18 | top: 0; 19 | left: 0; 20 | z-index: 99; 21 | } 22 | 23 | .tab-item{ 24 | width: 33.333%; 25 | text-align: center; 26 | display: inline-block; 27 | color: #535353; 28 | } 29 | .tab-item.active{ 30 | color: #3d667a; 31 | position: relative; 32 | } 33 | .tab-item.active:after{ 34 | content: ""; 35 | display: block; 36 | height: 4rpx; 37 | width: 100%; 38 | background: #3d667a; 39 | position: absolute; 40 | bottom: 3rpx; 41 | left: 0%; 42 | border-radius: 16rpx; 43 | } 44 | 45 | .tab-content{ 46 | margin-top: 93rpx; 47 | padding: 0 24rpx; 48 | background: #fff; 49 | } 50 | .scoll-h{ 51 | height: 100%; 52 | } 53 | 54 | .item{ 55 | position: relative; 56 | padding: 24rpx 0 24rpx 61rpx; 57 | border-bottom: 0.5rpx solid #ddd; 58 | } 59 | .item .iconfont{ 60 | position: absolute; 61 | left: 0; 62 | top: 50%; 63 | transform: translateY(-50%); 64 | font-size: 34rpx; 65 | } 66 | .item .title{ 67 | font-size: 30rpx; 68 | color: #535353; 69 | line-height: 48rpx; 70 | } 71 | 72 | .item .time{ 73 | font-size: 28rpx; 74 | color: #7d7d7d; 75 | margin: 10rpx 0; 76 | } 77 | 78 | .item .countDown{ 79 | font-size: 28rpx; 80 | color: #e0c788; 81 | } 82 | 83 | .item .countDown i{ 84 | color: #3d667a; 85 | } 86 | 87 | /*footer*/ 88 | .footer{ 89 | position: fixed; 90 | bottom: 0; 91 | left: 0; 92 | height: 88rpx; 93 | line-height: 88rpx; 94 | font-size: 30rpx; 95 | display: flex; 96 | background: #fff; 97 | width: 100%; 98 | border-top: 1rpx solid #ddd; 99 | } 100 | .footer .checkAll{ 101 | flex: 1; 102 | color: #979797; 103 | } 104 | .footer .checkAll .iconfont{ 105 | font-size: 34rpx; 106 | margin-right: 15rpx; 107 | padding-left: 24rpx; 108 | } 109 | .footer .cancel{ 110 | width: 180rpx; 111 | text-align: center; 112 | background: #3d667a; 113 | color: #fff; 114 | } 115 | 116 | .icon-circle-checked{ 117 | color: #3d667a; 118 | } -------------------------------------------------------------------------------- /src/page/user/auth/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | seatDetial: '同一时间段最多可预约两个座位', 5 | spaceDetial: '冻结', 6 | lectureDetial: '暂未开通' 7 | }, 8 | 9 | onLoad: function (options) { 10 | 11 | } 12 | }) -------------------------------------------------------------------------------- /src/page/user/auth/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "我的权限" 7 | } -------------------------------------------------------------------------------- /src/page/user/auth/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 座位预约: 4 | {{seatDetial}} 5 | 6 | 7 | 空间预约: 8 | {{spaceDetial}} 9 | 10 | 11 | 讲座预约: 12 | {{lectureDetial}} 13 | 14 | -------------------------------------------------------------------------------- /src/page/user/auth/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #fff; 3 | } 4 | 5 | .auth{ 6 | border-top: 1rpx solid #3d667a; 7 | } 8 | 9 | .item{ 10 | display: flex; 11 | font-size: 28rpx; 12 | padding-left: 23rpx; 13 | color: #535353; 14 | margin-bottom: 10rpx; 15 | } 16 | .item:first-child{ 17 | color: #252525; 18 | margin-top: 37rpx; 19 | } 20 | .item:nth-child(2){ 21 | color: #dc2121; 22 | } 23 | .item:last-child{ 24 | color: #e0c788; 25 | } 26 | -------------------------------------------------------------------------------- /src/page/user/index/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | info: {}, 5 | tagList: ['看书','旅行','唱歌','做甜点'], 6 | hiddenModal: true, 7 | showModalStatus: false, 8 | animationData: null 9 | }, 10 | 11 | onLoad: function (options) { 12 | this.setData({ 13 | info: { 14 | name: '裴亚楠', 15 | count: 13797071376, 16 | headImg: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1529048134226&di=6de431ebcec3dd10f226c433b1ed0912&imgtype=0&src=http%3A%2F%2Fimg3.duitang.com%2Fuploads%2Fitem%2F201512%2F10%2F20151210043341_NLBrX.thumb.700_0.jpeg' 17 | } 18 | }) 19 | }, 20 | 21 | setUserMsg(){ 22 | wx.navigateTo({ 23 | url: "/src/page/user/msg/index" 24 | }) 25 | }, 26 | 27 | // 我的学币 28 | goToMyMoney(){ 29 | wx.navigateTo({ 30 | url: `/src/page/user/money/index` 31 | }) 32 | }, 33 | 34 | // 我的预约码 35 | goToMyQrcode(){ 36 | wx.navigateTo({ 37 | url: `/src/page/user/qrcode/index` 38 | }) 39 | }, 40 | 41 | // 公告提醒 42 | goToNotice(){ 43 | wx.navigateTo({ 44 | url: `/src/page/user/noticeList/index` 45 | }) 46 | }, 47 | 48 | // 我的权限 49 | goToMyAuth(){ 50 | wx.navigateTo({ 51 | url: `/src/page/user/auth/index` 52 | }) 53 | }, 54 | 55 | // 修改密码 56 | changePassword(){ 57 | wx.navigateTo({ 58 | url: `/src/page/user/passwordReset/index` 59 | }) 60 | }, 61 | 62 | // 重置密码 63 | resetPassword(){ 64 | this.setData({ 65 | hiddenModal: false 66 | }) 67 | }, 68 | // 确认重置密码 69 | listenerConfirm(){ 70 | this.setData({ 71 | hiddenModal: true 72 | }) 73 | }, 74 | // 取消重置密码 75 | listenerCancel(){ 76 | this.setData({ 77 | hiddenModal: true 78 | }) 79 | }, 80 | 81 | // 绑定微信号 82 | bindWechat(){ 83 | wx.navigateTo({ 84 | url: `/src/page/user/bindWechat/index` 85 | }) 86 | }, 87 | 88 | // 切换账号 89 | changeCount(){ 90 | wx.navigateTo({ 91 | url: `/src/page/user/changeCount/index` 92 | }) 93 | }, 94 | 95 | // 客服 96 | goToServicer(){ 97 | wx.navigateTo({ 98 | url: `/src/page/user/service/index` 99 | }) 100 | }, 101 | 102 | // 退出登录,显示对话框 103 | loginOut: function () { 104 | // 显示遮罩层 105 | var animation = wx.createAnimation({ 106 | duration: 200, 107 | timingFunction: "linear", 108 | delay: 0 109 | }) 110 | this.animation = animation 111 | animation.translateY(300).step() 112 | this.setData({ 113 | animationData: animation.export(), 114 | showModalStatus: true 115 | }) 116 | setTimeout(function () { 117 | animation.translateY(0).step() 118 | this.setData({ 119 | animationData: animation.export() 120 | }) 121 | }.bind(this), 200) 122 | }, 123 | 124 | //隐藏对话框 125 | hideModal: function () { 126 | // 隐藏遮罩层 127 | var animation = wx.createAnimation({ 128 | duration: 200, 129 | timingFunction: "linear", 130 | delay: 0 131 | }) 132 | this.animation = animation 133 | animation.translateY(300).step() 134 | this.setData({ 135 | animationData: animation.export(), 136 | }) 137 | setTimeout(function () { 138 | animation.translateY(0).step() 139 | this.setData({ 140 | animationData: animation.export(), 141 | showModalStatus: false 142 | }) 143 | }.bind(this), 200) 144 | }, 145 | 146 | loginOutConfirm(){ 147 | wx.redirectTo({ 148 | url: "/src/page/home/login/index" 149 | }) 150 | this.hideModal() 151 | } 152 | }) -------------------------------------------------------------------------------- /src/page/user/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#3d667a", 5 | "navigationBarTextStyle": "light", 6 | "navigationBarTitleText": "个人", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/user/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 姓名:{{info.name}} 11 | 账号:{{info.count}} 12 | 13 | 14 | 15 | 16 | 17 | 18 | {{item}} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 我的学币 27 | 28 | 29 | 30 | 我的预约码 31 | 32 | 33 | 34 | 公告提醒 35 | 36 | 37 | 38 | 我的权限 39 | 40 | 41 | 42 | 安全设置 43 | 44 | 45 | 46 | 修改密码 47 | 48 | 49 | 50 | 恢复初始密码 51 | 52 | 53 | 54 | 账号管理 55 | 56 | 57 | 58 | 微信绑定 59 | 60 | 61 | 62 | 切换账号 63 | 64 | 65 | 66 | 退出登录 67 | 68 | 69 | 70 | 预约管理平台 71 | 72 | 73 | 74 | 客服 75 | 76 | 77 | 78 | 79 | 87 | 88 | 89 | 90 | 91 | 96 | 退出登录 97 | 取消 98 | 99 | -------------------------------------------------------------------------------- /src/page/user/index/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4 3 | } 4 | /*顶部*/ 5 | .top{ 6 | padding: 48rpx 24rpx; 7 | background-color: #3d667a; 8 | } 9 | .top .user{ 10 | display: flex; 11 | justify-content: space-between; 12 | color: #fff; 13 | font-size: 30rpx; 14 | position: relative; 15 | } 16 | .top .user .headImg{ 17 | height: 120rpx; 18 | width: 120rpx; 19 | border-radius: 50%; 20 | margin-right: 24rpx; 21 | } 22 | .top .user .msg{ 23 | flex: 1; 24 | } 25 | .top .user .msg .userName{ 26 | margin: 20rpx 0 10rpx 0; 27 | } 28 | .top .user .iconfont{ 29 | position: absolute; 30 | right: 20rpx; 31 | top: 50%; 32 | transform: translateY(-50%); 33 | font-size: 55rpx; 34 | color: #fff; 35 | } 36 | 37 | .tag-list{ 38 | padding: 0 18rpx; 39 | display: flex; 40 | margin-top: 45rpx; 41 | } 42 | .tag-list .item{ 43 | height: 40rpx; 44 | line-height: 40rpx; 45 | width: 120rpx; 46 | text-align: center; 47 | background: rgba(0, 0, 0, 0.2); 48 | color: #fff; 49 | margin-right: 20rpx; 50 | font-size: 24rpx; 51 | } 52 | 53 | .icon-list{ 54 | display: flex; 55 | color: #4b4b4b; 56 | font-size: 24rpx; 57 | background: #fff; 58 | margin-bottom: 20rpx; 59 | } 60 | .icon-list:last-child{ 61 | margin-bottom: 0; 62 | } 63 | .icon-list .iconfont{ 64 | font-size: 54rpx; 65 | color: #4b4b4b; 66 | } 67 | .icon-list .icon-item{ 68 | width: 25%; 69 | text-align: center; 70 | padding: 32rpx 0 19rpx; 71 | } 72 | .icon-list .icon-item .text{ 73 | margin-top: 30rpx; 74 | } 75 | 76 | .title{ 77 | background: #fff; 78 | font-size: 24rpx; 79 | height: 58rpx; 80 | line-height: 58rpx; 81 | padding-left: 24rpx; 82 | color: #4b4b4b; 83 | margin-bottom: -10rpx; 84 | } 85 | .icon-list .icon-money{ 86 | color: #c23030; 87 | } 88 | .icon-list .icon-qrcode{ 89 | color: #333; 90 | } 91 | .icon-list .icon-notice{ 92 | color: #255591; 93 | } 94 | .icon-list .icon-crown{ 95 | color: #e7991e; 96 | } 97 | .icon-list .icon-lock{ 98 | color: #552b8f; 99 | } 100 | .icon-list .icon-reset{ 101 | color: #599cbc; 102 | } 103 | .icon-list .icon-wechat{ 104 | color: #339629; 105 | } 106 | .icon-list .icon-change{ 107 | color: #2d4b77; 108 | } 109 | .icon-list .icon-source{ 110 | color: #207277; 111 | } 112 | .icon-list .icon-headset{ 113 | color: #33708d; 114 | } 115 | 116 | 117 | /*使屏幕变暗 */ 118 | .commodity_screen { 119 | width: 100%; 120 | height: 100%; 121 | position: fixed; 122 | top: 0; 123 | left: 0; 124 | background: #000; 125 | opacity: 0.2; 126 | overflow: hidden; 127 | z-index: 1000; 128 | color: #fff; 129 | } 130 | /*对话框 */ 131 | .commodity_attr_box { 132 | height: 177rpx; 133 | width: 100%; 134 | overflow: hidden; 135 | position: fixed; 136 | bottom: 0; 137 | left: 0; 138 | z-index: 2000; 139 | background: #fff; 140 | padding-top: 20rpx; 141 | } 142 | .commodity_attr_box .item{ 143 | height: 88rpx; 144 | line-height: 88rpx; 145 | position: relative; 146 | color: #4b4b4b; 147 | font-size: 30rpx; 148 | text-align: center; 149 | } 150 | .commodity_attr_box .confrimLogout:after{ 151 | content: ''; 152 | display: inline-block; 153 | width: 720rpx; 154 | height: 0.5rpx; 155 | background: #dedede; 156 | left: 50%; 157 | bottom: 0; 158 | transform: translateX(-50%); 159 | position: absolute; 160 | } -------------------------------------------------------------------------------- /src/page/user/money/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | info: {}, 5 | scoreList: [] 6 | }, 7 | 8 | onLoad: function (options) { 9 | this.setData({ 10 | info: { 11 | name: '许刚', 12 | id: 1, 13 | headImg: 'http://xxb.xuexunbao.com.cn/201806062227018863cfc5b771da58f0ae5acd19064476b22.jpg', 14 | count: 200 15 | }, 16 | scoreList: [{ 17 | id:1, 18 | title: '每日签到', 19 | time: '2018-5-23 08:24', 20 | score: '+30' 21 | },{ 22 | id:1, 23 | title: '座位预约', 24 | time: '2018-5-23 08:24', 25 | score: '-10' 26 | },{ 27 | id:1, 28 | title: '每日签到', 29 | time: '2018-5-23 08:24', 30 | score: '+30' 31 | },{ 32 | id:1, 33 | title: '空间预约-完成', 34 | time: '2018-5-23 08:24', 35 | score: '+30' 36 | }] 37 | }) 38 | } 39 | }) -------------------------------------------------------------------------------- /src/page/user/money/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarBackgroundColor": "#3d667a", 3 | "navigationBarTextStyle": "#fff", 4 | "navigationBarTitleText": "我的学币", 5 | "backgroundColor": "#000", 6 | "backgroundTextStyle": "light", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/user/money/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | {{info.name}} 8 | {{info.count+'学币'}} 9 | 签到 10 | 11 | 12 | 13 | 学币记录 14 | 15 | 16 | {{item.title}} 17 | {{item.score}} 18 | 19 | {{item.time}} 20 | 21 | 没有更多了 22 | 23 | -------------------------------------------------------------------------------- /src/page/user/money/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4 3 | } 4 | .top{ 5 | background-color: #3d667a; 6 | padding: 11rpx 0 71rpx 0; 7 | margin-bottom: 20rpx; 8 | text-align: center; 9 | font-size: 28rpx; 10 | color: #fff; 11 | position: relative; 12 | } 13 | .top .headImg{ 14 | width: 118rpx; 15 | height: 118rpx; 16 | border-radius: 50%; 17 | border: 9rpx solid rgba(189, 189, 189, 0.3); 18 | } 19 | 20 | .top .name{ 21 | margin: 16rpx 0; 22 | } 23 | .top .btn{ 24 | position: absolute; 25 | right: 24rpx; 26 | bottom: 14rpx; 27 | width: 124rpx; 28 | height: 44rpx; 29 | line-height: 44rpx; 30 | border: solid 1px #fcd667; 31 | color: #fcd667; 32 | border-radius: 30rpx; 33 | font-size: 24rpx; 34 | } 35 | 36 | .list{ 37 | padding: 0 24rpx; 38 | font-size: 30rpx; 39 | color: #4b4b4b; 40 | } 41 | 42 | .title{ 43 | height: 78rpx; 44 | line-height: 78rpx; 45 | padding-left: 18rpx; 46 | position: relative; 47 | } 48 | .title:after{ 49 | position: absolute; 50 | left: 0; 51 | top: 50%; 52 | width: 5rpx; 53 | height: 38rpx; 54 | transform: translateY(-50%); 55 | background-color: #4e88a5; 56 | content: ''; 57 | } 58 | 59 | .item{ 60 | padding: 27rpx 0 26rpx 0; 61 | border-bottom: 1rpx solid #dedede; 62 | } 63 | .content{ 64 | display: flex; 65 | justify-content: space-between; 66 | } 67 | .time{ 68 | font-size: 24rpx; 69 | color: #a4a4a4; 70 | } 71 | -------------------------------------------------------------------------------- /src/page/user/qrcode/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | 5 | }, 6 | 7 | onLoad: function (options) { 8 | 9 | } 10 | }) -------------------------------------------------------------------------------- /src/page/user/qrcode/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarBackgroundColor": "#3d667a", 3 | "navigationBarTextStyle": "#fff", 4 | "navigationBarTitleText": "我的预约码", 5 | "backgroundColor": "#000", 6 | "backgroundTextStyle": "light", 7 | "enablePullDownRefresh": false 8 | } -------------------------------------------------------------------------------- /src/page/user/qrcode/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 扫一扫,签到打卡,领取积分 9 | 10 | -------------------------------------------------------------------------------- /src/page/user/qrcode/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #3d667a; 3 | } 4 | 5 | .img-box{ 6 | width: 472rpx; 7 | height: 527rpx; 8 | background: #fff; 9 | margin: 270rpx auto 0; 10 | text-align: center; 11 | } 12 | 13 | .img{ 14 | width: 352rpx; 15 | height: 352rpx; 16 | margin-top: 49rpx; 17 | } 18 | .text{ 19 | margin-top: 50rpx; 20 | font-size: 30rpx; 21 | color: #4b4b4b; 22 | } 23 | -------------------------------------------------------------------------------- /src/page/user/service/index.js: -------------------------------------------------------------------------------- 1 | // import { getUserInfo } from '../../resource/utils/comment.js' 2 | Page({ 3 | data: { 4 | 5 | }, 6 | 7 | onLoad: function (options) { 8 | 9 | } 10 | }) -------------------------------------------------------------------------------- /src/page/user/service/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "backgroundTextStyle": "light", 3 | "backgroundColor":"#fff", 4 | "navigationBarBackgroundColor": "#fff", 5 | "navigationBarTextStyle": "black", 6 | "navigationBarTitleText": "客服" 7 | } -------------------------------------------------------------------------------- /src/page/user/service/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 热点问题 3 | 4 | 5 | 6 | {{item.title}} 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/page/user/service/index.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background-color: #f4f4f4 3 | } 4 | 5 | -------------------------------------------------------------------------------- /src/resource/components/toast/toast.js: -------------------------------------------------------------------------------- 1 | let _compData = { 2 | '_toast_.isHide': false, 3 | '_toast_.content': '' 4 | } 5 | 6 | let toastPannel = { 7 | show: function(data){ 8 | let self = this; 9 | this.setData({ 10 | '_toast_.isHide': true, 11 | '_toast_.content': data 12 | }) 13 | setTimeout(function(){ 14 | self.setData({ 15 | '_toast_.isHide': false 16 | }) 17 | },3000) 18 | } 19 | } 20 | 21 | function ToastPannel(){ 22 | let pages = getCurrentPages(); 23 | let curPage = pages[pages.length - 1]; 24 | this._page = curPage; 25 | 26 | Object.assign(curPage, toastPannel); 27 | 28 | curPage.toastPannel = this; 29 | 30 | curPage.setData(_compData) 31 | } 32 | 33 | module.exports = { 34 | ToastPannel 35 | } -------------------------------------------------------------------------------- /src/resource/components/toast/toast.wxml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resource/components/toast/toast.wxss: -------------------------------------------------------------------------------- 1 | /*按钮*/ 2 | .btn222 { 3 | font-size: 28rpx; 4 | padding: 15rpx 30rpx; 5 | width: 100rpx; 6 | margin: 20rpx; 7 | text-align: center; 8 | border-radius: 10rpx; 9 | border: 1px solid #000; 10 | } 11 | /*mask*/ 12 | .toast_mask { 13 | opacity: 0; 14 | width: 100%; 15 | height: 100%; 16 | overflow: hidden; 17 | position: fixed; 18 | top: 0; 19 | left: 0; 20 | z-index: 888; 21 | } 22 | /*toast*/ 23 | .toast_content_box { 24 | display: flex; 25 | width: 100%; 26 | height: 100%; 27 | justify-content: center; 28 | align-items: center; 29 | position: fixed; 30 | z-index: 999; 31 | } 32 | .toast_content { 33 | width: 50%; 34 | padding: 20rpx; 35 | background: rgba(0, 0, 0, 0.8); 36 | border-radius: 20rpx; 37 | z-index:10000; 38 | } 39 | .toast_content_text { 40 | height: 100%; 41 | width: 100%; 42 | color: #fff; 43 | font-size: 28rpx; 44 | text-align: center; 45 | } 46 | -------------------------------------------------------------------------------- /src/resource/images/bind.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/bind.jpg -------------------------------------------------------------------------------- /src/resource/images/chair1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/chair1.png -------------------------------------------------------------------------------- /src/resource/images/chair2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/chair2.png -------------------------------------------------------------------------------- /src/resource/images/chair3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/chair3.png -------------------------------------------------------------------------------- /src/resource/images/changeCount.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/changeCount.jpg -------------------------------------------------------------------------------- /src/resource/images/change_password.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/change_password.jpg -------------------------------------------------------------------------------- /src/resource/images/jiangzuo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/jiangzuo.png -------------------------------------------------------------------------------- /src/resource/images/lock1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/lock1.png -------------------------------------------------------------------------------- /src/resource/images/lock2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/lock2.png -------------------------------------------------------------------------------- /src/resource/images/lock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/lock3.png -------------------------------------------------------------------------------- /src/resource/images/login-top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/login-top.jpg -------------------------------------------------------------------------------- /src/resource/images/login_bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/login_bottom.jpg -------------------------------------------------------------------------------- /src/resource/images/nostatus1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/nostatus1.png -------------------------------------------------------------------------------- /src/resource/images/seat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/seat.png -------------------------------------------------------------------------------- /src/resource/images/seat1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/seat1.png -------------------------------------------------------------------------------- /src/resource/images/seat2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/seat2.png -------------------------------------------------------------------------------- /src/resource/images/seat3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/seat3.png -------------------------------------------------------------------------------- /src/resource/images/smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/smile.png -------------------------------------------------------------------------------- /src/resource/images/space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/space.png -------------------------------------------------------------------------------- /src/resource/images/space1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/space1.png -------------------------------------------------------------------------------- /src/resource/images/space2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/space2.png -------------------------------------------------------------------------------- /src/resource/images/space3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/space3.png -------------------------------------------------------------------------------- /src/resource/images/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/success.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/head-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/head-active.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/head.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/home-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/home-active.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/home.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/message-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/message-active.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/message.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/myreser-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/myreser-active.png -------------------------------------------------------------------------------- /src/resource/images/tabbarIcon/myreser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/tabbarIcon/myreser.png -------------------------------------------------------------------------------- /src/resource/images/user-bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/user-bg1.png -------------------------------------------------------------------------------- /src/resource/images/user-bg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/user-bg2.png -------------------------------------------------------------------------------- /src/resource/images/user-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/user-default.png -------------------------------------------------------------------------------- /src/resource/images/warn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKitty/h5-weixin-library-all/42cbde1421ef8c0a15697e5732f7d17ebf64d10c/src/resource/images/warn.png -------------------------------------------------------------------------------- /src/resource/js/base64.js: -------------------------------------------------------------------------------- 1 | function base64_encode(str) { 2 | var c1, c2, c3; 3 | var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 4 | var i = 0, len = str.length, string = ''; 5 | 6 | while (i < len) { 7 | c1 = str.charCodeAt(i++) & 0xff; 8 | if (i == len) { 9 | string += base64EncodeChars.charAt(c1 >> 2); 10 | string += base64EncodeChars.charAt((c1 & 0x3) << 4); 11 | string += "=="; 12 | break; 13 | } 14 | c2 = str.charCodeAt(i++); 15 | if (i == len) { 16 | string += base64EncodeChars.charAt(c1 >> 2); 17 | string += base64EncodeChars.charAt(((c1 & 0x3) << 4) 18 | | ((c2 & 0xF0) >> 4)); 19 | string += base64EncodeChars.charAt((c2 & 0xF) << 2); 20 | string += "="; 21 | break; 22 | } 23 | c3 = str.charCodeAt(i++); 24 | string += base64EncodeChars.charAt(c1 >> 2); 25 | string += base64EncodeChars.charAt(((c1 & 0x3) << 4) 26 | | ((c2 & 0xF0) >> 4)); 27 | string += base64EncodeChars.charAt(((c2 & 0xF) << 2) 28 | | ((c3 & 0xC0) >> 6)); 29 | string += base64EncodeChars.charAt(c3 & 0x3F) 30 | } 31 | return string 32 | } 33 | 34 | function base64_decode(str) { 35 | var c1, c2, c3, c4; 36 | var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, 39 | -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 40 | -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 41 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 42 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 | 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); 44 | var i = 0, len = str.length, string = ''; 45 | 46 | while (i < len) { 47 | do { 48 | c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff] 49 | } while (i < len && c1 == -1); 50 | 51 | if (c1 == -1) 52 | break; 53 | 54 | do { 55 | c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff] 56 | } while (i < len && c2 == -1); 57 | 58 | if (c2 == -1) 59 | break; 60 | 61 | string += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); 62 | 63 | do { 64 | c3 = str.charCodeAt(i++) & 0xff; 65 | if (c3 == 61) 66 | return string; 67 | 68 | c3 = base64DecodeChars[c3] 69 | } while (i < len && c3 == -1); 70 | 71 | if (c3 == -1) 72 | break; 73 | 74 | string += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); 75 | 76 | do { 77 | c4 = str.charCodeAt(i++) & 0xff; 78 | if (c4 == 61) 79 | return string; 80 | c4 = base64DecodeChars[c4] 81 | } while (i < len && c4 == -1); 82 | 83 | if (c4 == -1) 84 | break; 85 | 86 | string += String.fromCharCode(((c3 & 0x03) << 6) | c4) 87 | } 88 | return string; 89 | } 90 | module.exports = { 91 | 'base64_encode': base64_encode, 92 | 'base64_decode': base64_decode 93 | }; -------------------------------------------------------------------------------- /src/resource/js/htmlToWxml.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by kevenfeng on 2016/10/12. 3 | */ 4 | // Regular Expressions for parsing tags and attributes 5 | var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, 6 | endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/, 7 | attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; 8 | 9 | // Empty Elements - HTML 5 10 | var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"); 11 | 12 | // Block Elements - HTML 5 13 | var block = makeMap("a,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"); 14 | 15 | // Inline Elements - HTML 5 16 | var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,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"); 17 | 18 | // Elements that you can, intentionally, leave open 19 | // (and which close themselves) 20 | var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); 21 | 22 | // Attributes that have their values filled in disabled="disabled" 23 | var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); 24 | 25 | // Special Elements (can contain anything) 26 | var special = makeMap("script,style"); 27 | 28 | var HTMLParser = function (html, handler) { 29 | var index, chars, match, stack = [], last = html; 30 | stack.last = function () { 31 | return this[this.length - 1]; 32 | }; 33 | 34 | while (html) { 35 | chars = true; 36 | 37 | // Make sure we're not in a script or style element 38 | if (!stack.last() || !special[stack.last()]) { 39 | 40 | // Comment 41 | if (html.indexOf(""); 43 | 44 | if (index >= 0) { 45 | if (handler.comment) 46 | handler.comment(html.substring(4, index)); 47 | html = html.substring(index + 3); 48 | chars = false; 49 | } 50 | 51 | // end tag 52 | } else if (html.indexOf("]*>"), function (all, text) { 84 | text = text.replace(/|/g, "$1$2"); 85 | if (handler.chars) 86 | handler.chars(text); 87 | 88 | return ""; 89 | }); 90 | 91 | parseEndTag("", stack.last()); 92 | } 93 | 94 | if (html == last) 95 | throw "Parse Error: " + html; 96 | last = html; 97 | } 98 | 99 | // Clean up any remaining tags 100 | parseEndTag(); 101 | 102 | function parseStartTag(tag, tagName, rest, unary) { 103 | tagName = tagName.toLowerCase(); 104 | 105 | if (block[tagName]) { 106 | while (stack.last() && inline[stack.last()]) { 107 | parseEndTag("", stack.last()); 108 | } 109 | } 110 | 111 | if (closeSelf[tagName] && stack.last() == tagName) { 112 | parseEndTag("", tagName); 113 | } 114 | 115 | unary = empty[tagName] || !!unary; 116 | 117 | if (!unary) 118 | stack.push(tagName); 119 | 120 | if (handler.start) { 121 | var attrs = []; 122 | 123 | rest.replace(attr, function (match, name) { 124 | var value = arguments[2] ? arguments[2] : 125 | arguments[3] ? arguments[3] : 126 | arguments[4] ? arguments[4] : 127 | fillAttrs[name] ? name : ""; 128 | 129 | attrs.push({ 130 | name: name, 131 | value: value, 132 | escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //" 133 | }); 134 | }); 135 | 136 | if (handler.start) 137 | handler.start(tagName, attrs, unary); 138 | } 139 | } 140 | 141 | function parseEndTag(tag, tagName) { 142 | // If no tag name is provided, clean shop 143 | if (!tagName) 144 | var pos = 0; 145 | 146 | // Find the closest opened tag of the same type 147 | else 148 | for (var pos = stack.length - 1; pos >= 0; pos--) 149 | if (stack[pos] == tagName) 150 | break; 151 | 152 | if (pos >= 0) { 153 | // Close all the open elements, up the stack 154 | for (var i = stack.length - 1; i >= pos; i--) 155 | if (handler.end) 156 | handler.end(stack[i]); 157 | 158 | // Remove the open elements from the stack 159 | stack.length = pos; 160 | } 161 | } 162 | }; 163 | 164 | function makeMap(str) { 165 | var obj = {}, items = str.split(","); 166 | for (var i = 0; i < items.length; i++) 167 | obj[items[i]] = true; 168 | return obj; 169 | } 170 | var global = {}; 171 | var debug = function () { }; 172 | 173 | function q(v) { 174 | return '"' + v + '"'; 175 | } 176 | 177 | function removeDOCTYPE(html) { 178 | return html 179 | .replace(/<\?xml.*\?>\n/, '') 180 | .replace(/\n/, '') 181 | .replace(/\n/, ''); 182 | } 183 | global.html2json = function html2json(html) { 184 | html = removeDOCTYPE(html); 185 | var bufArray = []; 186 | var results = { 187 | node: 'root', 188 | child: [], 189 | }; 190 | HTMLParser(html, { 191 | start: function (tag, attrs, unary) { 192 | debug(tag, attrs, unary); 193 | // node for this element 194 | var node = { 195 | node: 'element', 196 | tag: tag, 197 | }; 198 | if (attrs.length !== 0) { 199 | node.attr = attrs.reduce(function (pre, attr) { 200 | var name = attr.name; 201 | var value = attr.value; 202 | 203 | // has multi attibutes 204 | // make it array of attribute 205 | if (value.match(/ /)) { 206 | value = value.split(' '); 207 | } 208 | 209 | // if attr already exists 210 | // merge it 211 | if (pre[name]) { 212 | if (Array.isArray(pre[name])) { 213 | // already array, push to last 214 | pre[name].push(value); 215 | } else { 216 | // single value, make it array 217 | pre[name] = [pre[name], value]; 218 | } 219 | } else { 220 | // not exist, put it 221 | pre[name] = value; 222 | } 223 | 224 | return pre; 225 | }, {}); 226 | } 227 | if (unary) { 228 | // if this tag dosen't have end tag 229 | // like 230 | // add to parents 231 | var parent = bufArray[0] || results; 232 | if (parent.child === undefined) { 233 | parent.child = []; 234 | } 235 | parent.child.push(node); 236 | } else { 237 | bufArray.unshift(node); 238 | } 239 | }, 240 | end: function (tag) { 241 | debug(tag); 242 | // merge into parent tag 243 | var node = bufArray.shift(); 244 | if (node.tag !== tag) console.error('invalid state: mismatch end tag'); 245 | 246 | if (bufArray.length === 0) { 247 | results.child.push(node); 248 | } else { 249 | var parent = bufArray[0]; 250 | if (parent.child === undefined) { 251 | parent.child = []; 252 | } 253 | parent.child.push(node); 254 | } 255 | }, 256 | chars: function (text) { 257 | debug(text); 258 | var node = { 259 | node: 'text', 260 | text: text, 261 | }; 262 | if (bufArray.length === 0) { 263 | results.child.push(node); 264 | } else { 265 | var parent = bufArray[0]; 266 | if (parent.child === undefined) { 267 | parent.child = []; 268 | } 269 | parent.child.push(node); 270 | } 271 | }, 272 | comment: function (text) { 273 | debug(text); 274 | var node = { 275 | node: 'comment', 276 | text: text, 277 | }; 278 | var parent = bufArray[0]; 279 | if (parent.child === undefined) { 280 | parent.child = []; 281 | } 282 | parent.child.push(node); 283 | }, 284 | }); 285 | return results; 286 | }; 287 | 288 | global.json2html = function json2html(json) { 289 | // Empty Elements - HTML 4.01 290 | var empty = ['area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'embed']; 291 | 292 | var child = ''; 293 | if (json.child) { 294 | child = json.child.map(function (c) { 295 | return json2html(c); 296 | }).join(''); 297 | } 298 | 299 | var attr = ''; 300 | if (json.attr) { 301 | attr = Object.keys(json.attr).map(function (key) { 302 | var value = json.attr[key]; 303 | if (Array.isArray(value)) value = value.join(' '); 304 | return key + '=' + q(value); 305 | }).join(' '); 306 | if (attr !== '') attr = ' ' + attr; 307 | } 308 | 309 | if (json.node === 'element') { 310 | var tag = json.tag; 311 | if (empty.indexOf(tag) > -1) { 312 | // empty element 313 | return '<' + json.tag + attr + '/>'; 314 | } 315 | 316 | // non empty element 317 | var open = '<' + json.tag + attr + '>'; 318 | var close = ''; 319 | return open + child + close; 320 | } 321 | 322 | if (json.node === 'text') { 323 | return json.text; 324 | } 325 | 326 | if (json.node === 'comment') { 327 | return ''; 328 | } 329 | 330 | if (json.node === 'root') { 331 | return child; 332 | } 333 | }; 334 | 335 | var html2wxwebview = function (html) { 336 | var htmlNode = global.html2json(html); 337 | htmlNode = parseHtmlNode(htmlNode); 338 | htmlNode = arrangeNode(htmlNode); 339 | 340 | return htmlNode; 341 | } 342 | //整理节点 343 | var arrangeNode = function (htmlNode) { 344 | var arrangeArray = []; 345 | var nodeObj = []; 346 | for (var i = 0, j = htmlNode.length; i < j; i++) { 347 | if (i == 0) { 348 | if (htmlNode[i].type == "view") { 349 | continue; 350 | } 351 | arrangeArray.push(htmlNode[i]); 352 | } else { 353 | if (htmlNode[i].type == "view") { 354 | if (arrangeArray.length > 0) { 355 | var obj = { 356 | type: "view", 357 | child: arrangeArray 358 | } 359 | nodeObj.push(obj); 360 | } 361 | arrangeArray = []; 362 | } else if (htmlNode[i].type == "img") { 363 | if (arrangeArray.length > 0) { 364 | var obj = { 365 | type: "view", 366 | child: arrangeArray 367 | } 368 | nodeObj.push(obj); 369 | } 370 | 371 | var attr = htmlNode[i].attr; 372 | if (htmlNode[i].attr.width && htmlNode[i].attr.width.indexOf('%') === -1 && htmlNode[i].attr.width.indexOf('px') === -1) { 373 | htmlNode[i].attr.width = htmlNode[i].attr.width + 'px' 374 | } 375 | if (htmlNode[i].attr.height && htmlNode[i].attr.height.indexOf('%') === -1 && htmlNode[i].attr.height.indexOf('px') === -1) { 376 | htmlNode[i].attr.height = htmlNode[i].attr.height + 'px' 377 | } 378 | var obj = { 379 | type: "img", 380 | attr: attr 381 | } 382 | nodeObj.push(obj); 383 | 384 | arrangeArray = []; 385 | } else { 386 | arrangeArray.push(htmlNode[i]); 387 | if (i == (j - 1)) { 388 | var obj = { 389 | type: "view", 390 | child: arrangeArray 391 | } 392 | nodeObj.push(obj); 393 | } 394 | } 395 | } 396 | } 397 | 398 | return nodeObj; 399 | } 400 | 401 | //将html节点转成小程序可用的接口 402 | var parseHtmlNode = function (htmlNode) { 403 | var tagsArray = []; 404 | var parsetags = function (node) { 405 | var tag = {}; 406 | if (node.node == "root") { 407 | 408 | } else if (node.node == "element") { 409 | switch (node.tag) { 410 | case "a": 411 | tag = { 412 | type: "a", 413 | text: node.child[0].text, 414 | } 415 | break; 416 | case "img": 417 | tag = { 418 | type: "img", 419 | text: node.text, 420 | } 421 | break; 422 | case "p": 423 | tag = { 424 | type: "view", 425 | text: node.text, 426 | } 427 | break; 428 | case "div": 429 | tag = { 430 | type: "view", 431 | text: node.text, 432 | } 433 | break; 434 | } 435 | } else if (node.node == "text") { 436 | tag = { 437 | type: "text", 438 | text: node.text, 439 | } 440 | } 441 | 442 | if (node.attr) { 443 | tag.attr = node.attr; 444 | } 445 | 446 | if (Object.keys(tag).length != 0) { 447 | // if(tag.text||node.tag=="img"){ 448 | tagsArray.push(tag); 449 | // } 450 | } 451 | 452 | if (node.tag == "a") {//如果是a标签就不去解析他的child 453 | return; 454 | } 455 | 456 | var child = node.child; 457 | 458 | if (child) { 459 | for (var val in child) { 460 | parsetags(child[val]); 461 | } 462 | } 463 | } 464 | 465 | parsetags(htmlNode); 466 | return tagsArray; 467 | } 468 | 469 | module.exports = { 470 | html2json: html2wxwebview 471 | } 472 | 473 | -------------------------------------------------------------------------------- /src/resource/js/md5.js: -------------------------------------------------------------------------------- 1 | /* 2 | * JavaScript MD5 3 | * https://github.com/blueimp/JavaScript-MD5 4 | * 5 | * Copyright 2011, Sebastian Tschan 6 | * https://blueimp.net 7 | * 8 | * Licensed under the MIT license: 9 | * http://www.opensource.org/licenses/MIT 10 | * 11 | * Based on 12 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message 13 | * Digest Algorithm, as defined in RFC 1321. 14 | * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 15 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet 16 | * Distributed under the BSD License 17 | * See http://pajhome.org.uk/crypt/md5 for more info. 18 | */ 19 | 20 | /*global unescape, define, module */ 21 | 22 | ; (function ($) { 23 | 'use strict' 24 | 25 | /* 26 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally 27 | * to work around bugs in some JS interpreters. 28 | */ 29 | function safe_add(x, y) { 30 | var lsw = (x & 0xFFFF) + (y & 0xFFFF) 31 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16) 32 | return (msw << 16) | (lsw & 0xFFFF) 33 | } 34 | 35 | /* 36 | * Bitwise rotate a 32-bit number to the left. 37 | */ 38 | function bit_rol(num, cnt) { 39 | return (num << cnt) | (num >>> (32 - cnt)) 40 | } 41 | 42 | /* 43 | * These functions implement the four basic operations the algorithm uses. 44 | */ 45 | function md5_cmn(q, a, b, x, s, t) { 46 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b) 47 | } 48 | function md5_ff(a, b, c, d, x, s, t) { 49 | return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t) 50 | } 51 | function md5_gg(a, b, c, d, x, s, t) { 52 | return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t) 53 | } 54 | function md5_hh(a, b, c, d, x, s, t) { 55 | return md5_cmn(b ^ c ^ d, a, b, x, s, t) 56 | } 57 | function md5_ii(a, b, c, d, x, s, t) { 58 | return md5_cmn(c ^ (b | (~d)), a, b, x, s, t) 59 | } 60 | 61 | /* 62 | * Calculate the MD5 of an array of little-endian words, and a bit length. 63 | */ 64 | function binl_md5(x, len) { 65 | /* append padding */ 66 | x[len >> 5] |= 0x80 << (len % 32) 67 | x[(((len + 64) >>> 9) << 4) + 14] = len 68 | 69 | var i 70 | var olda 71 | var oldb 72 | var oldc 73 | var oldd 74 | var a = 1732584193 75 | var b = -271733879 76 | var c = -1732584194 77 | var d = 271733878 78 | 79 | for (i = 0; i < x.length; i += 16) { 80 | olda = a 81 | oldb = b 82 | oldc = c 83 | oldd = d 84 | 85 | a = md5_ff(a, b, c, d, x[i], 7, -680876936) 86 | d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586) 87 | c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819) 88 | b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330) 89 | a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897) 90 | d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426) 91 | c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341) 92 | b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983) 93 | a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416) 94 | d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417) 95 | c = md5_ff(c, d, a, b, x[i + 10], 17, -42063) 96 | b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162) 97 | a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682) 98 | d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101) 99 | c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290) 100 | b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329) 101 | 102 | a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510) 103 | d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632) 104 | c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713) 105 | b = md5_gg(b, c, d, a, x[i], 20, -373897302) 106 | a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691) 107 | d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083) 108 | c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335) 109 | b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848) 110 | a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438) 111 | d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690) 112 | c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961) 113 | b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501) 114 | a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467) 115 | d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784) 116 | c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473) 117 | b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734) 118 | 119 | a = md5_hh(a, b, c, d, x[i + 5], 4, -378558) 120 | d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463) 121 | c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562) 122 | b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556) 123 | a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060) 124 | d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353) 125 | c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632) 126 | b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640) 127 | a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174) 128 | d = md5_hh(d, a, b, c, x[i], 11, -358537222) 129 | c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979) 130 | b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189) 131 | a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487) 132 | d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835) 133 | c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520) 134 | b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651) 135 | 136 | a = md5_ii(a, b, c, d, x[i], 6, -198630844) 137 | d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415) 138 | c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905) 139 | b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055) 140 | a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571) 141 | d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606) 142 | c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523) 143 | b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799) 144 | a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359) 145 | d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744) 146 | c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380) 147 | b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649) 148 | a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070) 149 | d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379) 150 | c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259) 151 | b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551) 152 | 153 | a = safe_add(a, olda) 154 | b = safe_add(b, oldb) 155 | c = safe_add(c, oldc) 156 | d = safe_add(d, oldd) 157 | } 158 | return [a, b, c, d] 159 | } 160 | 161 | /* 162 | * Convert an array of little-endian words to a string 163 | */ 164 | function binl2rstr(input) { 165 | var i 166 | var output = '' 167 | var length32 = input.length * 32 168 | for (i = 0; i < length32; i += 8) { 169 | output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF) 170 | } 171 | return output 172 | } 173 | 174 | /* 175 | * Convert a raw string to an array of little-endian words 176 | * Characters >255 have their high-byte silently ignored. 177 | */ 178 | function rstr2binl(input) { 179 | var i 180 | var output = [] 181 | output[(input.length >> 2) - 1] = undefined 182 | for (i = 0; i < output.length; i += 1) { 183 | output[i] = 0 184 | } 185 | var length8 = input.length * 8 186 | for (i = 0; i < length8; i += 8) { 187 | output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32) 188 | } 189 | return output 190 | } 191 | 192 | /* 193 | * Calculate the MD5 of a raw string 194 | */ 195 | function rstr_md5(s) { 196 | return binl2rstr(binl_md5(rstr2binl(s), s.length * 8)) 197 | } 198 | 199 | /* 200 | * Calculate the HMAC-MD5, of a key and some data (raw strings) 201 | */ 202 | function rstr_hmac_md5(key, data) { 203 | var i 204 | var bkey = rstr2binl(key) 205 | var ipad = [] 206 | var opad = [] 207 | var hash 208 | ipad[15] = opad[15] = undefined 209 | if (bkey.length > 16) { 210 | bkey = binl_md5(bkey, key.length * 8) 211 | } 212 | for (i = 0; i < 16; i += 1) { 213 | ipad[i] = bkey[i] ^ 0x36363636 214 | opad[i] = bkey[i] ^ 0x5C5C5C5C 215 | } 216 | hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8) 217 | return binl2rstr(binl_md5(opad.concat(hash), 512 + 128)) 218 | } 219 | 220 | /* 221 | * Convert a raw string to a hex string 222 | */ 223 | function rstr2hex(input) { 224 | var hex_tab = '0123456789abcdef' 225 | var output = '' 226 | var x 227 | var i 228 | for (i = 0; i < input.length; i += 1) { 229 | x = input.charCodeAt(i) 230 | output += hex_tab.charAt((x >>> 4) & 0x0F) + 231 | hex_tab.charAt(x & 0x0F) 232 | } 233 | return output 234 | } 235 | 236 | /* 237 | * Encode a string as utf-8 238 | */ 239 | function str2rstr_utf8(input) { 240 | return unescape(encodeURIComponent(input)) 241 | } 242 | 243 | /* 244 | * Take string arguments and return either raw or hex encoded strings 245 | */ 246 | function raw_md5(s) { 247 | return rstr_md5(str2rstr_utf8(s)) 248 | } 249 | function hex_md5(s) { 250 | return rstr2hex(raw_md5(s)) 251 | } 252 | function raw_hmac_md5(k, d) { 253 | return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)) 254 | } 255 | function hex_hmac_md5(k, d) { 256 | return rstr2hex(raw_hmac_md5(k, d)) 257 | } 258 | 259 | function md5(string, key, raw) { 260 | if (!key) { 261 | if (!raw) { 262 | return hex_md5(string) 263 | } 264 | return raw_md5(string) 265 | } 266 | if (!raw) { 267 | return hex_hmac_md5(key, string) 268 | } 269 | return raw_hmac_md5(key, string) 270 | } 271 | 272 | module.exports = md5; 273 | }(this)) 274 | -------------------------------------------------------------------------------- /src/resource/js/util.js: -------------------------------------------------------------------------------- 1 | var util = {}; 2 | /** 3 | 构造微擎地址, 4 | @params action 微擎系统中的controller, action, do,格式为 'wxapp/home/navs' 5 | @params querystring 格式为 {参数名1 : 值1, 参数名2 : 值2} 6 | */ 7 | util.url = function (action, querystring) { 8 | var app = getApp(); 9 | var url = app.siteInfo.siteroot + '?i=' + app.siteInfo.uniacid + '&t=' + app.siteInfo.multiid + '&v=' + app.siteInfo.version + '&from=wxapp&'; 10 | 11 | if (action) { 12 | action = action.split('/'); 13 | if (action[0]) { 14 | url += 'c=' + action[0] + '&'; 15 | } 16 | if (action[1]) { 17 | url += 'a=' + action[1] + '&'; 18 | } 19 | if (action[2]) { 20 | url += 'do=' + action[2] + '&'; 21 | } 22 | } 23 | if (querystring && typeof querystring === 'object') { 24 | for (let param in querystring) { 25 | if (param && querystring.hasOwnProperty(params) && querystring[param]) { 26 | url += param + '=' + querystring[param] + '&'; 27 | } 28 | } 29 | } 30 | return url; 31 | } 32 | 33 | function getQuery(url) { 34 | var theRequest = []; 35 | if (url.indexOf("?") != -1) { 36 | var str = url.split('?')[1]; 37 | var strs = str.split("&"); 38 | for (var i = 0; i < strs.length; i++) { 39 | if (strs[i].split("=")[0] && unescape(strs[i].split("=")[1])) { 40 | theRequest[i] = { 41 | 'name': strs[i].split("=")[0], 42 | 'value': unescape(strs[i].split("=")[1]) 43 | } 44 | } 45 | } 46 | } 47 | return theRequest; 48 | } 49 | /* 50 | * 获取链接某个参数 51 | * url 链接地址 52 | * name 参数名称 53 | */ 54 | function getUrlParam(url, name) { 55 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 56 | var r = url.split('?')[1].match(reg); //匹配目标参数 57 | if (r != null) return unescape(r[2]); return null; //返回参数值 58 | } 59 | /** 60 | * 获取签名 将链接地址的所有参数按字母排序后拼接加上token进行md5 61 | * url 链接地址 62 | * date 参数{参数名1 : 值1, 参数名2 : 值2} * 63 | * token 签名token 非必须 64 | */ 65 | function getSign(url, data, token) { 66 | var _ = require('underscore.js'); 67 | var md5 = require('md5.js'); 68 | var querystring = ''; 69 | var sign = getUrlParam(url, 'sign'); 70 | if (sign || (data && data.sign)) { 71 | return false; 72 | } else { 73 | if (url) { 74 | querystring = getQuery(url); 75 | } 76 | if (data) { 77 | var theRequest = []; 78 | for (let param in data) { 79 | if (param && data[param]) { 80 | theRequest = theRequest.concat({ 81 | 'name': param, 82 | 'value': data[param] 83 | }) 84 | } 85 | } 86 | querystring = querystring.concat(theRequest); 87 | } 88 | //排序 89 | querystring = _.sortBy(querystring, 'name'); 90 | //去重 91 | querystring = _.uniq(querystring, true, 'name'); 92 | var urlData = ''; 93 | for (let i = 0; i < querystring.length; i++) { 94 | if (querystring[i] && querystring[i].name && querystring[i].value) { 95 | urlData += querystring[i].name + '=' + querystring[i].value; 96 | if (i < (querystring.length - 1)) { 97 | urlData += '&'; 98 | } 99 | } 100 | } 101 | token = token ? token : getApp().siteInfo.token; 102 | sign = md5(urlData + token); 103 | return sign; 104 | } 105 | } 106 | /** 107 | 二次封装微信wx.request函数、增加交互体全、配置缓存、以及配合微擎格式化返回数据 108 | 109 | @params option 弹出参数表, 110 | { 111 | url : 同微信, 112 | data : 同微信, 113 | header : 同微信, 114 | method : 同微信, 115 | success : 同微信, 116 | fail : 同微信, 117 | complete : 同微信, 118 | 119 | cachetime : 缓存周期,在此周期内不重复请求http,默认不缓存 120 | } 121 | */ 122 | util.request = function (option) { 123 | var _ = require('underscore.js'); 124 | var md5 = require('md5.js'); 125 | var app = getApp(); 126 | var option = option ? option : {}; 127 | option.cachetime = option.cachetime ? option.cachetime : 0; 128 | option.showLoading = typeof option.showLoading != 'undefined' ? option.showLoading : true; 129 | 130 | var sessionid = wx.getStorageSync('userInfo').sessionid; 131 | var url = option.url; 132 | if (url.indexOf('http://') == -1 && url.indexOf('https://') == -1) { 133 | url = util.url(url); 134 | } 135 | var state = getUrlParam(url, 'state'); 136 | if (!state && !(option.data && option.data.state) && sessionid) { 137 | url = url + '&state=we7sid-' + sessionid 138 | } 139 | if (!option.data || !option.data.m) { 140 | var nowPage = getCurrentPages(); 141 | 142 | if (nowPage.length) { 143 | nowPage = nowPage[getCurrentPages().length - 1]; 144 | if (nowPage && nowPage.__route__) { 145 | url = url + '&m=' + nowPage.__route__.split('/')[0]; 146 | } 147 | } 148 | } 149 | 150 | var sign = getSign(url, option.data); 151 | if (sign) { 152 | url = url + "&sign=" + sign; 153 | } 154 | if (!url) { 155 | return false; 156 | } 157 | wx.showNavigationBarLoading(); 158 | if (option.showLoading) { 159 | util.showLoading(); 160 | } 161 | if (option.cachetime) { 162 | var cachekey = md5(url); 163 | var cachedata = wx.getStorageSync(cachekey); 164 | var timestamp = Date.parse(new Date()); 165 | 166 | if (cachedata && cachedata.data) { 167 | if (cachedata.expire > timestamp) { 168 | if (option.complete && typeof option.complete == 'function') { 169 | option.complete(cachedata); 170 | } 171 | if (option.success && typeof option.success == 'function') { 172 | option.success(cachedata); 173 | } 174 | console.log('cache:' + url); 175 | wx.hideLoading(); 176 | wx.hideNavigationBarLoading(); 177 | return true; 178 | } else { 179 | wx.removeStorageSync(cachekey) 180 | } 181 | } 182 | } 183 | wx.request({ 184 | 'url': url, 185 | 'data': option.data ? option.data : {}, 186 | 'header': option.header ? option.header : {}, 187 | 'method': option.method ? option.method : 'GET', 188 | 'header': { 189 | 'content-type': 'application/x-www-form-urlencoded' 190 | }, 191 | 'success': function (response) { 192 | wx.hideNavigationBarLoading(); 193 | wx.hideLoading(); 194 | if (response.data.errno) { 195 | if (response.data.errno == '41009') { 196 | wx.setStorageSync('userInfo', ''); 197 | util.getUserInfo(function () { 198 | util.request(option) 199 | }); 200 | return; 201 | } else { 202 | if (option.fail && typeof option.fail == 'function') { 203 | option.fail(response); 204 | } else { 205 | if (response.data.message) { 206 | if (response.data.data != null && response.data.data.redirect) { 207 | var redirect = response.data.data.redirect; 208 | } else { 209 | var redirect = ''; 210 | } 211 | app.util.message(response.data.message, redirect, 'error'); 212 | } 213 | } 214 | return; 215 | } 216 | } else { 217 | if (option.success && typeof option.success == 'function') { 218 | option.success(response); 219 | } 220 | //写入缓存,减少HTTP请求,并且如果网络异常可以读取缓存数据 221 | if (option.cachetime) { 222 | var cachedata = { 'data': response.data, 'expire': timestamp + option.cachetime * 1000 }; 223 | wx.setStorageSync(cachekey, cachedata); 224 | } 225 | } 226 | }, 227 | 'fail': function (response) { 228 | wx.hideNavigationBarLoading(); 229 | wx.hideLoading(); 230 | 231 | //如果请求失败,尝试从缓存中读取数据 232 | var md5 = require('md5.js'); 233 | var cachekey = md5(url); 234 | var cachedata = wx.getStorageSync(cachekey); 235 | if (cachedata && cachedata.data) { 236 | if (option.success && typeof option.success == 'function') { 237 | option.success(cachedata); 238 | } 239 | console.log('failreadcache:' + url); 240 | return true; 241 | } else { 242 | if (option.fail && typeof option.fail == 'function') { 243 | option.fail(response); 244 | } 245 | } 246 | }, 247 | 'complete': function (response) { 248 | // wx.hideNavigationBarLoading(); 249 | // wx.hideLoading(); 250 | if (option.complete && typeof option.complete == 'function') { 251 | option.complete(response); 252 | } 253 | } 254 | }); 255 | } 256 | /* 257 | * 获取用户信息 258 | */ 259 | util.getUserInfo = function (cb) { 260 | var login = function() { 261 | console.log('start login'); 262 | var userInfo = { 263 | 'sessionid': '', 264 | 'wxInfo': '', 265 | 'memberInfo': '', 266 | }; 267 | wx.login({ 268 | success: function (res) { 269 | util.request({ 270 | url: 'auth/session/openid', 271 | data: { code: res.code }, 272 | cachetime: 0, 273 | success: function (session) { 274 | if (!session.data.errno) { 275 | userInfo.sessionid = session.data.data.sessionid 276 | wx.setStorageSync('userInfo', userInfo); 277 | wx.getUserInfo({ 278 | success: function (wxInfo) { 279 | userInfo.wxInfo = wxInfo.userInfo 280 | wx.setStorageSync('userInfo', userInfo); 281 | util.request({ 282 | url: 'auth/session/userinfo', 283 | data: { 284 | signature: wxInfo.signature, 285 | rawData: wxInfo.rawData, 286 | iv: wxInfo.iv, 287 | encryptedData: wxInfo.encryptedData 288 | }, 289 | method: 'POST', 290 | header: { 291 | 'content-type': 'application/x-www-form-urlencoded' 292 | }, 293 | cachetime: 0, 294 | success: function (res) { 295 | if (!res.data.errno) { 296 | userInfo.memberInfo = res.data.data; 297 | wx.setStorageSync('userInfo', userInfo); 298 | } 299 | typeof cb == "function" && cb(userInfo); 300 | } 301 | }); 302 | }, 303 | fail: function () { 304 | }, 305 | complete: function () { 306 | } 307 | }) 308 | } 309 | } 310 | }); 311 | }, 312 | fail: function () { 313 | wx.showModal({ 314 | title: '获取信息失败', 315 | content: '请允许授权以便为您提供给服务', 316 | success: function (res) { 317 | if (res.confirm) { 318 | util.getUserInfo(); 319 | } 320 | } 321 | }) 322 | } 323 | }); 324 | }; 325 | 326 | var app = wx.getStorageSync('userInfo'); 327 | if (app.sessionid) { 328 | wx.checkSession({ 329 | success: function(){ 330 | typeof cb == "function" && cb(app); 331 | }, 332 | fail: function(){ 333 | app.sessionid = ''; 334 | console.log('relogin'); 335 | wx.removeStorageSync('userInfo'); 336 | login(); 337 | } 338 | }) 339 | } else { 340 | //调用登录接口 341 | login(); 342 | } 343 | } 344 | 345 | util.navigateBack = function (obj) { 346 | let delta = obj.delta ? obj.delta : 1; 347 | if (obj.data) { 348 | let pages = getCurrentPages() 349 | let curPage = pages[pages.length - (delta + 1)]; 350 | if (curPage.pageForResult) { 351 | curPage.pageForResult(obj.data); 352 | } else { 353 | curPage.setData(obj.data); 354 | } 355 | } 356 | wx.navigateBack({ 357 | delta: delta, // 回退前 delta(默认为1) 页面 358 | success: function (res) { 359 | // success 360 | typeof obj.success == "function" && obj.success(res); 361 | }, 362 | fail: function (err) { 363 | // fail 364 | typeof obj.fail == "function" && obj.function(err); 365 | }, 366 | complete: function () { 367 | // complete 368 | typeof obj.complete == "function" && obj.complete(); 369 | } 370 | }) 371 | }; 372 | 373 | util.footer = function ($this) { 374 | let app = getApp(); 375 | let that = $this; 376 | let tabBar = app.tabBar; 377 | for (let i in tabBar['list']) { 378 | tabBar['list'][i]['pageUrl'] = tabBar['list'][i]['pagePath'].replace(/(\?|#)[^"]*/g, '') 379 | } 380 | that.setData({ 381 | tabBar: tabBar, 382 | 'tabBar.thisurl': that.__route__ 383 | }) 384 | }; 385 | /* 386 | * 提示信息 387 | * type 为 success, error 当为 success, 时,为toast方式,否则为模态框的方式 388 | * redirect 为提示后的跳转地址, 跳转的时候可以加上 协议名称 389 | * navigate:/we7/pages/detail/detail 以 navigateTo 的方法跳转, 390 | * redirect:/we7/pages/detail/detail 以 redirectTo 的方式跳转,默认为 redirect 391 | */ 392 | util.message = function(title, redirect, type) { 393 | if (!title) { 394 | return true; 395 | } 396 | if (typeof title == 'object') { 397 | redirect = title.redirect; 398 | type = title.type; 399 | title = title.title; 400 | } 401 | if (redirect) { 402 | var redirectType = redirect.substring(0, 9), url = '', redirectFunction = ''; 403 | if (redirectType == 'navigate:') { 404 | redirectFunction = 'navigateTo'; 405 | url = redirect.substring(9); 406 | } else if (redirectType == 'redirect:') { 407 | redirectFunction = 'redirectTo'; 408 | url = redirect.substring(9); 409 | } else { 410 | url = redirect; 411 | redirectFunction = 'redirectTo'; 412 | } 413 | } 414 | 415 | if (!type) { 416 | type = 'success'; 417 | } 418 | 419 | if (type == 'success') { 420 | wx.showToast({ 421 | title: title, 422 | icon: 'success', 423 | duration: 2000, 424 | mask : url ? true : false, 425 | complete : function() { 426 | if (url) { 427 | setTimeout(function(){ 428 | wx[redirectFunction]({ 429 | url: url, 430 | }); 431 | }, 1800); 432 | } 433 | 434 | } 435 | }); 436 | } else if (type == 'error') { 437 | wx.showModal({ 438 | title: '系统信息', 439 | content : title, 440 | showCancel : false, 441 | complete : function() { 442 | if (url) { 443 | wx[redirectFunction]({ 444 | url: url, 445 | }); 446 | } 447 | } 448 | }); 449 | } 450 | } 451 | 452 | util.user = util.getUserInfo; 453 | 454 | //封装微信等待提示,防止ajax过多时,show多次 455 | util.showLoading = function() { 456 | var isShowLoading = wx.getStorageSync('isShowLoading'); 457 | if (isShowLoading) { 458 | wx.hideLoading(); 459 | wx.setStorageSync('isShowLoading', false); 460 | } 461 | 462 | wx.showLoading({ 463 | title : '加载中', 464 | complete : function() { 465 | wx.setStorageSync('isShowLoading', true); 466 | }, 467 | fail : function() { 468 | wx.setStorageSync('isShowLoading', false); 469 | } 470 | }); 471 | } 472 | 473 | util.showImage = function(event) { 474 | var url = event ? event.currentTarget.dataset.preview : ''; 475 | if (!url) { 476 | return false; 477 | } 478 | wx.previewImage({ 479 | urls: [url] 480 | }); 481 | } 482 | 483 | /** 484 | * 转换内容中的emoji表情为 unicode 码点,在Php中使用utf8_bytes来转换输出 485 | */ 486 | util.parseContent = function(string) { 487 | if (!string) { 488 | return string; 489 | } 490 | 491 | var ranges = [ 492 | '\ud83c[\udf00-\udfff]', // U+1F300 to U+1F3FF 493 | '\ud83d[\udc00-\ude4f]', // U+1F400 to U+1F64F 494 | '\ud83d[\ude80-\udeff]' // U+1F680 to U+1F6FF 495 | ]; 496 | var emoji = string.match( 497 | new RegExp(ranges.join('|'), 'g')); 498 | 499 | if (emoji) { 500 | for (var i in emoji) { 501 | string = string.replace(emoji[i], '[U+' + emoji[i].codePointAt(0).toString(16).toUpperCase() + ']'); 502 | } 503 | } 504 | return string; 505 | } 506 | 507 | util.date = function(){ 508 | /** 509 | * 判断闰年 510 | * @param date Date日期对象 511 | * @return boolean true 或false 512 | */ 513 | this.isLeapYear = function(date){ 514 | return (0==date.getYear()%4&&((date.getYear()%100!=0)||(date.getYear()%400==0))); 515 | } 516 | 517 | /** 518 | * 日期对象转换为指定格式的字符串 519 | * @param f 日期格式,格式定义如下 yyyy-MM-dd HH:mm:ss 520 | * @param date Date日期对象, 如果缺省,则为当前时间 521 | * 522 | * YYYY/yyyy/YY/yy 表示年份 523 | * MM/M 月份 524 | * W/w 星期 525 | * dd/DD/d/D 日期 526 | * hh/HH/h/H 时间 527 | * mm/m 分钟 528 | * ss/SS/s/S 秒 529 | * @return string 指定格式的时间字符串 530 | */ 531 | this.dateToStr = function(formatStr, date){ 532 | formatStr = arguments[0] || "yyyy-MM-dd HH:mm:ss"; 533 | date = arguments[1] || new Date(); 534 | var str = formatStr; 535 | var Week = ['日','一','二','三','四','五','六']; 536 | str=str.replace(/yyyy|YYYY/,date.getFullYear()); 537 | str=str.replace(/yy|YY/,(date.getYear() % 100)>9?(date.getYear() % 100).toString():'0' + (date.getYear() % 100)); 538 | str=str.replace(/MM/,date.getMonth()>9?(date.getMonth() + 1):'0' + (date.getMonth() + 1)); 539 | str=str.replace(/M/g,date.getMonth()); 540 | str=str.replace(/w|W/g,Week[date.getDay()]); 541 | 542 | str=str.replace(/dd|DD/,date.getDate()>9?date.getDate().toString():'0' + date.getDate()); 543 | str=str.replace(/d|D/g,date.getDate()); 544 | 545 | str=str.replace(/hh|HH/,date.getHours()>9?date.getHours().toString():'0' + date.getHours()); 546 | str=str.replace(/h|H/g,date.getHours()); 547 | str=str.replace(/mm/,date.getMinutes()>9?date.getMinutes().toString():'0' + date.getMinutes()); 548 | str=str.replace(/m/g,date.getMinutes()); 549 | 550 | str=str.replace(/ss|SS/,date.getSeconds()>9?date.getSeconds().toString():'0' + date.getSeconds()); 551 | str=str.replace(/s|S/g,date.getSeconds()); 552 | 553 | return str; 554 | } 555 | 556 | 557 | /** 558 | * 日期计算 559 | * @param strInterval string 可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒 560 | * @param num int 561 | * @param date Date 日期对象 562 | * @return Date 返回日期对象 563 | */ 564 | this.dateAdd = function(strInterval, num, date){ 565 | date = arguments[2] || new Date(); 566 | switch (strInterval) { 567 | case 's' :return new Date(date.getTime() + (1000 * num)); 568 | case 'n' :return new Date(date.getTime() + (60000 * num)); 569 | case 'h' :return new Date(date.getTime() + (3600000 * num)); 570 | case 'd' :return new Date(date.getTime() + (86400000 * num)); 571 | case 'w' :return new Date(date.getTime() + ((86400000 * 7) * num)); 572 | case 'm' :return new Date(date.getFullYear(), (date.getMonth()) + num, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()); 573 | case 'y' :return new Date((date.getFullYear() + num), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()); 574 | } 575 | } 576 | 577 | /** 578 | * 比较日期差 dtEnd 格式为日期型或者有效日期格式字符串 579 | * @param strInterval string 可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒 580 | * @param dtStart Date 可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒 581 | * @param dtEnd Date 可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒 582 | */ 583 | this.dateDiff = function(strInterval, dtStart, dtEnd) { 584 | switch (strInterval) { 585 | case 's' :return parseInt((dtEnd - dtStart) / 1000); 586 | case 'n' :return parseInt((dtEnd - dtStart) / 60000); 587 | case 'h' :return parseInt((dtEnd - dtStart) / 3600000); 588 | case 'd' :return parseInt((dtEnd - dtStart) / 86400000); 589 | case 'w' :return parseInt((dtEnd - dtStart) / (86400000 * 7)); 590 | case 'm' :return (dtEnd.getMonth()+1)+((dtEnd.getFullYear()-dtStart.getFullYear())*12) - (dtStart.getMonth()+1); 591 | case 'y' :return dtEnd.getFullYear() - dtStart.getFullYear(); 592 | } 593 | } 594 | 595 | /** 596 | * 字符串转换为日期对象 597 | * @param date Date 格式为yyyy-MM-dd HH:mm:ss,必须按年月日时分秒的顺序,中间分隔符不限制 598 | */ 599 | this.strToDate = function(dateStr){ 600 | var data = dateStr; 601 | var reCat = /(\d{1,4})/gm; 602 | var t = data.match(reCat); 603 | t[1] = t[1] - 1; 604 | eval('var d = new Date('+t.join(',')+');'); 605 | return d; 606 | } 607 | 608 | /** 609 | * 把指定格式的字符串转换为日期对象yyyy-MM-dd HH:mm:ss 610 | * 611 | */ 612 | this.strFormatToDate = function(formatStr, dateStr){ 613 | var year = 0; 614 | var start = -1; 615 | var len = dateStr.length; 616 | if((start = formatStr.indexOf('yyyy')) > -1 && start < len){ 617 | year = dateStr.substr(start, 4); 618 | } 619 | var month = 0; 620 | if((start = formatStr.indexOf('MM')) > -1 && start < len){ 621 | month = parseInt(dateStr.substr(start, 2)) - 1; 622 | } 623 | var day = 0; 624 | if((start = formatStr.indexOf('dd')) > -1 && start < len){ 625 | day = parseInt(dateStr.substr(start, 2)); 626 | } 627 | var hour = 0; 628 | if( ((start = formatStr.indexOf('HH')) > -1 || (start = formatStr.indexOf('hh')) > 1) && start < len){ 629 | hour = parseInt(dateStr.substr(start, 2)); 630 | } 631 | var minute = 0; 632 | if((start = formatStr.indexOf('mm')) > -1 && start < len){ 633 | minute = dateStr.substr(start, 2); 634 | } 635 | var second = 0; 636 | if((start = formatStr.indexOf('ss')) > -1 && start < len){ 637 | second = dateStr.substr(start, 2); 638 | } 639 | return new Date(year, month, day, hour, minute, second); 640 | } 641 | 642 | 643 | /** 644 | * 日期对象转换为毫秒数 645 | */ 646 | this.dateToLong = function(date){ 647 | return date.getTime(); 648 | } 649 | 650 | /** 651 | * 毫秒转换为日期对象 652 | * @param dateVal number 日期的毫秒数 653 | */ 654 | this.longToDate = function(dateVal){ 655 | return new Date(dateVal); 656 | } 657 | 658 | /** 659 | * 判断字符串是否为日期格式 660 | * @param str string 字符串 661 | * @param formatStr string 日期格式, 如下 yyyy-MM-dd 662 | */ 663 | this.isDate = function(str, formatStr){ 664 | if (formatStr == null){ 665 | formatStr = "yyyyMMdd"; 666 | } 667 | var yIndex = formatStr.indexOf("yyyy"); 668 | if(yIndex==-1){ 669 | return false; 670 | } 671 | var year = str.substring(yIndex,yIndex+4); 672 | var mIndex = formatStr.indexOf("MM"); 673 | if(mIndex==-1){ 674 | return false; 675 | } 676 | var month = str.substring(mIndex,mIndex+2); 677 | var dIndex = formatStr.indexOf("dd"); 678 | if(dIndex==-1){ 679 | return false; 680 | } 681 | var day = str.substring(dIndex,dIndex+2); 682 | if(!isNumber(year)||year>"2100" || year< "1900"){ 683 | return false; 684 | } 685 | if(!isNumber(month)||month>"12" || month< "01"){ 686 | return false; 687 | } 688 | if(day>getMaxDay(year,month) || day< "01"){ 689 | return false; 690 | } 691 | return true; 692 | } 693 | 694 | this.getMaxDay = function(year,month) { 695 | if(month==4||month==6||month==9||month==11) 696 | return "30"; 697 | if(month==2) 698 | if(year%4==0&&year%100!=0 || year%400==0) 699 | return "29"; 700 | else 701 | return "28"; 702 | return "31"; 703 | } 704 | /** 705 | * 变量是否为数字 706 | */ 707 | this.isNumber = function(str) 708 | { 709 | var regExp = /^\d+$/g; 710 | return regExp.test(str); 711 | } 712 | 713 | /** 714 | * 把日期分割成数组 [年、月、日、时、分、秒] 715 | */ 716 | this.toArray = function(myDate) 717 | { 718 | myDate = arguments[0] || new Date(); 719 | var myArray = Array(); 720 | myArray[0] = myDate.getFullYear(); 721 | myArray[1] = myDate.getMonth(); 722 | myArray[2] = myDate.getDate(); 723 | myArray[3] = myDate.getHours(); 724 | myArray[4] = myDate.getMinutes(); 725 | myArray[5] = myDate.getSeconds(); 726 | return myArray; 727 | } 728 | 729 | /** 730 | * 取得日期数据信息 731 | * 参数 interval 表示数据类型 732 | * y 年 M月 d日 w星期 ww周 h时 n分 s秒 733 | */ 734 | this.datePart = function(interval, myDate) 735 | { 736 | myDate = arguments[1] || new Date(); 737 | var partStr=''; 738 | var Week = ['日','一','二','三','四','五','六']; 739 | switch (interval) 740 | { 741 | case 'y' :partStr = myDate.getFullYear();break; 742 | case 'M' :partStr = myDate.getMonth()+1;break; 743 | case 'd' :partStr = myDate.getDate();break; 744 | case 'w' :partStr = Week[myDate.getDay()];break; 745 | case 'ww' :partStr = myDate.WeekNumOfYear();break; 746 | case 'h' :partStr = myDate.getHours();break; 747 | case 'm' :partStr = myDate.getMinutes();break; 748 | case 's' :partStr = myDate.getSeconds();break; 749 | } 750 | return partStr; 751 | } 752 | 753 | /** 754 | * 取得当前日期所在月的最大天数 755 | */ 756 | this.maxDayOfDate = function(date) 757 | { 758 | date = arguments[0] || new Date(); 759 | date.setDate(1); 760 | date.setMonth(date.getMonth() + 1); 761 | var time = date.getTime() - 24 * 60 * 60 * 1000; 762 | var newDate = new Date(time); 763 | return newDate.getDate(); 764 | } 765 | }; 766 | 767 | 768 | util.jsonToObject = function(value){ 769 | console.log('value:',value) 770 | let jsonStr = value, obj = {}; 771 | jsonStr = jsonStr.replace(" ",""); 772 | if(typeof jsonStr!= 'object'){ 773 | jsonStr= jsonStr.replace(/\ufeff/g,""); //重点 774 | obj = JSON.parse(jsonStr); 775 | return obj 776 | } 777 | }; 778 | 779 | module.exports = util; -------------------------------------------------------------------------------- /src/resource/template/complete.wxml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/resource/utils/base.js: -------------------------------------------------------------------------------- 1 | var app = getApp(); 2 | import { store } from '../../resource/utils/store.js' 3 | 4 | class Base{ 5 | constructor(){ 6 | this.baseRequestUrl = '' 7 | this.store = store // 一个简单的仓库 8 | } 9 | 10 | request(params){ 11 | var url = params.url; 12 | var that = this; 13 | // 数据上传时带上acid 14 | if (app.sq_acid) { 15 | if(!params.data) { 16 | params.data = { sq_acid: app.sq_acid} 17 | }else{ 18 | if (typeof params.data == 'object') { 19 | params.data.sq_acid = app.sq_acid 20 | } 21 | } 22 | } 23 | app.util.request({ 24 | url: url, 25 | data:params.data, 26 | method:params.type, 27 | showLoading:false, 28 | header: params.header, 29 | success:function(res){ 30 | params.sCallback && params.sCallback(res); 31 | }, 32 | fail:function(err){ 33 | that._processError(err); 34 | } 35 | }) 36 | } 37 | 38 | _processError(err) { 39 | if(err.data.errno === 1) { 40 | wx.showModal({ 41 | title: '提示', 42 | content: err.data.message, 43 | success: function (res) { 44 | if (res.confirm) { 45 | 46 | } else if (res.cancel) { 47 | 48 | } 49 | } 50 | }) 51 | } 52 | } 53 | 54 | setNavigationBarTitle() { 55 | wx.getStorage({ 56 | key: 'title', 57 | success: function (res) { 58 | if (!res.data) { 59 | getTitle() 60 | return 61 | } 62 | wx.setNavigationBarTitle({ 63 | title: res.data 64 | }) 65 | }, 66 | fail(err) { 67 | getTitle() 68 | } 69 | }) 70 | 71 | var getTitle = () => { 72 | var param = { 73 | url: 'entry/wxapp/getTitle', 74 | sCallback: (res) => { 75 | wx.setNavigationBarTitle({ 76 | title: res.data.data 77 | }) 78 | wx.setStorage({ 79 | key: "title", 80 | data: res.data.data 81 | }) 82 | } 83 | } 84 | this.request(param) 85 | } 86 | } 87 | 88 | /*获得元素上的绑定的值*/ 89 | getDataSet(event, key) { 90 | return event.currentTarget.dataset[key]; 91 | } 92 | } 93 | export {Base}; -------------------------------------------------------------------------------- /src/resource/utils/comment.js: -------------------------------------------------------------------------------- 1 | const app = getApp(); 2 | 3 | let dateToStr = function (formatStr, date) { 4 | formatStr = arguments[0] || "yyyy-MM-dd HH:mm:ss"; 5 | date = arguments[1] || new Date(); 6 | var str = formatStr; 7 | var Week = ['日', '一', '二', '三', '四', '五', '六']; 8 | str = str.replace(/yyyy|YYYY/, date.getFullYear()); 9 | str = str.replace(/yy|YY/, (date.getYear() % 100) > 9 ? (date.getYear() % 100).toString() : '0' + (date.getYear() % 100)); 10 | str = str.replace(/MM/, date.getMonth() >= 9 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)); 11 | str = str.replace(/M/g, date.getMonth()); 12 | str = str.replace(/w|W/g, Week[date.getDay()]); 13 | 14 | str = str.replace(/dd|DD/, date.getDate() > 9 ? date.getDate().toString() : '0' + date.getDate()); 15 | str = str.replace(/d|D/g, date.getDate()); 16 | 17 | str = str.replace(/hh|HH/, date.getHours() > 9 ? date.getHours().toString() : '0' + date.getHours()); 18 | str = str.replace(/h|H/g, date.getHours()); 19 | str = str.replace(/mm/, date.getMinutes() > 9 ? date.getMinutes().toString() : '0' + date.getMinutes()); 20 | str = str.replace(/m/g, date.getMinutes()); 21 | 22 | str = str.replace(/ss|SS/, date.getSeconds() > 9 ? date.getSeconds().toString() : '0' + date.getSeconds()); 23 | str = str.replace(/s|S/g, date.getSeconds()); 24 | 25 | return str; 26 | } 27 | 28 | // 处理时间戳字符串 29 | let handleTime = function (data) { 30 | if(data.freshtime !== '0' && data.freshtime !== undefined) { 31 | data.freshtime = dateToStr("yyyy-MM-dd HH:mm:ss", new Date(parseInt(data.freshtime + '000'))) 32 | }else { 33 | data.createtime = dateToStr("yyyy-MM-dd HH:mm:ss", new Date(parseInt(data.createtime + '000'))) 34 | } 35 | return data 36 | } 37 | 38 | // 取经纬度信息 39 | let getLocation = function (reset = false, callback) { 40 | if(typeof reset == 'function') { 41 | callback = reset 42 | reset = false 43 | } 44 | if(reset) { 45 | wx.getLocation({ 46 | type: 'wgs84', 47 | success: (res) => { 48 | wx.setStorage({ 49 | key: "location", 50 | data: res 51 | }) 52 | callback && callback(res) 53 | }, 54 | fail: (err) => { 55 | wx.getSetting({ 56 | success: (res) => { 57 | if(res.authSetting['scope.userLocation'] == false) { 58 | wx.showModal({ 59 | title: '是否要打开设置页面重新授权', 60 | content: '需要获取您的公开信息(昵称,头像,地址等),请到小程序的设置中打开授权', 61 | confirmText: '去设置', 62 | success: function (res) { 63 | if(res.confirm) { 64 | wx.openSetting({ 65 | success: (res) => { 66 | if(res.authSetting['scope.userLocation']) { 67 | getLocation(true, callback) 68 | return 69 | } 70 | } 71 | }) 72 | } 73 | callback && callback('') 74 | } 75 | }) 76 | } 77 | } 78 | }) 79 | } 80 | }) 81 | }else{ 82 | wx.getStorage({ 83 | key: 'location', 84 | success: function (res) { 85 | callback && callback(res.data) 86 | }, 87 | fail() { 88 | getLocation(true, callback) 89 | } 90 | }) 91 | } 92 | } 93 | 94 | 95 | // 得到用户信息 96 | let getUserInfo = function (reset = false, callback) { 97 | if (typeof reset == 'function') { 98 | callback = reset 99 | reset = false 100 | } 101 | reset = true 102 | if (reset) { 103 | wx.getUserInfo({ 104 | success: (res) => { 105 | wx.setStorage({ 106 | key: "mUserInfo", 107 | data: res.userInfo 108 | }) 109 | callback && callback(res.userInfo) 110 | }, 111 | fail() { 112 | wx.getSetting({ 113 | success: (res) => { 114 | if (res.authSetting['scope.userInfo'] == false) { 115 | wx.showModal({ 116 | title: '是否要打开设置页面重新授权', 117 | content: '需要获取您的公开信息(昵称,头像,地址等),请到小程序的设置中打开授权', 118 | confirmText: '去设置', 119 | success: function (res) { 120 | if (res.confirm) { 121 | wx.openSetting({ 122 | success: (res) => { 123 | if (res.authSetting['scope.userInfo']) { 124 | getUserInfo(true, callback) 125 | return 126 | } 127 | } 128 | }) 129 | } 130 | callback && callback('') 131 | } 132 | }) 133 | } 134 | } 135 | }) 136 | } 137 | }) 138 | }else{ 139 | wx.getStorage({ 140 | key: 'mUserInfo', 141 | success: function (res) { 142 | callback && callback(res.data) 143 | }, 144 | fail(err) { 145 | getUserInfo(true, callback) 146 | } 147 | }) 148 | } 149 | } 150 | 151 | // 获取图片前缀 152 | let getImageSocket = function (callback) { 153 | wx.getStorage({ 154 | key: 'imageSocket', 155 | success: function (res) { 156 | if (!res.data) { 157 | getData() 158 | return 159 | } 160 | callback && callback(res.data) 161 | }, 162 | fail(err) { 163 | getData() 164 | } 165 | }) 166 | function getData() { 167 | app.util.request({ 168 | url: 'entry/wxapp/Attachurl', 169 | data: { sq_acid: app.sq_acid }, 170 | success(res) { 171 | wx.setStorage({ 172 | key: "imageSocket", 173 | data: res.data 174 | }) 175 | callback && callback(res.data) 176 | } 177 | }) 178 | } 179 | } 180 | 181 | // 获取微擎URL 182 | let getWxUrl = function (ourl) { 183 | var that = this; 184 | var surl = app.util.url(ourl); 185 | var nowPage = getCurrentPages(); 186 | var nowPage = getCurrentPages(); 187 | if(nowPage){ 188 | nowPage = nowPage[getCurrentPages().length - 1]; 189 | if(nowPage.__route__){ 190 | surl = surl + '&m=' + nowPage.__route__.split('/')[0]; 191 | } 192 | } 193 | return surl; 194 | } 195 | 196 | let getCredit = function (reset = false, callback) { 197 | if(typeof reset == 'function') { 198 | callback = reset 199 | reset = false 200 | } 201 | if(reset) { 202 | app.util.request({ 203 | url: 'entry/wxapp/credit2money', 204 | success(res) { 205 | wx.setStorage({ 206 | key: "credit", 207 | data: res.data.data 208 | }) 209 | callback && callback(res.data.data) 210 | } 211 | }) 212 | }else{ 213 | wx.getStorage({ 214 | key: 'credit', 215 | success: function (res) { 216 | callback && callback(res.data) 217 | }, 218 | fail(err) { 219 | getCredit(true, callback) 220 | } 221 | }) 222 | } 223 | } 224 | 225 | module.exports = { 226 | handleTime, 227 | getLocation, 228 | getUserInfo, 229 | getImageSocket, 230 | getWxUrl, 231 | getCredit, 232 | dateToStr 233 | } -------------------------------------------------------------------------------- /src/resource/utils/connect.js: -------------------------------------------------------------------------------- 1 | module.exports = (function() { 2 | var webSocketUrl = 'ws://123.56.85.164:18080/websocket', 3 | socketOpened = false, // 标记websocket是否已经打开 4 | socketMsgQueue = [], 5 | connCallback = null, 6 | msgReceived = {}; 7 | 8 | function connect(callback) { // 发起链接 9 | var app = getApp(), 10 | roomNo = app.getRoomNo(); 11 | wx.connectSocket({ 12 | url: webSocketUrl + '?no=' + roomNo 13 | }); 14 | connCallback = callback; 15 | } 16 | 17 | function initEvent() { // 初始化一些webSocket事件 18 | wx.onSocketOpen(function(res){ // webSocket打开事件处理 19 | socketOpened = true; 20 | console.log('websocket opened.'); 21 | // 处理一下没发出去的消息 22 | while(socketMsgQueue.length > 0) { 23 | var msg = socketMsgQueue.pop(); 24 | sendSocketMessage(msg); 25 | } 26 | // sendSocketMessage('after'); 27 | 28 | // connection callback 29 | connCallback && connCallback.call(null); 30 | }); 31 | wx.onSocketMessage(function(res) { // 收到服务器消息时的处理 32 | console.log('received msg: ' + res.data); 33 | msgReceived.callback && msgReceived.callback.call(null, res.data, ...msgReceived.params); 34 | }); 35 | wx.onSocketError(function(res){ // 链接出错时的处理 36 | console.log('webSocket fail'); 37 | }); 38 | } 39 | 40 | function sendSocketMessage(msg) { 41 | if (typeof(msg) === 'object') { 42 | msg = JSON.stringify(msg); 43 | } 44 | if (socketOpened) { 45 | wx.sendSocketMessage({ 46 | data:msg 47 | }); 48 | } else { // 发送的时候,链接还没建立 49 | socketMsgQueue.push(msg); 50 | } 51 | } 52 | 53 | function setReceiveCallback(callback, ...params) { 54 | if (callback) { 55 | msgReceived.callback = callback; 56 | msgReceived.params = params; 57 | } 58 | } 59 | 60 | function init() { 61 | initEvent(); 62 | } 63 | 64 | init(); 65 | return { 66 | connect: connect, 67 | send: sendSocketMessage, 68 | setReceiveCallback: setReceiveCallback, 69 | socketOpened: socketOpened 70 | }; 71 | })(); -------------------------------------------------------------------------------- /src/resource/utils/store.js: -------------------------------------------------------------------------------- 1 | const app = getApp() 2 | // 获取用户标识 3 | let getSeid = function (state, callback) { 4 | if (state.seid === -1) { 5 | wx.getUserInfo({ 6 | success: (data) => { 7 | wx.login({ 8 | success: (res) => { 9 | app.util.request({ 10 | url: 'entry/wxapp/getSeid', 11 | data: { 12 | code: res.code, 13 | ...data.userInfo 14 | }, 15 | success(res) { 16 | state.seid = res.data.data 17 | callback && callback(res.data.data) 18 | }, 19 | fail(err) { 20 | 21 | } 22 | }) 23 | } 24 | }) 25 | } 26 | }) 27 | } else { 28 | callback(state.seid) 29 | } 30 | } 31 | // 积分换取的值 32 | let getCredit = function (state, callback) { 33 | if (state.credit === -1) { 34 | app.util.request({ 35 | url: 'entry/wxapp/credit2money', 36 | success(res) { 37 | state.credit = res.data.data 38 | callback && callback(res.data.data) 39 | } 40 | }) 41 | } else { 42 | callback(state.credit) 43 | } 44 | } 45 | const state = { 46 | seid: -1, 47 | credit: -1 48 | } 49 | let store = function (action,callback) { 50 | switch (action.type) { 51 | case 'GET_SEID': 52 | getSeid(state, callback) 53 | return 54 | case 'GET_CREDIT': 55 | getCredit(state, callback) 56 | return 57 | default: 58 | return state; 59 | } 60 | } 61 | module.exports = { 62 | store 63 | } --------------------------------------------------------------------------------