odf_new/odf-uniapp/pages/trunk/index.vue

151 lines
2.8 KiB
Vue

<template>
<view class="trunk-page">
<image class="bg-image" src="/static/images/home_bg.png" mode="aspectFill" />
<view class="content">
<!-- 顶部导航栏 -->
<view class="nav-bar" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="nav-bar-inner">
<image
class="nav-icon"
src="/static/images/ic_back.png"
mode="aspectFit"
@click="goBack"
/>
<text class="nav-title">干线</text>
<view class="nav-icon-placeholder" />
</view>
</view>
<!-- 小标题 -->
<text class="section-title">公司列表</text>
<!-- 公司列表 -->
<scroll-view class="company-list" scroll-y>
<view
class="company-card"
v-for="item in companyList"
:key="item.deptId"
@click="goCable(item)"
>
<text class="company-name">{{ item.deptName }}</text>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app'
import { getCompanyList } from '@/services/home'
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0
const companyList = ref([])
async function loadCompanyList() {
const res = await getCompanyList()
if (res.code === 200) {
companyList.value = res.data || []
}
}
function goBack() {
uni.navigateBack()
}
function goCable(item) {
uni.navigateTo({ url: '/pages/cable/index?deptId=' + item.deptId })
}
onLoad(() => {
loadCompanyList()
})
onPullDownRefresh(() => {
loadCompanyList().finally(() => {
uni.stopPullDownRefresh()
})
})
</script>
<style scoped>
.trunk-page {
position: relative;
min-height: 100vh;
background-color: #F5F5F5;
}
.bg-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 500rpx;
z-index: 0;
}
.content {
position: relative;
z-index: 1;
}
.nav-bar {
width: 100%;
}
.nav-bar-inner {
display: flex;
align-items: center;
justify-content: space-between;
height: 88rpx;
padding: 0 24rpx;
}
.nav-icon {
width: 44rpx;
height: 44rpx;
}
.nav-icon-placeholder {
width: 44rpx;
height: 44rpx;
}
.nav-title {
font-size: 34rpx;
font-weight: 600;
color: #fff;
}
.section-title {
font-size: 30rpx;
font-weight: 600;
color: #333;
padding: 16rpx 24rpx 8rpx;
display: block;
}
.company-list {
padding: 0 0 24rpx;
height: calc(100vh - 400rpx);
}
.company-card {
display: flex;
align-items: center;
margin: 0 24rpx 20rpx;
padding: 28rpx 24rpx;
background-color: #fff;
border-radius: 12rpx;
border: 1rpx solid #E8E8E8;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
}
.company-name {
font-size: 30rpx;
color: #333;
font-weight: 500;
}
</style>