zhouwx
2024-06-11 bb677211fa6a0916869eb264ba047aa88a8181be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<template>
  <el-dialog
    :visible.sync="dialogVisible"
    :modal-append-to-body="false"
    :close-on-click-modal="false"
    width="600px"
    :before-close="handleClose"
  >
    <div style="margin:  0 25px">
      <div style="display: flex;flex-direction: column">
        <div style="display: flex;align-items: center;justify-content: space-between">
          <span style="font-size: 20px;font-weight: 550">课程大纲</span>
          <span style="color: #1890ff;cursor: pointer;" @click="clickOpen">收起/展开</span>
        </div>
        <div :class="{'open':isClose}" style="overflow: hidden">
          <div v-for="(item,index) in courseList" :key="index" style="font-size: 16px;margin: 20px 35px">
            <span>{{item.name}}</span>
          </div>
        </div>
 
      </div>
      <div style="display: flex;flex-direction: column">
        <span style="font-size: 20px;font-weight: 550">课程章节资源</span>
        <el-table
          :data="courseTable"
          style="width: 80%;margin: 20px 35px">
          <el-table-column
            prop="catalogCode"
            label="章节UUID">
          </el-table-column>
          <el-table-column
            prop="catalogName"
            label="章节名称">
          </el-table-column>
          <el-table-column
            label="资源类别"
            prop="resourceType">
          </el-table-column>
          <el-table-column
            label="章节学时"
            prop="lessonNum">
          </el-table-column>
          <el-table-column label="预览" align="center" class-name="small-padding fixed-width">
            <template #default="scope">
              <el-button
                size="mini"
                type="text"
                style="color: #1890ff"
              >预览课程</el-button>
            </template>
          </el-table-column>
        </el-table>
 
      </div>
 
    </div>
  </el-dialog>
</template>
 
<script >
export default {
  name: 'addUser',
  components: {
  },
  data() {
    return {
      isClose:false,
      dialogVisible: false,
      dialogStatus: '',
      dataForm: {},
      courseTable: [
        {
          catalogCode: '1',
          catalogName: '测试',
          resourceType: '视频',
          lessonNum: '2h'
        },
        {
          catalogCode: '1',
          catalogName: '测试3',
          resourceType: '音频',
          lessonNum: '45min'
        }
      ],
      courseList: [
        {
          name: '1.1  ……'
        },
        {
          name: '1.2  ……'
        },
        {
          name: '1.3  ……'
        }
 
      ]
    }
  },
  created() {
  },
  methods: {
    openDialog (type, data) {
      this.resetDataForm();
      this.dialogVisible = true;
      this.dialogStatus = type;
    },
    clickOpen() {
      this.isClose = !this.isClose
    },
    handleClose() {
      this.dialogVisible = false;
      this.$emit("getList");
    },
    onSubmit() {
      this.$refs["dataForm"].validate( async valid => {
        if (valid) {
          if(this.dialogStatus == 'add'){
            // this.dataForm.isCm = 1;
            // console.log("this.dataForm",this.dataForm)
            // const res = await addExam(this.dataForm);
            // if(res.code == 200) {
              this.$emit("getList");
              this.dialogVisible = false;
            //   this.$message({
            //     type:'success',
            //     message: '新增成功'
            //   })
            // }else{
            //   this.$message({
            //     type:'warning',
            //     message: res.msg
            //   })
            // }
          }else {
            // this.dataForm.isCm = 1;
            // console.log("this.dataForm",this.dataForm)
            // const res = await updateExam(this.dataForm);
            // if(res.code == 200) {
              this.$emit("getList");
              this.dialogVisible = false;
            //   this.$message({
            //     type:'success',
            //     message: '编辑成功'
            //   })
            // }else{
            //   this.$message({
            //     type:'warning',
            //     message: res.msg
            //   })
            // }
          }
        }
      })
 
    },
    resetDataForm() {
      this.dataForm = {
      }
    },
  }
}
 
</script>
<style scoped>
.open{
  height: 15px;
}
</style>