123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view class="content">
- <u-sticky offsetTop="0" customNavHeight="0">
- <view class="tabs">
- <u-tabs :scrollable="false" :list="tabs" :current="current" lineColor="#FF5C03" @change="tabChange">
- </u-tabs>
- </view>
- </u-sticky>
- <view>
- <mescroll-body bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
- <view class="list">
- <view class="list-item" v-for="item in dataList" :key="item.id">
- <view class="list-top ellipsis2" @click="navTo('./voice?id='+item.id)">{{item.voiceTxt}}</view>
- <view class="list-cont x-f es-center">
- <text class="duration">{{secondsToHoursAndMinutes(item.duration || 0)}}</text>
- <view class="btn" v-show="current==0" @click="navTo('./voice?id='+item.id)">录制</view>
- <view class="btn" v-show="current==1" @click="navTo('./voice?id='+item.id)">详情</view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import {querySopVoiceList} from '@/api/companyUser'
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- current: 0,
- tabs: [{
- id: 0,
- name: '未完成'
- },
- {
- id: 1,
- name: '已完成'
- }
- ],
- mescroll: null,
- downOption: { //下拉刷新
- use: true,
- auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
- },
- upOption: {
- onScroll: false,
- use: true, // 是否启用上拉加载; 默认true
- page: {
- pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- textNoMore: "已经到底了",
- empty: {
- icon: 'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
- tip: '暂无数据'
- }
- },
- dataList: []
- }
- },
- onLoad() {
- uni.$on('refreshVoiceList', () => {
- this.mescroll.resetUpScroll()
- })
- },
- onUnload() {
- uni.$off('refreshVoiceList')
- },
- methods: {
- secondsToHoursAndMinutes(totalSeconds) {
- let hours = Math.floor(totalSeconds / 3600);
- let minutes = Math.floor((totalSeconds % 3600) / 60);
- let seconds = totalSeconds % 60;
- hours = hours.toString().padStart(2, '0');
- minutes = minutes.toString().padStart(2, '0');
- seconds = seconds.toString().padStart(2, '0');
- return hours+':'+minutes+':'+seconds;
- },
- tabChange(item) {
- if(this.current == item.index) return
- this.current = item.index
- this.mescroll.resetUpScroll()
- },
- navTo(url) {
- uni.navigateTo({
- url: url
- })
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback() {
- this.mescroll.resetUpScroll()
- },
- /*上拉加载的回调*/
- upCallback(page) {
- //联网加载数据
- var that = this;
- var data = {
- recordType: this.current,
- pageNum: page.num,
- pageSize: page.size
- };
- querySopVoiceList(data).then(res => {
- if (res.code == 200) {
- if (page.num == 1) {
- that.dataList = res.rows;
- } else {
- that.dataList = that.dataList.concat(res.rows);
- }
- that.mescroll.endBySize(res.rows.length, res.total);
- } else {
- uni.showToast({
- icon: 'none',
- title: "请求失败",
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @mixin u-flex($flexD, $alignI, $justifyC) {
- display: flex;
- flex-direction: $flexD;
- align-items: $alignI;
- justify-content: $justifyC;
- }
- .content {
- .tabs {
- background-color: #fff;
- }
- .list {
- width: 100%;
- padding: 15rpx;
- @include u-flex(column,flex-start,flex-start);
- .list-item {
- margin-bottom: 15rpx;
- width: 100%;
- padding: 15rpx;
- box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.05);
- background-color: #fff;
- border-radius: 15rpx;
- @include u-flex(column,flex-start,flex-start);
- }
- .list-cont {
- margin-top: 24rpx;
- width: 100%;
- }
- }
- .duration {
- box-sizing: border-box;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- }
- .btn {
- padding: 10rpx 30rpx;
- border: 1rpx solid #FF5C03;
- color: #FF5C03;
- font-size: 28rpx;
- border-radius: 30rpx;
- }
- }
- </style>
|