lifanagju_citu 6 месяцев назад
Родитель
Сommit
8b7d39f723
2 измененных файлов с 122 добавлено и 33 удалено
  1. 121 32
      pagesA/vip/blockEnt/index.vue
  2. 1 1
      pagesA/vip/index.vue

+ 121 - 32
pagesA/vip/blockEnt/index.vue

@@ -1,6 +1,6 @@
 <!-- 屏蔽企业 -->
 <template>
-  <view>
+  <view style="height: 100%; overflow: auto;">
     <!-- 搜索条 -->
     <view class="white-bgc stick ss-p-t-10">
       <view style="position: relative;">
@@ -17,12 +17,42 @@
         <button class="search-btn" @click.stop="getEntList" :loading="loading">搜索</button>
       </view>
     </view>
+    <!-- 已屏蔽的企业 -->
+    <view class="tags">
+      <view style="color: #777; width: 100%; margin-bottom: 15px;">已屏蔽的企业:</view>
+      <view
+        v-for="k in dataList" :key="k.id"
+        class="tag"
+        style="color: #00897B; background-color: #e2f0ef;;"
+        @tap="handleDel(k)"
+      >
+        {{ k.name }}
+        <uni-icons type="clear" size="16" color="#00897B"></uni-icons>
+      </view>
+    </view>
+     
     <uni-popup ref="popup" type="bottom" background-color="#fff">
-			<uni-card v-for="item in entList" :key="item.id" :is-shadow="true" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.1)">
-				<view class="d-flex align-center">
-          123
+      <view style="padding: 30rpx;">
+        <view class="entListBox">
+          <view style="color: #777; margin: 20rpx 0 30rpx 40rpx; ">请选择要屏蔽的企业</view>
+          <view v-if="!entList?.length" style="color: #777; text-align: center; margin-top: 20vh;">未查询到相关内容 . . .</view>
+          <uni-card v-else v-for="item in entList" :key="item.key" @click="joinBlock(item)" :is-shadow="true" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.1)">
+            <view>{{ item.value }}</view>
+          </uni-card>
         </view>
-			</uni-card>
+      </view>
+    </uni-popup>
+    <!-- 确认框 -->
+    <uni-popup ref="confirm" type="dialog">
+      <uni-popup-dialog
+        type="warn"
+        cancelText="取消"
+        confirmText="确认" 
+        title="系统提示"
+        :content="dialogContent"
+        @confirm="handleConfirm"
+        @close="handleClose"
+      ></uni-popup-dialog>
     </uni-popup>
   </view>
 </template>
@@ -31,52 +61,91 @@
 import { ref } from 'vue'
 import { 
   getBlockEnterpriseList,
-  // handleBlockEnterprise,
-  // handleUnBlockEnterprise,
+  handleBlockEnterprise,
+  handleUnBlockEnterprise,
 } from '@/api/vip'
+import { enterpriseSearchByName } from '@/api/resume.js'
 
-const popup = ref()
-const loading = ref(false)
-const name = ref('')
-const entList = ref([])
-// 获取企业列表
-const getEntList = async (name) => {
-  // if (name) name.value = name
-  // if (!name) {
-  //   uni.showToast({
-  //     title: '请输入公司关键字',
-  //     icon: 'none'
-  //   })
-  //   return
-  // }
+const dataList = ref([])
+const getData = async () => {
   try {
-    loading.value = true
     const res = await getBlockEnterpriseList()
-    entList.value = res?.data?.list || []
-    popup.value.open()
+    dataList.value = res?.data?.list || []
   } catch (error) {
     uni.showToast({
-      title: '搜索失败',
+      title: '查询数据失败,请重试',
       icon: 'none'
     })
-    loading.value = false
   }
 }
+getData()
+
+let confirm = ref()
+const handleConfirm = async () => {
+  if (isDel) {
+    await handleUnBlockEnterprise(enterpriseId)
+    uni.showToast({ title: '取消屏蔽成功!', icon: 'none' })
+  } else {
+    await handleBlockEnterprise({ enterpriseId })
+    uni.showToast({ title: '屏蔽企业成功!', icon: 'none' })
+  }
+  getData()
+}
+const handleClose = () => {
+  confirm.value.close()
+  dialogContent = ''
+  enterpriseId = ''
+}
 
-const dataList = ref([])
-const getData = async () => {
+let enterpriseId = ''
+let dialogContent = ''
+let isDel = false
+
+// 屏蔽
+const joinBlock = (item) => {
+  isDel = false
+  enterpriseId = item.key
+  dialogContent = `是否屏蔽【${item.value}】?`
+  confirm.value.open()
+
+}
+// 取消屏蔽
+const handleDel = (item) => {
+  isDel = true
+  enterpriseId = item.id
+  dialogContent = `是否取消屏蔽【${item.name}】?`
+  confirm.value.open()
+}
+
+// 搜索企业
+const popup = ref()
+const loading = ref(false)
+const name = ref('')
+const entList = ref([])
+// 获取企业列表
+const getEntList = async () => {
+  if (!name.value || name.value === '公司' || name.value === '有限公司') {
+    uni.showToast({ title: '请输入公司名称关键字查询', icon: 'none' })
+    return
+  }
+  if (name.value.length < 2) {
+    uni.showToast({ title: '输入内容过少,请输入更多关键字查询', icon: 'none' })
+    return
+  }
   try {
-    const res = await getBlockEnterpriseList()
-    dataList.value = res?.data?.list || []
+    loading.value = true
+    const res = await enterpriseSearchByName({ name: name.value })
+    entList.value = res?.data || []
     popup.value.open()
+    loading.value = false
   } catch (error) {
     uni.showToast({
-      title: '查询数据失败,请重试',
+      title: '搜索失败',
       icon: 'none'
     })
+    loading.value = false
   }
 }
-getData()
 
 </script>
 <style lang="scss" scoped>
@@ -104,4 +173,24 @@ getData()
   padding-right: 20px;
   flex: none;
 }
+
+.tags {
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: center;
+  padding: 30rpx;
+  .tag {
+    margin: 0 15rpx 12rpx 0;
+    border: 2rpx 15rpx #008978;
+    color: #008978;
+    white-space: nowrap;
+    padding: 4rpx 10rpx;
+    border-radius: 10rpx;
+    font-size: 24rpx;
+  }
+}
+.entListBox {
+  height: 70vh;
+  overflow: auto;
+}
 </style>

+ 1 - 1
pagesA/vip/index.vue

@@ -51,7 +51,7 @@ const remaining = computed(() => {
 
 const list = ref([
 	{	title: '简历模板',	path: '/pagesA/vip/template/index'	},					
-	// {	title: '屏蔽企业',	path: '/pagesA/vip/blockEnt/index'	},			
+	{	title: '屏蔽企业',	path: '/pagesA/vip/blockEnt/index'	},			
 ])
 
 // 列表跳转