浏览代码

Merge branch 'master' of https://git.citupro.com/zhengnaiwen_citu/menduner-uniapp

Xiao_123 6 月之前
父节点
当前提交
b02a831e4a
共有 3 个文件被更改,包括 194 次插入42 次删除
  1. 12 0
      api/vip.js
  2. 121 32
      pagesA/vip/blockEnt/index.vue
  3. 61 10
      pagesA/vip/index.vue

+ 12 - 0
api/vip.js

@@ -36,3 +36,15 @@ export const handleUnBlockEnterprise = async (enterpriseId) => {
     }
     }
   })
   })
 }
 }
+
+// 套餐列表
+export const getMembershipPackageList = async (enterpriseId) => {
+  return request({
+    url: 'app-api/menduner/system/user-package/list',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}

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

@@ -1,6 +1,6 @@
 <!-- 屏蔽企业 -->
 <!-- 屏蔽企业 -->
 <template>
 <template>
-  <view>
+  <view style="height: 100%; overflow: auto;">
     <!-- 搜索条 -->
     <!-- 搜索条 -->
     <view class="white-bgc stick ss-p-t-10">
     <view class="white-bgc stick ss-p-t-10">
       <view style="position: relative;">
       <view style="position: relative;">
@@ -17,12 +17,42 @@
         <button class="search-btn" @click.stop="getEntList" :loading="loading">搜索</button>
         <button class="search-btn" @click.stop="getEntList" :loading="loading">搜索</button>
       </view>
       </view>
     </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-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>
         </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>
     </uni-popup>
   </view>
   </view>
 </template>
 </template>
@@ -31,52 +61,91 @@
 import { ref } from 'vue'
 import { ref } from 'vue'
 import { 
 import { 
   getBlockEnterpriseList,
   getBlockEnterpriseList,
-  // handleBlockEnterprise,
-  // handleUnBlockEnterprise,
+  handleBlockEnterprise,
+  handleUnBlockEnterprise,
 } from '@/api/vip'
 } 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 {
   try {
-    loading.value = true
     const res = await getBlockEnterpriseList()
     const res = await getBlockEnterpriseList()
-    entList.value = res?.data?.list || []
-    popup.value.open()
+    dataList.value = res?.data?.list || []
   } catch (error) {
   } catch (error) {
     uni.showToast({
     uni.showToast({
-      title: '搜索失败',
+      title: '查询数据失败,请重试',
       icon: 'none'
       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 {
   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()
     popup.value.open()
+    loading.value = false
   } catch (error) {
   } catch (error) {
     uni.showToast({
     uni.showToast({
-      title: '查询数据失败,请重试',
+      title: '搜索失败',
       icon: 'none'
       icon: 'none'
     })
     })
+    loading.value = false
   }
   }
 }
 }
-getData()
 
 
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
@@ -104,4 +173,24 @@ getData()
   padding-right: 20px;
   padding-right: 20px;
   flex: none;
   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>
 </style>

+ 61 - 10
pagesA/vip/index.vue

@@ -10,7 +10,7 @@
       <view class="nameBox">
       <view class="nameBox">
 				<view class="name font-weight-bold font-size-16">{{ baseInfo?.name || userInfo?.phone }}</view>
 				<view class="name font-weight-bold font-size-16">{{ baseInfo?.name || userInfo?.phone }}</view>
 				<view class="vipInfo font-size-14">
 				<view class="vipInfo font-size-14">
-          14天双周卡将于{{ remaining }}后过期
+          {{ pName }}将于{{ remaining }}后过期
         </view>
         </view>
       </view>
       </view>
     </view>
     </view>
@@ -18,7 +18,7 @@
     <view class="card">
     <view class="card">
       <uni-list>
       <uni-list>
         <uni-list-item
         <uni-list-item
-          v-for="item in list"
+          v-for="item in menuList"
           :clickable="true"
           :clickable="true"
           :key="item.title"
           :key="item.title"
           :title="item.title"
           :title="item.title"
@@ -34,14 +34,45 @@
 
 
 <script setup>
 <script setup>
 import { userStore } from '@/store/user'
 import { userStore } from '@/store/user'
-import { ref, computed } from 'vue'
+import { ref, computed, watch } from 'vue'
 import { getUserAvatar } from '@/utils/avatar'
 import { getUserAvatar } from '@/utils/avatar'
-
+import { getMembershipPackageList } from '@/api/vip'
 
 
 const useUserStore = userStore()
 const useUserStore = userStore()
 const baseInfo = computed(() => useUserStore?.baseInfo)
 const baseInfo = computed(() => useUserStore?.baseInfo)
 const userInfo = computed(() => useUserStore?.userInfo)
 const userInfo = computed(() => useUserStore?.userInfo)
 
 
+let list = [
+	{	title: '简历刷新次数', key: 'resumeRefreshCount', show: true,	path: '/pagesA/vip/template/index'	},					
+	{	title: '简历模板', key: 'resumeTemplate', show: false,	path: '/pagesA/vip/template/index'	},					
+	{	title: '屏蔽企业', key: 'viewersList', show: true,	path: '/pagesA/vip/blockEnt/index'	},			
+]
+const listKeys = list.map(e => e.key)
+
+// 权益列表
+const menuList = ref([])
+watch(() => userInfo.value?.entitlement, 
+  (newVal) => {
+    // if (newVal) getPName()
+    if (newVal && listKeys?.length) {
+      listKeys.forEach(key => {
+        const item = list.find(e => e.key === key)
+        if (!item || item.show) return
+        //
+        if (key === 'resumeRefreshCount') { // 简历刷新次数
+          item.rightTex = '剩余 ' + (newVal[key] ? newVal[key] : 0) + ' 次'
+        }
+        else if (newVal[key]) item.show = true
+      })
+      menuList.value = list.filter(e => e.show)
+    }
+  },
+  {
+    // deep: true,
+    immediate: true
+  }
+)
+
 const remaining = computed(() => {
 const remaining = computed(() => {
   if (!userInfo.value?.vipExpireDate) return '0'
   if (!userInfo.value?.vipExpireDate) return '0'
   const diffInMs =  (userInfo.value?.vipExpireDate-0) - new Date().getTime()
   const diffInMs =  (userInfo.value?.vipExpireDate-0) - new Date().getTime()
@@ -49,18 +80,38 @@ const remaining = computed(() => {
   return day < 1 ? '今天' : Math.floor(day) + '天'
   return day < 1 ? '今天' : Math.floor(day) + '天'
 })
 })
 
 
-const list = ref([
-	{	title: '简历模板',	path: '/pagesA/vip/template/index'	},					
-	// {	title: '屏蔽企业',	path: '/pagesA/vip/blockEnt/index'	},			
-])
-
 // 列表跳转
 // 列表跳转
 const handleToLink = (item) => {
 const handleToLink = (item) => {
 	uni.navigateTo({
 	uni.navigateTo({
 		url: item.path
 		url: item.path
 	})
 	})
 }
 }
+const pName = ref('')
+let getPNameNum = 0 
+const getPName = () => {
+  if (!useUserStore.userInfo?.vipFlag) {
+    getPNameNum++
+    if (getPNameNum > 6)
+    setTimeout(() => { getPName() }, 1000);
+    return
+  }
+  memberList.value.forEach(e => {
+    if (e.id && e.id.toString() === useUserStore.userInfo?.vipFlag?.toString()) pName.value = e.name
+  })
+}
 
 
+const memberList = ref([])
+const getMemberList = async () => {
+  try {
+    const res = await getMembershipPackageList()
+    if (!res?.data?.length) return uni.showToast({ title: '查询数据失败,请重试', icon: 'none' })
+    memberList.value = res.data
+    getPName()
+  } catch (error) {
+    uni.showToast({ title: '查询数据失败,请重试', icon: 'none' })
+  }
+}
+getMemberList()
 
 
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
@@ -99,7 +150,7 @@ const handleToLink = (item) => {
       color: #724d2b;
       color: #724d2b;
     }
     }
     .vipInfo {
     .vipInfo {
-      color: #211000;
+      color: #572a00;
     }
     }
   }
   }
 }
 }