diff --git a/manifest.json b/manifest.json
index d692b13aa27a0afab661938051a203986558050d..1946daf5cade02196259d29c5114a1146999d285 100644
--- a/manifest.json
+++ b/manifest.json
@@ -137,12 +137,12 @@
"enable" : false
},
"devServer" : {
- "port" : -11,
+ "port" : 8080,
"disableHostCheck" : true,
"https" : false
},
"router" : {
- "mode" : "history"
+ "mode" : "hash"
}
},
"_spaceID" : "9f641af8-e860-44e5-b18f-f68dd8fe3fe4",
diff --git a/pages.json b/pages.json
index 6aad4374993df6c238654a870d0a1aeaf088e9a6..02ad80f711d9d5cf16a58d5341798158e8d7b5d2 100644
--- a/pages.json
+++ b/pages.json
@@ -1,7 +1,15 @@
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+ {
+ "path" : "pages/test/test",
+ "style" :
+ {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
{
- "path": "pages/index/index",
+ "path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
@@ -39,7 +47,7 @@
{
"path": "uni_modules/uni-id-pages/pages/login/login-withpwd",
"style": {
- "navigationBarTitleText": ""
+ "navigationBarTitleText": ""
}
},
{
@@ -80,7 +88,10 @@
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#FFF",
- "backgroundColor": "#F8F8F8"
+ "backgroundColor": "#F8F8F8",
+ /* #ifdef H5 */
+ "navigationStyle": "custom"
+ /* #endif */
}
,"condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
diff --git a/pages/test/test.vue b/pages/test/test.vue
new file mode 100644
index 0000000000000000000000000000000000000000..059ce8b8d9abfc2ebca33b281cc3a1cc9adb0ba7
--- /dev/null
+++ b/pages/test/test.vue
@@ -0,0 +1,22 @@
+
+
+ index
+
+
+
+
+
+
diff --git a/uni_modules/uni-id-pages/changelog.md b/uni_modules/uni-id-pages/changelog.md
index 98ae996f401725edd6490378e9fd887f846863e8..308f6ec359b393f7290530383b34713faa05007a 100644
--- a/uni_modules/uni-id-pages/changelog.md
+++ b/uni_modules/uni-id-pages/changelog.md
@@ -1,9 +1,7 @@
## 1.0.7(2022-07-19)
- 新增 web移动端,微信内基于公众号登录
- 新增 web电脑端,基于微信开放平台的微信扫码登录
-- 未安装
-
-
+- 新增 登录成功(全局)回调事件:`uni-id-pages-login-success`,支持通过[uni.$on](https://uniapp.dcloud.net.cn/api/window/communication.html#on)监听;
## 1.0.7(2022-07-19)
- 修复 uni-id-co接口 logout时没有删除token的Bug
## 1.0.6(2022-07-13)
diff --git a/uni_modules/uni-id-pages/common/login-page.mixin.js b/uni_modules/uni-id-pages/common/login-page.mixin.js
index 4ddab0b38b21403bd25aec2cb0bef856ff034e03..6a3cab9c8d8bde41975b520079ba2ed7364c834c 100644
--- a/uni_modules/uni-id-pages/common/login-page.mixin.js
+++ b/uni_modules/uni-id-pages/common/login-page.mixin.js
@@ -4,7 +4,7 @@ let mixin = {
data() {
return {
config,
- isMounted:false
+ isMounted: false
}
},
onUnload() {
@@ -15,9 +15,33 @@ let mixin = {
mounted() {
this.isMounted = true;
},
+ onLoad(e) {
+ if (e.is_weixin_redirect) {
+ uni.showLoading({
+ mask: true
+ })
+
+ if( window.location.href.includes('#') ){
+ // 将url通过 ? 分割获取后面的参数字符串 再通过 & 将每一个参数单独分割出来
+ let paramsArr = window.location.href.split('?')[1].split('&')
+ paramsArr.forEach(item=>{
+ let arr = item.split('=')
+ if(arr[0] == 'code'){
+ e.code = arr[1]
+ }
+ })
+ }
+ this.$nextTick(n => {
+ console.log(this.$refs.uniFabLogin);
+ this.$refs.uniFabLogin.login({
+ code:e.code
+ }, 'weixin')
+ })
+ }
+ },
computed: {
- needAgreements(){
- if(this.isMounted){
+ needAgreements() {
+ if (this.isMounted) {
if (this.$refs.agreements) {
return this.$refs.agreements.needAgreements
} else {
@@ -27,7 +51,7 @@ let mixin = {
},
agree: {
get() {
- if(this.isMounted){
+ if (this.isMounted) {
if (this.$refs.agreements) {
return this.$refs.agreements.isAgree
} else {
@@ -38,7 +62,7 @@ let mixin = {
set(agree) {
if (this.$refs.agreements) {
this.$refs.agreements.isAgree = agree
- }else{
+ } else {
console.log('不存在 隐私政策协议组件');
}
}
@@ -48,6 +72,6 @@ let mixin = {
loginSuccess(e) {
loginSuccess(e)
}
- }
+ }
}
-export default mixin
+export default mixin
diff --git a/uni_modules/uni-id-pages/common/loginSuccess.js b/uni_modules/uni-id-pages/common/loginSuccess.js
index 655628b550a2c92c86db1a08801144d593ff873a..17df975216c645d49054b94b08894d79e41c9820 100644
--- a/uni_modules/uni-id-pages/common/loginSuccess.js
+++ b/uni_modules/uni-id-pages/common/loginSuccess.js
@@ -14,16 +14,24 @@ export default function(e = {}) {
}
if (autoBack) {
let delta = 0; //判断需要返回几层
- let pages = getCurrentPages();
+ let pages = getCurrentPages();
+ uni.$emit('uni-id-pages-login-success',pages)
console.log(pages);
pages.forEach((page, index) => {
if (pages[pages.length - index - 1].route.split('/')[3] == 'login') {
delta++
}
+ })
+ console.log('判断需要返回几层:',pages, delta);
+ // #ifdef H5
+ if(e.loginType == 'weixin'){
+ console.log('window.history',window.history);
+ return window.history.go(-3)
+ }
+ // #endif
+
+ uni.navigateBack({
+ delta
})
- console.log('判断需要返回几层:', delta);
- // uni.navigateBack({
- // delta
- // })
}
}
diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue
index b8ea9eefc67c6e3aae5e4f125a0fdae21909ed9c..15877e1794bfdf34a926ddc72030026e4e01f331 100644
--- a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue
+++ b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue
@@ -229,17 +229,27 @@
// #ifdef H5
if(type == 'weixin'){
console.log('开始微信网页登录');
- location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=wx4dcf96ab6af4c5e8
- &redirect_uri=${encodeURIComponent('http://test.0577app.com/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin_redirect')}
- &response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`
-
- /*location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?
- appid=wx32b2580e30ef8555
- &redirect_uri=${encodeURIComponent('http://test.0577app.com/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin_redirect')}
- &response_type=code
- &scope=snsapi_userinfo
- &state=STATE&connect_redirect=1#wechat_redirect`;*/
+ let redirectUrl = location.protocol +'//'+
+ document.domain +
+ (window.location.href.includes('#')?'/#':'') +
+ '/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
+ let ua = window.navigator.userAgent.toLowerCase();
+ if (ua.match(/MicroMessenger/i) == 'micromessenger'){
+ console.log('在微信公众号内');
+ return window.open(`https://open.weixin.qq.com/connect/oauth2/authorize?
+ appid=wx32b2580e30ef8555
+ &redirect_uri=${encodeURIComponent(redirectUrl)}
+ &response_type=code
+ &scope=snsapi_userinfo
+ &state=STATE&connect_redirect=1#wechat_redirect`);
+
+ }else{
+ console.log('非微信公众号内');
+ return location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=wx4dcf96ab6af4c5e8
+ &redirect_uri=${encodeURIComponent(redirectUrl)}
+ &response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`
+ }
}
// #endif
@@ -426,6 +436,9 @@
})
return this.$refs.userProfile.open(result.uid)
}
+ // #endif
+ // #ifdef H5
+ result.loginType = type
// #endif
loginSuccess(result)
})
@@ -489,7 +502,7 @@
width: 750rpx;
justify-content: space-around;
position: fixed;
- bottom: 10rpx;
+ bottom: 10rpx;
left: 0;
}
@@ -509,7 +522,7 @@
align-items: center;
height: 200rpx;
cursor: pointer;
- }
+ }
.logo {
width: 60rpx;
diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue b/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue
index 088326b01031a0714ce2aeb85ea3c8c85d2ecc74..81b2292cc9dbef5324274cf7634cee75a85f1709 100644
--- a/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue
+++ b/uni_modules/uni-id-pages/components/uni-id-pages-sms-form/uni-id-pages-sms-form.vue
@@ -198,7 +198,7 @@
top: 0;
right: 8px;
width: 260rpx;
- max-width: 130px;
+ max-width: 100px;
height: 44px;
/* #ifndef APP-NVUE */
display: flex;
@@ -229,7 +229,7 @@
}
.box ::v-deep .content-clear-icon {
- margin-right: 100px;
+ margin-right: 110px;
}
.box {
diff --git a/uni_modules/uni-id-pages/init.js b/uni_modules/uni-id-pages/init.js
index a12da9e363b1c3509641e20961a927c3640121a2..8a7db56d984ee80dc1bffbac3b827a6a92264242 100644
--- a/uni_modules/uni-id-pages/init.js
+++ b/uni_modules/uni-id-pages/init.js
@@ -96,11 +96,4 @@ export default async function() {
}
})
}
-
- //5.未启用uni统计,但使用uni-id-pages+uni-push2.0,onLaunch时上报device_id至服务端
- if(uni.report == undefined){
- if (uni.getPushClientId) {
-
- }
- }
}
diff --git a/uni_modules/uni-id-pages/package-lock.json b/uni_modules/uni-id-pages/package-lock.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4c0c59c76a41c35f82d7099256705ef7fb5ae32
--- /dev/null
+++ b/uni_modules/uni-id-pages/package-lock.json
@@ -0,0 +1,29 @@
+{
+ "name": "uni-id-pages",
+ "version": "1.0.7",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "version": "1.0.7",
+ "dependencies": {
+ "jweixin-module": "^1.6.0"
+ },
+ "engines": {
+ "HBuilderX": "^3.4.17"
+ }
+ },
+ "node_modules/jweixin-module": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
+ "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
+ }
+ },
+ "dependencies": {
+ "jweixin-module": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
+ "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
+ }
+ }
+}
diff --git a/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue b/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue
index da7c4aa25256ec6fdbf21329c32775f710260a52..256a99e7548b6d2cba7c7047f8eb14b5e466949f 100644
--- a/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue
+++ b/uni_modules/uni-id-pages/pages/login/login-withoutpwd.vue
@@ -53,15 +53,6 @@
async onLoad(e) {
console.log(e);
let type = e.type
-
-
- if(type == 'weixin_redirect'){
- this.$nextTick(n=>{
- console.log(this.$refs.uniFabLogin);
- this.$refs.uniFabLogin.login({code:e.code},'weixin')
- })
- }
-
// console.log({type});
this.type = type
if(type != 'univerify'){
diff --git a/uni_modules/uni-id-pages/uniCloud/database/opendb-device.schema.json b/uni_modules/uni-id-pages/uniCloud/database/opendb-device.schema.json
index 7c6cb444e4445307c66aa259c72b102cbaaa7de2..529b672ca053d845b35793b5ec6d61b3d08065fe 100644
--- a/uni_modules/uni-id-pages/uniCloud/database/opendb-device.schema.json
+++ b/uni_modules/uni-id-pages/uniCloud/database/opendb-device.schema.json
@@ -3,7 +3,7 @@
"required": [],
"permission": {
"read": false,
- "create": false,
+ "create": true,
"update": false,
"delete": false
},