component-shipinlv 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/AuthClient/qr/h5-we-public-login.d.ts +2 -0
- package/dist/AuthClient/qr/h5-we-public-login.js +42 -0
- package/dist/AuthClient/qr/index.js +21 -1
- package/dist/lib/Tool.d.ts +1 -1
- package/dist/service/api/WechatController.d.ts +8 -0
- package/dist/service/api/WechatController.js +50 -0
- package/dist/typings/Wechat.d.ts +19 -0
- package/dist/typings/Wechat.js +0 -0
- package/package.json +1 -1
@@ -0,0 +1,42 @@
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
|
+
// h5 页面 登录公众号
|
4
|
+
import * as WechatController from "../../service/api/WechatController";
|
5
|
+
import Tool from "../../lib/Tool";
|
6
|
+
var h5WePublicLogin = /*#__PURE__*/function () {
|
7
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
8
|
+
var domainUrl, redirectUrl, inviteUserId, loginResult;
|
9
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
10
|
+
while (1) switch (_context.prev = _context.next) {
|
11
|
+
case 0:
|
12
|
+
// 首先获取 登录跳转地址;
|
13
|
+
domainUrl = 'https://auth.shanren.wang';
|
14
|
+
redirectUrl = "".concat(domainUrl, "/h5-wechat-login-callback?");
|
15
|
+
inviteUserId = Tool.getInviteUserId();
|
16
|
+
_context.next = 5;
|
17
|
+
return WechatController.h5WePublicLogin({
|
18
|
+
redirectUrl: redirectUrl,
|
19
|
+
inviteUserId: inviteUserId
|
20
|
+
}).catch(function () {});
|
21
|
+
case 5:
|
22
|
+
loginResult = _context.sent;
|
23
|
+
if (loginResult) {
|
24
|
+
_context.next = 8;
|
25
|
+
break;
|
26
|
+
}
|
27
|
+
return _context.abrupt("return");
|
28
|
+
case 8:
|
29
|
+
// 因为 微信 会校验跳转域名,所以 用制定 中转;
|
30
|
+
|
31
|
+
document.location.href = loginResult.redirectUrl;
|
32
|
+
case 9:
|
33
|
+
case "end":
|
34
|
+
return _context.stop();
|
35
|
+
}
|
36
|
+
}, _callee);
|
37
|
+
}));
|
38
|
+
return function h5WePublicLogin() {
|
39
|
+
return _ref.apply(this, arguments);
|
40
|
+
};
|
41
|
+
}();
|
42
|
+
export default h5WePublicLogin;
|
@@ -19,6 +19,7 @@ var reTryTimeLoop = 1000; // ms
|
|
19
19
|
var FromWhere = 'web';
|
20
20
|
import QRCode from 'qrcode.react';
|
21
21
|
import isInClient from "../../lib/isInClient";
|
22
|
+
import h5WePublicLogin from "./h5-we-public-login";
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
23
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
24
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -144,7 +145,7 @@ var LoginQr = function LoginQr(_ref) {
|
|
144
145
|
env: getApiEnv()
|
145
146
|
});
|
146
147
|
}, {
|
147
|
-
manual: !isInClient() || defaultLoginType !== 'wechat',
|
148
|
+
manual: Platform.isWechat || !isInClient() || defaultLoginType !== 'wechat',
|
148
149
|
onSuccess: function onSuccess(result) {
|
149
150
|
setWeQrUrl(result.url);
|
150
151
|
onRunCheck();
|
@@ -216,6 +217,25 @@ var LoginQr = function LoginQr(_ref) {
|
|
216
217
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
217
218
|
while (1) switch (_context3.prev = _context3.next) {
|
218
219
|
case 0:
|
220
|
+
if (!Platform.isWechat) {
|
221
|
+
_context3.next = 7;
|
222
|
+
break;
|
223
|
+
}
|
224
|
+
setLoading(true);
|
225
|
+
// jump
|
226
|
+
_context3.next = 4;
|
227
|
+
return h5WePublicLogin();
|
228
|
+
case 4:
|
229
|
+
setLoading(false);
|
230
|
+
_context3.next = 9;
|
231
|
+
break;
|
232
|
+
case 7:
|
233
|
+
_context3.next = 9;
|
234
|
+
return runWeLoginQr();
|
235
|
+
case 9:
|
236
|
+
_context3.next = 11;
|
237
|
+
return runWeLoginQr();
|
238
|
+
case 11:
|
219
239
|
case "end":
|
220
240
|
return _context3.stop();
|
221
241
|
}
|
package/dist/lib/Tool.d.ts
CHANGED
@@ -163,7 +163,7 @@ declare const Tool: {
|
|
163
163
|
setTimeOffset(serverTime: number): void;
|
164
164
|
getTime(): number;
|
165
165
|
h5Pay(query: Pay.H5PayQuery): void;
|
166
|
-
notification(type: "
|
166
|
+
notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
167
167
|
notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
168
168
|
notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
169
169
|
notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare function share(body: {
|
2
|
+
url: string;
|
3
|
+
dealerId: number;
|
4
|
+
}, options?: ServicesApi.RequestOptions): Promise<Wechat.Share>;
|
5
|
+
export declare function h5WePublicLogin(body: {
|
6
|
+
redirectUrl: string;
|
7
|
+
inviteUserId: number;
|
8
|
+
}, options?: ServicesApi.RequestOptions): Promise<Wechat.H5WePublicLogin>;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
|
+
import request from "../../lib/request";
|
5
|
+
export function share(_x, _x2) {
|
6
|
+
return _share.apply(this, arguments);
|
7
|
+
}
|
8
|
+
function _share() {
|
9
|
+
_share = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body, options) {
|
10
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
11
|
+
while (1) switch (_context.prev = _context.next) {
|
12
|
+
case 0:
|
13
|
+
return _context.abrupt("return", request("wechat/jsConfigByWechatAppId", _objectSpread({
|
14
|
+
method: 'POST',
|
15
|
+
headers: {
|
16
|
+
'Content-Type': 'application/json'
|
17
|
+
},
|
18
|
+
data: body
|
19
|
+
}, options || {})));
|
20
|
+
case 1:
|
21
|
+
case "end":
|
22
|
+
return _context.stop();
|
23
|
+
}
|
24
|
+
}, _callee);
|
25
|
+
}));
|
26
|
+
return _share.apply(this, arguments);
|
27
|
+
}
|
28
|
+
export function h5WePublicLogin(_x3, _x4) {
|
29
|
+
return _h5WePublicLogin.apply(this, arguments);
|
30
|
+
}
|
31
|
+
function _h5WePublicLogin() {
|
32
|
+
_h5WePublicLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, options) {
|
33
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
34
|
+
while (1) switch (_context2.prev = _context2.next) {
|
35
|
+
case 0:
|
36
|
+
return _context2.abrupt("return", request("wechat/h5WePublicLogin", _objectSpread({
|
37
|
+
method: 'POST',
|
38
|
+
headers: {
|
39
|
+
'Content-Type': 'application/json'
|
40
|
+
},
|
41
|
+
data: body
|
42
|
+
}, options || {})));
|
43
|
+
case 1:
|
44
|
+
case "end":
|
45
|
+
return _context2.stop();
|
46
|
+
}
|
47
|
+
}, _callee2);
|
48
|
+
}));
|
49
|
+
return _h5WePublicLogin.apply(this, arguments);
|
50
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
declare namespace Wechat {
|
2
|
+
interface Share {
|
3
|
+
appId: string;
|
4
|
+
timestamp: string;
|
5
|
+
nonceStr: string;
|
6
|
+
signature: string;
|
7
|
+
}
|
8
|
+
interface H5WePublicLogin {
|
9
|
+
redirectUrl: string;
|
10
|
+
}
|
11
|
+
interface WeJsConfig {
|
12
|
+
debug: boolean;
|
13
|
+
jsApiList: string[];
|
14
|
+
appId: string;
|
15
|
+
nonceStr: string;
|
16
|
+
signature: string;
|
17
|
+
timestamp: number;
|
18
|
+
}
|
19
|
+
}
|
File without changes
|