Browse Source

feat: 添加激励视频记录功能并扩展评论类型

- 在rewardedVideoAd混入中添加激励视频记录配置
- 扩展评论和记录接口的类型注释(新增9群聊和10抽奖类型)
- 在各页面组件中设置激励视频记录类型和目标ID
- 重构productList组件,添加商品编辑和删除功能
- 更新浏览记录接口注释使其更准确
master
前端-胡立永 3 days ago
parent
commit
3a0df0487e
8 changed files with 194 additions and 59 deletions
  1. +3
    -3
      api/model/browseRecord.js
  2. +1
    -1
      api/model/comment.js
  3. +3
    -0
      components/user/callPhone.vue
  4. +166
    -54
      components/user/productList.vue
  5. +11
    -0
      mixins/rewardedVideoAd.js
  6. +5
    -1
      pages_order/gourmet/gourmetDetail.vue
  7. +3
    -0
      pages_order/group/groupDetail.vue
  8. +2
    -0
      pages_order/marketing/turntable.vue

+ 3
- 3
api/model/browseRecord.js View File

@ -1,7 +1,7 @@
// 评论相关接口
// 记录相关接口
const api = { const api = {
//发布评论
//添加记录 category 分类 0浏览 1点赞 2转发 3激励视频
addBrowseRecord: { addBrowseRecord: {
url: '/city/browseRecord/addBrowseRecord', url: '/city/browseRecord/addBrowseRecord',
method: 'POST', method: 'POST',
@ -9,7 +9,7 @@ const api = {
auth : true, auth : true,
showLoading : true, showLoading : true,
}, },
//获取评论列表type-0帖子-1租房-2工作-3景点-4美食-5活动-6人找车-7车找人-8文章
//获取记录列表type-0帖子-1租房-2工作-3景点-4美食-5活动-6人找车-7车找人-8文章
getBrowseRecordPage: { getBrowseRecordPage: {
url: '/city/browseRecord/getBrowseRecordPage', url: '/city/browseRecord/getBrowseRecordPage',
method: 'GET', method: 'GET',


+ 1
- 1
api/model/comment.js View File

@ -15,7 +15,7 @@ const api = {
auth : true, auth : true,
showLoading : true, showLoading : true,
}, },
//获取评论列表type-0帖子-1租房-2工作-3景点-4美食-5活动-6人找车-7车找人-8文章
//获取评论列表type-0帖子-1租房-2工作-3景点-4美食-5活动-6人找车-7车找人-8文章-9群聊-10抽奖
getCommentPage: { getCommentPage: {
url: '/city/getCommentPage', url: '/city/getCommentPage',
method: 'GET', method: 'GET',


+ 3
- 0
components/user/callPhone.vue View File

@ -43,6 +43,9 @@
type : this.type, type : this.type,
id : this.pid id : this.pid
} }
this.rewardedRecordConfig.type = this.type //
this.rewardedRecordConfig.formId = this.pid //
console.log(data); console.log(data);


+ 166
- 54
components/user/productList.vue View File

@ -1,66 +1,97 @@
<template> <template>
<view class="list">
<view class="item"
v-for="(item, index) in productList"
@click="$utils.navigateTo(`/pages_order/product/productDetail?id=${item.id}&pay=${pay}`)"
:key="index">
<image
class="image"
:src="item.image ? item.image.split(',')[0] : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg'" mode="aspectFill"></image>
<view class="info">
<view class="title text-ellipsis">
{{ item.name }}
</view>
<!-- <view class="price">
<text>{{ item.originalPrice }}</text>/
</view>
<view class="favorable" v-if="item.goodsSku">
<view class="t">
限时优惠
<view class="product-list-container">
<view class="list">
<view class="item"
v-for="(item, index) in productList"
@click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id + '&pay=' + pay)"
:key="index">
<image
class="image"
:src="item.image ? item.image.split(',')[0] : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg'" mode="aspectFill"></image>
<view class="info">
<view class="title text-ellipsis">
{{ item.name }}
</view> </view>
<view class="p">
{{ item.goodsSku.price }}
<!-- <view class="price">
<text>{{ item.originalPrice }}</text>/
</view> </view>
</view> -->
<view class="price"
v-if="isProductPrice(item)">
现价<text>{{ item.price }}</text>
</view>
<view class="del"
v-if="isProductPrice(item)">
原价{{ item.oldPrice }}
</view>
<!-- <view class="favorable" v-if="item.oldPrice">
<view class="t">
原价
<view class="favorable" v-if="item.goodsSku">
<view class="t">
限时优惠
</view>
<view class="p">
{{ item.goodsSku.price }}
</view>
</view> -->
<view class="price"
v-if="isProductPrice(item)">
现价<text>{{ item.price }}</text>
</view>
<view class="del"
v-if="isProductPrice(item)">
原价{{ item.oldPrice }}
</view> </view>
<view class="p">
{{ item.oldPrice }}
<!-- <view class="favorable" v-if="item.oldPrice">
<view class="t">
原价
</view>
<view class="p">
{{ item.oldPrice }}
</view>
</view> -->
<view class="favorable"
v-if="item.points
&& isProductPoint(item)">
<view class="t">
积分兑换
</view>
<view class="p">
{{ item.points }}
</view>
</view> </view>
</view> -->
<view class="favorable"
v-if="item.points
&& isProductPoint(item)">
<view class="t">
积分兑换
<view class="num">
{{ item.shopId }}
</view> </view>
<view class="p">
{{ item.points }}
<!-- 编辑和删除按钮 -->
<view class="edit-actions" v-if="edit">
<uv-icon
name="edit-pen-fill"
size="40rpx"
@click.stop="toEdit(item)"
color="#5baaff"
/>
<uv-icon
name="trash-fill"
size="40rpx"
@click.stop="del(item)"
color="#5baaff"
/>
</view> </view>
<!-- <view class="num">
已售卖{{ item.soldNum || 0 }}+
</view> -->
</view> </view>
<view class="num">
{{ item.shopId }}
<view class="btn">
<uv-icon name="shopping-cart"
color="#fff"></uv-icon>
</view> </view>
<!-- <view class="num">
已售卖{{ item.soldNum || 0 }}+
</view> -->
</view> </view>
<view class="btn">
<uv-icon name="shopping-cart"
color="#fff"></uv-icon>
</view>
<!-- 添加商品按钮 -->
<view class="createDetail"
v-if="edit">
<view
@click="$utils.navigateTo('/pages_order/product/addProduct?shopId=' + shopId)">
<uv-icon
size="40rpx"
color="#fff"
name="plus"></uv-icon>
</view> </view>
</view> </view>
</view> </view>
@ -71,19 +102,66 @@
export default { export default {
mixins : [productMixins], mixins : [productMixins],
name:"productList", name:"productList",
props : ['productList', 'pay'],
props : {
productList: {
type: Array,
default: function() {
return []
}
},
pay: {
type: String,
default: ''
},
edit: {
type: Boolean,
default: false
},
shopId: {
type: [String, Number],
default: ''
}
},
data() { data() {
return { return {
}; };
}, },
methods : { methods : {
//
toEdit: function(item){
this.$utils.navigateTo('/pages_order/product/addProduct?id=' + item.id)
},
//
del: function(item){
var self = this;
uni.showModal({
title: '您确认要下架吗?',
content: '您正在下架 ' + item.name,
success : function(res) {
if(res.confirm){
self.$api('orderUpdate', {
id : item.id,
isOpen : 'N',
}, function(res) {
if(res.code == 200){
self.$emit('getData')
}
})
}
}
})
},
}, },
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.product-list-container {
position: relative;
}
.list{ .list{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -146,6 +224,16 @@
font-size: 22rpx; font-size: 22rpx;
color: #888; color: #888;
} }
.edit-actions{
display: flex;
margin-top: 10rpx;
justify-content: flex-start;
/deep/ .uv-icon {
margin-right: 20rpx;
}
}
} }
.btn{ .btn{
position: absolute; position: absolute;
@ -157,4 +245,28 @@
} }
} }
} }
.createDetail {
position: fixed;
top: 60vh;
right: 50rpx;
z-index: 999;
button{
all : unset;
}
button::after{
all : unset;
}
& > view{
width: 100rpx;
height: 100rpx;
background-color: $uni-color;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 0 10rpx 10rpx rgba(0, 0, 0, 0.1);
margin-bottom: 30rpx;
}
}
</style> </style>

+ 11
- 0
mixins/rewardedVideoAd.js View File

@ -5,6 +5,11 @@
export default { export default {
data() { data() {
return { return {
rewardedRecordConfig: {
category: 3, // 分类 3激励视频
type: 0, // 类型 0帖子-1租房-2工作-3景点-4美食-5活动-6人找车-7车找人-8文章-9群聊-10抽奖
formId: '', // 目标对象ID
},
// 视频广告相关 // 视频广告相关
rewardedVideoAd: null, // 激励视频广告实例 rewardedVideoAd: null, // 激励视频广告实例
isAdLoaded: false, // 广告是否已加载 isAdLoaded: false, // 广告是否已加载
@ -60,6 +65,7 @@ export default {
} else if (this.onAdWatchComplete && typeof this.onAdWatchComplete === 'function') { } else if (this.onAdWatchComplete && typeof this.onAdWatchComplete === 'function') {
this.onAdWatchComplete() this.onAdWatchComplete()
} }
} else { } else {
// 用户中途关闭了广告 // 用户中途关闭了广告
console.log('用户中途关闭广告') console.log('用户中途关闭广告')
@ -76,6 +82,11 @@ export default {
}) })
} }
} }
this.$api('addBrowseRecord', {
...this.rewardedRecordConfig,
complete: (res && res.isEnded) ? 'Y' : 'N'
})
// 清理临时回调方法 // 清理临时回调方法
this.tempOnAdWatchComplete = null this.tempOnAdWatchComplete = null


+ 5
- 1
pages_order/gourmet/gourmetDetail.vue View File

@ -64,7 +64,11 @@
:list="list"/> :list="list"/>
<view v-else style="padding: 0 20rpx;"> <view v-else style="padding: 0 20rpx;">
<productList :productList="list" :pay="detail.pay"/>
<productList
:productList="list"
@getData="getData"
:edit="detail.shopUser == userInfo.id"
:pay="detail.pay"/>
</view> </view>
</view> </view>


+ 3
- 0
pages_order/group/groupDetail.vue View File

@ -103,6 +103,9 @@
// //
this.share.path = '/pages_order/group/groupDetail?id=' + options.id this.share.path = '/pages_order/group/groupDetail?id=' + options.id
this.rewardedRecordConfig.type = 9 // 9
this.rewardedRecordConfig.formId = this.groupId // ID
}, },
methods: { methods: {
// 广 // 广


+ 2
- 0
pages_order/marketing/turntable.vue View File

@ -148,6 +148,8 @@
onLoad() { onLoad() {
this.getLuckDrawList() this.getLuckDrawList()
// initRewardedVideoAd() mounted // initRewardedVideoAd() mounted
this.rewardedRecordConfig.type = 10 // 10
}, },
onShow() { onShow() {
// //


Loading…
Cancel
Save