flat: 修复bug

This commit is contained in:
史典卓
2025-07-21 14:49:45 +08:00
parent ec2dc5f659
commit ea04387b58
17 changed files with 171 additions and 108 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -58,9 +58,9 @@ const state = reactive({
visible: false,
});
onMounted(() => {
serchforIt();
});
// onMounted(() => {
// serchforIt();
// });
// 统一处理二维数组格式
const processedListData = computed(() => {
@@ -82,11 +82,11 @@ const open = (newConfig = {}) => {
rowLabel: configRowLabel = 'label',
rowKey: configRowKey = 'value',
maskClick: configMaskClick = false,
defaultIndex = [],
defaultId = '',
} = newConfig;
reset();
serchforIt();
serchforIt(defaultId);
if (configTitle) title.value = configTitle;
if (typeof success === 'function') confirmCallback.value = success;
@@ -143,11 +143,13 @@ const handleClick = async (callback) => {
console.error('confirmCallback 执行出错:', error);
}
};
function serchforIt() {
function serchforIt(defaultId) {
if (state.stations.length) {
const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id));
const ids = defaultId
? defaultId.split(',').map((id) => Number(id))
: userInfo.value.jobTitleId.split(',').map((id) => Number(id));
count.value = ids.length;
state.jobTitleId = userInfo.value.jobTitleId;
state.jobTitleId = defaultId ? defaultId : userInfo.value.jobTitleId;
setCheckedNodes(state.stations, ids);
state.visible = true;
return;
@@ -166,14 +168,14 @@ function serchforIt() {
const reset = () => {
maskClick.value = false;
confirmCallback.value = null;
cancelCallback.value = null;
changeCallback.value = null;
listData.value = [];
selectedIndex.value = [0, 0, 0];
rowLabel.value = 'label';
rowKey.value = 'value';
selectedItems.value = [];
JobsIdsValue.value = '';
JobsLabelValue.value = '';
};
// 暴露方法给父组件

View File

@@ -10,6 +10,7 @@
>
<image :src="currentItem == item.id ? item.selectedIconPath : item.iconPath"></image>
</view>
<view class="badge" v-if="item.badge">{{ item.badge }}</view>
<view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']">
<text>{{ item.text }}</text>
</view>
@@ -17,77 +18,94 @@
</view>
</template>
<script>
export default {
data() {
return {
currentItem: 0,
tabbarList: [
{
id: 0,
text: '首页',
path: '/pages/index/index',
iconPath: '../../static/tabbar/calendar.png',
selectedIconPath: '../../static/tabbar/calendared.png',
centerItem: false,
},
{
id: 1,
text: '招聘会',
path: '/pages/careerfair/careerfair',
iconPath: '../../static/tabbar/post.png',
selectedIconPath: '../../static/tabbar/posted.png',
centerItem: false,
},
{
id: 2,
text: '',
path: '/pages/chat/chat',
iconPath: '../../static/tabbar/logo3.png',
selectedIconPath: '../../static/tabbar/logo3.png',
centerItem: true,
},
{
id: 3,
text: '消息',
path: '/pages/msglog/msglog',
iconPath: '../../static/tabbar/chat4.png',
selectedIconPath: '../../static/tabbar/chat4ed.png',
centerItem: false,
},
{
id: 4,
text: '我的',
path: '/pages/mine/mine',
iconPath: '../../static/tabbar/mine.png',
selectedIconPath: '../../static/tabbar/mined.png',
centerItem: false,
},
],
};
<script setup>
import { ref, defineProps, onMounted, computed } from 'vue';
import { useReadMsg } from '@/stores/useReadMsg';
const props = defineProps({
currentpage: {
type: Number,
required: true,
default: 0,
},
props: {
currentpage: {
type: Number,
required: true,
default: 0,
},
});
const readMsg = useReadMsg();
const currentItem = ref(0);
console.log(readMsg);
const tabbarList = computed(() => [
{
id: 0,
text: '首页',
path: '/pages/index/index',
iconPath: '../../static/tabbar/calendar.png',
selectedIconPath: '../../static/tabbar/calendared.png',
centerItem: false,
badge: readMsg.badges[0].count,
},
mounted() {
this.currentItem = this.currentpage;
uni.hideTabBar();
{
id: 1,
text: '招聘会',
path: '/pages/careerfair/careerfair',
iconPath: '../../static/tabbar/post.png',
selectedIconPath: '../../static/tabbar/posted.png',
centerItem: false,
badge: readMsg.badges[1].count,
},
methods: {
changeItem(item) {
uni.switchTab({
url: item.path,
});
},
{
id: 2,
text: '',
path: '/pages/chat/chat',
iconPath: '../../static/tabbar/logo3.png',
selectedIconPath: '../../static/tabbar/logo3.png',
centerItem: true,
badge: readMsg.badges[2].count,
},
{
id: 3,
text: '消息',
path: '/pages/msglog/msglog',
iconPath: '../../static/tabbar/chat4.png',
selectedIconPath: '../../static/tabbar/chat4ed.png',
centerItem: false,
badge: readMsg.badges[3].count,
},
{
id: 4,
text: '我的',
path: '/pages/mine/mine',
iconPath: '../../static/tabbar/mine.png',
selectedIconPath: '../../static/tabbar/mined.png',
centerItem: false,
badge: readMsg.badges[4].count,
},
]);
onMounted(() => {
uni.hideTabBar();
currentItem.value = props.currentpage;
});
const changeItem = (item) => {
uni.switchTab({
url: item.path,
});
};
</script>
<style lang="scss" scoped>
.badge {
position: absolute;
top: 4rpx;
right: 20rpx;
min-width: 30rpx;
height: 30rpx;
background-color: red;
color: #fff;
font-size: 18rpx;
border-radius: 15rpx;
text-align: center;
line-height: 30rpx;
padding: 0 10rpx;
}
.tabbar_container {
background-color: #ffffff;
width: 100%;

View File

@@ -30,7 +30,7 @@ export function useAudioRecorder(wsUrl) {
// 配置常量
const SAMPLE_RATE = 16000;
const SILENCE_THRESHOLD = 0.02; // 静音阈值 (0-1)
const SILENCE_THRESHOLD = 0.05; // 静音阈值 (0-1)
const SILENCE_DURATION = 100; // 静音持续时间(ms)后切片
const MIN_SOUND_DURATION = 200; // 最小有效声音持续时间(ms)

View File

@@ -145,10 +145,17 @@ function changeArea() {
function changeJobs() {
selectJobsModel.value?.open({
title: '添加岗位',
defaultId: fromValue.jobTitleId,
success: (ids, labels) => {
console.log(ids, labels);
fromValue.jobTitleId = ids;
state.jobsText = labels.split(',');
},
cancel: (ids, labels) => {
console.log(ids, labels);
// fromValue.jobTitleId = ids;
// state.jobsText = labels.split(',');
},
});
}

View File

@@ -287,7 +287,7 @@ const {
lastFinalText,
} = useAudioRecorder(config.vioceBaseURl);
const { speak, pause, resume, isSpeaking, isPaused, cancelAudio, audioUrl } = useTTSPlayer(config.speechSynthesis);
const { speak, pause, resume, isSpeaking, isPaused, cancelAudio } = useTTSPlayer(config.speechSynthesis);
// state
const queries = ref([]);

View File

@@ -390,10 +390,12 @@ function getJobRecommend(type = 'add') {
list.value = dataToImg(data);
}
// 切换状态
if (data.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
if (data.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
}
// 当没有岗位刷新sessionId重新啦
if (!data.length) {
@@ -431,10 +433,13 @@ function getJobList(type = 'add') {
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value?.change('noMore');
} else {
loadmoreRef.value?.change('more');
// 切换状态
if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
if (rows.length < pageState.pageSize) {
loadmoreRef.value?.change('noMore');
} else {
loadmoreRef.value?.change('more');
}
}
});
}
@@ -747,20 +752,22 @@ defineExpose({ loadData });
.falls-card-pepleNumber
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20rpx;
flex-wrap: wrap
margin-top: 10rpx;
font-weight: 400;
font-size: 24rpx;
color: #999999;
line-height: 46rpx
view
display:flex
align-items: center
white-space: nowrap;
.point2
margin: 4rpx 6rpx 0 2rpx
margin: 0rpx 6rpx 0 2rpx
height: 22rpx
width: 22rpx
.point3
margin: 4rpx 4rpx 0 0
margin: 0rpx 4rpx 0 0
height: 28rpx
width: 28rpx
.falls-card-matchingrate
@@ -772,7 +779,7 @@ defineExpose({ loadData });
color: #4778EC;
text-align: left;
.falls-card-company2
margin-top: 8rpx;
margin-top: 4rpx;
font-size: 24rpx;
color: #999999;
text-align: left;

View File

@@ -60,9 +60,9 @@ const maskFristEntry = ref(false);
onLoad(() => {
// 判断浏览器是否有 fristEntry 第一次进入
// let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读
// maskFristEntry.value = fristEntry ;
maskFristEntry.value = true;
let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读
maskFristEntry.value = fristEntry;
// maskFristEntry.value = true;
});
onShow(() => {

View File

@@ -241,10 +241,12 @@ function getJobList(type = 'add') {
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
}
});
}

View File

@@ -292,10 +292,12 @@ function getJobList(type = 'add') {
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
}
});
}

View File

@@ -317,10 +317,12 @@ function getJobList(type = 'add') {
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
}
});
}

View File

@@ -222,10 +222,12 @@ function getJobList(type = 'add') {
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
if (rows.length < pageState.pageSize) {
loadmoreRef.value.change('noMore');
} else {
loadmoreRef.value.change('more');
}
}
});
}

BIN
static/.DS_Store vendored

Binary file not shown.

View File

@@ -15,6 +15,22 @@ import {
// 控制消息
export const useReadMsg = defineStore('readMsg', () => {
const msgList = ref([])
const badges = ref([{
count: 0
},
{
count: 0
},
{
count: 0
},
{
count: 0
},
{
count: 0
},
])
// 计算总未读数量,基于 notReadCount 字段
const unreadCount = computed(() =>
@@ -35,9 +51,13 @@ export const useReadMsg = defineStore('readMsg', () => {
index: 3
}) // 替换为你消息页面的 TabBar index
} else {
const val = count > 99 ? '99+' : String(count)
badges.value[index] = {
count: val
}
uni.setTabBarBadge({
index: 3,
text: count > 99 ? '99+' : String(count)
text: val
})
}
}
@@ -76,6 +96,7 @@ export const useReadMsg = defineStore('readMsg', () => {
}
return {
badges,
msgList,
unreadMsgList,
unreadCount,

BIN
unpackage/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.