提交 cd9a8bf7 编写于 作者: DCloud_JSON's avatar DCloud_JSON

1. 通过微信小程序登陆自动保存到表 2. 我的-设置-个人资料 点击绑定手机号码,完善账号信息支持以下三种策略: -...

1. 通过微信小程序登陆自动保存到表 2. 我的-设置-个人资料 点击绑定手机号码,完善账号信息支持以下三种策略: 	- APP端,(如果支持)使用通过运营商一键获取手机号码 	- 微信小程序端,支持一键获取微信绑定的手机号 	- 其他端,通过手机验证码
上级 371241cb
## 1.1.14(2021-09-30)
1. 通过微信小程序登陆自动保存`sessionKey``uni-id-users`
2. 我的-设置-个人资料 点击绑定手机号码,完善账号信息支持以下三种策略:
- APP端,(如果支持)使用"通过运营商一键获取手机号码"
- 微信小程序端,支持"一键获取微信绑定的手机号"
- 其他端,通过手机验证码
## 1.1.13(2021-09-29)
修复search页面因多语言国际化导致白屏问题
修复search页面因多语言国际化导致白屏问题
## 1.1.12(2021-09-28)
1. 改造微信登陆逻辑,直接使用`uni.login`参数`"onlyAuthorize":true`实现
2. 修复,一键登录弹出层,已勾选“同意隐私政策协议”点击自定义登陆按钮,报“你未同意隐私政策协议”的bug
......
<template>
<uni-popup ref="popup" type="bottom">
<view class="box">
<text class="headBox">绑定资料</text>
<text class="tip">将一键获取你的手机号码绑定你的个人资料</text>
<view class="btnBox">
<text @click="closeMe" class="close">关闭</text>
<button class="agree" type="warn" @click="beforeGetphonenumber" open-type="getPhoneNumber"
@getphonenumber="bindMobileByMpWeixin">获取</button>
</view>
</view>
</uni-popup>
</template>
<script>
import {
mapMutations,
mapGetters
} from 'vuex';
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
let userId = ''
export default {
emits: ['next'],
computed: {
...mapGetters({
userInfo: 'user/info',
login: 'user/hasLogin'
})
},
data() {
return {}
},
methods: {
...mapMutations({
setUserInfo: 'user/login'
}),
beforeGetphonenumber() {
uni.showLoading({
mask:true
})
wx.checkSession({
success() {
console.log('session_key 未过期');
uni.hideLoading()
},
fail() {
console.log('session_key 已经失效,正在执行更新');
wx.login({
success({code}) {
uniCloud.callFunction({
name: "uni-id-cf",
data: {
"action": "refreshSessionKey",
"params": {
code
}
},
complete: (e) => {
console.log(e);
uni.hideLoading()
}
})
},
fail: (err) => {
console.error(err);
}
})
}
})
},
bindMobileByMpWeixin(e) {
console.log(e.detail);
uniCloud.callFunction({
name: "uni-id-cf",
data: {
"action": "bindMobileByMpWeixin",
"params": e.detail
},
complete: (e) => {
console.log(e);
},
success: (e) => {
uni.showToast({
title: e.result.msg,
icon: 'none'
});
if(e.result.code === 0){
this.setUserInfo({
"mobile": e.result.mobile
})
}
this.closeMe()
}
})
},
async open(uid) {
userId = uid
this.$refs.popup.open()
this.beforeGetphonenumber()
},
closeMe(e) {
this.$refs.popup.close()
},
}
}
</script>
<style lang="scss" scoped>
view {
display: flex;
}
.box {
background-color: #FFFFFF;
height: 200px;
width: 750rpx;
flex-direction: column;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
.headBox {
padding: 20rpx;
height: 80rpx;
line-height: 80rpx;
text-align: left;
font-size: 32upx;
color: #333333;
margin-left: 15rpx;
}
.tip {
color: #666666;
text-align: left;
justify-content: center;
margin: 10rpx 30rpx;
font-size: 36rpx;
}
.btnBox {
margin-top: 45rpx;
justify-content: center;
flex-direction: row;
}
.close,
.agree {
text-align: center;
width: 200rpx;
height: 80upx;
line-height: 80upx;
border-radius: 50px;
margin: 0 20rpx;
font-size: 36rpx;
}
.close {
color: #999999;
border-color: #EEEEEE;
border-style: solid;
border-width: 1px;
background-color: #FFFFFF;
}
.close:active {
color: #989898;
background-color: #E2E2E2;
}
.agree {
background-color: #DD524D;
color: #FFFFFF;
}
/* #ifdef MP */
.agree::after {
border: none;
}
.agree {
background-color: #DD524D;
}
/* #endif */
.agree:active {
background-color: #F5F5F6;
}
</style>
{
"id": "uni-starter",
"displayName": "uni-starter",
"version": "1.1.13",
"version": "1.1.14",
"description": "云端一体应用快速开发基本项目模版",
"keywords": [
"login",
......
......@@ -7,7 +7,6 @@
<uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
cancelButton="none" disabled :placeholder="inputPlaceholder" />
<view class="cover-search-bar" @click="searchClick"></view>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users" :page-size="10"
field="avatar,title,last_modify_date,user_id.username">
......@@ -26,8 +25,8 @@
<text class="title">{{item.title}}</text>
<view class="info">
<text class="author">{{item.user_id[0].username}}</text>
<uni-dateformat class="last_modify_date" :date="item.last_modify_date" format="yyyy-MM-dd"
:threshold="[60000, 2592000000]" />
<uni-dateformat class="last_modify_date" :date="item.last_modify_date"
format="yyyy-MM-dd" :threshold="[60000, 2592000000]" />
</view>
</view>
</template>
......@@ -54,11 +53,11 @@
components: {
statusBar
},
computed:{
inputPlaceholder(e){
if(uni.getStorageSync('CURRENT_LANG') == "en"){
computed: {
inputPlaceholder(e) {
if (uni.getStorageSync('CURRENT_LANG') == "en") {
return 'Please enter the search content'
}else{
} else {
return '请输入搜索内容'
}
}
......@@ -100,7 +99,9 @@
// });
//默认h5端不获取定位
// #ifndef H5
let location = await gps.getLocation({geocode:true})
let location = await gps.getLocation({
geocode: true
})
console.log(location);
// #endif
// if(location){
......@@ -132,7 +133,7 @@
})
console.log('refresh');
},
onqueryerror(e){
onqueryerror(e) {
console.log(e);
}
},
......@@ -154,6 +155,7 @@
box-sizing: border-box;
flex-direction: column;
}
/* #endif */
.pages {
background-color: #FFFFFF;
......@@ -239,13 +241,14 @@
.f1 {
flex: 1;
}
.cover-search-bar{
.cover-search-bar {
height: 50px;
position: relative;
top: -50px;
margin-bottom: -50px;
/* #ifndef APP-NVUE */
z-index:999;
z-index: 999;
/* #endif */
}
</style>
......@@ -12,7 +12,7 @@
</uni-list-item>
<uni-list-item class="item" @click="setNickname('')" :title="$t('userinfo.nickname')" :rightText="userInfo.nickname||$t('userinfo.notSet')" link>
</uni-list-item>
<uni-list-item class="item" @click="bindMobileBySmsCode" :title="$t('userinfo.phoneNumber')" :rightText="userInfo.mobile||$t('userinfo.notSpecified')" link>
<uni-list-item class="item" @click="bindMobile" :title="$t('userinfo.phoneNumber')" :rightText="userInfo.mobile||$t('userinfo.notSpecified')" link>
</uni-list-item>
</uni-list>
<uni-popup ref="dialog" type="dialog">
......@@ -20,6 +20,7 @@
:placeholder="$t('userinfo.setNicknamePlaceholder')">
</uni-popup-dialog>
</uni-popup>
<uni-bindMobileByMpWeixin ref="uni-bindMobileByMpWeixin"></uni-bindMobileByMpWeixin>
</view>
</template>
<script>
......@@ -76,9 +77,14 @@
}
})
// #endif
// #ifndef APP-PLUS
this.bindMobileBySmsCode()
// #ifdef MP-WEIXIN
this.$refs['uni-bindMobileByMpWeixin'].open()
// #endif
// #ifdef H5
//...去用验证码绑定
this.bindMobileBySmsCode()
// #endif
},
univerify() {
......
{
"name" : "uni-config-center",
"version" : "0.0.2",
"description" : "配置中心",
"main" : "index.js",
"keywords" : [],
"author" : "DCloud",
"license" : "Apache-2.0",
"dependencies" : null
"name": "uni-config-center",
"version": "0.0.2",
"description": "配置中心",
"main": "index.js",
"keywords": [],
"author": "DCloud",
"license": "Apache-2.0"
}
\ No newline at end of file
......@@ -127,6 +127,42 @@ exports.main = async (event, context) => {
let res = {}
switch (action) { //根据action的值执行对应的操作
case 'refreshSessionKey':
let getSessionKey = await uniID.code2SessionWeixin({code:params.code});
if(getSessionKey.code){
return getSessionKey
}
res = await uniID.updateUser({
uid: params.uid,
sessionKey:getSessionKey.sessionKey
})
console.log(res);
break;
case 'bindMobileByMpWeixin':
console.log(params);
let getSessionKeyRes = await uniID.getUserInfo({
uid: params.uid,
field: ['sessionKey']
})
if(getSessionKeyRes.code){
return getSessionKeyRes
}
let sessionKey = getSessionKeyRes.userInfo.sessionKey
console.log(getSessionKeyRes);
res = await uniID.wxBizDataCrypt({
...params,
sessionKey
})
console.log(res);
if(res.code){
return res
}
res = await uniID.bindMobile({
uid: params.uid,
mobile: res.purePhoneNumber
})
console.log(res);
break;
case 'bindMobileByUniverify':
let {
appid, apiKey, apiSecret
......@@ -269,6 +305,15 @@ exports.main = async (event, context) => {
return wxRes
}
}
if(context.PLATFORM == "mp-weixin"){
let resUpdateUser = await uniID.updateUser({
uid: loginRes.uid,
sessionKey:loginRes.sessionKey
})
console.log(resUpdateUser);
}
delete loginRes.openid
delete loginRes.sessionKey
delete loginRes.accessToken
delete loginRes.refreshToken
}
......
## 3.3.6(2021-09-08)
- 修复 邀请码可能重复的Bug
## 3.3.5(2021-08-10)
- 修复版本号错误
## 3.3.4(2021-08-10)
......
{
"id": "uni-id",
"displayName": "uni-id",
"version": "3.3.5",
"version": "3.3.6",
"description": "简单、统一、可扩展的用户中心",
"keywords": [
"uniid",
......
{
"name": "uni-id",
"version": "3.3.5",
"version": "3.3.6",
"description": "uni-id for uniCloud",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
......
......@@ -160,7 +160,7 @@
},
"quickapp" : {},
"mp-weixin" : {
"appid" : "",
"appid" : "wxec5319bef3a0d8fb",
"setting" : {
"urlCheck" : false,
"es6" : false
......
......@@ -23,8 +23,8 @@
"mp-weixin": {
"oauth": {
"weixin": {
"appid": "wx81dbb061d2258234",
"appsecret": "51977820eb14cd71377d4048a1b4754e"
"appid": "wxec5319bef3a0d8fb",
"appsecret": "68bf2402a70d50c3b53097be4712c914"
}
}
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册