Browse Source

fix: 增加学员删除

lvkun996 2 weeks ago
parent
commit
c1ef7b469a
3 changed files with 40 additions and 2 deletions
  1. 7 0
      src/api/student.js
  2. 1 1
      src/views/markting/leads/list.vue
  3. 32 1
      src/views/student/index.vue

+ 7 - 0
src/api/student.js

@@ -9,6 +9,13 @@ export function getStudent (params) {
     })
 }
 
+export function delLearnerById (id) {
+  return request({
+    url: '/edu/learner/' + id,
+    method: 'DELETE'
+  })
+}
+
 // 查询学员  复杂筛选
 export function getComplex (params) {
     return request({

+ 1 - 1
src/views/markting/leads/list.vue

@@ -228,7 +228,7 @@
         </span>
         <span slot="action" slot-scope="text, record">
           <template>
-            <a @click="goleadsDetailPage(record)" v-action:1004009>学员详情详情</a>
+            <a @click="goleadsDetailPage(record)" v-action:1004009>学员详情</a>
             <a-divider type="vertical" />
             <a @click="handleAddLeads(record)" v-action:1004006>添加记录</a>
             <a-divider type="vertical" />

+ 32 - 1
src/views/student/index.vue

@@ -144,6 +144,13 @@
           <a @click="editStudent(text, 'edit')">编辑</a>
           <a-divider type="vertical" />
           <a @click="buyCourse(text)">购课</a>
+          <a-divider type="vertical" />
+          <a-popconfirm
+            title="确定删除吗?"
+            @confirm="delStudent(record.id)"
+          >
+            <a>删除</a>
+          </a-popconfirm>
         </span>
       </a-table>
     </a-card>
@@ -152,7 +159,7 @@
 </template>
 
 <script>
-import { getComplex } from '@/api/student'
+import { getComplex, delLearnerById } from '@/api/student'
 import mixinOptions from '@/mixin/index'
 import AddStudent from './components/addStudent'
 
@@ -237,6 +244,30 @@ export default {
      }
  },
  methods: {
+  async delStudent (id) {
+    const { code } = await delLearnerById(id)
+    if (code === 0) {
+      this.$message.success('删除成功')
+      this.getComplex()
+    } else {
+      this.$message.error('删除失败')
+    }
+  },
+   getCourse () {
+     this.getSelectList('course').then(res => {
+       this.courseList = res.data
+     })
+   },
+   getGrade () {
+     this.getSelectList('grade').then(res => {
+       this.classList = res.data
+     })
+   },
+   getTeacher () {
+     this.getSelectList('teacher').then(res => {
+       this.roleList = res.data
+     })
+  },
    changePagination (page) {
      console.log(page)
      this.queryParams.curPage = page