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

View File

@@ -10,6 +10,7 @@
> >
<image :src="currentItem == item.id ? item.selectedIconPath : item.iconPath"></image> <image :src="currentItem == item.id ? item.selectedIconPath : item.iconPath"></image>
</view> </view>
<view class="badge" v-if="item.badge">{{ item.badge }}</view>
<view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']"> <view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']">
<text>{{ item.text }}</text> <text>{{ item.text }}</text>
</view> </view>
@@ -17,77 +18,94 @@
</view> </view>
</template> </template>
<script> <script setup>
export default { import { ref, defineProps, onMounted, computed } from 'vue';
data() { import { useReadMsg } from '@/stores/useReadMsg';
return { const props = defineProps({
currentItem: 0, currentpage: {
tabbarList: [ type: Number,
{ required: true,
id: 0, default: 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,
},
],
};
}, },
props: { });
currentpage: { const readMsg = useReadMsg();
type: Number, const currentItem = ref(0);
required: true, console.log(readMsg);
default: 0, 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; id: 1,
uni.hideTabBar(); 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) { id: 2,
uni.switchTab({ text: '',
url: item.path, 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> </script>
<style lang="scss" scoped> <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 { .tabbar_container {
background-color: #ffffff; background-color: #ffffff;
width: 100%; width: 100%;

View File

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

View File

@@ -145,10 +145,17 @@ function changeArea() {
function changeJobs() { function changeJobs() {
selectJobsModel.value?.open({ selectJobsModel.value?.open({
title: '添加岗位', title: '添加岗位',
defaultId: fromValue.jobTitleId,
success: (ids, labels) => { success: (ids, labels) => {
console.log(ids, labels);
fromValue.jobTitleId = ids; fromValue.jobTitleId = ids;
state.jobsText = labels.split(','); 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, lastFinalText,
} = useAudioRecorder(config.vioceBaseURl); } = 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 // state
const queries = ref([]); const queries = ref([]);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -222,10 +222,12 @@ function getJobList(type = 'add') {
} }
pageState.total = resData.total; pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
if (rows.length < pageState.pageSize) { if (loadmoreRef.value && typeof loadmoreRef.value.change === 'function') {
loadmoreRef.value.change('noMore'); if (rows.length < pageState.pageSize) {
} else { loadmoreRef.value.change('noMore');
loadmoreRef.value.change('more'); } 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', () => { export const useReadMsg = defineStore('readMsg', () => {
const msgList = ref([]) const msgList = ref([])
const badges = ref([{
count: 0
},
{
count: 0
},
{
count: 0
},
{
count: 0
},
{
count: 0
},
])
// 计算总未读数量,基于 notReadCount 字段 // 计算总未读数量,基于 notReadCount 字段
const unreadCount = computed(() => const unreadCount = computed(() =>
@@ -35,9 +51,13 @@ export const useReadMsg = defineStore('readMsg', () => {
index: 3 index: 3
}) // 替换为你消息页面的 TabBar index }) // 替换为你消息页面的 TabBar index
} else { } else {
const val = count > 99 ? '99+' : String(count)
badges.value[index] = {
count: val
}
uni.setTabBarBadge({ uni.setTabBarBadge({
index: 3, index: 3,
text: count > 99 ? '99+' : String(count) text: val
}) })
} }
} }
@@ -76,6 +96,7 @@ export const useReadMsg = defineStore('readMsg', () => {
} }
return { return {
badges,
msgList, msgList,
unreadMsgList, unreadMsgList,
unreadCount, unreadCount,

BIN
unpackage/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.