Browse Source

Merge branch 'master' of http://git.cc-lotus.info/new_train/frame

wuhongyuq 5 năm trước cách đây
mục cha
commit
c8b240ceff

+ 0 - 1
components/data-table.vue

@@ -1,5 +1,4 @@
 <template>
-  <!-- TODO 多选回显显示有问题.没显示对号 row-key="id"  @selection-change="rows => handleSelectionChange(rows, 'select')"  -->
   <div id="data-table">
     <el-table
       ref="table"

+ 4 - 0
components/form.md

@@ -15,6 +15,10 @@
 |custom|Boolean|`-`|否|是否使用自定义插槽|
 |tip|String|`-`|否|提示语,例如:请输入11位电话号码|
 |labelWidth|String|`120px`|否|表单label宽度,element的,默认120px|
+|useEnter|Boolean|true|否|是否使用回车提交|
+
+###### submitText
+> String 非必填 默认值: 保存 提交按钮的文字
 
 ###### rules
 > object类型 非必填 校验规则,不会找el-form的例子,不过使用的async-validator这个依赖为基础,会写这个也可以~~(那就厉害了,反正我是不行)~~

+ 7 - 2
components/form.vue

@@ -42,7 +42,11 @@
                   <wang-editor v-model="form[item.model]"></wang-editor>
                 </template>
                 <template v-else-if="item.type === 'text'">
-                  {{ form[item.model] }}
+                  <el-row>
+                    <el-col :span="24">
+                      {{ form[item.model] }}
+                    </el-col>
+                  </el-row>
                 </template>
                 <template v-else>
                   <el-input
@@ -64,7 +68,7 @@
       <el-form-item v-if="needSave" class="btn">
         <el-row type="flex" align="middle" justify="space-around">
           <el-col :span="6">
-            <el-button type="primary" @click="save">登录</el-button>
+            <el-button type="primary" @click="save">{{ submitText }}</el-button>
           </el-col>
         </el-row>
       </el-form-item>
@@ -89,6 +93,7 @@ export default {
     needSave: { type: Boolean, default: true },
     labelWidth: { type: String, default: '120px' },
     useEnter: { type: Boolean, default: true },
+    submitText: { type: String, default: '保存' },
   },
   components: {
     wangEditor,

+ 46 - 0
components/pic.vue

@@ -0,0 +1,46 @@
+<template>
+  <div id="pic">
+    <el-tooltip content="点击放大" placement="right">
+      <el-image :src="src" :style="styles" :fit="fit" :preview-src-list="list"></el-image>
+    </el-tooltip>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+export default {
+  name: 'pic',
+  props: {
+    src: { type: String, required: true },
+    styles: {
+      type: Object,
+      default: () => {
+        return { width: `150px`, height: `150px` };
+      },
+    },
+    fit: { type: String, default: 'scale-down' },
+  },
+  components: {},
+  data: () => ({
+    list: [],
+  }),
+  created() {},
+  computed: {},
+  methods: {},
+  watch: {
+    src: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val) {
+          if (_.isArray(val)) {
+            this.$set(this, `list`, val);
+          } else if (_.isString(val)) this.list.push(val);
+        }
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 11 - 2
layout/register/login.vue

@@ -14,7 +14,16 @@
             <el-col :span="24">
               <el-tabs v-model="activeName" type="border-card" :stretch="true">
                 <el-tab-pane label="账号登录" name="first">
-                  <data-form :data="{}" :fields="fields" :rules="rules" @save="handleSave" :isNew="true" label-width="80px" :styles="{}"> </data-form>
+                  <data-form
+                    :data="{}"
+                    :fields="fields"
+                    :rules="rules"
+                    @save="handleSave"
+                    :isNew="true"
+                    label-width="80px"
+                    :styles="{}"
+                    submitText="登陆"
+                  ></data-form>
                 </el-tab-pane>
                 <el-tab-pane label="扫码登录" name="second">
                   扫码登录
@@ -46,7 +55,7 @@ export default {
       { label: '密码', required: true, model: 'passwd', type: 'password' },
     ],
     rules: {
-      name: [{ required: true, message: '请输入用户名' }],
+      mobile: [{ required: true, message: '请输入手机号' }],
       passwd: [{ required: true, message: '请输入密码' }],
     },
     form: {},

+ 0 - 1
parts/time-table.vue

@@ -109,7 +109,6 @@ export default {
       return `周${word}`;
     },
     getDate(date) {
-      console.log(date);
       let arr = date.split('-');
       return `${arr[1]}月${arr[2]}日`;
     },

+ 1 - 0
store/attendance.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/bedroom.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/classes.js

@@ -42,6 +42,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/dept.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/dir-plan.js

@@ -41,6 +41,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/director.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/duty.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/group.js

@@ -46,6 +46,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/leave.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/lesson.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/location.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 13 - 7
store/login.js

@@ -13,7 +13,7 @@ const state = () => ({});
 const mutations = {};
 
 const actions = {
-  async login({ commit }, { user, router }) {
+  async login({ commit }, { user, router, path = '/', needReturn = false }) {
     const res = await this.$axios.$post(`${api.interface}`, user);
     if (res.errcode === 0) {
       let user = jwt.decode(res.data);
@@ -26,7 +26,10 @@ const actions = {
           type: 'success',
           duration: 2000,
         });
-        router.push('/');
+        if (needReturn) return res;
+        else {
+          router.push(path);
+        }
       } else {
         Notification({
           title: '请重新登陆',
@@ -36,11 +39,14 @@ const actions = {
         console.warn('非当前端用户,需要重新登陆');
       }
     } else {
-      Notification({
-        title: '登录失败',
-        message: `失败原因:${res.errmsg}`,
-        type: 'error',
-      });
+      if (needReturn) return res;
+      else {
+        Notification({
+          title: '登录失败',
+          message: `失败原因:${res.errmsg}`,
+          type: 'error',
+        });
+      }
     }
   },
   async update({ commit }, { id, ...info }) {

+ 1 - 0
store/nation.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/question-answer.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/question-completion.js

@@ -37,6 +37,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/question.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/sch-import.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/sch-plan.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/school.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/score.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/student.js

@@ -41,6 +41,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/subject.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/task.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/tea-plan.js

@@ -41,6 +41,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 6 - 0
store/teacher.js

@@ -5,6 +5,7 @@ import axios from 'axios';
 Vue.use(Vuex);
 const api = {
   interface: `/api/train/teacher`,
+  status: `/api/train/teacher/status`,
 };
 const state = () => ({});
 const mutations = {};
@@ -32,12 +33,17 @@ const actions = {
     const res = await this.$axios.$delete(`${api.interface}/${payload}`);
     return res;
   },
+  async status({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.status}`, payload);
+    return res;
+  },
   async mergeRequest({ commit, dispatch }, { method, data }) {
     let toRequest = () => {
       let res = [];
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/termquest.js

@@ -36,6 +36,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 1 - 0
store/trainplan.js

@@ -42,6 +42,7 @@ const actions = {
       for (const i of data) {
         res.push(dispatch(method, i));
       }
+      return res;
     };
     let result = await axios.all(toRequest());
     let newFilter = data => {

+ 0 - 1
utils/axios-wrapper.js

@@ -53,7 +53,6 @@ export default class AxiosWrapper {
 
   async $request(uri, data, query, options) {
     if (!uri) console.error('uri不能为空');
-    // TODO: 合并query和options
     if (_.isObject(query) && _.isObject(options)) {
       const params = query.params ? query.params : query;
       options = { ...options, params };