├── .idea ├── 51apply.iml ├── jsLibraryMappings.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── app.js ├── app.json ├── app.wxss ├── images ├── logo.png ├── map │ └── localization.png └── tabs │ ├── find-off.png │ ├── find-on.png │ ├── home-off.png │ ├── home-on.png │ ├── news-off.png │ ├── news-on.png │ ├── service-off.png │ ├── service-on.png │ ├── user-off.png │ └── user-on.png ├── pages ├── account │ ├── account.js │ ├── account.json │ ├── account.wxml │ ├── account.wxss │ ├── login.js │ ├── login.json │ ├── login.wxml │ ├── login.wxss │ ├── passportphoto.js │ ├── passportphoto.json │ ├── passportphoto.wxml │ ├── passportphoto.wxss │ ├── personalinfo.js │ ├── personalinfo.json │ ├── personalinfo.wxml │ ├── personalinfo.wxss │ ├── register.js │ ├── register.json │ ├── register.wxml │ ├── register.wxss │ ├── subscribe.js │ ├── subscribe.json │ ├── subscribe.wxml │ └── subscribe.wxss ├── activity │ ├── activityapply.js │ ├── activityapply.json │ ├── activityapply.wxml │ ├── activityapply.wxss │ ├── activityapplymore.js │ ├── activityapplymore.json │ ├── activityapplymore.wxml │ └── activityapplymore.wxss ├── address │ ├── addaddress.js │ ├── addaddress.json │ ├── addaddress.wxml │ ├── addaddress.wxss │ ├── addressmanage.js │ ├── addressmanage.json │ ├── addressmanage.wxml │ └── addressmanage.wxss ├── apply │ ├── applyperson.js │ ├── applyperson.json │ ├── applyperson.wxml │ ├── applyperson.wxss │ ├── applysubject.js │ ├── applysubject.json │ ├── applysubject.wxml │ ├── applysubject.wxss │ ├── applysubjectmore.js │ ├── applysubjectmore.json │ ├── applysubjectmore.wxml │ └── applysubjectmore.wxss ├── find │ ├── find.js │ ├── find.json │ ├── find.wxml │ └── find.wxss ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── news │ ├── news.js │ ├── news.json │ ├── news.wxml │ └── news.wxss ├── notice │ ├── noticedetails.js │ ├── noticedetails.json │ ├── noticedetails.wxml │ ├── noticedetails.wxss │ ├── noticelist.js │ ├── noticelist.json │ ├── noticelist.wxml │ └── noticelist.wxss ├── pay │ ├── applypay.js │ ├── applypay.json │ ├── applypay.wxml │ └── applypay.wxss ├── record │ ├── applyrecord.js │ ├── applyrecord.json │ ├── applyrecord.wxml │ ├── applyrecord.wxss │ ├── applyrecorddetails.js │ ├── applyrecorddetails.json │ ├── applyrecorddetails.wxml │ └── applyrecorddetails.wxss └── service │ ├── service.js │ ├── service.json │ ├── service.wxml │ └── service.wxss └── utils ├── font.wxss ├── ionic.wxss ├── util.js └── validate.js /.idea/51apply.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | //启动时执行的初始化工作 全局只触发一次 5 | //存储当前经纬度地址到本地 6 | wx.getLocation({ 7 | type: 'wgs84', 8 | success: function (res) { 9 | wx.setStorageSync("longitude", res.longitude);//经度 10 | wx.setStorageSync("latitude", res.latitude);//纬度 11 | } 12 | }) 13 | }, 14 | globalData: { //全局常量参数配置 15 | api: "https://t.51enroll.com/Service.asmx", 16 | praviteKey:"oiox3tmqu1sn56x7occdd" 17 | } 18 | }) 19 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/apply/applysubject", 5 | "pages/apply/applysubjectmore", 6 | "pages/apply/applyperson", 7 | "pages/record/applyrecord", 8 | "pages/record/applyrecorddetails", 9 | "pages/address/addressmanage", 10 | "pages/address/addaddress", 11 | "pages/pay/applypay", 12 | "pages/activity/activityapply", 13 | "pages/activity/activityapplymore", 14 | "pages/notice/noticelist", 15 | "pages/notice/noticedetails", 16 | "pages/account/account", 17 | "pages/account/login", 18 | "pages/account/register", 19 | "pages/account/personalinfo", 20 | "pages/account/passportphoto", 21 | "pages/account/subscribe", 22 | "pages/news/news", 23 | "pages/find/find", 24 | "pages/service/service" 25 | ], 26 | "window": { 27 | "navigationBarBackgroundColor": "#f26604" 28 | }, 29 | "tabBar": { 30 | "color": "#707070", 31 | "selectedColor": "#f26604", 32 | "borderStyle": "black", 33 | "backgroundColor": "#ffffff", 34 | "list": [ 35 | { 36 | "pagePath": "pages/index/index", 37 | "iconPath": "images/tabs/home-off.png", 38 | "selectedIconPath": "images/tabs/home-on.png", 39 | "text": "首页" 40 | }, 41 | { 42 | "pagePath": "pages/news/news", 43 | "iconPath": "images/tabs/news-off.png", 44 | "selectedIconPath": "images/tabs/news-on.png", 45 | "text": "消息" 46 | }, 47 | { 48 | "pagePath": "pages/find/find", 49 | "iconPath": "images/tabs/find-off.png", 50 | "selectedIconPath": "images/tabs/find-on.png", 51 | "text": "附近" 52 | }, 53 | { 54 | "pagePath": "pages/service/service", 55 | "iconPath": "images/tabs/service-off.png", 56 | "selectedIconPath": "images/tabs/service-on.png", 57 | "text": "服务" 58 | }, 59 | { 60 | "pagePath": "pages/account/account", 61 | "iconPath": "images/tabs/user-off.png", 62 | "selectedIconPath": "images/tabs/user-on.png", 63 | "text": "我的" 64 | } 65 | ] 66 | }, 67 | "networkTimeout": { 68 | "request": 10000, 69 | "downloadFile": 10000 70 | } 71 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | @import "/utils/font.wxss"; 3 | @import "/utils/ionic.wxss"; 4 | /*.container { 5 | height: 100%; 6 | display: flex; 7 | flex-direction: column; 8 | align-items: center; 9 | justify-content: space-between; 10 | padding: 200 rpx 0; 11 | box-sizing: border-box; 12 | }*/ 13 | 14 | text, input { 15 | font-family: MicroSoft Yahei; 16 | } 17 | 18 | page { 19 | display: block; 20 | min-height: 100%; 21 | background-color: #f8f8f8; 22 | } 23 | 24 | .item-note picker { 25 | min-width: 5rem; 26 | text-align: right; 27 | } 28 | 29 | /** 修改默认的navigator点击态 **/ 30 | .navigator-hover { 31 | color: #f26604; 32 | } 33 | 34 | .isNotDataHint { 35 | width: 100%; 36 | height: 100%; 37 | color: rgba(128, 128, 128, 0.6); 38 | padding-top: 40%; 39 | text-align: center; 40 | } 41 | 42 | .isNotDataHint .iconfont { 43 | font-size: 5rem; 44 | } 45 | 46 | .isNotDataHint text { 47 | margin-top: 1rem; 48 | } 49 | 50 | /* 网格布局row水平方向居中*/ 51 | 52 | .row-horizontal-center { 53 | -webkit-box-pack: center; 54 | -ms-flex-pack: center; 55 | -webkit-justify-content: center; 56 | -moz-justify-content: center; 57 | justify-content: center; 58 | } 59 | 60 | /* 网格布局row水平方向均匀分布左右留有距离*/ 61 | 62 | .row-horizontal-around { 63 | -webkit-justify-content: space-around; 64 | -moz-justify-content: space-around; 65 | -ms-flex-pack: distribute; 66 | justify-content: space-around; 67 | } 68 | 69 | .row-horizontal-start { 70 | -webkit-justify-content: flex-start; 71 | -moz-justify-content: flex-start; 72 | -webkit-box-pack: start; 73 | -ms-flex-pack: start; 74 | justify-content: flex-start; 75 | } 76 | 77 | .row-horizontal-end { 78 | -webkit-justify-content: flex-end; 79 | -moz-justify-content: flex-end; 80 | -webkit-box-pack: end; 81 | -ms-flex-pack: end; 82 | justify-content: flex-end; 83 | } 84 | 85 | .row-horizontal-between { 86 | -webkit-justify-content: space-between; 87 | -moz-justify-content: space-between; 88 | -webkit-box-pack: justify; 89 | -ms-flex-pack: justify; 90 | justify-content: space-between; 91 | } 92 | 93 | .margin-top { 94 | margin-top: 0.6rem !important; 95 | } 96 | 97 | .border-radius-50 { 98 | border-radius: 50%; 99 | } 100 | 101 | .no-border { 102 | border: none; 103 | } 104 | 105 | .float-left { 106 | float: left; 107 | } 108 | 109 | .float-right { 110 | float: right; 111 | } 112 | 113 | .grey { 114 | color: #aaa !important; 115 | } 116 | 117 | .grey-bg { 118 | background-color: #aaa !important; 119 | } 120 | 121 | .bottom-0 { 122 | position: fixed; 123 | width: 100%; 124 | bottom: 0; 125 | box-shadow: 0px 0px 20px #ddd; 126 | } 127 | 128 | .list .item:first-child { 129 | border: none; 130 | } 131 | 132 | .list .item:last-child { 133 | border-bottom: none; 134 | } 135 | 136 | .item { 137 | border-color: rgba(221, 221, 221, 0.3) !important; 138 | } 139 | 140 | .fixed-bottom { 141 | position: fixed; 142 | bottom: 0; 143 | width: 100%; 144 | z-index: 10000 !important; 145 | } 146 | 147 | .has-bottom-button { 148 | position: relative; 149 | padding-top: 60px; 150 | bottom: 60px !important; 151 | } 152 | 153 | .input-label { 154 | width: 28% !important; 155 | } 156 | 157 | .nowrap { 158 | overflow: hidden; 159 | text-overflow: ellipsis; 160 | white-space: nowrap; 161 | } 162 | 163 | .text-wrap { 164 | white-space: normal !important; 165 | } 166 | 167 | -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/logo.png -------------------------------------------------------------------------------- /images/map/localization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/map/localization.png -------------------------------------------------------------------------------- /images/tabs/find-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/find-off.png -------------------------------------------------------------------------------- /images/tabs/find-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/find-on.png -------------------------------------------------------------------------------- /images/tabs/home-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/home-off.png -------------------------------------------------------------------------------- /images/tabs/home-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/home-on.png -------------------------------------------------------------------------------- /images/tabs/news-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/news-off.png -------------------------------------------------------------------------------- /images/tabs/news-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/news-on.png -------------------------------------------------------------------------------- /images/tabs/service-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/service-off.png -------------------------------------------------------------------------------- /images/tabs/service-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/service-on.png -------------------------------------------------------------------------------- /images/tabs/user-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/user-off.png -------------------------------------------------------------------------------- /images/tabs/user-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DreamPWJ/51apply/0b7c9565f186b18212be90c0be8a8076f9d9007e/images/tabs/user-on.png -------------------------------------------------------------------------------- /pages/account/account.js: -------------------------------------------------------------------------------- 1 | // pages/account/account.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: { 6 | isLogin: util.isLogin() 7 | }, 8 | onLoad: function (options) { 9 | // 页面初始化 options为页面跳转所带来的参数 10 | }, 11 | onReady: function () { 12 | // 页面渲染完成 13 | 14 | }, 15 | onShow: function () { 16 | // 页面显示 17 | this.setData({ 18 | isLogin: util.isLogin(), 19 | userData:wx.getStorageSync("userData")//用户信息 20 | }) 21 | 22 | }, 23 | onHide: function () { 24 | // 页面隐藏 25 | }, 26 | onUnload: function () { 27 | // 页面关闭 28 | } 29 | }) -------------------------------------------------------------------------------- /pages/account/account.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的" 3 | } -------------------------------------------------------------------------------- /pages/account/account.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 登录51报名管家,体验更完善功能 7 | 8 | 注册 10 | 11 | 登录 12 | 13 | 14 | 15 | 16 | 17 | {{userData.Name}} 18 | {{userData.Gender==1?'男':'女'}} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 个人信息 33 | 34 | 35 | 37 | 38 | 证件照 39 | 40 | 41 | 43 | 44 | 增值服务订单 45 | 46 | 47 | 49 | 50 | 继续报名 51 | 52 | 53 | 55 | 56 | 报名记录 57 | 58 | 59 | 61 | 62 | 我的预约 63 | 64 | 65 | 67 | 68 | 成绩查询 69 | 70 | 71 | 73 | 74 | 准考证查询 75 | 76 | 77 | 89 | 91 | 92 | 技术客服 93 | 94 | 95 | 96 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /pages/account/account.wxss: -------------------------------------------------------------------------------- 1 | /* pages/account/account.wxss */ 2 | .p .button { 3 | height: 1.8rem !important; 4 | min-height: 1.8rem !important; 5 | line-height: 1.8rem !important; 6 | border: none; 7 | } 8 | 9 | .item-avatar image { 10 | max-width: 65px !important; 11 | max-height: 65px !important; 12 | } 13 | 14 | .item-avatar.login view { 15 | padding-top: 0.5rem; 16 | padding-left: 1.5rem; 17 | } 18 | 19 | .login .sex { 20 | margin-left: 0.5rem; 21 | padding: 0.1rem; 22 | border-radius: 0.2rem; 23 | font-size: 0.8rem; 24 | } 25 | 26 | .login .grade { 27 | margin-top: 0.8rem; 28 | } 29 | 30 | .item-icon-left .iconfont:first-child{ 31 | font-size: 1.4rem; 32 | } -------------------------------------------------------------------------------- /pages/account/login.js: -------------------------------------------------------------------------------- 1 | // pages/account/login.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | import WxValidate from '../../utils/validate'; 5 | var inputContent = {};//输入内容 6 | Page({ 7 | data: {}, 8 | onLoad: function (options) { 9 | 10 | //退出清除用户数据 11 | wx.removeStorageSync("StudentId");//"用户ID" 12 | wx.removeStorageSync("TokenInfo");//"用户Token" 13 | wx.removeStorageSync("userData");//用户信息 14 | 15 | // 页面初始化 options为页面跳转所带来的参数 16 | //验证表单 17 | this.WxValidate = new WxValidate({ 18 | user: { //验证规则 input name值 19 | required: true, 20 | minlength: 11, 21 | maxlength: 18 22 | }, 23 | password: { 24 | required: true, 25 | minlength: 6, 26 | maxlength: 18 27 | }, 28 | 29 | }, 30 | { 31 | user: { //提示信息 32 | required: "请填写身份证或者手机号", 33 | minlength: "账户至少输入11个字符", 34 | maxlength: "账户最多输入18个字符" 35 | }, 36 | password: { //提示信息 37 | required: "请填写密码", 38 | minlength: "密码至少输入6个字符", 39 | maxlength: "密码最多输入18个字符" 40 | } 41 | }) 42 | }, 43 | onReady: function () { 44 | // 页面渲染完成 45 | }, 46 | onShow: function () { 47 | // 页面显示 48 | }, 49 | onHide: function () { 50 | // 页面隐藏 51 | }, 52 | onUnload: function () { 53 | // 页面关闭 54 | }, 55 | //获取用户输入 56 | bindChange: function (e) { 57 | inputContent[e.currentTarget.id] = e.detail.value 58 | console.log(inputContent); 59 | }, 60 | loginSubmit: function (e) {//登录 61 | //调用验证表单方法 62 | const params = e.detail.value 63 | console.log(params); 64 | if (!this.WxValidate.checkForm(e)) { 65 | const error = this.WxValidate.errorList 66 | wx.showModal({ 67 | title: '友情提示', 68 | content: error[0].msg, 69 | showCancel: false, 70 | confirmColor: "#f26604", 71 | success: function (res) { 72 | if (res.confirm) { 73 | console.log('用户点击确定'); 74 | } 75 | } 76 | }) 77 | console.log(error) 78 | 79 | return false 80 | } 81 | //用户登录 82 | util.https(app.globalData.api + "/UserLogin", "GET", { 83 | inputJson: { 84 | IDCard: inputContent.user, //身份证号 85 | TelNum: inputContent.user, //手机号码 86 | SearchPwd: inputContent.password, //密码 87 | StuLatitude: wx.getStorageSync("latitude"), //用户的纬度 88 | StuLongitude: wx.getStorageSync("longitude"), //用户的经度 89 | TypeId: inputContent.user.length > 11 ? 1 : 2, //注册类型 1 表示身份证号,2表示手机号 90 | }, 91 | praviteKey: app.globalData.praviteKey 92 | }, 93 | this.userLogin 94 | ) 95 | }, 96 | userLogin: function (data) { //用户登录回调 97 | console.log(data); 98 | if (data.StatusCode == 0) { 99 | wx.setStorageSync("StudentId", data.Data.StudentID);//"用户ID" 100 | wx.setStorageSync("TokenInfo", data.Data.TokenInfo);//"用户Token" 101 | wx.setStorageSync("userData", data.Data);//用户信息 102 | 103 | wx.showToast({ 104 | title: '登录成功', 105 | icon: 'success', 106 | duration: 1000 107 | }) 108 | /* wx.switchTab({ 109 | url: '/pages/account/account' 110 | })*/ 111 | //返回上一页 112 | wx.navigateBack({ 113 | delta: 1 114 | }) 115 | } 116 | } 117 | }) -------------------------------------------------------------------------------- /pages/account/login.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "登录" 3 | } -------------------------------------------------------------------------------- /pages/account/login.wxml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 账号 6 | 7 | 8 | 9 | 10 | 密码 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 |
22 | 忘记密码 23 | -------------------------------------------------------------------------------- /pages/account/login.wxss: -------------------------------------------------------------------------------- 1 | /* pages/account/login.wxss */ 2 | .forgetPassword{ 3 | font-size: 0.8rem; 4 | padding: 0.5rem; 5 | } -------------------------------------------------------------------------------- /pages/account/passportphoto.js: -------------------------------------------------------------------------------- 1 | // pages/account/passportphoto.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: {isLogin: util.isLogin()}, 6 | onLoad: function (options) { 7 | // 页面初始化 options为页面跳转所带来的参数 8 | }, 9 | onReady: function () { 10 | // 页面渲染完成 11 | }, 12 | onShow: function () { 13 | // 页面显示 14 | this.setData({ 15 | isLogin: util.isLogin(), 16 | userData: wx.getStorageSync("userData") || ""//用户信息 17 | }) 18 | if (!this.data.isLogin) { //没登录提示登录 19 | util.isLoginModal(); 20 | } else { 21 | //证件照 22 | 23 | } 24 | }, 25 | onHide: function () { 26 | // 页面隐藏 27 | }, 28 | onUnload: function () { 29 | // 页面关闭 30 | }, 31 | 32 | shootCredentials: function () {//图片上传 33 | //选择上传文件 34 | wx.chooseImage({ 35 | success: function (res) { 36 | var tempFilePaths = res.tempFilePaths 37 | wx.uploadFile({ 38 | url: app.globalData.api + '/SetExamPicture', //开发者服务器 url 39 | filePath: tempFilePaths[0],//要上传文件资源的路径 40 | name: 'file',//文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 41 | formData: { //HTTP 请求中其他额外的 form data 42 | 'inputJson': { 43 | 'PicType': 1,////照片类型,1表示计算机考试,2表示教师资格,3表示会计,4考霸或用户的icon,5 考霸证书的照片,6课程的图片,7 课程的附件 44 | }, 45 | 'userId': wx.getStorageSync("StudentId"), 46 | 'Token': wx.getStorageSync("TokenInfo"), 47 | 48 | }, 49 | success: function (res) { 50 | console.log(res); 51 | var data = res.data;//开发者服务器返回的数据 52 | //do something 53 | }, fail: function (error) { 54 | console.log(error); 55 | } 56 | }) 57 | } 58 | }) 59 | } 60 | }) -------------------------------------------------------------------------------- /pages/account/passportphoto.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "证件照" 3 | } -------------------------------------------------------------------------------- /pages/account/passportphoto.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 暂无证件照数据 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /pages/account/passportphoto.wxss: -------------------------------------------------------------------------------- 1 | /* pages/account/passportphoto.wxss */ -------------------------------------------------------------------------------- /pages/account/personalinfo.js: -------------------------------------------------------------------------------- 1 | // pages/account/personalinfo.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | import WxValidate from '../../utils/validate'; 5 | var inputContent = {};//输入内容 6 | Page({ 7 | data: { 8 | isLogin: util.isLogin(), 9 | date: new Date().Format("yyyy-MM-dd"), 10 | entranceDate: new Date().Format("yyyy"), 11 | credentialsIndex: 0, 12 | credentials: ["身份证", "台湾居民往来大陆通行证", "港澳居民往来大陆通行证", "军人证件", "护照"], 13 | nationIndex: 0, 14 | nation: ["汉", "蒙古", "回", "藏", "维吾尔", "苗", "彝", "壮", "布依", "朝鲜", "侗", "瑶", "白", "土家", "哈尼", "哈萨克", "傣", "黎", "其他"],//民族 15 | professionIndex: 0, 16 | profession: ["学生", "事业单位负责人", "企业负责人", "军人", "不便分类的其他从业人员", "失业(含待业及无业人员)", "其他专业技术人员", "行政办公人员", "医疗卫生辅助服务人员", "社会服务和居民生活服务人员", "其他行业"], 17 | cultureIndex: 0, 18 | culture: ["大专", "本科", "硕士"], 19 | degreeIndex: 0, 20 | degree: ["学士", "硕士", "博士", "无学位"], 21 | cultureTypeIndex: 0, 22 | cultureType: ["全日制", "非全日制"], 23 | sexIndex: 0, 24 | sex: ["男", "女"] 25 | }, 26 | onLoad: function (options) { 27 | // 页面初始化 options为页面跳转所带来的参数 28 | 29 | }, 30 | onReady: function () { 31 | // 页面渲染完成 32 | }, 33 | onShow: function () { 34 | // 页面显示 35 | this.setData({ 36 | isLogin: util.isLogin(), 37 | userData: wx.getStorageSync("userData") || ""//用户信息 38 | }) 39 | if (!this.data.isLogin) { //没登录提示登录 40 | util.isLoginModal(); 41 | } else { 42 | //个人信息 43 | //初始化数据 44 | //民族 45 | inputContent["Nation"] = this.data.userData.Nation || this.data.nation[0]; 46 | if (this.data.userData.Nation) { 47 | this.setData({ 48 | nationIndex: this.data.nation.indexOf(this.data.userData.Nation) 49 | }) 50 | } 51 | //职业 52 | inputContent["Job"] = this.data.userData.Job || this.data.profession[0]; 53 | if (this.data.userData.Job) { 54 | this.setData({ 55 | professionIndex: this.data.profession.indexOf(this.data.userData.Job) 56 | }) 57 | } 58 | //学历 59 | inputContent["Education"] = this.data.userData.Education || this.data.culture[0]; 60 | if (this.data.userData.Education) { 61 | this.setData({ 62 | cultureIndex: this.data.culture.indexOf(this.data.userData.Education) 63 | }) 64 | } 65 | //入学时间 66 | inputContent["Admssion"] = this.data.userData.Admssion || this.data.entranceDate[0]; 67 | if (this.data.userData.Admssion) { 68 | this.setData({ 69 | entranceDate: this.data.userData.Admssion 70 | }) 71 | } 72 | inputContent["Birthday"] = this.data.userData.Birthday || this.data.date.replace(/-/g, ""); 73 | if (this.data.userData.Birthday) { 74 | this.setData({ 75 | date: this.data.userData.Birthday 76 | }) 77 | } 78 | inputContent["Gender"] = this.data.userData.Gender || 1; 79 | if (this.data.userData.Gender) { 80 | this.setData({ 81 | sexIndex: this.data.userData.Gender - 1 82 | }) 83 | } 84 | this.wxValidate(); 85 | } 86 | 87 | }, 88 | onHide: function () { 89 | // 页面隐藏 90 | }, 91 | onUnload: function () { 92 | // 页面关闭 93 | }, 94 | wxValidate: function () { 95 | //验证表单 96 | this.WxValidate = new WxValidate({ 97 | IDCard: { //验证规则 input name值 98 | required: true, 99 | idcard: true 100 | }, 101 | Name: { 102 | required: true, 103 | minlength: 2 104 | }, 105 | TelNum: { 106 | required: true, 107 | tel: true 108 | }, 109 | QQNumber: { 110 | required: true, 111 | digits: true, 112 | minlength: 5 113 | }, 114 | University: { 115 | required: true, 116 | minlength: 4 117 | }, 118 | Colledge: { 119 | required: true 120 | }, 121 | MajorCode: { 122 | required: true 123 | }, 124 | ClassCode: { 125 | required: true 126 | }, 127 | }, 128 | { 129 | IDCard: { //提示信息 130 | required: "请填写身份证号" 131 | }, 132 | Name: { //提示信息 133 | required: "请填写真实姓名", 134 | minlength: "姓名至少输入两个字符" 135 | }, 136 | TelNum: { //提示信息 137 | required: "请填写真实手机号码" 138 | }, 139 | QQNumber: { //提示信息 140 | required: "请填写QQ号码" 141 | }, 142 | 143 | University: { //提示信息 144 | required: "请填写学校名称", 145 | minlength: "学校名称至少输入四个字符" 146 | }, 147 | Colledge: { //提示信息 148 | required: "请填写学院信息" 149 | }, 150 | MajorCode: { //提示信息 151 | required: "请填写专业信息" 152 | }, 153 | ClassCode: { //提示信息 154 | required: "请填写班级信息" 155 | } 156 | }) 157 | 158 | }, 159 | //证件类型选择 160 | bindCredentialsPickerChange: function (e) { 161 | this.setData({ 162 | credentialsIndex: e.detail.value 163 | }) 164 | }, 165 | 166 | //民族类型选择 167 | bindNationPickerChange: function (e) { 168 | this.setData({ 169 | nationIndex: e.detail.value 170 | }) 171 | inputContent[e.currentTarget.id] = this.data.nation[e.detail.value] 172 | }, 173 | 174 | //时间类型选择 175 | bindDateChange: function (e) { 176 | this.setData({ 177 | date: e.detail.value 178 | }) 179 | inputContent[e.currentTarget.id] = this.data.date.replace(/-/g, ""); 180 | }, 181 | //入学时间类型选择 182 | bindEntranceDateChange: function (e) { 183 | this.setData({ 184 | entranceDate: e.detail.value 185 | }) 186 | inputContent[e.currentTarget.id] = e.detail.value 187 | }, 188 | //职业类型选择 189 | bindProfessionPickerChange: function (e) { 190 | this.setData({ 191 | professionIndex: e.detail.value 192 | }) 193 | inputContent[e.currentTarget.id] = this.data.profession[e.detail.value] 194 | }, 195 | //学历选择 196 | bindCulturePickerChange: function (e) { 197 | this.setData({ 198 | cultureIndex: e.detail.value 199 | }) 200 | inputContent[e.currentTarget.id] = this.data.culture[e.detail.value] 201 | }, 202 | //学士选择 203 | bindDegreePickerChange: function (e) { 204 | this.setData({ 205 | degreeIndex: e.detail.value 206 | }) 207 | inputContent[e.currentTarget.id] = this.data.degree[e.detail.value] 208 | }, 209 | //学历类型选择 210 | bindCultureTypePickerChange: function (e) { 211 | this.setData({ 212 | cultureTypeIndex: e.detail.value 213 | }) 214 | inputContent[e.currentTarget.id] = this.data.cultureType[e.detail.value] 215 | }, 216 | //性别类型选择 217 | bindSexPickerChange: function (e) { 218 | this.setData({ 219 | sexIndex: e.detail.value 220 | }) 221 | inputContent[e.currentTarget.id] = Number(e.detail.value) + 1; 222 | }, 223 | //获取用户输入 224 | bindChange: function (e) { 225 | inputContent[e.currentTarget.id] = e.detail.value 226 | console.log(inputContent); 227 | }, 228 | /** 229 | * 个人信息提交数据 230 | */ 231 | personalInfoSubmit: function (e) { 232 | //调用验证表单方法 233 | const params = e.detail.value 234 | console.log(params); 235 | inputContent = util.mergeJsonObject(inputContent, params); 236 | console.log(inputContent); 237 | if (!this.WxValidate.checkForm(e)) { 238 | const error = this.WxValidate.errorList 239 | wx.showModal({ 240 | title: '友情提示', 241 | content: error[0].msg, 242 | showCancel: false, 243 | confirmColor: "#f26604", 244 | success: function (res) { 245 | if (res.confirm) { 246 | console.log('用户点击确定'); 247 | } 248 | } 249 | }) 250 | console.log(error) 251 | return false 252 | } 253 | // 毕业年份,毕业年份不需要填,直接根据入学年份加上学历就算出毕业年份了 254 | var seniorYear = inputContent.Admssion 255 | if (this.data.cultureIndex == 0) { 256 | seniorYear = Number(seniorYear) + 3; 257 | } else if (this.data.cultureIndex == 1) { 258 | seniorYear = Number(seniorYear) + 4; 259 | } else if (this.data.cultureIndex == 2) { 260 | seniorYear = Number(seniorYear) + 6; 261 | } 262 | 263 | inputContent.GraduationTime = seniorYear; 264 | //个人信息修改 265 | // 所有有登录状态接口默认带上userId和token。没有登录状态的接口默认带上pkey.防止其他方非法使用web服务的访问 266 | util.https(app.globalData.api + "/UpdateUserProfile", "GET", { 267 | userId: wx.getStorageSync("StudentId"),//用户id 268 | tokenInfo: wx.getStorageSync("TokenInfo"), //用户token 269 | inputJson: inputContent /*{ 270 | // Gender: 1,//1表示男,2表示女 271 | // Name: "报考名", //姓名 272 | // Nation: "汉", //民族 273 | // Job: "php工程师", //职位 274 | // TelNum: "13800138000", //手机号 275 | // QQNumber: "123456780", //qq号 276 | // University: "深圳大学", 277 | // Colledge: "文华学院", 278 | // Education: "本科", //学历 279 | Admssion: "2010", //入学年份 280 | GraduationTime: "2014", //毕业年份,毕业年份不需要填,直接根据入学年份加上学历就算出毕业年份了 281 | // MajorCode: "计算机技术", //专业 282 | // ClassCode: "1班", //班级 283 | // StudentNum: "123456", //考生学号 284 | // Birthday: "19900101", //考生生日 285 | // Address: "武汉科技大学" //考生当前报名地址 286 | }*/ 287 | }, 288 | function (data) { 289 | console.log(data); 290 | util.showToast(data.Msg); 291 | if (data.StatusCode == 0) { 292 | //获取用户信息 293 | util.https(app.globalData.api + "/GetUserProfile", "GET", { 294 | inputJson: { 295 | StudentID: wx.getStorageSync("StudentId"), //身份证号 296 | }, 297 | userId: wx.getStorageSync("StudentId"),//用户id 298 | tokenInfo: wx.getStorageSync("TokenInfo"), //用户token 299 | }, 300 | function (data) { 301 | if (data.StatusCode == 0) { 302 | console.log(data); 303 | wx.setStorageSync("userData", data.Data);//用户信息 304 | } 305 | } 306 | ) 307 | } 308 | } 309 | ) 310 | } 311 | }) -------------------------------------------------------------------------------- /pages/account/personalinfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "个人信息" 3 | } -------------------------------------------------------------------------------- /pages/account/personalinfo.wxml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 基本资料 6 | 7 | 8 | 姓名 9 | 11 | 12 | 13 | 性别 14 | 15 | 17 | 18 | {{sex[sexIndex]}} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 民族 27 | 28 | 30 | 31 | {{nation[nationIndex]}} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 职业 40 | 41 | 43 | 44 | {{profession[professionIndex]}} 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 手机号码 53 | 56 | 57 | 58 | QQ号码 59 | 62 | 63 | 64 | 65 | 身份信息 66 | 67 | 68 | 证件类型 69 | 70 | 72 | 73 | {{credentials[credentialsIndex]}} 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 证件号码 82 | 85 | 86 | 87 | 88 | 出生年月 89 | 90 | 92 | 93 | {{date}} 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 联系地址 104 | 107 | 108 | 109 | 110 | 111 | 112 | 学校与专业 113 | 114 | 115 | 学校 116 | 119 | 120 | 121 | 122 | 学院 123 | 126 | 127 | 128 | 学历 129 | 130 | 132 | 133 | {{culture[cultureIndex]}} 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 学位 142 | 143 | 145 | 146 | {{degree[degreeIndex]}} 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 学历类型 155 | 156 | 158 | 159 | {{cultureType[cultureTypeIndex]}} 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 入学时间 168 | 169 | 172 | 173 | {{entranceDate}} 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 专业 182 | 185 | 186 | 187 | 班级 188 | 191 | 192 | 193 | 学号 194 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 |
205 | -------------------------------------------------------------------------------- /pages/account/personalinfo.wxss: -------------------------------------------------------------------------------- 1 | /* pages/account/personalinfo.wxss */ -------------------------------------------------------------------------------- /pages/account/register.js: -------------------------------------------------------------------------------- 1 | // pages/account/register.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | import WxValidate from '../../utils/validate'; 5 | var inputContent = {};//输入内容 6 | Page({ 7 | data: {}, 8 | onLoad: function (options) { 9 | // 页面初始化 options为页面跳转所带来的参数 10 | //验证表单 11 | this.WxValidate = new WxValidate({ 12 | username: { //验证规则 input name值 13 | required: true, 14 | minlength: 2, 15 | maxlength: 8 16 | }, 17 | user: { //验证规则 input name值 18 | required: true, 19 | idcard: true 20 | }, 21 | school: { 22 | required: true, 23 | minlength: 3 24 | }, 25 | password: { 26 | required: true, 27 | minlength: 6, 28 | maxlength: 18 29 | }, 30 | qq: { 31 | required: true, 32 | digits: true, 33 | minlength: 5 34 | }, 35 | 36 | }, 37 | { 38 | username: { //提示信息 39 | required: "请填写用户姓名" 40 | }, 41 | user: { //提示信息 42 | required: "请填写身份证" 43 | }, 44 | school: { //提示信息 45 | required: "请填写学校名称", 46 | minlength: "学校至少输入3个字符", 47 | }, 48 | password: { //提示信息 49 | required: "请填写密码", 50 | minlength: "密码至少输入6个字符", 51 | maxlength: "密码最多输入18个字符" 52 | }, 53 | qq: { 54 | required: "请填写QQ号 方便密码找回" 55 | } 56 | }) 57 | }, 58 | onReady: function () { 59 | // 页面渲染完成 60 | }, 61 | onShow: function () { 62 | // 页面显示 63 | }, 64 | onHide: function () { 65 | // 页面隐藏 66 | }, 67 | onUnload: function () { 68 | // 页面关闭 69 | }, 70 | //获取用户输入 71 | bindChange: function (e) { 72 | inputContent[e.currentTarget.id] = e.detail.value 73 | console.log(inputContent); 74 | }, 75 | registerSubmit: function (e) {//登录 76 | //调用验证表单方法 77 | const params = e.detail.value 78 | console.log(params); 79 | if (!this.WxValidate.checkForm(e)) { 80 | const error = this.WxValidate.errorList 81 | wx.showModal({ 82 | title: '友情提示', 83 | content: error[0].msg, 84 | showCancel: false, 85 | confirmColor: "#f26604", 86 | success: function (res) { 87 | if (res.confirm) { 88 | console.log('用户点击确定'); 89 | } 90 | } 91 | }) 92 | console.log(error) 93 | 94 | return false 95 | } 96 | //首页活动报名列表 97 | util.https(app.globalData.api + "/QuickRegister", "GET", { 98 | inputJson: { 99 | Name: inputContent.username, //姓名 100 | QQNumber: inputContent.qq, //个人qq号,方便密码找回 101 | IDCard: inputContent.user, //身份证号 102 | TelNum: "", //手机号码 103 | University: inputContent.school,//学校 104 | SearchPwd: inputContent.password, //密码 105 | StuLatitude: wx.getStorageSync("latitude"), //用户的纬度 106 | StuLongitude: wx.getStorageSync("longitude"), //用户的经度 107 | TypeId: "1", //注册类型 1 表示身份证号,2表示手机号 108 | }, 109 | praviteKey: app.globalData.praviteKey 110 | }, 111 | this.userRegister 112 | ) 113 | }, 114 | userRegister: function (data) { //用户注册回调 115 | console.log(data); 116 | if (data.StatusCode == 0) { 117 | this.loginSubmit();//注册成功后自动登录 118 | wx.showToast({ 119 | title: '注册成功', 120 | icon: 'success', 121 | duration: 1000 122 | }) 123 | wx.switchTab({ 124 | url: '/pages/index/index' 125 | }) 126 | 127 | } 128 | }, 129 | loginSubmit: function () {//登录 130 | //首页活动报名列表 131 | util.https(app.globalData.api + "/UserLogin", "GET", { 132 | inputJson: { 133 | IDCard: inputContent.user, //身份证号 134 | TelNum: "", //手机号码 135 | SearchPwd: inputContent.password, //密码 136 | StuLatitude: wx.getStorageSync("latitude"), //用户的纬度 137 | StuLongitude: wx.getStorageSync("longitude"), //用户的经度 138 | TypeId: "1", //注册类型 1 表示身份证号,2表示手机号 139 | }, 140 | praviteKey: app.globalData.praviteKey 141 | }, 142 | this.userLogin 143 | ) 144 | }, 145 | userLogin: function (data) { //用户登录回调 146 | console.log(data); 147 | if (data.StatusCode == 0) { 148 | wx.setStorageSync("StudentId", data.Data.StudentID);//"用户ID" 149 | wx.setStorageSync("TokenInfo", data.Data.TokenInfo);//"用户Token" 150 | wx.setStorageSync("userData", data.Data);//用户信息 151 | 152 | } 153 | } 154 | 155 | }) -------------------------------------------------------------------------------- /pages/account/register.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "注册" 3 | } -------------------------------------------------------------------------------- /pages/account/register.wxml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 姓名 6 | 7 | 8 | 9 | 10 | 身份证号 11 | 12 | 13 | 14 | 学校 15 | 16 | 17 | 18 | 密码 19 | 20 | 21 | 25 | 26 | QQ号 27 | 28 | 29 | 30 | 31 | 以上信息请保持与本人身份证一致,否则将会影响你的报名 32 | 33 | 35 | 36 | 37 |
-------------------------------------------------------------------------------- /pages/account/register.wxss: -------------------------------------------------------------------------------- 1 | /* pages/account/register.wxss */ 2 | .hint { 3 | padding:15px 8px!important; 4 | font-size: 0.7rem; 5 | color: #262626; 6 | } -------------------------------------------------------------------------------- /pages/account/subscribe.js: -------------------------------------------------------------------------------- 1 | // pages/account/subscribe.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: { 6 | isLogin: util.isLogin(), 7 | winWidth: 0, 8 | winHeight: 0, 9 | currentTab: 0 // tab切换 10 | }, 11 | onLoad: function (options) { 12 | // 页面初始化 options为页面跳转所带来的参数 13 | var that = this; 14 | 15 | /** 16 | * 获取系统信息 17 | */ 18 | wx.getSystemInfo({ 19 | success: function (res) { 20 | that.setData({ 21 | winWidth: res.windowWidth, 22 | winHeight: res.windowHeight 23 | }); 24 | } 25 | 26 | }); 27 | }, 28 | onReady: function () { 29 | // 页面渲染完成 30 | }, 31 | onShow: function () { 32 | // 页面显示 33 | this.setData({ 34 | isLogin: util.isLogin(), 35 | userData: wx.getStorageSync("userData") || ""//用户信息 36 | }) 37 | if (!this.data.isLogin) { //没登录提示登录 38 | util.isLoginModal(); 39 | } else { 40 | //我的预约 41 | this.getMyAllOrderInfoHttps() 42 | } 43 | }, 44 | onHide: function () { 45 | // 页面隐藏 46 | }, 47 | onUnload: function () { 48 | // 页面关闭 49 | }, 50 | getMyAllOrderInfoHttps: function () { //获取用户的我的预约列表 51 | // 所有有登录状态接口默认带上userId和token。没有登录状态的接口默认带上pkey.防止其他方非法使用web服务的访问 52 | util.https(app.globalData.api + "/GetMyAllOrderInfo", "GET", { 53 | userId: wx.getStorageSync("StudentId"),//用户id 54 | tokenInfo: wx.getStorageSync("TokenInfo") //用户token 55 | }, 56 | this.getMyAllOrderInfo 57 | ) 58 | }, 59 | getMyAllOrderInfo: function (data) { 60 | console.log(data); 61 | this.setData({ 62 | myAllOrderInfo: data.Data 63 | 64 | }) 65 | }, 66 | /** 67 | * 滑动切换tab 68 | */ 69 | bindChange: function (e) { 70 | 71 | var that = this; 72 | that.setData({currentTab: e.detail.current}); 73 | 74 | }, 75 | /** 76 | * 点击tab切换 77 | */ 78 | swichNav: function (e) { 79 | 80 | var that = this; 81 | 82 | if (this.data.currentTab === e.target.dataset.current) { 83 | return false; 84 | } else { 85 | that.setData({ 86 | currentTab: e.target.dataset.current 87 | }) 88 | } 89 | } 90 | }) -------------------------------------------------------------------------------- /pages/account/subscribe.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的预约" 3 | } -------------------------------------------------------------------------------- /pages/account/subscribe.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 考试报名预约 5 | 成绩查询预约 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 无考试报名预约数据 16 | 17 | 18 | {{item.ExamName}} 19 | 科目 : {{item.SubjectName}} 20 | 时间 : {{item.ExamTimes}} 21 | 预约状态 : {{item.OrderStatus}} 22 | 官网状态 : {{item.OfficeWebStatus}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 无成绩查询预约数据 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /pages/account/subscribe.wxss: -------------------------------------------------------------------------------- 1 | /* pages/account/subscribe.wxss */ 2 | .swiper-tab { 3 | position: fixed; 4 | z-index: 10000; 5 | top: 0; 6 | text-align: center; 7 | background-color: #f8f8f8; 8 | } 9 | 10 | .swiper-tab-list { 11 | font-size: 16px; 12 | box-sizing: border-box; 13 | display: inline-block; 14 | color: #777777; 15 | padding: 0.5rem; 16 | } 17 | 18 | .on { 19 | color: #f26604; 20 | border-bottom: 2px solid #f26604; 21 | } 22 | 23 | .swiper-box { 24 | display: block; 25 | margin-top: 50px; 26 | width: 100%; 27 | overflow: hidden; 28 | } 29 | 30 | .swiper-box view { 31 | 32 | } 33 | 34 | .item .p:first-child { 35 | padding-top: 0.3rem; 36 | } 37 | -------------------------------------------------------------------------------- /pages/activity/activityapply.js: -------------------------------------------------------------------------------- 1 | // pages/activity/activityapply.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: { 6 | shapeIndex: 0, 7 | shape: ["线上", "线下"] 8 | }, 9 | onLoad: function (options) { 10 | // 页面初始化 options为页面跳转所带来的参数 11 | //活动详情信息 12 | this.getActivityDetails(); 13 | //误操作提示 14 | /* if (!wx.getStorageSync("isManyPeoplePrompt")) {*/ 15 | wx.showModal({ 16 | title: '友情提示', 17 | content: "请勿使用同一个小程序或App给多人报名,造成信息错误后果自行承担!", 18 | showCancel: false, 19 | confirmColor: "#f26604", 20 | success: function (res) { 21 | if (res.confirm) { 22 | wx.setStorageSync("isManyPeoplePrompt", true); 23 | console.log('用户点击确定'); 24 | 25 | } 26 | } 27 | }) 28 | /* }*/ 29 | 30 | }, 31 | onReady: function () { 32 | // 页面渲染完成 33 | }, 34 | onShow: function () { 35 | // 页面显示 36 | }, 37 | onHide: function () { 38 | // 页面隐藏 39 | }, 40 | onUnload: function () { 41 | // 页面关闭 42 | }, 43 | //报名形式选择 44 | bindShapePickerChange: function (e) { 45 | this.setData({ 46 | shapeIndex: e.detail.value 47 | }) 48 | }, 49 | //活动详情信息 50 | getActivityDetails: function () { 51 | util.https(app.globalData.api + "/GetActiveDetail", "GET", { 52 | inputJson: { 53 | ActiveId: "1", //传入选择活动的ID 54 | Latitude: wx.getStorageSync("latitude"), //纬度 55 | Longitude: wx.getStorageSync("longitude"), //经度 56 | }, 57 | praviteKey: app.globalData.praviteKey 58 | }, 59 | this.getActivityDetailsData 60 | ) 61 | 62 | }, 63 | //活动详情信息数据处理 64 | getActivityDetailsData: function (data) { 65 | console.log(data); 66 | this.setData({ 67 | activityDetails: data.Data 68 | }) 69 | } 70 | }) -------------------------------------------------------------------------------- /pages/activity/activityapply.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "活动报名" 3 | } -------------------------------------------------------------------------------- /pages/activity/activityapply.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 活动介绍 6 | 7 | 8 | 活动名称 9 | 10 | 13 | 14 | {{headExamType[headExamTypeIndex].ExamTypeName}} 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 形式选择 23 | 24 | 26 | 27 | {{shape[shapeIndex]}} 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 活动省份 36 | 37 | 41 | 42 | {{examProvinceList[provinceListIndex].ProvinceName}} 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 活动地点 51 | 52 | 55 | 56 | {{examPlace[examPlaceIndex].SchoolName}} 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 具体地址 66 | {{examPlaceItem.TelNum}} 67 | 68 | 69 | 活动信息 70 | 71 | 72 | 73 | {{activityDetails.ActiveName}} 74 | 75 | 时间 : {{activityDetails.ActiveBeginDate}} 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /pages/activity/activityapply.wxss: -------------------------------------------------------------------------------- 1 | /* pages/activity/activityapply.wxss */ -------------------------------------------------------------------------------- /pages/activity/activityapplymore.js: -------------------------------------------------------------------------------- 1 | // pages/activity/activityapplymore.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: {}, 6 | onLoad: function (options) { 7 | // 页面初始化 options为页面跳转所带来的参数 8 | //首页活动报名列表 9 | util.https(app.globalData.api + "/GetHeadActiveList", "GET", { 10 | inputJson: { 11 | StudentID: wx.getStorageSync("StudentId") ? wx.getStorageSync("StudentId") : 0//传入用户的ID,如果是没登录状态就给0,如果是已经登录就返回userID. 12 | }, 13 | praviteKey: app.globalData.praviteKey 14 | }, 15 | this.getHeadActiveList 16 | ) 17 | }, 18 | onReady: function () { 19 | // 页面渲染完成 20 | }, 21 | onShow: function () { 22 | // 页面显示 23 | }, 24 | onHide: function () { 25 | // 页面隐藏 26 | }, 27 | onUnload: function () { 28 | // 页面关闭 29 | }, //首页活动报名列表 30 | getHeadActiveList: function (data) { 31 | console.log(data); 32 | var headActiveList = data.Data; 33 | for (var index in headActiveList) { 34 | //考试时间差 35 | headActiveList[index].differdays = Math.floor((new Date(headActiveList[index].EndDate).getTime() - new Date().getTime()) / (24 * 3600 * 1000)); 36 | } 37 | this.setData({ 38 | headActiveList: headActiveList 39 | }); 40 | 41 | }, 42 | }) -------------------------------------------------------------------------------- /pages/activity/activityapplymore.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "活动报名" 3 | } -------------------------------------------------------------------------------- /pages/activity/activityapplymore.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 暂无活动报名数据 6 | 7 | 8 | 9 | 10 | {{item.differdays}} 11 | 12 | {{item.ActiveName}} 13 | 活动地点 : {{item.ActiveAddress}} 14 | 报名时间 : {{item.SignTimes}} 15 | 16 | 18 | {{item.differdays<10?'立即':'预约'}}报名 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /pages/activity/activityapplymore.wxss: -------------------------------------------------------------------------------- 1 | /* pages/activity/activityapplymore.wxss */ 2 | @import "../index/index.wxss"; -------------------------------------------------------------------------------- /pages/address/addaddress.js: -------------------------------------------------------------------------------- 1 | // pages/address/addaddress.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | import WxValidate from '../../utils/validate'; 5 | var inputContent = {};//输入内容 6 | Page({ 7 | data: {}, 8 | onLoad: function (options) { 9 | // 页面初始化 options为页面跳转所带来的参数 10 | 11 | }, 12 | onReady: function () { 13 | // 页面渲染完成 14 | }, 15 | onShow: function () { 16 | // 页面显示 17 | //验证表单 18 | this.WxValidate = new WxValidate({ 19 | ReceiveName: { //验证规则 input name值 20 | required: true, 21 | minlength: 2, 22 | maxlength: 6 23 | }, 24 | ReceiveTel: { 25 | required: true, 26 | tel: true 27 | }, 28 | ReceiveAdd: { 29 | required: true, 30 | minlength: 5 31 | }, 32 | 33 | }, 34 | { 35 | ReceiveName: { //提示信息 36 | required: "请填写收件人", 37 | }, 38 | ReceiveTel: { //提示信息 39 | required: "请填写手机号码" 40 | }, 41 | ReceiveAdd: { //提示信息 42 | required: "请填写收货地址", 43 | minlength: "收货地址至少输入五个字符" 44 | } 45 | }) 46 | }, 47 | onHide: function () { 48 | // 页面隐藏 49 | }, 50 | onUnload: function () { 51 | // 页面关闭 52 | }, 53 | //获取用户输入 54 | bindChange: function (e) { 55 | inputContent[e.currentTarget.id] = e.detail.value 56 | console.log(inputContent); 57 | }, 58 | addAddressSubmit: function (e) { //增加地址 59 | //调用验证表单方法 60 | const params = e.detail.value 61 | console.log(params); 62 | if (!this.WxValidate.checkForm(e)) { 63 | const error = this.WxValidate.errorList 64 | wx.showModal({ 65 | title: '友情提示', 66 | content: error[0].msg, 67 | showCancel: false, 68 | confirmColor: "#f26604", 69 | success: function (res) { 70 | if (res.confirm) { 71 | console.log('用户点击确定'); 72 | } 73 | } 74 | }) 75 | console.log(error) 76 | 77 | return false 78 | } 79 | util.https(app.globalData.api + "/SetMyAddress", "GET", { 80 | inputJson: { 81 | ReceiveName: inputContent.ReceiveName, //表示收件人 82 | ReceiveTel: inputContent.ReceiveTel, // 表示收件人电话 83 | ReceiveAdd: inputContent.ReceiveAdd, //表示收件人地址 84 | }, 85 | userId: wx.getStorageSync("StudentId"),//用户id 86 | tokenInfo: wx.getStorageSync("TokenInfo"), //用户token 87 | }, 88 | function (data) { 89 | console.log(data); 90 | //返回上一页 91 | wx.navigateBack({ 92 | delta: 1 93 | }) 94 | } 95 | ) 96 | } 97 | }) -------------------------------------------------------------------------------- /pages/address/addaddress.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "新增地址" 3 | } -------------------------------------------------------------------------------- /pages/address/addaddress.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 收件人 7 | 9 | 10 | 11 | 手机号码 12 | 14 | 15 | 16 | 收货地址 17 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | -------------------------------------------------------------------------------- /pages/address/addaddress.wxss: -------------------------------------------------------------------------------- 1 | /* pages/address/addaddress.wxss */ -------------------------------------------------------------------------------- /pages/address/addressmanage.js: -------------------------------------------------------------------------------- 1 | // pages/address/addressmanage.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: {}, 6 | onLoad: function (options) { 7 | // 页面初始化 options为页面跳转所带来的参数 8 | //获取收货地址 9 | util.https(app.globalData.api + "/GetMyAddress", "GET", { 10 | userId: wx.getStorageSync("StudentId"),//用户id 11 | tokenInfo: wx.getStorageSync("TokenInfo"), //用户token 12 | }, 13 | this.getAddress 14 | ) 15 | }, 16 | onReady: function () { 17 | // 页面渲染完成 18 | }, 19 | onShow: function () { 20 | // 页面显示 21 | }, 22 | onHide: function () { 23 | // 页面隐藏 24 | }, 25 | onUnload: function () { 26 | // 页面关闭 27 | }, 28 | getAddress: function (data) { 29 | console.log(data); 30 | this.setData({ 31 | addressList: data.Data 32 | }) 33 | }, 34 | //增加地址页面 35 | addDress: function () { 36 | wx.navigateTo({ 37 | url: '../address/addaddress' 38 | }) 39 | } 40 | }) -------------------------------------------------------------------------------- /pages/address/addressmanage.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "地址管理" 3 | } -------------------------------------------------------------------------------- /pages/address/addressmanage.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 暂无地址数据 7 | 8 | 9 | 收件人 : {{addressList.ReceiveName}} 10 | 手机号 : {{addressList.ReceiveTel}} 11 | 收货地址 : {{addressList.ReceiveAdd}} 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /pages/address/addressmanage.wxss: -------------------------------------------------------------------------------- 1 | /* pages/address/addressmanage.wxss */ -------------------------------------------------------------------------------- /pages/apply/applyperson.js: -------------------------------------------------------------------------------- 1 | // pages/apply/applyperson.js 2 | //获取应用实例 3 | var app = getApp(); 4 | var util = require('../../utils/util.js'); 5 | var inputContent = {};//输入内容 6 | import WxValidate from '../../utils/validate' 7 | Page({ 8 | data: { 9 | isLogin: util.isLogin(), 10 | date: new Date().Format("yyyy-MM-dd"), 11 | entranceDate: new Date().Format("yyyy"), 12 | credentialsIndex: 0, 13 | credentials: ["身份证", "台湾居民往来大陆通行证", "港澳居民往来大陆通行证", "军人证件", "护照"], 14 | nationIndex: 0, 15 | nation: ["汉", "蒙古", "回", "藏", "维吾尔", "苗", "彝", "壮", "布依", "朝鲜", "侗", "瑶", "白", "土家", "哈尼", "哈萨克", "傣", "黎", "其他"],//民族 16 | professionIndex: 0, 17 | profession: ["学生", "事业单位负责人", "企业负责人", "军人", "不便分类的其他从业人员", "失业(含待业及无业人员)", "其他专业技术人员", "行政办公人员", "医疗卫生辅助服务人员", "社会服务和居民生活服务人员", "其他行业"], 18 | cultureIndex: 0, 19 | culture: ["大专", "本科", "硕士"], 20 | degreeIndex: 0, 21 | degree: ["学士", "硕士", "博士", "无学位"], 22 | cultureTypeIndex: 0, 23 | cultureType: ["全日制", "非全日制"], 24 | sexIndex: 0, 25 | sex: ["男", "女"] 26 | }, 27 | onLoad: function (options) { 28 | console.log(options); 29 | // 页面初始化 options为页面跳转所带来的参数 30 | inputContent = JSON.parse(options.inputContent);//接受上一步操作参数 31 | //考试的动态填写字段获取 不同的考试,有些自己特有的字段 32 | util.https(app.globalData.api + "/GetExamTypeFieldList", "GET", { 33 | inputJson: { 34 | ExamTypeId: inputContent.ExamType //考试类型ID 35 | }, 36 | praviteKey: app.globalData.praviteKey 37 | }, 38 | this.getExamTypeFieldList 39 | ) 40 | //获取地理位置信息 高德web api 41 | /* util.https("https://restapi.amap.com/v3/geocode/regeo", "GET", { 42 | key: '972cafdc2472d8f779c5274db770ac22', 43 | location: Number(wx.getStorageSync("longitude")).toFixed(6) + "," + Number(wx.getStorageSync("latitude")).toFixed(6) 44 | }, 45 | this.getCurrentCityInfo 46 | )*/ 47 | //初始化数据 48 | inputContent["IDType"] = 1; 49 | inputContent["Nation"] = this.data.nation[0]; 50 | inputContent["Job"] = this.data.profession[0]; 51 | inputContent["Admssion"] = this.data.entranceDate[0]; 52 | inputContent["Education"] = this.data.culture[0]; 53 | if (this.data.credentialsIndex != 0) { 54 | inputContent["Birthday"] = this.data.date.replace(/-/g, ""); 55 | inputContent["Gender"] = 1; 56 | } 57 | inputContent.AutoData = []; 58 | }, 59 | onReady: function () { 60 | // 页面渲染完成 61 | }, 62 | onShow: function () { 63 | // 页面显示 64 | this.setData({ 65 | isLogin: util.isLogin(), 66 | userData: wx.getStorageSync("userData") || ""//用户信息 67 | }) 68 | console.log(wx.getStorageSync("userData")); 69 | //验证表单 70 | this.wxValidate(); 71 | if (this.data.isLogin) { //已登录 72 | //民族 73 | inputContent["Nation"] = this.data.userData.Nation || this.data.nation[0]; 74 | if (this.data.userData.Nation) { 75 | this.setData({ 76 | nationIndex: this.data.nation.indexOf(this.data.userData.Nation) 77 | }) 78 | } 79 | //职业 80 | inputContent["Job"] = this.data.userData.Job || this.data.profession[0]; 81 | if (this.data.userData.Job) { 82 | this.setData({ 83 | professionIndex: this.data.profession.indexOf(this.data.userData.Job) 84 | }) 85 | } 86 | //学历 87 | inputContent["Education"] = this.data.userData.Education || this.data.culture[0]; 88 | if (this.data.userData.Education) { 89 | this.setData({ 90 | cultureIndex: this.data.culture.indexOf(this.data.userData.Education) 91 | }) 92 | } 93 | //入学时间 94 | inputContent["Admssion"] = this.data.userData.Admssion || this.data.entranceDate[0]; 95 | if (this.data.userData.Admssion) { 96 | this.setData({ 97 | entranceDate: this.data.userData.Admssion 98 | }) 99 | } 100 | } 101 | }, 102 | onHide: function () { 103 | // 页面隐藏 104 | }, 105 | onUnload: function () { 106 | // 页面关闭 107 | }, 108 | wxValidate: function () { 109 | //验证表单 110 | this.WxValidate = new WxValidate({ 111 | IDCard: { //验证规则 input name值 112 | required: true, 113 | idcard: true 114 | }, 115 | Name: { 116 | required: true, 117 | minlength: 2 118 | }, 119 | TelNum: { 120 | required: true, 121 | tel: true 122 | }, 123 | QQNumber: { 124 | required: true, 125 | digits: true, 126 | minlength: 5 127 | }, 128 | SearchPwd: { 129 | required: !this.data.isLogin, 130 | minlength: 6, 131 | maxlength: 18 132 | }, 133 | University: { 134 | required: true, 135 | minlength: 4 136 | }, 137 | Colledge: { 138 | required: true 139 | }, 140 | MajorCode: { 141 | required: true 142 | }, 143 | ClassCode: { 144 | required: true 145 | }, 146 | }, 147 | { 148 | IDCard: { //提示信息 149 | required: "请填写身份证号" 150 | }, 151 | Name: { //提示信息 152 | required: "请填写真实姓名", 153 | minlength: "姓名至少输入两个字符" 154 | }, 155 | TelNum: { //提示信息 156 | required: "请填写真实手机号码" 157 | }, 158 | QQNumber: { //提示信息 159 | required: "请填写QQ号码" 160 | }, 161 | SearchPwd: { //提示信息 162 | required: "请填写密码", 163 | minlength: "密码至少输入6个字符", 164 | maxlength: "密码最多输入18个字符" 165 | }, 166 | University: { //提示信息 167 | required: "请填写学校名称", 168 | minlength: "学校名称至少输入四个字符" 169 | }, 170 | Colledge: { //提示信息 171 | required: "请填写学院信息" 172 | }, 173 | MajorCode: { //提示信息 174 | required: "请填写专业信息" 175 | }, 176 | ClassCode: { //提示信息 177 | required: "请填写班级信息" 178 | } 179 | }) 180 | 181 | }, 182 | //考试的动态填写字段获取 不同的考试,有些自己特有的字段 183 | getExamTypeFieldList: function (data) { 184 | console.log(data); 185 | this.setData({ 186 | examTypeFieldList: data.Data 187 | 188 | }) 189 | }, 190 | 191 | //获取地理位置信息 高德web api 192 | /* getCurrentCityInfo: function (data) { 193 | console.log(data); 194 | this.setData({ 195 | currentCityAddress: data.status == 1 ? data.regeocode.formatted_address : "" 196 | 197 | }) 198 | },*/ 199 | 200 | //证件类型选择 201 | bindCredentialsPickerChange: function (e) { 202 | this.setData({ 203 | credentialsIndex: e.detail.value 204 | }) 205 | inputContent[e.currentTarget.id] = Number(e.detail.value) + 1; 206 | 207 | }, 208 | 209 | //民族类型选择 210 | bindNationPickerChange: function (e) { 211 | this.setData({ 212 | nationIndex: e.detail.value 213 | }) 214 | inputContent[e.currentTarget.id] = this.data.nation[e.detail.value] 215 | }, 216 | 217 | //时间类型选择 218 | bindDateChange: function (e) { 219 | this.setData({ 220 | date: e.detail.value 221 | }) 222 | inputContent[e.currentTarget.id] = this.data.date.replace(/-/g, ""); 223 | }, 224 | //入学时间类型选择 225 | bindEntranceDateChange: function (e) { 226 | this.setData({ 227 | entranceDate: e.detail.value 228 | }) 229 | inputContent[e.currentTarget.id] = e.detail.value 230 | }, 231 | //职业类型选择 232 | bindProfessionPickerChange: function (e) { 233 | this.setData({ 234 | professionIndex: e.detail.value 235 | }) 236 | if (this.data.professionIndex == 0) { 237 | //验证表单 238 | this.wxValidate(); 239 | } else { 240 | //验证表单 241 | this.WxValidate = new WxValidate({ 242 | IDCard: { //验证规则 input name值 243 | required: true, 244 | idcard: true 245 | }, 246 | Name: { 247 | required: true, 248 | minlength: 2 249 | }, 250 | TelNum: { 251 | required: true, 252 | tel: true 253 | }, 254 | QQNumber: { 255 | required: true, 256 | digits: true, 257 | minlength: 5 258 | }, 259 | SearchPwd: { 260 | required: !this.data.isLogin, 261 | minlength: 6, 262 | maxlength: 18 263 | }, 264 | Address: { 265 | required: true, 266 | minlength: 5 267 | }, 268 | 269 | }, 270 | { 271 | IDCard: { //提示信息 272 | required: "请填写身份证号" 273 | }, 274 | Name: { //提示信息 275 | required: "请填写真实姓名", 276 | minlength: "姓名至少输入两个字符" 277 | }, 278 | TelNum: { //提示信息 279 | required: "请填写真实手机号码" 280 | }, 281 | QQNumber: { //提示信息 282 | required: "请填写QQ号码" 283 | }, 284 | SearchPwd: { //提示信息 285 | required: "请填写密码", 286 | minlength: "密码至少输入6个字符", 287 | maxlength: "密码最多输入18个字符" 288 | }, 289 | Address: { //提示信息 290 | required: "请填写联系地址", 291 | minlength: "联系地址至少输入五个字符" 292 | }, 293 | 294 | }) 295 | } 296 | 297 | 298 | inputContent[e.currentTarget.id] = this.data.profession[e.detail.value] 299 | }, 300 | //学历选择 301 | bindCulturePickerChange: function (e) { 302 | this.setData({ 303 | cultureIndex: e.detail.value 304 | }) 305 | inputContent[e.currentTarget.id] = this.data.culture[e.detail.value] 306 | }, 307 | //学士选择 308 | bindDegreePickerChange: function (e) { 309 | this.setData({ 310 | degreeIndex: e.detail.value 311 | }) 312 | }, 313 | //学历类型选择 314 | bindCultureTypePickerChange: function (e) { 315 | this.setData({ 316 | cultureTypeIndex: e.detail.value 317 | }) 318 | }, 319 | //性别类型选择 320 | bindSexPickerChange: function (e) { 321 | this.setData({ 322 | sexIndex: e.detail.value 323 | }) 324 | inputContent[e.currentTarget.id] = Number(e.detail.value) + 1; 325 | }, 326 | //获取用户输入 327 | bindChange: function (e) { 328 | inputContent[e.currentTarget.id] = e.detail.value 329 | console.log(inputContent); 330 | }, 331 | //获取用户输入的动态字段 332 | bindChangeAuto: function (e) { 333 | inputContent.AutoData.push({ 334 | TypeFieldId: e.currentTarget.id,//自动字段ID,来源于接口99的返回 335 | AutoValue: e.detail.value //自动字段用户填写输入的信息 336 | }) 337 | console.log(inputContent); 338 | }, 339 | /** 340 | * 考试报名最终提交数据 341 | */ 342 | applySubmit: function (e) { 343 | //调用验证表单方法 344 | const params = e.detail.value 345 | console.log(params); 346 | if (this.data.isLogin) { //已登录自动获取数据 347 | inputContent.SearchPwd = ""; 348 | inputContent = util.mergeJsonObject(inputContent, params) 349 | } 350 | if (!this.WxValidate.checkForm(e)) { 351 | const error = this.WxValidate.errorList 352 | wx.showModal({ 353 | title: '友情提示', 354 | content: error[0].msg, 355 | showCancel: false, 356 | confirmColor: "#f26604", 357 | success: function (res) { 358 | if (res.confirm) { 359 | console.log('用户点击确定'); 360 | } 361 | } 362 | }) 363 | console.log(error) 364 | 365 | return false 366 | } 367 | 368 | var inputJson = { 369 | OperatorType: !wx.getStorageSync("TokenInfo") ? 1 : 2,// 如果用户没登陆过,就给0,登录过给1 "提交类别" 1表示没有注册过,第一次报名提交,2表示已经快速注册,3 表示立即支付进入 370 | // Name: "", //姓名 371 | // SearchPwd: "", //登录密码,如果是已经注册过的用户不需要再次传入密码,直接设置为空 372 | // IDType: "", //1表示身份证号 373 | // IDCard: "", //证件号,该值必须传入 374 | // Birthday: 19960101, // 自动获取身份证号中的8位 375 | // Gender:1,//1表示男,2表示女 376 | // Nation: "", //民族 377 | // Job: "学生", //职位 378 | // TelNum: "13800138000", //手机号 379 | // QQNumber: "", //qq号 380 | // University: "深圳大学",//学校 381 | // Colledge: "计算机学院",//学院 382 | // Education: "本科", //学历 383 | // Admssion: "2010", //入学年份字符串 384 | // GraduationTime: "2014", //毕业年份,毕业年份不需要填,直接根据入学年份加上学历就算出毕业年份了 385 | // MajorCode: "计算机技术", //专业 386 | // ClassCode: "1班", //班级 387 | // Address: "武汉市金融港", //用户当前地址 388 | 389 | // SchoolID: "1", //考点ID号,该值必须传入 390 | // SubjectId: "4", //科目ID号,该值必须传入 391 | // ExamType: "1", //包括类型,1表示计算机考试,2表示会计,3表示教师资格…,该值必须传入 392 | // ProvinceName: "湖北省",//省份名称 393 | // IsJoin: "0", //模拟考试ID,0表示没参加。最多传入一个考试科目ID 勾选了模拟考试就给1,没勾就给0 394 | // BookID: "0", //需要的教材ID,如果有多本就用,号分割,没有预定就是0 395 | // ReceiveName: "",// 表示收件人 396 | // ReceiveTel: "", // 表示收件人电话 397 | // ReceiveAdd: "",// 表示收件人地址 398 | // OpenId: "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",// 微信用户标示 399 | /*AutoData: [ 400 | { 401 | TypeFieldId: "",//自动字段ID,来源于接口99的返回 402 | AutoValue: "" //自动字段用户填写输入的信息 403 | }]*/ 404 | 405 | } 406 | 407 | 408 | //根据身份证 自动获取生日和性别 409 | if (this.data.credentialsIndex == 0) { 410 | var iIdNo = inputContent.IDCard; 411 | var sex = ""; 412 | var tmpStr = ""; 413 | if (iIdNo.length == 15) { 414 | tmpStr = iIdNo.substring(6, 12); 415 | tmpStr = "19" + tmpStr; 416 | sex = (iIdNo.substring(14, 15)) % 2 == 0 ? 2 : 1 417 | } 418 | else { 419 | tmpStr = iIdNo.substring(6, 14); 420 | sex = (iIdNo.substring(16, 17)) % 2 == 0 ? 2 : 1 421 | } 422 | 423 | inputJson.Birthday = tmpStr; 424 | inputJson.Gender = sex; 425 | } 426 | 427 | // 毕业年份,毕业年份不需要填,直接根据入学年份加上学历就算出毕业年份了 428 | var seniorYear = inputContent.Admssion 429 | if (this.data.cultureIndex == 0) { 430 | seniorYear = Number(seniorYear) + 3; 431 | } else if (this.data.cultureIndex == 1) { 432 | seniorYear = Number(seniorYear) + 4; 433 | } else if (this.data.cultureIndex == 2) { 434 | seniorYear = Number(seniorYear) + 6; 435 | } 436 | 437 | 438 | inputJson.GraduationTime = seniorYear; 439 | console.log(util.mergeJsonObject(inputJson, inputContent)); 440 | 441 | //支付页面 442 | wx.navigateTo({ 443 | url: '../pay/applypay?inputJson=' + JSON.stringify(util.mergeJsonObject(inputJson, inputContent)) 444 | }) 445 | } 446 | }) -------------------------------------------------------------------------------- /pages/apply/applyperson.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "考试报名" 3 | } -------------------------------------------------------------------------------- /pages/apply/applyperson.wxml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 基本资料(以下项目均为必填项) 6 | 7 | 8 | 证件类型 9 | 10 | 12 | 13 | {{credentials[credentialsIndex]}} 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 证件号码 22 | 25 | 26 | 27 | 姓名 28 | 30 | 31 | 32 | 出生年月 33 | 34 | 36 | 37 | {{date}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 性别 46 | 47 | 49 | 50 | {{sex[sexIndex]}} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 民族 59 | 60 | 62 | 63 | {{nation[nationIndex]}} 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 职业 72 | 73 | 75 | 76 | {{profession[professionIndex]}} 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 学历 86 | 87 | 89 | 90 | {{culture[cultureIndex]}} 91 | 92 | 93 | 94 | 95 | 96 | 97 | 110 | 123 | 124 | 手机号码 125 | 128 | 129 | 130 | QQ号码 131 | 134 | 135 | 136 | 137 | 联系地址 138 | 141 | 142 | 143 | 144 | 145 | 补充信息 146 | 147 | 148 | 149 | {{item.AutoFieldName}} 150 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 学校与专业(以下项目均为必填项) 159 | 160 | 161 | 学校 162 | 165 | 166 | 167 | 168 | 学院 169 | 172 | 173 | 174 | 入学时间 175 | 176 | 179 | 180 | {{entranceDate}} 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 专业 189 | 192 | 193 | 194 | 班级 195 | 198 | 199 | 200 | 204 | 205 | 206 | 密码 207 | 208 | 209 | 密码 210 | 212 | 213 | 217 | 218 | 219 | 220 | 221 | 222 |
-------------------------------------------------------------------------------- /pages/apply/applyperson.wxss: -------------------------------------------------------------------------------- 1 | /* pages/apply/applyperson.wxss */ -------------------------------------------------------------------------------- /pages/apply/applysubject.js: -------------------------------------------------------------------------------- 1 | // pages/apply/applysubject.js 2 | //获取应用实例 3 | var app = getApp(); 4 | var util = require('../../utils/util.js'); 5 | var inputContent = {};//输入内容 6 | 7 | 8 | Page({ 9 | data: { 10 | headExamTypeIndex: 0, 11 | examSubjectIndex: 0, 12 | isSelectExamSubject: false, 13 | provinceListIndex: 0, 14 | examPlaceIndex: 0, 15 | longitude: wx.getStorageSync("longitude"), 16 | latitude: wx.getStorageSync("latitude"), 17 | markers: [{ 18 | iconPath: "/images/map/localization.png", 19 | id: 0, 20 | latitude: 0, 21 | longitude: 0, 22 | width: 20, 23 | height: 20 24 | }] 25 | 26 | }, 27 | 28 | onLoad: function (options) { 29 | 30 | // 页面初始化 options为页面跳转所带来的参数 31 | this.setData({ 32 | ExamTypeId: options.ExamTypeId 33 | }); 34 | //考试报名列表 35 | util.https(app.globalData.api + "/GetHeadExamType", "GET", { 36 | praviteKey: app.globalData.praviteKey 37 | }, 38 | this.getHeadExamType 39 | ) 40 | //误操作提示 41 | /* if (!wx.getStorageSync("isManyPeoplePrompt")) {*/ 42 | wx.showModal({ 43 | title: '友情提示', 44 | content: "请勿使用同一个小程序或App给多人报名,造成信息错误后果自行承担!", 45 | showCancel: false, 46 | confirmColor: "#f26604", 47 | success: function (res) { 48 | if (res.confirm) { 49 | wx.setStorageSync("isManyPeoplePrompt", true); 50 | console.log('用户点击确定'); 51 | } 52 | } 53 | }) 54 | /* }*/ 55 | }, 56 | onReady: function () { 57 | // 页面渲染完成 58 | }, 59 | onShow: function () { 60 | // 页面显示 61 | this.setData({ 62 | isLogin: util.isLogin(), 63 | userData: wx.getStorageSync("userData") || ""//用户信息 64 | }) 65 | //初始化数据 66 | inputContent.ReceiveName = "";// 表示收件人 67 | inputContent.ReceiveTel = "";// 表示收件人电话 68 | inputContent.ReceiveAdd = "";// 表示收件人地址 69 | //验证表单 70 | /* this.wxValidate();*/ 71 | }, 72 | onHide: function () { 73 | // 页面隐藏 74 | }, 75 | onUnload: function () { 76 | // 页面关闭 77 | }, 78 | //考试报名列表 79 | getHeadExamType: function (data) { 80 | var headExamTypeArr = []; 81 | for (var index in data.Data) { 82 | var item = data.Data[index]; 83 | if (item.IsActive == 1 || item.IsActive == 2) {//只显示IsActive 是1或者2的考试类型 84 | headExamTypeArr.push(item); 85 | if (item.ExamTypeId == this.data.ExamTypeId) { 86 | this.setData({ 87 | headExamTypeIndex: index 88 | }) 89 | } 90 | } 91 | 92 | } 93 | 94 | this.setData({ 95 | headExamType: headExamTypeArr 96 | }); 97 | //考试科目获取 98 | this.getExamSubjectHttp(this.data.ExamTypeId) 99 | inputContent["ExamType"] = this.data.headExamType[this.data.headExamTypeIndex].ExamTypeId; 100 | } 101 | , 102 | 103 | //考试名称选择 104 | bindNamePickerChange: function (e) { 105 | this.setData({ 106 | headExamTypeIndex: e.detail.value 107 | }) 108 | inputContent[e.currentTarget.id] = this.data.headExamType[e.detail.value].ExamTypeId; 109 | //考试科目获取 110 | this.getExamSubjectHttp(this.data.headExamType[e.detail.value].ExamTypeId) 111 | } 112 | , 113 | 114 | //获取考试科目请求 115 | getExamSubjectHttp: function (ExamTypeId) { 116 | util.https(app.globalData.api + "/GetExamSubject", "GET", { 117 | inputJson: { 118 | ExamTypeId: ExamTypeId//考试类型ID, 如果是培训默认给6. 119 | }, 120 | praviteKey: app.globalData.praviteKey 121 | }, 122 | this.getExamSubject 123 | ) 124 | } 125 | , 126 | //考试科目获取 127 | getExamSubject: function (data) { 128 | this.setData({ 129 | examSubject: data.Data 130 | }); 131 | this.getExamProvinceListHttps(this.data.examSubject[0].SubjectID) 132 | } 133 | , 134 | //考试科目选择 135 | bindexamSubjectPickerChange: function (e) { 136 | this.setData({ 137 | examSubjectIndex: e.detail.value, 138 | isSelectExamSubject: true 139 | }) 140 | inputContent[e.currentTarget.id] = this.data.examSubject[e.detail.value].SubjectID; 141 | //考试的省份获取 142 | this.getExamProvinceListHttps(this.data.examSubject[e.detail.value].SubjectID) 143 | 144 | } 145 | , 146 | //考试的省份获取 147 | getExamProvinceListHttps: function (SubjectID) { 148 | util.https(app.globalData.api + "/GetExamProvinceList", "GET", { 149 | inputJson: { 150 | ExamTypeId: SubjectID //考试类型ID 如果给空或者0,则返回全部省份 151 | }, 152 | praviteKey: app.globalData.praviteKey 153 | }, 154 | this.getExamProvinceList 155 | ) 156 | } 157 | , 158 | //考试的省份获取 159 | getExamProvinceList: function (data) { 160 | this.setData({ 161 | examProvinceList: data.Data 162 | }); 163 | inputContent["ProvinceName"] = this.data.examProvinceList[0].ProvinceName; 164 | //考点获取 165 | this.getExamPlaceHttp(); 166 | } 167 | , 168 | //考试的省份选择 169 | bindProvincePickerChange: function (e) { 170 | this.setData({ 171 | provinceListIndex: e.detail.value 172 | }) 173 | inputContent[e.currentTarget.id] = this.data.examProvinceList[e.detail.value].ProvinceName; 174 | //考点获取 175 | this.getExamPlaceHttp(e); 176 | } 177 | , 178 | //考点获取http请求 179 | getExamPlaceHttp: function (e) { 180 | util.https(app.globalData.api + "/GetExamPlace", "GET", { 181 | inputJson: { 182 | SubjectID: this.data.examSubject[this.data.examSubjectIndex].SubjectID,//用户选中的考试科目ID,如果有多个,一定要加,号分割,如果只有一个科目一定不要加,号. 183 | Latitude: wx.getStorageSync("latitude"), //纬度 184 | Longitude: wx.getStorageSync("longitude"), //经度 185 | ProvinceName: this.data.examProvinceList[e ? e.detail.value : 0].ProvinceName //省份名称,可以为空 186 | }, 187 | praviteKey: app.globalData.praviteKey 188 | }, 189 | this.getExamPlace 190 | ) 191 | } 192 | , 193 | 194 | //考点获取 195 | getExamPlace: function (data) { 196 | console.log(data); 197 | this.setData({ 198 | examPlace: data.Data, 199 | examPlaceItem: data.Data[0], 200 | longitude: data.Data[0].Longitude, 201 | latitude: data.Data[0].Latitude, 202 | 'markers[0].latitude': data.Data[0].Latitude, 203 | 'markers[0].longitude': data.Data[0].Longitude 204 | }); 205 | inputContent["SchoolID"] = this.data.examPlace[0].SchoolID; 206 | //根据考试的科目和考点来获取对应的增值服务 207 | this.getAddServicesHttp(); 208 | } 209 | , 210 | //考点获取选择 211 | bindExamPlacePickerChange: function (e) { 212 | this.setData({ 213 | examPlaceIndex: e.detail.value, 214 | examPlaceItem: this.data.examPlace[e.detail.value], 215 | longitude: this.data.examPlace[e.detail.value].Longitude, 216 | latitude: this.data.examPlace[e.detail.value].Latitude, 217 | 'markers[0].latitude': this.data.examPlace[e.detail.value].Latitude, 218 | 'markers[0].longitude': this.data.examPlace[e.detail.value].Longitude 219 | }) 220 | inputContent[e.currentTarget.id] = this.data.examPlace[e.detail.value].SchoolID; 221 | //根据考试的科目和考点来获取对应的增值服务 222 | this.getAddServicesHttp(); 223 | } 224 | , 225 | //根据考试的科目和考点来获取对应的增值服务http请求 226 | getAddServicesHttp: function () { 227 | util.https(app.globalData.api + "/GetAddServices", "GET", { 228 | inputJson: { 229 | SubjectID: this.data.examSubject[this.data.examSubjectIndex].SubjectID,//用户选中的考试科目ID 230 | SchoolId: this.data.examPlace[this.data.examPlaceIndex].SchoolID //用户选中的考点ID 231 | }, 232 | praviteKey: app.globalData.praviteKey 233 | }, 234 | this.getAddServices 235 | ) 236 | } 237 | , 238 | //根据考试的科目和考点来获取对应的增值服务 239 | getAddServices: function (data) { 240 | console.log(data); 241 | this.setData({ 242 | addServices: data.Data 243 | }); 244 | } 245 | , 246 | 247 | //点击选择增值服务 248 | checkboxChange: function (e) { 249 | console.log('checkbox发生change事件,携带value值为:', e.detail.value); 250 | var serveArr = e.detail.value; 251 | if (this.data.addServices.BookList.length != 0) { //没有教材, 也不显示那个快递费 252 | serveArr = e.detail.value.slice(1);//去掉默认快递费数组 253 | } 254 | //模拟考试ID,0表示没参加。最多传入一个考试科目ID 勾选了模拟考试就给1,没勾就给0 255 | inputContent["IsJoin"] = serveArr.length == 0 ? 0 : 1; 256 | //需要的教材ID,如果有多本就用,号分割,没有预定就是0 257 | inputContent["BookID"] = serveArr.length <= 1 ? 0 : e.detail.value.slice(1).join(","); 258 | } 259 | , 260 | 261 | //使用微信内置地图查看位置 262 | openLocation: function () { 263 | wx.openLocation({ 264 | latitude: this.data.latitude, 265 | longitude: this.data.longitude, 266 | scale: 18 267 | }) 268 | } 269 | , 270 | //获取用户输入 271 | bindChange: function (e) { 272 | inputContent[e.currentTarget.id] = e.detail.value 273 | console.log(inputContent); 274 | } 275 | , 276 | //下一步事件处理函数 277 | applyperson: function () { 278 | console.log(inputContent); 279 | wx.navigateTo({ 280 | url: 'applyperson?inputContent=' + JSON.stringify(inputContent) 281 | }) 282 | } 283 | , 284 | }) -------------------------------------------------------------------------------- /pages/apply/applysubject.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "考试报名" 3 | } -------------------------------------------------------------------------------- /pages/apply/applysubject.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 选择考点及科目 5 | 6 | 7 | 考试名称 8 | 9 | 12 | 13 | {{headExamType[headExamTypeIndex].ExamTypeName}} 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 科目选择 23 | 24 | 27 | 28 | {{examSubject[examSubjectIndex].SubjectName}} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 考试省份 37 | 38 | 42 | 43 | {{examProvinceList[provinceListIndex].ProvinceName}} 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 考点选择 52 | 53 | 56 | 57 | {{examPlace[examPlaceIndex].SchoolName}} 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 增值服务 68 | 69 | 70 | 83 | 90 | 91 | 92 | 收件人 93 | 95 | 96 | 97 | 收件人电话 98 | 100 | 101 | 102 | 收件人地址 103 | 105 | 106 | 107 | 108 | 112 | 113 | 点击选择地址 116 | 117 | 118 | 119 | 考点信息 120 | 121 | 122 | 考点电话 123 | {{examPlaceItem.TelNum}} 124 | 125 | 126 | 考点地址 127 | {{examPlaceItem.Address}} 128 | 129 | 130 | 考点距离 131 | {{examPlaceItem.Diatance}} 132 | 133 | 134 | 135 | 136 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /pages/apply/applysubject.wxss: -------------------------------------------------------------------------------- 1 | /* pages/apply/applysubject.wxss */ 2 | .checkbox { 3 | display: block; 4 | padding: 0.5rem 1rem; 5 | } 6 | 7 | .checkbox checkbox { 8 | margin-right: 0.8rem; 9 | } 10 | 11 | .checkbox view { 12 | margin-left: 2.5rem; 13 | color: #585858; 14 | } 15 | 16 | .address { 17 | color: #f26604 !important; 18 | } -------------------------------------------------------------------------------- /pages/apply/applysubjectmore.js: -------------------------------------------------------------------------------- 1 | // pages/apply/applysubjectmore.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: {}, 6 | onLoad: function (options) { 7 | // 页面初始化 options为页面跳转所带来的参数 8 | //考试报名列表 9 | util.https(app.globalData.api + "/GetHeadExamType", "GET", { 10 | praviteKey: app.globalData.praviteKey 11 | } 12 | , 13 | this.getHeadExamType 14 | ) 15 | }, 16 | onReady: function () { 17 | // 页面渲染完成 18 | }, 19 | onShow: function () { 20 | // 页面显示 21 | }, 22 | onHide: function () { 23 | // 页面隐藏 24 | }, 25 | onUnload: function () { 26 | // 页面关闭 27 | }, //考试报名列表 28 | getHeadExamType: function (data) { 29 | 30 | var headExamType = data.Data; 31 | for (var index in headExamType) { 32 | //考试时间差 33 | headExamType[index].differdays = Math.floor((new Date(headExamType[index].RealExamDate).getTime() - new Date().getTime()) / (24 * 3600 * 1000)); 34 | } 35 | console.log(headExamType); 36 | this.setData({ 37 | headExamType: headExamType 38 | }); 39 | 40 | 41 | }, 42 | }) -------------------------------------------------------------------------------- /pages/apply/applysubjectmore.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "考试报名" 3 | } -------------------------------------------------------------------------------- /pages/apply/applysubjectmore.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 暂无考试报名数据 6 | 7 | 8 | 9 | 10 | {{item.differdays}} 11 | 12 | {{item.ExamTypeName}} 13 | 报名时间 : {{item.SignTimes}} 14 | 考试时间 : {{item.ExamTimes}} 15 | 18 | {{item.differdays<10?'立即':'预约'}}报名 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /pages/apply/applysubjectmore.wxss: -------------------------------------------------------------------------------- 1 | /* pages/apply/applysubjectmore.wxss */ 2 | @import "../index/index.wxss"; -------------------------------------------------------------------------------- /pages/find/find.js: -------------------------------------------------------------------------------- 1 | // pages/find/find.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data:{}, 6 | onLoad:function(options){ 7 | // 页面初始化 options为页面跳转所带来的参数 8 | }, 9 | onReady:function(){ 10 | // 页面渲染完成 11 | }, 12 | onShow:function(){ 13 | // 页面显示 14 | }, 15 | onHide:function(){ 16 | // 页面隐藏 17 | }, 18 | onUnload:function(){ 19 | // 页面关闭 20 | } 21 | }) -------------------------------------------------------------------------------- /pages/find/find.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "附近" 3 | } -------------------------------------------------------------------------------- /pages/find/find.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 小程序版正在开发中,请下载51报名管家App使用本功能 6 | 7 | 8 | -------------------------------------------------------------------------------- /pages/find/find.wxss: -------------------------------------------------------------------------------- 1 | /* pages/find/find.wxss */ -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | var app = getApp(); 4 | var util = require('../../utils/util.js'); 5 | Page({ 6 | data: { 7 | hiddenLoading: false 8 | }, 9 | 10 | onLoad: function () { 11 | 12 | }, 13 | onReady: function () { 14 | // 页面渲染完成 15 | }, 16 | onShow: function () { 17 | // 页面显示 18 | //考试报名列表 19 | util.https(app.globalData.api + "/GetHeadExamType", "GET", { 20 | praviteKey: app.globalData.praviteKey 21 | } 22 | , 23 | this.getHeadExamType 24 | ) 25 | //考试头条 26 | util.https(app.globalData.api + "/GetHeadLines", "GET", { 27 | praviteKey: app.globalData.praviteKey 28 | }, 29 | this.getHeadLines 30 | ) 31 | 32 | //首页活动报名列表 33 | util.https(app.globalData.api + "/GetHeadActiveList", "GET", { 34 | inputJson: { 35 | StudentID: wx.getStorageSync("StudentId") ? wx.getStorageSync("StudentId") : 0//传入用户的ID,如果是没登录状态就给0,如果是已经登录就返回userID. 36 | }, 37 | praviteKey: app.globalData.praviteKey 38 | }, 39 | this.getHeadActiveList 40 | ) 41 | }, 42 | onHide: function () { 43 | // 页面隐藏 44 | }, 45 | onUnload: function () { 46 | // 页面关闭 47 | }, 48 | //考试报名列表 49 | getHeadExamType: function (data) { 50 | 51 | var headExamType = data.Data; 52 | for (var index in headExamType) { 53 | //考试时间差 54 | headExamType[index].differdays = Math.floor((new Date(headExamType[index].EndDate).getTime() - new Date().getTime()) / (24 * 3600 * 1000)); 55 | } 56 | console.log(headExamType); 57 | this.setData({ 58 | headExamType: headExamType 59 | }); 60 | 61 | 62 | } 63 | , 64 | //考试头条 65 | getHeadLines: function (data) { 66 | this.setData({ 67 | headLine: data.Data 68 | }); 69 | 70 | } 71 | , 72 | //首页活动报名列表 73 | getHeadActiveList: function (data) { 74 | console.log(data); 75 | var headActiveList = data.Data; 76 | for (var index in headActiveList) { 77 | //考试时间差 78 | headActiveList[index].differdays = Math.floor((new Date(headActiveList[index].EndDate).getTime() - new Date().getTime()) / (24 * 3600 * 1000)); 79 | } 80 | this.setData({ 81 | headActiveList: headActiveList 82 | }); 83 | 84 | } 85 | , 86 | }) 87 | -------------------------------------------------------------------------------- /pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "51报名管家", 3 | "enablePullDownRefresh": false 4 | } -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 报名记录 7 | 8 | 9 | 10 | 准考证查询 11 | 12 | 13 | 14 | 成绩查询 15 | 16 | 17 | 18 | 19 | {{headLine[0].NewsTitle}} 20 | 21 | 22 | 23 | 24 | 公告 25 | 26 | 27 | 28 | 关注 29 | 30 | 31 | 32 | 考试宝典 33 | 34 | 35 | 36 | 增值服务 37 | 38 | 39 | 40 | 41 | 43 | 44 | 报名考试 45 | 46 | 47 | 48 | 49 | 50 | {{item.differdays}} 51 | 52 | {{item.ExamTypeName}} 53 | 报名时间 : {{item.SignTimes}} 54 | 考试时间 : {{item.ExamTimes}} 55 | 57 | {{item.differdays<10?'立即':'预约'}}报名 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 活动报名 69 | 70 | 71 | 72 | 73 | 74 | {{item.differdays}} 75 | 76 | {{item.ActiveName}} 77 | 活动地点 : {{item.ActiveAddress}} 78 | 报名时间 : {{item.SignTimes}} 79 | 80 | 82 | {{item.differdays<10?'立即':'预约'}}报名 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /**index.wxss**/ 2 | 3 | #index { 4 | with: 100%; 5 | overflow: hidden; 6 | } 7 | 8 | .header-nav { 9 | color: #fff; 10 | height: 200 rpx; 11 | } 12 | 13 | .header-nav .iconfont { 14 | font-size: 1.8rem; 15 | } 16 | 17 | .header-nav .icon-text, .header-subnav .icon-text { 18 | font-size: 0.8rem; 19 | } 20 | 21 | .icon-naozhong:before { 22 | border-color: transparent; 23 | color: #f26604; 24 | font-size: 2.2rem !important; 25 | } 26 | 27 | .icon-naozhong { 28 | position: relative; 29 | color: #fff; 30 | font-size: 1rem !important; 31 | } 32 | 33 | .icon-naozhong text { 34 | position: absolute; 35 | left: 50%; 36 | top: 50%; 37 | -webkit-transform: translate(-50%, -50%); 38 | transform: translate(-50%, -50%); 39 | } 40 | 41 | .header-subnav { 42 | color: #000; 43 | height: 200 rpx; 44 | } 45 | 46 | .header-subnav .iconfont { 47 | font-size: 1.6rem; 48 | } 49 | 50 | .item-divider text:first-child { 51 | display: inline-block; 52 | margin-right: 0.6rem; 53 | height: 0.8rem; 54 | border-left: 3px solid #f26604 !important; 55 | } 56 | 57 | .share { 58 | margin-top: -0.6rem; 59 | color: #000; 60 | height: 300 rpx; 61 | } 62 | 63 | .applylist:last-child { 64 | margin-bottom: 0.8rem; 65 | } 66 | 67 | .applylist .p { 68 | font-size: 13px; 69 | } 70 | 71 | .headLine { 72 | font-size: 0.8rem; 73 | color: #262626; 74 | font-weight: 100 !important; 75 | line-height: 20px; 76 | } 77 | 78 | .headLine .iconfont { 79 | font-size: 1rem; 80 | } -------------------------------------------------------------------------------- /pages/news/news.js: -------------------------------------------------------------------------------- 1 | // pages/news/news.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data:{}, 6 | onLoad:function(options){ 7 | // 页面初始化 options为页面跳转所带来的参数 8 | }, 9 | onReady:function(){ 10 | // 页面渲染完成 11 | }, 12 | onShow:function(){ 13 | // 页面显示 14 | }, 15 | onHide:function(){ 16 | // 页面隐藏 17 | }, 18 | onUnload:function(){ 19 | // 页面关闭 20 | } 21 | }) -------------------------------------------------------------------------------- /pages/news/news.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "消息" 3 | } -------------------------------------------------------------------------------- /pages/news/news.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 小程序版正在开发中,请下载51报名管家App使用本功能 6 | 7 | 8 | -------------------------------------------------------------------------------- /pages/news/news.wxss: -------------------------------------------------------------------------------- 1 | /* pages/news/news.wxss */ -------------------------------------------------------------------------------- /pages/notice/noticedetails.js: -------------------------------------------------------------------------------- 1 | // pages/notice/noticedetails.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: {}, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | this.getNoticeDetails(options.url); 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面初次渲染完成 20 | */ 21 | onReady: function () { 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面显示 27 | */ 28 | onShow: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面隐藏 34 | */ 35 | onHide: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面卸载 41 | */ 42 | onUnload: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 页面相关事件处理函数--监听用户下拉动作 48 | */ 49 | onPullDownRefresh: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面上拉触底事件的处理函数 55 | */ 56 | onReachBottom: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 用户点击右上角分享 62 | */ 63 | onShareAppMessage: function () { 64 | 65 | }, 66 | /** 67 | * 获取公告详情数据 68 | */ 69 | getNoticeDetails: function (url) { 70 | console.log(url); 71 | var that=this; 72 | util.https(url, "GET", {}, 73 | function (data) { 74 | console.log(data); 75 | that.setData({ 76 | helpdata: data 77 | }) 78 | } 79 | ) 80 | } 81 | }) -------------------------------------------------------------------------------- /pages/notice/noticedetails.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "公告详情" 3 | } -------------------------------------------------------------------------------- /pages/notice/noticedetails.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /pages/notice/noticedetails.wxss: -------------------------------------------------------------------------------- 1 | /* pages/notice/noticedetails.wxss */ -------------------------------------------------------------------------------- /pages/notice/noticelist.js: -------------------------------------------------------------------------------- 1 | // pages/notice/noticelist.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: { 6 | totalCount: 1, 7 | examNoticeArr: [], 8 | hasData:true 9 | }, 10 | onLoad: function (options) { 11 | // 页面初始化 options为页面跳转所带来的参数 12 | //考试公告列表 13 | this.getExamNoticeHttps(this.data.totalCount); 14 | 15 | }, 16 | onReady: function () { 17 | // 页面渲染完成 18 | }, 19 | onShow: function () { 20 | // 页面显示 21 | }, 22 | onHide: function () { 23 | // 页面隐藏 24 | }, 25 | onUnload: function () { 26 | // 页面关闭 27 | }, 28 | onPullDownRefresh: function (event) { // 下拉刷新回调接口 29 | this.data.totalCount = 1; 30 | //考试公告列表 31 | wx.showNavigationBarLoading(); 32 | this.getExamNoticeHttps(this.data.totalCount); 33 | 34 | }, 35 | onReachBottom: function (event) { // 上滑加载 36 | if(!this.data.hasData){ 37 | return; 38 | } 39 | //考试公告列表 40 | wx.showNavigationBarLoading() 41 | this.getExamNoticeHttps(this.data.totalCount); 42 | 43 | }, 44 | getExamNoticeHttps: function (CurrPage) { //考试公告列表 45 | util.https(app.globalData.api + "/GetExamNotice", "GET", { 46 | inputJson: { 47 | NoticeType: 1, //公告类型,1表示考试,2表示活动,3表示培训, 如果不传该参数系统默认返回都是考试的公告 48 | CurrPage: CurrPage, 49 | PageSize: 10 50 | }, 51 | praviteKey: app.globalData.praviteKey 52 | }, 53 | this.getExamNotice 54 | ) 55 | }, 56 | getExamNotice: function (data) { 57 | console.log(data); 58 | if (data.Data.length == 0) { //没有数据 59 | this.setData({ 60 | hasData: false 61 | }); 62 | wx.showToast({ 63 | title: "没有更多数据", 64 | icon: 'success', 65 | duration: 1500 66 | }) 67 | wx.hideNavigationBarLoading(); 68 | return; 69 | } 70 | if (this.data.totalCount == 1) { 71 | this.setData({ 72 | examNoticeArr: [] 73 | }); 74 | } 75 | for (var index in data.Data) { 76 | this.data.examNoticeArr.push(data.Data[index]); 77 | } 78 | 79 | this.setData({ 80 | examNotice: this.data.examNoticeArr 81 | }); 82 | this.data.totalCount++; 83 | wx.hideNavigationBarLoading(); 84 | wx.stopPullDownRefresh() 85 | 86 | } 87 | }) -------------------------------------------------------------------------------- /pages/notice/noticelist.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "考试公告", 3 | "enablePullDownRefresh": true 4 | } -------------------------------------------------------------------------------- /pages/notice/noticelist.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 暂无考试公告数据 6 | 7 | 8 | {{item.NewsTitle}} 9 | {{item.NewsDate}} 10 | 11 | 12 | -------------------------------------------------------------------------------- /pages/notice/noticelist.wxss: -------------------------------------------------------------------------------- 1 | /* pages/notice/noticelist.wxss */ -------------------------------------------------------------------------------- /pages/pay/applypay.js: -------------------------------------------------------------------------------- 1 | // pages/pay/applypay.js 2 | //获取应用实例 3 | var app = getApp(); 4 | var util = require('../../utils/util.js'); 5 | Page({ 6 | data: { 7 | paydata: {} 8 | }, 9 | onLoad: function (options) { 10 | console.log(JSON.parse(options.inputJson)); 11 | options.inputJson = JSON.parse(options.inputJson); 12 | // 页面初始化 options为页面跳转所带来的参数 13 | //调用接口获取登录凭证(code)进而换取用户登录态信息,包括用户的唯一标识(openid) 14 | if (!wx.getStorageSync("openId")) { //初次授权登录 获取openid 15 | wx.login({ 16 | success: function (res) { 17 | if (res.code) { 18 | //发起网络请求 19 | console.log(res); 20 | //根据微信Code获取对应的openId 21 | util.https(app.globalData.api + "/GetOpenidFromJsCode", "GET", { 22 | inputJson: {JsCode: res.code}, 23 | praviteKey: app.globalData.praviteKey 24 | }, 25 | function (data) { 26 | console.log(data); 27 | if (data.StatusCode == 0) { 28 | wx.setStorageSync("openId", data.Data.OpenId);//微信openid 29 | options.inputJson.OpenId = data.Data.OpenId; 30 | //微信小程序考试报名数据提交 31 | this.setWXOrderExamInfo(options.inputJson); 32 | } 33 | 34 | }) 35 | 36 | } else { 37 | console.log('获取用户登录状态失败!' + res.errMsg); 38 | } 39 | } 40 | }); 41 | } else { 42 | options.inputJson.OpenId = wx.getStorageSync("openId"); 43 | this.setWXOrderExamInfo(options.inputJson) 44 | } 45 | 46 | }, 47 | onReady: function () { 48 | // 页面渲染完成 49 | }, 50 | onShow: function () { 51 | // 页面显示 52 | }, 53 | onHide: function () { 54 | // 页面隐藏 55 | }, 56 | onUnload: function () { 57 | // 页面关闭 58 | }, 59 | /** 60 | * 微信小程序考试报名数据提交 61 | */ 62 | setWXOrderExamInfo: function (inputJson) { 63 | console.log(inputJson); 64 | util.https(app.globalData.api + "/SetWXOrderExamInfo", "GET", { 65 | inputJson: inputJson, 66 | praviteKey: app.globalData.praviteKey 67 | }, 68 | this.setWXOrderExamInfoCallBack) 69 | }, 70 | setWXOrderExamInfoCallBack: function (data) { 71 | console.log(data); 72 | if (data.StatusCode == 0) { 73 | wx.setStorageSync("StudentId", data.Data.StudentId);//"用户ID" 74 | wx.setStorageSync("TokenInfo", data.Data.TokenInfo);//"用户Token" 75 | 76 | this.setData({ 77 | paydata: data.Data 78 | }) 79 | } 80 | }, 81 | /** 82 | * 立即支付 83 | */ 84 | pay: function () { 85 | var data = this.data.paydata; 86 | console.log(this.data.paydata); 87 | wx.requestPayment({ 88 | 'timeStamp': data.TimeStamp, 89 | 'nonceStr': data.NonceStr, 90 | 'package': data.PackAge, 91 | 'signType': 'MD5', 92 | 'paySign': data.PaySign, 93 | 'success': function (res) { 94 | console.log(res); 95 | }, 96 | 'fail': function (res) { 97 | console.log(res); 98 | } 99 | }) 100 | 101 | 102 | } 103 | }) -------------------------------------------------------------------------------- /pages/pay/applypay.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "报名费用支付" 3 | } -------------------------------------------------------------------------------- /pages/pay/applypay.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 注意 : 在线支付成功后报名方为有效 6 | 7 | 8 | 商品信息 9 | 10 | 11 | 订单编号 : {{paydata.OrderId}} 12 | 13 | 14 | 15 | {{item.ItemName}} 16 | ¥{{item.Price}} 17 | 18 | 19 | 20 | 合计 : 21 | ¥{{paydata.AllPrice}} 22 | 23 | 24 | 25 | 支付说明 26 | 27 | 28 | 1 、本系统支持微信即时到账在线支付方式 29 | 2 、点击立即支付按钮 ,系统会自动调起到微信支付 30 | 31 | 32 | 支付方式 33 | 34 | 35 | 36 | 微信 37 | 推荐微信用户使用 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /pages/pay/applypay.wxss: -------------------------------------------------------------------------------- 1 | /* pages/pay/applypay.wxss */ 2 | #applypay { 3 | with: 100%; 4 | overflow: hidden; 5 | } 6 | .headLine { 7 | font-size: 0.8rem; 8 | font-weight: 100 !important; 9 | } -------------------------------------------------------------------------------- /pages/record/applyrecord.js: -------------------------------------------------------------------------------- 1 | // pages/record/applyrecord.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: { 6 | isLogin: util.isLogin() 7 | }, 8 | onLoad: function (options) { 9 | // 页面初始化 options为页面跳转所带来的参数 10 | 11 | 12 | }, 13 | onReady: function () { 14 | // 页面渲染完成 15 | }, 16 | onShow: function () { 17 | // 页面显示 18 | this.setData({ 19 | isLogin: util.isLogin(), 20 | userData: wx.getStorageSync("userData") || ""//用户信息 21 | }) 22 | if (!this.data.isLogin) { //没登录提示登录 23 | util.isLoginModal(); 24 | } else { 25 | //报考记录 26 | this.getExamReocrdListHttps(); 27 | } 28 | }, 29 | onHide: function () { 30 | // 页面隐藏 31 | }, 32 | onUnload: function () { 33 | // 页面关闭 34 | }, 35 | getExamReocrdListHttps: function () { //报考记录 36 | // 所有有登录状态接口默认带上userId和token。没有登录状态的接口默认带上pkey.防止其他方非法使用web服务的访问 37 | util.https(app.globalData.api + "/GetExamReocrdList", "GET", { 38 | userId: wx.getStorageSync("StudentId"),//用户id 39 | tokenInfo: wx.getStorageSync("TokenInfo") //用户token 40 | }, 41 | this.getExamReocrdList 42 | ) 43 | }, 44 | 45 | //报考记录 46 | getExamReocrdList: function (data) { 47 | console.log(data); 48 | var examReocrdList = data.Data; 49 | for (var index in examReocrdList) { 50 | //考试时间差 51 | examReocrdList[index].differdays = Math.floor((new Date(examReocrdList[index].RealExamDate).getTime() - new Date().getTime()) / (24 * 3600 * 1000)); 52 | } 53 | this.setData({ 54 | examReocrdList: examReocrdList 55 | 56 | }) 57 | }, 58 | //报考记录详情 59 | getExamReocrdListDetails: function (e) { 60 | var dataset = e.currentTarget.dataset; 61 | wx.navigateTo({ 62 | url: 'applyrecorddetails?MulStuId=' + dataset.id + '&ExamTypeId=' + dataset.examtypeid 63 | }) 64 | }, 65 | //删除未支付 66 | deleteExamReocrdList: function (e) { 67 | console.log(e.currentTarget.dataset); 68 | 69 | wx.showModal({ 70 | title: '删除记录', 71 | content: "确定删除这条报考记录?", 72 | showCancel: true, 73 | confirmText: "删除", 74 | confirmColor: "#f26604", 75 | success: function (res) { 76 | if (res.confirm) { 77 | // 考生删除未缴费的订单信息 78 | util.https(app.globalData.api + "/DeleteOrderInfo", "GET", { 79 | userId: wx.getStorageSync("StudentId"),//用户id 80 | tokenInfo: wx.getStorageSync("TokenInfo"), //用户token 81 | inputJson: { 82 | PayType: "1",//删除类型,1表示计算机考试报名,2表示模拟考试,3表示教材,4表示考霸课程,5表示会计报名,6 表示报名的技能高考模拟练习,7 表示删除快递证书,8表示删除培训订单,9 表示删除考试提醒 83 | SubjectID: e.currentTarget.dataset.subjectid, //表示科目ID 84 | BookId: 0, //表示书本ID 85 | CourseId: 0, //表示课程ID,接口33有返回 86 | ExamTypeId: e.currentTarget.dataset.id, //表示考试类型 87 | } 88 | 89 | }, 90 | function (data) { 91 | util.showToast(data.Msg); 92 | if (data.StatusCode == 0) { 93 | this.getExamReocrdListHttps(); 94 | } 95 | 96 | } 97 | ) 98 | } 99 | } 100 | }) 101 | } 102 | }) -------------------------------------------------------------------------------- /pages/record/applyrecord.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "报名记录" 3 | } -------------------------------------------------------------------------------- /pages/record/applyrecord.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 暂无报名记录数据 6 | 7 | 8 | 9 | 考试倒计时{{item.differdays}}天 10 | 13 | 14 | 15 | 16 | 考试类型 17 | {{item.ExamType}} 18 | 19 | 20 | 考试科目 21 | {{item.ExamName}} 22 | 23 | 24 | 25 | 报名时间 26 | {{item.ExamDate}} 27 | 28 | 29 | 30 | 31 | {{item.ExamStatus==0?"未缴费":(item.ExamStatus==1?"已缴费":"已过期")}} 32 | 立即支付 33 | 34 | 35 | 36 | 39 | -------------------------------------------------------------------------------- /pages/record/applyrecord.wxss: -------------------------------------------------------------------------------- 1 | /* pages/record/applyrecord.wxss */ 2 | .icon-lajixiang { 3 | font-size: 1.1rem!important; 4 | } -------------------------------------------------------------------------------- /pages/record/applyrecorddetails.js: -------------------------------------------------------------------------------- 1 | // pages/record/applyrecorddetails.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data: { 6 | viewmore: false 7 | }, 8 | onLoad: function (options) { 9 | // 页面初始化 options为页面跳转所带来的参数 10 | // 所有有登录状态接口默认带上userId和token。没有登录状态的接口默认带上pkey.防止其他方非法使用web服务的访问 11 | util.https(app.globalData.api + "/GetStudentExamDetail", "GET", { 12 | userId: wx.getStorageSync("StudentId"),//用户id 13 | tokenInfo: wx.getStorageSync("TokenInfo"),//用户token 14 | inputJson: { 15 | MulStuId: options.MulStuId, //接口33的报名ID,该值必须传入 16 | ExamTypeId: options.ExamTypeId, //接口33的ExamtypeId, 非计算机等级考试的时候必须传入 17 | } 18 | }, 19 | this.getStudentExamDetail 20 | ) 21 | }, 22 | onReady: function () { 23 | // 页面渲染完成 24 | }, 25 | onShow: function () { 26 | // 页面显示 27 | }, 28 | onHide: function () { 29 | // 页面隐藏 30 | }, 31 | onUnload: function () { 32 | // 页面关闭 33 | }, 34 | getStudentExamDetail: function (data) { //报名记录详情 35 | console.log(data); 36 | this.setData({ 37 | studentExamDetail: data.Data 38 | }) 39 | }, 40 | viewMore: function () { //查看更多信息 41 | this.setData({ 42 | viewmore: true 43 | }) 44 | } 45 | }) -------------------------------------------------------------------------------- /pages/record/applyrecorddetails.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "报名记录详情" 3 | } -------------------------------------------------------------------------------- /pages/record/applyrecorddetails.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 证件照 5 | 6 | 7 | 8 | 报名科目 9 | {{studentExamDetail.SubjectName}} 10 | ¥{{studentExamDetail.ExamMoney}} 11 | 12 | 13 | 14 | 报考网址 15 | {{studentExamDetail.GWURL}} 16 | 17 | 18 | 19 | 报名时间 20 | {{studentExamDetail.ExamDate}} 21 | 22 | 23 | 24 | 报考考点 25 | {{studentExamDetail.SchoolName}} 26 | 27 | 28 | 29 | 报名费用 30 | {{studentExamDetail.ExamMoney}} 31 | 32 | 33 | 34 | 考试时间 35 | {{studentExamDetail.RealExamTimes}} 36 | 37 | 38 | 39 | 考试地点 40 | {{studentExamDetail.SchoolAddress}} 41 | 42 | 43 | 44 | 密码 45 | {{studentExamDetail.SearchPwd}} 46 | 47 | 48 | 49 | 姓名 50 | {{studentExamDetail.Name}} 51 | 52 | 53 | 54 | 性别 55 | {{studentExamDetail.Gender==1?'男':'女'}} 56 | 57 | 58 | 59 | 出生日期 60 | {{studentExamDetail.Birthday}} 61 | 62 | 63 | 64 | 民族 65 | {{studentExamDetail.Nation}} 66 | 67 | 68 | 69 | 职业 70 | {{studentExamDetail.Job}} 71 | 72 | 73 | 74 | 学历 75 | {{studentExamDetail.Education}} 76 | 77 | 78 | 79 | 手机号码 80 | {{studentExamDetail.TelNum}} 81 | 82 | 83 | 84 | 学号 85 | {{studentExamDetail.SchoolNum}} 86 | 87 | 88 | 89 | QQ号码 90 | {{studentExamDetail.QQNumber}} 91 | 92 | 93 | 查看更多 94 | 95 | 96 | 以上信息有程序自动注册,请勿重复注册 97 | 98 | 99 | 状态 100 | 101 | 102 | 103 | 填写个人信息 104 | 105 | 106 | 107 | 选择考试科目 108 | 109 | 110 | 111 | 支付报名费用 112 | 未支付 113 | 114 | 115 | 116 | 上传证件照 117 | 未完成 118 | 119 | 120 | 121 | 照片审核 122 | 未完成 123 | 124 | 125 | 126 | 完成报名 127 | 未完成 128 | 129 | 130 | 131 | 信息上报 132 | 本步骤由程序自动完成 133 | 未完成 134 | 135 | 136 | 137 | 打印准考证 138 | {{studentExamDetail.ExamCertPrintDate}} 139 | 未开放 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /pages/record/applyrecorddetails.wxss: -------------------------------------------------------------------------------- 1 | /* pages/record/applyrecorddetails.wxss */ 2 | .item-avatar-right { 3 | margin-bottom: 0; 4 | padding-bottom: 0; 5 | } 6 | 7 | .status .item-icon-left .iconfont { 8 | font-size: 1rem !important; 9 | } 10 | 11 | .status .item .p { 12 | font-size: 0.6rem !important; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /pages/service/service.js: -------------------------------------------------------------------------------- 1 | // pages/service/service.js 2 | var app = getApp(); 3 | var util = require('../../utils/util.js'); 4 | Page({ 5 | data:{}, 6 | onLoad:function(options){ 7 | // 页面初始化 options为页面跳转所带来的参数 8 | }, 9 | onReady:function(){ 10 | // 页面渲染完成 11 | }, 12 | onShow:function(){ 13 | // 页面显示 14 | }, 15 | onHide:function(){ 16 | // 页面隐藏 17 | }, 18 | onUnload:function(){ 19 | // 页面关闭 20 | } 21 | }) -------------------------------------------------------------------------------- /pages/service/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "服务" 3 | } -------------------------------------------------------------------------------- /pages/service/service.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 小程序版正在开发中,请下载51报名管家App使用本功能 6 | 7 | 8 | -------------------------------------------------------------------------------- /pages/service/service.wxss: -------------------------------------------------------------------------------- 1 | /* pages/service/service.wxss */ -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 格式化时间 3 | * 对Date的扩展,将 Date 转化为指定格式的String 4 | * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, 5 | * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) 6 | * 例子: 7 | * (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 8 | * (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 9 | */ 10 | Date.prototype.Format = function (fmt) { // 11 | var o = { 12 | "M+": this.getMonth() + 1, //月份 13 | "d+": this.getDate(), //日 14 | "h+": this.getHours(), //小时 15 | "m+": this.getMinutes(), //分 16 | "s+": this.getSeconds(), //秒 17 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度 18 | "S": this.getMilliseconds() //毫秒 19 | }; 20 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); 21 | for (var k in o) 22 | if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); 23 | return fmt; 24 | } 25 | 26 | /** 27 | * JavaScript合并两个Json对象 28 | */ 29 | function mergeJsonObject(jsonbject1, jsonbject2) { 30 | var resultJsonObject = {}; 31 | for (var attr in jsonbject1) { 32 | resultJsonObject[attr] = jsonbject1[attr]; 33 | } 34 | for (var attr in jsonbject2) { 35 | resultJsonObject[attr] = jsonbject2[attr]; 36 | } 37 | return resultJsonObject; 38 | }; 39 | 40 | /** 41 | * 公共微信https请求封装 42 | * @param url 43 | * @param type 44 | * @param data 45 | * @param callBack 46 | */ 47 | function https(url, type, data, callBack) { 48 | 49 | wx.showNavigationBarLoading(); 50 | wx.request({ 51 | url: url, 52 | method: type, 53 | data: data, 54 | header: { 55 | "Content-Type": "json" 56 | }, 57 | success: function (res) { 58 | if (res.data.StatusCode != 0) { 59 | 60 | wx.showToast({ 61 | title: res.data.Msg, 62 | icon: 'success', 63 | duration: 2000 64 | }) 65 | } 66 | callBack(res.data); 67 | }, 68 | fail: function (error) { 69 | wx.showToast({ 70 | title: "请求失败" , 71 | icon: 'success', 72 | duration: 2000 73 | }) 74 | console.log(error) 75 | }, 76 | complete: function () { 77 | wx.hideLoading(); 78 | wx.stopPullDownRefresh(); 79 | wx.hideNavigationBarLoading(); 80 | } 81 | }) 82 | } 83 | 84 | /** 85 | * 是否登录 86 | */ 87 | function isLogin() { 88 | return wx.getStorageSync("TokenInfo") ? true : false; 89 | } 90 | 91 | /** 92 | * 是否登录提示 93 | */ 94 | function isLoginModal() { 95 | wx.showModal({ 96 | title: '友情提示', 97 | content: "登录51报名管家,体验更完善功能", 98 | showCancel: true, 99 | confirmColor: "#f26604", 100 | confirmText: "登录", 101 | success: function (res) { 102 | if (res.confirm) { 103 | wx.navigateTo({ 104 | url: '/pages/account/login' 105 | }) 106 | console.log('用户点击确定'); 107 | } else if (res.cancel) { 108 | //返回上一页 109 | wx.navigateBack({ 110 | delta: 1 111 | }) 112 | } 113 | } 114 | }) 115 | } 116 | 117 | /** 118 | * Toast提示框 119 | */ 120 | function showToast(title, icon, duration) { 121 | wx.showToast({ 122 | title: title || "", 123 | icon: icon || 'success', 124 | duration: duration || 1500 125 | }) 126 | } 127 | 128 | module.exports = { 129 | https: https, 130 | isLogin: isLogin, 131 | isLoginModal: isLoginModal, 132 | showToast: showToast, 133 | mergeJsonObject: mergeJsonObject, 134 | hexMD5: hexMD5 135 | } 136 | /* 137 | * A Javascript implementation of the RSA Data Security, Inc. MD5 Message 138 | * Digest Algorithm, as defined in RFC 1321. 139 | * Version 1.1 Copyright (C) Paul Johnston 1999 - 2002. 140 | * Code also contributed by Greg Holt 141 | * See http://pajhome.org.uk/site/legal.html for details. 142 | */ 143 | 144 | /* 145 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally 146 | * to work around bugs in some JS interpreters. 147 | */ 148 | function safe_add(x, y) { 149 | var lsw = (x & 0xFFFF) + (y & 0xFFFF) 150 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16) 151 | return (msw << 16) | (lsw & 0xFFFF) 152 | } 153 | 154 | /* 155 | * Bitwise rotate a 32-bit number to the left. 156 | */ 157 | function rol(num, cnt) { 158 | return (num << cnt) | (num >>> (32 - cnt)) 159 | } 160 | 161 | /* 162 | * These functions implement the four basic operations the algorithm uses. 163 | */ 164 | function cmn(q, a, b, x, s, t) { 165 | return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b) 166 | } 167 | 168 | function ff(a, b, c, d, x, s, t) { 169 | return cmn((b & c) | ((~b) & d), a, b, x, s, t) 170 | } 171 | 172 | function gg(a, b, c, d, x, s, t) { 173 | return cmn((b & d) | (c & (~d)), a, b, x, s, t) 174 | } 175 | 176 | function hh(a, b, c, d, x, s, t) { 177 | return cmn(b ^ c ^ d, a, b, x, s, t) 178 | } 179 | 180 | function ii(a, b, c, d, x, s, t) { 181 | return cmn(c ^ (b | (~d)), a, b, x, s, t) 182 | } 183 | 184 | /* 185 | * Calculate the MD5 of an array of little-endian words, producing an array 186 | * of little-endian words. 187 | */ 188 | function coreMD5(x) { 189 | var a = 1732584193 190 | var b = -271733879 191 | var c = -1732584194 192 | var d = 271733878 193 | 194 | for (var i = 0; i < x.length; i += 16) { 195 | var olda = a 196 | var oldb = b 197 | var oldc = c 198 | var oldd = d 199 | 200 | a = ff(a, b, c, d, x[i + 0], 7, -680876936) 201 | d = ff(d, a, b, c, x[i + 1], 12, -389564586) 202 | c = ff(c, d, a, b, x[i + 2], 17, 606105819) 203 | b = ff(b, c, d, a, x[i + 3], 22, -1044525330) 204 | a = ff(a, b, c, d, x[i + 4], 7, -176418897) 205 | d = ff(d, a, b, c, x[i + 5], 12, 1200080426) 206 | c = ff(c, d, a, b, x[i + 6], 17, -1473231341) 207 | b = ff(b, c, d, a, x[i + 7], 22, -45705983) 208 | a = ff(a, b, c, d, x[i + 8], 7, 1770035416) 209 | d = ff(d, a, b, c, x[i + 9], 12, -1958414417) 210 | c = ff(c, d, a, b, x[i + 10], 17, -42063) 211 | b = ff(b, c, d, a, x[i + 11], 22, -1990404162) 212 | a = ff(a, b, c, d, x[i + 12], 7, 1804603682) 213 | d = ff(d, a, b, c, x[i + 13], 12, -40341101) 214 | c = ff(c, d, a, b, x[i + 14], 17, -1502002290) 215 | b = ff(b, c, d, a, x[i + 15], 22, 1236535329) 216 | 217 | a = gg(a, b, c, d, x[i + 1], 5, -165796510) 218 | d = gg(d, a, b, c, x[i + 6], 9, -1069501632) 219 | c = gg(c, d, a, b, x[i + 11], 14, 643717713) 220 | b = gg(b, c, d, a, x[i + 0], 20, -373897302) 221 | a = gg(a, b, c, d, x[i + 5], 5, -701558691) 222 | d = gg(d, a, b, c, x[i + 10], 9, 38016083) 223 | c = gg(c, d, a, b, x[i + 15], 14, -660478335) 224 | b = gg(b, c, d, a, x[i + 4], 20, -405537848) 225 | a = gg(a, b, c, d, x[i + 9], 5, 568446438) 226 | d = gg(d, a, b, c, x[i + 14], 9, -1019803690) 227 | c = gg(c, d, a, b, x[i + 3], 14, -187363961) 228 | b = gg(b, c, d, a, x[i + 8], 20, 1163531501) 229 | a = gg(a, b, c, d, x[i + 13], 5, -1444681467) 230 | d = gg(d, a, b, c, x[i + 2], 9, -51403784) 231 | c = gg(c, d, a, b, x[i + 7], 14, 1735328473) 232 | b = gg(b, c, d, a, x[i + 12], 20, -1926607734) 233 | 234 | a = hh(a, b, c, d, x[i + 5], 4, -378558) 235 | d = hh(d, a, b, c, x[i + 8], 11, -2022574463) 236 | c = hh(c, d, a, b, x[i + 11], 16, 1839030562) 237 | b = hh(b, c, d, a, x[i + 14], 23, -35309556) 238 | a = hh(a, b, c, d, x[i + 1], 4, -1530992060) 239 | d = hh(d, a, b, c, x[i + 4], 11, 1272893353) 240 | c = hh(c, d, a, b, x[i + 7], 16, -155497632) 241 | b = hh(b, c, d, a, x[i + 10], 23, -1094730640) 242 | a = hh(a, b, c, d, x[i + 13], 4, 681279174) 243 | d = hh(d, a, b, c, x[i + 0], 11, -358537222) 244 | c = hh(c, d, a, b, x[i + 3], 16, -722521979) 245 | b = hh(b, c, d, a, x[i + 6], 23, 76029189) 246 | a = hh(a, b, c, d, x[i + 9], 4, -640364487) 247 | d = hh(d, a, b, c, x[i + 12], 11, -421815835) 248 | c = hh(c, d, a, b, x[i + 15], 16, 530742520) 249 | b = hh(b, c, d, a, x[i + 2], 23, -995338651) 250 | 251 | a = ii(a, b, c, d, x[i + 0], 6, -198630844) 252 | d = ii(d, a, b, c, x[i + 7], 10, 1126891415) 253 | c = ii(c, d, a, b, x[i + 14], 15, -1416354905) 254 | b = ii(b, c, d, a, x[i + 5], 21, -57434055) 255 | a = ii(a, b, c, d, x[i + 12], 6, 1700485571) 256 | d = ii(d, a, b, c, x[i + 3], 10, -1894986606) 257 | c = ii(c, d, a, b, x[i + 10], 15, -1051523) 258 | b = ii(b, c, d, a, x[i + 1], 21, -2054922799) 259 | a = ii(a, b, c, d, x[i + 8], 6, 1873313359) 260 | d = ii(d, a, b, c, x[i + 15], 10, -30611744) 261 | c = ii(c, d, a, b, x[i + 6], 15, -1560198380) 262 | b = ii(b, c, d, a, x[i + 13], 21, 1309151649) 263 | a = ii(a, b, c, d, x[i + 4], 6, -145523070) 264 | d = ii(d, a, b, c, x[i + 11], 10, -1120210379) 265 | c = ii(c, d, a, b, x[i + 2], 15, 718787259) 266 | b = ii(b, c, d, a, x[i + 9], 21, -343485551) 267 | 268 | a = safe_add(a, olda) 269 | b = safe_add(b, oldb) 270 | c = safe_add(c, oldc) 271 | d = safe_add(d, oldd) 272 | } 273 | return [a, b, c, d] 274 | } 275 | 276 | /* 277 | * Convert an array of little-endian words to a hex string. 278 | */ 279 | function binl2hex(binarray) { 280 | var hex_tab = "0123456789abcdef" 281 | var str = "" 282 | for (var i = 0; i < binarray.length * 4; i++) { 283 | str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + 284 | hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF) 285 | } 286 | return str 287 | } 288 | 289 | /* 290 | * Convert an array of little-endian words to a base64 encoded string. 291 | */ 292 | function binl2b64(binarray) { 293 | var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 294 | var str = "" 295 | for (var i = 0; i < binarray.length * 32; i += 6) { 296 | str += tab.charAt(((binarray[i >> 5] << (i % 32)) & 0x3F) | 297 | ((binarray[i >> 5 + 1] >> (32 - i % 32)) & 0x3F)) 298 | } 299 | return str 300 | } 301 | 302 | /* 303 | * Convert an 8-bit character string to a sequence of 16-word blocks, stored 304 | * as an array, and append appropriate padding for MD4/5 calculation. 305 | * If any of the characters are >255, the high byte is silently ignored. 306 | */ 307 | function str2binl(str) { 308 | var nblk = ((str.length + 8) >> 6) + 1 // number of 16-word blocks 309 | var blks = new Array(nblk * 16) 310 | for (var i = 0; i < nblk * 16; i++) blks[i] = 0 311 | for (var i = 0; i < str.length; i++) 312 | blks[i >> 2] |= (str.charCodeAt(i) & 0xFF) << ((i % 4) * 8) 313 | blks[i >> 2] |= 0x80 << ((i % 4) * 8) 314 | blks[nblk * 16 - 2] = str.length * 8 315 | return blks 316 | } 317 | 318 | /* 319 | * Convert a wide-character string to a sequence of 16-word blocks, stored as 320 | * an array, and append appropriate padding for MD4/5 calculation. 321 | */ 322 | function strw2binl(str) { 323 | var nblk = ((str.length + 4) >> 5) + 1 // number of 16-word blocks 324 | var blks = new Array(nblk * 16) 325 | for (var i = 0; i < nblk * 16; i++) blks[i] = 0 326 | for (var i = 0; i < str.length; i++) 327 | blks[i >> 1] |= str.charCodeAt(i) << ((i % 2) * 16) 328 | blks[i >> 1] |= 0x80 << ((i % 2) * 16) 329 | blks[nblk * 16 - 2] = str.length * 16 330 | return blks 331 | } 332 | 333 | /* 334 | * External interface 335 | */ 336 | function hexMD5(str) { 337 | return binl2hex(coreMD5(str2binl(str))) 338 | } 339 | 340 | function hexMD5w(str) { 341 | return binl2hex(coreMD5(strw2binl(str))) 342 | } 343 | 344 | function b64MD5(str) { 345 | return binl2b64(coreMD5(str2binl(str))) 346 | } 347 | 348 | function b64MD5w(str) { 349 | return binl2b64(coreMD5(strw2binl(str))) 350 | } 351 | 352 | /* Backward compatibility */ 353 | function calcMD5(str) { 354 | return binl2hex(coreMD5(str2binl(str))) 355 | } -------------------------------------------------------------------------------- /utils/validate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 创建验证字段的工厂函数 3 | * 4 | * @param {Object} rules 验证字段的规则 5 | * @param {Object} messages 验证字段的提示信息 6 | * https://github.com/skyvow/m-mall 7 | */ 8 | class WxValidate { 9 | constructor(rules = {}, messages = {}) { 10 | Object.assign(this, { 11 | rules, 12 | messages, 13 | }) 14 | this.__init() 15 | } 16 | 17 | /** 18 | * __init 19 | */ 20 | __init() { 21 | this.__initMethods() 22 | this.__initDefaults() 23 | this.__initErrorList() 24 | } 25 | 26 | /** 27 | * 初始化错误信息 28 | */ 29 | __initErrorList() { 30 | this.errorList = [] 31 | } 32 | 33 | /** 34 | * 初始化默认提示信息 35 | */ 36 | __initDefaults() { 37 | this.defaults = { 38 | messages: { 39 | required: '这是必填字段。', 40 | email: '请输入有效的电子邮件地址。', 41 | tel: '请输入11位的手机号码。', 42 | url: '请输入有效的网址。', 43 | date: '请输入有效的日期。', 44 | dateISO: '请输入有效的日期(ISO),例如:2009-06-23,1998/01/22。', 45 | number: '请输入有效的数字。', 46 | digits: '只能输入数字。', 47 | idcard: '请输入18位的有效身份证。', 48 | equalTo: this.formatTpl('输入值必须和 {0} 相同。'), 49 | contains: this.formatTpl('输入值必须包含 {0}。'), 50 | minlength: this.formatTpl('最少要输入 {0} 个字符。'), 51 | maxlength: this.formatTpl('最多可以输入 {0} 个字符。'), 52 | rangelength: this.formatTpl('请输入长度在 {0} 到 {1} 之间的字符。'), 53 | min: this.formatTpl('请输入不小于 {0} 的数值。'), 54 | max: this.formatTpl('请输入不大于 {0} 的数值。'), 55 | range: this.formatTpl('请输入范围在 {0} 到 {1} 之间的数值。'), 56 | } 57 | } 58 | } 59 | 60 | /** 61 | * 初始化默认验证方法 62 | */ 63 | __initMethods() { 64 | const that = this 65 | that.methods = { 66 | /** 67 | * 验证必填元素 68 | */ 69 | required(value, param) { 70 | if (!that.depend(param)) { 71 | return 'dependency-mismatch' 72 | } 73 | return value.length > 0 74 | }, 75 | /** 76 | * 验证电子邮箱格式 77 | */ 78 | email(value) { 79 | return that.optional(value) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value) 80 | }, 81 | /** 82 | * 验证手机格式 83 | */ 84 | tel(value) { 85 | return that.optional(value) || /^1[34578]\d{9}$/.test(value) 86 | }, 87 | /** 88 | * 验证URL格式 89 | */ 90 | url(value) { 91 | return that.optional(value) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(value) 92 | }, 93 | /** 94 | * 验证日期格式 95 | */ 96 | date(value) { 97 | return that.optional(value) || !/Invalid|NaN/.test(new Date(value).toString()) 98 | }, 99 | /** 100 | * 验证ISO类型的日期格式 101 | */ 102 | dateISO(value) { 103 | return that.optional(value) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value) 104 | }, 105 | /** 106 | * 验证十进制数字 107 | */ 108 | number(value) { 109 | return that.optional(value) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value) 110 | }, 111 | /** 112 | * 验证整数 113 | */ 114 | digits(value) { 115 | return that.optional(value) || /^\d+$/.test(value) 116 | }, 117 | /** 118 | * 验证身份证号码 119 | */ 120 | idcard(value) { 121 | return that.optional(value) || /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value) 122 | }, 123 | /** 124 | * 验证两个输入框的内容是否相同 125 | */ 126 | equalTo(value, param) { 127 | return that.optional(value) || value === that.scope.detail.value[param] 128 | }, 129 | /** 130 | * 验证是否包含某个值 131 | */ 132 | contains(value, param) { 133 | return that.optional(value) || value.indexOf(param) >= 0 134 | }, 135 | /** 136 | * 验证最小长度 137 | */ 138 | minlength(value, param) { 139 | return that.optional(value) || value.length >= param 140 | }, 141 | /** 142 | * 验证最大长度 143 | */ 144 | maxlength(value, param) { 145 | return that.optional(value) || value.length <= param 146 | }, 147 | /** 148 | * 验证一个长度范围[min, max] 149 | */ 150 | rangelength(value, param) { 151 | return that.optional(value) || (value.length >= param[0] && value.length <= param[1]) 152 | }, 153 | /** 154 | * 验证最小值 155 | */ 156 | min(value, param) { 157 | return that.optional(value) || value >= param 158 | }, 159 | /** 160 | * 验证最大值 161 | */ 162 | max(value, param) { 163 | return that.optional(value) || value <= param 164 | }, 165 | /** 166 | * 验证一个值范围[min, max] 167 | */ 168 | range(value, param) { 169 | return that.optional(value) || (value >= param[0] && value <= param[1]) 170 | }, 171 | } 172 | } 173 | 174 | /** 175 | * 添加自定义验证方法 176 | * @param {String} name 方法名 177 | * @param {Function} method 函数体,接收两个参数(value, param),value表示元素的值,param表示参数 178 | * @param {String} message 提示信息 179 | */ 180 | addMethod(name, method, message) { 181 | this.methods[name] = method 182 | this.defaults.messages[name] = message !== undefined ? message : this.defaults.messages[name] 183 | } 184 | 185 | /** 186 | * 判断验证方法是否存在 187 | */ 188 | isValidMethod(value) { 189 | let methods = [] 190 | for(let method in this.methods) { 191 | if (method && typeof this.methods[method] === 'function') { 192 | methods.push(method) 193 | } 194 | } 195 | return methods.indexOf(value) !== -1 196 | } 197 | 198 | /** 199 | * 格式化提示信息模板 200 | */ 201 | formatTpl(source, params) { 202 | const that = this 203 | if (arguments.length === 1) { 204 | return function() { 205 | let args = Array.from(arguments) 206 | args.unshift(source) 207 | return that.formatTpl.apply(this, args) 208 | } 209 | } 210 | if (params === undefined) { 211 | return source 212 | } 213 | if (arguments.length > 2 && params.constructor !== Array) { 214 | params = Array.from(arguments).slice(1) 215 | } 216 | if (params.constructor !== Array) { 217 | params = [ params ] 218 | } 219 | params.forEach(function(n, i) { 220 | source = source.replace(new RegExp("\\{" + i + "\\}", "g"), function() { 221 | return n 222 | }) 223 | }) 224 | return source 225 | } 226 | 227 | /** 228 | * 判断规则依赖是否存在 229 | */ 230 | depend(param) { 231 | switch(typeof param) { 232 | case 'boolean': 233 | param = param 234 | break 235 | case 'string': 236 | param = !!param.length 237 | break 238 | case 'function': 239 | param = param() 240 | default: 241 | param = !0 242 | } 243 | return param 244 | } 245 | 246 | /** 247 | * 判断输入值是否为空 248 | */ 249 | optional(value) { 250 | return !this.methods.required(value) && 'dependency-mismatch' 251 | } 252 | 253 | /** 254 | * 获取自定义字段的提示信息 255 | * @param {String} param 字段名 256 | * @param {Object} rule 规则 257 | */ 258 | customMessage(param, rule) { 259 | const params = this.messages[param] 260 | const isObject = typeof params === 'object' 261 | if (params && isObject) return params[rule.method] 262 | } 263 | 264 | /** 265 | * 获取某个指定字段的提示信息 266 | * @param {String} param 字段名 267 | * @param {Object} rule 规则 268 | */ 269 | defaultMessage(param, rule) { 270 | let message = this.customMessage(param, rule) || this.defaults.messages[rule.method] 271 | let type = typeof message 272 | 273 | if (type === 'undefined') { 274 | message = `Warning: No message defined for ${rule.method}.` 275 | } else if (type === 'function') { 276 | message = message.call(this, rule.parameters) 277 | } 278 | 279 | return message 280 | } 281 | 282 | /** 283 | * 缓存错误信息 284 | * @param {String} param 字段名 285 | * @param {Object} rule 规则 286 | * @param {String} value 元素的值 287 | */ 288 | formatTplAndAdd(param, rule, value) { 289 | let msg = this.defaultMessage(param, rule) 290 | 291 | this.errorList.push({ 292 | param: param, 293 | msg: msg, 294 | value: value, 295 | }) 296 | } 297 | 298 | /** 299 | * 验证某个指定字段的规则 300 | * @param {String} param 字段名 301 | * @param {Object} rules 规则 302 | * @param {Object} event 表单数据对象 303 | */ 304 | checkParam(param, rules, event) { 305 | 306 | // 缓存表单数据对象 307 | this.scope = event 308 | 309 | // 缓存字段对应的值 310 | const data = event.detail.value 311 | const value = data[param] || '' 312 | 313 | // 遍历某个指定字段的所有规则,依次验证规则,否则缓存错误信息 314 | for(let method in rules) { 315 | 316 | // 判断验证方法是否存在 317 | if (this.isValidMethod(method)) { 318 | 319 | // 缓存规则的属性及值 320 | const rule = { 321 | method: method, 322 | parameters: rules[method] 323 | } 324 | 325 | // 调用验证方法 326 | const result = this.methods[method](value, rule.parameters) 327 | 328 | // 若result返回值为dependency-mismatch,则说明该字段的值为空或非必填字段 329 | if (result === 'dependency-mismatch') { 330 | continue 331 | } 332 | 333 | // 判断是否通过验证,否则缓存错误信息,跳出循环 334 | if (!result) { 335 | this.formatTplAndAdd(param, rule, value) 336 | break 337 | } 338 | } 339 | } 340 | } 341 | 342 | /** 343 | * 验证所有字段的规则,返回验证是否通过 344 | * @param {Object} event 表单数据对象 345 | */ 346 | checkForm(event) { 347 | this.errorList = [] 348 | 349 | for (let param in this.rules) { 350 | this.checkParam(param, this.rules[param], event) 351 | } 352 | 353 | return this.valid() 354 | } 355 | 356 | /** 357 | * 返回验证是否通过 358 | */ 359 | valid() { 360 | return this.size() === 0 361 | } 362 | 363 | /** 364 | * 返回错误信息的个数 365 | */ 366 | size() { 367 | return this.errorList.length 368 | } 369 | 370 | /** 371 | * 返回所有错误信息 372 | */ 373 | validationErrors() { 374 | return this.errorList 375 | } 376 | } 377 | 378 | export default WxValidate 379 | --------------------------------------------------------------------------------