Commit b0dbc48e by zhangxw

bug修改

1 parent 6cbaa5b2
......@@ -37,10 +37,17 @@ class ActivityApi {
...data
})
}
// 申请活动
applyActivity(data) {
// 获取申请活动已开通场景
getOpenSceneList(data) {
return api.post({
method: `${path}.service.activity.apply`,
method: 'scrm.api.busassistant.activity.findOpenScene',
...data
})
}
// 获取申请活动可开通的产品
getNotOpenProductsList(data) {
return api.post({
method: 'scrm.api.busassistant.activity.findNotOpenProducts',
...data
})
}
......@@ -66,12 +73,6 @@ class ActivityApi {
...data
})
}
getActivityVisitorList(data) {
return api.post({
method: `scrm.api.stoassistant.user.activity.visitor.list`,
...data
})
}
}
export default ActivityApi
\ No newline at end of file
......@@ -34,5 +34,12 @@ module.exports = {
operationDate: new Date().format('yyyy-MM-dd hh:mm:ss'),
})
},
// 任务分享埋点
taskShareReport(data) {
return api.post({
method: 'entmicro.api.customercollect.reportCustomerList',
...data
})
}
}
/* packageActivity/pages/shareTaskDetail/shareTaskDetail.wxss */
.share-box{
background: #FFFFFF;
box-shadow: 0 8rpx 24rpx 0 rgba(106,126,204,0.12);
position: relative;
margin-bottom: 30rpx;
.bg{
width: 100%;
height: 176rpx;
......@@ -104,7 +104,16 @@
}
.type-text{
font-size: 24rpx;
color: #9299AD;
color: #9299AD;
margin-top: 10rpx;
}
}
}
.copyWriting{
margin-left: 20rpx;
font-weight: 400;
font-size: 24rpx;
color: #7A8299;
line-height: 40rpx;
margin-bottom: 24rpx;
}
\ No newline at end of file
......@@ -5,16 +5,7 @@
}
module.exports.indexOf = indexOf
</wxs>
<view wx:if="{{fn.indexOf(materialTypeArr, 4)}}">
<view class="link-share" bind:tap="goShareLink" data-url="{{detailInfo.linkUrl}}">
<image src="{{detailInfo.activityImage ? detailInfo.activityImage : IMGURL+'share_task_default_img.png'}}"></image>
<view class="right">
<view>{{detailInfo.activityName}}</view>
<view class="type-text">{{activityTypList[0]}}活动</view>
</view>
</view>
</view>
<view class="share-box" wx:if="{{!fn.indexOf(materialTypeArr, 4)}}">
<view class="share-box">
<image class="bg" webp src="{{IMGURL}}taskDetail_bg.png"></image>
<view class="user-box">
<image webp src="{{detailInfo.weChatAvatarUrl ? detailInfo.weChatAvatarUrl : IMGURL + 'order_person_default.png'}}"></image>
......@@ -23,7 +14,7 @@
<view class="activity">{{detailInfo.merchantName || ""}}{{detailInfo.activityName || ""}}<text>{{activityTypList[0]}}</text></view>
</view>
</view>
<view class="content">
<view class="content" wx:if="{{!fn.indexOf(materialTypeArr, 4)}}">
<view class="text-box">
<text>{{detailInfo.textContent}}</text>
</view>
......@@ -40,3 +31,13 @@
</view>
</view>
</view>
<view wx:if="{{fn.indexOf(materialTypeArr, 4)}}">
<view class="copyWriting">将链接转发给好友或发送朋友圈可提高活动曝光度</view>
<view class="link-share" bind:tap="goShareLink" data-url="{{detailInfo.linkUrl}}">
<image src="{{detailInfo.activityImage ? detailInfo.activityImage : IMGURL+'share_task_default_img.png'}}"></image>
<view class="right">
<view>{{detailInfo.activityName}}</view>
<view class="type-text">{{activityTypList[0]}}活动</view>
</view>
</view>
</view>
// packageActivity/pages/taskDetail/taskDetail.js
import index_const from "~/pages/tab/index/index_const"
import ActivityApi from '~/api/activityApi/index'
import {
domain
} from '~/utils/request/http'
Page({
/**
......@@ -35,13 +38,34 @@ Page({
})
},
filterJumpUrl(id) {
const userStorage = wx.$storage.get('userInfo')
return `${domain}/scrm-wx-merchant-activity/#/?id=${id}&merchantId=${userStorage.merchantId}&shareStaffUuid=${userStorage.uuid}&shareStaffName=${this.toUnicode(userStorage.name)}&isExclusive=1&exclusiveUuid=${userStorage.uuid}&shareStaffType=2&sharedTime=${Date.now()}`
},
toUnicode (chineseStr = '') {
let unicodeStr = ''
for (let i = 0, iLength = chineseStr.length; i < iLength; i++) {
unicodeStr += '@' + chineseStr.charCodeAt(i).toString(16)
}
return unicodeStr
},
// 获取任务详情
getActiveTaskDetail(missionId) {
ActivityApi.getActiveTaskDetail({missionId: missionId}).then(res => {
res.imgUrlList = []
// missonType 任务类型1注册 2分享 3浏览 4访客 5下单
if (res.missonType != 2) { // 非分享任务 显示活动专属链接
res.linkUrl = this.filterJumpUrl(res.activityId)
wx.hideShareMenu({
menus: ['shareAppMessage'],
})
}
let typeArr = []
res.platformMerchantMissionMaterialResponseList && res.platformMerchantMissionMaterialResponseList.forEach(val => {
typeArr.push(val.materialType)
// materialType 素材类型1文案 2图片 3视频 4专属链接
if (val.materialType == 1) { // 文案
res.textContent = val.materialContent
}
......@@ -55,6 +79,8 @@ Page({
res.linkUrl = val.materialContent
}
})
// 分享埋点上报
// this.shareTrackData = { item_id: res.activityId }
this.setData({
detailInfo: res,
materialTypeArr: typeArr
......@@ -103,9 +129,10 @@ Page({
// 复制链接
copyUrl(e) {
let { linkUrl } = this.data.detailInfo
let { linkUrl, activityName } = this.data.detailInfo
const userStorage = wx.$storage.get('userInfo')
wx.setClipboardData({
data: linkUrl,
data: `${userStorage.name || ''}邀请你参加${userStorage.merchantName || ''}${activityName || ""} ${linkUrl}`,
success (res) {
wx.showToast({
title: '活动链接已复制,请打开企微进行转发',
......
......@@ -36,6 +36,7 @@
.type-text{
font-size: 24rpx;
color: #9299AD;
margin-top: 10rpx;
}
}
}
......@@ -88,6 +89,7 @@
box-shadow: 0 8rpx 24rpx 0 rgba(106,126,204,0.12);
border-radius: 32rpx;
position: relative;
margin-bottom: 30rpx;
.bg{
width: 100%;
height: 176rpx;
......
......@@ -20,18 +20,9 @@
<view>+{{detailInfo.gainScore}}积分</view>
</view>
</view>
<!-- 分享内容 -->
<view class="title">分享内容</view>
<view wx:if="{{fn.indexOf(materialTypeArr, 4)}}">
<view class="copyWriting" >将链接转发给好友或发送朋友圈可提高活动曝光度</view>
<view class="link-share" bind:tap="goShareLink" data-url="{{detailInfo.linkUrl}}">
<image src="{{detailInfo.activityImage ? detailInfo.activityImage : IMGURL+'share_task_default_img.png'}}"></image>
<view class="right">
<view>{{detailInfo.activityName}}</view>
<view class="type-text">{{activityTypList[0]}}活动</view>
</view>
</view>
</view>
<view class="share-box" wx:if="{{!fn.indexOf(materialTypeArr, 4)}}">
<view class="share-box" wx:if="{{detailInfo.missonType == 2}}">
<image class="bg" webp src="{{IMGURL}}taskDetail_bg.png"></image>
<view class="user-box">
<image webp src="{{userStorage.weChatAvatarUrl ? userStorage.weChatAvatarUrl : IMGURL + 'order_person_default.png'}}"></image>
......@@ -40,7 +31,7 @@
<view class="activity">{{userStorage.merchantName || ""}}{{detailInfo.activityName || ""}}<text>{{activityTypList[0]}}</text></view>
</view>
</view>
<view class="content" wx:if="{{detailInfo.platformMerchantMissionMaterialResponseList.length}}">
<view class="content" wx:if="{{!fn.indexOf(materialTypeArr, 4)}}">
<view class="text-box">
<text>{{detailInfo.textContent}}</text>
</view>
......@@ -57,14 +48,25 @@
</view>
</view>
</view>
<!-- 专属链接 -->
<view wx:if="{{detailInfo.missonType != 2 || fn.indexOf(materialTypeArr, 4)}}">
<view class="copyWriting">将链接转发给好友或发送朋友圈可提高活动曝光度</view>
<view class="link-share" bind:tap="goShareLink" data-url="{{detailInfo.linkUrl}}">
<image src="{{detailInfo.activityImage ? detailInfo.activityImage : IMGURL+'share_task_default_img.png'}}"></image>
<view class="right">
<view>{{detailInfo.activityName}}</view>
<view class="type-text">{{activityTypList[0]}}活动</view>
</view>
</view>
</view>
<view class="btn-box">
<view class="btn" wx:if="{{fn.indexOf(materialTypeArr, 1)}}" bind:tap="copyText">复制文案</view>
<view class="btn" wx:if="{{fn.indexOf(materialTypeArr, 4)}}" bind:tap="copyUrl">复制链接</view>
<view class="btn" wx:if="{{detailInfo.missonType != 2 || fn.indexOf(materialTypeArr, 4)}}" bind:tap="copyUrl">复制链接</view>
<view class="btn" bind:tap="saveWith" wx:if="{{fn.indexOf(materialTypeArr, 2) || fn.indexOf(materialTypeArr, 3)}}">
<text>一键保存图片</text>
<van-loading wx:if="{{isloading}}" size="30rpx" style="margin-left: 20rpx;" type="spinner" />
</view>
<!-- <view class="btn primary" bind:tap="share">分享</view> -->
<button class="btn primary" open-type="share">分享</button>
<button class="btn primary" wx:if="{{detailInfo.missonType == 2}}" open-type="share">分享</button>
</view>
</view>
......@@ -20,6 +20,12 @@ Component({
},
nothing: {
type: Boolean
},
activeDateIndex: {
type: Number
},
allTaskCount: {
type: Number
}
},
......@@ -61,17 +67,18 @@ Component({
val.newtaskCalenderList = this.calenderFilter(JSON.parse(JSON.stringify(val.missionList)) || [], 7)
let d = new Date()
let nowDate = (d.getMonth() + 1).toString().padStart(2, "0") + "月" + d.getDate().toString().padStart(2, "0") + "日"
let ind = 0
let ind = 0 // 下标值
let allTaskCount = 0 // 任务总数
val.calenderActiveIndex = 0
val.newtaskCalenderList.forEach((v, index) => {
v.forEach(k => {
allTaskCount+=k.platformMerchantMissionResponseList.length
k.time = (new Date(k.activityTime).getMonth() + 1).toString().padStart(2, "0") + "月" + new Date(k.activityTime).getDate().toString().padStart(2, "0") + "日"
k.ind = ind
if (d.getTime() > new Date(`${k.activityTime} 23:59:59`).getTime()) k.status = 2
if (nowDate == k.time) {
val.calenderActiveIndex = index
this.setData({activeDateIndex: ind})
} else {
val.calenderActiveIndex = 0
this.setData({activeDateIndex : ind})
}
ind++
})
......@@ -79,10 +86,29 @@ Component({
val.isCollapse = false
let itemVal = 'activeList['+idx+']'
this.setData({
[itemVal]: val
[itemVal]: val,
allTaskCount
})
})
} else if (flag && val.missionList) { // 已请求数据 展开默认选中当天
val.newtaskCalenderList = this.calenderFilter(JSON.parse(JSON.stringify(val.missionList)) || [], 7)
let d = new Date()
let nowDate = (d.getMonth() + 1).toString().padStart(2, "0") + "月" + d.getDate().toString().padStart(2, "0") + "日"
let ind = 0 // 下标值
val.calenderActiveIndex = 0
val.newtaskCalenderList.forEach((v, index) => {
v.forEach(k => {
k.time = (new Date(k.activityTime).getMonth() + 1).toString().padStart(2, "0") + "月" + new Date(k.activityTime).getDate().toString().padStart(2, "0") + "日"
k.ind = ind
if (d.getTime() > new Date(`${k.activityTime} 23:59:59`).getTime()) k.status = 2
if (nowDate == k.time) {
val.calenderActiveIndex = index
this.setData({activeDateIndex : ind})
}
ind++
})
console.log(itemVal)
})
val.isCollapse = false
} else {
val.isCollapse = !flag
}
......@@ -112,16 +138,17 @@ Component({
return unicodeStr
},
filterJumpUrl(id, num) {
filterJumpUrl(item, num) {
console.log(item)
const userStorage = wx.$storage.get('userInfo')
return num == 2 ? `${domain}/scrm-wx-merchant-activity/#/?id=${id}&merchantId=${userStorage.merchantId}&shareStaffUuid=${userStorage.uuid}&shareStaffName=${this.toUnicode(userStorage.name)}&shareStaffType=2&sharedTime=${Date.now()}` : `${domain}/scrm-wx-merchant-activity/#/?id=${id}&merchantId=${userStorage.merchantId}&shareStaffUuid=${userStorage.uuid}&shareStaffName=${this.toUnicode(userStorage.name)}&isExclusive=1&exclusiveUuid=${userStorage.uuid}&shareStaffType=2&sharedTime=${Date.now()}`
return num == 2 ? `${domain}/scrm-wx-merchant-activity/#/?id=${item.id}&merchantId=${userStorage.merchantId}&shareStaffUuid=${userStorage.uuid}&shareStaffName=${this.toUnicode(userStorage.name)}&shareStaffType=2&sharedTime=${Date.now()}` : `${userStorage.name || ''}邀请你参加${userStorage.merchantName || ''}${item.activityName || ""}${domain}/scrm-wx-merchant-activity/#/?id=${item.id}&merchantId=${userStorage.merchantId}&shareStaffUuid=${userStorage.uuid}&shareStaffName=${this.toUnicode(userStorage.name)}&isExclusive=1&exclusiveUuid=${userStorage.uuid}&shareStaffType=2&sharedTime=${Date.now()}`
},
// 分享活动(复制链接)
copyActivityUrl(e) {
let { id } = e.currentTarget.dataset
let { item } = e.currentTarget.dataset
wx.setClipboardData({
data: this.filterJumpUrl(id, 1),
data: this.filterJumpUrl(item, 1),
success (res) {
wx.showToast({
title: '复制成功',
......@@ -132,8 +159,8 @@ Component({
},
// 活动详情
goToDetail(e) {
let { id } = e.currentTarget.dataset
let h5Url = this.filterJumpUrl(id, 2)
let { item } = e.currentTarget.dataset
let h5Url = this.filterJumpUrl(item, 2)
console.log(h5Url)
wx.$router.jumpH5(h5Url)
},
......
......@@ -14,7 +14,7 @@
<!-- 活动操作按钮 -->
<view class="active-btn">
<view class="btn" bind:tap="jump" data-item="{{item}}">活动战报</view>
<view class="btn" bind:tap="copyActivityUrl" data-id="{{item.id}}">分享活动</view>
<view class="btn" bind:tap="copyActivityUrl" data-item="{{item}}">分享活动</view>
<view class="btn primary" bind:tap="goToDetail" data-id="{{item.id}}">查看详情</view>
</view>
<!-- 活动概览 -->
......@@ -22,7 +22,7 @@
<!-- 任务日历 -->
<view class="task-box {{item.isCollapse ? 'hidden' : ''}}">
<view class="box-content">
<activity-calender data="{{item}}" activeDateIndex="{{activeDateIndex}}" isCollapse="{{item.isCollapse}}"></activity-calender>
<activity-calender data="{{item}}" activeDateIndex="{{activeDateIndex}}" allTaskCount="{{allTaskCount}}" isCollapse="{{item.isCollapse}}"></activity-calender>
</view>
</view>
<!-- 展开/收起 -->
......
......@@ -22,8 +22,10 @@ Component({
},
// 默认选中日期(今天)
activeDateIndex: {
type: Number,
value: 0
type: Number
},
allTaskCount: {
type: Number
}
},
......
......@@ -38,6 +38,9 @@
color: #1B233D;
}
}
.active{
background-image: linear-gradient(180deg, #FFF7DB 15%, #FFF1E0 87%);
}
.completed{
background-image: linear-gradient(180deg, #FFD84B 28%, #FFB33E 76%);
.task-time{
......
......@@ -2,13 +2,13 @@
<wxs src="../index.wxs" module="fn"></wxs>
<block wx:if="{{!isCollapse}}">
<view class="title">任务日历<text> · {{data.missionList.length}}</text></view>
<view class="title">任务日历<text> · {{allTaskCount}}</text></view>
<view wx:if="{{data.newtaskCalenderList.length}}" class="calender-box {{data.newtaskCalenderList.length > 1 ? 'p-b-54' : ''}}">
<swiper class="swiper" current="{{data.calenderActiveIndex}}" bindchange="changeTaskCalender" data-index="{{index}}">
<block wx:for="{{data.newtaskCalenderList}}" wx:for-item="val" wx:for-index="k" wx:key="k">
<swiper-item class='swiper_item'>
<block wx:for="{{val}}" wx:for-item="v" wx:for-index="j" wx:key="j">
<view class="time-box {{v.status == 2 ? 'completed' : ''}}" bind:tap="changeDate" data-dateindex="{{v.ind}}">
<view class="time-box {{v.status == 2 ? 'completed' : (activeDateIndex == v.ind ? 'active' : '')}}" bind:tap="changeDate" data-dateindex="{{v.ind}}">
<image webp src="{{IMGURL}}{{v.status == 2 ? 'task_completed.png' : 'calender_integral_icon.png'}}"></image>
<view class="task-time">{{v.status == 2 ? '已完成' : v.time}}</view>
</view>
......
......@@ -18,7 +18,8 @@ Page({
],
tabIndex: 0,
activeList: [],
activityEndList: []
activityEndList: [],
allTaskCount: 0
},
onPageScroll({
......@@ -52,6 +53,7 @@ Page({
},
getData(onPullDown) {
wx.showLoading()
this.getActivityList(1, onPullDown)
this.getActivityList(2, onPullDown)
},
......@@ -68,25 +70,27 @@ Page({
val.startTime = val.startTime.split(' ')[0]
val.endTime = val.endTime.split(' ')[0]
val.tabIndex = num - 1
if (num == 1 && activePageNum == 1 && index == 0) { // 活动中默认展开第一条
if (num == 1 && activePageNum == 1 && index == 0) { // 活动中默认展开第一条 数据处理
val.isloading = true
ActivityApi.getActiveTaskList({activityId: val.id}).then(res => {
wx.hideLoading()
val.isloading = false
val.missionList = res
val.newtaskCalenderList = this.calenderFilter(JSON.parse(JSON.stringify(val.missionList)) || [], 7)
let d = new Date()
let nowDate = (d.getMonth() + 1).toString().padStart(2, "0") + "月" + d.getDate().toString().padStart(2, "0") + "日"
let ind = 0
val.calenderActiveIndex = 0
let allTaskCount = 0
val.newtaskCalenderList.forEach((v, index) => {
v.forEach(k => {
allTaskCount += k.platformMerchantMissionResponseList.length
k.time = (new Date(k.activityTime).getMonth() + 1).toString().padStart(2, "0") + "月" + new Date(k.activityTime).getDate().toString().padStart(2, "0") + "日"
k.ind = ind
if (d.getTime() > new Date(`${k.activityTime} 23:59:59`).getTime()) k.status = 2
if (nowDate == k.time) {
val.calenderActiveIndex = index
this.setData({activeDateIndex: ind})
} else {
val.calenderActiveIndex = 0
}
ind++
})
......@@ -94,12 +98,14 @@ Page({
val.isCollapse = false
let itemVal = 'activeList['+index+']'
this.setData({
[itemVal]: val
[itemVal]: val,
allTaskCount
})
})
}
if (num == 2 && pageNum == 1 && index == 0) { // 活动诊断展开第一条
ActivityApi.getActivityEndInstallOrderList({activityId: val.id}).then(res => {
wx.hideLoading()
val.isCollapse = false
res.orderList && res.orderList.forEach(it => {
it.time = new Date(it.payDate).format('yyyy-MM-dd hh:mm:ss')
......
......@@ -24,7 +24,7 @@
<!-- 活动中 -->
<view class="active-content" hidden="{{tabIndex != 0}}">
<block>
<active-box activeList="{{activeList}}" nothing="{{nothing}}"></active-box>
<active-box activeList="{{activeList}}" nothing="{{nothing}}" activeDateIndex="{{activeDateIndex}}" allTaskCount="{{allTaskCount}}"></active-box>
</block>
</view>
<!-- 活动诊断 -->
......
......@@ -9,9 +9,9 @@
* @param {*} onViewTrack 开启浏览埋点
* @returns
*/
// import {
// reportData
// } from '~/api/index.js'
import {
taskShareReport
} from '~/api/api.js'
// import USERAPI from '~/api/usersApi/index'
class Share {
......@@ -54,8 +54,8 @@ class Share {
if (shareQuery) path += `?${shareQuery}`
if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}`
if (shareFun) shareFun()
// if (shareTrackData) that.reportShareData(shareTrackData)
if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
console.log('::', path)
return {
path,
......@@ -87,10 +87,8 @@ class Share {
}
getCommonData() {
const WXUSERINFO = wx.$storage.get('wx_user_info'),
USERINFO = wx.$storage.get('userInfo')
const USERINFO = wx.$storage.get('userInfo')
return {
WXUSERINFO,
USERINFO
}
}
......@@ -105,21 +103,21 @@ class Share {
}
reportShareData(shareTrackData) {
const {
WXUSERINFO,
USERINFO
} = this.getCommonData(),
thisPage = wx.$router.getPageInstance()
reportData({
openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '',
phone: USERINFO.phone || '',
merchantId: thisPage.merchantId || USERINFO.merchantId || '',
shareOpenId: thisPage.shareOpenId || WXUSERINFO.openId || '',
sharePhone: thisPage.sharePhone || USERINFO.phone || '',
thisPage = wx.$router.getPageInstance()
let data = {
action_type: 4, // 事件类型固定为4-分享
item_type: 3, // 商品类型,固定为3-众筹活动
merchant_id: USERINFO.merchantId, // 门店号
staff_uuid: USERINFO.uuid,
business_type: 1, // 业务类型,固定为1
add_way: 104, // 来源,固定为104
create_time: new Date().format("yyyy-MM-dd hh:mm:ss"), // 分享时间
...shareTrackData
})
}
let jsonList = JSON.stringify(data)
taskShareReport({jsonList})
}
}
new Share()
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!