@@ -14,7 +14,9 @@
</el-col>
<el-col :span="6" class="anniu">
<van-col :span="3" class="score">
- <van-button type="primary" size="mini" @click="clickBtn(tag.taskid, tag.name, tag.score)">上成绩</van-button>
+ <van-button v-if="user.job == '学委' || user.type == '3'" type="primary" size="mini" @click="clickBtn(tag.taskid, tag.name, tag.score)"
+ >上成绩</van-button
+ >
</van-col>
</van-row>
@@ -37,6 +39,7 @@
</template>
<script>
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
export default {
name: 'homeworkAchiece',
props: {
@@ -61,7 +64,7 @@ export default {
openCollapse: [],
}),
created() {},
- computed: {},
+ computed: { ...mapState(['user']) },
methods: {
onConfirm(value) {
this.value = value;
@@ -10,7 +10,7 @@
<span>分数:{{ item.selfscore }}分</span>
<el-col :span="4" class="score">
- <el-button type="primary" size="mini" @click="showBtn(item.id)" round>选择</el-button>
+ <el-button type="primary" v-if="user.job == '学委' || user.type == '3'" size="mini" @click="showBtn(item.id)" round>选择</el-button>
@@ -22,6 +22,7 @@
name: 'peaceAchieve',
@@ -34,7 +35,9 @@ export default {
columns: ['1', '2', '3', '4', '5', '7', '8', '9', '10'],
+ computed: {
+ ...mapState(['user']),
+ },
showBtn(id) {
this.$emit('showBtn', id);
@@ -7,7 +7,7 @@
<el-col :span="18">科目:{{ item.subname }}</el-col>
<el-button v-if="item.display === 'second'" type="primary" size="small" @click="clickBtn(item.subname, item.subid, item._id)">在线作答</el-button>
- <el-button v-else type="primary" size="small" @click="clickzy(item._id)">上传作业</el-button>
+ <el-button v-else type="primary" size="small" @click="clickzy(item.subid)">上传作业</el-button>
@@ -32,10 +32,8 @@ export default {
clickBtn(subname, subid, _id) {
this.$router.push({ path: '/user/dati', query: { name: subname, id: subid, lessonid: _id } });
},
- clickzy(_id) {
- console.log(_id);
-
- this.$router.push({ path: '/user/chuanzuoye', query: { id: _id } });
+ clickzy(subid) {
+ this.$router.push({ path: '/user/chuanzuoye', query: { id: subid } });
};
@@ -111,6 +111,7 @@ export default {
for (const accc of res.data) {
var arr = result.data.filter(item => item.studentid === accc.id);
}
+
// let lessons = [];
let lessone = [];
let stus = [];
@@ -147,7 +148,9 @@ export default {
stus = [...stu, ...stus];
//去掉重复数组对象
- var appArray = _.uniqWith(stus, _.isEqual);
+ var appArray = _.uniqBy(stus, _.isEqual);
+ console.log(appArray);
//合并数组
this.$set(this, `achieveList`, appArray);
@@ -73,20 +73,20 @@ export default {
const res = await this.lessonList({ classid });
const resout = await this.list();
console.log(res.data);
- for (const val of resout.data) {
- for (const tyl of res.data) {
- var crr = tyl.lessons.filter(item => item.subid);
+ let lessons = _.get(res.data[0], `lessons`);
+ let r = _.uniqBy(lessons, 'subid');
+ r = r.filter(f => f.subid);
+ console.log(r);
- var appArray = _.uniqWith(crr, _.isEqual);
- console.log(appArray);
+ var crr = r.filter(item => item.subid);
+ console.log(crr);
- this.$set(this, `workLists`, appArray);
- }
- var arr = crr.filter(item => item.subid === val.code);
- for (const att of arr) {
- att.display = 'second';
+ this.$set(this, `workLists`, crr);
+ // var arr = crr.filter(item => item.subid === val.code);
+ // for (const att of arr) {
+ // att.display = 'second';
+ // }
@@ -67,6 +67,10 @@ export default {
// this.form.studentid = '5e4f3d096a90e861b0f30871';
this.form.studentid = this.user.userid;
this.form.type = '0';
+ this.form.batchid = this.user.batchid;
+ this.form.termid = this.user.termid;
+ this.form.classid = this.user.classid;
+ this.form.stuname = this.user.name;
let data = this.form;
let res = await this.create(data);
@@ -52,7 +52,9 @@ export default {
...mapClass({ classinfo: 'query' }),
...mapStudent({ stuQuery: 'query', stuFetch: 'fetch' }),
async searchInfo({ ...info } = {}) {
- const res = await this.classinfo({ ...info });
+ let batchid = this.user.batchid;
+ let termid = this.user.termid;
+ const res = await this.classinfo({ batchid, termid, ...info });
this.$set(this, `classList`, res.data);