优化草稿功能
This commit is contained in:
1 parent
1263ed20a3
commit
0f3edc6925
8 files changed
+157
-190
No files matched your search
Vendored
+51
-83
@@ -2544,9 +2544,6 @@ function _toConsumableArray(arr) {
|
||||
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.string.starts-with.js
|
||||
var es6_string_starts_with = __webpack_require__("d31c");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.object.assign.js
|
||||
var es6_object_assign = __webpack_require__("6ba0");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.array.sort.js
|
||||
var es6_array_sort = __webpack_require__("3441");
|
||||
|
||||
@@ -2669,8 +2666,6 @@ var memory_MemoryCache = /*#__PURE__*/function () {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function componentsvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { componentsvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { componentsvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
@@ -3318,6 +3313,41 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this.$refs.messages.scrollToBottom();
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置联系人的草稿信息
|
||||
*/
|
||||
setDraft: function setDraft(contactId, editorValue) {
|
||||
if (isEmpty(contactId) || isEmpty(editorValue)) return false;
|
||||
var contact = this.findContact(contactId);
|
||||
if (isEmpty(contact)) return false;
|
||||
this.CacheDraft.set(contactId, {
|
||||
editorValue: editorValue,
|
||||
lastContent: contact.lastContent
|
||||
});
|
||||
this.updateContact({
|
||||
id: contactId,
|
||||
lastContent: "<span style=\"color:red;\">[\u8349\u7A3F]</span><span>".concat(this.lastContentRender({
|
||||
type: "text",
|
||||
content: editorValue
|
||||
}), "</span>")
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 清空联系人草稿信息
|
||||
*/
|
||||
clearDraft: function clearDraft(contactId) {
|
||||
var draft = this.CacheDraft.get(contactId);
|
||||
|
||||
if (draft) {
|
||||
this.updateContact({
|
||||
id: contactId,
|
||||
lastContent: draft.lastContent
|
||||
});
|
||||
this.CacheDraft.remove(contactId);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 改变聊天对象
|
||||
* @param contactId 联系人 id
|
||||
@@ -3326,7 +3356,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
var _changeContact = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(contactId, menuName) {
|
||||
var _this13 = this;
|
||||
|
||||
var prevCurrentContactId, editorValue, draft;
|
||||
var editorValue, draft;
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
@@ -3349,47 +3379,41 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
return _context2.abrupt("return", false);
|
||||
|
||||
case 6:
|
||||
prevCurrentContactId = this.currentContactId; //保存上个聊天目标的草稿
|
||||
|
||||
if (prevCurrentContactId) {
|
||||
//保存上个聊天目标的草稿
|
||||
if (this.currentContactId) {
|
||||
editorValue = this.getEditorValue();
|
||||
|
||||
if (editorValue) {
|
||||
this.CacheDraft.set(prevCurrentContactId, editorValue);
|
||||
this.updateContact({
|
||||
id: prevCurrentContactId,
|
||||
lastContent: "<span style=\"color:red;\">[\u8349\u7A3F]</span><span>".concat(this.lastContentRender({
|
||||
type: "text",
|
||||
content: editorValue
|
||||
}), "</span>")
|
||||
});
|
||||
this.setEditorValue("");
|
||||
this.setDraft(this.currentContactId, editorValue);
|
||||
this.setEditorValue();
|
||||
} else {
|
||||
this.clearDraft(this.currentContactId);
|
||||
}
|
||||
}
|
||||
|
||||
this.currentContactId = contactId;
|
||||
|
||||
if (this.currentContactId) {
|
||||
_context2.next = 11;
|
||||
_context2.next = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return", false);
|
||||
|
||||
case 11:
|
||||
case 10:
|
||||
this.$emit("change-contact", this.currentContact, this);
|
||||
|
||||
if (!isFunction(this.currentContact.renderContainer)) {
|
||||
_context2.next = 14;
|
||||
_context2.next = 13;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return");
|
||||
|
||||
case 14:
|
||||
case 13:
|
||||
//填充草稿内容
|
||||
draft = this.CacheDraft.get(contactId) || "";
|
||||
if (draft) this.setEditorValue(draft);
|
||||
draft = this.CacheDraft.get(contactId);
|
||||
if (draft) this.setEditorValue(draft.editorValue);
|
||||
|
||||
if (this.CacheMessageLoaded.has(contactId)) {
|
||||
this.$refs.messages.loaded();
|
||||
@@ -3411,7 +3435,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}, 0);
|
||||
}
|
||||
|
||||
case 18:
|
||||
case 17:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
@@ -3697,7 +3721,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
getCurrentMessages: function getCurrentMessages() {
|
||||
return this.currentMessages;
|
||||
},
|
||||
setEditorValue: function setEditorValue(val) {
|
||||
setEditorValue: function setEditorValue() {
|
||||
var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
||||
if (!isString(val)) return false;
|
||||
this.$refs.editor.setValue(this.emojiNameToImage(val));
|
||||
},
|
||||
@@ -5467,17 +5492,6 @@ try {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "6ba0":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 19.1.3.1 Object.assign(target, source)
|
||||
var $export = __webpack_require__("e99b");
|
||||
|
||||
$export($export.S + $export.F, 'Object', { assign: __webpack_require__("9f15") });
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "6bf8":
|
||||
@@ -5924,52 +5938,6 @@ module.exports = function (it) {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "9f15":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// 19.1.2.1 Object.assign(target, source, ...)
|
||||
var DESCRIPTORS = __webpack_require__("26df");
|
||||
var getKeys = __webpack_require__("93ca");
|
||||
var gOPS = __webpack_require__("0c29");
|
||||
var pIE = __webpack_require__("35d4");
|
||||
var toObject = __webpack_require__("8078");
|
||||
var IObject = __webpack_require__("1b96");
|
||||
var $assign = Object.assign;
|
||||
|
||||
// should work with symbols and should have deterministic property order (V8 bug)
|
||||
module.exports = !$assign || __webpack_require__("0926")(function () {
|
||||
var A = {};
|
||||
var B = {};
|
||||
// eslint-disable-next-line no-undef
|
||||
var S = Symbol();
|
||||
var K = 'abcdefghijklmnopqrst';
|
||||
A[S] = 7;
|
||||
K.split('').forEach(function (k) { B[k] = k; });
|
||||
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
||||
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
|
||||
var T = toObject(target);
|
||||
var aLen = arguments.length;
|
||||
var index = 1;
|
||||
var getSymbols = gOPS.f;
|
||||
var isEnum = pIE.f;
|
||||
while (aLen > index) {
|
||||
var S = IObject(arguments[index++]);
|
||||
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
||||
var length = keys.length;
|
||||
var j = 0;
|
||||
var key;
|
||||
while (length > j) {
|
||||
key = keys[j++];
|
||||
if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
|
||||
}
|
||||
} return T;
|
||||
} : $assign;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "a450":
|
||||
|
||||
Vendored
+51
-83
@@ -2553,9 +2553,6 @@ function _toConsumableArray(arr) {
|
||||
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.string.starts-with.js
|
||||
var es6_string_starts_with = __webpack_require__("d31c");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.object.assign.js
|
||||
var es6_object_assign = __webpack_require__("6ba0");
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.array.sort.js
|
||||
var es6_array_sort = __webpack_require__("3441");
|
||||
|
||||
@@ -2678,8 +2675,6 @@ var memory_MemoryCache = /*#__PURE__*/function () {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function componentsvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { componentsvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { componentsvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
@@ -3327,6 +3322,41 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this.$refs.messages.scrollToBottom();
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置联系人的草稿信息
|
||||
*/
|
||||
setDraft: function setDraft(contactId, editorValue) {
|
||||
if (isEmpty(contactId) || isEmpty(editorValue)) return false;
|
||||
var contact = this.findContact(contactId);
|
||||
if (isEmpty(contact)) return false;
|
||||
this.CacheDraft.set(contactId, {
|
||||
editorValue: editorValue,
|
||||
lastContent: contact.lastContent
|
||||
});
|
||||
this.updateContact({
|
||||
id: contactId,
|
||||
lastContent: "<span style=\"color:red;\">[\u8349\u7A3F]</span><span>".concat(this.lastContentRender({
|
||||
type: "text",
|
||||
content: editorValue
|
||||
}), "</span>")
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 清空联系人草稿信息
|
||||
*/
|
||||
clearDraft: function clearDraft(contactId) {
|
||||
var draft = this.CacheDraft.get(contactId);
|
||||
|
||||
if (draft) {
|
||||
this.updateContact({
|
||||
id: contactId,
|
||||
lastContent: draft.lastContent
|
||||
});
|
||||
this.CacheDraft.remove(contactId);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 改变聊天对象
|
||||
* @param contactId 联系人 id
|
||||
@@ -3335,7 +3365,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
var _changeContact = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(contactId, menuName) {
|
||||
var _this13 = this;
|
||||
|
||||
var prevCurrentContactId, editorValue, draft;
|
||||
var editorValue, draft;
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
@@ -3358,47 +3388,41 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
return _context2.abrupt("return", false);
|
||||
|
||||
case 6:
|
||||
prevCurrentContactId = this.currentContactId; //保存上个聊天目标的草稿
|
||||
|
||||
if (prevCurrentContactId) {
|
||||
//保存上个聊天目标的草稿
|
||||
if (this.currentContactId) {
|
||||
editorValue = this.getEditorValue();
|
||||
|
||||
if (editorValue) {
|
||||
this.CacheDraft.set(prevCurrentContactId, editorValue);
|
||||
this.updateContact({
|
||||
id: prevCurrentContactId,
|
||||
lastContent: "<span style=\"color:red;\">[\u8349\u7A3F]</span><span>".concat(this.lastContentRender({
|
||||
type: "text",
|
||||
content: editorValue
|
||||
}), "</span>")
|
||||
});
|
||||
this.setEditorValue("");
|
||||
this.setDraft(this.currentContactId, editorValue);
|
||||
this.setEditorValue();
|
||||
} else {
|
||||
this.clearDraft(this.currentContactId);
|
||||
}
|
||||
}
|
||||
|
||||
this.currentContactId = contactId;
|
||||
|
||||
if (this.currentContactId) {
|
||||
_context2.next = 11;
|
||||
_context2.next = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return", false);
|
||||
|
||||
case 11:
|
||||
case 10:
|
||||
this.$emit("change-contact", this.currentContact, this);
|
||||
|
||||
if (!isFunction(this.currentContact.renderContainer)) {
|
||||
_context2.next = 14;
|
||||
_context2.next = 13;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return");
|
||||
|
||||
case 14:
|
||||
case 13:
|
||||
//填充草稿内容
|
||||
draft = this.CacheDraft.get(contactId) || "";
|
||||
if (draft) this.setEditorValue(draft);
|
||||
draft = this.CacheDraft.get(contactId);
|
||||
if (draft) this.setEditorValue(draft.editorValue);
|
||||
|
||||
if (this.CacheMessageLoaded.has(contactId)) {
|
||||
this.$refs.messages.loaded();
|
||||
@@ -3420,7 +3444,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}, 0);
|
||||
}
|
||||
|
||||
case 18:
|
||||
case 17:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
@@ -3706,7 +3730,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
getCurrentMessages: function getCurrentMessages() {
|
||||
return this.currentMessages;
|
||||
},
|
||||
setEditorValue: function setEditorValue(val) {
|
||||
setEditorValue: function setEditorValue() {
|
||||
var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
||||
if (!isString(val)) return false;
|
||||
this.$refs.editor.setValue(this.emojiNameToImage(val));
|
||||
},
|
||||
@@ -5476,17 +5501,6 @@ try {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "6ba0":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 19.1.3.1 Object.assign(target, source)
|
||||
var $export = __webpack_require__("e99b");
|
||||
|
||||
$export($export.S + $export.F, 'Object', { assign: __webpack_require__("9f15") });
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "6bf8":
|
||||
@@ -5933,52 +5947,6 @@ module.exports = function (it) {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "9f15":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// 19.1.2.1 Object.assign(target, source, ...)
|
||||
var DESCRIPTORS = __webpack_require__("26df");
|
||||
var getKeys = __webpack_require__("93ca");
|
||||
var gOPS = __webpack_require__("0c29");
|
||||
var pIE = __webpack_require__("35d4");
|
||||
var toObject = __webpack_require__("8078");
|
||||
var IObject = __webpack_require__("1b96");
|
||||
var $assign = Object.assign;
|
||||
|
||||
// should work with symbols and should have deterministic property order (V8 bug)
|
||||
module.exports = !$assign || __webpack_require__("0926")(function () {
|
||||
var A = {};
|
||||
var B = {};
|
||||
// eslint-disable-next-line no-undef
|
||||
var S = Symbol();
|
||||
var K = 'abcdefghijklmnopqrst';
|
||||
A[S] = 7;
|
||||
K.split('').forEach(function (k) { B[k] = k; });
|
||||
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
||||
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
|
||||
var T = toObject(target);
|
||||
var aLen = arguments.length;
|
||||
var index = 1;
|
||||
var getSymbols = gOPS.f;
|
||||
var isEnum = pIE.f;
|
||||
while (aLen > index) {
|
||||
var S = IObject(arguments[index++]);
|
||||
var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
|
||||
var length = keys.length;
|
||||
var j = 0;
|
||||
var key;
|
||||
while (length > j) {
|
||||
key = keys[j++];
|
||||
if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
|
||||
}
|
||||
} return T;
|
||||
} : $assign;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "a450":
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["index"]=e(require("vue")):t["index"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="112a")}({"01be":function(t,e,n){},"0353":function(t,e,n){"use strict";var r=n("6bf8"),i=RegExp.prototype.exec,o=String.prototype.replace,a=i,c="lastIndex",s=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t[c]||0!==e[c]}(),u=void 0!==/()??/.exec("")[1],l=s||u;l&&(a=function(t){var e,n,a,l,f=this;return u&&(n=new RegExp("^"+f.source+"$(?!\\s)",r.call(f))),s&&(e=f[c]),a=i.call(f,t),s&&a&&(f[c]=f.global?a.index+a[0].length:e),u&&a&&a.length>1&&o.call(a[0],n,(function(){for(l=1;l<arguments.length-2;l++)void 0===arguments[l]&&(a[l]=void 0)})),a}),t.exports=a},"0451":function(t,e,n){var r=n("9cff"),i=n("d1cb"),o=n("839a")("species");t.exports=function(t){var e;return i(t)&&(e=t.constructor,"function"!=typeof e||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&(e=e[o],null===e&&(e=void 0))),void 0===e?Array:e}},"0484":function(t,e,n){},"04f4":function(t,e,n){"use strict";n("de97")},"05fd":function(t,e,n){t.exports=n("baa7")("native-function-to-string",Function.toString)},"065d":function(t,e,n){var r=n("bb8b"),i=n("5edc");t.exports=n("26df")?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},"065e":function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"0926":function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},"0b34":function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"0c29":function(t,e){e.f=Object.getOwnPropertySymbols},"0c84":function(t,e,n){"use strict";var r=n("1663")(!0);n("120f")(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},"0e15":function(t,e,n){"use strict";n("d5e9")},"112a":function(t,e,n){"use strict";var r;(n.r(e),"undefined"!==typeof window)&&(n("e67d"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));n("a450"),n("1bc7");var i=n("8bbf"),o=n.n(i);n("3269"),n("25ba"),n("b3d7"),n("4057");function a(t){return"[object Object]"===Object.prototype.toString.call(t)}function c(t){return"string"==typeof t}function s(t){return(new Date).getTime()-t<864e5}function u(t){return!t||(!(!Array.isArray(t)||0!=t.length)||!(!a(t)||0!=Object.values(t).length))}function l(t){return t&&"function"===typeof t}n("6a61");function f(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(u){return void n(u)}c.done?e(s):Promise.resolve(s).then(r,i)}function d(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){f(o,r,i,a,c,"next",t)}function c(t){f(o,r,i,a,c,"throw",t)}a(void 0)}))}}n("32ea"),n("aa18"),n("982e");var h,p,m=[],v={hover:function(t){},focus:function(t){var e=this;t.addEventListener("focus",(function(t){e.changeVisible()})),t.addEventListener("blur",(function(t){e.changeVisible()}))},click:function(t){var e=this;t.addEventListener("click",(function(t){t.stopPropagation(),$.hide(),e.changeVisible()}))},contextmenu:function(t){var e=this;t.addEventListener("contextmenu",(function(t){t.preventDefault(),e.changeVisible()}))}},g={name:"LemonPopover",props:{trigger:{type:String,default:"click",validator:function(t){return Object.keys(v).includes(t)}}},data:function(){return{popoverStyle:{},visible:!1}},created:function(){document.addEventListener("click",this._documentClickEvent),m.push(this.close)},mounted:function(){v[this.trigger].call(this,this.$slots.default[0].elm)},render:function(){var t=arguments[0];return t("span",{style:"position:relative"},[t("transition",{attrs:{name:"lemon-slide-top"}},[this.visible&&t("div",{class:"lemoLine truncated
|
||||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["index"]=e(require("vue")):t["index"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="112a")}({"01be":function(t,e,n){},"0353":function(t,e,n){"use strict";var r=n("6bf8"),i=RegExp.prototype.exec,o=String.prototype.replace,a=i,c="lastIndex",s=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t[c]||0!==e[c]}(),u=void 0!==/()??/.exec("")[1],l=s||u;l&&(a=function(t){var e,n,a,l,f=this;return u&&(n=new RegExp("^"+f.source+"$(?!\\s)",r.call(f))),s&&(e=f[c]),a=i.call(f,t),s&&a&&(f[c]=f.global?a.index+a[0].length:e),u&&a&&a.length>1&&o.call(a[0],n,(function(){for(l=1;l<arguments.length-2;l++)void 0===arguments[l]&&(a[l]=void 0)})),a}),t.exports=a},"0451":function(t,e,n){var r=n("9cff"),i=n("d1cb"),o=n("839a")("species");t.exports=function(t){var e;return i(t)&&(e=t.constructor,"function"!=typeof e||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&(e=e[o],null===e&&(e=void 0))),void 0===e?Array:e}},"0484":function(t,e,n){},"04f4":function(t,e,n){"use strict";n("de97")},"05fd":function(t,e,n){t.exports=n("baa7")("native-function-to-string",Function.toString)},"065d":function(t,e,n){var r=n("bb8b"),i=n("5edc");t.exports=n("26df")?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},"065e":function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"0926":function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},"0b34":function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"0c29":function(t,e){e.f=Object.getOwnPropertySymbols},"0c84":function(t,e,n){"use strict";var r=n("1663")(!0);n("120f")(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},"0e15":function(t,e,n){"use strict";n("d5e9")},"112a":function(t,e,n){"use strict";var r;(n.r(e),"undefined"!==typeof window)&&(n("e67d"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));n("a450"),n("1bc7");var i=n("8bbf"),o=n.n(i);n("3269"),n("25ba"),n("b3d7"),n("4057");function a(t){return"[object Object]"===Object.prototype.toString.call(t)}function c(t){return"string"==typeof t}function s(t){return(new Date).getTime()-t<864e5}function u(t){return!t||(!(!Array.isArray(t)||0!=t.length)||!(!a(t)||0!=Object.values(t).length))}function l(t){return t&&"function"===typeof t}n("6a61");function f(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(u){return void n(u)}c.done?e(s):Promise.resolve(s).then(r,i)}function d(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){f(o,r,i,a,c,"next",t)}function c(t){f(o,r,i,a,c,"throw",t)}a(void 0)}))}}n("32ea"),n("aa18"),n("982e");var h,p,m=[],v={hover:function(t){},focus:function(t){var e=this;t.addEventListener("focus",(function(t){e.changeVisible()})),t.addEventListener("blur",(function(t){e.changeVisible()}))},click:function(t){var e=this;t.addEventListener("click",(function(t){t.stopPropagation(),$.hide(),e.changeVisible()}))},contextmenu:function(t){var e=this;t.addEventListener("contextmenu",(function(t){t.preventDefault(),e.changeVisible()}))}},g={name:"LemonPopover",props:{trigger:{type:String,default:"click",validator:function(t){return Object.keys(v).includes(t)}}},data:function(){return{popoverStyle:{},visible:!1}},created:function(){document.addEventListener("click",this._documentClickEvent),m.push(this.close)},mounted:function(){v[this.trigger].call(this,this.$slots.default[0].elm)},render:function(){var t=arguments[0];return t("span",{style:"position:relative"},[t("transition",{attrs:{name:"lemon-slide-top"}},[this.visible&&t("div",{class:"lemoLine truncated
|
||||
+1
-6
@@ -1205,11 +1205,6 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const contactData1 = {
|
||||
id: "contact-1",
|
||||
displayName: "工作协作群",
|
||||
@@ -1266,7 +1261,7 @@ export default {
|
||||
let contactList = [
|
||||
{ ...contactData1 },
|
||||
{ ...contactData2 },
|
||||
{ ...contactData3 },
|
||||
{ ...contactData3 }
|
||||
//...Array(100).fill(contactData1)
|
||||
];
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title>Lemon IMUI</title><link href=css/index.e91d4c69.css rel=preload as=style><link href=js/chunk-vendors.2abee366.js rel=preload as=script><link href=js/index.67dbfb3d.js rel=preload as=script><link href=css/index.e91d4c69.css rel=stylesheet></head><body><noscript><strong>We're sorry but flat-im doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.2abee366.js></script><script src=js/index.67dbfb3d.js></script></body></html>
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title>Lemon IMUI</title><link href=css/index.e91d4c69.css rel=preload as=style><link href=js/chunk-vendors.2abee366.js rel=preload as=script><link href=js/index.6db35f89.js rel=preload as=script><link href=css/index.e91d4c69.css rel=stylesheet></head><body><noscript><strong>We're sorry but flat-im doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.2abee366.js></script><script src=js/index.6db35f89.js></script></body></html>
|
||||
@@ -1 +1 @@
|
||||
(function(t){function e(e){for(var i,r,o=e[0],c=e[1],d=e[2],u=0,m=[];u<o.length;u++)r=o[u],Object.prototype.hasOwnProperty.call(s,r)&&s[r]&&m.push(s[r][0]),s[r]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=c[i]);l&&l(e);while(m.length)m.shift()();return a.push.apply(a,d||[]),n()}function n(){for(var t,e=0;e<a.length;e++){for(var n=a[e],i=!0,o=1;o<n.length;o++){var c=n[o];0!==s[c]&&(i=!1)}i&&(a.splice(e--,1),t=r(r.s=n[0]))}return t}var i={},s={index:0},a=[];function r(e){if(i[e])return i[e].exports;var n=i[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=i,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="";var o=window["webpackJsonp"]=window["webpackJsonp"]||[],c=o.push.bind(o);o.push=e,o=o.slice();for(var d=0;d<o.length;d++)e(o[d]);var l=c;a.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("c31f")},"01be":function(t,e,n){},"0484":function(t,e,n){},"04f4":function(t,e,n){"use strict";n("de97")},"0e15":function(t,e,n){"use strict";n("d5e9")},1179:function(t,e,n){},16636:function(t,e,n){"use strict";n("e706")},"1c18":function(t,e,n){},"1e45":function(t,e,n){"use strict";n("e021")},3423:function(t,e,n){"use strict";n("4942")},3550:function(t,e,n){},"436f":function(t,e,n){"use strict";n("1179")},"476d":function(t,e,n){"use strict";n("9c51")},4942:function(t,e,n){},"49c2":function(t,e,n){"use strict";n("5d33")},"4c4e":function(t,e,n){},"4d21":function(t,e,n){"use strict";n("1c18")},"5d33":function(t,e,n){},"6a2b":function(t,e,n){},"909e":function(t,e,n){"use strict";n("0484")},9224:function(t){t.exports=JSON.parse('{"name":"lemon-imui","version":"1.6.5","main":"dist/index.umd.min.js","description":"基于 VUE2.0 的 IM 聊天组件","homepage":"https://github.com/fanjyy/lemon-imui","repository":{"type":"git","url":"git+https://github.com/fanjyy/lemon-imui.git"},"scripts":{"serve":"vue-cli-service serve","build":"vue-cli-service build --target lib --name index packages/index.js","build-examples":"vue-cli-service build --dest examples/dist examples/main.js","lint":"vue-cli-service lint"},"dependencies":{"vue":"^2.6.10"},"devDependencies":{"@vue/cli-plugin-babel":"^3.6.0","@vue/cli-plugin-eslint":"^3.6.0","@vue/cli-service":"^3.6.0","@vue/eslint-config-prettier":"^4.0.1","babel-eslint":"^10.0.2","eslint":"^5.16.0","eslint-plugin-vue":"^5.2.3","stylus":"^0.54.5","stylus-loader":"^3.0.2","vue-template-compiler":"^2.5.21"},"author":"fanjun","license":"MIT"}')},"9b01":function(t,e,n){"use strict";n("aa55")},"9c51":function(t,e,n){},"9c9b":function(t,e,n){"use strict";n("dbd8")},aa55:function(t,e,n){},c31f:function(t,e,n){"use strict";n.r(e);n("25ba"),n("5f1c"),n("6ba0"),n("b47f");var i=n("a593"),s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[n("div",{staticClass:"scroll-top",on:{click:t.scrollToTop}},[t._v("🚀")]),n("div",{staticClass:"logo"},[n("div",{staticClass:"logo-text"},[n("b",[t._v("Lemon")]),t._v(" IMUI"),n("span",{staticClass:"logo-badge"},[t._v(t._s(this.packageData.version))])]),n("div",{staticClass:"logo-sub"},[t._v(t._s(this.packageData.description))]),t._m(0),n("br"),t._m(1),t._m(2)]),n("div",{staticClass:"imui-center"},[n("lemon-imui",{ref:"IMUI",attrs:{user:t.user,contextmenu:t.contextmenu,"contact-contextmenu":t.contactContextmenu,theme:t.theme,"hide-menu":t.hideMenu,"hide-menu-avatar":t.hideMenuAvatar,"hide-message-name":t.hideMessageName,"hide-message-time":t.hideMessageTime},on:{"change-menu":t.handleChangeMenu,"change-contact":t.handleChangeContact,"pull-messages":t.handlePullMessages,"message-click":t.handleMessageClick,"menu-avatar-click":t.handleMenuAvatarClick,send:t.handleSend},scopedSlots:t._u([{key:"cover",fn:function(){return[n("div",{staticClass:"cover"},[n("i",{staticClass:"lemon-icon-message"}),n("p",[n("b",[t._v("自定义封面 Lemon")]),t._v(" IMUI")])])]},proxy:!0},{key:"message-title",fn:function(e){return[n("span",[t._v(t._s(e.displayName))]),n("small",{staticClass:"more",on:{click:function(n){return t.changeDrawer(e,t.$refs.IMUI)}}},[t._v(t._s(t.$refs.IMUI&&t.$refs.IMUI.drawerVisible?"关闭":"打开")+"抽屉")])]}}])}),n("a",{staticStyle:{"font-size":"14px"},attrs:{target:"_blank",href:"https://codesandbox.io/s/sweet-chaplygin-s24mb?fontsize=14&hidenavigation=1&theme=dark"}},[t._v(Line truncated
|
||||
(function(t){function e(e){for(var i,r,o=e[0],c=e[1],d=e[2],u=0,m=[];u<o.length;u++)r=o[u],Object.prototype.hasOwnProperty.call(s,r)&&s[r]&&m.push(s[r][0]),s[r]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(t[i]=c[i]);l&&l(e);while(m.length)m.shift()();return a.push.apply(a,d||[]),n()}function n(){for(var t,e=0;e<a.length;e++){for(var n=a[e],i=!0,o=1;o<n.length;o++){var c=n[o];0!==s[c]&&(i=!1)}i&&(a.splice(e--,1),t=r(r.s=n[0]))}return t}var i={},s={index:0},a=[];function r(e){if(i[e])return i[e].exports;var n=i[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=i,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="";var o=window["webpackJsonp"]=window["webpackJsonp"]||[],c=o.push.bind(o);o.push=e,o=o.slice();for(var d=0;d<o.length;d++)e(o[d]);var l=c;a.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("c31f")},"01be":function(t,e,n){},"0484":function(t,e,n){},"04f4":function(t,e,n){"use strict";n("de97")},"0e15":function(t,e,n){"use strict";n("d5e9")},1179:function(t,e,n){},16636:function(t,e,n){"use strict";n("e706")},"1c18":function(t,e,n){},"1e45":function(t,e,n){"use strict";n("e021")},3423:function(t,e,n){"use strict";n("4942")},3550:function(t,e,n){},"436f":function(t,e,n){"use strict";n("1179")},"476d":function(t,e,n){"use strict";n("9c51")},4942:function(t,e,n){},"49c2":function(t,e,n){"use strict";n("5d33")},"4c4e":function(t,e,n){},"4d21":function(t,e,n){"use strict";n("1c18")},"5d33":function(t,e,n){},"6a2b":function(t,e,n){},"909e":function(t,e,n){"use strict";n("0484")},9224:function(t){t.exports=JSON.parse('{"name":"lemon-imui","version":"1.6.6","main":"dist/index.umd.min.js","description":"基于 VUE2.0 的 IM 聊天组件","homepage":"http://june000.gitee.io/lemon-im/","keywords":["vue","im","chat","vueim","vuechat","webim","webchat"],"repository":{"type":"git","url":"git+https://github.com/fanjyy/lemon-imui.git"},"scripts":{"serve":"vue-cli-service serve","build":"vue-cli-service build --target lib --name index packages/index.js","build-examples":"vue-cli-service build --dest examples/dist examples/main.js","lint":"vue-cli-service lint"},"dependencies":{"vue":"^2.6.10"},"devDependencies":{"@vue/cli-plugin-babel":"^3.6.0","@vue/cli-plugin-eslint":"^3.6.0","@vue/cli-service":"^3.6.0","@vue/eslint-config-prettier":"^4.0.1","babel-eslint":"^10.0.2","eslint":"^5.16.0","eslint-plugin-vue":"^5.2.3","stylus":"^0.54.5","stylus-loader":"^3.0.2","vue-template-compiler":"^2.5.21"},"author":"fanjun","license":"MIT"}')},"9b01":function(t,e,n){"use strict";n("aa55")},"9c51":function(t,e,n){},"9c9b":function(t,e,n){"use strict";n("dbd8")},aa55:function(t,e,n){},c31f:function(t,e,n){"use strict";n.r(e);n("25ba"),n("5f1c"),n("6ba0"),n("b47f");var i=n("a593"),s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[n("div",{staticClass:"scroll-top",on:{click:t.scrollToTop}},[t._v("🚀")]),n("div",{staticClass:"logo"},[n("div",{staticClass:"logo-text"},[n("b",[t._v("Lemon")]),t._v(" IMUI"),n("span",{staticClass:"logo-badge"},[t._v(t._s(this.packageData.version))])]),n("div",{staticClass:"logo-sub"},[t._v(t._s(this.packageData.description))]),t._m(0),n("br"),t._m(1),t._m(2)]),n("div",{staticClass:"imui-center"},[n("lemon-imui",{ref:"IMUI",attrs:{user:t.user,contextmenu:t.contextmenu,"contact-contextmenu":t.contactContextmenu,theme:t.theme,"hide-menu":t.hideMenu,"hide-menu-avatar":t.hideMenuAvatar,"hide-message-name":t.hideMessageName,"hide-message-time":t.hideMessageTime},on:{"change-menu":t.handleChangeMenu,"change-contact":t.handleChangeContact,"pull-messages":t.handlePullMessages,"message-click":t.handleMessageClick,"menu-avatar-click":t.handleMenuAvatarClick,send:t.handleSend},scopedSlots:t._u([{key:"cover",fn:function(){return[n("div",{staticClass:"cover"},[n("i",{staticClass:"lemon-icon-message"}),n("p",[n("b",[t._v("自定义封面 Lemon")]),t._v(" IMUI")])])]},proxy:!0},{key:"message-title",fn:function(e){return[n("span",[t._v(t._s(e.displayName))]),n("small",{staticClass:"more",on:{click:function(n){return t.changeDrawer(e,t.$refs.IMUI)}}},[t._v(t._s(t.$refs.IMUI&&t.$refs.IMUI.drawerVisible?"关闭":"打开")+"抽屉")])]}}])}),n("a",{staticStyle:{"font-size":"14px"},attrs:{target:"_blank",href:"https://codesandbox.io/s/sweet-c
Line truncated
|
||||
+11
-2
@@ -1,9 +1,18 @@
|
||||
{
|
||||
"name": "lemon-imui",
|
||||
"version": "1.6.5",
|
||||
"version": "1.6.6",
|
||||
"main": "dist/index.umd.min.js",
|
||||
"description": "基于 VUE2.0 的 IM 聊天组件",
|
||||
"homepage": "https://github.com/fanjyy/lemon-imui",
|
||||
"homepage": "http://june000.gitee.io/lemon-im/",
|
||||
"keywords": [
|
||||
"vue",
|
||||
"im",
|
||||
"chat",
|
||||
"vueim",
|
||||
"vuechat",
|
||||
"webim",
|
||||
"webchat"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/fanjyy/lemon-imui.git"
|
||||
|
||||
@@ -587,6 +587,37 @@ export default {
|
||||
messageViewToBottom() {
|
||||
this.$refs.messages.scrollToBottom();
|
||||
},
|
||||
/**
|
||||
* 设置联系人的草稿信息
|
||||
*/
|
||||
setDraft(contactId, editorValue) {
|
||||
if (isEmpty(contactId) || isEmpty(editorValue)) return false;
|
||||
const contact = this.findContact(contactId);
|
||||
if (isEmpty(contact)) return false;
|
||||
this.CacheDraft.set(contactId, {
|
||||
editorValue: editorValue,
|
||||
lastContent: contact.lastContent
|
||||
});
|
||||
this.updateContact({
|
||||
id: contactId,
|
||||
lastContent: `<span style="color:red;">[草稿]</span><span>${this.lastContentRender(
|
||||
{ type: "text", content: editorValue }
|
||||
)}</span>`
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 清空联系人草稿信息
|
||||
*/
|
||||
clearDraft(contactId) {
|
||||
const draft = this.CacheDraft.get(contactId);
|
||||
if (draft) {
|
||||
this.updateContact({
|
||||
id: contactId,
|
||||
lastContent: draft.lastContent
|
||||
});
|
||||
this.CacheDraft.remove(contactId);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 改变聊天对象
|
||||
* @param contactId 联系人 id
|
||||
@@ -598,19 +629,15 @@ export default {
|
||||
if (this._changeContactLock || this.currentContactId == contactId)
|
||||
return false;
|
||||
}
|
||||
const prevCurrentContactId = this.currentContactId;
|
||||
|
||||
//保存上个聊天目标的草稿
|
||||
if (prevCurrentContactId) {
|
||||
if (this.currentContactId) {
|
||||
const editorValue = this.getEditorValue();
|
||||
if (editorValue) {
|
||||
this.CacheDraft.set(prevCurrentContactId, editorValue);
|
||||
this.updateContact({
|
||||
id: prevCurrentContactId,
|
||||
lastContent: `<span style="color:red;">[草稿]</span><span>${this.lastContentRender(
|
||||
{ type: "text", content: editorValue }
|
||||
)}</span>`
|
||||
});
|
||||
this.setEditorValue("");
|
||||
this.setDraft(this.currentContactId, editorValue);
|
||||
this.setEditorValue();
|
||||
} else {
|
||||
this.clearDraft(this.currentContactId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,8 +649,8 @@ export default {
|
||||
return;
|
||||
}
|
||||
//填充草稿内容
|
||||
const draft = this.CacheDraft.get(contactId) || "";
|
||||
if (draft) this.setEditorValue(draft);
|
||||
const draft = this.CacheDraft.get(contactId);
|
||||
if (draft) this.setEditorValue(draft.editorValue);
|
||||
|
||||
if (this.CacheMessageLoaded.has(contactId)) {
|
||||
this.$refs.messages.loaded();
|
||||
@@ -890,7 +917,7 @@ export default {
|
||||
getCurrentMessages() {
|
||||
return this.currentMessages;
|
||||
},
|
||||
setEditorValue(val) {
|
||||
setEditorValue(val = "") {
|
||||
if (!isString(val)) return false;
|
||||
this.$refs.editor.setValue(this.emojiNameToImage(val));
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user