Blame view

src/views/portrait/index.vue 6.1 KB
77ebf04d   梁保满   个人版
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  <template>
    <div>
      <back-box>
        <template slot="title">
          <span>{{ "学生画像" }}</span>
        </template>
      </back-box>
      <div class="answer-header">
        <div class="sel-box">
          <el-select
            class="sel"
            v-model="query.classId"
            placeholder="选择班级"
            @change="changeclass"
          >
            <el-option
              v-for="item in classList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
38bdc422   梁保满   学生画像班主任和任课教师接口区分
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
          <el-input
            placeholder="请输入学生姓名"
            v-model="query.studentName"
            class="input-with-select"
            maxlength="30"
            @keyup.enter.native="(query.studentCode = ''), _QueryData()"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="(query.studentCode = ''), _QueryData()"
            ></el-button>
          </el-input>
          <el-input
            placeholder="请输入学生学号"
            v-model="query.studentCode"
            class="input-with-select"
            maxlength="30"
            @keyup.enter.native="(query.studentName = ''), _QueryData()"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="(query.studentName = ''), _QueryData()"
            ></el-button>
          </el-input>
77ebf04d   梁保满   个人版
50
51
52
53
54
55
56
57
58
59
60
        </div>
      </div>
      <div class="page-content">
        <ul class="stu-ul">
          <li class="stu-li" v-for="item in tableData" :key="item.studentId">
            <div class="tx">
              <i class="fa fa-mortar-board"></i>
              <p>{{ item.studentCode }}</p>
            </div>
            <div class="info">
              <p class="p1">
38bdc422   梁保满   学生画像班主任和任课教师接口区分
61
62
63
64
                {{ item.studentName }}
                <template v-if="item.clickerSn"
                  ><i class="fa fa-calculator"></i> {{ item.clickerSn }}</template
                >
77ebf04d   梁保满   个人版
65
              </p>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
66
67
              <p class="p2">{{ gradeName(item.grade) }}</p>
              <p class="p3">最近活跃:{{ item.modifiedTime }}</p>
77ebf04d   梁保满   个人版
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
            </div>
            <el-button
              class="btn"
              type="primary"
              round
              circle
              icon="el-icon-right"
              @click="linkDetail(item)"
            ></el-button>
          </li>
        </ul>
      </div>
    </div>
  </template>
  
  <script>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
84
  import { formatDate, setGradeName } from "utils";
77ebf04d   梁保满   个人版
85
86
87
88
  import BusEvent from "@/utils/busEvent";
  export default {
    data() {
      return {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
89
        role: "",
77ebf04d   梁保满   个人版
90
91
92
        query: {
          //搜索条件
          classId: "",
38bdc422   梁保满   学生画像班主任和任课教师接口区分
93
94
          studentName: "",
          studentCode: "",
77ebf04d   梁保满   个人版
95
96
97
        },
        date: "",
        classList: [],
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
98
        tableData: [],
77ebf04d   梁保满   个人版
99
        page: 1,
38bdc422   梁保满   学生画像班主任和任课教师接口区分
100
        size: 999,
77ebf04d   梁保满   个人版
101
102
103
104
        total: 0,
      };
    },
    async created() {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
105
106
107
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
77ebf04d   梁保满   个人版
108
      await this._QueryClassList();
38bdc422   梁保满   学生画像班主任和任课教师接口区分
109
      await this._QueryData();
77ebf04d   梁保满   个人版
110
111
112
113
114
    },
    activated() {
      const that = this;
      BusEvent.$on("keepAlive", async function () {
        await that._QueryClassList();
38bdc422   梁保满   学生画像班主任和任课教师接口区分
115
        await that._QueryData();
77ebf04d   梁保满   个人版
116
117
118
      });
    },
    methods: {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
119
120
121
      gradeName(type) {
        return setGradeName(type);
      },
77ebf04d   梁保满   个人版
122
123
124
125
      linkDetail(obj) {
        this.$router.push({
          path: "/portraitDetail",
          query: {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
126
127
128
129
            studentName: obj.studentName,
            studentCode: obj.studentCode,
            id: obj.id,
            classId: this.query.classId,
77ebf04d   梁保满   个人版
130
131
132
133
134
          },
        });
      },
      changeclass() {
        this.page = 1;
38bdc422   梁保满   学生画像班主任和任课教师接口区分
135
136
        this.query.studentName = "";
        this.query.studentCode = "";
77ebf04d   梁保满   个人版
137
138
        this._QueryData();
      },
77ebf04d   梁保满   个人版
139
      async _QueryClassList() {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
140
141
142
        let fetchClassList =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pClassList
38bdc422   梁保满   学生画像班主任和任课教师接口区分
143
144
            : this.role == "ROLE_BANZHUREN"
            ? this.$request.cTClassList
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
145
146
147
            : this.$request.fetchClassList;
  
        const { data, status, info } = await fetchClassList();
77ebf04d   梁保满   个人版
148
149
150
        if (status === 0) {
          this.classList = data.list.map((item) => {
            return {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
151
              value: this.role == "ROLE_PERSONAL" ? item.id : item.classId,
77ebf04d   梁保满   个人版
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
              label: item.className,
            };
          });
          this.query.classId = this.classList[0]?.value;
        } else {
          this.$message.error(info);
        }
      },
      async _QueryData() {
        this.loading = true;
        let query = {};
        for (let key in this.query) {
          if (this.query[key] != "") {
            query[key] = this.query[key];
          }
        }
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
168
169
170
171
172
        let studentList =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pStudentList
            : this.$request.tStudentList;
        const { data, status, info } = await studentList({
77ebf04d   梁保满   个人版
173
          ...query,
77ebf04d   梁保满   个人版
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
          size: this.size,
        });
        this.loading = false;
        if (status === 0) {
          this.tableData = (data?.list && [...data?.list]) || [];
          this.total = data.count || 0;
        } else {
          this.$message.error(info);
        }
      },
    },
  };
  </script>
  
  <style lang="scss" scoped>
  .page-content {
    padding: 0 20px;
  }
  .stu-ul {
    border-radius: 20px;
    background: #f8f8f8;
    padding: 12px;
    .stu-li {
      border-radius: 12px;
      background: #fff;
      display: flex;
      align-items: center;
      padding: 12px 10px;
      margin-bottom: 16px;
      &:last-of-type {
        margin-bottom: 0;
      }
      .tx {
3617eaad   梁保满   长水账号设置
207
        width: 100px;
77ebf04d   梁保满   个人版
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
        height: 80px;
        background: #667ffd;
        border-radius: 8px;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 16px;
        color: #fff;
        margin-right: 12px;
        .fa-mortar-board {
          font-size: 32px;
        }
      }
      .info {
        flex: 1;
        .p1 {
          font-size: 18px;
          color: #333;
          .fa-calculator {
            font-size: 20px;
            color: #a6a6a6;
            margin: 0 5px 10px 10px;
          }
        }
        .p2 {
          font-size: 16px;
          padding-bottom: 6px;
        }
        .p3 {
          font-size: 16px;
          color: #7f7f7f;
        }
      }
      .btn {
        margin-right: 40px;
        &.is-circle {
          padding: 8px;
        }
        :deep(.el-icon-right) {
          font-size: 22px;
          font-weight: bold;
        }
      }
    }
  }
  </style>