lrf 1 年之前
父节点
当前提交
9a678340a9
共有 8 个文件被更改,包括 119 次插入97 次删除
  1. 10 0
      README.md
  2. 0 3
      src/layout/user/clickBtn.vue
  3. 1 1
      src/router/index.js
  4. 17 26
      src/views/class/index.vue
  5. 55 55
      src/views/class/newClass/homework.vue
  6. 22 7
      src/views/login.vue
  7. 9 1
      src/views/user/checkWork.vue
  8. 5 4
      vue.config.js

+ 10 - 0
README.md

@@ -1 +1,11 @@
 测试openid: 12345678 
 测试openid: 12345678 
+http://localhost:8001/login?openid=ocPqjswkUejZHq2ANriNrFFC7A3I&type=4
+班长:ocPqjszboRdEAgYxhJNOD2z5LsNc 
+学委:ocPqjs1RlXKjWwhDW_WcCBcw7bJs
+安全:ocPqjs9exS070MznTAUhGS9NCwB0
+文艺:ocPqjs3SyAPnxHz5pWF6j0SVvf2Y
+宣传:ocPqjs4xFZBYn7J8z9JwlyfAONYg
+普通:ocPqjs94Jaw0vdshaY3Hh0g7UGx8
+学生入学二维码地址(绑定用):
+http://jytz.jilinjobs.cn/api/train/auth?redirect_uri=http://jytz.jilinjobs.cn/student/bind&type=2
+

+ 0 - 3
src/layout/user/clickBtn.vue

@@ -38,9 +38,6 @@
         <el-col :span="24" class="native">
         <el-col :span="24" class="native">
           <van-cell is-link @click="$router.push({ path: '/user/trainVidoe' })">课程培训</van-cell>
           <van-cell is-link @click="$router.push({ path: '/user/trainVidoe' })">课程培训</van-cell>
         </el-col>
         </el-col>
-        <el-col :span="24" class="native" v-if="user.job == '宣传委员'">
-          <van-cell is-link @click="$router.push({ path: '/user/newspaper' })">新人才报</van-cell>
-        </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
   </div>
   </div>

+ 1 - 1
src/router/index.js

@@ -14,7 +14,7 @@ const routes = [
   {
   {
     path: '/confirm',
     path: '/confirm',
     name: 'confirm',
     name: 'confirm',
-    meta: { title: '测试页', isleftarrow: true },
+    meta: { title: '确认绑定', isleftarrow: true },
     component: () => import('../views/bind/confirm.vue'),
     component: () => import('../views/bind/confirm.vue'),
   },
   },
 
 

+ 17 - 26
src/views/class/index.vue

@@ -30,14 +30,7 @@
               <daily :data="studentList" :scoreList="pscoreList" :classInfo="classInfo" :lesson="lesson" @save="dailyUpdate"></daily>
               <daily :data="studentList" :scoreList="pscoreList" :classInfo="classInfo" :lesson="lesson" @save="dailyUpdate"></daily>
             </el-tab-pane>
             </el-tab-pane>
             <el-tab-pane label="作业成绩" name="forth">
             <el-tab-pane label="作业成绩" name="forth">
-              <homework
-                :homeworkList="homeworkList"
-                :homeworkLessonList="homeworkLessonList"
-                @onsist="onsist"
-                :homeworkForm="homeworkForm"
-                @homeworkBtn="homeworkBtn"
-                @homeworkOnsubmit="homeworkOnsubmit"
-              ></homework>
+              <homework :list="achieveList" @submit="onsave"></homework>
             </el-tab-pane>
             </el-tab-pane>
           </el-tabs>
           </el-tabs>
         </el-col>
         </el-col>
@@ -103,9 +96,7 @@ export default {
       // 平时分列表
       // 平时分列表
       pscoreList: [],
       pscoreList: [],
       // 作业成绩
       // 作业成绩
-      homeworkList: [],
-      homeworkLessonList: [],
-      homeworkForm: {},
+      achieveList: [],
       // 班级信息
       // 班级信息
       classInfo: {},
       classInfo: {},
       // 课程信息
       // 课程信息
@@ -305,24 +296,24 @@ export default {
     },
     },
     // forth作业成绩
     // forth作业成绩
     async searchHomework() {
     async searchHomework() {
-      if (this.user.job == '学委') {
-        this.$set(this, `homeworkList`, this.studentList);
-      } else {
-        let classid = this.user.classid;
-        const res = await this.uploadtasklist({ classid });
-        for (const val of res.data) {
-          var arr = this.studentList.filter(item => item.id === val.studentid);
-          this.$set(this, `homeworkList`, arr);
-        }
+      let classid = this.user.classid;
+      const res = await this.uploadtasklist({ classid });
+      const stuGroups = _.groupBy(res.data, 'studentid');
+      const aList = [];
+      for (const id in stuGroups) {
+        const head = stuGroups[id][0];
+        if (!head) continue;
+        const { stuname: name } = head;
+        const newobj = { name, lesson: stuGroups[id] };
+        aList.push(newobj);
       }
       }
+      this.$set(this, `achieveList`, aList);
     },
     },
     // 当前学生上传科目成绩
     // 当前学生上传科目成绩
-    async onsist({ id }) {
-      const res = await this.uploadtasklist({ studentid: id });
-      if (res.errcode === 0) {
-        let homeworkLessonList = _.uniqBy(res.data, 'lessonid');
-        this.$set(this, `homeworkLessonList`, homeworkLessonList);
-      }
+    async onsave({ data }) {
+      const obj = { id: data.id, score: data.score };
+      await this.uploadtaskUpdate(obj);
+      this.search();
     },
     },
     // 打开上成绩
     // 打开上成绩
     homeworkBtn({ data }) {
     homeworkBtn({ data }) {

+ 55 - 55
src/views/class/newClass/homework.vue

@@ -1,29 +1,29 @@
 <template>
 <template>
   <div id="homework">
   <div id="homework">
     <el-row>
     <el-row>
-      <el-col :span="24" class="homework">
+      <el-col :span="24" class="list">
         <van-collapse v-model="openCollapse" accordion>
         <van-collapse v-model="openCollapse" accordion>
-          <van-collapse-item :name="index" v-for="(item, index) in homeworkList" :key="index">
-            <div slot="title" class="title" @click="onsist(item.id)">
+          <van-collapse-item :name="index" v-for="(item, index) in list" :key="index">
+            <div slot="title" class="title">
               <span class="name">{{ item.name }}</span>
               <span class="name">{{ item.name }}</span>
             </div>
             </div>
-            <van-row class="homeworkLessonList" v-for="(tag, index) in homeworkLessonList" :key="index">
-              <van-col span="18" class="info">
-                <p>课程名称:{{ tag.lessonname }}</p>
-                <p>作业分: {{ tag.score }}分</p>
-              </van-col>
-              <van-col span="6" class="btn">
-                <van-button v-if="user.job == '学委'" type="info" size="mini" @click="homeworkBtn(tag)">上成绩</van-button>
-              </van-col>
+            <van-row v-for="(tag, index) in item.lesson" :key="index">
+              <el-col :span="18">
+                <van-col :span="24" class="score"> 名称:{{ tag.lessonname }} </van-col>
+                <van-col :span="24" class="score"> 作业分: {{ tag.score }}分</van-col>
+              </el-col>
+              <el-col :span="6" class="anniu">
+                <van-button v-if="user.job == '学委'" type="primary" size="mini" @click="clickBtn(tag.id, tag.lessonname, tag.score)">上成绩</van-button>
+              </el-col>
             </van-row>
             </van-row>
           </van-collapse-item>
           </van-collapse-item>
         </van-collapse>
         </van-collapse>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
-    <van-dialog v-model="show" title="学生成绩上传" :showConfirmButton="false">
-      <van-form @submit="homeworkOnsubmit">
-        <van-field v-model="homeworkForm.lessonname" name="课程名称" label="课程名称" readonly />
-        <van-field v-model="homeworkForm.score" type="digit" name="作业分数" label="作业分数" placeholder="请输入作业分数" />
+    <van-dialog v-model="show" @before-close="closeDialog" title="学生成绩上传" :showConfirmButton="false" show-cancel-button>
+      <van-form @submit="onSubmit">
+        <span class="lesson">课程名称</span><span class="lesson">{{ form.name }}</span>
+        <van-field v-model="form.score" name="作业分数" label="作业分数" placeholder="请输入作业分数" />
         <div style="margin: 16px;">
         <div style="margin: 16px;">
           <van-button round block type="info" native-type="submit">
           <van-button round block type="info" native-type="submit">
             提交
             提交
@@ -35,45 +35,45 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { mapState, createNamespacedHelpers } from 'vuex';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 export default {
 export default {
   name: 'homework',
   name: 'homework',
   props: {
   props: {
-    homeworkList: { type: Array },
-    homeworkLessonList: { type: Array },
-    homeworkForm: { type: Object },
+    list: null,
   },
   },
   components: {},
   components: {},
-  data: function() {
-    return {
-      openCollapse: [],
-      show: false,
-    };
-  },
+  data: () => ({
+    ruleForm: {
+      region: '',
+      lesson: [],
+    },
+    show: false,
+    dscore: 0,
+    form: {},
+    value: '',
+    openCollapse: [],
+  }),
   created() {},
   created() {},
+  computed: { ...mapState(['user']) },
   methods: {
   methods: {
-    onsist(id) {
-      this.$emit('onsist', { id: id });
+    clickcds(index) {
+      this.openCollapse = index;
     },
     },
-    // 学生上成绩
-    homeworkBtn(data) {
+    clickBtn(id, name, score) {
+      this.form = { id, name, score };
+      this.dscore = score;
       this.show = true;
       this.show = true;
-      this.$emit('homeworkBtn', { data: data });
     },
     },
-    homeworkOnsubmit() {
-      this.$emit('homeworkOnsubmit', { data: this.homeworkForm });
-      this.show = false;
+    onSubmit() {
+      this.$emit('submit', { data: this.form });
+      this.closeDialog();
     },
     },
-  },
-  computed: {
-    ...mapState(['user']),
-    pageTitle() {
-      return `${this.$route.meta.title}`;
+    closeDialog() {
+      this.form = {};
+      this.show = false;
+      this.dscore = 0;
     },
     },
   },
   },
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
 };
 };
 </script>
 </script>
 
 
@@ -82,17 +82,17 @@ p {
   padding: 0;
   padding: 0;
   margin: 0;
   margin: 0;
 }
 }
-.homework {
+.list {
   margin: 5px;
   margin: 5px;
   width: 97%;
   width: 97%;
   padding: 0 10px;
   padding: 0 10px;
   border-radius: 15px;
   border-radius: 15px;
 }
 }
-.homework .title {
+.list .title {
   float: left;
   float: left;
   width: 100%;
   width: 100%;
 }
 }
-.homework .name {
+.list .name {
   float: left;
   float: left;
   width: 80%;
   width: 80%;
   font-size: 20px;
   font-size: 20px;
@@ -112,16 +112,16 @@ p {
 /deep/.el-collapse-item__content {
 /deep/.el-collapse-item__content {
   padding: 10px 0 10px 0;
   padding: 10px 0 10px 0;
 }
 }
-.homeworkLessonList {
-  border-bottom: 1px dashed #ccc;
-  padding: 5px 0 0 0;
-  .info {
-    p {
-      font-size: 16px;
-    }
-  }
-  .btn {
-    text-align: right;
-  }
+.list .score {
+  padding: 5px 0;
+  font-size: 18px;
+}
+.anniu {
+  padding: 20px 0 0 0;
+}
+.lesson {
+  font-size: 14px;
+  padding: 0 21px 0 16px;
+  color: #323233;
 }
 }
 </style>
 </style>

+ 22 - 7
src/views/login.vue

@@ -6,7 +6,8 @@
 
 
 <script>
 <script>
 const jwt = require('jsonwebtoken');
 const jwt = require('jsonwebtoken');
-
+import { createNamespacedHelpers } from 'vuex';
+const { mapActions: login } = createNamespacedHelpers('login');
 export default {
 export default {
   metaInfo: { title: '正在登陆...' },
   metaInfo: { title: '正在登陆...' },
   name: 'login',
   name: 'login',
@@ -15,17 +16,30 @@ export default {
   data: () => ({
   data: () => ({
     is_dev: process.env.NODE_ENV === 'development',
     is_dev: process.env.NODE_ENV === 'development',
   }),
   }),
-  created() {
+  async created() {
     this.$toast.loading({
     this.$toast.loading({
       message: '登陆中...',
       message: '登陆中...',
       duration: 0,
       duration: 0,
     });
     });
     let token = this.$route.query.token;
     let token = this.$route.query.token;
-    let user = jwt.decode(token);
-    sessionStorage.setItem('user', JSON.stringify(user));
-    this.$toast.clear();
-    if (this.redirect_uri) this.$router.push(this.redirect_uri);
-    else if (!this.is_dev) this.toIndex();
+    if (token) {
+      let user = jwt.decode(token);
+      sessionStorage.setItem('user', JSON.stringify(user));
+      this.$toast.clear();
+      if (this.redirect_uri) this.$router.push(this.redirect_uri);
+      else if (!this.is_dev) this.toIndex();
+    } else {
+      let openid = this.$route.query.openid;
+      let type = this.$route.query.type;
+      if (openid && type) {
+        const obj = { openid, type };
+        const res = await this.openidLogin(obj);
+        if (res.data) {
+          this.$toast.clear();
+          this.$router.push({ path: '/', query: { token: res.data } });
+        }
+      }
+    }
   },
   },
   computed: {
   computed: {
     redirect_uri() {
     redirect_uri() {
@@ -33,6 +47,7 @@ export default {
     },
     },
   },
   },
   methods: {
   methods: {
+    ...login(['openidLogin']),
     toIndex() {
     toIndex() {
       this.$router.push({ path: '/' });
       this.$router.push({ path: '/' });
     },
     },

+ 9 - 1
src/views/user/checkWork.vue

@@ -56,7 +56,15 @@ export default {
     async search() {
     async search() {
       let studentid = this.user.userid;
       let studentid = this.user.userid;
       const res = await this.query({ studentid });
       const res = await this.query({ studentid });
-      this.$set(this, `list`, res.data[0].attend);
+      const d = [
+        {
+          date: '2021-05-06',
+          time: '07:50',
+          type: '0',
+          status: '1',
+        },
+      ];
+      this.$set(this, `list`, d);
     },
     },
   },
   },
 };
 };

+ 5 - 4
vue.config.js

@@ -1,10 +1,11 @@
 const path = require('path');
 const path = require('path');
 const question = path.resolve(__dirname, '../question-examine');
 const question = path.resolve(__dirname, '../question-examine');
 const frame = path.resolve(__dirname, '../frame');
 const frame = path.resolve(__dirname, '../frame');
+const ip = 'http://127.0.0.1';
 module.exports = {
 module.exports = {
   publicPath: process.env.NODE_ENV === 'development' ? '/' : '/student',
   publicPath: process.env.NODE_ENV === 'development' ? '/' : '/student',
   outputDir: 'student',
   outputDir: 'student',
-  configureWebpack: config => {
+  configureWebpack: (config) => {
     Object.assign(config, {
     Object.assign(config, {
       // 开发生产共同配置
       // 开发生产共同配置
       resolve: {
       resolve: {
@@ -28,16 +29,16 @@ module.exports = {
         ws: true,
         ws: true,
       },
       },
       '/ws': {
       '/ws': {
-        target: 'http://free.liaoningdoupo.com',
+        target: 'http://jytz.jilinjobs.cn',
         ws: true,
         ws: true,
       },
       },
       '/weixin': {
       '/weixin': {
-        target: 'http://smart.cc-lotus.info',
+        target: 'http://jytz.jilinjobs.cn',
         changeOrigin: true,
         changeOrigin: true,
         ws: true,
         ws: true,
       },
       },
       '/api': {
       '/api': {
-        target: 'http://127.0.0.1:2001',
+        target: ip,
         changeOrigin: true,
         changeOrigin: true,
         ws: true,
         ws: true,
       },
       },