wangguoyu 2 hónapja
szülő
commit
5f5c24bfac

+ 22 - 0
api/jiazheng.js

@@ -347,4 +347,26 @@ export function jiazhengKcList(data = {}) {
 		data,
 		timeout: 20000
 	})
+}
+export function jiazhengKcAdd(data = {}) {
+	return request({
+		url: '/app/user/jiazheng/kecheng/add',
+		headers: {
+			isToken: false
+		},
+		method: 'post',
+		data,
+		timeout: 20000
+	})
+}
+export function jiazhengKcDelete(data = {}) {
+	return request({
+		url: '/app/user/jiazheng/kecheng/delete',
+		headers: {
+			isToken: false
+		},
+		method: 'post',
+		data,
+		timeout: 20000
+	})
 }

+ 74 - 22
pages/admin/Jiazheng/kechengBind.vue

@@ -6,10 +6,12 @@
 		</view>
 		<v-tabs v-model="current" :tabs="tabs" :scroll="false" @change="changeTab" field="name"
 			class="admin-tab-box"></v-tabs>
-		<uni-list v-if="current ==1" class="jz-scroll-view">
+		<uni-list v-if="current ==0" class="jz-scroll-view">
 			<uni-list-item v-for="item in list" class="jz-list-item-box">
 				<template v-slot:body>
-
+					<view class="card-head-row">
+						<button type="default" class="phone-green-btn bz-tel-btn" @click.stop="toAdd(item)">添加</button>
+					</view>
 					<view @click="lookUserInfo(item)" class="card-body-row">
 						<view class="card-img-box">
 							<img :src="item.pic" v-if="item.pic">
@@ -25,14 +27,13 @@
 				</template>
 			</uni-list-item>
 		</uni-list>
-		<uni-list v-if="current ==2" class="jz-scroll-view">
-			<view class="jz-new-btn-box">
-				<button type="default" class="phone-green-btn" @click="addJiazhengRenyuan">新增人员</button>
-			</view>
-
-			<uni-list-item v-for="item in list" class="jz-list-item-box">
+		<uni-list v-if="current ==1" class="jz-scroll-view">
+			<uni-list-item v-for="item in listYx" class="jz-list-item-box">
 				<template v-slot:body>
-
+					<view class="card-head-row">
+						<button type="default" class="phone-green-btn bz-tel-btn"
+							@click.stop="toDelete(item)">删除</button>
+					</view>
 					<view @click="lookUserInfo(item)" class="card-body-row">
 						<view class="card-img-box">
 							<img :src="item.pic" v-if="item.pic">
@@ -56,7 +57,10 @@
 		ref
 	} from "vue";
 	import {
-		kcSelectList
+		kcSelectList,
+		jiazhengKcList,
+		jiazhengKcAdd,
+		jiazhengKcDelete
 	} from "@/api/jiazheng.js";
 	import commonDialog from '@/components/dialog/commonDialog.vue';
 
@@ -65,8 +69,9 @@
 			return {
 				kcClassifyId: 0,
 				id: '',
-				current: 1,
-				list:[],
+				current: 0,
+				list: [],
+				listYx: [],
 				tabs: [{
 						id: 1,
 						name: '未绑定课程',
@@ -88,19 +93,54 @@
 			this.getList()
 		},
 		methods: {
-			changeTab(data){
-				console.log('data',data);
+			toAdd(data) {
+				let req = {
+					kcIds: [data.kcId],
+					id: this.id
+				}
+				jiazhengKcAdd(req).then(res => {
+					if (res.code == 0) {
+						this.getList()
+						uni.showToast({
+							title: '添加成功',
+							icon: 'success'
+						});
+					} else {
+						return false
+					}
+				})
 			},
-			goUpPage() {
-				if (this.pageInfo.from == 'banzheng') {
-					uni.redirectTo({
-						url: "/pages/admin/banzheng/list"
-					})
+			toDelete(data) {
+				let req = {
+					kcId: data.kcId,
+					id: this.id
+				}
+				jiazhengKcDelete(req).then(res => {
+					if (res.code == 0) {
+						this.getYxList()
+						uni.showToast({
+							title: '删除成功',
+							icon: 'success'
+						});
+					} else {
+						return false
+					}
+				})
+			},
+			changeTab(data) {
+				this.current = data
+				if (this.current == 0) {
+					this.getList()
 				} else {
-					uni.redirectTo({
-						url: "/pages/admin/Jiazheng/index"
-					})
+					this.getYxList()
 				}
+
+				console.log('data', data);
+			},
+			goUpPage() {
+				uni.redirectTo({
+					url: "/pages/admin/Jiazheng/index"
+				})
 			},
 			getList() {
 				let req = {
@@ -115,6 +155,18 @@
 					}
 				})
 			},
+			getYxList() {
+				let req = {
+					id: this.id,
+				}
+				jiazhengKcList(req).then(res => {
+					if (res.code == 0) {
+						this.listYx = res.data
+					} else {
+						return false
+					}
+				})
+			}
 		}
 	}
 </script>

+ 9 - 3
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -2,18 +2,24 @@
   "hash": "7375ca5a",
   "configHash": "fdaa8c6f",
   "lockfileHash": "e3b0c442",
-  "browserHash": "150bab29",
+  "browserHash": "0905010f",
   "optimized": {
     "ts-md5/dist/md5": {
       "src": "../../../../../node_modules/ts-md5/dist/md5.js",
       "file": "ts-md5_dist_md5.js",
-      "fileHash": "4e67595f",
+      "fileHash": "215e17fa",
       "needsInterop": true
     },
     "jsonp": {
       "src": "../../../../../node_modules/jsonp/index.js",
       "file": "jsonp.js",
-      "fileHash": "591ba340",
+      "fileHash": "bb4a5317",
+      "needsInterop": true
+    },
+    "dayjs": {
+      "src": "../../../../../node_modules/dayjs/dayjs.min.js",
+      "file": "dayjs.js",
+      "fileHash": "046961b5",
       "needsInterop": true
     }
   },