├── README.md ├── app.js ├── app.json ├── app.wxss ├── pages ├── answer_chapter │ ├── chapter.js │ ├── chapter.json │ ├── chapter.wxml │ └── chapter.wxss ├── answer_classify │ ├── classify.js │ ├── classify.json │ ├── classify.wxml │ └── classify.wxss ├── answer_common │ ├── movie-list.wxml │ └── movie-list.wxss ├── answer_info │ ├── info.js │ ├── info.json │ ├── info.wxml │ └── info.wxss ├── answer_mark │ ├── mark.js │ ├── mark.json │ ├── mark.wxml │ └── mark.wxss ├── answer_simulate_info │ ├── simulate_info.js │ ├── simulate_info.json │ ├── simulate_info.wxml │ └── simulate_info.wxss ├── answer_simulate_tip │ ├── simulate_tip.js │ ├── simulate_tip.json │ ├── simulate_tip.wxml │ └── simulate_tip.wxss ├── common │ └── movie-list.wxml ├── custom-swiper │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss └── mark │ ├── mark.js │ ├── mark.json │ ├── mark.wxml │ └── mark.wxss ├── public ├── core │ ├── Q.js │ └── object-assign.js ├── images │ ├── 1.png │ ├── 2-1.png │ ├── 2.png │ ├── 3.png │ ├── error-1.png │ ├── error.png │ ├── exam-results-bg.jpg │ ├── exam-results-cs.png │ ├── exam-results-csz.png │ ├── exam-results-ss.png │ ├── exam-results-ssz.png │ ├── success-1.png │ └── success.png └── js │ └── douban.js └── utils └── util.js /README.md: -------------------------------------------------------------------------------- 1 | # 微信小程序-题库 2 | 3 | ### 说明: 4 | 5 | 实现题库功能,特色: 6 | - 判断题型和单选题型 7 | - 做题进度和对错显示 8 | 9 | ### 数据接口: 10 | 11 | - https://api.getweapp.com/vendor/com1217 12 | 13 | ### 目录结构: 14 | 15 | - public — 存放项目公共库文件 16 | - pages — 存放项目页面文件 17 | - utils — 存放项目日期处理文件 18 | 19 | ### 开发环境: 20 | 21 | 微信web开发者工具 v0.11.112301 22 | 23 | ### 项目截图: 24 | 25 | https://www.getweapp.com/project?projectId=584c4f78e8ff074c22472f75 26 | 27 | ### 感谢: 28 | 29 | 本项目原始版本由HuBinAdd提供:https://github.com/HuBinAdd/calculate-swiperList 30 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | const https = require('public/js/douban.js'); 3 | 4 | if(!Object.assign) { 5 | Object.assign = require('public/core/object-assign.js') 6 | } 7 | 8 | App({ 9 | onLaunch: function () { 10 | //调用API从本地缓存中获取数据 11 | var logs = wx.getStorageSync('1217_logs') || false; 12 | if(logs){ 13 | this.globalData = logs; 14 | }else{ 15 | 16 | } 17 | }, 18 | getUserInfo:function(cb){ 19 | var that = this; 20 | wx.getLocation({ 21 | type: 'wgs84', 22 | success: function(res) { 23 | that.globalData.getLocation = `${res.latitude},${res.longitude}` //纬,经 24 | } 25 | }) 26 | if(this.globalData.hasLogin){ 27 | typeof cb == "function" && cb(this.globalData.userInfo); 28 | }else{ 29 | //调用登录接口 30 | wx.login({ 31 | success: function (data) { 32 | https.login('weixin/small/1.0?m=SmallApp&c=weixin&a=login',{code:data.code}).then((data) =>{ 33 | if(!!(data.data.status - 0) ){ 34 | that.globalData.openid = data.data.data; 35 | that.globalData.hasLogin = true; 36 | wx.getUserInfo({ 37 | success: function (res) { 38 | that.globalData.userInfo = res.userInfo; 39 | wx.setStorageSync('1217_logs', that.globalData);//储存用户信息 40 | typeof cb == "function" && cb(that.globalData.userInfo) 41 | } 42 | }) 43 | }else{//登录失败 44 | 45 | } 46 | }); 47 | 48 | }, 49 | fail:function(){ 50 | typeof cb == "function" && cb(false) 51 | } 52 | }) 53 | } 54 | }, 55 | globalData:{ 56 | hasLogin:false,//是否登陆 57 | userInfo:null,//用户信息 58 | openid:null,//用户唯一标识 59 | city:null//用户唯一标识 60 | } 61 | }) -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages":[ 3 | "pages/index/index", 4 | "pages/answer_chapter/chapter", 5 | "pages/answer_classify/classify", 6 | "pages/answer_simulate_info/simulate_info", 7 | "pages/answer_mark/mark", 8 | "pages/answer_simulate_tip/simulate_tip", 9 | "pages/answer_info/info" 10 | ], 11 | "window":{ 12 | "backgroundTextStyle":"light", 13 | "backgroundColor":"#f6f6f6", 14 | "navigationBarBackgroundColor": "#38393c", 15 | "navigationBarTitleText": "学车题库", 16 | "navigationBarTextStyle":"white", 17 | "enablePullDownRefresh":true 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | page{ 3 | font-family: Arial,"Microsoft Yahei","微软雅黑", sans-serif; 4 | font-size: 24rpx; 5 | background: #eee; 6 | color: #333; 7 | } 8 | 9 | /* CSS Document */ 10 | 11 | .row:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; } 12 | 13 | .row { display: inline-table; } /* Hides from IE-mac \*/ 14 | 15 | html .row { height: 1%; } 16 | 17 | .row { display: block; } /* End hide from IE-mac */ 18 | 19 | .col-hg-1, .col-hg-2, .col-hg-3, .col-hg-4, .col-hg-5, .col-hg-6, .col-hg-7, .col-hg-8, .col-hg-9, .col-hg-10, .col-hg-11, .col-hg-12 { float: left; box-sizing: border-box;} 20 | 21 | .col-hg-12 { width: 100%; } 22 | 23 | .col-hg-11 { width: 91.6667%; } 24 | 25 | .col-hg-10 { width: 83.3333%; } 26 | 27 | .col-hg-9 { width: 75%; } 28 | 29 | .col-hg-8 { width: 66.6667%;} 30 | 31 | .col-hg-7 { width: 40%; } 32 | 33 | .col-hg-6 { width: 50%; } 34 | 35 | .col-hg-5 { width: 41.6667%; } 36 | 37 | .col-hg-4 { width: 33.3333%; } 38 | 39 | .col-hg-3 { width: 25%; } 40 | 41 | .col-hg-2 { width: 16.6667%; } 42 | 43 | .col-hg-1 { width: 8.33333%; } 44 | 45 | /*classify-lists*/ 46 | .classify-exer-lists{ 47 | background: #fff; 48 | margin-top: 10rpx; 49 | } 50 | .classify-exer-lists.first{ 51 | margin-top: 0; 52 | } 53 | 54 | .classify-exer-lists .classify-exer-list{ 55 | position: relative; 56 | padding: 27rpx 0 27rpx 90rpx; 57 | border-bottom: 1rpx solid #f6f6f6; 58 | font-size: 30rpx; 59 | line-height: 46rpx; 60 | } 61 | 62 | .classify-exer-lists .classify-exer-list .icon-exer{ 63 | position: absolute; 64 | left: 30rpx; 65 | top: 50%; 66 | transform: translate3d(0, -50%, 0px); 67 | -webkit-transform: translate3d(0, -50%, 0px); 68 | width: 40rpx; 69 | height: 40rpx; 70 | border-radius: 20rpx; 71 | background: #fc8f02 url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWCAYAAADAQbwGAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsSAAALEgHS3X78AAABWUlEQVQ4y6WVsUpjURCGvwnR1cbKgEXYaq1MHkBBCIJW1iu+irXd4mtYWW29SGzFFGqpIIqCEIslpYKfRU4gXO5JbuLfnMvM/T9m5lzmorbVa2fXb0pUB06BN2AP+KCaBC7LM0PtVgRNVS2dVSubqnqm6jVgqSLjMSLMAtUa8AQsVATuAv+ywIj4VH/OUuHUliPidd4Z1sqCal2t50yT8rWM5w/QUxslsAbQA04K8XX1YvQddgrJX+qDejsOVRspdqc2C56O6UbLZngPbAPLQFdtJkA3vbIVEc+ztEwydIAfCdQFPoGdiOjnfNnBj6BpCfRSaHMSbGKFo1kCfxkugkvgTN2YC6i2U5svDDfRXnruplzWWHbLbbWvnqsrY/GVFOurrYInf8vAAXAF7EfEYGymA2A/5Q4rVziPihUufhdI2k6h3gD/gWPg/RuwI2AVtTXnT6qoa7X9BT+zVy5f6mfUAAAAAElFTkSuQmCC") no-repeat center/20rpx 22rpx; 72 | overflow: hidden; 73 | } 74 | .classify-exer-lists .classify-exer-list.left{border-right: 1rpx solid #f6f6f6;} 75 | 76 | .classify-exer-lists .classify-exer-list .special-exer-tip{ 77 | position: absolute; 78 | left: 30rpx; 79 | top: 50%; 80 | transform: translate3d(0, -50%, 0px); 81 | -webkit-transform: translate3d(0, -50%, 0px); 82 | width: 40rpx; 83 | height: 40rpx; 84 | background: #73d263; 85 | border-radius: 20rpx; 86 | font-size: 24rpx; 87 | color: #fff; 88 | text-align: center; 89 | line-height: 40rpx; 90 | } 91 | .classify-exer-lists.num .classify-exer-list{ 92 | counter-increment: my; 93 | } 94 | .classify-exer-lists.num .classify-exer-list:after{ 95 | position: absolute; 96 | left: 30rpx; 97 | top: 50%; 98 | transform: translate3d(0, -50%, 0px); 99 | -webkit-transform: translate3d(0, -50%, 0px); 100 | width: 40rpx; 101 | height: 40rpx; 102 | content: counter(my); 103 | background: #0ae; 104 | border-radius: 20rpx; 105 | font-size: 24rpx; 106 | color: #fff; 107 | text-align: center; 108 | line-height: 40rpx; 109 | } 110 | .classify-exer-lists.num .classify-exer-list .classify-exam-num{ 111 | position: absolute; 112 | right: 30rpx; 113 | top: 50%; 114 | transform: translate3d(0, -50%, 0px); 115 | -webkit-transform: translate3d(0, -50%, 0px); 116 | font-size: 24rpx; 117 | color: #999; 118 | vertical-align: middle; 119 | } 120 | .classify-exer-lists.num .classify-exer-list .classify-exam-num .icon-label-class{ 121 | display: inline-block; 122 | width: 12rpx; 123 | height: 20rpx; 124 | margin-left: 4rpx; 125 | background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAASCAYAAABit09LAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsSAAALEgHS3X78AAAA4ElEQVQoz43Rr0qEQRiF8We/9SYMgoIIFoPFC7CsxWSyaJHTDGI2LqggosUHDGtQEEyLYcU/WC0Gr8gyGtZvdn3j8GPeOWdQ79UeU6YBzoAbdXMiTPIBbABX6takG0nyCfSAC3W7Cgv+AtaBY3V3HHbGD9Ql4BnoJ7EKC14AXoDzJJdVWPBcwddJTquw4FngFbht+N90u1NWvwGDJP1amPmy8jdM04IWgXfg5Af9Sa0uA0/AUZJBa+HqCjACDpPctf6Mugo8AvtJHtre3VHXgCGwl2RYa2EGOAB2kowmFfkNyq5O87vOCYoAAAAASUVORK5CYII=")no-repeat center/10rpx 18rpx; 126 | } 127 | .metadata{ 128 | display: table; 129 | height: 300px; 130 | width: 100%; 131 | } 132 | .metadata view{display: table-cell; vertical-align:middle; text-align:center; color: #999;} -------------------------------------------------------------------------------- /pages/answer_chapter/chapter.js: -------------------------------------------------------------------------------- 1 | const https = require('../../public/js/douban.js'); 2 | 3 | if(!Object.assign) { 4 | Object.assign = require('../../public/core/object-assign.js') 5 | } 6 | 7 | //获取应用实例 8 | var app = getApp(); 9 | Page({ 10 | data: { 11 | column:[{ 12 | class:'num', 13 | option:[ 14 | { 15 | "id": "3", 16 | "title": "安全ssss行车、文明驾驶基础知识", 17 | "count": "284" 18 | } 19 | ] 20 | }], 21 | }, 22 | onLoad (params) { 23 | this.data.subject = params.subject; 24 | this.data.type = params.type; 25 | var that = this; 26 | https.chapter('weixin/small/1.0?m=SmallApp&c=weixin&a=chapter',{subject:params.subject,type:params.type}).then((data) =>{ 27 | if(data.data.status == 1){ 28 | that.data.subject = params.subject; 29 | that.data.column[0].option = data.data.data; 30 | that.setData(that.data); 31 | } 32 | }) 33 | this.setData(this.data); 34 | }, 35 | onUnload(){//页面卸载 36 | 37 | } 38 | }); -------------------------------------------------------------------------------- /pages/answer_chapter/chapter.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "章节练习", 3 | "enablePullDownRefresh":false 4 | } -------------------------------------------------------------------------------- /pages/answer_chapter/chapter.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{option.exerTip}} 4 | 5 | {{option.title}} 6 | {{option.count}} 7 | 8 | -------------------------------------------------------------------------------- /pages/answer_chapter/chapter.wxss: -------------------------------------------------------------------------------- 1 | /* pages/answer_chapter/chapter.wxss */ -------------------------------------------------------------------------------- /pages/answer_classify/classify.js: -------------------------------------------------------------------------------- 1 | const https = require('../../public/js/douban.js'); 2 | 3 | if(!Object.assign) { 4 | Object.assign = require('../../public/core/object-assign.js') 5 | } 6 | 7 | 8 | //获取应用实例 9 | var app = getApp(); 10 | Page({ 11 | data: { 12 | isLoading:false, 13 | subject:'kemu1', 14 | column:[{},{},{class:'num'}] 15 | }, 16 | onLoad (params) { 17 | this.data.subject = params.subject; 18 | this.data.type = params.type; 19 | var that = this; 20 | https.classify('weixin/small/1.0?m=SmallApp&c=weixin&a=special',{subject:params.subject,type:params.type}).then((data) =>{ 21 | if(data.data.status == 1){ 22 | data = data.data.data; 23 | this.data.column[0].option = data[0]; 24 | this.data.column[1].option = data[1]; 25 | this.data.column[2].option = data[2]; 26 | this.data.isLoading = true; 27 | that.setData(that.data); 28 | } 29 | }) 30 | this.setData(this.data); 31 | }, 32 | onUnload(){//页面卸载 33 | 34 | } 35 | }); -------------------------------------------------------------------------------- /pages/answer_classify/classify.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "专项练习", 3 | "enablePullDownRefresh":false 4 | } -------------------------------------------------------------------------------- /pages/answer_classify/classify.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{option.exerTip}} 7 | 8 | {{option.text}} 9 | {{option.examNum}} 10 | 11 | 12 | -------------------------------------------------------------------------------- /pages/answer_classify/classify.wxss: -------------------------------------------------------------------------------- 1 | /* pages/answer_classify/classify.wxss */ -------------------------------------------------------------------------------- /pages/answer_common/movie-list.wxml: -------------------------------------------------------------------------------- 1 | 2 | 24 | 25 | 26 | 51 | 52 | 53 | 59 | 60 |