| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <primary-question-card v-if="questionVO!==undefined" :question-v-o="questionVO" :cur-num="curNum" :total-num="totalNum">
- <template v-slot:button>
- <el-col :span="1">
- <el-button type="primary" icon="el-icon-check" circle @click="mockApproveQuestion"/>
- </el-col>
- <el-col :span="1">
- <el-button type="danger" icon="el-icon-close" circle @click="mockDisapproveQuestion"/>
- </el-col>
- </template>
- </primary-question-card>
- </template>
- <script>
- import PrimaryQuestionCard from '@/components/QuestionCard/PrimaryQuestionCard';
- export default {
- name: "CreatingQuestionCard",
- components: {
- PrimaryQuestionCard
- },
- data() {
- return {}
- },
- props: {
- questionVO: Object,
- curNum: Number,
- totalNum: Number
- },
- mounted() {
- },
- methods: {
- // 审核通过新建的题目
- approveQuestion() {
- const _this = this
- _this.questionVO.state = "APPROVED"
- let record = {
- userId: _this.$store.state.user.id,
- operationType: "Approve",
- }
- // 更新题目信息
- _this.$api.updateQuestion(this.questionVO)
- .then(async res => {
- console.log(res)
- _this.$message({
- type: "success",
- message: "新建审核通过",
- })
- record.questionId = res.data.result.id;
- record.time = new Date();
- // 添加新的操作记录
- await _this.$api.createRecord(record)
- .then(recordRes => {
- console.log(recordRes)
- })
- .catch(recordErr => {
- console.log(recordErr)
- })
- // 向父组件更新题目列表信息
- _this.$emit("approve")
- })
- .catch(err=>{
- _this.$message({
- type: "error",
- message: "新建审核不通过"
- })
- })
- },
- // 审核不通过新建的题目
- disapproveQuestion(){},
- mockApproveQuestion() {
- // TODO
- const _this = this
- _this.$message({
- type: "success",
- message: "新建审核通过"
- })
- _this.$emit("approve")
- },
- mockDisapproveQuestion() {
- // TODO
- const _this = this
- _this.$message({
- type: "error",
- message: "新建审核不通过"
- })
- },
- },
- emits:["approve"]
- }
- </script>
- <style scoped>
- </style>
|