123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <template>
- <view>
- <view class="content1">
- <u-search placeholder="搜索用户名称" v-model="keyword" :show-action='false' @search='keywordsearch'
- 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="item.commonUser.avatarUrl?item.commonUser.avatarUrl:'../../static/img/myimg/YongHu@3x.png'"
- mode="aspectFill" class="head-img"></image>
- <view class="name">
- {{item.commonUser.wechatNo}}
- </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>
- <view class="total" v-if="goods.length>=10">
- 共关注{{goods.length}}人
- </view>
- </mescroll-body>
- <u-modal v-model="show" :content="content" :show-title='false' :show-cancel-button='true'
- :content-style="contentStyle" :showCancelButton='true' @confirm="cancelFollow" @cancel="show=false">
- </u-modal>
- <u-toast ref="uToast" />
- </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'
- },
- selectType: '',
- upOption: {
- // page: {
- // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- // size: 10 // 每页数据的数量
- // },
- noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty: {
- icon: '/static/empty.png',
- tip: '暂无内容', // 提示
- // btnText: '去看看'
- }
- },
- goods: [], //列表数据
- }
- },
- onShow() {
- uni.showTabBar()
- uni.hideKeyboard()
- var userInfo = uni.getStorageSync("userInfo")
- var that = this
- console.log("userInfo", userInfo)
- },
- onLoad(options) {
- this.selectType = options.selectType
- },
- methods: {
- cancelFollow() {
- let _obj = {
- id: this.selectItem.id
- }
- console.log()
- this.$api.doRequest('post', '/followInformation/api/deleteInfo', _obj).then(res => {
- console.log(res.data)
- if (res.data.code == 200) {
- this.$refs.uToast.show({
- title: '取关成功',
- type: 'success',
- })
- this.mescroll.resetUpScroll()
- }
- uni.hideLoading()
- })
- },
- follow(val) {
- this.selectItem = val
- this.show = true
- },
- edit() {},
- del() {},
- selectAddress(val) {
- console.log(val)
- },
- release() {
- uni.navigateTo({
- url: 'release'
- })
- },
- keywordsearch(e) {
- this.keyword = e
- this.upCallback({
- size: 10,
- num: 1
- })
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- uni.showLoading({
- title: '数据加载中',
- mask: true
- })
- console.log("this.selectPlace", this.selectPlace)
- console.log("this.selectType", this.selectType)
- let _obj = {
- }
- // if (this.selectType == '关注') {
- // _obj = {
- // pageSize: page.size,
- // currentPage: page.num,
- // placeDelivery: this.selectPlace,
- // tranType: this.selectType,
- // userIdFollow: this.userInfo.id,
- // followedId: this.keyword,
- // nowUserId: this.userInfo.id
- // }
- // } else {
- _obj = {
- pageSize: page.size,
- currentPage: page.num,
- userId: this.userInfo.id,
- }
- // }
- this.$api.doRequest('get', '/followInformation/getInfo', _obj).then(res => {
- console.log(res.data.data.records)
- if (res.data.code == 200) {
- let curPageData = res.data.data.records;
- let curPageLen = curPageData.length;
- let totalPage = res.data.data.total;
- if (page.num == 1) this.goods = [];
- this.goods = this.goods.concat(curPageData);
- console.log(curPageLen, totalPage)
- this.mescroll.endByPage(curPageLen, totalPage);
- }
- uni.hideLoading()
- })
- },
- //点击空布局按钮的回调
- emptyClick() {
- uni.showToast({
- title: '点击了按钮,具体逻辑自行实现'
- })
- },
- // 切换菜单
- tabChange() {
- this.goods = [] // 先置空列表,显示加载进度
- this.mescroll.resetUpScroll() // 再刷新列表数据
- }
- }
- }
- </script>
- <style lang='scss'>
- .head-img {
- width: 76rpx;
- height: 76rpx;
- 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 31rpx;
- border-bottom: 1px solid #E6E6E6;
- }
- }
- .total {
- display: flex;
- justify-content: center;
- margin: 40rpx 0;
- }
- </style>
|