123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628 |
- <template>
- <view class="content">
- <view class="content1 flex flex-between">
- <view class="search flex">
- <view class="left flex" @click="search">
- <image src="../../static/imgs/cirlce/search.png" mode="widthFix" class="search-img"></image>
- <text class="search-val"> {{searchVal?searchVal:'搜索圈子'}}</text>
- <image class='search-del' style='width:32rpx;height:32rpx;' v-if="searchVal"
- @click.native.stop="delSearchVal" src="../../static/imgs/card/searchdel.png" mode="widthFix">
- </image>
- </view>
- </view>
- <view class="right relative">
- <image src="../../static/imgs/cirlce/hy.png" mode="widthFix" class="hy-search-img"
- @click="toChangeCard"></image>
- <u-badge v-if='cardList.length>0' :isDot="true" type="error" class="point position"></u-badge>
- </view>
- </view>
- <mescroll-uni ref="mescrollRef" :top="120" :up="upOption" :down="downOption" @init="mescrollInit" @up="upCallback"
- @down="downCallback">
- <view class="content2 flex flex-between">
- <view class="left flex title">
- <view class="line"></view>
- <view class="text-title">
- 我的圈子
- </view>
- </view>
- <!-- <view class="right">
- <uni-icons type="personadd-filled" size="30" @click="toCreateCircle"></uni-icons>
- </view> -->
- </view>
- <view class="wd-list">
- <view v-for="(item,index) in circleList1" :key="index">
- <view class="flex title" v-if="item.name">
- <view class="line"></view>
- <view class="text-title">
- {{item.name}}
- </view>
- </view>
- <view class="row-tiem flex" v-if="!item.name" @click="toDetail(item.id)">
- <view class="left">
- <image :src="item.circleHead?item.circleHead:'../../static/imgs/mySet/ewm.png'"
- mode="aspectFill" class="img"></image>
- </view>
- <view class="right">
- <view class="top">{{item.circleName}}({{item.cardNum}}人)</view>
- <view style='flex-wrap: wrap;' class="bottom flex">
- <view v-for="item1 in item.circleLabelArray" class="text">
- {{item1}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="content2 flex flex-between">
- <view class="left flex title">
- <view class="line"></view>
- <view class="text-title">
- 推荐圈子
- </view>
- </view>
- <!-- <view class="right">
- <uni-icons type="personadd-filled" size="30" @click="toCreateCircle"></uni-icons>
- </view> -->
- </view>
- <view class="tj-list">
- <view v-for="(item,index) in circleList" :key="index">
- <view class="flex title" v-if="item.name">
- <view class="line"></view>
- <view class="text-title">
- {{item.name}}
- </view>
- </view>
- <view class="row-tiem flex" v-if="!item.name" @click="toDetail(item.id)">
- <view class="left">
- <image :src="item.circleHead?item.circleHead:'../../static/imgs/mySet/ewm.png'"
- mode="aspectFill" class="img"></image>
- </view>
- <view class="right">
- <view class="top">{{item.circleName}}({{item.cardNum}}人)</view>
- <view style='flex-wrap: wrap;' class="bottom flex">
- <view v-for="item1 in item.circleLabelArray" class="text">
- {{item1}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </mescroll-uni>
- <image v-if='hidden!="隐藏"' src="../../static/imgs/cirlce/add.png" mode="widthFix" class="add" @click="toCreateCircle"></image>
- <u-toast ref="uToast"></u-toast>
- <!-- #ifdef MP-WEIXIN -->
- <u-modal :show="showAuthorizePhone" :showConfirmButton="false">
- <view class="slot-content">
- <view class="auth-card">
- <view class="img">
- <img class="avatar-img" src="@/static/imgs/logo.png" mode="widthFix">
- </view>
- <view class="content">手机登录后才能查看名片哦~</view>
- </view>
- <view class="auth-btncard">
- <view class="btn-unok">
- <u-button :customStyle="customStyleUnOk" @click="showAuthorizePhone=false" :plain="true">
- 拒绝</u-button>
- </view>
- <view class="btn-ok">
- <u-button :customStyle="customStyleOk" open-type="getPhoneNumber"
- @getphonenumber="getPhoneNumber"> 立即登录</u-button>
- </view>
- </view>
- </view>
- </u-modal>
- <u-modal :show="showAuthorizeUser" :showConfirmButton="false">
- <view class="slot-content">
- <view class="auth-card">
- <view class="img">
- <img class="avatar-img" src="/static/imgs/logo.png" mode="widthFix">
- </view>
- <view class="content">邀请您补全个人信息<br></br>(昵称、头像)</view>
- <view style="margin-left: 100rpx;margin-right: 100rpx">
- <u-form :model="userInfo" ref="uForm">
- <u-form-item label="头像">
- <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"
- slot="right">
- <image class="avatar"
- :src="userInfo.head?userInfo.head:'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'">
- </image>
- </button>
- </u-form-item>
- <u-form-item label="昵称">
- <u-input inputAlign='right' v-model="userInfo.nickname" class="weui-input"
- @blur="userNameInput" placeholder="请输入昵称" border="false" />
- <!-- <input type="nickname" :value="userInfo.nickname" class="weui-input" @blur="userNameInput" placeholder="请输入昵称"/> -->
- </u-form-item>
- </u-form>
- </view>
- </view>
- <view class="auth-btncard">
- <view class="btn-unok"><u-button :customStyle="customStyleUnOk" @click="authUser(0)">
- 拒绝</u-button>
- </view>
- <view class="btn-ok">
- <u-button :customStyle="customStyleOk" @click="authUser(1)"> 允许</u-button>
- </view>
- </view>
- </view>
- </u-modal>
- <!-- #endif -->
- </view>
- </template>
- <script>
- var that;
- import {
- pathToBase64,
- base64ToPath
- } from 'image-tools'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import {
- mapState,
- mapMutations
- } from 'vuex';
- export default {
- mixins: [MescrollMixin], // 使用mixin
- computed: {
- ...mapState(['hasLogin'])
- },
- data() {
- return {
- showAuthorizeUser: false,
- showAuthorizePhone: false,
- customStyleUnOk: {
- marginTop: '20rpx',
- color: '#18254C',
- border: '2px solid #18254C',
- "border-radius": "10px",
- fontSize: "32rpx"
- },
- customStyleOk: {
- marginTop: '20rpx',
- color: '#fff',
- border: '2px solid #18254C',
- "border-radius": "10px",
- fontSize: "32rpx",
- background: "#18254C"
- },
- hidden:'',
- searchVal: '',
- circleList: [],
- userInfo: {},
- canReset: false,
- cardList: [],
- circleList1: [],
- downOption: {
- auto: false,
- textColor: '#bbb'
- },
- upOption: {
- page: {
- size: 10 // 每页数据的数量,默认10
- },
- auto: false,
- noMoreSize: 1,
- textNoMore: '没有更多了~',
- textColor: '#bbb'
- }
- };
- },
- onLoad() {
- that = this
- if (uni.getStorageSync("userInfo").phone) {
- this.userInfo = uni.getStorageSync("userInfo")
- this.$nextTick(function() {
- that.mescroll.resetUpScroll()
- });
- this.$request.baseRequest('admin.unimall.cardExchangeInfo', 'list', {
- receiveId: this.userInfo.id,
- status: 1
- }, failres => {
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
- }).then(res => {
- this.cardList = res.data.items.filter((item) => {
- return item.status == 0
- })
- console.log(this.cardList)
- })
- }
- },
- onShow() {
- this.$request.baseRequest('admin.dictData', 'list', {
- dictType:'circle_friends'
- }, failres => {
-
- }).then( res => {
- console.log(res,11111)
- this.hidden=res.data.items[0].dictLabel
- })
- if (uni.getStorageSync("userInfo").phone) {
-
- this.userInfo = uni.getStorageSync("userInfo")
- this.$request.baseRequest('admin.unimall.cardExchangeInfo', 'list', {
- receiveId: this.userInfo.id,
- status: 1
- }, failres => {
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
- }).then(res => {
- this.searchVal = uni.getStorageSync("cirlce_search_val") ? uni.getStorageSync(
- "cirlce_search_val") : ''
- if (this.searchVal) this.mescroll.resetUpScroll();
- })
-
- } else {
- this.showAuthorizePhone = true
- }
-
- },
- methods: {
- //获取昵称输入内容
- userNameInput(e) {
- this.userInfo.nickname = e.detail.value
- },
- async onChooseAvatar(e) {
- this.$set(this.userInfo, "head", await this.toBase64(e.detail.avatarUrl))
- },
- toBase64(url) {
- return new Promise(resolve => {
- pathToBase64(url).then(path => {
- resolve(path);
- }).catch(error => {
- console.log(error)
- })
- })
- },
- async authUser(type) {
- //同步信息,没有头像和昵称自动生成
- this.userInfo = await this.$request.syncInfo(this.userInfo)
- if(this.userInfo.openId) {
- uni.setStorageSync("userInfo", that.userInfo)
- that.showAuthorizeUser = false
- that.mescroll.resetUpScroll()
- }
- },
-
- downCallback() {
- if (uni.getStorageSync("userInfo").phone) {
- this.mescroll.resetUpScroll()
- } else {
- this.mescroll.endBySize(0, 0)
- this.showAuthorizePhone = true
- }
-
- },
- async getPhoneNumber(e) {
- that.userInfo = await this.$request.wxlogin()
- that.userInfo.phone = await this.$request.getPhone(e, that.userInfo)
- this.showAuthorizePhone = false
- this.showAuthorizeUser = true
- },
- delSearchVal() {
- this.searchVal = ""
- uni.removeStorageSync('cirlce_search_val')
- this.mescroll.resetUpScroll()
- },
- toChangeCard() {
- if (this.userInfo.phone) {
- uni.navigateTo({
- url: "/pageA/circle/changeCard"
- })
- } else {
- this.showAuthorizePhone = true
- }
-
- },
- toCreateCircle() {
- if (this.userInfo.phone) {
- uni.navigateTo({
- url: "/pageA/circle/createCirclce"
- })
- } else {
- this.showAuthorizePhone = true
- }
- },
- micOpen: function() {
- this.$refs.asr.show();
- },
- search() {
- if (this.userInfo.phone) {
- uni.navigateTo({
- url: "/pageA/circle/search"
- })
- } else {
- this.showAuthorizePhone = true
- }
-
- },
- toDetail(val) {
- uni.navigateTo({
- url: "/pageA/circle/detail?val=" + val
- })
- },
- upCallback(page) {
- uni.showLoading({
- title: '数据加载中'
- })
- let _data = {
- commonId: this.userInfo.id,
- page: page.num,
- limit: page.size,
- status: 1
- }
- if (this.searchVal) {
- _data.circleName = this.searchVal
- }
- this.$request.baseRequest('admin.unimall.circleManagementInfo', 'list', _data, failres => {
- console.log('res+++++', failres.errmsg)
- uni.showToast({
- icon: "none",
- title: failres.errmsg,
- duration: 3000
- });
- uni.hideLoading()
- }).then(res => {
- uni.hideLoading()
- console.log(11)
- let curPageData = res.data.items;
- let totalPage = res.data.total;
- let curPageLen = curPageData.length;
- this.mescroll.endByPage(curPageLen, totalPage);
- console.log(res.data)
- // this.makeData(res.data)
- //追加新数据
- for (let i = 0; i < this.circleList.length; i++) {
- if (this.circleList[i].circleLabel) {
- if (this.circleList[i].circleLabel.split(',').length >= 3) {
- var arr = this.circleList[i].circleLabel.split(',')
- console.log(arr)
- this.circleList[i].circleLabelArray = arr.filter((item, index) => {
- return index <= 2
- })
- } else {
- this.circleList[i].circleLabelArray = this.circleList[i].circleLabel.split(',')
- }
- }
- }
- if (page.num == 1) this.circleList1 = [];
- this.circleList = []; //如果是第一页需手动置空列表
- var tjarr = curPageData.filter((item) => {
- return item.addedFlag == 0
- })
- var wdarr = curPageData.filter((item) => {
- return item.addedFlag == 1
- })
- this.circleList1 = this.circleList1.concat(wdarr);
- this.circleList = this.circleList.concat(tjarr);
- })
- },
- input(res) {
- console.log('----input:', res)
- },
- clear(res) {
- uni.showToast({
- title: 'clear事件,清除值为:' + res.value,
- icon: 'none'
- })
- },
- blur(res) {
- uni.showToast({
- title: 'blur事件,输入值为:' + res.value,
- icon: 'none'
- })
- },
- focus(e) {
- uni.showToast({
- title: 'focus事件,输出值为:' + e.value,
- icon: 'none'
- })
- },
- cancel(res) {
- uni.showToast({
- title: '点击取消,输入值为:' + res.value,
- icon: 'none'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content1 {
- margin: 50rpx 25rpx 14rpx 25rpx;
- .search {
- width: 100%;
- .left {
- background: #F0F0F0;
- border-radius: 38rpx;
- padding: 18rpx;
- width: 100%;
- position: relative;
- }
- .search-val {
- color: #B3B3B3;
- }
- .search-del {
- position: absolute;
- right: 10px;
- }
- }
- .hy-search-img {
- width: 38rpx;
- height: auto;
- margin-left: 40rpx;
- }
- .search-img {
- width: 38rpx;
- margin-right: 40rpx;
- height: auto;
- }
- .right {
- /deep/.u-badge {
- position: absolute;
- top: 0;
- right: -10rpx;
- }
- }
- }
- .line {
- width: 8rpx;
- height: 34rpx;
- background: #112253;
- border-radius: 3px;
- margin: 20rpx;
- }
- .title {
- margin: 20rpx 0;
- }
- .text-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #1A1A1A;
- }
- .row-tiem {
- // background: #fff;
- padding: 24rpx;
- // margin: 0 34rpx;
- align-items: unset;
- .img {
- width: 122rpx;
- height: 122rpx;
- border-radius: 10px;
- margin-right: 30rpx;
- }
- .right {
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- .top {
- font-size: 32rpx;
- color: #1A1A1A;
- font-family: PingFang SC;
- font-weight: bold;
- }
- .bottom {
- margin-top: 10rpx;
- .text {
- background: #FAFAFA;
- border-radius: 10rpx;
- font-size: 26rpx;
- font-weight: 700;
- color: #666666;
- padding: 10rpx 20rpx;
- margin: 0px 10rpx 10rpx 0;
- }
- }
- }
- }
- .add {
- width: 84rpx;
- height: auto;
- position: fixed;
- bottom: 26rpx;
- right: 26rpx;
- height: auto;
- z-index: 999;
- }
- .wd-list,
- .tj-list {
- border-radius: 20rpx;
- background: #fff;
- margin: 0 34rpx;
- }
- .slot-content {
- width: 100%;
- }
- .auth-btncard {
- display: flex !important;
- justify-content: space-between !important;
- .btn-unok {
- width: 40%;
- }
- .btn-ok {
- width: 40%;
- }
- }
- .auth-card {
- text-align: center;
- .avatar-img {
- width: 250rpx;
- }
- .title {
- font-size: 20rpx;
- }
- .content {
- font-size: 32rpx;
- font-weight: bold;
- color: #1A1A1A;
- margin-bottom: 30rpx;
- }
- }
- .avatar-wrapper {
- color: #333 !important;
- border: none !important;
- border-radius: 0 !important;
- background-color: transparent !important;
- padding: 0;
- }
- .avatar-wrapper::after {
- border: none !important;
- }
- .avatar {
- width: 100rpx;
- height: 100rpx;
- overflow: hidden;
- border-radius: 100%;
- }
- /deep/.u-popup__content {
- border-radius: 20rpx !important;
- }
- </style>
|