Commit 20043ffc by 张晓玮

Merge branch 'zhangxw_dev_3.0' into 'v3.0'

Zhangxw dev 3.0

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