diff --git a/changelog.md b/changelog.md index 4a93f5a21f947544d6388acb49e50dac18d18e89..8911de1493aa8cdd283baea512acb6922ab2c3a2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,5 @@ +## 1.0.15(2021-06-07) +为迎合苹果App Store的规则,登陆与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登陆和微信分享选项。 ## 1.0.14(2021-06-07) 修改错误的表名称uni-verify为opendb-verify-codes ## 1.0.13(2021-06-04) diff --git a/components/uni-quick-login/uni-quick-login.vue b/components/uni-quick-login/uni-quick-login.vue index 24ead917e2fcfccf4bb4f11653f148f1f33bb1f3..f1e4a36143557d99982b9c066487c5b330bdfc56 100644 --- a/components/uni-quick-login/uni-quick-login.vue +++ b/components/uni-quick-login/uni-quick-login.vue @@ -39,9 +39,9 @@ } }, props: { - agree:{ - type:Boolean, - default(){ + agree: { + type: Boolean, + default () { return false } }, @@ -105,7 +105,7 @@ //去掉配置项中不存在的项 for (var i = 0; i < servicesList.length; i++) { if (!this.loginConfig.includes(servicesList[i].id)) { - console.log('去掉配置项中不存在的项',servicesList[i].id); + console.log('去掉配置项中不存在的项', servicesList[i].id); servicesList.splice(i, 1) } } @@ -119,15 +119,23 @@ oauthServices.forEach(({ id }) => { - // console.log(9527,id); - if (this.config[id].isChecked&&this.loginConfig.includes(id)) { + if (this.config[id].isChecked && this.loginConfig.includes(id)) { + if (id == 'weixin') { + if (~plus.runtime.isApplicationExist({ + pname: 'com.tencent.mm', + action: 'weixin://' + })) { + // console.log("微信应用未安装"); + return + } + } this.servicesList.push({ ...this.config[id], id }) } }) - // console.log(oauthServices); + // console.log('oauthServices',oauthServices); }, err => { uni.hideLoading() uni.showModal({ @@ -171,13 +179,15 @@ } }, login_before(type, navigateBack = true) { - if(!this.agree){ + if (!this.agree) { return uni.showToast({ title: '你未同意隐私政策协议', icon: 'none' }); } - uni.showLoading({mask:true}) + uni.showLoading({ + mask: true + }) // console.log(arguments); let oauthService = this.oauthServices.find((service) => service.id == type) // console.log(type); @@ -195,10 +205,10 @@ }, err => { uni.hideLoading() - console.log(err); - uni.showModal({ - content: JSON.stringify(err), - showCancel: false + console.log(err); + uni.showModal({ + content: JSON.stringify(err), + showCancel: false }); }) } @@ -233,7 +243,7 @@ console.log(err); if (type == 'univerify') { - if (err.metadata&&err.metadata.error_data) { + if (err.metadata && err.metadata.error_data) { uni.showToast({ title: "一键登录:" + err.metadata.error_data, icon: 'none' @@ -249,33 +259,33 @@ uni.navigateBack() } break; - case 30006: - uni.showModal({ - title: "登录服务初始化错误", - content: err.metadata.error_data, - showCancel: false, - confirmText: '知道了', - }); - break; - case "30008": - uni.showToast({ - title: '点击了第三方登陆', - icon: 'none' - }); - switch (err.index){ - case 0: - this.login_before('weixin',false) - break; - case 1: - this.login_before('apple',false) - break; - default: - break; - } - + case 30006: + uni.showModal({ + title: "登录服务初始化错误", + content: err.metadata.error_data, + showCancel: false, + confirmText: '知道了', + }); break; - default: - console.log(9527,err); + case "30008": + uni.showToast({ + title: '点击了第三方登陆', + icon: 'none' + }); + switch (err.index) { + case 0: + this.login_before('weixin', false) + break; + case 1: + this.login_before('apple', false) + break; + default: + break; + } + + break; + default: + console.log(9527, err); break; } } @@ -283,31 +293,34 @@ }) }, login(params, type) { //联网验证登录 + console.log('type--', type); console.log({ params, type }); - uniCloud.callFunction({ - name:'uni-id-cf', - data:{ - action:'login_by_'+type, - params - }, - success: ({result}) => { - console.log(result); - if (result.code === 0) { - if (type == 'univerify') { - uni.closeAuthView() - } - uni.hideLoading() - loginSuccess(result) - delete result.userInfo.token - this.setUserInfo(result.userInfo) - } - }, - complete: () => { - uni.hideLoading() - } + uniCloud.callFunction({ + name: 'uni-id-cf', + data: { + action: 'login_by_' + type, + params + }, + success: ({ + result + }) => { + console.log(result); + if (result.code === 0) { + if (type == 'univerify') { + uni.closeAuthView() + } + uni.hideLoading() + loginSuccess(result) + delete result.userInfo.token + this.setUserInfo(result.userInfo) + } + }, + complete: () => { + uni.hideLoading() + } }) }, async getUserInfo(e) { @@ -357,4 +370,4 @@ margin-top: 4px; font-size: 26rpx; } - + diff --git a/package.json b/package.json index ebf3c99e6fd7dde5555bdefe5978f573561cfd56..aa1165681acb1f5034ddf7d09938edc28e4997b2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "id": "uni-starter", "displayName": "uni-starter", - "version": "1.0.14", + "version": "1.0.15", "description": "云端一体应用快速开发模版", "keywords": [ "uni-starter", diff --git a/pages/list/list.nvue b/pages/list/list.nvue index b46c5613728b27234a9ad8e74890569b05bc34f9..007e6cef56ded761259db7052d8f6bedb61f5a84 100644 --- a/pages/list/list.nvue +++ b/pages/list/list.nvue @@ -1,17 +1,19 @@