diff --git a/api/business/member.js b/api/business/member.js index 3501a95..bb1988d 100644 --- a/api/business/member.js +++ b/api/business/member.js @@ -3,10 +3,19 @@ import request from '@/utils/request' //------------------博主、通告主----------------------- //查询博主详情 -export function bloggerDetail(userId) { +export function queryDetail(params) { return request({ - url: '/member/member/bloggerDetail/' + userId, - method: 'get' + url: '/member/member/queryDetail', + method: 'get', + params:params + }) +} +//保存博主 +export function uniSaveMember(data) { + return request({ + url: '/member/member/uniSaveMember', + method: 'post', + data:data }) } diff --git a/pages/mine/card/my-card.vue b/pages/mine/card/my-card.vue index 970f3ad..d2d1c1d 100644 --- a/pages/mine/card/my-card.vue +++ b/pages/mine/card/my-card.vue @@ -2,7 +2,7 @@ - + 管理 @@ -19,7 +19,7 @@ - @@ -62,7 +62,7 @@ 已选择{{getChooseNum}}张 - 保存 + 保存 @@ -77,12 +77,20 @@ getUserBusiCard, removeBusiCard } from '@/api/business/member.js' + import { + getSignCard + } from '@/api/business/signCard.js' + import { + hasRights + } from '@/utils/common.js' + import rightsCode from '@/utils/rightsCode.js' export default { components: { navigationBarVue }, data() { return { + noticeId: null, //是否是管理模式 ifEdit: false, //是否是选择模式(默认值为false,管理页面) @@ -106,7 +114,29 @@ onShow() { this.initData(); }, + onLoad(param) { + if (param.ifChoose) { + this.ifChoose = param.ifChoose + + } + if (param.noticeId) { + this.noticeId = param.noticeId + } + }, methods: { + chooseOk() { + let info = hasRights(rightsCode.manyCardReport) + if (!info && this.busiCardList.length > 1) { + //未开通不可选多个 + uni.showToast({ + title: '未开通会员不可添加多个', + icon: 'none' + }) + return + } + uni.$emit('updateCard', this.busiCardList) + uni.navigateBack() + }, /** * 数值单位转换 * @param {Object} number @@ -117,20 +147,40 @@ //查询名片列表 initData() { this.busiCardList = [] - getUserBusiCard().then(res => { - if (res.data.length > 0) { - res.data.map((item) => { - item.choosed = [] - this.busiCardList.push(item) - }) - } - }).catch((e) => { - uni.showToast({ - icon: 'error', - duration: 2000, - title: e - }); - }) + if (!this.ifChoose) { + getUserBusiCard().then(res => { + if (res.data.length > 0) { + res.data.map((item) => { + item.choosed = [] + this.busiCardList.push(item) + }) + } + }).catch((e) => { + uni.showToast({ + icon: 'error', + duration: 2000, + title: e + }); + }) + } else { + getSignCard({ + noticeId: this.noticeId + }).then(res => { + if (res.data.list.length > 0) { + res.data.list.map((item) => { + item.choosed = [] + this.busiCardList.push(item) + }) + } + }).catch((e) => { + uni.showToast({ + icon: 'error', + duration: 2000, + title: e + }); + }) + } + }, /**删除名片*/ remove(id) { @@ -159,13 +209,13 @@ chooseAllFun(e) { if (e.detail.value.length > 0) { this.busiCardList.map((item) => { - if ("1" == item.approvalStatus) { + if ("1" == item.canUse) { item.choosed = [true] } }) } else { this.busiCardList.map((item) => { - if ("1" == item.approvalStatus) { + if ("1" == item.canUse) { item.choosed = [] } }) @@ -424,4 +474,4 @@ } } } - \ No newline at end of file + diff --git a/pages/mine/mine-index.vue b/pages/mine/mine-index.vue index 2a79f5f..bd8fd5b 100644 --- a/pages/mine/mine-index.vue +++ b/pages/mine/mine-index.vue @@ -182,7 +182,7 @@ getStrData } from '@/utils/auth.js' import { - bloggerDetail + queryDetail } from '@/api/business/member.js' export default { props: { @@ -215,7 +215,6 @@ popupImgUrl: "", } }, - mounted() {}, onShow() { }, @@ -225,7 +224,7 @@ mounted() { if (null != getJSONData(constant.userInfo)) { this.userInfo = getJSONData(constant.userInfo) - this.getBloggerDetail() + this.getDetail() } }, computed: { @@ -240,11 +239,12 @@ // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 this.$refs.popup.open(type) }, - getBloggerDetail() { - bloggerDetail(this.userInfo.userId).then(res => { + getDetail() { + queryDetail({userId:this.userInfo.userId,userType:this.localUserType}).then(res => { this.userInfo.tfansNum = res.data.tfansNum.toString() this.userInfo.pointsBalance = res.data.pointsBalance.toString() this.userInfo.report = res.data.report.toString() + this.userInfo.avatar = this.imageUrl+res.data.avatar }) }, /** @@ -254,6 +254,7 @@ changeUserType(type) this.localUserType = type this.$emit('update:nowUserType', this.localUserType) + this.getDetail() this.$forceUpdate() }, handleToInfo() { @@ -290,7 +291,7 @@ * 跳转编辑页 */ goEdit() { - this.$tab.navigateTo('/pages/mine/set/my-info') + this.$tab.navigateTo('/pages/mine/set/my-info?userType='+this.localUserType+'&userId='+this.userInfo.userId) }, viewNewPeople() { this.$tab.navigateTo( diff --git a/pages/mine/set/my-info.vue b/pages/mine/set/my-info.vue index 9b979d5..49d2a2f 100644 --- a/pages/mine/set/my-info.vue +++ b/pages/mine/set/my-info.vue @@ -5,7 +5,7 @@ - + @@ -18,15 +18,15 @@ - + - - + + - - + + @@ -38,17 +38,25 @@