@ljhy/smallwei-avue-benteng 3.4.65 → 3.4.67
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/avue.js +14 -3
- package/package.json +1 -1
package/lib/avue.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Avue.js v3.4.
|
2
|
+
* Avue.js v3.4.67
|
3
3
|
* (c) 2017-2024 Smallwei
|
4
4
|
* Released under the MIT License.
|
5
5
|
*
|
@@ -550,7 +550,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
550
550
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
551
551
|
|
552
552
|
"use strict";
|
553
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\");\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_create__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/create */ \"./src/core/create.js\");\n/* harmony import */ var core_locale__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core/locale */ \"./src/core/locale.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(core_create__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n name: \"chat\",\n mixins: [core_locale__WEBPACK_IMPORTED_MODULE_2__[\"default\"]],\n data: function data() {\n return {\n // 添加一个临时变量用于存储正在构建的消息\n currentNonMineMessage: null,\n upload: {\n box: false,\n src: \"\",\n type: '',\n title: ''\n },\n visible: false,\n imgSrc: '',\n videoSrc: '',\n audioSrc: '',\n keys: \"\",\n show: false\n };\n },\n props: {\n size: String,\n beforeOpen: Function,\n tools: {\n type: Object,\n \"default\": function _default() {\n return {\n img: true,\n video: true,\n file: true\n };\n }\n },\n placeholder: {\n type: String,\n \"default\": '有问题尽管问我'\n },\n width: {\n type: [String, Number],\n \"default\": 320\n },\n height: {\n type: [String, Number],\n \"default\": 520\n },\n modelValue: {\n type: String\n },\n notice: {\n type: Boolean,\n \"default\": true\n },\n audio: {\n type: Array,\n \"default\": function _default() {\n return ['https://www.helloweba.net/demo/notifysound/notify.ogg', 'https://www.helloweba.net/demo/notifysound/notify.mp3', 'https://www.helloweba.net/demo/notifysound/notify.wav'];\n }\n },\n config: {\n type: Object,\n \"default\": function _default() {\n return {};\n }\n },\n keylist: {\n type: Array,\n \"default\": function _default() {\n return [];\n }\n },\n list: {\n type: Array,\n \"default\": function _default() {\n return [];\n }\n }\n },\n computed: {\n msg: {\n get: function get() {\n return this.modelValue;\n },\n set: function set(val) {\n this.$emit('update:modelValue', val);\n this.$emit('change', val);\n }\n },\n heightStyleName: function heightStyleName() {\n return {\n height: this.setPx(this.height)\n };\n },\n widthStyleName: function widthStyleName() {\n return {\n width: this.setPx(this.width)\n };\n },\n msgActive: function msgActive() {\n return !this.validatenull(this.msg.replace(/[\\r\\n]/g, \"\"));\n }\n },\n methods: {\n uploadSubmit: function uploadSubmit() {\n var _this = this;\n this.$refs.form.validate(function (valid) {\n if (valid) {\n _this.upload.box = false;\n _this.$emit('submit', _this.getDetail(_this.upload));\n }\n });\n },\n handleUpload: function handleUpload(type) {\n this.upload.type = type;\n this.upload.src = '';\n if (type === 'img') {\n this.upload.title = \"图片上传\";\n } else if (type === 'video') {\n this.upload.title = \"视频上传\";\n } else if (type === 'file') {\n this.upload.title = \"文件上传\";\n }\n this.upload.box = true;\n },\n handleClose: function handleClose(done) {\n this.imgSrc = undefined;\n this.videoSrc = undefined;\n this.audioSrc = undefined;\n done();\n },\n addKey: function addKey() {\n if (this.keys !== '') {\n this.$emit('keyadd', this.keys);\n this.keys = '';\n }\n this.visible = false;\n },\n sendKey: function sendKey(key) {\n this.$emit('keysend', key);\n },\n getAudio: function getAudio() {\n this.$refs.chatAudio.play();\n },\n getNotification: function getNotification(text) {\n var safe = this;\n var NotificationInstance = Notification || window.Notification;\n if (!!NotificationInstance) {\n var setPermission = function setPermission() {\n //请求获取通知权限\n NotificationInstance.requestPermission(function (PERMISSION) {\n if (PERMISSION === 'granted') {\n CreatNotification();\n } else {\n console.log('用户无情残忍的拒绝了你!!!');\n }\n });\n };\n var CreatNotification = function CreatNotification() {\n var n = new Notification(safe.config.name, {\n body: text,\n icon: safe.config.img\n });\n n.onshow = function () {\n safe.getAudio();\n setTimeout(function () {\n n.close();\n }, 2500);\n };\n n.onclick = function (e) {\n n.close();\n };\n };\n var permissionNow = NotificationInstance.permission;\n if (permissionNow === 'granted') {\n //允许通知\n CreatNotification();\n } else if (permissionNow === 'denied') {\n console.log('用户拒绝了你!!!');\n } else {\n setPermission();\n }\n }\n },\n //mine为'我'的对话\n //text为内容\n pushMsg: function pushMsg() {\n var _this2 = this;\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var mine = params.mine === true ? true : false;\n var text = params.text || {};\n var date = params.date;\n var textObj = {\n date: date || dayjs__WEBPACK_IMPORTED_MODULE_3___default()().format('YYYY-MM-DD HH:mm:ss'),\n text: function () {\n if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(text) != 'object') {\n return {\n text: text\n };\n }\n return text;\n }(),\n mine: mine,\n img: mine ? this.config.myImg : this.config.img,\n name: mine ? this.config.myName : this.config.name\n };\n this.list.push(textObj);\n setTimeout(function () {\n _this2.setScroll();\n }, 50);\n },\n // pushMsg (params = {}) {\n // const mine = params.mine === true ? true : false;\n // const text = params.text || {};\n // const date = params.date\n // const textObj = {\n // date: date || dayjs().format('YYYY-MM-DD HH:mm:ss'),\n // text: (() => {\n // if (typeof (text) != 'object') {\n // return {\n // text: text\n // }\n // }\n // return text\n // })(),\n // mine: mine,\n // img: mine ? this.config.myImg : this.config.img,\n // name: mine ? this.config.myName : this.config.name,\n // }\n //\n //\n // if (!textObj.mine) {\n // console.log('textObj', textObj)\n // let currentText = '';\n // for (let i = 0; i < textObj.text.text.length; i++) {\n // currentText += textObj.text.text[i];\n // const charObj = Object.assign({}, textObj, {text: {text: currentText}});\n // this.list.push(charObj);\n // }\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // } else {\n // this.list.push(textObj)\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // }\n //\n //\n // },\n // pushMsg (params = {}) {\n // const mine = params.mine === true ? true : false;\n // const text = params.text || {};\n // const date = params.date\n // const textObj = {\n // date: date || dayjs().format('YYYY-MM-DD HH:mm:ss'),\n // text: (() => {\n // if (typeof (text) != 'object') {\n // return {\n // text: text\n // }\n // }\n // return text\n // })(),\n // mine: mine,\n // img: mine ? this.config.myImg : this.config.img,\n // name: mine ? this.config.myName : this.config.name,\n // }\n //\n //\n // if (!textObj.mine) {\n // console.log('textObj', textObj)\n // let currentText = '';\n // for (let i = 0; i < textObj.text.text.length; i++) {\n // currentText += textObj.text.text[i];\n // const charObj = Object.assign({}, textObj, {text: {text: currentText}});\n // this.list.push(charObj);\n // }\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // } else {\n // this.list.push(textObj)\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // }\n //\n //\n // },\n // pushMsg(params) {\n // const mine = params.mine === true ? true : false;\n // const text = params.text || {};\n // const date = params.date\n // const textObj = {\n // date: date || dayjs().format('YYYY-MM-DD HH:mm:ss'),\n // text: (() => {\n // if (typeof (text) != 'object') {\n // return {\n // text: text\n // }\n // }\n // return text\n // })(),\n // mine: mine,\n // img: mine ? this.config.myImg : this.config.img,\n // name: mine ? this.config.myName : this.config.name,\n // }\n //\n // if (!params.mine) { // 只有非\"我\"的消息才使用流式展示\n // let index = 0;\n // const textArray = params.text.text.split('');\n //\n // // 初始化当前非\"我\"的消息对象\n // console.log('currentNonMineMessage1', this.currentNonMineMessage)\n // if (!this.currentNonMineMessage) {\n // this.currentNonMineMessage = {\n // mine: false,\n // text: '',\n // name: textObj.name,\n // img: textObj.img,\n // date: textObj.date,\n // };\n // console.log('currentNonMineMessage2', this.currentNonMineMessage)\n //\n // }\n //\n // const displayText = () => {\n // console.log('displayText')\n // if (index < textArray.length) {\n // console.log('index', index)\n // this.currentNonMineMessage.text += textArray[index];\n // console.log('currentNonMineMessage3', this.currentNonMineMessage)\n // index++;\n // this.list.push(this.currentNonMineMessage)\n // requestAnimationFrame(displayText);\n // } else {\n // // 所有字符展示完毕后,将完整的消息对象添加到list中\n // // this.list.push(this.currentNonMineMessage);\n // console.log('this.list', this.list)\n // // this.currentNonMineMessage = null; // 清空临时消息对象\n // // this.setScroll(); // 调整滚动条位置\n // }\n // };\n // displayText();\n // } else {\n // // 对于\"我\"的消息,直接添加到list中\n // this.list.push(textObj);\n // this.setScroll();\n // }\n // },\n clearStreamDisplay: function clearStreamDisplay() {\n if (this.streamDisplayTimeout !== null) {\n cancelAnimationFrame(this.streamDisplayTimeout);\n this.streamDisplayTimeout = null;\n }\n },\n beforeDestroy: function beforeDestroy() {\n this.clearStreamDisplay();\n },\n setScroll: function setScroll(count) {\n var _this3 = this;\n //滚动条一直处于下方\n this.$nextTick(function () {\n _this3.$refs.main.scrollTop = count || _this3.$refs.main.scrollHeight;\n });\n },\n //用户主动发送\n handleSend: function handleSend() {\n if (this.msgActive) {\n this.$emit('submit');\n }\n },\n //选择列表\n handleItemMsg: function handleItemMsg(item) {\n this.$emit('submit', item.ask);\n },\n //处理排版\n handleDetail: function handleDetail() {\n var _this4 = this;\n var html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var result = html;\n setTimeout(function () {\n var list = _this4.$refs.content || [];\n list.forEach(function (ele) {\n var _loop = function _loop() {\n var child = ele.children[i];\n if (child.getAttribute('data-flag') != 0) {\n child.setAttribute('data-flag', 0);\n child.onclick = function () {\n _this4.handleEvent(child.dataset);\n };\n if (child.tagName === 'IMG') {\n child.className = 'web__msg--img';\n child.src = child.getAttribute('data-src');\n } else if (child.tagName === 'VIDEO') {\n child.className = 'web__msg--video';\n child.src = child.getAttribute('data-src');\n } else if (child.tagName === 'AUDIO') {\n child.className = 'web__msg--audio';\n child.controls = 'controls';\n child.src = child.getAttribute('data-src');\n } else if (child.tagName === 'FILE') {\n child.className = 'web__msg--file';\n child.innerHTML = \"<h2>File</h2><span>\".concat(child.getAttribute('data-name'), \"</span>\");\n } else if (child.tagName === 'MAP') {\n child.className = 'web__msg--file web__msg--map';\n child.innerHTML = \"<h2>Map</h2><span>\".concat(child.getAttribute('data-longitude'), \" , \").concat(child.getAttribute('data-latitude'), \"<br />\").concat(child.getAttribute('data-address'), \"</span>\");\n }\n _this4.setScroll();\n }\n };\n for (var i = 0; i < ele.children.length; i++) {\n _loop();\n }\n });\n }, 0);\n return result;\n },\n getDetail: function getDetail() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var type = params.type,\n src = params.src,\n name = params.name,\n longitude = params.longitude,\n latitude = params.latitude,\n address = params.address;\n if (type === 'img') {\n return \"<img data-type=\\\"IMG\\\" data-src=\\\"\".concat(src, \"\\\" />\");\n } else if (type === 'video') {\n return \"<video data-type=\\\"VIDEO\\\" data-src=\\\"\".concat(src, \"\\\"></video>\");\n } else if (type === 'audio') {\n return \"<audio data-type=\\\"AUDIO\\\" data-src=\\\"\".concat(src, \"\\\"></audio>\");\n } else if (type === 'file') {\n return \"<file data-type=\\\"FILE\\\" data-name=\\\"\".concat(name, \"\\\" data-src=\\\"\").concat(src, \"\\\"></file>\");\n } else if (type === 'map') {\n return \"<map data-type=\\\"MAP\\\" data-src=\\\"\".concat(src, \"\\\" data-address=\\\"\").concat(address, \" \\\"data-latitude=\\\"\").concat(latitude, \"\\\" data-longitude=\\\"\").concat(longitude, \"\\\"></map>\");\n }\n },\n //处理事件\n handleEvent: function handleEvent(params) {\n var _this5 = this;\n var callback = function callback() {\n if (params.type === 'IMG') {\n _this5.imgSrc = params.src;\n _this5.show = true;\n } else if (params.type === 'VIDEO') {\n _this5.videoSrc = params.src;\n _this5.show = true;\n } else if (params.type === 'AUDIO') {\n _this5.audioSrc = params.src;\n _this5.show = true;\n } else if (params.type === 'FILE') {\n window.open(params.src);\n }\n };\n if (typeof this.beforeOpen === 'function') {\n this.beforeOpen(params, callback);\n } else {\n callback();\n }\n },\n rootSendMsg: function rootSendMsg(msg) {\n console.log('msg', msg);\n console.log('this.notice', this.notice);\n this.pushMsg({\n text: msg\n });\n if (this.notice) {\n this.getNotification(msg.text || msg);\n }\n },\n displayMessageCharByChar: function displayMessageCharByChar(message) {\n var _this6 = this;\n var index = 0;\n var messageElement = document.createElement('div');\n messageElement.classList.add('message-bubble');\n var intervalId = setInterval(function () {\n if (index < message.length) {\n messageElement.textContent += message[index];\n console.log('messageElement.textContent', messageElement.textContent);\n index++;\n } else {\n clearInterval(intervalId);\n _this6.$nextTick(function () {\n _this6.$refs.main.appendChild(messageElement);\n _this6.setScroll();\n });\n }\n }, 100); // 这里的数字是字符显示间隔时间,单位是毫秒,可以根据需要调整\n }\n }\n}));\n\n//# sourceURL=webpack://AVUE/./packages/element-ui/chat/index.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/dist??ref--1");
|
553
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\");\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_create__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/create */ \"./src/core/create.js\");\n/* harmony import */ var core_locale__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core/locale */ \"./src/core/locale.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var marked__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! marked */ \"./node_modules/marked/lib/marked.umd.js\");\n/* harmony import */ var marked__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(marked__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(core_create__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n name: \"chat\",\n mixins: [core_locale__WEBPACK_IMPORTED_MODULE_2__[\"default\"]],\n data: function data() {\n return {\n // 添加一个临时变量用于存储正在构建的消息\n currentNonMineMessage: null,\n upload: {\n box: false,\n src: \"\",\n type: '',\n title: ''\n },\n visible: false,\n imgSrc: '',\n videoSrc: '',\n audioSrc: '',\n keys: \"\",\n show: false\n };\n },\n props: {\n size: String,\n beforeOpen: Function,\n tools: {\n type: Object,\n \"default\": function _default() {\n return {\n img: true,\n video: true,\n file: true\n };\n }\n },\n placeholder: {\n type: String,\n \"default\": '有问题尽管问我'\n },\n width: {\n type: [String, Number],\n \"default\": 320\n },\n height: {\n type: [String, Number],\n \"default\": 520\n },\n modelValue: {\n type: String\n },\n notice: {\n type: Boolean,\n \"default\": true\n },\n audio: {\n type: Array,\n \"default\": function _default() {\n return ['https://www.helloweba.net/demo/notifysound/notify.ogg', 'https://www.helloweba.net/demo/notifysound/notify.mp3', 'https://www.helloweba.net/demo/notifysound/notify.wav'];\n }\n },\n config: {\n type: Object,\n \"default\": function _default() {\n return {};\n }\n },\n keylist: {\n type: Array,\n \"default\": function _default() {\n return [];\n }\n },\n list: {\n type: Array,\n \"default\": function _default() {\n return [];\n }\n }\n },\n computed: {\n msg: {\n get: function get() {\n return this.modelValue;\n },\n set: function set(val) {\n this.$emit('update:modelValue', val);\n this.$emit('change', val);\n }\n },\n heightStyleName: function heightStyleName() {\n return {\n height: this.setPx(this.height)\n };\n },\n widthStyleName: function widthStyleName() {\n return {\n width: this.setPx(this.width)\n };\n },\n msgActive: function msgActive() {\n return !this.validatenull(this.msg.replace(/[\\r\\n]/g, \"\"));\n }\n },\n methods: {\n uploadSubmit: function uploadSubmit() {\n var _this = this;\n this.$refs.form.validate(function (valid) {\n if (valid) {\n _this.upload.box = false;\n _this.$emit('submit', _this.getDetail(_this.upload));\n }\n });\n },\n handleUpload: function handleUpload(type) {\n this.upload.type = type;\n this.upload.src = '';\n if (type === 'img') {\n this.upload.title = \"图片上传\";\n } else if (type === 'video') {\n this.upload.title = \"视频上传\";\n } else if (type === 'file') {\n this.upload.title = \"文件上传\";\n }\n this.upload.box = true;\n },\n handleClose: function handleClose(done) {\n this.imgSrc = undefined;\n this.videoSrc = undefined;\n this.audioSrc = undefined;\n done();\n },\n addKey: function addKey() {\n if (this.keys !== '') {\n this.$emit('keyadd', this.keys);\n this.keys = '';\n }\n this.visible = false;\n },\n sendKey: function sendKey(key) {\n this.$emit('keysend', key);\n },\n getAudio: function getAudio() {\n this.$refs.chatAudio.play();\n },\n getNotification: function getNotification(text) {\n var safe = this;\n var NotificationInstance = Notification || window.Notification;\n if (!!NotificationInstance) {\n var setPermission = function setPermission() {\n //请求获取通知权限\n NotificationInstance.requestPermission(function (PERMISSION) {\n if (PERMISSION === 'granted') {\n CreatNotification();\n } else {\n console.log('用户无情残忍的拒绝了你!!!');\n }\n });\n };\n var CreatNotification = function CreatNotification() {\n var n = new Notification(safe.config.name, {\n body: text,\n icon: safe.config.img\n });\n n.onshow = function () {\n safe.getAudio();\n setTimeout(function () {\n n.close();\n }, 2500);\n };\n n.onclick = function (e) {\n n.close();\n };\n };\n var permissionNow = NotificationInstance.permission;\n if (permissionNow === 'granted') {\n //允许通知\n CreatNotification();\n } else if (permissionNow === 'denied') {\n console.log('用户拒绝了你!!!');\n } else {\n setPermission();\n }\n }\n },\n //mine为'我'的对话\n //text为内容\n pushMsg: function pushMsg() {\n var _this2 = this;\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var mine = params.mine === true ? true : false;\n var text = params.text || {};\n var date = params.date;\n var haveSameKey = false;\n console.log('pushMsg, this.list: ', this.list);\n console.log('pushMsg, format this.list 1: ', marked__WEBPACK_IMPORTED_MODULE_4___default.a.parse(this.list.map(function (v) {\n return v.text.text;\n }).join('\\n')));\n console.log('pushMsg, format this.list 2: ', marked__WEBPACK_IMPORTED_MODULE_4___default.a.parse(this.list.map(function (v) {\n return v.text.text;\n })));\n this.list.forEach(function (v) {\n if (params.key === v.key && !mine) {\n haveSameKey = true;\n if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(text) != 'object') {\n v.text = {\n text: text\n };\n } else {\n v.text = text;\n }\n }\n });\n if (!haveSameKey) {\n var textObj = {\n date: date || dayjs__WEBPACK_IMPORTED_MODULE_3___default()().format('YYYY-MM-DD HH:mm:ss'),\n text: function () {\n if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(text) != 'object') {\n return {\n text: text\n };\n }\n return text;\n }(),\n mine: mine,\n img: mine ? this.config.myImg : this.config.img,\n name: mine ? this.config.myName : this.config.name,\n key: params.key\n };\n this.list.push(textObj);\n }\n // console.log('pushMsg',this.list,params)\n setTimeout(function () {\n _this2.setScroll();\n }, 50);\n },\n // pushMsg (params = {}) {\n // const mine = params.mine === true ? true : false;\n // const text = params.text || {};\n // const date = params.date\n // const textObj = {\n // date: date || dayjs().format('YYYY-MM-DD HH:mm:ss'),\n // text: (() => {\n // if (typeof (text) != 'object') {\n // return {\n // text: text\n // }\n // }\n // return text\n // })(),\n // mine: mine,\n // img: mine ? this.config.myImg : this.config.img,\n // name: mine ? this.config.myName : this.config.name,\n // }\n //\n //\n // if (!textObj.mine) {\n // console.log('textObj', textObj)\n // let currentText = '';\n // for (let i = 0; i < textObj.text.text.length; i++) {\n // currentText += textObj.text.text[i];\n // const charObj = Object.assign({}, textObj, {text: {text: currentText}});\n // this.list.push(charObj);\n // }\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // } else {\n // this.list.push(textObj)\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // }\n //\n //\n // },\n // pushMsg (params = {}) {\n // const mine = params.mine === true ? true : false;\n // const text = params.text || {};\n // const date = params.date\n // const textObj = {\n // date: date || dayjs().format('YYYY-MM-DD HH:mm:ss'),\n // text: (() => {\n // if (typeof (text) != 'object') {\n // return {\n // text: text\n // }\n // }\n // return text\n // })(),\n // mine: mine,\n // img: mine ? this.config.myImg : this.config.img,\n // name: mine ? this.config.myName : this.config.name,\n // }\n //\n //\n // if (!textObj.mine) {\n // console.log('textObj', textObj)\n // let currentText = '';\n // for (let i = 0; i < textObj.text.text.length; i++) {\n // currentText += textObj.text.text[i];\n // const charObj = Object.assign({}, textObj, {text: {text: currentText}});\n // this.list.push(charObj);\n // }\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // } else {\n // this.list.push(textObj)\n // setTimeout(() => {\n // this.setScroll();\n // }, 50)\n // }\n //\n //\n // },\n // pushMsg(params) {\n // const mine = params.mine === true ? true : false;\n // const text = params.text || {};\n // const date = params.date\n // const textObj = {\n // date: date || dayjs().format('YYYY-MM-DD HH:mm:ss'),\n // text: (() => {\n // if (typeof (text) != 'object') {\n // return {\n // text: text\n // }\n // }\n // return text\n // })(),\n // mine: mine,\n // img: mine ? this.config.myImg : this.config.img,\n // name: mine ? this.config.myName : this.config.name,\n // }\n //\n // if (!params.mine) { // 只有非\"我\"的消息才使用流式展示\n // let index = 0;\n // const textArray = params.text.text.split('');\n //\n // // 初始化当前非\"我\"的消息对象\n // console.log('currentNonMineMessage1', this.currentNonMineMessage)\n // if (!this.currentNonMineMessage) {\n // this.currentNonMineMessage = {\n // mine: false,\n // text: '',\n // name: textObj.name,\n // img: textObj.img,\n // date: textObj.date,\n // };\n // console.log('currentNonMineMessage2', this.currentNonMineMessage)\n //\n // }\n //\n // const displayText = () => {\n // console.log('displayText')\n // if (index < textArray.length) {\n // console.log('index', index)\n // this.currentNonMineMessage.text += textArray[index];\n // console.log('currentNonMineMessage3', this.currentNonMineMessage)\n // index++;\n // this.list.push(this.currentNonMineMessage)\n // requestAnimationFrame(displayText);\n // } else {\n // // 所有字符展示完毕后,将完整的消息对象添加到list中\n // // this.list.push(this.currentNonMineMessage);\n // console.log('this.list', this.list)\n // // this.currentNonMineMessage = null; // 清空临时消息对象\n // // this.setScroll(); // 调整滚动条位置\n // }\n // };\n // displayText();\n // } else {\n // // 对于\"我\"的消息,直接添加到list中\n // this.list.push(textObj);\n // this.setScroll();\n // }\n // },\n clearStreamDisplay: function clearStreamDisplay() {\n if (this.streamDisplayTimeout !== null) {\n cancelAnimationFrame(this.streamDisplayTimeout);\n this.streamDisplayTimeout = null;\n }\n },\n beforeDestroy: function beforeDestroy() {\n this.clearStreamDisplay();\n },\n setScroll: function setScroll(count) {\n var _this3 = this;\n //滚动条一直处于下方\n this.$nextTick(function () {\n _this3.$refs.main.scrollTop = count || _this3.$refs.main.scrollHeight;\n });\n },\n //用户主动发送\n handleSend: function handleSend() {\n if (this.msgActive) {\n this.$emit('submit');\n }\n },\n //选择列表\n handleItemMsg: function handleItemMsg(item) {\n this.$emit('submit', item.ask);\n },\n //处理排版\n handleDetail: function handleDetail() {\n var _this4 = this;\n var html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var markDownToHtml = marked__WEBPACK_IMPORTED_MODULE_4___default.a.parse(html);\n var result = markDownToHtml;\n console.log('html', html);\n console.log('markDownToHtml', markDownToHtml);\n setTimeout(function () {\n var list = _this4.$refs.content || [];\n list.forEach(function (ele) {\n var _loop = function _loop() {\n var child = ele.children[i];\n if (child.getAttribute('data-flag') != 0) {\n child.setAttribute('data-flag', 0);\n child.onclick = function () {\n _this4.handleEvent(child.dataset);\n };\n if (child.tagName === 'IMG') {\n child.className = 'web__msg--img';\n child.src = child.getAttribute('data-src');\n } else if (child.tagName === 'VIDEO') {\n child.className = 'web__msg--video';\n child.src = child.getAttribute('data-src');\n } else if (child.tagName === 'AUDIO') {\n child.className = 'web__msg--audio';\n child.controls = 'controls';\n child.src = child.getAttribute('data-src');\n } else if (child.tagName === 'FILE') {\n child.className = 'web__msg--file';\n child.innerHTML = \"<h2>File</h2><span>\".concat(child.getAttribute('data-name'), \"</span>\");\n } else if (child.tagName === 'MAP') {\n child.className = 'web__msg--file web__msg--map';\n child.innerHTML = \"<h2>Map</h2><span>\".concat(child.getAttribute('data-longitude'), \" , \").concat(child.getAttribute('data-latitude'), \"<br />\").concat(child.getAttribute('data-address'), \"</span>\");\n }\n _this4.setScroll();\n }\n };\n for (var i = 0; i < ele.children.length; i++) {\n _loop();\n }\n });\n }, 0);\n return result;\n },\n getDetail: function getDetail() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var type = params.type,\n src = params.src,\n name = params.name,\n longitude = params.longitude,\n latitude = params.latitude,\n address = params.address;\n if (type === 'img') {\n return \"<img data-type=\\\"IMG\\\" data-src=\\\"\".concat(src, \"\\\" />\");\n } else if (type === 'video') {\n return \"<video data-type=\\\"VIDEO\\\" data-src=\\\"\".concat(src, \"\\\"></video>\");\n } else if (type === 'audio') {\n return \"<audio data-type=\\\"AUDIO\\\" data-src=\\\"\".concat(src, \"\\\"></audio>\");\n } else if (type === 'file') {\n return \"<file data-type=\\\"FILE\\\" data-name=\\\"\".concat(name, \"\\\" data-src=\\\"\").concat(src, \"\\\"></file>\");\n } else if (type === 'map') {\n return \"<map data-type=\\\"MAP\\\" data-src=\\\"\".concat(src, \"\\\" data-address=\\\"\").concat(address, \" \\\"data-latitude=\\\"\").concat(latitude, \"\\\" data-longitude=\\\"\").concat(longitude, \"\\\"></map>\");\n }\n },\n //处理事件\n handleEvent: function handleEvent(params) {\n var _this5 = this;\n var callback = function callback() {\n if (params.type === 'IMG') {\n _this5.imgSrc = params.src;\n _this5.show = true;\n } else if (params.type === 'VIDEO') {\n _this5.videoSrc = params.src;\n _this5.show = true;\n } else if (params.type === 'AUDIO') {\n _this5.audioSrc = params.src;\n _this5.show = true;\n } else if (params.type === 'FILE') {\n window.open(params.src);\n }\n };\n if (typeof this.beforeOpen === 'function') {\n this.beforeOpen(params, callback);\n } else {\n callback();\n }\n },\n rootSendMsg: function rootSendMsg(msg, key) {\n // console.log('msg', msg);\n // console.log('this.notice', this.notice);\n this.pushMsg({\n text: msg,\n key: key\n });\n if (this.notice) {\n this.getNotification(msg.text || msg);\n }\n },\n displayMessageCharByChar: function displayMessageCharByChar(message) {\n var _this6 = this;\n var index = 0;\n var messageElement = document.createElement('div');\n messageElement.classList.add('message-bubble');\n var intervalId = setInterval(function () {\n if (index < message.length) {\n messageElement.textContent += message[index];\n console.log('messageElement.textContent', messageElement.textContent);\n index++;\n } else {\n clearInterval(intervalId);\n _this6.$nextTick(function () {\n _this6.$refs.main.appendChild(messageElement);\n _this6.setScroll();\n });\n }\n }, 100); // 这里的数字是字符显示间隔时间,单位是毫秒,可以根据需要调整\n }\n }\n}));\n\n//# sourceURL=webpack://AVUE/./packages/element-ui/chat/index.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/dist??ref--1");
|
554
554
|
|
555
555
|
/***/ }),
|
556
556
|
|
@@ -1176,6 +1176,17 @@ eval("!function(t,e){ true?module.exports=e():undefined}(this,(function(){\"use
|
|
1176
1176
|
|
1177
1177
|
/***/ }),
|
1178
1178
|
|
1179
|
+
/***/ "./node_modules/marked/lib/marked.umd.js":
|
1180
|
+
/*!***********************************************!*\
|
1181
|
+
!*** ./node_modules/marked/lib/marked.umd.js ***!
|
1182
|
+
\***********************************************/
|
1183
|
+
/*! no static exports found */
|
1184
|
+
/***/ (function(module, exports) {
|
1185
|
+
|
1186
|
+
eval("throw new Error(\"Module parse failed: Unexpected token (253:15)\\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\\n| */\\n| class _Tokenizer {\\n> options;\\n| rules; // set by the lexer\\n| lexer; // set by the lexer\");\n\n//# sourceURL=webpack://AVUE/./node_modules/marked/lib/marked.umd.js?");
|
1187
|
+
|
1188
|
+
/***/ }),
|
1189
|
+
|
1179
1190
|
/***/ "./node_modules/vue-loader/dist/exportHelper.js":
|
1180
1191
|
/*!******************************************************!*\
|
1181
1192
|
!*** ./node_modules/vue-loader/dist/exportHelper.js ***!
|
@@ -5132,7 +5143,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
5132
5143
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
5133
5144
|
|
5134
5145
|
"use strict";
|
5135
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"version\", function() { return version; });\nvar version = '3.4.
|
5146
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"version\", function() { return version; });\nvar version = '3.4.67';\n\n//# sourceURL=webpack://AVUE/./src/version.js?");
|
5136
5147
|
|
5137
5148
|
/***/ }),
|
5138
5149
|
|