diff --git a/App.vue b/App.vue index e96fdc44496b1d349e19b950d6bc74bbf8baa97a..7e2ee3c83de4d0bb4dbd6e065b3c1a876c678e0f 100644 --- a/App.vue +++ b/App.vue @@ -19,28 +19,6 @@ // #endif // #ifdef APP-PLUS - //一键登录 功能预登录 - plus.oauth.getServices(oauthServices => { - // console.log(oauthServices); - oauthServices.forEach(({ - _id - }, item) => { - if (_id == 'provider') { - uni.preLogin({ - provider: item, - complete: e => { - console.log(e); - } - }) - } - }) - uni.preloadPage({ - url: "/pages/ucenter/login-page/index/index" - }); - }, err => { - console.error('获取服务供应商失败:' + JSON.stringify(err)); - }) - //idfa有需要的用户在应用首次启动时自己获取存储到storage中 //https://ask.dcloud.net.cn/article/36107 /*if(~plus.storage.getItem('idfa')){ diff --git a/README.md b/README.md index 853b8f9cab27424dffa0fac00873769f66b6f207..226a9857f5bf584b4f4c279664605d7e7994ca17 100644 --- a/README.md +++ b/README.md @@ -455,7 +455,7 @@ uni-starter ### 注意事项 1. 真机运行需要制作自定义基座,制作后选择运行到自定义基座 -2. 苹果登录的图标,需要满足苹果应用市场的审核规范请勿随便修改;如需修改请先阅读:[Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/) +2. 苹果登录的图标,需要满足苹果应用市场的审核规范请勿随便修改;如需修改请先阅读:[Sign in with Apple Button](https://appleid.apple.com/signinwithapple/button) 3. 应用登录功能,默认不勾选同意隐私权限是响应安卓应用市场的规范;请勿修改该逻辑。 ### FAQ:常见问题 diff --git a/common/appInit.js b/common/appInit.js index 8b005efc2e4d646bdcbf2ae3e85598fc01972619..007a8ab4a615425b28782abd9e67117749efb938 100644 --- a/common/appInit.js +++ b/common/appInit.js @@ -7,17 +7,64 @@ import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-ch import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/js_sdk/main.js'; // #endif const db = uniCloud.database() -export default function() { - // #ifndef H5 +export default async function() { + let loginConfig = uniStarterConfig.router.login + //清除有配置但设备环境不支持的登陆项 + // #ifdef APP-PLUS + await new Promise((callBack)=>{ + plus.oauth.getServices(oauthServices => { + loginConfig = loginConfig.filter(item=>{ + if(["univerify", "weixin", "apple"].includes(item)){ + let index = oauthServices.findIndex(e=>e.id==item) + if(index==-1){ + return false + }else{ + return oauthServices[index].nativeClient + } + }else{ + return true + } + }) + + if(loginConfig.includes('univerify')){ //一键登录 功能预登录 + uni.preLogin({ + provider:'univerify', + complete: e => { + console.log(e); + } + }) + } + callBack() + }, err => { + console.error('获取服务供应商失败:' + JSON.stringify(err)); + }) + }) + // #endif + + // #ifndef APP-PLUS + loginConfig = loginConfig.filter(item=>{ + return ![ + 'univerify', + 'apple', + // #ifdef H5 + 'weixin' + // #endif + ].includes(item) + }) + // #endif + + uniStarterConfig.router.login = loginConfig + + // uniStarterConfig挂载到getApp().globalData.config + // #ifdef MP-WEIXIN setTimeout(()=>{ // #endif - // uniStarterConfig挂载到getApp(). - const app = getApp({allowDefault: true}) - app.globalData.config = uniStarterConfig; - // #ifndef H5 - },30) + getApp({allowDefault: true}).globalData.config = uniStarterConfig; + // #ifdef MP-WEIXIN + },100) // #endif + // 初始化appVersion(仅app生效) initAppVersion(); @@ -257,12 +304,15 @@ export default function() { && pages[pages.length - 1].route.split('/')[2]!='login-page' ) { + + console.log(9527777,login); + //一键登录(univerify)、账号(username)、验证码登录(短信smsCode) - if (login[0] == 'univerify') { - if(e.url == url) { e.url += '?' } //添加参数之前判断是否带了`?`号如果没有就补上,因为当开发场景本身有参数的情况下是已经带了`?`号 - e.url += "univerify_first=true" - } else if (login[0] == 'username') { + if (login[0] == 'username') { e.url = "/pages/ucenter/login-page/pwd-login/pwd-login" + }else{ + if(e.url == url) { e.url += '?' } //添加参数之前判断是否带了`?`号如果没有就补上,因为当开发场景本身有参数的情况下是已经带了`?`号 + e.url += "type="+login[0] } }else{ //拦截强制登录页面 diff --git a/components/uni-agreements/uni-agreements.vue b/components/uni-agreements/uni-agreements.vue index 3b0c001cf18e33434b1d85aa1006db74c3019d77..86a60cebd59d459e275828d0ee07260b37d1906c 100644 --- a/components/uni-agreements/uni-agreements.vue +++ b/components/uni-agreements/uni-agreements.vue @@ -4,10 +4,10 @@ 同意 - + @@ -56,6 +56,9 @@ display: flex; flex-direction: row; } +.item{ + flex-direction: row; +} .agreement{ color:#04498c; } diff --git a/components/uni-quick-login/uni-quick-login.vue b/components/uni-quick-login/uni-quick-login.vue index 26143f2519457782e617acbe87078296a8f13847..5774eaa61bf17c0e3a4b7511eb0e8758bb36fe6b 100644 --- a/components/uni-quick-login/uni-quick-login.vue +++ b/components/uni-quick-login/uni-quick-login.vue @@ -123,7 +123,7 @@ }) }) // #endif - //添加已配置且可用的第三方快捷登陆项 + //添加可用的第三方快捷登陆项 servicesList = servicesList.concat(this.oauthServices.map( ({id})=>{ return {...this.config[id],id} })) @@ -169,7 +169,8 @@ uni.navigateBack(); } else { uni.navigateTo({ - url: path + url: path, + animationType:'slide-in-left' }) } }, diff --git a/manifest.json b/manifest.json index 5fa1e94d867329638a0f2dd9393209d406085395..690f7a60b53ddf243711c1002f7a25903ef6edda 100644 --- a/manifest.json +++ b/manifest.json @@ -57,14 +57,20 @@ ], "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ] }, - "ios" : {}, + "ios" : { + "capabilities" : { + "entitlements" : { + "com.apple.developer.associated-domains" : [ "applinks:static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com" ] + } + } + }, "sdkConfigs" : { "oauth" : { "apple" : {}, "weixin" : { "appid" : "wxffdd8fa6ec4ef2a0", "appsecret" : "", - "UniversalLinks" : "" + "UniversalLinks" : "https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com/uni-universallinks/__UNI__03B096E" }, "univerify" : {} }, @@ -72,7 +78,7 @@ "share" : { "weixin" : { "appid" : "wxffdd8fa6ec4ef2a0", - "UniversalLinks" : "" + "UniversalLinks" : "https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com/uni-universallinks/__UNI__03B096E" } }, "geolocation" : {}, @@ -108,5 +114,6 @@ }, "h5" : { "template" : "" - } + }, + "_spaceID" : "76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e" } diff --git a/pages.json b/pages.json index 1ea6903c1c2ca01d454401f50fcdbf260827abab..5664ca2a53b402b4717b579caa8b9e0ee649ba01 100644 --- a/pages.json +++ b/pages.json @@ -185,7 +185,7 @@ "path": "pages/ucenter/settings/settings" } ], - "current": 1 + "current": 0 }, "tabBar": { "color": "#7A7E83", diff --git a/pages/ucenter/login-page/index/index.vue b/pages/ucenter/login-page/index/index.vue index ded8cb9d5bb1a4e8c137736790eb814c6ee471d3..086eb7f2e8a32160897015100db615f242c07b20 100644 --- a/pages/ucenter/login-page/index/index.vue +++ b/pages/ucenter/login-page/index/index.vue @@ -2,15 +2,21 @@ 登录后即可展示自己 - - - - - - 未注册的手机号验证通过后将自动注册 - + + + + + + + + @@ -20,24 +26,28 @@ export default { data() { return { - first_type:"", + type:"", phone: "", agree: false } }, - computed: { + computed: { + loginConfig() { + return getApp().globalData.config.router.login + }, isPhone() { return /^1\d{10}$/.test(this.phone); }, imgSrc(){ - return '/static/login-index/'+this.first_type+'.jpg' + return '/static/login-index/'+this.type+'.png' } }, onLoad(e) { - this.first_type = e.first_type + this.type = e.type + //是否优先启动一键登录。即:页面一加载就启动一键登录 //#ifdef APP-PLUS - if (this.first_type == "univerify") { + if (this.type == "univerify") { const pages = getCurrentPages(); currentWebview = pages[pages.length - 1].$getAppWebview(); currentWebview.setStyle({ @@ -48,7 +58,8 @@ }, onReady() { //#ifdef APP-PLUS - if (univerify_first) { + if (this.type == "univerify") { + this.type == loginConfig[1] // console.log('开始一键登录'); setTimeout(() => { this.$refs.uniQuickLogin.login_before('univerify') @@ -69,7 +80,7 @@ }, methods: { quickLogin(){ - this.$refs.uniQuickLogin.login_before(this.first_type) + this.$refs.uniQuickLogin.login_before(this.type) }, sendShortMsg() { if (!this.agree) { @@ -99,8 +110,14 @@ + \ No newline at end of file diff --git a/static/login-index/apple.jpg b/static/login-index/apple.jpg deleted file mode 100644 index 37cc85586936cf6083afd68c81623aa08c836aa6..0000000000000000000000000000000000000000 Binary files a/static/login-index/apple.jpg and /dev/null differ diff --git a/static/login-index/weixin.jpg b/static/login-index/weixin.jpg deleted file mode 100644 index 37cc85586936cf6083afd68c81623aa08c836aa6..0000000000000000000000000000000000000000 Binary files a/static/login-index/weixin.jpg and /dev/null differ diff --git a/uni-starter.config.js b/uni-starter.config.js index 720fcdf027dc00c93cd4bd36df7f2816e4e99306..0e52d78fea370beeffad8264285796de3e5c8133 100644 --- a/uni-starter.config.js +++ b/uni-starter.config.js @@ -31,7 +31,7 @@ module.exports = { 根据数组的第0项,决定登录方式的第一优先级。 */ // "login": ["username","smsCode","univerify", "weixin", "apple"], - "login": ["weixin","username"], + "login": ["username","weixin","apple","smsCode"], }, //关于应用 "about": {