Selaa lähdekoodia

自定义底部导航

zhengnaiwen_citu 7 kuukautta sitten
vanhempi
commit
1b1bed286e

+ 24 - 2
components/PositionList/index.vue

@@ -1,7 +1,7 @@
 <template>
   <view>
     <view v-if="list.length > 0">
-      <view v-for="(item, index) in list" :key="index">
+      <view v-for="(item, index) in list" :key="index" class="mList" :class="{ 'disable': item.job?.status === '1'}">
         <!-- 职位信息 -->
         <view class="list-shape" @click="toDetail(1, item)">
           <!-- 职位 -->
@@ -153,7 +153,7 @@ const toDetail = (isPosition, item) =>{
 }
 .list-shape {
 	padding: 10px 30rpx 10px;
-  margin-top: 10px;
+  // margin-top: 10px;
   background-color: #fff;
   .titleBox {
     display: flex;
@@ -195,6 +195,9 @@ const toDetail = (isPosition, item) =>{
 	overflow: hidden;
 	text-overflow: ellipsis;
 }
+.mList {
+  margin-top: 20rpx;
+}
 /* 列表触底暂无更多 */
 .noMore{ text-align:center; color:grey; }
 .mt { margin-top: 10rpx; }
@@ -203,4 +206,23 @@ const toDetail = (isPosition, item) =>{
 .mr { margin-right: 20rpx; }
 .mr-10{ margin-right: 10rpx; }
 .my-5{ margin: 5px 0; }
+.disable {
+  position: relative;
+  overflow: hidden;
+  &::after {
+    content: '已失效';
+    position: absolute;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    font-size: 1.2em;
+    font-weight: bold;
+    color: #fc796f;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+    background-color: rgba(255, 255, 255, 0.75);
+  }
+}
 </style>

+ 6 - 1
components/ResumeStatus/index.vue

@@ -17,6 +17,7 @@
 import { ref, watch } from 'vue';
 import { getRecommendCount } from '@/api/position.js'
 import { getDict } from '@/hooks/useDictionaries.js'
+import { onShow } from '@dcloudio/uni-app'
 // const props = defineProps({
 // 	type: {
 // 		type: String,
@@ -35,6 +36,10 @@ watch(() => useUserStore.refreshToken, (newVal, oldVal) => {
 	}
 })
 
+onShow(() => {
+	recommendCount()
+})
+
 const items = ref([])
 
 const handleTo = (item) => {
@@ -67,7 +72,7 @@ async function recommendCount () {
 		// console.log(error)
 	}
 }
-recommendCount()
+
 </script>
 
 <style scoped lang="scss">

+ 57 - 0
custom-tab-bar/index.js

@@ -0,0 +1,57 @@
+Component({
+  data: {
+    selected: 0,
+		show: true,
+    color: "#7A7E83",
+    selectedColor: "#00897B",
+    list: [
+			{
+				"pagePath": "/pages/index/position",
+				"text": "求职",
+				"iconPath": "/static/img/position.png",
+				"selectedIconPath": "/static/img/position-fill.png"
+			},
+			{
+				"pagePath": "/pages/index/communicate",
+				"text": "沟通",
+				"iconPath": "/static/img/message.png",
+				"selectedIconPath": "/static/img/message-fill.png"
+			},
+			{
+				"pagePath": "/pages/index/welfare",
+				"text": "会员福利",
+        "center": true,
+				"iconPath": "/static/img/welfare.png",
+				"selectedIconPath": "/static/img/welfare.png"
+			},
+			{
+				"pagePath": "/pages/index/crowdsourcing",
+				"text": "赏金",
+				"iconPath": "/static/img/pin.png",
+				"selectedIconPath": "/static/img/pin-fill.png"
+			},
+			{
+				"pagePath": "/pages/index/my",
+				"text": "我的",
+				"iconPath": "/static/img/my.png",
+				"selectedIconPath": "/static/img/my-fill.png"
+			}
+		]
+  },
+  lifetimes: {  
+
+  },
+  methods: {
+    switchTab(e) {
+      const data = e.currentTarget.dataset
+      const url = data.path
+      wx.switchTab({
+        url
+      })
+      this.setData({  
+        selected: data.index  
+      })
+      console.log('select', this.data)
+    }
+  }
+})

+ 4 - 0
custom-tab-bar/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 14 - 0
custom-tab-bar/index.wxml

@@ -0,0 +1,14 @@
+<!--miniprogram/custom-tab-bar/index.wxml-->
+<view class="tab-bar" style="display: {{ show ? 'flex' : 'none'}}">
+  <view
+    wx:for="{{list}}"
+    wx:key="index"
+    class="tab-bar-item {{ item.center ? 'center' : ''}}"
+    data-path="{{item.pagePath}}"
+    data-index="{{index}}"
+    bindtap="switchTab"
+  >
+    <image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image>
+    <view style="color: {{selected === index ? selectedColor : color}};z-index: 1;">{{item.text}}</view>
+  </view>
+</view>

+ 75 - 0
custom-tab-bar/index.wxss

@@ -0,0 +1,75 @@
+.tab-bar {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  height: 48px;
+  background: white;
+  display: flex;
+  padding-bottom: env(safe-area-inset-bottom);
+  border-radius: 20px 20px 0 0;
+  box-shadow: 0px 8px 20px 0px rgba(0,0,0,.5);
+  z-index: 0;
+}
+
+.tab-bar-border {
+  background-color: rgba(0, 0, 0, 0.33);
+  position: absolute;
+  left: 0;
+  top: 0;
+  width: 100%;
+  height: 1px;
+  transform: scaleY(0.5);
+}
+
+.tab-bar-item {
+  flex: 1;
+  text-align: center;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+  position: relative;
+}
+
+.tab-bar-item.center {
+  margin-top: -14px;
+}
+.tab-bar-item.center image {
+  width: 41px;
+  height: 41px;
+  z-index: 3;
+  border-radius: 50%;
+}
+/* .tab-bar-item.center::after {
+  content: '';
+  width: 80px;
+  height: 50px;
+  position: absolute;
+  left: 50%;
+  top: 15px;
+  background: #FFF;
+  transform: translate(-50%, 0);
+  z-index: 0;
+} */
+.tab-bar-item.center::before {
+  content: '';
+  width: 46px;
+  height: 46px;
+  position: absolute;
+  left: 50%;
+  top: 0;
+  transform: translate(-50%, 0px);
+  background: #FFF;
+  border-radius: 180px 180px 0 0;
+  box-shadow: 0px 8px 20px 0px rgba(0,0,0,.5);
+
+}
+.tab-bar-item image {
+  width: 27px;
+  height: 27px;
+}
+
+.tab-bar-item view {
+  font-size: 10px;
+}

+ 27 - 9
hooks/useModal.js

@@ -1,18 +1,36 @@
-import { modalStore } from '@/store/modal'; const modal = modalStore()
+import { modalStore } from '@/store/modal';
+const modal = modalStore()
 
 // 隐藏TabBar
 const hideBar = () => {
-  uni.hideTabBar({
-    success: () => {},
-    fail: () => {} // 捕获报错,防止没有tabbar页面调用后控制台报错
-  }) 
+  // 关闭tabBar
+  const currentPage = getCurrentPages()
+  if (!currentPage) {
+    return
+  }
+  const currentTabBar = currentPage[0]?.getTabBar?.();
+  // console.log('打开了', currentTabBar)
+  currentTabBar?.setData({ show: false });
+  // uni.hideTabBar({
+  //   success: () => {},
+  //   fail: () => {} // 捕获报错,防止没有tabbar页面调用后控制台报错
+  // }) 
 }
 // 显示TabBar
 const showBar = () => {
-  uni.showTabBar({
-    success: () => {},
-    fail: () => {} // 捕获报错,防止没有tabbar页面调用后控制台报错
-  }) 
+  
+  // 打开tabBar
+  const currentPage = getCurrentPages()
+  if (!currentPage) {
+    return
+  }
+  const currentTabBar = currentPage[0]?.getTabBar?.();
+  // console.log('打开了', currentTabBar)
+  currentTabBar?.setData({ show: true });
+  // uni.showTabBar({
+  //   success: () => {},
+  //   fail: () => {} // 捕获报错,防止没有tabbar页面调用后控制台报错
+  // }) 
 }
 
 // 打开授权弹框

+ 2 - 1
layout/index.vue

@@ -47,8 +47,9 @@ watch(() => useUserStore.accountInfo.userId, (newVal, oldVal) => {
   .page-main {
     position: absolute;
     z-index: 1;
+    padding-bottom: 160rpx;
     width: 100%;
-    min-height: 100%;
+    min-height: calc(100% - 160rpx);
     display: flex;
     flex-direction: column;
 

+ 2 - 2
pages.json

@@ -123,13 +123,13 @@
 		"backgroundColor": "#ffffff"
 	},
 	"tabBar": {
-		"color": "#000",
+		"color": "#7A7E83",
 		"selectedColor": "#00897B",
 		"borderStyle": "black",
 		"backgroundColor": "#ffffff",
 		"height": "65px",
 		"fontSize": "24rpx",
-
+		"custom": true,
 		"list": [
 			{
 				"pagePath": "pages/index/position",

+ 7 - 1
pages/index/communicate.vue

@@ -51,7 +51,8 @@ import { getUserAvatar } from '@/utils/avatar'
 import { timesTampChange } from '@/utils/date'
 import { userStore } from '@/store/user'
 import { useIMStore } from '@/store/im'
-  const IM = useIMStore()
+
+const IM = useIMStore()
 
 const useUserStore = userStore()
 
@@ -62,6 +63,11 @@ watch([() => useUserStore.refreshToken, () => IM.newMsg], () => {
 })
 
 onShow(() => {
+	const currentPage = getCurrentPages()[0];  // 获取当前页面实例
+	const currentTabBar = currentPage?.getTabBar?.();
+
+	// 设置当前tab页的下标index
+	currentTabBar?.setData({ selected: 1 });
 	init()
 })
 

+ 10 - 1
pages/index/crowdsourcing.vue

@@ -48,7 +48,16 @@ import { getJobAdvertisedHire } from '@/api/position.js'
 import { getDict } from '@/hooks/useDictionaries.js'
 import { dealDictArrayData } from '@/utils/position.js'
 import PositionList from '@/components/PositionList'
+import { onShow } from '@dcloudio/uni-app'
+// 设置自定义tabbar选中值
+onShow(() => {
+    const currentPage = getCurrentPages()[0];  // 获取当前页面实例
+    const currentTabBar = currentPage?.getTabBar?.();
 
+    // 设置当前tab页的下标index
+    currentTabBar?.setData({ selected: 3 });
+		getList()
+})
 const swiperAdList = ref(swiperAdListTest)
 const items = reactive([])
 const pageInfo = ref({
@@ -105,7 +114,7 @@ async function getList () {
 	
 }
 
-getList()
+
 </script>
 
 <style scoped lang="scss">

+ 9 - 0
pages/index/my.vue

@@ -53,6 +53,15 @@ import { getUserAvatar } from '@/utils/avatar'
 import { getAccessToken } from '@/utils/request'
 import layoutPage from '@/layout'
 import { showAuthModal } from '@/hooks/useModal'
+import { onShow } from '@dcloudio/uni-app'
+// 设置自定义tabbar选中值
+onShow(() => {
+    const currentPage = getCurrentPages()[0];  // 获取当前页面实例
+    const currentTabBar = currentPage?.getTabBar?.();
+
+    // 设置当前tab页的下标index
+    currentTabBar?.setData({ selected: 4 });
+})
 
 const useUserStore = userStore()
 const baseInfo = computed(() => useUserStore?.baseInfo)

+ 8 - 0
pages/index/position.vue

@@ -30,8 +30,16 @@ import PositionList from '@/components/PositionList'
 import { swiperAdListTest } from '@/utils/testData'
 import { dealDictObjData } from '@/utils/position'
 import { getJobAdvertisedSearch } from '@/api/position';
+import { onShow } from '@dcloudio/uni-app'
 
 import { ref, reactive } from 'vue'
+// 设置自定义tabbar选中值
+onShow(() => {
+    const currentPage = getCurrentPages()[0];  // 获取当前页面实例
+    const currentTabBar = currentPage?.getTabBar?.();
+    // 设置当前tab页的下标index
+    currentTabBar?.setData({ selected: 0 });
+})
 
 const swiperAdList = ref(swiperAdListTest)
 const filterList = ref([

+ 8 - 0
pages/index/welfare.vue

@@ -13,7 +13,15 @@ import layoutPage from '@/layout'
 import SwiperAd from '@/components/SwiperAd'
 
 import { swiperAdListTest } from '@/utils/testData'
+import { onShow } from '@dcloudio/uni-app'
+// 设置自定义tabbar选中值
+onShow(() => {
+    const currentPage = getCurrentPages()[0];  // 获取当前页面实例
+    const currentTabBar = currentPage?.getTabBar?.();
 
+    // 设置当前tab页的下标index
+    currentTabBar?.setData({ selected: 2 });
+})
 const swiperAdList = ref(swiperAdListTest)
 </script>
 

+ 1 - 0
pagesA/interview/index.vue

@@ -31,6 +31,7 @@ import { userStore } from '@/store/user'
 
 const useUserStore = userStore()
 const current = ref(0)
+// const controlList = ['已投递', '待同意', '待面试', '已完成', '已拒绝']
 const controlList = ['已投递', '待同意', '待面试', '已完成', '已拒绝']
 const statusList = [0, 1, 3, 98]
 

+ 4 - 4
pagesA/recommendation/index.vue

@@ -8,10 +8,10 @@
 		  </view>
 		  <view v-else class="nodata-img-parent">
 		    <image
-				src="https://minio.citupro.com/dev/static/nodata.png"
-				mode="widthFix"
-				style="width: 100vw;height: 100vh;"
-			></image>
+					src="https://minio.citupro.com/dev/static/nodata.png"
+					mode="widthFix"
+					style="width: 100vw"
+				></image>
 		  </view>
 		</scroll-view>
 	</layout-page>

+ 1 - 1
pagesB/positionDetail/index.vue

@@ -83,7 +83,7 @@
       </view>
     </scroll-view>
     <!-- 分享 投递 -->
-    <view class="bottom-sticky" v-if="!loading && jobId">
+    <view class="bottom-sticky" v-if="!loading && jobId && info.status === '0'">
       <view class="bottom-content">
         <view @click="handleClickShare" class="bottom-content-tool">
           <uni-icons type="redo-filled" size="24" color="#00897B"/>

BIN
static/img/welfare.png


+ 15 - 15
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -1,50 +1,50 @@
 {
-  "hash": "47dcb4f1",
+  "hash": "3fec5660",
   "configHash": "06645ce3",
-  "lockfileHash": "8c101f21",
-  "browserHash": "f0bed5f8",
+  "lockfileHash": "c6d0d79b",
+  "browserHash": "f75d13a9",
   "optimized": {
     "pinia-plugin-persistedstate": {
       "src": "../../../../../node_modules/pinia-plugin-persistedstate/dist/index.js",
       "file": "pinia-plugin-persistedstate.js",
-      "fileHash": "de8dc243",
+      "fileHash": "c2c4ea4f",
       "needsInterop": false
     },
     "luch-request": {
       "src": "../../../../../node_modules/luch-request/src/lib/luch-request.js",
       "file": "luch-request.js",
-      "fileHash": "c5810002",
+      "fileHash": "52606568",
       "needsInterop": false
     },
     "qs": {
       "src": "../../../../../node_modules/qs/lib/index.js",
       "file": "qs.js",
-      "fileHash": "e4fd86e6",
+      "fileHash": "a09ab1fe",
       "needsInterop": true
     },
     "lodash-es": {
       "src": "../../../../../node_modules/lodash-es/lodash.js",
       "file": "lodash-es.js",
-      "fileHash": "cc0e5b4c",
+      "fileHash": "2f28623f",
       "needsInterop": false
     },
-    "dayjs": {
-      "src": "../../../../../node_modules/dayjs/dayjs.min.js",
-      "file": "dayjs.js",
-      "fileHash": "faa24560",
-      "needsInterop": true
-    },
     "js-base64": {
       "src": "../../../../../node_modules/js-base64/base64.mjs",
       "file": "js-base64.js",
-      "fileHash": "9be10531",
+      "fileHash": "e48e3266",
       "needsInterop": false
     },
     "wukongimjssdk": {
       "src": "../../../../../node_modules/wukongimjssdk/lib/wukongimjssdk.esm.js",
       "file": "wukongimjssdk.js",
-      "fileHash": "1f9bb9cc",
+      "fileHash": "071728c3",
       "needsInterop": false
+    },
+    "dayjs": {
+      "src": "../../../../../node_modules/dayjs/dayjs.min.js",
+      "file": "dayjs.js",
+      "fileHash": "e5632627",
+      "needsInterop": true
     }
   },
   "chunks": {