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.
404 lines
18 KiB
404 lines
18 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[547],{
|
|
|
|
/***/ 80032:
|
|
/*!*************************************************!*\
|
|
!*** ./src/pages/Account/index.tsx + 5 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; }
|
|
});
|
|
|
|
// 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 + 15 modules
|
|
var _umi_production_exports = __webpack_require__(67866);
|
|
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
|
|
var env = __webpack_require__(21873);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
|
|
var message = __webpack_require__(8591);
|
|
// 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/spin/index.js + 1 modules
|
|
var spin = __webpack_require__(71418);
|
|
// EXTERNAL MODULE: ./node_modules/_react-cropper@1.3.0@react-cropper/dist/react-cropper.js
|
|
var react_cropper = __webpack_require__(33555);
|
|
;// CONCATENATED MODULE: ./src/pages/Account/components/UpdateAvatarModal/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var UpdateAvatarModalmodules = ({"modal":"modal___UiRZE","avatarWrap":"avatarWrap___ult2g","tip":"tip___VD4sc","previewWrap":"previewWrap___DqV9j","previewImg":"previewImg___hrFoK","uploadButton":"uploadButton___RgVQG"});
|
|
// EXTERNAL MODULE: ./node_modules/_cropperjs@1.6.2@cropperjs/dist/cropper.css
|
|
var cropper = __webpack_require__(11271);
|
|
;// CONCATENATED MODULE: ./src/pages/Account/components/UpdateAvatarModal/index.tsx
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const UpdateAvatarModal = ({
|
|
user,
|
|
account,
|
|
globalSetting,
|
|
loading,
|
|
dispatch,
|
|
visible,
|
|
onClose
|
|
}) => {
|
|
const [avatarImg, setAvatarImg] = (0,_react_17_0_2_react.useState)();
|
|
const cropper = (0,_react_17_0_2_react.useRef)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a;
|
|
if (visible) {
|
|
setAvatarImg(`${env/* default */.Z.IMG_SERVER}/images/${(_a = user.userInfo) == null ? void 0 : _a.image_url}`);
|
|
}
|
|
}, [user.userInfo, visible]);
|
|
const onChange = (e) => {
|
|
let files;
|
|
if (e.dataTransfer) {
|
|
files = e.dataTransfer.files;
|
|
} else if (e.target) {
|
|
files = e.target.files;
|
|
}
|
|
if (!(files == null ? void 0 : files.length)) {
|
|
return;
|
|
}
|
|
const file = files[0];
|
|
if (!/^image\/\w+/.test(file.type)) {
|
|
message/* default */.ZP.info("\u8BF7\u9009\u62E9\u4E00\u4E2A\u56FE\u7247\u683C\u5F0F\u7684\u6587\u4EF6");
|
|
return;
|
|
}
|
|
if (file.size > 10 * 1024 * 1024) {
|
|
message/* default */.ZP.info("\u4EC5\u652F\u6301\u6587\u4EF6\u5927\u5C0F\u5C0F\u4E8E10M\u7684\u6587\u4EF6");
|
|
return;
|
|
}
|
|
const reader = new FileReader();
|
|
reader.onload = () => {
|
|
setAvatarImg(reader.result);
|
|
};
|
|
reader.readAsDataURL(files[0]);
|
|
};
|
|
const handleOk = () => __async(void 0, null, function* () {
|
|
var _a;
|
|
const dataUrl = cropper.current.getCroppedCanvas().toDataURL("image/jpeg");
|
|
if (!dataUrl) {
|
|
message/* default */.ZP.info("\u8BF7\u5148\u4E0A\u4F20\u56FE\u7247");
|
|
}
|
|
const res = yield dispatch({
|
|
type: "account/updateAvatar",
|
|
payload: { image: dataUrl, login: (_a = user.userInfo) == null ? void 0 : _a.login }
|
|
});
|
|
handlerCancel();
|
|
if (res.status === 0) {
|
|
message/* default */.ZP.info("\u4FEE\u6539\u5934\u50CF\u6210\u529F");
|
|
dispatch({
|
|
type: "user/getUserInfo"
|
|
});
|
|
}
|
|
});
|
|
const handlerCancel = () => {
|
|
onClose();
|
|
};
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
modal["default"],
|
|
{
|
|
centered: true,
|
|
keyboard: false,
|
|
closable: false,
|
|
open: visible,
|
|
title: "\u4E0A\u4F20\u5934\u50CF",
|
|
width: 550,
|
|
forceRender: true,
|
|
confirmLoading: loading["account/updateAvatar"],
|
|
onOk: handleOk,
|
|
onCancel: handlerCancel
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement(spin/* default */.Z, { spinning: !!loading["account/updateAvatar"] }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: UpdateAvatarModalmodules.modal }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: UpdateAvatarModalmodules.avatarWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
react_cropper/* default */.Z,
|
|
{
|
|
style: { height: 320, width: 320 },
|
|
ref: cropper,
|
|
src: avatarImg,
|
|
guides: false,
|
|
aspectRatio: 1,
|
|
preview: "#updateAvatarImg"
|
|
}
|
|
)), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: UpdateAvatarModalmodules.tip }, "\u4EC5\u652F\u6301JPG\u3001GIF\u3001PNG\uFF0C\u4E14\u6587\u4EF6\u5C0F\u4E8E10M")), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: UpdateAvatarModalmodules.previewWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: UpdateAvatarModalmodules.previewImg, id: "updateAvatarImg" }), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: `${UpdateAvatarModalmodules.tip} tc` }, "\u5934\u50CF\u9884\u89C8")), /* @__PURE__ */ _react_17_0_2_react.createElement("label", { className: UpdateAvatarModalmodules.uploadButton, id: "uploadBtn", htmlFor: "inputImage" }, /* @__PURE__ */ _react_17_0_2_react.createElement("input", { type: "file", className: "sr-only", id: "inputImage", name: "file", accept: "image/*", style: { display: "none" }, onChange }), "\u70B9\u51FB\u4E0A\u4F20"))))
|
|
);
|
|
};
|
|
/* harmony default export */ var components_UpdateAvatarModal = ((0,_umi_production_exports.connect)(
|
|
({
|
|
user,
|
|
account,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
user,
|
|
account,
|
|
globalSetting,
|
|
loading: loading.effects
|
|
})
|
|
)(UpdateAvatarModal));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Account/components/Sidebar/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Sidebarmodules = ({"wrap":"wrap___jmmMV","avatarWrap":"avatarWrap___rSWxp","avatar":"avatar___fcL4a","updateAvatarWrap":"updateAvatarWrap___PvFWZ","img":"img___HYjbH","updateAvatar":"updateAvatar___A4WCJ","name":"name___I27vY","role":"role___S1bgR","title":"title___lYk_h","colorGary":"colorGary___dTxWU","colorGreen":"colorGreen___IMA6y","colorRed":"colorRed___I0jPR","item":"item___daAx6","active":"active___ZGd1H"});
|
|
;// CONCATENATED MODULE: ./src/pages/Account/components/Sidebar/index.tsx
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var NavType = /* @__PURE__ */ ((NavType2) => {
|
|
NavType2["Profile"] = "profile";
|
|
NavType2["Certification"] = "certification";
|
|
NavType2["Secure"] = "secure";
|
|
NavType2["Group"] = "teach-group";
|
|
NavType2["Binding"] = "binding";
|
|
NavType2["Results"] = "Results";
|
|
return NavType2;
|
|
})(NavType || {});
|
|
const Sidebar = (_a) => {
|
|
var _b = _a, {
|
|
user,
|
|
account,
|
|
globalSetting,
|
|
loading,
|
|
dispatch
|
|
} = _b, props = __objRest(_b, [
|
|
"user",
|
|
"account",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch"
|
|
]);
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
const [activeKey, setActiveKey] = (0,_react_17_0_2_react.useState)();
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a3;
|
|
const active = (_a3 = location.pathname.split("/")) == null ? void 0 : _a3[2];
|
|
setActiveKey(active);
|
|
}, [location.pathname]);
|
|
const avatarImg = `${env/* default */.Z.IMG_SERVER}/images/${(_a2 = user.userInfo) == null ? void 0 : _a2.image_url}`;
|
|
return /* @__PURE__ */ _react_17_0_2_react.createElement("section", { className: Sidebarmodules.wrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Sidebarmodules.avatarWrap }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Sidebarmodules.avatar }, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Sidebarmodules.updateAvatarWrap, onClick: () => {
|
|
dispatch({
|
|
type: "account/setActionTabs",
|
|
payload: { key: "Account-UpdateAvatar" }
|
|
});
|
|
} }, /* @__PURE__ */ _react_17_0_2_react.createElement("img", { className: Sidebarmodules.img, src: avatarImg }), /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Sidebarmodules.updateAvatar }, "\u4FEE\u6539\u5934\u50CF"))), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: Sidebarmodules.name, title: (_b2 = user.userInfo) == null ? void 0 : _b2.username }, ((_d = (_c = user.userInfo) == null ? void 0 : _c.username) == null ? void 0 : _d.length) > 6 ? ((_f = (_e = user.userInfo) == null ? void 0 : _e.username) == null ? void 0 : _f.substr(0, 6)) + "..." : (_g = user.userInfo) == null ? void 0 : _g.username), /* @__PURE__ */ _react_17_0_2_react.createElement("span", { className: Sidebarmodules.role }, (_h = user.userInfo) == null ? void 0 : _h.user_identity)), /* @__PURE__ */ _react_17_0_2_react.createElement("div", null, /* @__PURE__ */ _react_17_0_2_react.createElement("div", { className: Sidebarmodules.title }, "\u8D26\u53F7\u7BA1\u7406"), /* @__PURE__ */ _react_17_0_2_react.createElement("ul", { className: "pl0" }, /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"li",
|
|
{
|
|
className: `${Sidebarmodules.item} ${activeKey === "profile" /* Profile */ ? Sidebarmodules.active : ""}`,
|
|
onClick: () => _umi_production_exports.history.push(`/account/${"profile" /* Profile */}`)
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-jibenxinxi font16 mr5 ${Sidebarmodules.colorGary}` }), "\u57FA\u672C\u4FE1\u606F"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont font16 mr25 ${((_i = account.basicInfo) == null ? void 0 : _i.base_info_completed) ? `${Sidebarmodules.colorGreen} icon-wancheng` : `${Sidebarmodules.colorRed} icon-tishi`}` })
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"li",
|
|
{
|
|
className: `${Sidebarmodules.item} ${activeKey === "certification" /* Certification */ ? Sidebarmodules.active : ""}`,
|
|
onClick: () => _umi_production_exports.history.push(`/account/${"certification" /* Certification */}`)
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-renzhengxinxi font16 mr5 ${Sidebarmodules.colorGary}` }), "\u8BA4\u8BC1\u4FE1\u606F"),
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont font16 mr25 ${((_j = account.basicInfo) == null ? void 0 : _j.professional_certification) === "certified" && ((_k = account.basicInfo) == null ? void 0 : _k.authentication) === "certified" ? `${Sidebarmodules.colorGreen} icon-wancheng` : `${Sidebarmodules.colorRed} icon-tishi`}` })
|
|
), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"li",
|
|
{
|
|
className: `${Sidebarmodules.item} ${activeKey === "secure" /* Secure */ ? Sidebarmodules.active : ""}`,
|
|
onClick: () => _umi_production_exports.history.push(`/account/${"secure" /* Secure */}`)
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-anquanshezhi font16 mr5 ${Sidebarmodules.colorGary}` }), "\u5B89\u5168\u8BBE\u7F6E")
|
|
), !((_l = globalSetting == null ? void 0 : globalSetting.setting) == null ? void 0 : _l.is_local) && /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
"li",
|
|
{
|
|
className: `${Sidebarmodules.item} ${activeKey === "binding" /* Binding */ ? Sidebarmodules.active : ""}`,
|
|
onClick: () => _umi_production_exports.history.push(`/account/${"binding" /* Binding */}`)
|
|
},
|
|
/* @__PURE__ */ _react_17_0_2_react.createElement("span", null, /* @__PURE__ */ _react_17_0_2_react.createElement("i", { className: `iconfont icon-lianjie font16 mr5 ${Sidebarmodules.colorGary}` }), "\u7ED1\u5B9A\u767B\u5F55\u8D26\u53F7")
|
|
))), /* @__PURE__ */ _react_17_0_2_react.createElement(
|
|
components_UpdateAvatarModal,
|
|
{
|
|
visible: ((_m = account.actionTabs) == null ? void 0 : _m.key) === "Account-UpdateAvatar",
|
|
onClose: () => {
|
|
dispatch({
|
|
type: "account/setActionTabs"
|
|
});
|
|
}
|
|
}
|
|
));
|
|
};
|
|
/* harmony default export */ var components_Sidebar = ((0,_umi_production_exports.connect)(
|
|
({
|
|
user,
|
|
account,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
user,
|
|
account,
|
|
globalSetting,
|
|
loading: loading.models.index
|
|
})
|
|
)(Sidebar));
|
|
|
|
;// CONCATENATED MODULE: ./src/pages/Account/index.less?modules
|
|
// extracted by mini-css-extract-plugin
|
|
/* harmony default export */ var Accountmodules = ({"bg":"bg___lB_B_","wrap":"wrap___GGUEr"});
|
|
;// CONCATENATED MODULE: ./src/pages/Account/index.tsx
|
|
/* provided dependency */ var React = __webpack_require__(/*! react */ 59301);
|
|
var Account_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var Account_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var Account_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var Account_objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (Account_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && Account_getOwnPropSymbols)
|
|
for (var prop of Account_getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && Account_propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var Account_async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
const AccountPage = (_a) => {
|
|
var _b = _a, {
|
|
user,
|
|
account,
|
|
globalSetting,
|
|
loading,
|
|
dispatch
|
|
} = _b, props = Account_objRest(_b, [
|
|
"user",
|
|
"account",
|
|
"globalSetting",
|
|
"loading",
|
|
"dispatch"
|
|
]);
|
|
var _a2;
|
|
const location = (0,_umi_production_exports.useLocation)();
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
dispatch({
|
|
type: "globalSetting/delayTipToggle",
|
|
payload: true
|
|
});
|
|
return () => {
|
|
dispatch({
|
|
type: "globalSetting/delayTipToggle",
|
|
payload: false
|
|
});
|
|
};
|
|
}, []);
|
|
(0,_react_17_0_2_react.useEffect)(() => {
|
|
var _a3;
|
|
if (!((_a3 = user.userInfo) == null ? void 0 : _a3.login)) {
|
|
return;
|
|
}
|
|
(() => Account_async(void 0, null, function* () {
|
|
var _a4;
|
|
const res = yield dispatch({
|
|
type: "account/getBasicInfo",
|
|
payload: { login: (_a4 = user.userInfo) == null ? void 0 : _a4.login }
|
|
});
|
|
if (!(res == null ? void 0 : res.base_info_completed)) {
|
|
if (localStorage.getItem("Noviceguide") === "0") {
|
|
} else {
|
|
dispatch({
|
|
type: "shixunHomeworks/setActionTabs",
|
|
payload: {
|
|
key: "\u5E95\u90E8\u5F39\u7A97",
|
|
type: 3,
|
|
text: /* @__PURE__ */ React.createElement("div", null, "\u8BF7\u60A8\u5B8C\u5584\u4E00\u4E0B\u5E73\u53F0\u7684\u57FA\u672C\u4FE1\u606F\uFF0C\u5305\u62EC\uFF1A\u6635\u79F0\u3001\u804C\u4E1A\u3001\u5B66\u6821/\u5355\u4F4D\uFF0C \u70B9\u51FB\u4FDD\u5B58")
|
|
}
|
|
});
|
|
}
|
|
_umi_production_exports.history.push(`/account/profile/edit`);
|
|
}
|
|
}))();
|
|
}, [(_a2 = user.userInfo) == null ? void 0 : _a2.login]);
|
|
return /* @__PURE__ */ React.createElement("section", { className: Accountmodules.bg }, /* @__PURE__ */ React.createElement("div", { className: Accountmodules.wrap }, /* @__PURE__ */ React.createElement(components_Sidebar, null), /* @__PURE__ */ React.createElement(_umi_production_exports.Outlet, null)));
|
|
};
|
|
/* harmony default export */ var Account = ((0,_umi_production_exports.connect)(
|
|
({
|
|
user,
|
|
account,
|
|
loading,
|
|
globalSetting
|
|
}) => ({
|
|
user,
|
|
account,
|
|
globalSetting,
|
|
loading: loading.models.index
|
|
})
|
|
)(AccountPage));
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |