项目初始化

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,84 @@
<!-- 虚拟列表演示(不使用内置列表)(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" :auto="true" 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 -->
<order-list :virtualList="virtualList"></order-list>
</z-paging>
</view>
</template>
<script>
import OrderList from '@/pages/reward/components/orderList.vue';
import RewardApi from '@/sheep/api/worker/reward';
import {
fen2yuan,
} from '@/sheep/hooks/useGoods';
export default {
components: {
OrderList,
},
props: {
title: {
type: String,
default: '打赏记录',
},
},
data() {
return {
// 虚拟列表数组,通过@virtualListChange监听获得最新数组
virtualList: [],
scrollTop: 0,
paddingTop: 0,
paddingBottom: 0,
height: 0,
}
},
methods: {
scroll(e) {
this.scrollTop = e.detail.scrollTop;
},
// 监听虚拟列表数组改变并赋值给virtualList进行重新渲染
virtualListChange(vList) {
this.virtualList = vList;
},
queryList(pageNo, pageSize) {
// 组件加载时会自动触发此方法,因此默认页面加载时会自动触发,无需手动调用
// 这里的pageNo和pageSize会自动计算好直接传给服务器即可
// 模拟请求服务器获取分页数据,请替换成自己的网络请求
const params = {
pageNo: pageNo,
pageSize: pageSize,
}
RewardApi.getRewardPage(params).then(res => {
// 将请求的结果数组传递给z-paging
res.data.list.forEach((order) => order.payMoney = fen2yuan(order.payMoney));
res.data.list.forEach((order) => order.money = fen2yuan(order.money));
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);
})
},
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,169 @@
<template>
<view :id="`zp-id-${order.zp_index}`" :key="order.zp_index" v-for="(order,index) in orderList" class="order-card">
<view class="main-box" :class="index == orderList.length-1 ? '':'bt'">
<view>
<u-avatar size="100" :src="order.avatar"></u-avatar>
</view>
<view class="right-box">
<view class="nickname-box">
<view class="nickname">{{order.nickname}}</view>
<view class="info">礼物名称{{order.gift}}×{{order.count}}</view>
<view class="info">到账金额{{order.money}}</view>
<view class="info">心动留言{{order.msg}}</view>
<view class="info">
<text class="weixin">微信{{order.weixin}}</text>
<view @tap.stop="onCopy(order.weixin)">
<u-icon name="outline-copy" custom-prefix="iconfont"></u-icon>
</view>
</view>
<view class="info">订单时间{{order.createTimeStr}}</view>
</view>
<view class="price-box">
<text class="price">{{order.payMoney}}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import sheep from '@/sheep';
export default {
components: {
},
props: {
virtualList: {
type: Array,
default: [],
},
},
data() {
return {
}
},
computed: {
orderList() {
this.virtualList.forEach((order) => order.createTimeStr = sheep.$helper.timeFormat(order.createTime, 'yyyy-mm-dd hh:MM:ss'));
return this.virtualList;
},
},
methods: {
// 复制
onCopy(text) {
sheep.$helper.copyText(text);
},
}
}
</script>
<style lang="scss" scoped>
.order-card {
padding: 0 10px;
background-color: #fff;
display: flex;
flex-direction: column;
flex: 1;
.no-box {
display: flex;
align-items: center;
justify-content: space-between;
flex: 1;
padding-bottom: 10px;
color: rgb(100, 101, 102);
.order-no {
.number {
margin-left: 5px;
font-size: 22rpx;
}
}
.status {
font-size: 22rpx;
}
}
.main-box {
display: flex;
padding: 10px 0;
.right-box {
display: flex;
justify-content: space-between;
flex: 1;
align-items: center;
margin-left: 10px;
.nickname {
font-size: 12px;
font-weight: bold;
margin-bottom: 10px;
}
.info {
font-size: 22rpx;
color: rgb(100, 101, 102);
line-height: 22rpx;
margin-bottom: 5px;
display: flex;
align-items: center;
.weixin {
margin-right: 5px;
}
}
.price-box {
font-size: 22rpx;
color: rgb(100, 101, 102);
.price {
font-size: 34rpx;
font-weight: bold;
color: var(--ui-BG-Main);
}
}
}
}
.bt {
border-bottom: 1px solid #fbf0f0;
}
.bottom-box {
display: flex;
justify-content: flex-end;
.btn-box {
display: flex;
align-items: center;
}
.btn {
background-color: #ddd;
color: rgb(100, 101, 102);
font-size: 22rpx;
border-radius: 40px;
padding: 5px 10px;
margin-left: 10px;
min-width: 140rpx;
display: flex;
justify-content: center;
}
.active {
background-color: var(--ui-BG-Main);
color: #fff;
}
}
}
</style>

40
pages/reward/list.vue Normal file
View File

@@ -0,0 +1,40 @@
<template>
<view class="page-app theme-light main-green font-1">
<layout ref="order"></layout>
<s-menu-tools />
<s-auth-modal />
</view>
</template>
<script>
import layout from '@/pages/reward/components/layout.vue';
export default {
components: {
layout,
},
props: {
},
data() {
return {
}
},
onLoad(options) {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.page-app {
background-color: #fafafa;
padding-bottom: 140rpx;
height: calc(100vh);
padding-bottom: env(safe-area-inset-bottom);
}
</style>