Browse Source

feat: 添加分享审核计数功能并优化激活弹窗

- 在config.js中将环境切换为dev并更新API基础URL
- 在index.vue中添加queryShareCount方法获取分享审核通过的记录数
- 在sharing.js中添加queryShareCount API接口
- 优化popupActivate.vue的代码格式和过期代理提示逻辑
master
前端-胡立永 1 week ago
parent
commit
d65d40e6c7
4 changed files with 180 additions and 165 deletions
  1. +71
    -63
      api/model/sharing.js
  2. +84
    -94
      components/center/popupActivate.vue
  3. +3
    -3
      config.js
  4. +22
    -5
      pages/index/index.vue

+ 71
- 63
api/model/sharing.js View File

@ -1,7 +1,7 @@
const api = { const api = {
/**
* 获取个人分享记录详情
*/
/**
* 获取个人分享记录详情
*/
getShareInfo: { getShareInfo: {
url: '/fen/getShareInfo', url: '/fen/getShareInfo',
method: 'GET', method: 'GET',
@ -13,122 +13,130 @@ const api = {
addLogShareInfo: { addLogShareInfo: {
url: '/fen/addLog', url: '/fen/addLog',
method: 'POST', method: 'POST',
limit : 500,
showLoading : true,
limit: 500,
showLoading: true,
}, },
/**
* 删除分享记录
*/
/**
* 删除分享记录
*/
deleteLog: { deleteLog: {
url: '/fen/deleteLog', url: '/fen/deleteLog',
method: 'POST', method: 'POST',
auth: true,
limit : 500,
showLoading : true,
auth: true,
limit: 500,
showLoading: true,
}, },
/**
* 增加或者修改个人分享
*/
/**
* 增加或者修改个人分享
*/
saveOrUpdateShare: { saveOrUpdateShare: {
url: '/fen/saveOrUpdateShare', url: '/fen/saveOrUpdateShare',
method: 'POST', method: 'POST',
auth: true,
limit : 500,
showLoading : true,
auth: true,
limit: 500,
showLoading: true,
}, },
/**
* 获取视频分享记录详情
*/
/**
* 获取视频分享记录详情
*/
getVideoShareInfo: { getVideoShareInfo: {
url: '/fen/getVideoShareInfo', url: '/fen/getVideoShareInfo',
method: 'GET', method: 'GET',
debounce: 500, debounce: 500,
}, },
/**
* 增加或者修改视频分享
*/
/**
* 增加或者修改视频分享
*/
saveOrUpdateVideoShare: { saveOrUpdateVideoShare: {
url: '/fen/saveOrUpdateVideoShare', url: '/fen/saveOrUpdateVideoShare',
method: 'POST', method: 'POST',
auth: true,
limit : 500,
showLoading : true,
auth: true,
limit: 500,
showLoading: true,
}, },
/**
* 获取群分享记录详情
*/
/**
* 获取群分享记录详情
*/
getGroupShareInfo: { getGroupShareInfo: {
url: '/fen/getGroupShareInfo', url: '/fen/getGroupShareInfo',
method: 'GET', method: 'GET',
debounce: 500, debounce: 500,
}, },
/**
* 增加或者修改群分享
*/
/**
* 增加或者修改群分享
*/
saveOrUpdateGroupShare: { saveOrUpdateGroupShare: {
url: '/fen/saveOrUpdateGroupShare', url: '/fen/saveOrUpdateGroupShare',
method: 'POST', method: 'POST',
auth: true,
limit : 500,
showLoading : true,
auth: true,
limit: 500,
showLoading: true,
}, },
/**
* 获取文章分享记录详情
*/
/**
* 获取文章分享记录详情
*/
getArticleShareInfo: { getArticleShareInfo: {
url: '/fen/getArticleShareInfo', url: '/fen/getArticleShareInfo',
method: 'GET', method: 'GET',
debounce: 500, debounce: 500,
}, },
/**
* 增加或者修改文章分享
*/
/**
* 增加或者修改文章分享
*/
saveOrUpdateArticleShare: { saveOrUpdateArticleShare: {
url: '/fen/saveOrUpdateArticleShare', url: '/fen/saveOrUpdateArticleShare',
method: 'POST', method: 'POST',
auth: true,
limit : 500,
showLoading : true,
auth: true,
limit: 500,
showLoading: true,
}, },
/**
* 获取分享记录列表带分页
*/
/**
* 获取分享记录列表带分页
*/
getSharePage: { getSharePage: {
url: '/fen/getSharePage', url: '/fen/getSharePage',
method: 'GET', method: 'GET',
auth: true, auth: true,
}, },
/**
* 校验个人转发是否达标
*/
/**
* 校验个人转发是否达标
*/
checkShare: { checkShare: {
url: '/fen/checkShare', url: '/fen/checkShare',
method: 'POST', method: 'POST',
showLoading : true,
showLoading: true,
}, },
/**
* 校验视频转发是否达标
*/
/**
* 校验视频转发是否达标
*/
checkVideoShare: { checkVideoShare: {
url: '/fen/checkVideoShare', url: '/fen/checkVideoShare',
method: 'POST', method: 'POST',
showLoading : true,
showLoading: true,
}, },
/**
* 校验群转发是否达标
*/
/**
* 校验群转发是否达标
*/
checkGroupShare: { checkGroupShare: {
url: '/fen/checkGroupShare', url: '/fen/checkGroupShare',
method: 'POST', method: 'POST',
showLoading : true,
showLoading: true,
}, },
/**
* 校验文章转发是否达标
*/
/**
* 校验文章转发是否达标
*/
checkArticleShare: { checkArticleShare: {
url: '/fen/checkArticleShare', url: '/fen/checkArticleShare',
method: 'POST', method: 'POST',
showLoading : true,
showLoading: true,
},
/**
* 查询当前用户分享审核通过的记录条数
*/
queryShareCount: {
url: '/fen/queryShareCount',
method: 'GET',
showLoading: true,
}, },
} }

+ 84
- 94
components/center/popupActivate.vue View File

@ -1,121 +1,111 @@
<template> <template>
<uv-popup
ref="popup"
:overlayOpacity="0.8"
:customStyle="{
backgroundColor: 'transparent',
}"
>
<view class="flex content">
<template v-if="mode === 'activate'">
<image class="popup-bg" src="@/pages_order/static/center/activate-code.png"></image>
<uv-popup ref="popup" :overlayOpacity="0.8" :customStyle="{
backgroundColor: 'transparent',
}">
<view class="flex content">
<template v-if="mode === 'activate'">
<image class="popup-bg" src="@/pages_order/static/center/activate-code.png"></image>
<view class="flex popup-btns">
<button plain class="btn-simple" @click="close">
<image class="popup-btn" src="@/pages_order/static/center/cancel.png"></image>
</button>
<button plain class="btn-simple" @click="onConfirm">
<image class="popup-btn" src="@/pages_order/static/center/confirm.png"></image>
</button>
</view>
<view class="flex popup-btns">
<button plain class="btn-simple" @click="close">
<image class="popup-btn" src="@/pages_order/static/center/cancel.png"></image>
</button>
<button plain class="btn-simple" @click="onConfirm">
<image class="popup-btn" src="@/pages_order/static/center/confirm.png"></image>
</button>
</view>
<uv-input
v-model="code"
:focus="true"
inputAlign="center"
color="#3DFEE0"
fontSize="45rpx"
border="none"
:customStyle="{
backgroundColor: 'transparent',
width: '250rpx',
height: '63rpx',
position: 'absolute',
top: '216rpx',
left: '160rpx',
}"
></uv-input>
</template>
<template v-else>
<image class="popup-bg" src="@/pages_order/static/center/not-agent.png"></image>
<view class="flex popup-btns">
<button plain class="btn-simple" @click="close">
<image class="popup-btn" src="@/pages_order/static/center/cancel.png"></image>
</button>
<button plain class="btn-simple" @click="mode = 'activate'" >
<image class="popup-btn" src="@/pages_order/static/center/activate.png"></image>
</button>
<uv-input v-model="code" :focus="true" inputAlign="center" color="#3DFEE0" fontSize="45rpx"
border="none" :customStyle="{
backgroundColor: 'transparent',
width: '250rpx',
height: '63rpx',
position: 'absolute',
top: '216rpx',
left: '160rpx',
}"></uv-input>
</template>
<template v-else>
<image class="popup-bg" src="@/pages_order/static/center/not-agent.png"></image>
<view class="flex popup-btns">
<button plain class="btn-simple" @click="close">
<image class="popup-btn" src="@/pages_order/static/center/cancel.png"></image>
</button>
<button plain class="btn-simple" @click="mode = 'activate'">
<image class="popup-btn" src="@/pages_order/static/center/activate.png"></image>
</button>
</view>
</template>
</view> </view>
</template>
</view>
</uv-popup>
</uv-popup>
</template> </template>
<script> <script>
export default {
export default {
props: { props: {
role: {
default: null
}
role: {
default: null
},
}, },
data() {
return {
mode: '',
code: '',
}
data() {
return {
mode: '',
code: '',
}
}, },
methods: { methods: {
open(role) {
this.mode = role ? 'activate' : ''
this.$refs.popup.open();
},
close() {
this.$refs.popup.close();
},
async onConfirm() {
try {
open(role) {
this.mode = role ? 'activate' : ''
this.$refs.popup.open();
},
close() {
this.$refs.popup.close();
},
async onConfirm() {
await this.$fetch('openVip', { code: this.code })
this.$store.commit('getUserInfo')
try {
uni.showToast({
title: '激活成功',
icon: 'none'
})
this.close()
} catch (err) {
await this.$fetch('openVip', { code: this.code })
}
this.$store.commit('getUserInfo')
uni.showToast({
title: '激活成功',
icon: 'none'
})
}
this.close()
} catch (err) {
}
}
}, },
}
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.content { .content {
position: relative;
flex-direction: column;
width: 570rpx;
position: relative;
flex-direction: column;
width: 570rpx;
} }
.popup { .popup {
&-bg {
width: 514rpx; height: 355rpx;
}
&-bg {
width: 514rpx;
height: 355rpx;
}
&-btns {
justify-content: space-between;
margin-top: 56rpx;
width: 100%;
}
&-btns {
justify-content: space-between;
margin-top: 56rpx;
width: 100%;
}
&-btn {
width: 265rpx;
height: 84rpx;
}
&-btn {
width: 265rpx;
height: 84rpx;
}
} }
</style> </style>

+ 3
- 3
config.js View File

@ -8,16 +8,16 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI); Vue.use(uvUI);
// 当前环境 // 当前环境
const type = 'prod'
const type = 'dev'
// 环境配置 // 环境配置
const config = { const config = {
dev : { dev : {
baseUrl : 'http://h5.xzaiyp.top/fission-star-api',
baseUrl : 'http://h5.xzaiyp.top/lbx-api',
}, },
test : { test : {
baseUrl : 'https://fission-star-api.hhlm1688.com/fission-star-api',
baseUrl : 'https://fission-star-api.hhlm1688.com/lbx-api',
}, },
prod : { prod : {
baseUrl : 'https://www.liebianxing.site/lbx-api', baseUrl : 'https://www.liebianxing.site/lbx-api',


+ 22
- 5
pages/index/index.vue View File

@ -13,7 +13,7 @@
</view> </view>
</view> </view>
<popupAuditMsg ref="popupAuditMsgRef" count="15"></popupAuditMsg>
<popupAuditMsg ref="popupAuditMsgRef" :count="count"></popupAuditMsg>
<popupActivate ref="popupActivate"></popupActivate> <popupActivate ref="popupActivate"></popupActivate>
@ -59,6 +59,7 @@
// path: '/pages_order/sharing/video?id=1922875315630133249' // path: '/pages_order/sharing/video?id=1922875315630133249'
// }, // },
], ],
count : 0,
} }
}, },
computed: { computed: {
@ -94,12 +95,21 @@
if (uni.getStorageSync('token') && !this.userInfo?.id) { if (uni.getStorageSync('token') && !this.userInfo?.id) {
this.$store.commit('getUserInfo') this.$store.commit('getUserInfo')
this.queryShareCount()
} }
}, },
onShow() { onShow() {
this.getMsg()
}, },
methods: { methods: {
queryShareCount(){
this.$fetch('queryShareCount')
.then(result => {
if(result > 0){
this.count = result
this.$refs.popupAuditMsgRef.open()
}
})
},
onClick(url) { onClick(url) {
if (!uni.getStorageSync('token')) { if (!uni.getStorageSync('token')) {
uni.navigateTo({ uni.navigateTo({
@ -112,11 +122,18 @@
this.$refs.popupActivate.open() this.$refs.popupActivate.open()
return return
} }
if(this.$dayjs(this.userInfo.endTime).isBefore(this.$dayjs())){
uni.showToast({
title: '代理已过期',
icon: 'none'
})
this.$refs.popupActivate.open(true)
return
}
this.$utils.navigateTo(url) this.$utils.navigateTo(url)
}, },
getMsg(){
this.$refs.popupAuditMsgRef.open()
},
}, },
} }
</script> </script>


Loading…
Cancel
Save