联调接口

This commit is contained in:
xuli3099
2025-08-13 18:15:04 +08:00
parent 0728d92094
commit 28f24a90fd
18 changed files with 516 additions and 280 deletions

View File

@@ -105,7 +105,7 @@
</view>
<!-- 常用服务 -->
<view class="white-bg">
<view class="white-bg" v-if="commonServiceList.length>0">
<view class="w-b-title">常用服务</view>
<view class="logo-list">
<view v-for="(item,index) in commonServiceList" class="l-l-item" :key="index">
@@ -147,23 +147,31 @@ import { onLoad } from '@dcloudio/uni-app';
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import customSteps from '@/components/customSteps.vue'
import { getNavBarPaddingTop} from '@/utils/system.js'
import { backBlogCount,swiperList,stepData,salesTask,commonServices,newsQueryList } from '@/api/home.js';
// ,swiperList,stepData,salesTask,commonServices,newsQueryList
import { messageNotifyCount,messageFlowCount,getUserFavorite} from '@/api/home.js';
import { getWeekStr,formatTimestamp } from '@/utils/datetime.js'
import { formatMoney } from '@/utils/formatter.js'
import {showLoading,hideLoading} from '@/utils/message.js'
onLoad(async(opt) => {
uni.setStorageSync('page_cache',true);
initLoad();
// initLoad();
})
// 初始化调用方法
const initLoad =()=>{
getBackBlogCount();
getSwiperList();
getStepData();
getSalesTask();
getCommonServices();
getNewsList();
try {
showLoading("加载中...")
getBackBlogCount();
getSwiperList();
getStepData();
getSalesTask();
getCommonServices();
getNewsList();
hideLoading();
} catch (error) {
hideLoading();
}
}
// 下拉刷新
@@ -209,20 +217,30 @@ let handleSearch = ()=>{
}
// tabar 增加消息数量
try {
wx.setTabBarBadge({
index: 2, // TabBar的索引从0开始计数
text: '3' // 徽章的文本
});
} catch (error) {
console.error('设置TabBar Badge失败:', error);
}
let backBlogObj = ref({})
let backBlogObj = ref({
count1:0,
count2:0,
count3:0,
count4: 0
})
// 获取待办数据
let getBackBlogCount = async () =>{
backBlogObj.value = await backBlogCount();
const getBackBlogCount = async () =>{
let res = await messageNotifyCount();
let res2 = await messageFlowCount();
backBlogObj.value.count1= res.todoCount || 0//消息待阅
backBlogObj.value.count2= res2.todoCount || 0//审核待办
// tabar 增加消息数量
try {
if(backBlogObj.value.count1>0){
wx.setTabBarBadge({
index: 2, // TabBar的索引从0开始计数
text: res.todoCount+'' // 徽章的文本
});
}
} catch (error) {
console.error('设置TabBar Badge失败:', error);
}
}
@@ -287,17 +305,8 @@ const getSalesTask = async ()=>{
// 常用服务
let commonServiceList = ref([])
const getCommonServices = async ()=>{
// let res = await commonServices({});
let res = {
list:[
{id:1,name:'设备管理',imgSrc:'static/images/business/icon-sbgl.png'},
{id:2,name:'目标管理',imgSrc:'static/images/business/icon-mbgl.png'},
{id:3,name:'科研工艺',imgSrc:'static/images/business/icon-kygy.png'},
{id:4,name:'工艺攻关',imgSrc:'static/images/business/icon-gygg.png'},
{id:5,name:'数据采集',imgSrc:'static/images/business/icon-sjcj.png'}
],
}
commonServiceList.value = res.list
let res = await getUserFavorite({});
commonServiceList.value = res.list || []
}
// 添加常用服务