diff --git a/public/index.html b/public/index.html index 1636a2c..be0e985 100644 --- a/public/index.html +++ b/public/index.html @@ -14,5 +14,6 @@
+ diff --git a/public/sdk.js b/public/sdk.js new file mode 100644 index 0000000..ca34ea8 --- /dev/null +++ b/public/sdk.js @@ -0,0 +1,70 @@ +;(function(window) { + var _instance = null; + window.TallPlugin = function(config) { + this.config = config; + this.props = null; + } + + // 初始化并保证是单例 + TallPlugin.init = function (config) { + if (!_instance) { + _instance = new TallPlugin(config); + } + return _instance; + } + + TallPlugin.prototype.created = function (callback) { + var _this = this; + window.postMessage('created'); + window.addEventListener('message', function ({ data, origin }) { + try { + var target = JSON.parse(data); + if (target.success) { + _this.props = JSON.parse(data); + callback && typeof callback === 'function' && callback.call(_this, _this.props); + } else { + _this.props = null; + } + } catch (e) { + _this.props = null; + } + }, false); + // DOM加载完成 + window.addEventListener('DOMContentLoaded', this.mounted, false); + // window onload + window.addEventListener('load', this.loaded, false); + // destroy + window.addEventListener('unload', this.destroy, false); + // error + window.addEventListener('error', this.error, false); + return this; + } + + TallPlugin.prototype.mounted = function(callback) { + console.log('mounted'); + window.postMessage('mounted'); + callback && typeof callback === 'function' && callback.call(this); + return this; + } + + TallPlugin.prototype.loaded = function(callback) { + console.log('loaded'); + window.postMessage('loaded'); + callback && typeof callback === 'function' && callback.call(this); + return this; + } + + TallPlugin.prototype.destroy = function(callback) { + console.log('destroy'); + window.postMessage('destroy'); + callback && typeof callback === 'function' && callback.call(this); + return this; + } + + TallPlugin.prototype.error = function(callback) { + console.log('error'); + window.postMessage('error'); + callback && typeof callback === 'function' && callback.call(this); + return this; + } +})(window) diff --git a/src/components/MeetingPreview/MeetingPreview.vue b/src/components/MeetingPreview/MeetingPreview.vue new file mode 100644 index 0000000..132f7c1 --- /dev/null +++ b/src/components/MeetingPreview/MeetingPreview.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/components/QuillEditor/QuillEditor.vue b/src/components/QuillEditor/QuillEditor.vue index d525750..6980427 100644 --- a/src/components/QuillEditor/QuillEditor.vue +++ b/src/components/QuillEditor/QuillEditor.vue @@ -1,6 +1,13 @@ @@ -72,9 +79,9 @@ export default { onEditorFocus() { //获得焦点事件 }, - onEditorChange() { + onEditorChange(placeholder) { //内容改变事件 - this.$emit('input', this.content); + this.$emit('changeInput', placeholder, this.content); }, // 富文本图片上传前 diff --git a/src/router/index.js b/src/router/index.js index d143d21..5ff5c8e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -25,11 +25,11 @@ const routes = [ component: () => import('@/views/Meeting/Meeting.vue'), }, // 会议纪要预览 - { - path: '/meetingPreview', - name: 'MeetingPreview', - component: () => import('@/views/MeetingPreview/MeetingPreview.vue'), - }, + // { + // path: '/meetingPreview', + // name: 'MeetingPreview', + // component: () => import('@/views/MeetingPreview/MeetingPreview.vue'), + // }, // 选择患者信息 { path: '/selectPatient', diff --git a/src/store/modules/home/mutations.js b/src/store/modules/home/mutations.js index 1230dd4..93d5410 100644 --- a/src/store/modules/home/mutations.js +++ b/src/store/modules/home/mutations.js @@ -37,6 +37,15 @@ const mutations = { setPatientId(state, data) { state.patientId = data; }, + + /** + * 设置预览信息 + * @param {object} state + * @param {string} data + */ + setPreviewInfo(state, data) { + state.previewInfo = data; + }, }; export default mutations; diff --git a/src/store/modules/home/state.js b/src/store/modules/home/state.js index dd90d75..b8a030a 100644 --- a/src/store/modules/home/state.js +++ b/src/store/modules/home/state.js @@ -3,6 +3,7 @@ const state = { user: { id: '', phone: '', account: '' }, controlGroups: [], // 对照组 patientId: '', // 病患id + previewInfo: { host: '', place: '', startTime: '', endTime: '', participants: '', meetingMinutes: '', discussionContent: '' }, // 预览信息 }; export default state; diff --git a/src/views/Meeting/Meeting.vue b/src/views/Meeting/Meeting.vue index 1fed0d2..35b0c44 100644 --- a/src/views/Meeting/Meeting.vue +++ b/src/views/Meeting/Meeting.vue @@ -2,8 +2,11 @@
-
- 预览 +
+ +
+ +
分享
@@ -27,40 +30,18 @@ :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="会议地点" + required > - + - + @@ -83,7 +64,7 @@ @@ -95,7 +76,7 @@ @@ -112,6 +93,8 @@ import QuillEditor from 'components/QuillEditor/QuillEditor.vue'; import moment from 'moment'; import { saveConferenceRecords } from 'config/api'; +import { mapMutations } from 'vuex'; +import MeetingPreview from 'components/MeetingPreview/MeetingPreview.vue'; const formItemLayout = { labelCol: { span: 4 }, @@ -120,7 +103,7 @@ const formItemLayout = { const tailItemLayout = { wrapperCol: { span: 18, offset: 4 } }; export default { name: 'Meeting', - components: { QuillEditor }, + components: { QuillEditor, MeetingPreview }, data() { return { showVideo: false, @@ -128,6 +111,8 @@ export default { tailItemLayout, form: this.$form.createForm(this, { name: 'page-add' }), rangeConfig: { rules: [{ type: 'array', required: true, message: '会议时间不能为空' }] }, + place: '', // 会议地点 + host: '', // 主持人 participants: '', // 参会人员 discussionContent: '', // 研讨内容 meetingMinutes: '', // 会议纪要 @@ -137,41 +122,75 @@ export default { maxSize: 2048, placeholderContent: '请在此输入研讨内容...', placeholderMeeting: '请在此输入会议纪要...', + visible: false, }; }, methods: { + ...mapMutations('home', ['setPreviewInfo']), moment, + + closeModal() { + this.visible = false; + }, + onChangeTime(dates, dateStrings) { - console.log('From: ', dates[0], ', to: ', dates[1]); - console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]); this.startTime = dateStrings[0]; this.endTime = dateStrings[1]; }, - // 提交表单 + changeInput(placeholder, value) { + if (placeholder === '请在此输入参会人员...') { + this.participants = value; + } + if (placeholder === '请在此输入研讨内容...') { + this.discussionContent = value; + } + if (placeholder === '请在此输入会议纪要...') { + this.meetingMinutes = value; + } + }, + + // 保存信息 handleSubmit(e) { e.preventDefault(); this.form.validateFieldsAndScroll(async (err, values) => { if (!err) { try { - const { host, place } = values; - const { startTime, endTime, participants, discussionContent, meetingMinutes } = this; - const params = { param: { host, place, startTime, endTime, participants, meetingMinutes, discussionContent, taskId: '0' } }; - console.log('params: ', params); - const res = await saveConferenceRecords(params); - const { data, msg, code } = res.data; - if (code === 200) { - this.$message.success('提交成功'); - } else { - throw msg; - } + const { host, place, startTime, endTime, participants, discussionContent, meetingMinutes } = this; + const previewInfo = { host, place, startTime, endTime, participants, meetingMinutes, discussionContent }; + // 提交表单 + const params = previewInfo; + this.saveConferenceRecords(params); } catch (error) { this.$message.error(error || '提交失败'); } } }); }, + + // 提交表单 + async saveConferenceRecords(params) { + try { + const res = await saveConferenceRecords(params); + const { data, msg, code } = res.data; + if (code === 200) { + this.$message.success('提交成功'); + } else { + throw msg; + } + } catch (error) { + this.$message.error(error || '提交失败'); + } + }, + + // 预览 + async openPreview() { + const { host, place, startTime, endTime, participants, discussionContent, meetingMinutes } = this; + const previewInfo = { host, place, startTime, endTime, participants, meetingMinutes, discussionContent }; + await this.setPreviewInfo(previewInfo); + this.$refs.meetingPreview.openModal(); + }, }, }; diff --git a/src/views/MeetingPreview/MeetingPreview.vue b/src/views/MeetingPreview/MeetingPreview.vue deleted file mode 100644 index b76752b..0000000 --- a/src/views/MeetingPreview/MeetingPreview.vue +++ /dev/null @@ -1,78 +0,0 @@ - - - - -