You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Account__Binding__index....

319 lines
13 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[89076],{
/***/ 84494:
/*!*********************************************************!*\
!*** ./src/pages/Account/Binding/index.tsx + 3 modules ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ Account_Binding; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(10574);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(39343);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(11006);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(27161);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 8 modules
var _umi_production_exports = __webpack_require__(7181);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
;// CONCATENATED MODULE: ./src/pages/Account/Binding/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var Bindingmodules = ({"wrap":"wrap___xodza","content":"content___ICbbC","hint":"hint___MLn02","titleWrap":"titleWrap___Q3Ucy","title":"title___nN0C7","bind":"bind___xQW3D","flexRow":"flexRow___pyjLx","wechatLogo":"wechatLogo___MOBmR","qqLogo":"qqLogo___JZOYi","action":"action___V1O9k","modal":"modal___q6F2P"});
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
;// CONCATENATED MODULE: ./src/pages/Account/Binding/components/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var componentsmodules = ({"wrap":"wrap___yM1g7","iframe":"iframe___rOQlC"});
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(26078);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Account/Binding/components/WechatModal.tsx
var WechatModal = function WechatModal(_ref) {
var visible = _ref.visible,
_ref$onClose = _ref.onClose,
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose;
return /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
centered: true,
keyboard: false,
closable: false,
destroyOnClose: true,
className: componentsmodules.modal,
open: visible,
title: null,
width: "530px",
footer: null,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: componentsmodules.wrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
className: componentsmodules.iframe,
frameBorder: "0",
sandbox: "allow-scripts allow-same-origin allow-top-navigation",
scrolling: "no",
src: "https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=".concat(env/* default */.Z.QQLoginCB, "%2fotherloginstart&response_type=code&scope=snsapi_login&state=account,").concat(window.location.host, "#wechat_redirect")
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "clearfix pagemancenter",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "link",
onClick: onClose,
children: "\u53D6\u6D88"
})
})]
})
});
};
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(87885);
;// CONCATENATED MODULE: ./src/pages/Account/Binding/index.tsx
var _excluded = ["user", "account", "globalSetting", "loading", "dispatch"];
var DataType = /*#__PURE__*/function (DataType) {
DataType["Wechat"] = "wechat";
DataType["QQ"] = "qq";
return DataType;
}(DataType || {});
var Binding = function Binding(_ref) {
var user = _ref.user,
account = _ref.account,
globalSetting = _ref.globalSetting,
loading = _ref.loading,
dispatch = _ref.dispatch,
props = objectWithoutProperties_default()(_ref, _excluded);
var _useState = (0,_react_17_0_2_react.useState)({}),
_useState2 = slicedToArray_default()(_useState, 2),
wechatData = _useState2[0],
setWechatData = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)({}),
_useState4 = slicedToArray_default()(_useState3, 2),
qqData = _useState4[0],
setqqData = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(),
_useState6 = slicedToArray_default()(_useState5, 2),
visibleWechat = _useState6[0],
setVisibleWechat = _useState6[1];
(0,_react_17_0_2_react.useEffect)(function () {
var _account$basicInfo, _account$basicInfo2;
var wechat = ((_account$basicInfo = account.basicInfo) === null || _account$basicInfo === void 0 ? void 0 : _account$basicInfo.open_users.find(function (item) {
return item.en_type === DataType.Wechat;
})) || {};
setWechatData(wechat);
var qq = ((_account$basicInfo2 = account.basicInfo) === null || _account$basicInfo2 === void 0 ? void 0 : _account$basicInfo2.open_users.find(function (item) {
return item.en_type === DataType.QQ;
})) || {};
setqqData(qq);
}, [account.basicInfo]);
var handleWechat = function handleWechat() {
// 解绑
if (wechatData.id) {
modal/* default */.Z.confirm({
centered: true,
okText: '确定',
cancelText: '取消',
title: '提示',
content: '是否确定解绑微信账号?',
className: Bindingmodules.modal,
onOk: function () {
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _account$basicInfo3;
var res, _user$userInfo;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return dispatch({
type: "account/unbindAccount",
payload: {
basicInfoId: (_account$basicInfo3 = account.basicInfo) === null || _account$basicInfo3 === void 0 ? void 0 : _account$basicInfo3.id,
id: wechatData.id
}
});
case 2:
res = _context.sent;
if (res) {
message/* default */.ZP.info('解绑成功!');
dispatch({
type: 'account/getBasicInfo',
payload: {
login: (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login
}
});
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
return;
}
setVisibleWechat(true);
};
var handleQQ = function handleQQ() {
// 解绑
if (qqData.id) {
modal/* default */.Z.confirm({
centered: true,
okText: '确定',
cancelText: '取消',
title: '提示',
content: '是否确定解绑QQ账号',
className: Bindingmodules.modal,
onOk: function () {
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var _account$basicInfo4;
var res, _user$userInfo2;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return dispatch({
type: "account/unbindAccount",
payload: {
basicInfoId: (_account$basicInfo4 = account.basicInfo) === null || _account$basicInfo4 === void 0 ? void 0 : _account$basicInfo4.id,
id: qqData.id
}
});
case 2:
res = _context2.sent;
if (res) {
message/* default */.ZP.info('解绑成功!');
dispatch({
type: 'account/getBasicInfo',
payload: {
login: (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.login
}
});
}
case 4:
case "end":
return _context2.stop();
}
}, _callee2);
}));
function onOk() {
return _onOk2.apply(this, arguments);
}
return onOk;
}()
});
return;
}
handleBindQQ();
};
var handleBindQQ = function handleBindQQ() {
var phoneDeviceList = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var userAgent = navigator.userAgent;
var isPhone = phoneDeviceList.some(function (item) {
return userAgent.includes(item);
});
if (isPhone) {
(0,util/* openNewWindow */.xg)("https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=".concat(env/* default */.Z.QQLoginCB, "%2fotherloginqq&state=account,").concat(window.location.host, "&response_type=code"));
} else {
window.location.href = "https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=".concat(env/* default */.Z.QQLoginCB, "%2fotherloginqq&state=account,").concat(window.location.host, "&response_type=code");
}
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: Bindingmodules.wrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Bindingmodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(Bindingmodules.titleWrap, " mt10"),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: Bindingmodules.title,
children: "\u7ED1\u5B9A\u767B\u5F55\u8D26\u53F7"
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Bindingmodules.bind,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Bindingmodules.flexRow,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-weixin2 mr10 ".concat(Bindingmodules.wechatLogo)
}), "\u5FAE\u4FE1"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(Bindingmodules.action, " current"),
onClick: handleWechat,
children: wechatData.id ? '解绑' : '绑定'
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Bindingmodules.bind,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: Bindingmodules.flexRow,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-QQ mr10 ".concat(Bindingmodules.qqLogo)
}), "QQ"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(Bindingmodules.action, " current"),
onClick: handleQQ,
children: qqData.id ? '解绑' : '绑定'
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(Bindingmodules.hint, " font14"),
children: "* \u6211\u4EEC\u786E\u4FDD\u4F60\u6240\u63D0\u4F9B\u7684\u4FE1\u606F\u5747\u5904\u4E8E\u4E25\u683C\u4FDD\u5BC6\u72B6\u6001\uFF0C\u4E0D\u4F1A\u6CC4\u9732"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(WechatModal, {
visible: visibleWechat,
onClose: function onClose() {
return setVisibleWechat(false);
}
})]
});
};
/* harmony default export */ var Account_Binding = ((0,_umi_production_exports.connect)(function (_ref2) {
var user = _ref2.user,
account = _ref2.account,
loading = _ref2.loading,
globalSetting = _ref2.globalSetting;
return {
user: user,
account: account,
globalSetting: globalSetting,
loading: loading.models.index
};
})(Binding));
/***/ })
}]);