export function idCardNoFn(data) { return new Promise(resolve => { const app = getApp(); const { appPublicKey } = app.globalData; const value = (typeof data).toLocaleLowerCase() === 'string' ? data : JSON.stringify(data); const textValue = JSON.parse(value); const idCardNo = textValue.idCardNo || ''; const params = { text: idCardNo, action: 'encrypt', key: appPublicKey }; my.rsa({ ...params, fail: () => resolve(''), success: ({ text }) => resolve(text) }); }); } export function mobileFn(data) { return new Promise(resolve => { const app = getApp(); const { appPublicKey } = app.globalData; const value = (typeof data).toLocaleLowerCase() === 'string' ? data : JSON.stringify(data); const textValue = JSON.parse(value); const mobile = textValue.mobile || ''; const params = { text: mobile, action: 'encrypt', key: appPublicKey }; my.rsa({ ...params, fail: () => resolve(''), success: ({ text }) => resolve(text) }); }); }