123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <div id="homework">
- <el-row>
- <el-col :span="24" class="style">
- <el-col :span="24" class="top">
- <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
- </el-col>
- <el-col :span="24" class="main">
- <el-col :span="24" class="leaveBtn"> </el-col>
- <el-col :span="24" class="leaveList">
- <shangchuan :form="form" @onConfirm="onsave"></shangchuan>
- </el-col>
- <el-col :span="24" class="foot">
- <footInfo></footInfo>
- </el-col>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import NavBar from '@/layout/common/topInfo.vue';
- import shangchuan from '@/layout/user/shangchuan.vue';
- import footInfo from '@/layout/common/footInfo.vue';
- import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
- const { mapActions: mapUploadtask } = createNamespacedHelpers('uploadtask');
- export default {
- name: 'homework',
- props: {},
- components: {
- NavBar, //头部导航
- shangchuan,
- footInfo,
- },
- data: () => ({
- form: {
- // picrul: [{ url: 'fksdfhksdhfsk' }],
- },
- show: false,
- navShow: true,
- title: '',
- isleftarrow: '',
- }),
- mounted() {
- this.title = this.$route.meta.title;
- this.isleftarrow = this.$route.meta.isleftarrow;
- },
- watch: {
- $route(to, from) {
- this.title = to.meta.title;
- this.isleftarrow = to.meta.isleftarrow;
- },
- },
- created() {},
- computed: {
- ...mapState(['user']),
- id() {
- return this.$route.query.id;
- },
- lessonid() {
- return this.$route.query.lessonid;
- },
- name() {
- return this.$route.query.name;
- },
- },
- methods: {
- ...mapUploadtask({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
- //提交上传
- async onsave(form) {
- this.form.termid = this.user.termid;
- this.form.batchid = this.user.batchid;
- this.form.classid = this.user.classid;
- this.form.studentid = this.user.userid;
- this.form.lessonid = this.lessonid;
- this.form.lessonname = this.name;
- let data = this.form;
- console.log();
- if (data.picrul) {
- let res = await this.add(data);
- this.$checkRes(res, '提交成功', res.errmsg);
- } else {
- this.$message({
- showClose: true,
- message: '请上传图片',
- type: 'error',
- });
- }
- //
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .style {
- width: 100%;
- min-height: 667px;
- position: relative;
- background-color: #f9fafc;
- }
- .top {
- height: 46px;
- overflow: hidden;
- }
- .main {
- min-height: 570px;
- }
- .main .leaveBtn {
- text-align: center;
- padding: 15px 0;
- }
- </style>
|