123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <template>
- <view>
- <view class="content1">
- <u-search placeholder="搜索用户名称" v-model="keyword" :show-action='false' bg-color="#F5F6FA"></u-search>
- </view>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" top="0" @down="downCallback" :up="upOption"
- @up="upCallback" @emptyclick="emptyClick">
- <!-- 数据列表 -->
- <view class="list" v-if="goods.length!=0">
- <view class="list-item" v-for="(item,index) in goods">
- <view class="left">
- <image src="../../static/img/face/27.png" mode="aspectFill" class="head-img"></image>
- <view class="name">
- 李师傅1334248520
- </view>
- </view>
- <view class="right">
- <u-icon name="plus" color="#333333" size="17" bold></u-icon><text class="case">关注</text>
- </view>
- <view class="right" @click="follow(item)">
- <text class="case" style="color:#878C9C;">已关注</text>
- </view>
- </view>
- </view>
- </mescroll-body>
- <u-modal v-model="show" :content="content" :show-title='false' :show-cancel-button='true'
- :content-style="contentStyle"></u-modal>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import {
- apiGoods
- } from "@/api/mock.js"
- export default {
- components: {
- },
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- selectItem: {},
- contentStyle: {
- "font-weight": 700
- },
- show: false,
- content: '确定不在关注?',
- keyword: '',
- inputStyle: {
- // "padding-left": '30rpx'
- },
- upOption: {
- // page: {
- // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- // size: 10 // 每页数据的数量
- // },
- noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty: {
- tip: '~ 搜索无数据 ~', // 提示
- btnText: '去看看'
- }
- },
- goods: [], //列表数据
- }
- },
- onShow() {
- uni.showTabBar()
- uni.hideKeyboard()
- var userInfo = uni.getStorageSync("userInfo")
- var that = this
- console.log("userInfo", userInfo)
- // setTimeout(function() {
- // that.$api.doRequest('get', '/appVersion/test', {
- // userId: "7e83070d05fc4d50aaa46e00a3ee03d8"
- // }).then(res => {
- // })
- // }, 500);
- uni.removeTabBarBadge({
- index: 4
- })
- this.$api.doRequest('get', '/newNoticeTask/query/noticeTasks').then(res => {
- if (res.data.data) {
- let name = 'myTip';
- let value = res.data.data.total;
- that.$store.commit('$uStore', {
- name,
- value
- });
- if (value != 0 && value) {
- uni.setTabBarBadge({
- index: 4,
- text: value + ""
- })
- }
- name = 'taskTip';
- value = res.data.data.total;
- that.$store.commit('$uStore', {
- name,
- value
- });
- }
- })
- },
- onLoad(options) {},
- methods: {
- follow(val) {
- this.selectItem = val
- this.show = true
- },
- edit() {},
- del() {},
- selectAddress(val) {
- console.log(val)
- },
- release() {
- uni.navigateTo({
- url: 'release'
- })
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- apiGoods(page.num, page.size).then(res => {
- //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
- this.mescroll.endSuccess(res.list.length);
- //设置列表数据
- if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
- this.goods = this.goods.concat(res.list); //追加新数据
- this.co
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- },
- //点击空布局按钮的回调
- emptyClick() {
- uni.showToast({
- title: '点击了按钮,具体逻辑自行实现'
- })
- },
- // 切换菜单
- tabChange() {
- this.goods = [] // 先置空列表,显示加载进度
- this.mescroll.resetUpScroll() // 再刷新列表数据
- }
- }
- }
- </script>
- <style lang='scss'>
- .head-img {
- width: 76rpx;
- height: 76rpx;
- background: red;
- border-radius: 50%;
- }
- page {
- background: #fff !important;
- }
- .content1 {
- padding: 20rpx;
- }
- .list {
- padding: 0 22rpx;
- .left {
- display: flex;
- align-items: center;
- .name {
- font-size: 32rpx;
- font-weight: 400;
- color: #262626;
- margin-left: 26rpx;
- }
- }
- .right {
- width: 124rpx;
- height: 58rpx;
- background: #FFFFFF;
- border-radius: 29rpx;
- border: 1px solid #CDCDCD;
- line-height: 58rpx;
- text-align: center;
- .case {
- font-weight: 700;
- }
- }
- .list-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 34rpx 0;
- border-bottom: 1px solid #E6E6E6;
- }
- }
- </style>
|