wangguoyu 1 месяц назад
Родитель
Сommit
6a20b5320c

+ 1 - 1
config.js

@@ -2,7 +2,7 @@
 // 切换环境后 注意 :map 要去对应manifest.json文件修改
 let isPro = process.env.NODE_ENV === 'production'
 const devUrl = 'https://kf3.mtavip.com/api'
-const proUrl = 'https://www.chengxiangjiaoyu.com/api'
+const proUrl = 'https://kf3.mtavip.com/api'
 const devKey = 'MZRBZ-Q6PKQ-THS5E-BOGKN-ZH4MQ-6YFWC'
 const proKey = 'VLOBZ-Q7XWB-YR4UP-NO4PH-EM7FS-G3BLR'
 export default   {

+ 42 - 0
pages/admin/Jiazheng/common/search2.vue

@@ -0,0 +1,42 @@
+<template>
+	<uni-popup ref="searchPopup" type="top" :animation="false" :is-mask-click="true"
+	 mask-background-color="rgba(0, 0, 0, 0.4)">
+	   <view class="select-search-row">
+		   <view class="select-search-body">
+			  <input type="text" class="search-input" v-model="searchInput" placeholder="请输入课程名称" />
+			  <view class="search-icon" @click="handleSearch">
+			  	<uni-icons type="search" size="24" color="#fff"></uni-icons>
+			  </view>	
+			</view>
+		</view>
+  </uni-popup>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+const $emit = defineEmits(['search-btn'])
+const searchPopup = ref(null); // 索引
+
+const searchInput= ref('');
+ 
+// 打开弹窗
+function handleShow() {
+	searchPopup.value.open();
+}
+// 取消
+function handleClose() {
+	searchInput.value = '';
+	searchPopup.value.close();
+}
+// 确认
+function handleSearch(){
+	$emit('search-btn',searchInput);
+	searchPopup.value.close();
+}
+
+defineExpose({
+	handleShow,
+	handleClose
+})
+</script>
+

+ 0 - 145
pages/admin/Jiazheng/common/share copy.vue

@@ -1,145 +0,0 @@
-<template>
-
-</template>
-
-<script>
-export default {
-  data() {
-    return {
-      imageUrl: 'https://example.com/path/to/your/image.jpg' // 后端提供的图片地址
-    };
-  },
-  methods: {
-    // 显示分享菜单
-    showShareMenu() {
-      uni.showActionSheet({
-        itemList: ['下载图片'],
-        success: (res) => {
-          if (res.tapIndex === 0) {
-            this.downloadImage(); // 点击“下载图片”
-          }
-        }
-      });
-    },
-
-    // 下载图片
-    downloadImage() {
-      // #ifdef H5
-      this.downloadImageForH5();
-      // #endif
-
-      // #ifdef APP-PLUS
-      this.downloadImageForApp();
-      // #endif
-    },
-
-    // H5 环境下载图片
-    downloadImageForH5() {
-      // 创建一个隐藏的 <a> 标签
-      const link = document.createElement('a');
-      link.href = this.imageUrl;
-      link.download = 'image.jpg'; // 设置下载文件名
-      document.body.appendChild(link);
-      link.click(); // 触发下载
-      document.body.removeChild(link);
-
-      // 提示用户手动保存
-      uni.showToast({
-        title: '图片已下载,请手动保存到相册。',
-        icon: 'none'
-      });
-    },
-
-    // APP 环境下载图片
-    downloadImageForApp() {
-      uni.showLoading({
-        title: '下载中...',
-        mask: true
-      });
-
-      // 下载图片
-      uni.downloadFile({
-        url: this.imageUrl, // 图片地址
-        success: (res) => {
-          if (res.statusCode === 200) {
-            const tempFilePath = res.tempFilePath; // 下载后的临时文件路径
-            this.saveImageToAlbum(tempFilePath); // 保存到相册
-          } else {
-            uni.showToast({
-              title: '下载失败',
-              icon: 'none'
-            });
-          }
-        },
-        fail: (err) => {
-          console.error('下载失败:', err);
-          uni.showToast({
-            title: '下载失败',
-            icon: 'none'
-          });
-        },
-        complete: () => {
-          uni.hideLoading();
-        }
-      });
-    },
-
-    // 保存图片到相册(APP 环境)
-    saveImageToAlbum(tempFilePath) {
-      // 检查权限(仅 Android 需要)
-      // #ifdef APP-PLUS
-      if (uni.getSystemInfoSync().platform === 'android') {
-        uni.authorize({
-          scope: 'scope.writePhotosAlbum',
-          success: () => {
-            this.saveImage(tempFilePath);
-          },
-          fail: () => {
-            // 无权限,提示用户去设置
-            uni.showModal({
-              title: '提示',
-              content: '需要相册权限才能保存图片,是否去设置?',
-              success: (res) => {
-                if (res.confirm) {
-                  uni.openSetting(); // 打开设置页面
-                }
-              }
-            });
-          }
-        });
-      } else {
-        this.saveImage(tempFilePath);
-      }
-      // #endif
-    },
-    saveImage(tempFilePath) {
-      uni.saveImageToPhotosAlbum({
-        filePath: tempFilePath,
-        success: () => {
-          uni.showToast({
-            title: '保存成功',
-            icon: 'success'
-          });
-        },
-        fail: (err) => {
-          console.error('保存失败:', err);
-          uni.showToast({
-            title: '保存失败',
-            icon: 'none'
-          });
-        }
-      });
-    }
-  }
-};
-</script>
-
-<style>
-button {
-  margin-top: 20px;
-  padding: 10px 20px;
-  background-color: #007AFF;
-  color: white;
-  border-radius: 5px;
-}
-</style>

+ 53 - 34
pages/admin/Jiazheng/kechengBind.vue

@@ -3,7 +3,7 @@
 		<view class="phone-navBar-box">
 			<view @click="goUpPage" class="nav-bar-icon"></view>
 			<text class="nav-bar-title">家政人员</text>
-			<uni-icons class="nav-bar-right-icon bar-ml10" type="search" size="20"></uni-icons>
+			<uni-icons class="nav-bar-right-icon bar-ml10" type="search" @click="searchBtn" size="20"></uni-icons>
 		</view>
 		<v-tabs v-model="current" :tabs="tabs" :scroll="false" @change="changeTab" field="name"
 			class="admin-tab-box"></v-tabs>
@@ -12,7 +12,7 @@
 				<text>{{leixing}}</text>
 				<icon class="select-jt-default" />
 			</view>
-		</view>	
+		</view>
 		<view class="kc-bind-scroll-view scroll-top-border" v-if="current ==0">
 			<uni-list class="admin-list-box">
 				<uni-list-item v-for="item in list" class="admin-list-item-box">
@@ -26,7 +26,8 @@
 								<view class="ks-totalTm kc-fenlei">
 									<icon class="phone-fenlei-icon" />分类:{{item.kcClassifyName}}
 								</view>
-								<button class="item-view-btn" type="primary" size="mini" @click.stop="toAdd(item)">添加</button>
+								<button class="item-view-btn" type="primary" size="mini"
+									@click.stop="toAdd(item)">绑定</button>
 							</view>
 						</view>
 					</template>
@@ -56,7 +57,8 @@
 		</view>
 		<common-dialog ref="commonDialogRef" :title="deleteTitle" :content="deleteConcent"
 			@confirm-btn="deleteQuerenBtn"></common-dialog>
-				<kechengLeixingVue ref="kclxRef" @select="handleSelectLeixing" @reset="handleResetLeixing"></kechengLeixingVue>
+		<kechengLeixingVue ref="kclxRef" @select="handleSelectLeixing" @reset="handleResetLeixing"></kechengLeixingVue>
+		<searchVue ref="searchRef" @search-btn="handleSearchFromBtn"></searchVue>
 	</view>
 </template>
 
@@ -73,20 +75,25 @@
 	} from "@/api/jiazheng.js";
 	import commonDialog from '@/components/dialog/commonDialog.vue';
 	import kechengLeixingVue from "./common/kechengLeixing.vue";
+	import searchVue from "./common/search2.vue";
+	import {
+		debounce
+	} from "@/utils/common";
 	export default {
 		data() {
 			return {
 				leixing: '全部类型',
 				leixingList: [],
-				selectClassify:null,
+				selectClassify: null,
 				kcClassifyId: 0,
 				id: '',
+				name: '',
 				current: 0,
 				list: [],
-				listYx: [],	
-				 deleteTitle :'删除',
-				 kcId :'',
-				 deleteConcent :'你确定要执行这个操作吗',		
+				listYx: [],
+				deleteTitle: '删除',
+				kcId: '',
+				deleteConcent: '你确定要执行这个操作吗',
 				tabs: [{
 						id: 1,
 						name: '未绑定课程',
@@ -102,7 +109,8 @@
 		},
 		components: {
 			commonDialog,
-			kechengLeixingVue
+			kechengLeixingVue,
+			searchVue
 		},
 		onLoad(options) {
 			this.id = options.id
@@ -110,23 +118,30 @@
 			this.getKechengClassify()
 		},
 		methods: {
+			searchBtn() {
+				this.$refs.searchRef.handleShow()
+			},
 			
-			 handleResetLeixing() {
+			handleSearchFromBtn(textD) {
+				this.name = textD;
+				this.getList()
+			},
+			handleResetLeixing() {
 				this.selectClassify = null;
 				this.leixing = '全部类型';
 				this.getList()
 			},
-			 handleSelectLeixing(item) {
+			handleSelectLeixing(item) {
 				this.leixing = item.lable;
 				this.selectClassify = item;
 				this.getList()
 			},
-			clickAlltype(){
+			clickAlltype() {
 				this.$refs.kclxRef.showPopup({
-					data: this.leixingList 
+					data: this.leixingList
 				})
 			},
-			getKechengClassify(){
+			getKechengClassify() {
 				getAdminClassify().then(res => {
 					res.data.children.forEach(item => {
 						item.checked = false;
@@ -135,27 +150,30 @@
 				})
 			},
 			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 {
-						uni.showToast({
-							title: '添加失败',
-							icon: 'success'
-						});
-						return false
+				debounce(()=>{
+					let req = {
+						kcIds: [data.kcId],
+						id: this.id
 					}
-				})
+					jiazhengKcAdd(req).then(res => {
+						if (res.code == 0) {
+							this.getList()
+							uni.showToast({
+								title: '添加成功',
+								icon: 'success'
+							});
+						} else {
+							uni.showToast({
+								title: '添加失败',
+								icon: 'success'
+							});
+							return false
+						}
+					})
+				},500)
+			
 			},
-			deleteQuerenBtn(){
+			deleteQuerenBtn() {
 				let req = {
 					kcId: this.kcId,
 					id: this.id
@@ -199,6 +217,7 @@
 				let req = {
 					id: this.id,
 					"kcClassifyId": this.selectClassify && this.selectClassify.id || 0,
+					name:this.name
 				}
 				kcSelectList(req).then(res => {
 					if (res.code == 0) {

+ 1 - 1
utils/common.js

@@ -168,4 +168,4 @@ export function jsonp2(url, params, callbackName = 'jsonp_callback') {
       // 将 script 标签添加到文档中
       document.body.appendChild(script);
     });
-}
+}