项目初始化

This commit is contained in:
jerry
2025-01-21 01:46:34 +08:00
parent 364021b042
commit 48153e7761
962 changed files with 172070 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
<!-- 虚拟列表演示(不使用内置列表)(vue) -->
<!-- 写法较简单在页面中对当前需要渲染的虚拟列表数据进行for循环在vue3中兼容性良好 -->
<!-- 在各平台兼容性请查阅https://z-paging.zxlee.cn/module/virtual-list.html -->
<template>
<view class="content">
<!-- 如果页面中的cell高度是固定不变的则不需要设置cell-height-mode如果页面中高度是动态改变的则设置cell-height-mode="dynamic" -->
<!-- 原先的v-model修改为@virtualListChange="virtualListChange"并赋值处理后的虚拟列表 -->
<z-paging ref="paging" use-virtual-list :force-close-inner-list="true" :paging-style="{ paddingTop: 0 + 'px', paddingBottom: paddingBottom + 'rpx' }" cell-height-mode="dynamic" @scroll="scroll" @virtualListChange="virtualListChange" @query="queryList">
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中如果需要跟着滚动则不要设置slot="top" -->
<template #top>
<su-navbar :title="title" statusBar></su-navbar>
</template>
<!-- :id="`zp-id-${item.zp_index}`":key="item.zp_index" 必须写必须写 -->
<!-- 这里for循环的index不是数组中真实的index了请使用item.zp_index获取真实的index -->
<worker-list :virtualList="virtualList"></worker-list>
<template #bottom>
<view class="bottom-box">
<view class="btn" @click="addWorker">添加</view>
</view>
</template>
</z-paging>
</view>
</template>
<script>
import WorkerList from '@/pages/worker/workerList/components/workerList.vue';
import ClerkApi from '@/sheep/api/worker/clerk';
export default {
components: {
WorkerList,
},
props: {
title: {
type: String,
default: '',
}
},
data() {
return {
// 虚拟列表数组,通过@virtualListChange监听获得最新数组
virtualList: [],
scrollTop: 0,
paddingTop: 0,
paddingBottom: 0,
height: 0,
current: 0,
}
},
methods: {
initNav(e) {
this.height = e.height;
this.paddingTop = this.height;
},
scroll(e) {
this.scrollTop = e.detail.scrollTop;
},
// 监听虚拟列表数组改变并赋值给virtualList进行重新渲染
virtualListChange(vList) {
this.virtualList = vList;
},
queryList(pageNo, pageSize) {
// 组件加载时会自动触发此方法,因此默认页面加载时会自动触发,无需手动调用
// 这里的pageNo和pageSize会自动计算好直接传给服务器即可
// 模拟请求服务器获取分页数据,请替换成自己的网络请求
const params = {
pageNo: pageNo,
pageSize: pageSize,
}
ClerkApi.getClerkApplyPage(params).then(res => {
// 将请求的结果数组传递给z-paging
this.$refs.paging.complete(res.data.list);
}).catch(res => {
// 如果请求失败写this.$refs.paging.complete(false);
// 注意每次都需要在catch中写这句话很麻烦z-paging提供了方案可以全局统一处理
// 在底层的网络请求抛出异常时写uni.$emit('z-paging-error-emit');即可
this.$refs.paging.complete(false);
})
},
addWorker() {
this.$u.route({
url: 'pages/clerk/apply/index',
});
},
}
}
</script>
<style lang="scss" scoped>
.bottom-box {
display: flex;
justify-content: center;
align-items: center;
padding: 7px 15px;
background-color: #fff;
box-shadow: 0 0 6px 0 #ccc;
.btn {
background-color: var(--ui-BG-Main);
padding: 10px;
border-radius: 40px;
color: #fff;
display: flex;
flex: 1;
justify-content: center;
align-items: center;
font-size: 28rpx;
}
}
</style>

View File

@@ -0,0 +1,208 @@
<template>
<view class="worker-box">
<view :id="`zp-id-${item.zp_index}`" :key="item.zp_index" v-for="(item,index) in virtualList" class="worker-card">
<view class="main-box">
<view class="avatar-box">
<u-avatar mode="square" size="120" :src="item.avatar"></u-avatar>
<view class="online-box" v-if="item.onlineStatus">在线</view>
<view class="online-box" v-else>离线</view>
</view>
<view class="right-box">
<view class="nickname-box">
<view class="nickname">
<text class="name">{{item.nickname}}</text>
<view class="man-box" v-if="item.sex == 0">
<u-icon name="man"></u-icon>
<text>{{item.age}}</text>
</view>
<view class="woman-box" v-if="item.sex == 1">
<u-icon name="woman"></u-icon>
<text>{{item.age}}</text>
</view>
</view>
<view class="status" v-if="item.status == 0">待审核</view>
<view class="status" v-if="item.status == 1">已审核</view>
</view>
<view class="btn-box">
<view class="btn" @click="editApply(item)">编辑资料</view>
<view class="btn" @click="levelList(item)">技能管理</view>
<view class="btn" @click="setOnline(item)">在线状态</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
components: {
},
props: {
virtualList: {
type: Array,
default: [],
},
},
data() {
return {
}
},
methods: {
editApply(e) {
this.$u.route({
url: 'pages/clerk/apply/edit',
params: {
id: e.id,
}
});
},
levelList(e) {
this.$u.route({
url: 'pages/worker/levelList/index',
params: {
id: e.id,
}
});
},
setOnline(e) {
this.$u.route({
url: 'pages/worker/workerList/set',
params: {
id: e.id,
}
});
},
}
}
</script>
<style lang="scss" scoped>
.worker-box {
padding: 0 10px;
}
.worker-card {
padding: 10px;
margin-top: 10px;
background-color: #fff;
display: flex;
flex-direction: column;
flex: 1;
border-radius: 10px;
.main-box {
display: flex;
align-items: center;
.avatar-box {
position: relative;
width: 120rpx;
height: 120rpx;
.online-box {
position: absolute;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
color: #fff;
background-color: var(--ui-BG-Main);
font-size: 11px;
padding: 1px 0;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
}
.right-box {
display: flex;
flex: 1;
flex-direction: column;
margin-left: 10px;
.nickname-box {
display: flex;
justify-content: space-between;
flex: 1;
align-items: center;
}
.nickname {
display: flex;
align-items: center;
.name {
font-size: 28rpx;
font-weight: bold;
margin-right: 5px;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 300rpx;
overflow: hidden;
}
}
.man-box {
background: linear-gradient(90deg,#2b99ca,#87b5e7);
display: flex;
justify-content: center;
align-items: center;
border-radius: 40px;
color: #fff;
font-size: 20rpx;
padding: 1px 5px;
}
.woman-box {
background: linear-gradient(90deg,#c33239,#de8189);
display: flex;
justify-content: center;
align-items: center;
border-radius: 40px;
color: #fff;
font-size: 20rpx;
padding: 1px 5px;
}
.status {
font-size: 24rpx;
font-weight: bold;
color: var(--ui-BG-Main);
}
.btn-box {
display: flex;
justify-content: flex-end;
.btn {
background-color: var(--ui-BG-Main);
color: #fff;
border-radius: 40px;
font-size: 22rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx 20rpx;
margin-left: 5px;
margin-top: 20rpx;
}
}
}
}
}
</style>