Browse Source

添加图片组件(虽然可能没用)

lrf402788946 5 years ago
parent
commit
0061920103
2 changed files with 51 additions and 0 deletions
  1. 46 0
      components/pic.vue
  2. 5 0
      store/teacher.js

+ 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>

+ 5 - 0
store/teacher.js

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