diff --git a/app.acss b/app.acss index 6da9fac..b488e88 100644 --- a/app.acss +++ b/app.acss @@ -76,10 +76,10 @@ checkbox{ } checkbox+.point{ box-sizing: border-box; - width: 26rpx; - height: 26rpx; - border: 2rpx solid #cccccc; - border-radius: 4rpx; + width: 13px; + height: 13px; + border: 1px solid #cccccc; + border-radius: 2px; background-color: #FFFFFF; } .a-checkbox-checked+.point{ @@ -87,7 +87,7 @@ checkbox+.point{ background-image: url(/static/success.png); background-position: center; background-repeat: no-repeat; - background-size: 18rpx 18rpx; + background-size: 7px 7px; } radio{ width: 0 !important; @@ -108,20 +108,20 @@ label{ } radio+.point{ box-sizing: border-box; - width: 28rpx; - height: 28rpx; - border: 2rpx solid #cccccc; + width: 14px; + height: 14px; + border: 1px solid #cccccc; border-radius: 100%; background-color: #FFFFFF; position: relative; } .a-radio-checked+.point{ - border: 2rpx solid #2e80b6; + border: 1px solid #2e80b6; } .a-radio-checked+.point>text{ display: block; - width: 16rpx; - height: 16rpx; + width: 8px; + height: 8px; border-radius: 100%; background-color:#2e80b6; position: absolute; diff --git a/app.js b/app.js index a8bb15e..a31125e 100644 --- a/app.js +++ b/app.js @@ -1,3 +1,6 @@ +import utils from '/utils/utils' +dd['utils'] = utils + App({ onLaunch(options) { // 第一次打开 diff --git a/app.json b/app.json index 9b72cad..95430d1 100644 --- a/app.json +++ b/app.json @@ -1,8 +1,8 @@ { "pages": [ - "pages/index/index", - "components/otherBar/otherBar", + "pages/login/login", "components/tabBar/tabBar", + "components/otherBar/otherBar", "pages/counselor/account/bind/bind", "pages/counselor/free/freedetail/freedetail", "pages/counselor/personal/list/list", @@ -12,6 +12,7 @@ "pages/examinee/service/answer/answer", "pages/examinee/information/report/report", "pages/examinee/information/revise/revise", - "pages/counselor/position/position" + "pages/counselor/position/position", + "pages/index/index" ] } \ No newline at end of file diff --git a/components/tabBar/tabBar.js b/components/tabBar/tabBar.js index e762b40..cd11d7c 100644 --- a/components/tabBar/tabBar.js +++ b/components/tabBar/tabBar.js @@ -1,6 +1,7 @@ Component({ mixins: [], - data: {}, + data: { + }, props: {}, didMount() {}, didUpdate() {}, @@ -31,7 +32,7 @@ Page({ // "selectedIconPath": "/image/icon_biz.png", "text": "考生信息" } - ] + ], }, onLoad() { dd.setNavigationBar({ diff --git a/config/config.js b/config/config.js new file mode 100644 index 0000000..f8071af --- /dev/null +++ b/config/config.js @@ -0,0 +1,3 @@ +export default { + BASE_URL: 'http://aspiration.scdxtc.cn' // api接口服务器地址 +} \ No newline at end of file diff --git a/pages/login/login.acss b/pages/login/login.acss new file mode 100644 index 0000000..e69de29 diff --git a/pages/login/login.axml b/pages/login/login.axml new file mode 100644 index 0000000..5441cee --- /dev/null +++ b/pages/login/login.axml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js new file mode 100644 index 0000000..d122f9f --- /dev/null +++ b/pages/login/login.js @@ -0,0 +1,72 @@ +Page({ + data:{ + authCode:'' + }, + onLoad(){ + // 提取免登码 + dd.getStorage({ + key: 'authCode', + success: function(res) { + // dd.alert({content: '获取成功:' + res.data.authCode}); + // 登录 + let params = { + code: res.data.authCode + } + dd.utils.$http('/api/user/login','POST',params).then( + (data) => { + console.log(res.data.authCode) + dd.redirectTo({ + url: '/pages/index/index' + }) + }, + (err) => { + console.log('错误:'+err) + } + ); + }, + fail: function(res){ + //dd.alert({content: res.errorMessage}); + let _this = this; + // 获取免登码 + dd.getAuthCode({ + success:(res)=>{ + _this.setData({ + authCode:res.authCode + }) + this.data.authCode = res.authCode; + // 缓存免登码 + dd.setStorage({ + key: 'authCode', + data: { + authCode: res.authCode, + }, + success: function() { + // dd.alert({content: '写入成功'}); + } + }); + // 登录 + let params = { + code: res.authCode, + } + dd.utils.$http('/api/user/login','POST',params).then( + (data) => { + console.log(data) + dd.redirectTo({ + url: '/pages/index/index' + }) + }, + (err) => { + console.log('错误:'+err) + } + ); + }, + fail: (err)=>{ + dd.alert({ + content: JSON.stringify(err) + }) + } + }) + } + }); + } +}) \ No newline at end of file diff --git a/pages/login/login.json b/pages/login/login.json new file mode 100644 index 0000000..a97367d --- /dev/null +++ b/pages/login/login.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} diff --git a/utils/utils.js b/utils/utils.js new file mode 100644 index 0000000..4a3672f --- /dev/null +++ b/utils/utils.js @@ -0,0 +1,25 @@ +import config from '/config/config' +export default { + $http(url, method, data, h) { + return new Promise(function(resolve, reject) { + dd.httpRequest({ + url: config.BASE_URL+url, + method: method, + data: data, + header:{ + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' + }, + success: (res) => { + if (res.status == 200) { + resolve(res); + } else { + reject(res); + } + }, + fail: () => { + reject(); + } + }) + }) + } +} \ No newline at end of file