Authored by yyq

Merge branch 'feature/import' of git.yoho.cn:fe/yoho-miniapp-eshop into feature/import

... ... @@ -256,7 +256,7 @@ App({
this.setSessionKey('');
},
getMiniappType() {
return config.mini_app_type;
return wx.getExtConfigSync().miniappType;
},
getUnionType() {
return config.unionType;
... ...
... ... @@ -130,7 +130,7 @@ function wechatAuthLogin() { // showMsg: 是否显示拒绝授权提示
return wx.login()
.then(res => {
if (res.code) {
return accountModel.wechatMiniAppLogin(app.getAppId(), res.code);
return accountModel.wechatMiniAppLogin(res.code);
}
})
.then(data => {
... ... @@ -180,6 +180,8 @@ function getUserInfoLogin(e) {
if (data.data.union_id) {
app.setUnionID(data.data.union_id);
return wechatUserIsBind(data.data.union_id, nickName);
} else {
return router.go('bindMobile');
}
})
.then(res => {
... ...
... ... @@ -5,6 +5,7 @@
"ext": {
"name": "wechat",
"extAppid": "wxe8bfc9b404772199",
"miniappType": "5",
"attr": {
"host": "open.weixin.qq.com",
"users": [
... ...
... ... @@ -43,13 +43,15 @@ export default {
* @param code
* @returns {*}
*/
wechatMiniAppLogin(appId, code) {
wechatMiniAppLogin(code) {
const app = getApp();
return api.get({
url: '/wechat/',
data: {
method: 'wechat.smallProgram.onLogin',
jsCode: code,
appId
miniapp_type: app.getMiniappType()
}
});
},
... ...
... ... @@ -8,9 +8,9 @@
<block wx:if="{{!isLogin}}">
<button wx:if="{{!hasUnionID}}" class="login-btn"
open-type="getUserInfo"
bindgetuserinfo="getUserInfoLogin" plain="true">{{hasUnionId}}登录/注册</button>
bindgetuserinfo="getUserInfoLogin" plain="true">登录/注册</button>
<button wx:else class="login-btn" open-type="getPhoneNumber"
bindgetphonenumber="getPhoneNumber" plain="true">{{hasUnionId}}登录/注册</button>
bindgetphonenumber="getPhoneNumber" plain="true">登录/注册</button>
</block>
<block wx:else>
<image src="{{helper.image(userInfo.avatarUrl, 200, 200)}}" class="user-avatar"></image>
... ...