123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import SerialNumberPosition from './SerialNumberPosition.vue';
- import { GetCoursewareComponentContent_View } from '@/api/book';
- const mixin = {
- data() {
- return {};
- },
- props: {
- id: {
- type: String,
- required: true,
- },
- coursewareId: {
- type: String,
- required: true,
- },
- },
- components: {
- SerialNumberPosition,
- },
- created() {
- this.getCoursewareComponentContent_View();
- },
- methods: {
- getCoursewareComponentContent_View() {
- GetCoursewareComponentContent_View({ courseware_id: this.coursewareId, component_id: this.id }).then(
- ({ content }) => {
- if (content) this.data = JSON.parse(content);
- },
- );
- },
- /**
- * 得到序号外部样式
- */
- getAreaStyle() {
- const position = this.data.property.sn_position;
- let grid = '';
- if (position.includes('right')) {
- grid = `"main position" / 1fr auto`;
- } else if (position.includes('left')) {
- grid = `"position main" / auto 1fr`;
- } else if (position.includes('top')) {
- grid = `"position" auto "main" 1fr`;
- } else if (position.includes('bottom')) {
- grid = `"main" 1fr "position" auto`;
- }
- return {
- grid,
- };
- },
- },
- };
- export default mixin;
|