diff --git a/src/App.vue b/src/App.vue index 327bedd..061d798 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,23 +26,36 @@ export default { return { zh_CN }; }, - computed: mapState('home', ['anyringToken']), + computed: mapState('home', ['anyringToken', 'ptProps']), - created() { - const userId = '1218763410024566784'; - const params = { userId }; - this.getUserId(params); + watch: { + ptProps(val) { + if (val.userId) { + const params = { userId: val.userId }; + this.getUserId(params); + } + }, + }, + created() { + // const userId = '1218763410024566784'; + // const params = { userId }; + // this.getUserId(params); + const that = this; window.plugin = window.TallPlugin.init(); // 调用created方法 向主窗体发送created消息,以便来接受、存储主窗体传递来的参数 // created接受一个回调函数 created成功后调用 可选参数 + // 接受PT传过来的 插件id,项目id,角色id,任务id,userId window.plugin.created(function(props) { - console.log(this); - console.log(props, props.projectId, this.config); + that.setPtProps(props); + console.log('props: ', props); }); }, - methods: mapActions('home', ['getUserId']), + methods: { + ...mapActions('home', ['getUserId']), + ...mapMutations('home', ['setPtProps']), + }, }; @@ -61,7 +74,6 @@ body::-webkit-scrollbar { } - diff --git a/src/store/modules/home/mutations.js b/src/store/modules/home/mutations.js index 93d5410..4243873 100644 --- a/src/store/modules/home/mutations.js +++ b/src/store/modules/home/mutations.js @@ -46,6 +46,15 @@ const mutations = { setPreviewInfo(state, data) { state.previewInfo = data; }, + + /** + * 设置Pt传过来的参数 + * @param {object} state + * @param {string} data + */ + setPtProps(state, data) { + state.ptProps = data; + }, }; export default mutations; diff --git a/src/store/modules/home/state.js b/src/store/modules/home/state.js index b8a030a..94f0536 100644 --- a/src/store/modules/home/state.js +++ b/src/store/modules/home/state.js @@ -4,6 +4,7 @@ const state = { controlGroups: [], // 对照组 patientId: '', // 病患id previewInfo: { host: '', place: '', startTime: '', endTime: '', participants: '', meetingMinutes: '', discussionContent: '' }, // 预览信息 + ptProps: null, // 接受PT传过来的 pluginId,projectId,roleId,taskId,userId }; export default state; diff --git a/src/views/Meeting/Meeting.vue b/src/views/Meeting/Meeting.vue index d6fdfb2..5a1b3fb 100644 --- a/src/views/Meeting/Meeting.vue +++ b/src/views/Meeting/Meeting.vue @@ -51,6 +51,7 @@ @@ -63,6 +64,7 @@ @@ -75,6 +77,7 @@ @@ -92,8 +95,8 @@ import MeetingPreview from 'components/MeetingPreview/MeetingPreview.vue'; import QuillEditor from 'components/QuillEditor/QuillEditor.vue'; import moment from 'moment'; -import { saveConRec, shareConRec } from 'config/api'; -import { mapMutations } from 'vuex'; +import { saveConRec, shareConRec, getConRec } from 'config/api'; +import { mapState, mapMutations } from 'vuex'; const formItemLayout = { labelCol: { span: 4 }, @@ -125,6 +128,14 @@ export default { }; }, + computed: mapState('home', ['ptProps']), + + mounted() { + if (this.ptProps.taskId) { + this.getConRec(this.ptProps.taskId); + } + }, + methods: { ...mapMutations('home', ['setPreviewInfo']), moment, @@ -183,6 +194,30 @@ export default { } }, + // 查看会议纪要 + async getConRec(taskId) { + try { + const params = { param: { taskId } }; + const res = await getConRec(params); + const { data, msg, code } = res.data; + if (code === 200) { + console.log('查看会议纪要data: ', data); + data.discussionContent = this.discussionContent; + data.endTime = this.endTime; + data.host = this.host; + data.meetingMinutes = this.meetingMinutes; + data.participants = this.participants; + data.place = this.place; + data.startTime = this.startTime; + data.taskId = this.taskId; + } else { + throw msg; + } + } catch (error) { + this.$message.error(error || '查看失败'); + } + }, + // 预览 async openPreview() { const { host, place, startTime, endTime, participants, discussionContent, meetingMinutes } = this; @@ -194,7 +229,7 @@ export default { // 分享 async shareConRec() { try { - const params = { param: { taskId: 0 } }; + const params = { param: { taskId: this.ptProps.taskId } }; const res = await shareConRec(params); const { data, msg, code } = res.data; if (code === 200) {