diff --git a/changelog.md b/changelog.md index 2a68080..dccc550 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ ## v0.16.10 * U 登录界面优化 + * U 优化分享 ## v0.16.9 * A 管理界面浏览历史查看 diff --git a/miniprogram/account/pages/account/account.js b/miniprogram/account/pages/account/account.js index 63d4c71..196281d 100644 --- a/miniprogram/account/pages/account/account.js +++ b/miniprogram/account/pages/account/account.js @@ -18,7 +18,10 @@ Page({ message, msgType: type, msgDuration: duration, - showMsg: true + showMsg: false + }); + wx.nextTick(()=>{ + this.setData({showMsg: true}); }) }, hideMsg(){ @@ -35,23 +38,53 @@ Page({ onLoginBlur({detail:{value:login}}){ this.validLogin(login); }, + validPhoneEmail: function ({login}) { + // a simple pre-check for input + let phoneReg = /^[1][0-9]{10}$/; + let emailReg = /.+@.+\..+/; + if(!phoneReg.test(login)&&!emailReg.test(login)){ + return false; + }else + return true; + }, validLogin(login){ if(!login) { - return this.setData({showtip:0}); + return this.setData({showMsg:0, hasError:0}); } let {action} = this.data; + if(this.cache.login==login&&this.cache.action==action) + return; if(action=="login"){ // some use login to login, this case judge can be wrong - this.cache.type = type; + this.cache.action = action; this.cache.login = login; - return this.setData({hasError:0, showMsg:0}); + var api_name = 'weapps.check_account'; + var type = 'login'; + }else if(action=='register'){ + var api_name = "weapps.check_account"; + var type = "register"; + if(!this.validPhoneEmail({login})){ + this.cache.action = action; + this.cache.login = login; + this.showError({message:"请输入正确的邮箱或手机号", duration:0}); + this.setData({hasError:0}); + return; + } + }else if(action=='reset'){ + var api_name = "accounts.valid_email_and_phone"; + var type = 2; + if(!this.validPhoneEmail({login})){ + this.cache.action = action; + this.cache.login = login; + this.showError({message:"请输入正确的手机号或邮箱", duration:0}); + this.setData({hasError:0}); + return; + } } - let type = action=="register"?1:2; - if(this.cache.login==login&&this.cache.type==type) return; - app.api("accounts.valid_email_and_phone")({ + app.api(api_name)({ login, type, complete: res => { - this.cache.type = type; + this.cache.action = action; this.cache.login = login; } }) @@ -61,8 +94,15 @@ Page({ }) .catch(e=>{ var hasError = e.message.indexOf("网络")!=-1?2:1; + if(action=='login'){ + hasError = e.message == '该账号尚未注册'?1:0; + } this.setData({ hasError}); - this.showError({message: e.message.replace(/\n/g," "), duration: 0}); + if(hasError){ + this.showError({message: e.message.replace(/\n/g," "), duration: 0}); + }else{ + this.hideMsg(); + } }) }, login_test(){ @@ -86,11 +126,7 @@ Page({ }) .catch(e=>{ if (showToast){ - app.api("accounts.valid_email_and_phone")({login, type:2}) - .then(res=>{ - this.showError(e); - }) - .catch(this.showError); + this.showError(e); } }) }, diff --git a/miniprogram/account/pages/account/account.wxml b/miniprogram/account/pages/account/account.wxml index 70f7e91..e4be6f6 100644 --- a/miniprogram/account/pages/account/account.wxml +++ b/miniprogram/account/pages/account/account.wxml @@ -7,7 +7,7 @@
- + @@ -45,6 +45,6 @@ - 登录即代表您同意 用户协议 + 登录或注册即代表您同意 用户协议 diff --git a/miniprogram/account/pages/account/account.wxss b/miniprogram/account/pages/account/account.wxss index 803ac05..7894f8c 100644 --- a/miniprogram/account/pages/account/account.wxss +++ b/miniprogram/account/pages/account/account.wxss @@ -110,7 +110,9 @@ navigator.agreement{ margin: 10px auto; font-size: 14px; text-align: center; + color: dimgray; } text.agreement{ text-decoration: underline; + font-weight: bold; } \ No newline at end of file diff --git a/miniprogram/setting/pages/image_crop/image_crop.js b/miniprogram/setting/pages/image_crop/image_crop.js index 8db8cea..7b03a6a 100644 --- a/miniprogram/setting/pages/image_crop/image_crop.js +++ b/miniprogram/setting/pages/image_crop/image_crop.js @@ -191,7 +191,8 @@ Page({ }, initCanvas(src="") { const { cropperOpt } = this.data; - Object.assign(cropperOpt, { src }); + if(src) + Object.assign(cropperOpt, { src }); this.mycropper = new WeCropper(cropperOpt); this.mycropper .on('beforeImageLoad', (ctx) => { @@ -214,6 +215,10 @@ Page({ zoom: 8, width, height, + boundStyle:{ + color:"#0080f0", + lineWidth: 1.2 + }, cut: { x: (width - 300) / 2, y: (height - 300) / 2, diff --git a/miniprogram/setting/we-cropper/dist/we-cropper.min.js b/miniprogram/setting/we-cropper/dist/we-cropper.min.js index 7966ab3..0a2a1f7 100644 --- a/miniprogram/setting/we-cropper/dist/we-cropper.min.js +++ b/miniprogram/setting/we-cropper/dist/we-cropper.min.js @@ -1,6 +1,6 @@ /** - * we-cropper v1.3.7 - * (c) 2019 dlhandsome + * we-cropper v1.3.9 + * (c) 2020 dlhandsome * @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.WeCropper=e()}(this,function(){"use strict";var t=void 0,e=["touchstarted","touchmoved","touchended"];function r(n){for(var o=[],t=arguments.length-1;0>18&63)+d.charAt(r>>12&63)+d.charAt(r>>6&63)+d.charAt(63&r);return 2==a?(e=t.charCodeAt(c)<<8,n=t.charCodeAt(++c),i+=d.charAt((r=e+n)>>10)+d.charAt(r>>4&63)+d.charAt(r<<2&63)+"="):1==a&&(r=t.charCodeAt(c),i+=d.charAt(r>>2)+d.charAt(r<<4&63)+"=="),i},decode:function(t){var e=(t=String(t).replace(c,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&s("Invalid character: the string to be decoded is not correctly encoded.");for(var n,o,r=0,a="",i=-1;++i>(-2*r&6)));return a},version:"0.1.0"};if(e&&!e.nodeType)if(n)n.exports=a;else for(var i in a)a.hasOwnProperty(i)&&(e[i]=a[i]);else t.base64=a}(f)});function x(t){var e="";if("string"==typeof t)e=t;else for(var n=0;n>8&255,r>>16&255,r>>24&255,0,0,0,0,54,0,0,0],i=[40,0,0,0,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,1,0,24,0,0,0,0,0,255&o,o>>8&255,o>>16&255,o>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=(4-3*e%4)%4,u=t.data,s="",d=e<<2,h=n,f=String.fromCharCode;do{for(var l=d*(h-1),p="",g=0;g=h&&(g.newScale=h),g.scaleWidth=Math.round(g.newScale*g.baseWidth),g.scaleHeight=Math.round(g.newScale*g.baseHeight);var l=Math.round(g.touchX1-g.scaleWidth/2),p=Math.round(g.touchY1-g.scaleHeight/2);g.outsideBound(l,p),g.updateCanvas()},g.__xtouchEnd=function(){g.oldScale=g.newScale,g.rectX=g.imgLeft,g.rectY=g.imgTop})},w}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.WeCropper=e()}(this,function(){"use strict";var t=void 0,e=["touchstarted","touchmoved","touchended"];function r(n){for(var o=[],t=arguments.length-1;0>18&63)+d.charAt(r>>12&63)+d.charAt(r>>6&63)+d.charAt(63&r);return 2==a?(e=t.charCodeAt(c)<<8,n=t.charCodeAt(++c),i+=d.charAt((r=e+n)>>10)+d.charAt(r>>4&63)+d.charAt(r<<2&63)+"="):1==a&&(r=t.charCodeAt(c),i+=d.charAt(r>>2)+d.charAt(r<<4&63)+"=="),i},decode:function(t){var e=(t=String(t).replace(c,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&s("Invalid character: the string to be decoded is not correctly encoded.");for(var n,o,r=0,a="",i=-1;++i>(-2*r&6)));return a},version:"0.1.0"};if(e&&!e.nodeType)if(n)n.exports=a;else for(var i in a)a.hasOwnProperty(i)&&(e[i]=a[i]);else t.base64=a}(f)});function x(t){var e="";if("string"==typeof t)e=t;else for(var n=0;n>8&255,r>>16&255,r>>24&255,0,0,0,0,54,0,0,0],i=[40,0,0,0,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,1,0,24,0,0,0,0,0,255&o,o>>8&255,o>>16&255,o>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=(4-3*e%4)%4,u=t.data,s="",d=e<<2,h=n,f=String.fromCharCode;do{for(var l=d*(h-1),g="",p=0;p=h&&(p.newScale=h),p.scaleWidth=Math.round(p.newScale*p.baseWidth),p.scaleHeight=Math.round(p.newScale*p.baseHeight);var l=Math.round(p.touchX1-p.scaleWidth/2),g=Math.round(p.touchY1-p.scaleHeight/2);p.outsideBound(l,g),p.updateCanvas()},p.__xtouchEnd=function(){p.oldScale=p.newScale,p.rectX=p.imgLeft,p.rectY=p.imgTop})},C}); \ No newline at end of file diff --git a/project.config.json b/project.config.json index 431aee7..213b91e 100644 --- a/project.config.json +++ b/project.config.json @@ -241,6 +241,13 @@ "pathName": "markdown/shixun/shixun/shixun", "query": "identifier=tb7hw62n", "scene": null + }, + { + "id": -1, + "name": "account", + "pathName": "account/pages/account/account", + "query": "course_id=7813", + "scene": null } ] }