|
@@ -900,6 +900,89 @@
|
|
|
<el-button type="primary" @click="isAddPP">确定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ title="创建问卷调查"
|
|
|
+ :visible.sync="dialogVisible4"
|
|
|
+ :append-to-body="true"
|
|
|
+ width="750px"
|
|
|
+ :before-close="handleClose"
|
|
|
+ class="dialog_diy"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in unitJson[unitIndex].chapterInfo"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div class="a_add_title">
|
|
|
+ <el-input
|
|
|
+ v-model="item.askTitle"
|
|
|
+ placeholder="请输入问卷标题"
|
|
|
+ style="width: 400px"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ <div class="a_addBox">
|
|
|
+ <div
|
|
|
+ class="a_add_box"
|
|
|
+ v-for="(item1, index1) in item.askCount"
|
|
|
+ :key="index1"
|
|
|
+ >
|
|
|
+ <div class="a_add_head">
|
|
|
+ <div>
|
|
|
+ {{ index1 + 1 + "、" }}
|
|
|
+ <el-input
|
|
|
+ class="a_add_head_input"
|
|
|
+ v-model="item.askJson[index1].askstitle"
|
|
|
+ placeholder="请输入问卷题目..."
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ <div class="a_add_head_div">
|
|
|
+ <el-button type="primary" size="small" @click="addAskList()"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="deleteAskList()"
|
|
|
+ v-if="index1 != 0"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="a_add_body">
|
|
|
+ <div class="a_add_input">
|
|
|
+ <el-input
|
|
|
+ v-for="(item2, checkIndex) in item.askJson[index1].askItem"
|
|
|
+ :key="checkIndex"
|
|
|
+ v-model="item.askJson[index1].checkList[checkIndex]"
|
|
|
+ placeholder="请输入选项..."
|
|
|
+ style="width: 150px; margin: 10px 10px 0 0"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ <div class="a_add_body_div">
|
|
|
+ <el-button
|
|
|
+ style="margin: 10px 0px 0 0"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="addcheckList(item.askJson[index1])"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ style="margin: 10px 0 0 0"
|
|
|
+ @click="deletecheckList(item.askJson[index1])"
|
|
|
+ v-if="item.askJson[index1].askItem != 1"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="cleanAsk(publicTool)">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="addAsk">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -928,6 +1011,8 @@ export default {
|
|
|
dialogVisible1: false,
|
|
|
dialogVisible2: false,
|
|
|
dialogVisible3: false,
|
|
|
+ dialogVisible4: false,
|
|
|
+ publicTool: 0,
|
|
|
searchPeople: "",
|
|
|
userid: this.$route.query.userid,
|
|
|
oid: this.$route.query.oid,
|
|
@@ -949,6 +1034,10 @@ export default {
|
|
|
courseName: "",
|
|
|
chapterData: [],
|
|
|
toolChoose: [],
|
|
|
+ askCount: 1,
|
|
|
+ askTitle: "",
|
|
|
+ askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
|
|
|
+ checkJson: [{ checkCount: [], checkPerent: [] }],
|
|
|
itemCount: 1,
|
|
|
fileList1: [],
|
|
|
homeworkList: [],
|
|
@@ -1573,6 +1662,14 @@ export default {
|
|
|
addTools(i) {
|
|
|
if (this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.length == 0) {
|
|
|
this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.push(i);
|
|
|
+ if (
|
|
|
+ i == 4 &&
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson.length == 1
|
|
|
+ ) {
|
|
|
+ this.dialogVisible4 = true;
|
|
|
+ } else {
|
|
|
+ this.dialogVisible4 = true;
|
|
|
+ }
|
|
|
} else {
|
|
|
if (
|
|
|
this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.indexOf(i) !=
|
|
@@ -1582,12 +1679,126 @@ export default {
|
|
|
this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.indexOf(i),
|
|
|
1
|
|
|
);
|
|
|
+ if (i == 4) {
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askTitle = "";
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson = [];
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson.push({
|
|
|
+ askstitle: "",
|
|
|
+ askItem: 1,
|
|
|
+ checkList: [],
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.push(i);
|
|
|
}
|
|
|
}
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
+ cleanAsk(p) {
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.splice(p, 1);
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askTitle = "";
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson = [];
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson.push({
|
|
|
+ askstitle: "",
|
|
|
+ askItem: 1,
|
|
|
+ checkList: [],
|
|
|
+ });
|
|
|
+ this.dialogVisible4 = false;
|
|
|
+ },
|
|
|
+ addAskList() {
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].checkJson.push({
|
|
|
+ checkCount: [],
|
|
|
+ checkPerent: [],
|
|
|
+ });
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson.push({
|
|
|
+ askstitle: "",
|
|
|
+ askItem: 1,
|
|
|
+ checkList: [],
|
|
|
+ });
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askCount++;
|
|
|
+ },
|
|
|
+ deleteAskList() {
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson.splice(-1);
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askCount--;
|
|
|
+ },
|
|
|
+ addcheckList(json) {
|
|
|
+ json.checkList.length++;
|
|
|
+ json.askItem++;
|
|
|
+ },
|
|
|
+ deletecheckList(json) {
|
|
|
+ json.checkList.length--;
|
|
|
+ json.askItem--;
|
|
|
+ },
|
|
|
+ addAsk() {
|
|
|
+ if (this.unitJson[this.unitIndex].chapterInfo[0].askTitle === "") {
|
|
|
+ this.$message.error("问卷调查标题不能为空!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var aj = this.unitJson[this.unitIndex].chapterInfo[0].askJson;
|
|
|
+ var b = 1;
|
|
|
+ for (var i = 0; i < aj.length; i++) {
|
|
|
+ if (aj[i].askstitle === "") {
|
|
|
+ var a = 1;
|
|
|
+ for (let index = 0; index < aj[i].askItem; index++) {
|
|
|
+ const element = aj[i].checkList[index]
|
|
|
+ ? aj[i].checkList[index]
|
|
|
+ : "";
|
|
|
+ if (element != "") {
|
|
|
+ b++;
|
|
|
+ this.$message.error("填写了问卷调查选项,问卷调查题目不能为空!");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ a++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (b == 1) {
|
|
|
+ this.$message.error("至少填写一个问题");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // if (a > 1) {
|
|
|
+ // aj.splice(i, 1);
|
|
|
+ // }
|
|
|
+ } else if (aj[i].askstitle != "") {
|
|
|
+ for (let index = 0; index < aj[i].askItem; index++) {
|
|
|
+ const element = aj[i].checkList[index]
|
|
|
+ ? aj[i].checkList[index]
|
|
|
+ : "";
|
|
|
+ var index = 0;
|
|
|
+ for (var z = 0; z < aj[i].checkList.length; z++) {
|
|
|
+ var checkC = aj[i].checkList[z] ? aj[i].checkList[z] : "";
|
|
|
+ if (checkC != "") {
|
|
|
+ index++;
|
|
|
+ } else {
|
|
|
+ this.$message.error("问卷调查选项不能为空!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ b++;
|
|
|
+ if (index < 2) {
|
|
|
+ this.$message.error(
|
|
|
+ "填写了问卷调查的题目,问卷调查选项至少要有两项!"
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // if (element == "") {
|
|
|
+ // this.$message.error(
|
|
|
+ // "填写了问卷调查的题目,问卷调查选项不能为空!"
|
|
|
+ // );
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.unitJson[this.unitIndex].chapterInfo[0].askJson = this.unitJson[
|
|
|
+ this.unitIndex
|
|
|
+ ].chapterInfo[0].askJson.filter((el) => {
|
|
|
+ var elc = el.checkList.filter((element) => {
|
|
|
+ return element != "";
|
|
|
+ });
|
|
|
+ return el.askstitle != "" && elc.length != 0;
|
|
|
+ });
|
|
|
+ this.dialogVisible4 = false;
|
|
|
+ },
|
|
|
selectCourseDetail() {
|
|
|
if (this.cid == "" || this.cid == undefined) {
|
|
|
console.log("这是新增课程");
|
|
@@ -2645,4 +2856,74 @@ ol {
|
|
|
.customWidth >>> .el-dialog {
|
|
|
min-width: 500px !important;
|
|
|
}
|
|
|
+.a_addBox {
|
|
|
+ margin: 10px 0;
|
|
|
+ background: #fff;
|
|
|
+ padding: 15px;
|
|
|
+}
|
|
|
+.a_add_box {
|
|
|
+ border-bottom: 2px solid #eee;
|
|
|
+ padding-bottom: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.a_add_head {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin: 10px 0;
|
|
|
+ font-size: 18px;
|
|
|
+}
|
|
|
+.a_add_head .a_add_head_input {
|
|
|
+ width: 300px;
|
|
|
+}
|
|
|
+.a_add_head .a_add_head_div {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+.a_add_body {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.a_add_input {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ /* flex-direction: column; */
|
|
|
+ /* width: 100%; */
|
|
|
+}
|
|
|
+.width100 {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+.a_add_input .a_add_persent {
|
|
|
+ /* display: flex; */
|
|
|
+ /* flex-direction: column; */
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+.a_add_persent_div {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.a_add_persent_div span {
|
|
|
+ margin: 5px 0;
|
|
|
+}
|
|
|
+.a_add_persent_div span:nth-child(1) {
|
|
|
+ width: 30%;
|
|
|
+}
|
|
|
+.a_add_persent_div span:nth-child(2) {
|
|
|
+ width: 7%;
|
|
|
+}
|
|
|
+.a_add_persent_div span:nth-child(3) {
|
|
|
+ width: 40%;
|
|
|
+}
|
|
|
+.a_add_persent_title {
|
|
|
+ /* margin-bottom: 10px; */
|
|
|
+}
|
|
|
+.a_add_body_div {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
</style>
|