| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <template>
- <div id="videoConfig">
- <div class="boxWs">
- <header class="hedsa">视频播放</header>
- <div class="bigBoxs">
- <el-form label-width="100px" class="demo-ruleForm">
- <el-form-item
- v-for="(item, index) in listitem"
- :key="index"
- :label="item.configName"
- >
- <el-radio-group v-model="item.configValue">
- <el-radio label="1">开启</el-radio>
- <el-radio label="0">禁止</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-form>
- <el-button @click="submit" v-hasPermi="['system:config:edit']">保存</el-button>
- </div>
- </div>
- <div class="boxWs">
- <header class="hedsa">视频-课程节-拍照</header>
- <div class="bigBoxs">
- <el-form label-width="100px" class="demo-ruleForm">
- <el-form-item :label="videoActive.configName">
- <el-radio-group v-model="videoActive.configValue">
- <el-radio label="1" @change="videoPhotoJG.configValue.push(0)"
- >是</el-radio
- >
- <el-radio label="0" @change="videoPhotoJG.configValue = []"
- >否</el-radio
- >
- </el-radio-group>
- <el-button
- style="margin-left: 12px"
- size="mini"
- v-if="videoActive.configValue === '1'"
- @click="videoPhotoJG.configValue.push(0)"
- >添加</el-button
- >
- </el-form-item>
- <template v-if="videoActive.configValue == 1">
- <el-form-item
- v-for="(item, index) in videoPhotoJG.configValue"
- :key="index"
- label="播放至"
- >
- <el-input-number
- :controls="false"
- v-model="videoPhotoJG.configValue[index]"
- controls-position="right"
- :min="0"
- ></el-input-number
- >分钟
- <el-button type="warning" size="mini" @click="del(index)"
- >删除</el-button
- >
- </el-form-item>
- </template>
- </el-form>
- <el-button @click="submitVideo" >保存</el-button>
- </div>
- </div>
- <div class="boxWs">
- <header class="hedsa">视频-课程章节-关联题卷-拍照</header>
- <div class="bigBoxs">
- <el-form label-width="100px" class="demo-ruleForm">
- <el-form-item :label="bankActive.configName">
- <el-radio-group v-model="bankActive.configValue">
- <el-radio label="1"
- >是</el-radio
- >
- <el-radio label="0" @change="bankPhotoJG.configValue = []"
- >否</el-radio
- >
- </el-radio-group>
- <!-- <el-button
- style="margin-left: 12px"
- size="mini"
- v-if="bankActive.configValue === '1'"
- @click="bankPhotoJG.configValue.push(0)"
- >添加</el-button
- > -->
- </el-form-item>
- <template v-if="bankActive.configValue == 1">
- <el-form-item
- v-for="(item, index) in bankPhotoJG.configValue"
- :key="index"
- label="做题至第"
- >
- <!-- <num-input
- :value="item"
- @changevalues="changeValues(index, $event)"
- message="请输入数值"
- min="1"
- /> -->
- <el-input-number
- :controls="false"
- v-model="bankPhotoJG.configValue[index]"
- controls-position="right"
- :min="0"
- :precision="0"
- ></el-input-number>
- 题
- <el-button type="warning" size="mini" @click="delbank(index)"
- >删除</el-button
- >
- </el-form-item>
- </template>
- </el-form>
- <el-button @click="submitBank">保存</el-button>
- </div>
- </div>
- <div style="clear: both"></div>
- </div>
- </template>
- <script>
- import numInput from "@/components/numInput";
- import {
- listConfig,
- getConfig,
- delConfig,
- addConfig,
- updateConfig,
- exportConfig,
- refreshCache,
- } from "@/api/system/config";
- export default {
- components: { numInput },
- data() {
- return {
- listitem: [],
- videoActive: {},
- videoPhotoJG: {},
- bankActive: {},
- bankPhotoJG: {},
- };
- },
- mounted() {
- this.getConfig();
- },
- methods: {
- changeValues(int, value) {
- if (value) {
- var ast = this.bankPhotoJG.configValue.some((item) => {
- return item == value;
- });
- if (ast) {
- this.$message.error("存在相同值,请重新输入");
- this.$set(this.bankPhotoJG.configValue, int, "");
- } else {
- this.$set(this.bankPhotoJG.configValue, int, value);
- }
- }else{
- this.$set(this.bankPhotoJG.configValue, int, "");
- }
- },
- del(index) {
- this.videoPhotoJG.configValue.splice(index, 1);
- },
- delbank(index) {
- this.bankPhotoJG.configValue.splice(index, 1);
- },
- getConfig() {
- listConfig().then((res) => {
- var listitems = [];
- res.rows.map((item) => {
- if (
- item.configKey == "sys.play.autoPlay" ||
- item.configKey == "sys.play.drag" ||
- item.configKey == "sys.play.speed"
- ) {
- listitems.push(item);
- }
- if (item.configKey == "sys.course.photograph") {
- this.videoActive = item;
- }
- if (item.configKey == "sys.paper.photograph") {
- this.bankActive = item;
- }
- if (item.configKey == "sys.course.intervalTime") {
- if (item.configValue) {
- item.configValue = item.configValue.split(",");
- } else {
- item.configValue = [];
- }
- this.videoPhotoJG = item;
- }
- if (item.configKey == "sys.paper.intervalNumber") {
- if (item.configValue) {
- item.configValue = item.configValue.split(",");
- } else {
- item.configValue = [];
- }
- this.bankPhotoJG = item;
- }
- });
- this.listitem = listitems;
- });
- },
- async submit() {
- for (let i = 0; i < this.listitem.length; i++) {
- await updateConfig(this.listitem[i]);
- }
- this.$modal.msgSuccess("修改成功");
- },
- async submitVideo() {
- // if (this.videoActive.configValue == 1) {
- if (
- this.videoActive.configValue == 1 &&
- !this.videoPhotoJG.configValue.length
- ) {
- this.$modal.msgError("参数键值不能为空");
- return;
- } else {
- var arr = {};
- for (let k in this.videoPhotoJG) {
- if (k == "configValue") {
- var arrs = this.videoPhotoJG[k];
- if (new Set(arrs).size != arrs.length) {
- this.$message.warning("不允许存在重复值");
- return;
- }
- arr[k] = this.videoPhotoJG[k].toString();
- } else {
- arr[k] = this.videoPhotoJG[k];
- }
- }
- await updateConfig(this.videoActive);
- await updateConfig(arr);
- this.$modal.msgSuccess("修改成功");
- this.getConfig();
- }
- // } else {
- // await updateConfig(this.videoActive);
- // this.$modal.msgSuccess("修改成功");
- // this.getConfig();
- // }
- },
- async submitBank() {
- // if (this.bankActive.configValue == 1) {
- // if (this.bankActive.configValue == 1 && !this.bankPhotoJG.configValue.length) {
- // this.$modal.msgError("参数键值不能为空");
- // return;
- // } else {
- // var arr = {};
- // for (let k in this.bankPhotoJG) {
- // if (k == "configValue") {
- // var arrs = this.bankPhotoJG[k];
- // if (new Set(arrs).size != arrs.length) {
- // this.$message.warning("不允许存在重复值");
- // return;
- // }
- // arr[k] = this.bankPhotoJG[k].toString();
- // } else {
- // arr[k] = this.bankPhotoJG[k];
- // }
- // }
- await updateConfig(this.bankActive);
- // await updateConfig(arr);
- this.$modal.msgSuccess("修改成功");
- this.getConfig();
- // }
- // } else {
- // await updateConfig(this.bankActive);
- // this.$modal.msgSuccess("修改成功");
- // this.getConfig();
- // }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .boxWs {
- margin: 0px 20px 20px 0px;
- float: left;
- width: 450px;
- height: 400px;
- border-radius: 8px;
- overflow: hidden;
- border: 1px solid #eee;
- .hedsa {
- background-color: #999;
- padding: 6px;
- }
- .bigBoxs {
- height: 367px;
- padding: 14px;
- overflow-y: auto;
- }
- }
- </style>
|