提交 2cb1aa0e 编写于 作者: fxy060608's avatar fxy060608

feat(v3): mp runtime

上级 dbb1884c
......@@ -6552,10 +6552,15 @@ var serviceContext = (function () {
code: err.code,
errMsg: 'login:fail:' + err.message
});
});
}, { scope: 'email' });
}
// 先注销再登录
loginServices[provider].logout(login, login);
// apple登录logout之后无法重新触发获取email,fullname
if (provider === 'apple') {
login();
} else {
loginServices[provider].logout(login, login);
}
};
/**
* 微信登录
......@@ -6594,7 +6599,7 @@ var serviceContext = (function () {
errMsg: 'operateWXData:fail:请先调用 uni.login'
})
}
loginService.getUserInfo(res => {
loginService.getUserInfo(res => {
let userInfo;
if (provider === 'weixin') {
const wechatUserInfo = loginService.userInfo;
......@@ -6608,28 +6613,38 @@ var serviceContext = (function () {
avatarUrl: wechatUserInfo.headimgurl,
unionId: wechatUserInfo.unionid
};
} else if (provider === 'apple') {
const appleInfo = loginService.appleInfo;
userInfo = {
openId: appleInfo.user,
fullName: appleInfo.fullName,
email: appleInfo.email,
authorizationCode: appleInfo.authorizationCode,
identityToken: appleInfo.identityToken,
realUserStatus: appleInfo.realUserStatus
};
} else {
loginService.userInfo.openId = loginService.userInfo.openId || loginService.userInfo.openid ||
loginService.authResult.openid;
loginService.userInfo.nickName = loginService.userInfo.nickName || loginService.userInfo.nickname;
loginService.userInfo.avatarUrl = loginService.userInfo.avatarUrl || loginService.userInfo.avatarUrl ||
loginService.userInfo.headimgurl;
loginService.userInfo.headimgurl;
userInfo = loginService.userInfo;
}
const result = {
errMsg: 'operateWXData:ok'
};
if (params.data && params.data.api_name === 'webapi_getuserinfo') {
}
const result = {
errMsg: 'operateWXData:ok'
};
if (params.data && params.data.api_name === 'webapi_getuserinfo') {
result.data = {
data: JSON.stringify(userInfo),
rawData: '',
signature: '',
encryptedData: '',
iv: ''
};
} else {
result.userInfo = userInfo;
}
};
} else {
result.userInfo = userInfo;
}
invoke$1(callbackId, result);
}, err => {
invoke$1(callbackId, {
......@@ -12245,6 +12260,10 @@ var serviceContext = (function () {
this.batchData.push([type, typeData]);
}
find (type, cid) {
return this.batchData.find(data => data[0] === type && data[1][0] === cid)
}
sendPageCreate (data) {
this.pageCreateData = data;
UniServiceJSBridge.publishHandler(VD_SYNC, {
......@@ -12467,8 +12486,18 @@ var serviceContext = (function () {
if (!this._$vd) {
return
}
this._$vdUpdatedData = Object.create(null);
this._$setData(UPDATED_DATA, this._$vdUpdatedData);
// 当已存在 _$vdMountedData 时,使用重置后的 _$vdMountedData
const mountedData = this._$vd.find(MOUNTED_DATA, this._$id);
if (mountedData) {
this._$data = Object.create(null); // 清空已有数据
this._$vdUpdatedData = mountedData[1][1] = Object.create(null);
if (process.env.NODE_ENV !== 'production') {
console.log('updated=>mounted:' + this._$id);
}
} else {
this._$vdUpdatedData = Object.create(null);
this._$setData(UPDATED_DATA, this._$vdUpdatedData);
}
this._$newData = Object.create(null);
},
beforeDestroy () {
......
......@@ -227,7 +227,7 @@ const BEHAVIORS = {
}
if (!props.value) {
props.value = {
type: null
type: String // 默认类型为 String,否则默认值为 null,导致一些自定义 input 显示不正确
};
}
}
......
......@@ -61,7 +61,7 @@ const BEHAVIORS = {
}
if (!props.value) {
props.value = {
type: null
type: String // 默认类型为 String,否则默认值为 null,导致一些自定义 input 显示不正确
}
}
}
......
......@@ -22,7 +22,7 @@ export function unsubscribe (event, callback) {
export function subscribeHandler (event, args, pageId) {
if (process.env.NODE_ENV !== 'production') {
console.log(`[subscribeHandler][${Date.now()}]:`, event, args, pageId)
console.log(`[subscribeHandler][${Date.now()}]:${event}, ${JSON.stringify(args)}, ${pageId}`)
}
return emit('view.' + event, args, pageId)
}
......
......@@ -19,7 +19,7 @@ export function unsubscribe (event, callback) {
export function subscribeHandler (event, args, pageId) {
if (process.env.NODE_ENV !== 'production') {
console.log(`[subscribeHandler][${Date.now()}]:`, event, args, pageId)
console.log(`[subscribeHandler][${Date.now()}]:${event}, ${JSON.stringify(args)}, ${pageId}`)
}
emit('service.' + event, args, pageId)
}
......
......@@ -99,8 +99,18 @@ export function initData (Vue) {
if (!this._$vd) {
return
}
this._$vdUpdatedData = Object.create(null)
this._$setData(UPDATED_DATA, this._$vdUpdatedData)
// 当已存在 _$vdMountedData 时,使用重置后的 _$vdMountedData
const mountedData = this._$vd.find(MOUNTED_DATA, this._$id)
if (mountedData) {
this._$data = Object.create(null) // 清空已有数据
this._$vdUpdatedData = mountedData[1][1] = Object.create(null)
if (process.env.NODE_ENV !== 'production') {
console.log('updated=>mounted:' + this._$id)
}
} else {
this._$vdUpdatedData = Object.create(null)
this._$setData(UPDATED_DATA, this._$vdUpdatedData)
}
this._$newData = Object.create(null)
},
beforeDestroy () {
......
......@@ -160,6 +160,10 @@ export class VDomSync {
this.batchData.push([type, typeData])
}
find (type, cid) {
return this.batchData.find(data => data[0] === type && data[1][0] === cid)
}
sendPageCreate (data) {
this.pageCreateData = data
UniServiceJSBridge.publishHandler(VD_SYNC, {
......
......@@ -96,6 +96,8 @@ function vdSync ({
})
vd.flush()
Vue.nextTick(() => {
// 清空本次 addBatchData
vd.clearAddBatchVData()
updateView()
isVdCallback && UniViewJSBridge.publishHandler(VD_SYNC_CALLBACK)
})
......
......@@ -49,6 +49,10 @@ export class VDomSync {
})
}
clearAddBatchVData () {
this.addBatchVData.length = 0
}
flush () {
this.updateBatchVData.forEach(([cid, data]) => {
const vm = this.vms[cid]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册