1 line
20 KiB
JavaScript
1 line
20 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[88],{"+hnl":function(e,t,n){},MKzF:function(e,t,n){"use strict";n.r(t);n("SchZ"),n("+hnl")},e6dI:function(e,t,n){},kaz8:function(e,t,n){"use strict";n.r(t);var r=n("q1tI"),a=n("17x9"),o=n("VCL8"),c=n("TSYQ"),l=n.n(c),i=n("x1Ya"),u=n("Gytx"),s=n.n(u),f=n("H84U"),d=n("6CfX");function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=O(e);if(t){var a=O(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return k(this,n)}}function k(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?E(e):t}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var x=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(c,e);var t,n,a,o=g(c);function c(){var e;return h(this,c),(e=o.apply(this,arguments)).saveCheckbox=function(t){e.rcCheckbox=t},e.renderCheckbox=function(t){var n,a=t.getPrefixCls,o=E(e),c=o.props,u=o.context,s=c.prefixCls,f=c.className,d=c.children,p=c.indeterminate,h=c.style,v=c.onMouseEnter,b=c.onMouseLeave,g=x(c,["prefixCls","className","children","indeterminate","style","onMouseEnter","onMouseLeave"]),k=u.checkboxGroup,O=a("checkbox",s),C=y({},g);k&&(C.onChange=function(){g.onChange&&g.onChange.apply(g,arguments),k.toggleOption({label:d,value:c.value})},C.name=k.name,C.checked=-1!==k.value.indexOf(c.value),C.disabled=c.disabled||k.disabled);var S=l()(f,(m(n={},"".concat(O,"-wrapper"),!0),m(n,"".concat(O,"-wrapper-checked"),C.checked),m(n,"".concat(O,"-wrapper-disabled"),C.disabled),n)),N=l()(m({},"".concat(O,"-indeterminate"),p));return r.createElement("label",{className:S,style:h,onMouseEnter:v,onMouseLeave:b},r.createElement(i.a,y({},C,{prefixCls:O,className:N,ref:e.saveCheckbox})),void 0!==d&&r.createElement("span",null,d))},e}return t=c,(n=[{key:"componentDidMount",value:function(){var e=this.props.value,t=(this.context||{}).checkboxGroup,n=void 0===t?{}:t;n.registerValue&&n.registerValue(e),Object(d.a)("checked"in this.props||(this.context||{}).checkboxGroup||!("value"in this.props),"Checkbox","`value` is not validate prop, do you mean `checked`?")}},{key:"shouldComponentUpdate",value:function(e,t,n){return!s()(this.props,e)||!s()(this.state,t)||!s()(this.context.checkboxGroup,n.checkboxGroup)}},{key:"componentDidUpdate",value:function(e){var t=e.value,n=this.props.value,r=(this.context||{}).checkboxGroup,a=void 0===r?{}:r;n!==t&&a.registerValue&&a.cancelValue&&(a.cancelValue(t),a.registerValue(n))}},{key:"componentWillUnmount",value:function(){var e=this.props.value,t=(this.context||{}).checkboxGroup,n=void 0===t?{}:t;n.cancelValue&&n.cancelValue(e)}},{key:"focus",value:function(){this.rcCheckbox.focus()}},{key:"blur",value:function(){this.rcCheckbox.blur()}},{key:"render",value:function(){return r.createElement(f.a,null,this.renderCheckbox)}}])&&v(t.prototype,n),a&&v(t,a),c}(r.Component);C.__ANT_CHECKBOX=!0,C.defaultProps={indeterminate:!1},C.contextTypes={checkboxGroup:a.any},Object(o.polyfill)(C);var S=C,N=n("BGR+");function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(){return(j=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function w(e){return function(e){if(Array.isArray(e))return P(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=G(e);if(t){var a=G(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return M(this,n)}}function M(e,t){return!t||"object"!==_(t)&&"function"!=typeof t?A(e):t}function A(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var R=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&V(e,t)}(c,e);var t,n,a,o=I(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=o.call(this,e)).cancelValue=function(e){t.setState((function(t){return{registeredValues:t.registeredValues.filter((function(t){return t!==e}))}}))},t.registerValue=function(e){t.setState((function(t){var n=t.registeredValues;return{registeredValues:[].concat(w(n),[e])}}))},t.toggleOption=function(e){var n=t.state.registeredValues,r=t.state.value.indexOf(e.value),a=w(t.state.value);-1===r?a.push(e.value):a.splice(r,1),"value"in t.props||t.setState({value:a});var o=t.props.onChange;if(o){var c=t.getOptions();o(a.filter((function(e){return-1!==n.indexOf(e)})).sort((function(e,t){return c.findIndex((function(t){return t.value===e}))-c.findIndex((function(e){return e.value===t}))})))}},t.renderGroup=function(e){var n=e.getPrefixCls,a=A(t),o=a.props,c=a.state,i=o.prefixCls,u=o.className,s=o.style,f=o.options,d=R(o,["prefixCls","className","style","options"]),p=n("checkbox",i),m="".concat(p,"-group"),y=Object(N.default)(d,["children","defaultValue","value","onChange","disabled"]),h=o.children;f&&f.length>0&&(h=t.getOptions().map((function(e){return r.createElement(S,{prefixCls:p,key:e.value.toString(),disabled:"disabled"in e?e.disabled:o.disabled,value:e.value,checked:-1!==c.value.indexOf(e.value),onChange:e.onChange,className:"".concat(m,"-item")},e.label)})));var v=l()(m,u);return r.createElement("div",j({className:v,style:s},y),h)},t.state={value:e.value||e.defaultValue||[],registeredValues:[]},t}return t=c,a=[{key:"getDerivedStateFromProps",value:function(e){return"value"in e?{value:e.value||[]}:null}}],(n=[{key:"getChildContext",value:function(){return{checkboxGroup:{toggleOption:this.toggleOption,value:this.state.value,disabled:this.props.disabled,name:this.props.name,registerValue:this.registerValue,cancelValue:this.cancelValue}}}},{key:"shouldComponentUpdate",value:function(e,t){return!s()(this.props,e)||!s()(this.state,t)}},{key:"getOptions",value:function(){return this.props.options.map((function(e){return"string"==typeof e?{label:e,value:e}:e}))}},{key:"render",value:function(){return r.createElement(f.a,null,this.renderGroup)}}])&&T(t.prototype,n),a&&T(t,a),c}(r.Component);B.defaultProps={options:[]},B.propTypes={defaultValue:a.array,value:a.array,options:a.array.isRequired,onChange:a.func},B.childContextTypes={checkboxGroup:a.any},Object(o.polyfill)(B);var D=B;S.Group=D;t.default=S},mz8h:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n("kLXV")),a=s(n("2/Rp")),o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,a=!1,o=void 0;try{for(var c,l=e[Symbol.iterator]();!(r=(c=l.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=function(e){f(c({},e,{type:"delete"}))},t.Confirm=function(e){f(c({},e,{type:"confirm"}))},n("k3Gp"),n("L/Qf");var l=n("q1tI"),i=s(l),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n("i8i4"));function s(e){return e&&e.__esModule?e:{default:e}}function f(e){var t=e.type,n=e.afterClose,r=document.createElement("div");function a(){n&&n(),u.unmountComponentAtNode(r)&&r.parentNode&&r.parentNode.removeChild(r)}document.body.appendChild(r),setTimeout((function(){u.render(function(t){return"delete"===t?i.default.createElement(d,c({title:"删除",contentTitle:"确定要删除吗?",okText:"确认删除"},e,{afterClose:a,contentTitle:i.default.createElement(i.default.Fragment,null,i.default.createElement("i",{className:"red-circle iconfont icon-shanchu_tc_icon mr3"}),e.contentTitle)})):i.default.createElement(d,c({title:"选择",afterClose:a},e))}(t),r)}))}function d(e){var t=e.onCancel,n=e.onOk,c=e.title,u=e.contentTitle,s=e.content,f=e.okText,d=e.cancelText,p=e.afterClose,m=e.className,y=(0,l.useState)(!0),h=o(y,2),v=h[0],b=h[1];function g(){b(!1),t&&t()}return i.default.createElement(r.default,{visible:v,onCancel:g,afterClose:p,title:c,className:"myself-modal "+m,centered:!0,footer:[i.default.createElement(a.default,{type:"default",key:"back",onClick:g},d),i.default.createElement(a.default,{className:"foot-submit",key:"submit",onClick:function(){b(!1),n&&n()}},f)]},i.default.createElement("div",null,u&&i.default.createElement("p",{className:"content-title"},u),i.default.createElement("p",{className:"content-descibe"},s)))}n("e6dI"),d.defaultProps={okText:"确认",cancelText:"取消",className:"",inputId:"copyText",onCancel:function(){},onOk:function(){},title:"提示",contentTitle:"",content:"",afterClose:function(){}}},yQCu:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=y(n("NUBc")),a=y(n("kaz8")),o=y(n("BvKs")),c=y(n("KrTs")),l=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,a=!1,o=void 0;try{for(var c,l=e[Symbol.iterator]();!(r=(c=l.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};n("YQTV"),n("MKzF"),n("2WkQ"),n("JvnM");var i=n("q1tI"),u=y(i),s=y(n("vDqi")),f=y(n("mz8h")),d=y(n("2CTR")),p=n("FCV+");n("69Ao"),n("j4F2");var m=n("sYIF");function y(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){var t=e.current_user,n=e.resetUserInfo,y=e.location,h=e.mygetHelmetapi,v=e.history,b=y&&y.query&&y.query.noticeType,g=(0,i.useState)("atme"===b?"2":"0"),k=l(g,2),E=k[0],O=k[1],x=(0,i.useState)(0),C=l(x,2),S=C[0],N=C[1],_=(0,i.useState)(!1),j=l(_,2),w=j[0],P=j[1],T=(0,i.useState)(!1),V=l(T,2),I=V[0],M=V[1],A=(0,i.useState)(void 0),G=l(A,2),R=G[0],B=G[1],D=(0,i.useState)(),F=l(D,2),U=F[0],z=F[1],L=(0,i.useState)(),q=l(L,2),H=q[0],K=q[1],Q=(0,i.useState)([]),Y=l(Q,2),J=Y[0],X=Y[1],W=(0,i.useState)(),Z=l(W,2),$=Z[0],ee=Z[1],te=(0,i.useState)(1),ne=l(te,2),re=ne[0],ae=ne[1],oe=(0,i.useState)(),ce=l(oe,2),le=ce[0],ie=ce[1];function ue(){var e={type:"0"===E?"notification":"2"===E?"atme":"",status:le||"",limit:15,page:re};t&&s.default.get("/users/"+t.login+"/messages.json",{params:e}).then((function(e){e&&e.data&&(z(e.data.unread_notification),K(e.data.unread_atme),X(e.data.messages),ee(e.data.total_count),B(e.data.type))}))}function se(e){if(e&&t){var n={type:"0"===E?"notification":"2"===E?"atme":"",ids:e};s.default.post("/users/"+t.login+"/messages/read.json",n).then((function(e){if(200===e.status){ue();var t=Math.ceil(($-1)/15);ae(re>=t?t:re)}}))}}function fe(e){var t=0,n=J.slice();n.map((function(n){n.id===e.target.value&&(n.checkedBatch=e.target.checked),n.checkedBatch&&t++})),X(n),N(t),M(t===J.length)}function de(e){var n=[];e||J.map((function(e){e.checkedBatch&&n.push(e.id)})),(0,f.default)({title:"1"===E?"删除私信用户":e?"删除消息":"批量删除",contentTitle:"1"===E?"您确定要删除与 xxx 的聊天吗?":e?"您确定要删除这条@我消息吗?":"您确定要删除选中的"+S+"条消息吗?",content:"1"===E?"此操作将删除与xxx的聊天框和xxx的所有聊天记录,请进行确认以防数据的丢失":e?"此操作将删除这条消息,请进行确认以防数据的丢失":"此操作将删除选中的"+S+"条消息,请进行确认以防数据的丢失",onOk:function(){var r={type:"0"===E?"notification":"2"===E?"atme":"",ids:e||n};s.default.delete("/users/"+t.login+"/messages.json",{data:r}).then((function(e){if(200===e.status){ue();var t=Math.ceil(($-1)/15);ae(re>=t?t:re),N(0),M(!1)}}))}})}function pe(e){e.notification_url&&(window.open(""+e.notification_url),se([e.id]))}return(0,i.useEffect)((function(){var e=h&&h.common&&h.common.notice;t&&t.login?e||v.push("/settings/profile"):v.push("/explore")}),[h]),(0,i.useEffect)((function(){O("atme"===b?"2":"0")}),[b]),(0,i.useEffect)((function(){n()}),[U,H]),(0,i.useEffect)((function(){ue()}),[E,le,re,t]),u.default.createElement("div",{className:"notice01"},u.default.createElement("div",{className:"sshHead"},u.default.createElement(o.default,{mode:"horizontal",selectedKeys:E,onClick:function(e){O(e.key),ae(1),ie(),"2"!=e.key&&P(!1)}},u.default.createElement(o.default.Item,{key:"0"},u.default.createElement(c.default,{count:U,title:""},"系统通知")),u.default.createElement(o.default.Item,{key:"2"},u.default.createElement(c.default,{count:H},"@我"))),"0"===E&&U>0||"2"===E&&H>0?u.default.createElement("button",{className:"but25",onClick:function(){se([-1])}},"所有","0"===E?"系统通知":"1"===E?"私信":"@我","一键已读"):""),u.default.createElement("div",{className:w?"invisible ":"visible"},u.default.createElement("div",{className:"vertical-center-style"},1===le||J&&J.length>0?u.default.createElement(a.default,{checked:le,onChange:function(e){return e.target.checked?ie(1):ie()}},"仅看未读","1"===E?"私信(12)":"0"===E?"消息("+U+")":"消息("+H+")"):""),"2"===E&&J&&J.length>0?u.default.createElement("button",{className:"batchDeleteBut",onClick:function(){P(!0)}},"批量删除"):""),J&&0===J.length?u.default.createElement(d.default,{_html:"暂无相关消息"}):"",J&&J.length>0&&u.default.createElement("div",{className:w?"visible":"invisible"},u.default.createElement("div",{className:"vertical-center-style"},u.default.createElement(a.default,{onChange:function(e){M(e.target.checked),N(e.target.checked?J.length:0);var t=J.slice();t.map((function(t){t.checkedBatch=e.target.checked})),X(t)},checked:I},"全选")," 已选择 ",u.default.createElement("span",{className:"numberSpan"},S)," 项"),u.default.createElement("div",null,u.default.createElement("button",{onClick:function(){P(!1),N(0);var e=J.slice();e.map((function(e){e.checkedBatch=!1})),X(e),M(!1)}},"取消")," ",u.default.createElement("button",{className:"deleteBut",onClick:S>0?function(){return de()}:function(){}},"删除"))),"notification"===R&&J&&J.map((function(e){return u.default.createElement("div",{className:"mynotice-content vertical-center-style",key:e.id},u.default.createElement("div",{className:"mynotice-cont stretch-style"},1===e.status?u.default.createElement(c.default,{color:"#FA2020"}):u.default.createElement("span",{className:"system-notice-blank"}),u.default.createElement("i",{className:"iconfont "+p.noticeSourceType[e.source]}),u.default.createElement("span",{className:"sysNotice-length "+(e.notification_url?"highlightSpan":""),onClick:function(){pe(e)},dangerouslySetInnerHTML:{__html:e.content}})),u.default.createElement("div",{className:"mynotice-cont vertical-center-style float-left-little"},u.default.createElement("span",{className:1===e.status?"timeSpan":""},e.time_ago),1===e.status&&u.default.createElement("span",{className:"invisable-read",onClick:function(){return se([e.id])}},"标记为已读")))})),"atme"===R&&J&&J.map((function(e){return u.default.createElement("div",{className:"mynotice-content vertical-center-style "+(w?"batchDel":""),key:e.id},u.default.createElement("div",{className:"mynotice-cont vertical-center-style"},u.default.createElement(a.default,{value:e.id,className:w?"visible-checkbox":"invisible-checkbox",onChange:fe,checked:e.checkedBatch}),e.sender&&u.default.createElement("img",{alt:"",src:(0,m.getImageUrl)("/"+e.sender.image_url),className:"currentImg",onClick:function(){window.open("/"+(e.sender&&e.sender.login))}}),u.default.createElement("div",{className:"atme-notice-text stretch-style "+(e.notification_url&&"highlightSpan"),onClick:function(){pe(e)}},1===e.status?u.default.createElement(c.default,{color:"#FA2020"}):u.default.createElement("span",{className:"system-notice-blank"}),e.sender&&u.default.createElement("span",{className:"atme-length",dangerouslySetInnerHTML:{__html:e.content}}))),u.default.createElement("div",{className:"mynotice-cont vertical-center-style"},u.default.createElement("span",{className:w||1!==e.status?"":"timeSpan"},e.time_ago),!w&&1===e.status&&u.default.createElement("span",{className:"invisable-read",onClick:function(){return se([e.id])}},"标记为已读")," ",!w&&u.default.createElement("span",{className:"invisable-read float-left-little",onClick:function(){return de([e.id])}},"删除")))})),!1,!w&&u.default.createElement("div",{className:"paging"},u.default.createElement(r.default,{simple:!0,current:re,pageSize:15,onChange:function(e){ae(e)},total:$,hideOnSinglePage:!0})))}}}]); |