项目实训记录(第10-11周)


前言

这两周主要开发了教师端的讨论区功能


一、教师端讨论区功能设想

和学生端的讨论区相似,教师端的讨论区同样分为两级。但是最关键的区别是教师有权管理这些讨论,例如说删除一些讨论;为这些讨论评级,这主要是为后面自动化地帮助教师统计学生平时讨论分数而服务。如果教师回复了某位同学的讨论,那就意味着这条讨论为优质讨论,如果教师认为某一条讨论在有“水群”嫌疑,那么教师可以删除这条讨论,系统会自动将这条讨论设置为质量差的讨论。如果教师删除的是1级讨论,那么会将该条1级讨论下面的2级讨论都删除并设置为差评。希望最后根据讨论的数量和质量判定平时的讨论分数。

二、教师端讨论区部分关键代码

1、前端

    bad(i, tag) {

      this.comments.splice(i, 1);
      this.$message({
        showClose: true,
        type: 'success',
        message: '删除成功'
      })
      console.log(tag)

      this.axios({
        url: '/teacher/bad',
        method: 'post',
        transformRequest: [function (data) {      //在请求之前对data传参进行格式转换
          data = JSON.stringify(data)
          return data
        }],
        data: {
          cid: this.class_id,
          sid: this.my_user,
          tag: tag,

          identity: 'teacher',
        },
        headers: {
          'Content-Type': 'application/json;charset=utf-8'
        }
      }).then(
          (res) => {
            // 在 then的内部不能使用Vue的实例化的this, 因为在内部 this 没有被绑定。
            console.log(res)

          },
          function (res) {
            alert("操作未成功")
            console.log(res)
            console.log('啊呀,出错啦')
          }
      )
    },
    bad2(i,j,tag){
      this.comments[i].reply.splice(j, 1);
      this.$message({
        showClose: true,
        type: 'success',
        message: '删除成功'
      })
      console.log(tag)

      this.axios({
        url: '/teacher/bad2',
        method: 'post',
        transformRequest: [function (data) {      //在请求之前对data传参进行格式转换
          data = JSON.stringify(data)
          return data
        }],
        data: {
          cid: this.class_id,
          sid: this.my_user,
          tag: tag,

          identity: 'teacher',
        },
        headers: {
          'Content-Type': 'application/json;charset=utf-8'
        }
      }).then(
          (res) => {
            // 在 then的内部不能使用Vue的实例化的this, 因为在内部 this 没有被绑定。
            console.log(res)

          },
          function (res) {
            alert("操作未成功")
            console.log(res)
            console.log('啊呀,出错啦')
          }
      )

    },

上述代码是给某一条讨论评定为质量差时的代码

2、后端

    @RequestMapping(value = "/teacher/bad", method = RequestMethod.POST) //接口请求的地址
    public void getTeacherBad(@RequestBody JSONObject bad) {
        String cid = bad.getString("cid");
        String sid = bad.getString("sid");
        String tag = bad.getString("tag");


      teacherService.getTeacherBad(cid,tag);
        //System.out.println(list.size());

    }
    public void getTeacherBad(String cid,String tag) {//[start,end)
        teacherMapper.getTeacherBad(cid,tag);
        System.out.println("pppppppp");
        System.out.println(tag);
        System.out.println("pppppppp");
        //查这个评论后面跟风的评论,一律设为bad,
        List<comment2> list = teacherMapper.getTeacherShow_reply0(cid, tag);
        for(comment2 temp:list){
            int temptag=temp.getTag();
            String taguse=Integer.toString(temptag);
            teacherMapper.getTeacherBad(cid,taguse);
        }
    }

//mapper
    void getTeacherBad(String cid,String tag);


//xml

    <select id="getTeacherBad" resultType="String">
        update comment
         set ifgood= 'bad'
          where cid=#{cid} tag=#{tag}
    </select>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值