|
@@ -82,6 +82,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <!--添加和修改表单 -->
|
|
|
<el-dialog title="首页项列表" :visible.sync="dialogFormVisible">
|
|
|
<el-form ref="ruleForm" :model="form" :rules="rules">
|
|
|
<el-form-item label="项目名称" :label-width="formLabelWidth">
|
|
@@ -101,15 +102,25 @@
|
|
|
<el-option value="PAY" label="知识付费" />
|
|
|
<el-option value="TOPIC" label="专题" />
|
|
|
<el-option value="SCHEDULE" label="课程表" />
|
|
|
- <el-option value="URL" label="URL" />
|
|
|
+ <!--<el-option value="URL" label="URL" />-->
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="排序" :label-width="formLabelWidth" prop="sort">
|
|
|
<el-input v-model="form.sort" autocomplete="off" clearable />
|
|
|
</el-form-item>
|
|
|
<el-form-item v-if="type === 'add'" label="跳转地址" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.targetContent" autocomplete="off" clearable />
|
|
|
- <el-tag type="danger">请输入Code</el-tag>
|
|
|
+ <el-select v-if="form.targetType === 'SCHEDULE'" v-model="form.targetContent" placeholder="请选择">
|
|
|
+ <el-option value="PRIMARY_FIRST_GRADE" label="小学一年级" />
|
|
|
+ <el-option value="PRIMARY_SECOND_GRADE" label="小学二年级" />
|
|
|
+ <el-option value="PRIMARY_THREE_GRADE" label="小学三年级" />
|
|
|
+ <el-option value="PRIMARY_SENIOR_GRADE" label="小学四年级" />
|
|
|
+ <el-option value="KINDERGARTEN" label="爱上幼儿园" />
|
|
|
+ <el-option value="PRESCHOOL" label="学前领先班" />
|
|
|
+ </el-select>
|
|
|
+ <div v-else>
|
|
|
+ <el-button @click="selectList">选择跳转</el-button>
|
|
|
+ <span>{{ form.targetContent }}</span>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
<el-form-item v-if="type === 'add'" label="状态" :label-width="formLabelWidth" prop="status">
|
|
|
<el-select v-model="form.status" placeholder="请选择">
|
|
@@ -123,6 +134,56 @@
|
|
|
<el-button type="primary" @click="handOk('ruleForm')">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- 选择课程表格 -->
|
|
|
+ <el-dialog :title="form.targetType === 'TOPIC' ? '选择专题' : '选择课程' " :visible.sync="dialogTableVisible">
|
|
|
+ <el-table
|
|
|
+ ref="singleTable"
|
|
|
+ :data="tableData"
|
|
|
+ highlight-current-row
|
|
|
+ style="width: 100%"
|
|
|
+ height="500"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ label="id"
|
|
|
+ width="180"
|
|
|
+ prop="id"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="code"
|
|
|
+ width="180"
|
|
|
+ prop="code"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="icon"
|
|
|
+ width="140"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <img :src="scope.row.iconImg" width="75">
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="标题"
|
|
|
+ width="200"
|
|
|
+ prop="title"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="form.targetType !== 'TOPIC'"
|
|
|
+ label="类型"
|
|
|
+ width="100"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.courseType === 'KNOWLEDGE' ? '知识付费' : '图书馆' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="totalSize"
|
|
|
+ @current-change="handleTableChange"
|
|
|
+ />
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -136,6 +197,7 @@ export default {
|
|
|
return {
|
|
|
form: {},
|
|
|
dialogFormVisible: false,
|
|
|
+ dialogTableVisible: false,
|
|
|
type: '',
|
|
|
formLabelWidth: '120px',
|
|
|
rules: {
|
|
@@ -149,9 +211,12 @@ export default {
|
|
|
sort: [
|
|
|
{ required: true, message: '请输入排序', trigger: 'blur' }
|
|
|
],
|
|
|
- targetContent: [{ required: true, message: '请输入项目Code', trigger: 'blur' }],
|
|
|
+ targetContent: [{ required: true, message: '请选择', trigger: 'blur' }],
|
|
|
status: [{ required: true, message: '请选择状态', trigger: 'change' }]
|
|
|
- }
|
|
|
+ },
|
|
|
+ tableData: [],
|
|
|
+ totalSize: 0,
|
|
|
+ tablePage: 1
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -273,6 +338,26 @@ export default {
|
|
|
'status': ''
|
|
|
}
|
|
|
},
|
|
|
+ selectList() {
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ if (this.form.targetType === 'TOPIC') {
|
|
|
+ this.$store.dispatch('topicList/getTopicLists', {
|
|
|
+ page: this.tablePage
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.tableData = res.list
|
|
|
+ this.totalSize = res.totalSize
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$store.dispatch('courseList/getCourseLists', {
|
|
|
+ page: this.tablePage
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.tableData = res.list
|
|
|
+ this.totalSize = res.totalSize
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
handleUp(index, row) {
|
|
|
console.log(index, row)
|
|
|
this.setForm(row)
|
|
@@ -295,6 +380,7 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
} else {
|
|
|
+ console.log(this.form)
|
|
|
this.$store.dispatch('dashboard/addRowItemList', this.form).then(() => {
|
|
|
this.dialogFormVisible = false
|
|
|
this.$store.dispatch('dashboard/getRowItemList', {
|
|
@@ -320,6 +406,43 @@ export default {
|
|
|
'sort': data.sort,
|
|
|
'status': data.status
|
|
|
}
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ console.log(val)
|
|
|
+ if (val) {
|
|
|
+ this.form.targetContent = val.id
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ this.$message({
|
|
|
+ message: '选择成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // this.currentRow = val
|
|
|
+ },
|
|
|
+ handleTableChange(val) {
|
|
|
+ console.log(val)
|
|
|
+ this.tablePage = val
|
|
|
+ if (this.form.targetType === 'TOPIC') {
|
|
|
+ this.$store.dispatch('topicList/getTopicLists', {
|
|
|
+ page: this.tablePage
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.tableData = res.list
|
|
|
+ this.totalSize = res.totalSize
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$store.dispatch('courseList/getCourseLists', {
|
|
|
+ page: this.tablePage
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.tableData = res.list
|
|
|
+ this.totalSize = res.totalSize
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // this.page = val
|
|
|
+ // this.$store.dispatch('courseList/getCourseLists', {
|
|
|
+ // page: this.page
|
|
|
+ // })
|
|
|
}
|
|
|
}
|
|
|
}
|