diff --git a/src/api/indexVote.js b/src/api/indexVote.js index 0f91f1bb..07d1d268 100644 --- a/src/api/indexVote.js +++ b/src/api/indexVote.js @@ -60,15 +60,10 @@ export const createVote = (obj) => http.post('/vote/createVote', obj) export const deleteVoteMessage = (obj) => http.post('/vote/deleteVoteMessage', { params: obj }) //删除题干信息接口 -export const deleteVoteStem = (obj) => http.post('/vote/deleteVoteStem', obj, { - headers: { - 'token': '123', - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - } -}) +export const deleteVoteStem = (voteStemId) => http.post(`/vote/deleteVoteStem?voteStemId=${voteStemId}`) //删除题选项息接口 -export const deleteVoteStemOption = (obj) => http.post('/vote/deleteVoteStemOption', { params: obj }) +export const deleteVoteStemOption = (optionId) => http.post(`/vote/deleteVoteStemOption?optionId=${optionId}`) //修改投票信息接口 export const editVote = (obj) => http.post('/vote/editVote', obj) diff --git a/src/components/vote/CreateVote.vue b/src/components/vote/CreateVote.vue index 8d4f23d2..36a713f3 100644 --- a/src/components/vote/CreateVote.vue +++ b/src/components/vote/CreateVote.vue @@ -34,8 +34,10 @@ +
- +
- -
题干{{item.id}}
+ +
题干{{ item.id }}
- +
- +
- + 添加选项
@@ -58,7 +40,7 @@ export default { VoteQuestionItem, }, props: { - num:{ + num: { type: Number, default: null, }, @@ -68,22 +50,22 @@ export default { return {}; }, }, - + }, - setup(props,{ emit }) { - - - + setup(props, { emit }) { + + + const curItem = ref(props.item); const handleTypesDel = () => { - emit("del", { id: curItem.value.id, curItem: curItem.value }); - console.log("删除题干======",{ id: curItem.value.id, curItem: curItem.value }); - api.deleteVoteStem({voteStemId:3}) + + console.log("删除题干======", { id: curItem.value.id, curItem: curItem.value }); + api.deleteVoteStem(curItem.value.voteStemId) .then(() => { - // message.success('删除题干信息成功') - - }) - + // message.success('删除题干信息成功') + emit("del", { id: curItem.value.id, curItem: curItem.value }); + }) + }; const handleSingleAdd = () => { @@ -92,8 +74,10 @@ export default { inputVal: "", imgVal: "", }); + emit("addOption", curItem); }; const input = ({ id, val }) => { + console.log(id, val) curItem.value.singleList.forEach((item) => { if (item.id === id) { item.inputVal = val; @@ -114,17 +98,28 @@ export default { } }); }; - const del = ({ id }) => { + const del = ({ id, data }) => { + console.log(data) + api.deleteVoteStemOption(data.value.optionId) + .then(() => { + // message.success('删除题干信息成功') + emit("delOption", data); + }) curItem.value.singleList.forEach((item, index) => { if (item.id === id) { curItem.value.singleList.splice(index, 1); } }); - - + + }; + const edit = (data) => { + // console.log('111111-223', data.value) + emit("edits", data) + } + return { curItem, handleTypesDel, @@ -133,6 +128,7 @@ export default { imgSrc, delImg, del, + edit }; }, }; @@ -142,10 +138,12 @@ export default { width: 100%; display: flex; flex-direction: column; + .header { width: 100%; display: flex; justify-content: space-between; + .title { color: #000000; font-size: 18px; @@ -154,10 +152,12 @@ export default { padding-left: 37px; //font-weight: 500; } + .goback { padding-right: 70px; //padding-top: 37px; position: relative; + .return { display: inline-block; width: 42px; @@ -166,6 +166,7 @@ export default { margin-right: 10px; background-image: url("../../assets/images/projectadd/return.png"); } + .returntext { display: inline-block; position: absolute; @@ -175,16 +176,19 @@ export default { } } } + .addtype { display: flex; border-bottom: 1px solid rgba(0, 0, 0, 0.1); margin-right: 20px; align-items: center; margin-left: 41px; + .addtypen { color: #6f6f6f; font-size: 14px; } + .types { cursor: pointer; width: 80px; @@ -197,11 +201,13 @@ export default { align-items: center; margin: 20px 10px; } + .typesCur { color: #fff; background: #409eff; } } + .content { display: flex; flex-direction: column; @@ -210,9 +216,11 @@ export default { min-width: 690px; margin-left: 38px; margin-top: 20px; + .tagbox { display: flex; justify-content: right; + .tagname { width: 90px; height: 32px; @@ -226,6 +234,7 @@ export default { color: rgba(64, 158, 255, 1); font-size: 16px; } + .deleteop { display: flex; justify-content: center; @@ -237,6 +246,7 @@ export default { border: 1px solid #409eff; border-radius: 8px; cursor: pointer; + .del_text { color: #409eff; font-size: 14px; @@ -244,21 +254,25 @@ export default { } } } + .scorebox { display: flex; align-items: center; margin-top: 20px; margin-left: 70px; + .scoretext { font-size: 14px; color: #56a3f9; } + .number { display: flex; border: 1px solid #d7e5fd; border-radius: 5px; margin: 0 10px; padding: 5px; + .btn { width: 40px; height: 40px; @@ -274,30 +288,36 @@ export default { line-height: 24px; cursor: pointer; } + .curBtn { background: #56a3f9; color: #fff; } } } + .picture { width: 100px; display: flex; flex-direction: column; margin-top: 20px; margin-left: 133px; + .pictureimg { width: 100px; height: 100px; } + .picturename { color: #6f6f6f; font-size: 14px; } } + .options { display: flex; } + .delete { cursor: pointer; margin-top: 32px; @@ -306,15 +326,18 @@ export default { color: #4ea6ff; font-size: 14px; } + .name2 { display: flex; align-items: flex-start; } + .name { width: 60%; // background-color: lightcoral; display: flex; margin-top: 20px; + //align-items: center; //height: 40px; // border: 1px solid black; @@ -324,25 +347,30 @@ export default { align-items: center; justify-content: flex-end; flex-shrink: 0; + .nameimg { width: 10px; height: 10px; } } + .inname { color: #6f6f6f; font-size: 14px; margin-left: 7px; font-weight: 700; } + .in { margin-left: 14px; flex: 1; + .assess { display: flex; width: 226px; height: 40px; border: 1px solid #56a3f9; + //margin-bottom: 20px; .assesstype { width: 50%; @@ -352,6 +380,7 @@ export default { justify-content: center; align-items: center; } + .assesswhole { width: 50%; background: rgba(86, 163, 249, 0.1); @@ -361,6 +390,7 @@ export default { justify-content: center; align-items: center; } + .ratio { position: absolute; right: 10px; @@ -369,24 +399,28 @@ export default { font-size: 14px; } } + .addimg { cursor: pointer; color: rgba(78, 166, 255, 1); font-size: 14px; } + .text { color: rgba(109, 117, 132, 1); font-size: 14px; //line-height: 24px; } - .ant-radio-wrapper { - } + + .ant-radio-wrapper {} + .ant-input { border-radius: 5px; // height: 120%; width: 100%; height: 35px; } + .ant-select-selector { border-radius: 5px; // height: 120%; @@ -394,26 +428,32 @@ export default { height: 40px; } } + .numberInp { width: 200px; + .ant-input-number { width: 200px; height: 40px; border-radius: 8px; } + // .ant-input-number-input-wrap { // width: 200px; // } } } } + .name2 { display: flex; align-items: flex-start; } + .opinion { display: flex; margin-top: 30px; + .namebox { width: 120px; display: flex; @@ -421,27 +461,33 @@ export default { justify-content: flex-end; flex-shrink: 0; } + .in { margin-left: 14px; width: 500px; + .ant-input-textarea-show-count { position: relative; height: 110px; } + .ant-input-textarea-show-count::after { position: absolute; right: 10px; bottom: 0px; } + .ant-input { border-radius: 8px; } } } + .footer { width: 100%; margin-top: 31px; margin-bottom: 14px; + .btn { display: flex; margin-bottom: 20px; @@ -452,6 +498,7 @@ export default { .uploadContent { display: block !important; + .uploadBtn { margin-left: 120px !important; } diff --git a/src/components/vote/VoteQuestionItem.vue b/src/components/vote/VoteQuestionItem.vue index a99eda58..d38f3bc6 100644 --- a/src/components/vote/VoteQuestionItem.vue +++ b/src/components/vote/VoteQuestionItem.vue @@ -7,41 +7,27 @@
选项{{ item.id }}
- +
删除
- +
+添加图片
{{ hasImgName }}
- + " src="../../assets/images/basicinfo/close.png" @click="handleCancel" />
@@ -67,12 +53,14 @@ export default { hasImgName: "", }); - const handleInput = () => { - emit("input", { id: curItem.value.id, val: curItem.value.inputVal }); + const handleInput = (value) => { + console.log(value.target.value) + emit("edit", curItem) + emit("input", { id: curItem.value.id, val: value.target.value }); }; const handleDel = () => { handleCancel(); - emit("del", { id: curItem.value.id, optionId: curItem.value.optionId }); + emit("del", { id: curItem.value.id, optionId: curItem.value.optionId, data: curItem }); }; const handleCancel = () => { state.hasImgName = ""; @@ -124,10 +112,12 @@ export default { width: 100%; display: flex; flex-direction: column; + .header { width: 100%; display: flex; justify-content: space-between; + .title { color: #000000; font-size: 18px; @@ -136,10 +126,12 @@ export default { padding-left: 37px; //font-weight: 500; } + .goback { padding-right: 70px; //padding-top: 37px; position: relative; + .return { display: inline-block; width: 42px; @@ -148,6 +140,7 @@ export default { margin-right: 10px; background-image: url("../../assets/images/projectadd/return.png"); } + .returntext { display: inline-block; position: absolute; @@ -157,16 +150,19 @@ export default { } } } + .addtype { display: flex; border-bottom: 1px solid rgba(0, 0, 0, 0.1); margin-right: 20px; align-items: center; margin-left: 41px; + .addtypen { color: #6f6f6f; font-size: 14px; } + .types { cursor: pointer; width: 80px; @@ -179,11 +175,13 @@ export default { align-items: center; margin: 20px 10px; } + .typesCur { color: #fff; background: #409eff; } } + .content { display: flex; flex-direction: column; @@ -192,9 +190,11 @@ export default { min-width: 690px; margin-left: 38px; margin-top: 20px; + .tagbox { display: flex; justify-content: space-between; + .tagname { width: 90px; height: 32px; @@ -208,6 +208,7 @@ export default { color: rgba(64, 158, 255, 1); font-size: 16px; } + .deleteop { display: flex; justify-content: center; @@ -219,6 +220,7 @@ export default { border: 1px solid #409eff; border-radius: 8px; cursor: pointer; + .del_text { color: #409eff; font-size: 14px; @@ -226,21 +228,25 @@ export default { } } } + .scorebox { display: flex; align-items: center; margin-top: 20px; margin-left: 70px; + .scoretext { font-size: 14px; color: #56a3f9; } + .number { display: flex; border: 1px solid #d7e5fd; border-radius: 5px; margin: 0 10px; padding: 5px; + .btn { width: 40px; height: 40px; @@ -258,24 +264,29 @@ export default { } } } + .picture { width: 100px; display: flex; flex-direction: column; margin-top: 20px; margin-left: 133px; + .pictureimg { width: 100px; height: 100px; } + .picturename { color: #6f6f6f; font-size: 14px; } } + .options { display: flex; } + .delete { cursor: pointer; margin-top: 32px; @@ -284,15 +295,18 @@ export default { color: #4ea6ff; font-size: 14px; } + .name2 { display: flex; align-items: flex-start; } + .name { width: 60%; // background-color: lightcoral; display: flex; margin-top: 20px; + //align-items: center; //height: 40px; // border: 1px solid black; @@ -302,25 +316,30 @@ export default { align-items: center; justify-content: flex-end; flex-shrink: 0; + .nameimg { width: 10px; height: 10px; } } + .inname { color: #6f6f6f; font-size: 14px; margin-left: 7px; font-weight: 700; } + .in { margin-left: 14px; flex: 1; + .assess { display: flex; width: 226px; height: 40px; border: 1px solid #56a3f9; + //margin-bottom: 20px; .assesstype { width: 50%; @@ -330,6 +349,7 @@ export default { justify-content: center; align-items: center; } + .assesswhole { width: 50%; background: rgba(86, 163, 249, 0.1); @@ -339,6 +359,7 @@ export default { justify-content: center; align-items: center; } + .ratio { position: absolute; right: 10px; @@ -347,24 +368,28 @@ export default { font-size: 14px; } } + .addimg { cursor: pointer; color: rgba(78, 166, 255, 1); font-size: 14px; } + .text { color: rgba(109, 117, 132, 1); font-size: 14px; //line-height: 24px; } - .ant-radio-wrapper { - } + + .ant-radio-wrapper {} + .ant-input { border-radius: 5px; // height: 120%; width: 100%; height: 35px; } + .ant-select-selector { border-radius: 5px; // height: 120%; @@ -372,26 +397,32 @@ export default { height: 40px; } } + .numberInp { width: 200px; + .ant-input-number { width: 200px; height: 40px; border-radius: 8px; } + // .ant-input-number-input-wrap { // width: 200px; // } } } } + .name2 { display: flex; align-items: flex-start; } + .opinion { display: flex; margin-top: 30px; + .namebox { width: 120px; display: flex; @@ -399,27 +430,33 @@ export default { justify-content: flex-end; flex-shrink: 0; } + .in { margin-left: 14px; width: 500px; + .ant-input-textarea-show-count { position: relative; height: 110px; } + .ant-input-textarea-show-count::after { position: absolute; right: 10px; bottom: 0px; } + .ant-input { border-radius: 8px; } } } + .footer { width: 100%; margin-top: 31px; margin-bottom: 14px; + .btn { display: flex; margin-bottom: 20px; @@ -430,6 +467,7 @@ export default { .uploadContent { display: block !important; + .uploadBtn { margin-left: 120px !important; }