@tmsfe/tms-core 0.0.42 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index-proxy.js +1 -1
- package/src/index.js +4 -1
- package/src/mpInfo.js +16 -0
package/package.json
CHANGED
package/src/index-proxy.js
CHANGED
|
@@ -63,7 +63,7 @@ const asyncFuncNames = [
|
|
|
63
63
|
// 这行是tms-runtime的
|
|
64
64
|
'getPhone', 'login', 'getLoginInfo', 'getOpenId', 'getMycarPubOpenId', 'getSinanPubOpenId',
|
|
65
65
|
// tms-core
|
|
66
|
-
'setAuthInfo', 'getConfig', 'navigateToWebview', 'callCloudFunc',
|
|
66
|
+
'setAuthInfo', 'getConfig', 'navigateToWebview', 'callCloudFunc', 'getEncryptUserInfo',
|
|
67
67
|
'setUserLocation', 'getUserLocation', 'getMpOpenId', 'getOuterOpenId',
|
|
68
68
|
];
|
|
69
69
|
asyncFuncNames.forEach((funcName) => {
|
package/src/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from './ipxHelper';
|
|
38
38
|
import getLocInstance from './location/index';
|
|
39
39
|
import LocationBase from './location/base';
|
|
40
|
-
import { getMpOpenId, getOuterOpenId } from './mpInfo';
|
|
40
|
+
import { getMpOpenId, getOuterOpenId, getEncryptUserInfo } from './mpInfo';
|
|
41
41
|
import * as storage from './storage';
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -173,6 +173,9 @@ const api = {
|
|
|
173
173
|
getMpOpenId, // 变更为 getOuterOpenId
|
|
174
174
|
getOuterOpenId,
|
|
175
175
|
|
|
176
|
+
/* 获取加密的用户信息 */
|
|
177
|
+
getEncryptUserInfo,
|
|
178
|
+
|
|
176
179
|
/** rpx转px */
|
|
177
180
|
rpxToPx,
|
|
178
181
|
|
package/src/mpInfo.js
CHANGED
|
@@ -32,7 +32,23 @@ async function getOuterOpenId(apiKey) {
|
|
|
32
32
|
return openId;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
async function getEncryptUserInfo(mpId = '', queryTypes = '') {
|
|
36
|
+
if (!mpId) return Promise.reject('缺少服务标志mpId');
|
|
37
|
+
if (!queryTypes) return Promise.reject('缺少需要加密的用户信息字段描述');
|
|
38
|
+
return new Request().get('user/info/encrypt', { mpId, queryTypes })
|
|
39
|
+
.then((res) => {
|
|
40
|
+
const { resData, errCode, errMsg } = res || {};
|
|
41
|
+
if (errCode === 0) {
|
|
42
|
+
// 请求成功
|
|
43
|
+
return resData;
|
|
44
|
+
}
|
|
45
|
+
return Promise.reject(errMsg);
|
|
46
|
+
})
|
|
47
|
+
.catch(e => Promise.reject('请求发生错误,请重试'));
|
|
48
|
+
}
|
|
49
|
+
|
|
35
50
|
export {
|
|
36
51
|
getMpOpenId,
|
|
37
52
|
getOuterOpenId,
|
|
53
|
+
getEncryptUserInfo,
|
|
38
54
|
};
|