Commit 2e5c36db by zhangxw

bug修改

1 parent 9e8843a2
......@@ -6,14 +6,14 @@ class ActivityApi {
return api.post({
method: `scrm.api.assistant.activity.page`,
...data
})
}, false, true)
}
// 获取活动中任务内容
getActiveTaskList(data) {
return api.post({
method: `stoassistant.api.mission.findStaffMissionList`,
...data
})
}, false, true)
}
// 获取单个任务详情内容
getActiveTaskDetail(data) {
......@@ -35,19 +35,19 @@ class ActivityApi {
return api.post({
method: `${path}.service.activity.detail.old`,
...data
})
}, false, true)
}
// 获取申请活动已开通场景
getOpenSceneList(data) {
return api.post({
method: 'scrm.api.busassistant.activity.findOpenScene',
method: 'scrm.api.busassistant.activity.SceneOpenStatus.stoAss',
...data
})
}
// 获取申请活动可开通的产品
getNotOpenProductsList(data) {
return api.post({
method: 'scrm.api.busassistant.activity.findNotOpenProducts',
method: 'scrm.api.busassistant.activity.productOpenStatus.stoAss',
...data
})
}
......
......@@ -80,7 +80,7 @@ Page({
}
})
// 分享埋点上报
// this.shareTrackData = { item_id: res.activityId }
this.shareTrackData = { item_id: res.activityId }
this.setData({
detailInfo: res,
materialTypeArr: typeArr
......@@ -132,7 +132,7 @@ Page({
let { linkUrl, activityName } = this.data.detailInfo
const userStorage = wx.$storage.get('userInfo')
wx.setClipboardData({
data: `${userStorage.name || ''}邀请你参加${userStorage.merchantName || ''}${activityName || ""} ${linkUrl}`,
data: `${userStorage.name || ''}邀请你参加${activityName || ""} ${linkUrl}`,
success (res) {
wx.showToast({
title: '活动链接已复制,请打开企微进行转发',
......
......@@ -42,7 +42,6 @@
}
.task-box{
width: 100%;
height: 72px;
background: #FFFFFF;
border-radius: 10px;
padding: 32rpx;
......@@ -51,12 +50,13 @@
margin-bottom: 40rpx;
justify-content: space-between;
image{
flex-shrink: 0;
width: 80rpx;
height: 80rpx;
margin-right: 20rpx;
}
.left{
flex: 0 0 75%;
flex: 0 0 70%;
display: flex;
font-size: 22rpx;
color: #9299AD;
......
// packageActivity/pages/visitor/visitor.js
import ActivityApi from '~/api/activityApi/index'
import index_const from "~/pages/tab/index/index_const"
import { commentTime } from '~/utils/format'
Page({
/**
......@@ -20,12 +21,13 @@ Page({
},
onRoute(options) {
console.log(options)
let activityId = options.id
console.log(activityId)
ActivityApi.getActivityVisitorList({
activityId
}).then(res => {
res.visitorList && res.visitorList.forEach(val => {
val.lastVisitFormatTime = commentTime(val.lastVisitDate)
})
this.setData({
allNum: res.visitorTotal,
todayNum: res.todayTotal,
......
......@@ -34,7 +34,7 @@
</view>
<view class="footprint">
<text>浏览 {{item.visitCount}} 次</text>
<text>{{item.lastVisitTime}} 访问过</text>
<text>{{item.lastVisitFormatTime}} 访问过</text>
</view>
</view>
</view>
......
......@@ -138,17 +138,17 @@ Component({
return unicodeStr
},
filterJumpUrl(item, num) {
console.log(item)
filterJumpUrl(item) {
const userStorage = wx.$storage.get('userInfo')
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()}`
return `${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) {
const userStorage = wx.$storage.get('userInfo')
let { item } = e.currentTarget.dataset
wx.setClipboardData({
data: this.filterJumpUrl(item, 1),
data: `${userStorage.name || ''}邀请你参加${item.activityName || ""}${item.activityUrl}`,
success (res) {
wx.showToast({
title: '复制成功',
......@@ -160,8 +160,7 @@ Component({
// 活动详情
goToDetail(e) {
let { item } = e.currentTarget.dataset
let h5Url = this.filterJumpUrl(item, 2)
console.log(h5Url)
let h5Url = this.filterJumpUrl(item)
wx.$router.jumpH5(h5Url)
},
// 活动战报
......
......@@ -9,13 +9,13 @@
<!-- 活动top信息 -->
<activity-top data="{{item}}" widthStyle="flex: 0 0 62%;">
<image webp src="{{IMGURL}}hot-icon.png?v={{img_version}}"></image>
<view class="hot">火爆进行中</view>
<text class="hot">火爆进行中</text>
</activity-top>
<!-- 活动操作按钮 -->
<view class="active-btn">
<view class="btn" bind:tap="jump" data-item="{{item}}">活动战报</view>
<view class="btn" bind:tap="copyActivityUrl" data-item="{{item}}">分享活动</view>
<view class="btn primary" bind:tap="goToDetail" data-id="{{item.id}}">查看详情</view>
<view class="btn primary" bind:tap="goToDetail" data-item="{{item}}">查看详情</view>
</view>
<!-- 活动概览 -->
<activity-overview data="{{item}}" activityOverviewList="{{activityOverviewList}}" backStyle="{{backStyle}}" textType="{{1}}"></activity-overview>
......
......@@ -39,7 +39,7 @@
</view>
</view>
<view class="task-btn">
<view class="btn {{val.completeStatus == 1 ? 'primary' : ''}}" bind:tap="jump" data-status="{{val.completeStatus}}" data-item="{{val}}" data-activityimg="{{data.activityImg}}">{{val.completeStatus == 1 ? '去完成' : '已完成'}}</view>
<view class="btn {{val.completeStatus == 1 ? 'primary' : ''}}" wx:if="{{fn.timeFilter(data.missionList[activeDateIndex].activityTime) || val.completeStatus == 2}}" bind:tap="jump" data-status="{{val.completeStatus}}" data-item="{{val}}" data-activityimg="{{data.activityImg}}">{{val.completeStatus == 1 ? '去完成' : '已完成'}}</view>
<view class="btn_title" wx:if="{{val.completeStatus == 2}}">奖励已发放</view>
</view>
</view>
......
......@@ -19,6 +19,12 @@ Component({
},
nothing: {
type: Boolean
},
isShow: {
type: Boolean,
observer(val) {
console.log(val)
}
}
},
......@@ -85,15 +91,15 @@ Component({
return unicodeStr
},
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)}&shareStaffType=2&sharedTime=${Date.now()}`
},
filterJumpUrl(item) {
const userStorage = wx.$storage.get('userInfo')
return `${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()}`
},
// 活动详情
goToDetail(e) {
let { id } = e.currentTarget.dataset
let h5Url = this.filterJumpUrl(id)
let { item } = e.currentTarget.dataset
let h5Url = this.filterJumpUrl(item)
console.log(h5Url)
wx.$router.jumpH5(h5Url)
},
......
......@@ -8,14 +8,14 @@
</view>
<view class="item-box" wx:if="{{imageLoaded}}">
<!-- 活动top信息 -->
<activity-top data="{{item}}" widthStyle="flex: 0 0 72%;">
<activity-top data="{{item}}" widthStyle="flex: 0 0 72%;" isShow="{{isShow}}">
<image webp src="{{IMGURL}}activity_end_icon.png?v={{img_version}}"></image>
<view class="end">已结束</view>
<text class="end">已结束</text>
</activity-top>
<!-- 活动操作按钮 -->
<view class="active-btn">
<view class="btn" bind:tap="jump" data-item="{{item}}">活动战报</view>
<view class="btn primary" bind:tap="goToDetail" data-id="{{item.id}}">查看详情</view>
<view class="btn primary" bind:tap="goToDetail" data-item="{{item}}">查看详情</view>
</view>
<!-- 活动概览 -->
<activity-overview data="{{item}}" backStyle="{{backStyle}}" textType="{{2}}"></activity-overview>
......@@ -25,7 +25,7 @@
<view class="title">累计收益</view>
<view class="sort">最终排名:{{item.statics.incomeRank || "-"}}</view>
</view>
<view class="integral-num">{{fn.filterIntegral(item.statics.income)}}<text>积分</text></view>
<view class="integral-num">{{fn.filterIntegral(item.statics.income || 0)}}<text>积分</text></view>
</view>
<!-- 转化分析 -->
<view class="invert-box {{item.isCollapse ? 'hidden' : ''}}">
......
......@@ -4,6 +4,7 @@ Component({
/**
* 组件的属性列表
*/
properties: {
data: {
type: Object,
......@@ -11,15 +12,16 @@ Component({
},
widthStyle: {
type: String
}
}
},
/**
* 组件的初始数据
*/
data: {
activityTypList: index_const.data.activityTypList,
activityTypeStyle: 'margin-top: 8rpx;height: 44rpx;line-height: 44rpx;',
},
/**
* 组件的方法列表
......
......@@ -4,7 +4,7 @@
.active-img{
position: relative;
width: 160rpx;
height: 120rpx;
height: 160rpx;
margin-right: 24rpx;
.thum-icon{
width: 100%;
......@@ -35,17 +35,25 @@
justify-content: space-between;
padding: 8rpx 0;
.name{
display: flex;
align-items: center;
.left{
// display: flex;
// align-items: center;
.name-left{
font-weight: 600;
font-size: 36rpx;
color: #1B233D;
line-height: 48rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
line-height: 48rpx;
word-break: break-all;
.activity-type{
float: right;
line-height: 44rpx;
font-size: 28rpx;
color: #FE5662;
image{
margin-top: 4rpx;
width: 32rpx;
height: 32rpx;
}
}
}
.right{
display: flex;
......
......@@ -9,8 +9,9 @@
</view>
<view class="active-title">
<view class="name">
<view class="left" style="{{widthStyle}}">{{data.activityName}}</view>
<view class="right">
<!-- <view class="left" style="{{widthStyle}}">{{data.activityName}}</view> -->
<view class="name-left" style="{{activityNameStyle}}">{{data.activityName}}<view wx:if="{{data.titleIsWarp}}" class="activity-type"><slot></slot></view></view>
<view wx:if="{{!data.titleIsWarp}}" class="right" style="{{activityTypeStyle}}">
<slot></slot>
</view>
</view>
......
......@@ -11,8 +11,14 @@ var formatNumber = function (e) {
? (e / 1000).toFixed(1) + "k"
: e;
}
var timeFilter = function(e) {
return getDate(e) > getDate().setHours(0, 0, 0, 0);
}
module.exports = {
filterIntegral: filterIntegral,
mathABS: mathABS,
formatNumber: formatNumber
formatNumber: formatNumber,
timeFilter: timeFilter
}
\ No newline at end of file
......@@ -53,11 +53,18 @@ Page({
},
getData(onPullDown) {
wx.showLoading()
this.getActivityList(1, onPullDown)
this.getActivityList(2, onPullDown)
},
// 计算文本宽度
getTextWidth(text, font, bold) {
var canvas = wx.createOffscreenCanvas({ type: '2d', width: 300, height: 300 })
var context = canvas.getContext('2d')
context.font = context.font = `${bold} ${font}px PingFangSC-Semibold`
var metrics = context.measureText(text)
return metrics.width
},
getActivityList(num, onPullDown) {
let {activePageNum, pageSize, pageNum, activeList, activityEndList, tabIndex} = this.data
ActivityApi.getActivityList({
......@@ -65,15 +72,16 @@ Page({
pageNum: num == 1 ? activePageNum : pageNum,
pageSize
}).then(res => {
res.data && res.data.forEach((val, index) => {
let activityTitleViewWidth = wx.getSystemInfoSync().windowWidth - 139 // 活动title区域宽度
res.list && res.list.forEach((val, index) => {
val.isCollapse = true
val.startTime = val.startTime.split(' ')[0]
val.endTime = val.endTime.split(' ')[0]
val.tabIndex = num - 1
val.tabIndex = num - 1
val.titleIsWarp = this.getTextWidth(val.activityName, '18', 600) > activityTitleViewWidth
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)
......@@ -105,7 +113,6 @@ Page({
}
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')
......@@ -123,13 +130,13 @@ Page({
})
if (num == 1) {
this.setData({
activeList: onPullDown ? res.data : [...activeList, ...res.data],
activeTotal: res.count
activeList: onPullDown ? res.list : [...activeList, ...res.list],
activeTotal: res.total
})
} else {
this.setData({
activityEndList: onPullDown ? res.data : [...activityEndList, ...res.data],
total: res.count
activityEndList: onPullDown ? res.list : [...activityEndList, ...res.list],
total: res.total
})
}
})
......
......@@ -8,15 +8,16 @@ import {
import {
getSessionId
} from '~/utils/cache/storageApi'
let requestTimes = 0
/**接口 */
class Request {
get(params, returnAll = false) {
return this.request('GET', params, returnAll)
get(params, returnAll = false, isShowLoading = false) {
return this.request('GET', params, returnAll, isShowLoading)
}
post(params, returnAll = false) {
return this.request('POST', params, returnAll)
post(params, returnAll = false, isShowLoading = false) {
return this.request('POST', params, returnAll, isShowLoading)
}
request(RequestMethods, params, returnAll) {
request(RequestMethods, params, returnAll, isShowLoading) {
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
let header =
......@@ -29,6 +30,12 @@ class Request {
if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName]
params = this.getData(params)
requestTimes++
if (isShowLoading) {
wx.showLoading({
title: '加载中'
})
}
wx.request({
url: `${domain}${path}router?method=${params.method}`,
data: params,
......@@ -77,6 +84,8 @@ class Request {
reject(error)
},
complete() {
requestTimes--;
if (requestTimes == 0) wx.hideLoading();
wx.stopPullDownRefresh()
wx.hideNavigationBarLoading()
}
......
......@@ -113,11 +113,24 @@ const getImgVersion = () => {
return commonApi.getImgVersion()
}
/**获取节点信息
* name(id获取class)
* callBack 回调函数
* isComponents是否在组件
*/
const getViewInfo = (name, callBack, isComponents) => {
const query = !isComponents ? wx.createSelectorQuery() : wx.createSelectorQuery().in(isComponents)
query.select(name).boundingClientRect(res => {
callBack(res)
}).exec()
}
const Util = {
getImgVersion,
onReachBottom,
isFullSucreen,
clearObjNull,
throttle
throttle,
getViewInfo
}
export default Util
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!