Parcourir la source

Merge branch 'master' of Hepper/comment into master

AdamFu il y a 5 ans
Parent
révision
3578176fa0

+ 1
- 0
lib/App.js Voir le fichier

@@ -797,6 +797,7 @@ App.defaultProps = {
797 797
   businessUserId: 0,
798 798
   API: "//api.links123.net/comment/v1",
799 799
   emojiAPI: "//api.links123.net/link/v1",
800
+  LOGINLINK: process.env.RUN_MOD === "production" ? "https://passport.links123.com/login" : "http://test.links123.net:5050/login",
800 801
   showList: true,
801 802
   showEditor: true,
802 803
   showAlertComment: false,

+ 1
- 1
lib/App.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 1
- 0
lib/components/CommentBox/index.js Voir le fichier

@@ -145,6 +145,7 @@ var CommentBox = function (_Component) {
145 145
             return _react2.default.createElement(_ContentItem2.default, {
146 146
               commentId: commentId,
147 147
               replyId: item.id,
148
+              user_id: item.user_id,
148 149
               key: item.id,
149 150
               content: item,
150 151
               action: "replyToReply" // 评论的回复

+ 1
- 1
lib/components/CommentBox/index.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 10
- 0
lib/components/ContentItem/AvatarHoverCard.js Voir le fichier

@@ -169,6 +169,16 @@ var AvatarHoverCard = function (_Component) {
169 169
               }
170 170
             },
171 171
             _reactIntlUniversal2.default.get("bilingually.follow", { ext: "" })
172
+          ),
173
+          _react2.default.createElement(
174
+            "div",
175
+            {
176
+              className: "privateMessageBtn " + (this.props.locale === "en-US" ? "enUs" : ""),
177
+              onClick: function onClick() {
178
+                return _this2.props.sendMessage({ id: user_id });
179
+              }
180
+            },
181
+            _reactIntlUniversal2.default.get("bilingually.im.send_msg")
172 182
           )
173 183
         )
174 184
       );

+ 1
- 1
lib/components/ContentItem/AvatarHoverCard.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 16
- 0
lib/components/ContentItem/AvatarHoverCard.less Voir le fichier

@@ -80,6 +80,22 @@
80 80
   border: 1px solid rgba(113, 193, 53, 1);
81 81
 }
82 82
 
83
+.privateMessageBtn {
84
+  width: 77px;
85
+  height: 31px;
86
+  line-height: 31px;
87
+  background: rgba(113, 193, 53, 1);
88
+  border-radius: 4px;
89
+  color: #fff;
90
+  font-size: 12px;
91
+  font-weight: 500;
92
+  text-align: center;
93
+  cursor: pointer;
94
+  margin: 0 5px;
95
+}
96
+.privateMessageBtn.enUs {
97
+  width: 90px;
98
+}
83 99
 .modalContainer {
84 100
   background: #fff;
85 101
   padding: 20px;

+ 1
- 2
lib/components/Editor/Emoji.js Voir le fichier

@@ -97,11 +97,10 @@ var Emoji = function (_React$Component) {
97 97
               return _react2.default.createElement(
98 98
                 "div",
99 99
                 { className: "item", key: item.id },
100
-                _react2.default.createElement("span", { className: "helper" }),
101 100
                 _react2.default.createElement("img", {
102 101
                   src: item.url,
103 102
                   alt: item.name,
104
-                  style: { display: "inline-block" },
103
+                  style: { display: "inline-block", width: "28px" },
105 104
                   onClick: function onClick() {
106 105
                     return _onClick(item.name);
107 106
                   }

+ 1
- 1
lib/components/Editor/Emoji.js.map Voir le fichier

@@ -1 +1 @@
1
-{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","carousel","next","prev","props","onClick","emojiList","content","i","length","push","slice","node","map","page","index","item","id","url","name","display","React","Component"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AAGA;;;;;;;;;AADA;;;AAEA;AACA;;AAEA;;IAEMA,K;;;;;;;;;;;2BACG;AACL,UAAI,KAAKC,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcC,IAAd;AACD;AACF;;;2BAEM;AACL,UAAI,KAAKD,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcE,IAAd;AACD;AACF;;;6BAEQ;AAAA;;AAAA,mBACwB,KAAKC,KAD7B;AAAA,UACCC,QADD,UACCA,OADD;AAAA,UACUC,SADV,UACUA,SADV;;AAEP,UAAMC,UAAU,EAAhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIF,UAAUG,MAA9B,EAAsCD,KAAK,EAA3C,EAA+C;AAC7CD,gBAAQG,IAAR,CAAaJ,UAAUK,KAAV,CAAgBH,CAAhB,EAAmBA,IAAI,EAAvB,CAAb;AACD;;AAED,aACE;AAAA;AAAA;AACE,eAAK,mBAAQ;AACX,mBAAKP,QAAL,GAAgBW,IAAhB;AACD;AAHH;AAKGL,gBAAQM,GAAR,CAAY,UAACC,IAAD,EAAOC,KAAP;AAAA,iBACX;AAAA;AAAA,cAAK,KAAKA,KAAV,EAAiB,WAAU,OAA3B;AACGD,iBAAKD,GAAL,CAAS,UAACG,IAAD,EAAOD,KAAP;AAAA,qBACR;AAAA;AAAA,kBAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKC,EAAhC;AACE,wDAAM,WAAU,QAAhB,GADF;AAEE;AACE,uBAAKD,KAAKE,GADZ;AAEE,uBAAKF,KAAKG,IAFZ;AAGE,yBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,2BAAS;AAAA,2BAAMf,SAAQW,KAAKG,IAAb,CAAN;AAAA;AAJX;AAFF,eADQ;AAAA,aAAT;AADH,WADW;AAAA,SAAZ;AALH,OADF;AAuBD;;;;EAvDiBE,gBAAMC,S;;kBA0DXtB,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\nimport { Carousel } from \"antd\";\n// import emoji, { prefixUrl } from \"../../emoji\";\nimport \"./Emoji.css\";\n// 每页 20  5*4\n// 共 20 * 3 = 60 (实际是 54)\n\n// class Emoji\n\nclass Emoji extends React.Component {\n  next() {\n    if (this.carousel) {\n      this.carousel.next();\n    }\n  }\n\n  prev() {\n    if (this.carousel) {\n      this.carousel.prev();\n    }\n  }\n\n  render() {\n    const { onClick, emojiList } = this.props;\n    const content = [];\n    // let curPage = [];\n    // for (let i = 0; i < 115; i++) {\n    //   if (curPage.length < 30) {\n    //     curPage.push(emoji[i]);\n    //   } else {\n    //     content.push(curPage);\n    //     curPage = [];\n    //   }\n    // }\n    // if (curPage.length > 0) {\n    //   content.push(curPage);\n    // }\n    for (let i = 0; i < emojiList.length; i += 30) {\n      content.push(emojiList.slice(i, i + 30));\n    }\n\n    return (\n      <Carousel\n        ref={node => {\n          this.carousel = node;\n        }}\n      >\n        {content.map((page, index) => (\n          <div key={index} className=\"emoji\">\n            {page.map((item, index) => (\n              <div className=\"item\" key={item.id}>\n                <span className=\"helper\" />\n                <img\n                  src={item.url}\n                  alt={item.name}\n                  style={{ display: \"inline-block\" }}\n                  onClick={() => onClick(item.name)}\n                />\n              </div>\n            ))}\n          </div>\n        ))}\n      </Carousel>\n    );\n  }\n}\n\nexport default Emoji;\n"]}
1
+{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","carousel","next","prev","props","onClick","emojiList","content","i","length","push","slice","node","map","page","index","item","id","url","name","display","width","React","Component"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AAGA;;;;;;;;;AADA;;;AAEA;AACA;;AAEA;;IAEMA,K;;;;;;;;;;;2BACG;AACL,UAAI,KAAKC,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcC,IAAd;AACD;AACF;;;2BAEM;AACL,UAAI,KAAKD,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcE,IAAd;AACD;AACF;;;6BAEQ;AAAA;;AAAA,mBACwB,KAAKC,KAD7B;AAAA,UACCC,QADD,UACCA,OADD;AAAA,UACUC,SADV,UACUA,SADV;;AAEP,UAAMC,UAAU,EAAhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIF,UAAUG,MAA9B,EAAsCD,KAAK,EAA3C,EAA+C;AAC7CD,gBAAQG,IAAR,CAAaJ,UAAUK,KAAV,CAAgBH,CAAhB,EAAmBA,IAAI,EAAvB,CAAb;AACD;;AAED,aACE;AAAA;AAAA;AACE,eAAK,mBAAQ;AACX,mBAAKP,QAAL,GAAgBW,IAAhB;AACD;AAHH;AAKGL,gBAAQM,GAAR,CAAY,UAACC,IAAD,EAAOC,KAAP;AAAA,iBACX;AAAA;AAAA,cAAK,KAAKA,KAAV,EAAiB,WAAU,OAA3B;AACGD,iBAAKD,GAAL,CAAS,UAACG,IAAD,EAAOD,KAAP;AAAA,qBACR;AAAA;AAAA,kBAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKC,EAAhC;AAEE;AACE,uBAAKD,KAAKE,GADZ;AAEE,uBAAKF,KAAKG,IAFZ;AAGE,yBAAO,EAAEC,SAAS,cAAX,EAA2BC,OAAO,MAAlC,EAHT;AAIE,2BAAS;AAAA,2BAAMhB,SAAQW,KAAKG,IAAb,CAAN;AAAA;AAJX;AAFF,eADQ;AAAA,aAAT;AADH,WADW;AAAA,SAAZ;AALH,OADF;AAuBD;;;;EAvDiBG,gBAAMC,S;;kBA0DXvB,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\nimport { Carousel } from \"antd\";\n// import emoji, { prefixUrl } from \"../../emoji\";\nimport \"./Emoji.css\";\n// 每页 20  5*4\n// 共 20 * 3 = 60 (实际是 54)\n\n// class Emoji\n\nclass Emoji extends React.Component {\n  next() {\n    if (this.carousel) {\n      this.carousel.next();\n    }\n  }\n\n  prev() {\n    if (this.carousel) {\n      this.carousel.prev();\n    }\n  }\n\n  render() {\n    const { onClick, emojiList } = this.props;\n    const content = [];\n    // let curPage = [];\n    // for (let i = 0; i < 115; i++) {\n    //   if (curPage.length < 30) {\n    //     curPage.push(emoji[i]);\n    //   } else {\n    //     content.push(curPage);\n    //     curPage = [];\n    //   }\n    // }\n    // if (curPage.length > 0) {\n    //   content.push(curPage);\n    // }\n    for (let i = 0; i < emojiList.length; i += 30) {\n      content.push(emojiList.slice(i, i + 30));\n    }\n\n    return (\n      <Carousel\n        ref={node => {\n          this.carousel = node;\n        }}\n      >\n        {content.map((page, index) => (\n          <div key={index} className=\"emoji\">\n            {page.map((item, index) => (\n              <div className=\"item\" key={item.id}>\n                {/* <span className=\"helper\" /> */}\n                <img\n                  src={item.url}\n                  alt={item.name}\n                  style={{ display: \"inline-block\", width: \"28px\" }}\n                  onClick={() => onClick(item.name)}\n                />\n              </div>\n            ))}\n          </div>\n        ))}\n      </Carousel>\n    );\n  }\n}\n\nexport default Emoji;\n"]}

+ 29
- 0
lib/components/Editor/index.css Voir le fichier

@@ -101,3 +101,32 @@
101 101
 .clearfix {
102 102
   clear: both;
103 103
 }
104
+
105
+.comment-unlogin-tip {
106
+  padding: 56px 0 24px 0;
107
+  text-align: center;
108
+  font-size: 16px;
109
+  color: #393939;
110
+}
111
+
112
+.comment-unlogin-button {
113
+  display: flex;
114
+  justify-content: center;
115
+}
116
+
117
+.comment-unlogin-button button {
118
+  width: 112px;
119
+  height: 36px;
120
+}
121
+
122
+@media (max-width: 575px) {
123
+  .comment-unlogin-tip {
124
+    padding: 36px 0 16px 0;
125
+    font-size: 14px;
126
+  }
127
+
128
+  .comment-unlogin-button button {
129
+    width: 82px;
130
+    height: 28px;
131
+  }
132
+}

+ 151
- 123
lib/components/Editor/index.js Voir le fichier

@@ -416,7 +416,8 @@ var Editor = function (_React$Component) {
416 416
           emojiToolIcon = _props2.emojiToolIcon,
417 417
           imageToolIcon = _props2.imageToolIcon,
418 418
           maxLength = _props2.maxLength,
419
-          autoFocus = _props2.autoFocus;
419
+          autoFocus = _props2.autoFocus,
420
+          app = _props2.app;
420 421
 
421 422
       var placeholder = this.props.placeholder || _reactIntlUniversal2.default.get("editor.placeholder");
422 423
       var btnSubmitText = this.props.btnSubmitText || _reactIntlUniversal2.default.get("editor.SubmitBtn");
@@ -424,146 +425,173 @@ var Editor = function (_React$Component) {
424 425
       var disabledSubmit = this.checkDisabledSubmit();
425 426
       var inputValue = value || this.state.value;
426 427
       var uploadFileList = fileList || this.state.fileList;
428
+      var isLogin = app.currentUser && app.currentUser.user_id > 0;
427 429
       return _react2.default.createElement(
428 430
         "div",
429 431
         { className: "comment-editor-container", onPaste: this.handlePaste },
430
-        _react2.default.createElement("div", {
431
-          className: (0, _classnames2.default)({
432
-            "comment-editor-toolbar": true,
433
-            "comment-editor-toolbar-error": inputValue.length > maxLength
434
-          })
435
-        }),
436
-        _react2.default.createElement(
437
-          "div",
438
-          { className: "comment-editor" },
439
-          _react2.default.createElement(TextArea, {
440
-            value: inputValue,
441
-            onChange: function onChange(e) {
442
-              return _this4.handleChange(e.target.value);
443
-            },
444
-            rows: rows,
445
-            placeholder: placeholder,
446
-            autoFocus: autoFocus
432
+        isLogin ? _react2.default.createElement(
433
+          _react.Fragment,
434
+          null,
435
+          _react2.default.createElement("div", {
436
+            className: (0, _classnames2.default)({
437
+              "comment-editor-toolbar": true,
438
+              "comment-editor-toolbar-error": inputValue.length > maxLength
439
+            })
447 440
           }),
448 441
           _react2.default.createElement(
449 442
             "div",
450
-            { className: "comment-toolbar" },
443
+            { className: "comment-editor" },
444
+            _react2.default.createElement(TextArea, {
445
+              value: inputValue,
446
+              onChange: function onChange(e) {
447
+                return _this4.handleChange(e.target.value);
448
+              },
449
+              rows: rows,
450
+              placeholder: placeholder,
451
+              autoFocus: autoFocus
452
+            }),
451 453
             _react2.default.createElement(
452 454
               "div",
453
-              { className: "comment-toolbar-left" },
454
-              showEmoji && _react2.default.createElement(
455
-                _popover2.default,
456
-                {
457
-                  trigger: "click",
458
-                  placement: emojiPopoverPlacement,
459
-                  autoAdjustOverflow: false,
460
-                  overlayStyle: { zIndex: 9999 },
461
-                  content: _react2.default.createElement(
462
-                    "div",
463
-                    {
464
-                      style: { width: 240, height: 205 },
465
-                      onWheel: this.handleEmojiScroll
466
-                    },
467
-                    _react2.default.createElement(_Emoji2.default, {
468
-                      onClick: this.handleClickEmoji,
469
-                      ref: function ref(node) {
470
-                        _this4.emoji = node;
455
+              { className: "comment-toolbar" },
456
+              _react2.default.createElement(
457
+                "div",
458
+                { className: "comment-toolbar-left" },
459
+                showEmoji && _react2.default.createElement(
460
+                  _popover2.default,
461
+                  {
462
+                    trigger: "click",
463
+                    placement: emojiPopoverPlacement,
464
+                    autoAdjustOverflow: false,
465
+                    overlayStyle: { zIndex: 9999 },
466
+                    content: _react2.default.createElement(
467
+                      "div",
468
+                      {
469
+                        style: { width: 240, height: 205 },
470
+                        onWheel: this.handleEmojiScroll
471 471
                       },
472
-                      emojiList: this.props.app.emojiList
473
-                    })
474
-                  ),
475
-                  overlayClassName: "comment-emoji-popover"
476
-                },
477
-                emojiToolIcon || _react2.default.createElement(_icon2.default, { type: "smile-o", className: "comment-toolbar-icon" })
478
-              ),
479
-              showUpload ? _react2.default.createElement(
480
-                _popover2.default,
481
-                {
482
-                  trigger: "click"
483
-                  // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
484
-                  , visible: this.state.uploadVisible,
485
-                  placement: uploadPopoverPlacement,
486
-                  overlayClassName: uploadOverlayClassName,
487
-                  autoAdjustOverflow: false,
488
-                  overlayStyle: { zIndex: 9999 },
489
-                  onVisibleChange: function onVisibleChange(visible) {
490
-                    _this4.setState({
491
-                      uploadVisible: visible
492
-                    });
472
+                      _react2.default.createElement(_Emoji2.default, {
473
+                        onClick: this.handleClickEmoji,
474
+                        ref: function ref(node) {
475
+                          _this4.emoji = node;
476
+                        },
477
+                        emojiList: this.props.app.emojiList
478
+                      })
479
+                    ),
480
+                    overlayClassName: "comment-emoji-popover"
493 481
                   },
494
-                  content: _react2.default.createElement(
495
-                    "div",
496
-                    {
497
-                      style: {
498
-                        width: 336, // 一行显示3张
499
-                        minHeight: 100,
500
-                        margin: "0 auto"
501
-                      }
482
+                  emojiToolIcon || _react2.default.createElement(_icon2.default, { type: "smile-o", className: "comment-toolbar-icon" })
483
+                ),
484
+                showUpload ? _react2.default.createElement(
485
+                  _popover2.default,
486
+                  {
487
+                    trigger: "click"
488
+                    // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
489
+                    , visible: this.state.uploadVisible,
490
+                    placement: uploadPopoverPlacement,
491
+                    overlayClassName: uploadOverlayClassName,
492
+                    autoAdjustOverflow: false,
493
+                    overlayStyle: { zIndex: 9999 },
494
+                    onVisibleChange: function onVisibleChange(visible) {
495
+                      _this4.setState({
496
+                        uploadVisible: visible
497
+                      });
502 498
                     },
503
-                    _react2.default.createElement(_Upload2.default, {
504
-                      onRef: function onRef(node) {
505
-                        return _this4.uploadRef = node;
499
+                    content: _react2.default.createElement(
500
+                      "div",
501
+                      {
502
+                        style: {
503
+                          width: 336, // 一行显示3张
504
+                          minHeight: 100,
505
+                          margin: "0 auto"
506
+                        }
506 507
                       },
507
-                      multiple: multiple,
508
-                      onChangeFileList: this.handleChangeFileList,
509
-                      onUpload: this.handleUpload,
510
-                      maxUpload: maxUpload,
511
-                      fileList: uploadFileList,
512
-                      showError: this.props.showError,
513
-                      onError: this.props.onError
514
-                    }),
515
-                    _react2.default.createElement("div", { className: "clearfix" })
516
-                  ),
517
-                  title: _react2.default.createElement(
518
-                    "div",
519
-                    { style: { margin: "5px auto" } },
520
-                    _react2.default.createElement(
521
-                      "span",
522
-                      null,
523
-                      _reactIntlUniversal2.default.get("editor.uploadTip"),
524
-                      maxUpload >= 2 ? _react2.default.createElement(
508
+                      _react2.default.createElement(_Upload2.default, {
509
+                        onRef: function onRef(node) {
510
+                          return _this4.uploadRef = node;
511
+                        },
512
+                        multiple: multiple,
513
+                        onChangeFileList: this.handleChangeFileList,
514
+                        onUpload: this.handleUpload,
515
+                        maxUpload: maxUpload,
516
+                        fileList: uploadFileList,
517
+                        showError: this.props.showError,
518
+                        onError: this.props.onError
519
+                      }),
520
+                      _react2.default.createElement("div", { className: "clearfix" })
521
+                    ),
522
+                    title: _react2.default.createElement(
523
+                      "div",
524
+                      { style: { margin: "5px auto" } },
525
+                      _react2.default.createElement(
525 526
                         "span",
526
-                        { style: { color: "#666", fontWeight: 400 } },
527
-                        _reactIntlUniversal2.default.get("editor.uploadCount", {
528
-                          count: maxUpload - uploadFileList.length
529
-                        })
530
-                      ) : null
527
+                        null,
528
+                        _reactIntlUniversal2.default.get("editor.uploadTip"),
529
+                        maxUpload >= 2 ? _react2.default.createElement(
530
+                          "span",
531
+                          { style: { color: "#666", fontWeight: 400 } },
532
+                          _reactIntlUniversal2.default.get("editor.uploadCount", {
533
+                            count: maxUpload - uploadFileList.length
534
+                          })
535
+                        ) : null
536
+                      )
531 537
                     )
532
-                  )
533
-                },
534
-                imageToolIcon ? _react2.default.cloneElement(imageToolIcon, {
535
-                  onClick: function onClick() {
536
-                    return _this4.handleShowUpload(true);
537
-                  }
538
-                }) : _react2.default.createElement(_icon2.default, {
539
-                  type: "picture",
540
-                  className: "comment-toolbar-icon",
541
-                  style: { marginLeft: 20 },
542
-                  onClick: function onClick() {
543
-                    return _this4.handleShowUpload(true);
544
-                  }
545
-                })
546
-              ) : null
547
-            ),
548
-            _react2.default.createElement(
549
-              "div",
550
-              { className: "comment-toolbar-right" },
551
-              button ? _react2.default.cloneElement(button, {
552
-                onClick: button.props.onClick || handleSubmit
553
-              }) : _react2.default.createElement(
554
-                _button2.default,
555
-                {
556
-                  onClick: function onClick() {
557
-                    return _this4.handleSubmit();
558 538
                   },
559
-                  type: "primary",
560
-                  loading: btnLoading,
561
-                  disabled: disabledSubmit
562
-                },
563
-                btnSubmitText
539
+                  imageToolIcon ? _react2.default.cloneElement(imageToolIcon, {
540
+                    onClick: function onClick() {
541
+                      return _this4.handleShowUpload(true);
542
+                    }
543
+                  }) : _react2.default.createElement(_icon2.default, {
544
+                    type: "picture",
545
+                    className: "comment-toolbar-icon",
546
+                    style: { marginLeft: 20 },
547
+                    onClick: function onClick() {
548
+                      return _this4.handleShowUpload(true);
549
+                    }
550
+                  })
551
+                ) : null
552
+              ),
553
+              _react2.default.createElement(
554
+                "div",
555
+                { className: "comment-toolbar-right" },
556
+                button ? _react2.default.cloneElement(button, {
557
+                  onClick: button.props.onClick || handleSubmit
558
+                }) : _react2.default.createElement(
559
+                  _button2.default,
560
+                  {
561
+                    onClick: function onClick() {
562
+                      return _this4.handleSubmit();
563
+                    },
564
+                    type: "primary",
565
+                    loading: btnLoading,
566
+                    disabled: disabledSubmit
567
+                  },
568
+                  btnSubmitText
569
+                )
564 570
               )
565 571
             )
566 572
           )
573
+        ) : _react2.default.createElement(
574
+          _react.Fragment,
575
+          null,
576
+          _react2.default.createElement(
577
+            "div",
578
+            { className: "comment-unlogin-tip" },
579
+            _reactIntlUniversal2.default.get("comment.unlogin")
580
+          ),
581
+          _react2.default.createElement(
582
+            "div",
583
+            { className: "comment-unlogin-button" },
584
+            _react2.default.createElement(
585
+              _button2.default,
586
+              {
587
+                type: "primary",
588
+                onClick: function onClick() {
589
+                  window.location.href = app.LOGINLINK + "?f=" + window.location.href;
590
+                }
591
+              },
592
+              _reactIntlUniversal2.default.get("account.login")
593
+            )
594
+          )
567 595
         )
568 596
       );
569 597
     }

+ 1
- 1
lib/components/Editor/index.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 1
- 2
lib/helper.js Voir le fichier

@@ -75,10 +75,9 @@ function renderContent(content, onClick) {
75 75
     }
76 76
     // 如果不存在对应的表情, 则返回原文
77 77
     // const emoji = emojiObejct[src];
78
-    console.log(src);
79 78
     var emoji = JSON.parse(sessionStorage.getItem("emojiMap"))[src];
80 79
     if (emoji) {
81
-      return "<img class=\"comment-emoji\" src=\"" + emoji + "\" alt=\"" + emoji.title + "\" />";
80
+      return "<img class=\"comment-emoji\" src=\"" + emoji + "\" alt=\"" + emoji.title + "\" style=\"width:28px\"/>";
82 81
     }
83 82
     return "[" + src + "]";
84 83
   }).replace(innerUrl, function (a, b) {

+ 1
- 1
lib/helper.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 9
- 0
lib/index.js Voir le fichier

@@ -148,6 +148,12 @@ if (process.env.NODE_ENV !== "production") {
148 148
         followers: 10,
149 149
         fans: 11,
150 150
         isFollowed: false
151
+      },
152
+      58297: {
153
+        nickname: "aaaaa",
154
+        followers: 10,
155
+        fans: 11,
156
+        isFollowed: false
151 157
       }
152 158
     },
153 159
     showHoverCard: true,
@@ -182,6 +188,9 @@ if (process.env.NODE_ENV !== "production") {
182 188
     onBeforeUpdateComment: function onBeforeUpdateComment() {
183 189
       console.log("onBeforeUpdateComment");
184 190
     },
191
+    sendMessage: function sendMessage(id) {
192
+      console.log("sendMessage", id);
193
+    },
185 194
     editorProps: {
186 195
       onCommentSuccess: function onCommentSuccess(data) {
187 196
         console.log(data);

+ 1
- 1
lib/index.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 4
- 4
lib/version.json Voir le fichier

@@ -1,8 +1,8 @@
1 1
 {
2 2
     "name":       "comment",
3
-    "buildDate":  1564979699301,
3
+    "buildDate":  1565080180929,
4 4
     "version":    "1.0.4",
5
-    "numCommits": 179,
6
-    "hash":       "083abcb",
7
-    "dirty":      true
5
+    "numCommits": 181,
6
+    "hash":       "d2c0f01",
7
+    "dirty":      false
8 8
 }

+ 4
- 0
src/App.js Voir le fichier

@@ -647,6 +647,10 @@ App.defaultProps = {
647 647
   businessUserId: 0,
648 648
   API: "//api.links123.net/comment/v1",
649 649
   emojiAPI: "//api.links123.net/link/v1",
650
+  LOGINLINK:
651
+    process.env.RUN_MOD === "production"
652
+      ? "https://passport.links123.com/login"
653
+      : "http://test.links123.net:5050/login",
650 654
   showList: true,
651 655
   showEditor: true,
652 656
   showAlertComment: false,

+ 1
- 0
src/components/CommentBox/index.js Voir le fichier

@@ -85,6 +85,7 @@ class CommentBox extends Component {
85 85
               <ContentItem
86 86
                 commentId={commentId}
87 87
                 replyId={item.id}
88
+                user_id={item.user_id}
88 89
                 key={item.id}
89 90
                 content={item}
90 91
                 action="replyToReply" // 评论的回复

+ 8
- 6
src/components/ContentItem/AvatarHoverCard.js Voir le fichier

@@ -110,12 +110,14 @@ class AvatarHoverCard extends Component {
110 110
             )}
111 111
 
112 112
             {/* 发私信按钮,暂时隐藏 */}
113
-            {/* <div
114
-            className={styles.privateMessageBtn}
115
-            onClick={this.toggleShowModal}
116
-          >
117
-            发私信
118
-          </div> */}
113
+            <div
114
+              className={`privateMessageBtn ${
115
+                this.props.locale === "en-US" ? "enUs" : ""
116
+              }`}
117
+              onClick={() => this.props.sendMessage({ id: user_id })}
118
+            >
119
+              {intl.get("bilingually.im.send_msg")}
120
+            </div>
119 121
           </Row>
120 122
         )}
121 123
       </div>

+ 16
- 0
src/components/ContentItem/AvatarHoverCard.less Voir le fichier

@@ -80,6 +80,22 @@
80 80
   border: 1px solid rgba(113, 193, 53, 1);
81 81
 }
82 82
 
83
+.privateMessageBtn {
84
+  width: 77px;
85
+  height: 31px;
86
+  line-height: 31px;
87
+  background: rgba(113, 193, 53, 1);
88
+  border-radius: 4px;
89
+  color: #fff;
90
+  font-size: 12px;
91
+  font-weight: 500;
92
+  text-align: center;
93
+  cursor: pointer;
94
+  margin: 0 5px;
95
+}
96
+.privateMessageBtn.enUs {
97
+  width: 90px;
98
+}
83 99
 .modalContainer {
84 100
   background: #fff;
85 101
   padding: 20px;

+ 2
- 2
src/components/Editor/Emoji.js Voir le fichier

@@ -49,11 +49,11 @@ class Emoji extends React.Component {
49 49
           <div key={index} className="emoji">
50 50
             {page.map((item, index) => (
51 51
               <div className="item" key={item.id}>
52
-                <span className="helper" />
52
+                {/* <span className="helper" /> */}
53 53
                 <img
54 54
                   src={item.url}
55 55
                   alt={item.name}
56
-                  style={{ display: "inline-block" }}
56
+                  style={{ display: "inline-block", width: "28px" }}
57 57
                   onClick={() => onClick(item.name)}
58 58
                 />
59 59
               </div>

+ 29
- 0
src/components/Editor/index.css Voir le fichier

@@ -101,3 +101,32 @@
101 101
 .clearfix {
102 102
   clear: both;
103 103
 }
104
+
105
+.comment-unlogin-tip {
106
+  padding: 56px 0 24px 0;
107
+  text-align: center;
108
+  font-size: 16px;
109
+  color: #393939;
110
+}
111
+
112
+.comment-unlogin-button {
113
+  display: flex;
114
+  justify-content: center;
115
+}
116
+
117
+.comment-unlogin-button button {
118
+  width: 112px;
119
+  height: 36px;
120
+}
121
+
122
+@media (max-width: 575px) {
123
+  .comment-unlogin-tip {
124
+    padding: 36px 0 16px 0;
125
+    font-size: 14px;
126
+  }
127
+
128
+  .comment-unlogin-button button {
129
+    width: 82px;
130
+    height: 28px;
131
+  }
132
+}

+ 142
- 120
src/components/Editor/index.js Voir le fichier

@@ -1,4 +1,4 @@
1
-import React from "react";
1
+import React, { Fragment } from "react";
2 2
 import PropTypes from "prop-types";
3 3
 import { Icon, Button, Popover, Input, message } from "antd";
4 4
 import classnames from "classnames";
@@ -308,7 +308,8 @@ class Editor extends React.Component {
308 308
       emojiToolIcon,
309 309
       imageToolIcon,
310 310
       maxLength,
311
-      autoFocus
311
+      autoFocus,
312
+      app
312 313
     } = this.props;
313 314
     let placeholder = this.props.placeholder || intl.get("editor.placeholder");
314 315
     let btnSubmitText =
@@ -317,137 +318,158 @@ class Editor extends React.Component {
317 318
     const disabledSubmit = this.checkDisabledSubmit();
318 319
     const inputValue = value || this.state.value;
319 320
     const uploadFileList = fileList || this.state.fileList;
321
+    const isLogin = app.currentUser && app.currentUser.user_id > 0;
320 322
     return (
321 323
       <div className="comment-editor-container" onPaste={this.handlePaste}>
322
-        <div
323
-          className={classnames({
324
-            "comment-editor-toolbar": true,
325
-            "comment-editor-toolbar-error": inputValue.length > maxLength
326
-          })}
327
-        ></div>
328
-        <div className="comment-editor">
329
-          <TextArea
330
-            value={inputValue}
331
-            onChange={e => this.handleChange(e.target.value)}
332
-            rows={rows}
333
-            placeholder={placeholder}
334
-            autoFocus={autoFocus}
335
-          />
324
+        {isLogin ? (
325
+          <Fragment>
326
+            <div
327
+              className={classnames({
328
+                "comment-editor-toolbar": true,
329
+                "comment-editor-toolbar-error": inputValue.length > maxLength
330
+              })}
331
+            ></div>
332
+            <div className="comment-editor">
333
+              <TextArea
334
+                value={inputValue}
335
+                onChange={e => this.handleChange(e.target.value)}
336
+                rows={rows}
337
+                placeholder={placeholder}
338
+                autoFocus={autoFocus}
339
+              />
336 340
 
337
-          <div className="comment-toolbar">
338
-            <div className="comment-toolbar-left">
339
-              {showEmoji && (
340
-                <Popover
341
-                  trigger="click"
342
-                  placement={emojiPopoverPlacement}
343
-                  autoAdjustOverflow={false}
344
-                  overlayStyle={{ zIndex: 9999 }}
345
-                  content={
346
-                    <div
347
-                      style={{ width: 240, height: 205 }}
348
-                      onWheel={this.handleEmojiScroll}
341
+              <div className="comment-toolbar">
342
+                <div className="comment-toolbar-left">
343
+                  {showEmoji && (
344
+                    <Popover
345
+                      trigger="click"
346
+                      placement={emojiPopoverPlacement}
347
+                      autoAdjustOverflow={false}
348
+                      overlayStyle={{ zIndex: 9999 }}
349
+                      content={
350
+                        <div
351
+                          style={{ width: 240, height: 205 }}
352
+                          onWheel={this.handleEmojiScroll}
353
+                        >
354
+                          <Emoji
355
+                            onClick={this.handleClickEmoji}
356
+                            ref={node => {
357
+                              this.emoji = node;
358
+                            }}
359
+                            emojiList={this.props.app.emojiList}
360
+                          />
361
+                        </div>
362
+                      }
363
+                      overlayClassName="comment-emoji-popover"
349 364
                     >
350
-                      <Emoji
351
-                        onClick={this.handleClickEmoji}
352
-                        ref={node => {
353
-                          this.emoji = node;
354
-                        }}
355
-                        emojiList={this.props.app.emojiList}
356
-                      />
357
-                    </div>
358
-                  }
359
-                  overlayClassName="comment-emoji-popover"
360
-                >
361
-                  {emojiToolIcon || (
362
-                    <Icon type="smile-o" className="comment-toolbar-icon" />
365
+                      {emojiToolIcon || (
366
+                        <Icon type="smile-o" className="comment-toolbar-icon" />
367
+                      )}
368
+                    </Popover>
363 369
                   )}
364
-                </Popover>
365
-              )}
366 370
 
367
-              {showUpload ? (
368
-                <Popover
369
-                  trigger="click"
370
-                  // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
371
-                  visible={this.state.uploadVisible}
372
-                  placement={uploadPopoverPlacement}
373
-                  overlayClassName={uploadOverlayClassName}
374
-                  autoAdjustOverflow={false}
375
-                  overlayStyle={{ zIndex: 9999 }}
376
-                  onVisibleChange={visible => {
377
-                    this.setState({
378
-                      uploadVisible: visible
379
-                    });
380
-                  }}
381
-                  content={
382
-                    <div
383
-                      style={{
384
-                        width: 336, // 一行显示3张
385
-                        minHeight: 100,
386
-                        margin: "0 auto"
371
+                  {showUpload ? (
372
+                    <Popover
373
+                      trigger="click"
374
+                      // TODO: 针对非 react.js,直接使用 click 事件来控制展开或关闭
375
+                      visible={this.state.uploadVisible}
376
+                      placement={uploadPopoverPlacement}
377
+                      overlayClassName={uploadOverlayClassName}
378
+                      autoAdjustOverflow={false}
379
+                      overlayStyle={{ zIndex: 9999 }}
380
+                      onVisibleChange={visible => {
381
+                        this.setState({
382
+                          uploadVisible: visible
383
+                        });
387 384
                       }}
388
-                    >
389
-                      <Upload
390
-                        onRef={node => (this.uploadRef = node)}
391
-                        multiple={multiple}
392
-                        onChangeFileList={this.handleChangeFileList}
393
-                        onUpload={this.handleUpload}
394
-                        maxUpload={maxUpload}
395
-                        fileList={uploadFileList}
396
-                        showError={this.props.showError}
397
-                        onError={this.props.onError}
398
-                      />
399
-                      <div className="clearfix" />
400
-                    </div>
401
-                  }
402
-                  title={
403
-                    <div style={{ margin: "5px auto" }}>
404
-                      <span>
405
-                        {intl.get("editor.uploadTip")}
406
-                        {maxUpload >= 2 ? (
407
-                          <span style={{ color: "#666", fontWeight: 400 }}>
408
-                            {intl.get("editor.uploadCount", {
409
-                              count: maxUpload - uploadFileList.length
410
-                            })}
385
+                      content={
386
+                        <div
387
+                          style={{
388
+                            width: 336, // 一行显示3张
389
+                            minHeight: 100,
390
+                            margin: "0 auto"
391
+                          }}
392
+                        >
393
+                          <Upload
394
+                            onRef={node => (this.uploadRef = node)}
395
+                            multiple={multiple}
396
+                            onChangeFileList={this.handleChangeFileList}
397
+                            onUpload={this.handleUpload}
398
+                            maxUpload={maxUpload}
399
+                            fileList={uploadFileList}
400
+                            showError={this.props.showError}
401
+                            onError={this.props.onError}
402
+                          />
403
+                          <div className="clearfix" />
404
+                        </div>
405
+                      }
406
+                      title={
407
+                        <div style={{ margin: "5px auto" }}>
408
+                          <span>
409
+                            {intl.get("editor.uploadTip")}
410
+                            {maxUpload >= 2 ? (
411
+                              <span style={{ color: "#666", fontWeight: 400 }}>
412
+                                {intl.get("editor.uploadCount", {
413
+                                  count: maxUpload - uploadFileList.length
414
+                                })}
415
+                              </span>
416
+                            ) : null}
411 417
                           </span>
412
-                        ) : null}
413
-                      </span>
414
-                    </div>
415
-                  }
416
-                >
417
-                  {imageToolIcon ? (
418
-                    React.cloneElement(imageToolIcon, {
419
-                      onClick: () => this.handleShowUpload(true)
418
+                        </div>
419
+                      }
420
+                    >
421
+                      {imageToolIcon ? (
422
+                        React.cloneElement(imageToolIcon, {
423
+                          onClick: () => this.handleShowUpload(true)
424
+                        })
425
+                      ) : (
426
+                        <Icon
427
+                          type="picture"
428
+                          className="comment-toolbar-icon"
429
+                          style={{ marginLeft: 20 }}
430
+                          onClick={() => this.handleShowUpload(true)}
431
+                        />
432
+                      )}
433
+                    </Popover>
434
+                  ) : null}
435
+                </div>
436
+
437
+                <div className="comment-toolbar-right">
438
+                  {button ? (
439
+                    React.cloneElement(button, {
440
+                      onClick: button.props.onClick || handleSubmit
420 441
                     })
421 442
                   ) : (
422
-                    <Icon
423
-                      type="picture"
424
-                      className="comment-toolbar-icon"
425
-                      style={{ marginLeft: 20 }}
426
-                      onClick={() => this.handleShowUpload(true)}
427
-                    />
443
+                    <Button
444
+                      onClick={() => this.handleSubmit()}
445
+                      type="primary"
446
+                      loading={btnLoading}
447
+                      disabled={disabledSubmit}
448
+                    >
449
+                      {btnSubmitText}
450
+                    </Button>
428 451
                   )}
429
-                </Popover>
430
-              ) : null}
452
+                </div>
453
+              </div>
431 454
             </div>
432
-
433
-            <div className="comment-toolbar-right">
434
-              {button ? (
435
-                React.cloneElement(button, {
436
-                  onClick: button.props.onClick || handleSubmit
437
-                })
438
-              ) : (
439
-                <Button
440
-                  onClick={() => this.handleSubmit()}
441
-                  type="primary"
442
-                  loading={btnLoading}
443
-                  disabled={disabledSubmit}
444
-                >
445
-                  {btnSubmitText}
446
-                </Button>
447
-              )}
455
+          </Fragment>
456
+        ) : (
457
+          <Fragment>
458
+            <div className="comment-unlogin-tip">
459
+              {intl.get("comment.unlogin")}
460
+            </div>
461
+            <div className="comment-unlogin-button">
462
+              <Button
463
+                type="primary"
464
+                onClick={() => {
465
+                  window.location.href = `${app.LOGINLINK}?f=${window.location.href}`;
466
+                }}
467
+              >
468
+                {intl.get("account.login")}
469
+              </Button>
448 470
             </div>
449
-          </div>
450
-        </div>
471
+          </Fragment>
472
+        )}
451 473
       </div>
452 474
     );
453 475
   }

+ 1
- 2
src/helper.js Voir le fichier

@@ -72,10 +72,9 @@ export function renderContent(content, onClick) {
72 72
       }
73 73
       // 如果不存在对应的表情, 则返回原文
74 74
       // const emoji = emojiObejct[src];
75
-      console.log(src);
76 75
       const emoji = JSON.parse(sessionStorage.getItem("emojiMap"))[src];
77 76
       if (emoji) {
78
-        return `<img class="comment-emoji" src="${emoji}" alt="${emoji.title}" />`;
77
+        return `<img class="comment-emoji" src="${emoji}" alt="${emoji.title}" style="width:28px"/>`;
79 78
       }
80 79
       return `[${src}]`;
81 80
     })

+ 9
- 0
src/index.js Voir le fichier

@@ -113,6 +113,12 @@ if (process.env.NODE_ENV !== "production") {
113 113
         followers: 10,
114 114
         fans: 11,
115 115
         isFollowed: false
116
+      },
117
+      58297: {
118
+        nickname: "aaaaa",
119
+        followers: 10,
120
+        fans: 11,
121
+        isFollowed: false
116 122
       }
117 123
     },
118 124
     showHoverCard: true,
@@ -147,6 +153,9 @@ if (process.env.NODE_ENV !== "production") {
147 153
     onBeforeUpdateComment: () => {
148 154
       console.log("onBeforeUpdateComment");
149 155
     },
156
+    sendMessage: id => {
157
+      console.log("sendMessage", id);
158
+    },
150 159
     editorProps: {
151 160
       onCommentSuccess: data => {
152 161
         console.log(data);