| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676 |
- <template>
- <view class="container">
- <image class="topbg" :src="info.thumbnail" mode="scaleToFill"></image>
- <view class="container-body">
- <view class="coursebox">
- <view class="coursebox-info">
- <!-- <view class="status">进行中</view> -->
- <!-- <view class="status" style="background-color: #ff4746;">已结束</view> -->
- <view class="coursebox-name">
- <text class="more-t">{{info.title}}</text>
- <view class="btn_icon" @click="copyId">ID
- <image src="@/static/images/copy_icon.png" mode="aspectFill"></image>
- </view>
- </view>
- <!-- <view class="coursebox-name">7.明医有话说-杜老师给您讲讲抑郁杜老师给您讲讲抑郁</view> -->
- <view style="margin-top: 5px;">{{info.courseName}}</view>
- <view class="coursebox-time x-start">
- <view class="coursebox-time-item" style="margin-right: 14px;">
- <view>直播时间</view>
- <view class="coursebox-time-t">{{info.createTime}}</view>
- </view>
- <view class="coursebox-time-item duration">
- <view>课程时长</view>
- <view class="coursebox-time-t">{{$formatSeconds(info.duration || 0,1)}}</view>
- </view>
- </view>
- </view>
- </view>
- <view class="statistics">
- <u-tabs :list="list1" :current='current' :scrollable="false" :lineWidth="40" lineColor="#1677ff" :activeStyle="activeStyle" :inactiveStyle="inactiveStyle" @click="clickTab"></u-tabs>
- <u-collapse :border='false' :value='collapseValue' @change="changeCollapse" v-if="current == 0">
- <u-collapse-item name="live">
- <view slot="title" class="statistics-title">直播数据<text class="statistics-title-tip">2分钟自动更新</text></view>
- <text slot="value" class="statistics-slot-title">{{collapseValue.includes('live')?'收回':'展开'}}</text>
- <text slot="right-icon">
- <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
- </text>
- <view class="collapse-content x-ac">
- <view class="collapse-content-item">
- <view class="collapse-content-title">观看人数</view>
- <view class="collapse-content-num"><text>{{courseCount.count || 0}}</text>人</view>
- </view>
- <view class="collapse-content-item">
- <view class="collapse-content-title">完播人数</view>
- <view class="collapse-content-num"><text>{{courseCount.completeCount || 0}}</text>人</view>
- </view>
- <view class="collapse-content-item">
- <view class="collapse-content-title">完播率</view>
- <view class="collapse-content-num"><text>{{courseCount.rate || 0}}</text>%</view>
- </view>
- </view>
- </u-collapse-item>
- <u-collapse-item name="questions">
- <text slot="title" class="statistics-title">答题数据<text class="statistics-title-tip">2分钟自动更新</text></text>
- <text slot="value" class="statistics-slot-title">{{collapseValue.includes('questions')?'收回':'展开'}}</text>
- <text slot="right-icon">
- <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
- </text>
- <view class="collapse-content">
- <view class="x-ac">
- <view class="collapse-content-item">
- <view class="collapse-content-title">答题人数</view>
- <view class="collapse-content-num"><text>{{quesCount.count || 0}}</text>人</view>
- </view>
- <view class="collapse-content-item">
- <view class="collapse-content-title">正确人数</view>
- <view class="collapse-content-num"><text>{{quesCount.completeCount || 0}}</text>人</view>
- </view>
- <view class="collapse-content-item">
- <view class="collapse-content-title">答题红包数</view>
- <view class="collapse-content-num"><text>{{redPacketCount.count || 0}}</text>个</view>
- </view>
- </view>
- <view class="redenvelope x-bc">
- <view class="x-f">
- <image src="@/static/images/redenvelope.png" mode="aspectFill"></image>
- <text>答题红包金额</text>
- </view>
- <view class="collapse-content-num"><text>{{redPacketCount.amount || '0.00'}}</text>元</view>
- </view>
- </view>
- </u-collapse-item>
- <u-collapse-item name="funnelplot">
- <text slot="title" class="statistics-title">转化漏斗图<text class="statistics-title-tip">2分钟自动更新</text></text>
- <text slot="value" class="statistics-slot-title">{{collapseValue.includes('funnelplot')?'收回':'展开'}}</text>
- <text slot="right-icon">
- <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
- </text>
- <view>
- 漏斗
- </view>
- </u-collapse-item>
- </u-collapse>
- </view>
- <!-- 参与记录 -->
- <view v-if="current == 1">
- <view class="participate-search">
- <view class="x-bc">
- <u-search placeholder="会员ID、昵称、姓名、手机" v-model="keyword" :showAction="false" height="30px"></u-search>
- <u-button type="primary" class="refresh" color='#1677ff' size="small" :disabled="disabled" text="刷新" @click="refresh"></u-button>
- </view>
- <view class="x-bc">
- <u-tabs :list="list2" :current='currentType' :lineWidth="40" lineColor="#1677ff" :activeStyle="activeStyle" :inactiveStyle="inactiveStyle" @click="clickTypeTab"></u-tabs>
- <view class="participate-order x-f">
- <image src="@/static/images/order_icon2.png" mode="aspectFill" v-if="searchTypeIndex == 3"></image>
- <image src="@/static/images/order_icon.png" mode="aspectFill" v-else></image>
- <picker @change="bindPickerChange" :value="searchTypeIndex" :range="typeArray">
- {{typeoption[searchTypeIndex]}}
- </picker>
- </view>
- </view>
- </view>
- <mescroll-body top="0" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
- <view class="list">
- <view class="list-item" v-for="(item,index) in dataList" :key="index">
- <view class="list-item-head x-bc">
- <view class="x-f" style="flex: 1;overflow: hidden;">
- <u-avatar :src='item.avatar'></u-avatar>
- <view class="list-item-head-l">
- <view style="flex: 1;overflow: hidden;display: flex;">
- <text class="list-item-name one-t">{{item.nickName}}</text>
- <image class="list-item-copy" src="@/static/images/copy_icon.png" mode="aspectFill"></image>
- </view>
- <view class="list-item-re">注册时间:{{item.createTime?item.createTime.substring(0,10):'--'}}</view>
- </view>
- </view>
- <image class="phone" src="@/static/logo.png" mode="aspectFill"></image>
- </view>
- <view class="list-item-desc">
- <view class="taglist">
- <view v-for="(tag,i) in item.tags ? item.tags.split(',') : []">
- <u-tag :text="tag" size="mini" color="#999" bgColor="#f5f5f5" borderColor="#f5f5f5"></u-tag>
- </view>
- </view>
- <view style="margin-top: 5px;">
- <text class="label">观看次数</text><text class="value-num">{{item.watchCount || 0}}</text>
- <text class="label">完播次数</text><text class="value-num">{{item.watchComlpleteCount || 0}}</text>
- <text class="label">累计时长</text><text class="value-num">{{item.watchTime || '--'}}</text>
- </view>
- <view style="margin-top: 5px;">
- <text class="label">红包领取状态</text>
- <!-- 发送中 1 已发送 -->
- <text class="value-num">{{item.redStatus == 1 ? '已发送': item.redStatus == 0 ? '发送中': item.redStatus}}</text>
- </view>
- <view style="margin-top: 5px;"><text class="label">观看时间</text><text class="value-num">{{item.watchDate}}</text></view>
- </view>
- <view class="list-item-footer x-f">
- <view class="list-item-footer-btn x-f" @click="openModel('name',item)">改姓名</view>
- <view class="list-item-footer-btn x-f" @click="openModel('remark',item)">改备注</view>
- <view class="list-item-footer-btn footer-tagbtn x-f" @click="openModel('tag',item)">改标签</view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- <!-- 修改名字/备注-->
- <u-modal :show="modelShow" :title="modelTitle" content='content' class="model" :showCancelButton='true' @cancel="closeModel" @confirm="confirmModel">
- <view class="setTimebox">
- <u-input
- fontSize="14px"
- :placeholder="modelTitle == '修改姓名' ? '请输入姓名':''"
- v-model="inputVal"
- maxlength="5"
- style="width: 520rpx;"
- ></u-input>
- </view>
- </u-modal>
- </view>
- </view>
- </template>
- <script>
- import {getCompanyUserAndUserCount,getCourseCount,getQuesCount,getRecPacketCount,getUserLogListByCourseId,updateFsUser} from "@/api/courseManage.js"
- export default{
- data() {
- return {
- modelShow: false,
- modelTitle: '',
- inputVal: '',
- info: {},
- list1: [{
- name: '课程数据',
- }, {
- name: '参与记录',
- }, {
- name: '活动节目'
- }],
- current: 0,
- list2: [{
- name: '答题正确',
- label: '答题正确',
- value: 0
- }, {
- name: '仅播完',
- label: '仅播完',
- value: 2
- }, {
- name: '未完播',
- label: '未完播',
- value: 1
- }, {
- name: '未播放',
- label: '未播放',
- value: 3
- }],
- currentType: 0,
- activeStyle:{
- color: '#1677ff',
- fontSize: '14px',
- fontWeight: 'bold'
- },
- inactiveStyle:{
- fontSize: '14px'
- },
- collapseValue:['live','questions','funnelplot'],
- keyword: '',
- disabled: false,
- searchTypeIndex: 0,
- typeArray: ['按看课时间从晚到早', '按完播时间从晚到早', '按注册时间从晚到早','按会员姓名0-9-A-Z'],
- typeoption: ['看课时间', '完播时间', '注册时间','会员姓名'],
- typeoptionOrder: ['desc', 'watchDesc', 'registerDesc','nameDesc'],
- mescroll:null,
- downOption: {
- auto:false//不要自动加载
- },
- upOption: {
- onScroll:false,
- use: true, // 是否启用上拉加载; 默认true
- page: {
- num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- textNoMore:"已经到底了",
- empty: {
- icon:'/static/images/empty.png',
- tip: '暂无数据'
- }
- },
- dataList: [],
- user: {},
- todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
- courseCount: {},
- quesCount: {},
- redPacketCount: {},
- courseId: '',
- chooseUserId: ''
- }
- },
- onLoad(option) {
- this.info = option.info ? JSON.parse(option.info) : {}
- uni.setNavigationBarTitle({
- title: '数据统计'
- });
- this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
- this.courseId = this.info.courseId || ''
- if(this.courseId)
- this.getCount()
- },
- methods: {
- copyId() {
- uni.setClipboardData({
- data: this.info.fileId,
- success: ()=> {
- uni.showToast({
- title: '复制课程ID成功',
- icon: 'success'
- })
- }
- });
- },
- clickTab(e) {
- this.current = e.index
- },
- clickTypeTab(e) {
- this.currentType = e.index
- this.mescroll.resetUpScroll()
- },
- bindPickerChange(e) {
- console.log('picker发送选择改变,携带值为', e.detail.value)
- this.searchTypeIndex = e.detail.value
- },
- changeCollapse(e) {
- this.collapseValue = e.filter(item=>item.status == 'open').map(it=>it.name)
- },
- refresh() {
- this.mescroll.resetUpScroll()
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- mescroll.resetUpScroll()
- },
- upCallback(page) {
- //联网加载数据
- var that = this;
- var data={
- courseId:this.courseId,
- order: this.typeoptionOrder[this.searchTypeIndex],
- tagIds: [],
- type: this.list2[this.currentType].value, // 0:答题正确 1:未完播 2:已完播 3:未播放
- pageNum: page.num,
- pageSize: page.size
- };
- uni.showLoading({
- title:"加载中..."
- })
- this.list2[this.currentType].name = this.list2[this.currentType].label
- getUserLogListByCourseId(data).then(res => {
- uni.hideLoading()
- if(res.code==200){
- //设置列表数据
- if (page.num == 1) {
- that.dataList = res.data.list;
-
- } else {
- that.dataList = that.dataList.concat(res.data.list);
-
- }
- this.list2[this.currentType].name = this.list2[this.currentType].label + (res.data.total)
- that.mescroll.endBySize(res.data.list.length, res.data.total);
-
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- },
- getCount() {
- const param = {
- companyId: this.user.companyId,
- companyUserId: this.user.userId,
- courseId: this.courseId,
- endTime: this.todayday + ' 23:59:59',
- startTime: this.todayday + ' 00:00:00',
- type: this.user.userType=='00' ? 0 : 1, // 0:经销商/1:群管
- }
- this.getCourseCount(param)
- this.getQuesCount(param)
- this.getRecPacketCount(param)
- },
- getCourseCount(param){
- getCourseCount(param).then(res=>{
- if(res.code==200){
- this.courseCount = res.data
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- })
- },
- getQuesCount(param){
- getQuesCount(param).then(res=>{
- if(res.code==200){
- this.quesCount = res.data
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- })
- },
- getRecPacketCount(param){
- getRecPacketCount(param).then(res=>{
- if(res.code==200){
- this.redPacketCount = res.data
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- })
- },
- openModel(type,item) {
- this.chooseUserId = item.userId
if(type == 'name') {
this.modelTitle = '修改姓名'
- this.inputVal = item.nickName || ''
} else if(type == 'remark') {
this.modelTitle = '修改备注'
- this.inputVal = item.remark || ''
}
this.modelShow = true
},
- closeModel() {
- this.modelShow = false
- this.inputVal = ''
- },
- confirmModel() {
- this.modelShow = false
- if(this.modelTitle == '修改姓名') {
- const param = {
- userId: this.chooseUserId,
- nickName: this.inputVal,
- }
- this.updateFsUser(param)
- } else if(this.modelTitle == '修改备注') {
- const param = {
- userId: this.chooseUserId,
- remark: this.inputVal,
- }
- this.updateFsUser(param)
- }
- },
- updateFsUser(param) {
- console.log(param)
- updateFsUser(param).then(res=>{
- if(res.code==200){
- this.redPacketCount = res.data
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- position: relative;
- z-index: 2;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 14px;
- color: #222;
- .topbg {
- position: absolute;
- z-index: -1;
- top: 0;
- left: 0;
- width: 100%;
- height: 210px;
- }
- &-body {
-
- }
- .coursebox {
- padding: 120px 50rpx 20px 50rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 14px;
- color: #999;
- .status {
- position: absolute;
- top: 0;
- right: 0;
- z-index: 2;
- height: 30px;
- padding: 0 8px;
- box-sizing: border-box;
- line-height: 30px;
- border-radius: 0 12px 0 12px;
- text-align: center;
- color: #fff;
- background-color: #08ce36;
- }
- &-info {
- padding: 12px;
- background-color: rgba(255,255,255,0.88);
- border-radius: 12px;
- overflow: hidden;
- position: relative;
- }
- &-name {
- color: #222;
- font-weight: bold;
- font-size: 16px;
- padding-right: 50px;
- .more-t {
- flex: 1;
- font-size: 14px;
- color: #222;
- display: inline;
- }
- }
- &-time-item {
- flex: 1;
- margin-top: 5px;
- }
- &-time-t {
- color: #222;
- font-weight: bold;
- margin-top: 5px;
- font-size: 12px;
- }
- .duration {
- position: relative;
- padding-left: 14px;
- &::after {
- content: "";
- height: 30px;
- width: 1px;
- background-color: #f5f5f5;
- position: absolute;
- left: 0;
- top: 5px;
- }
- }
- }
- }
- .statistics {
- background-color: #fff;
- &-title {
- font-family: PingFang SC, PingFang SC;
- font-weight: bold;
- font-size: 16px;
- color: #222222;
- }
- &-title-tip {
- font-weight: 400;
- font-size: 11px;
- color: #999;
- padding-left: 10px;
- }
- &-slot-title {
- font-size: 12px;
- color: #1677ff;
- }
- .collapse-content {
- margin: 0 -8px -8rpx 0;
- &-item {
- flex: 1;
- padding: 12px;
- box-sizing: border-box;
- border-radius: 10px;
- background: #f5f5f5;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 10px;
- color: #222222;
- margin: 0 8px 8rpx 0;
- }
- &-title {
- font-size: 14px;
- margin-bottom: 10px;
- }
- &-num {
- color: #1677ff;
- font-size: 10px;
- text {
- font-family: DIN, DIN;
- font-weight: bold;
- font-size: 25px;
- }
- }
- }
- .redenvelope {
- background-color: #f5f5f5;
- margin-right: 8px;
- margin-top: 4px;
- padding: 15px;
- box-sizing: border-box;
- border-radius: 10px;
- color: #222222;
- image {
- width: 50px;
- height: 50px;
- margin-right: 10px;
- }
- }
- }
- .participate-search {
- background-color: #fff;
- padding: 10px 15px;
- .refresh {
- height: 26px;
- min-width: 40px;
- width: 40px;
- padding: 0;
- display: inline-flex;
- margin-left: 15px;
- border-radius: 5px;
- overflow: hidden;
- }
- }
- .participate-order {
- font-size: 12px;
- image {
- width: 15px;
- height: 15px;
- }
- }
- .btn_icon {
- font-weight: 400;
- font-size: 14px;
- color: #1677ff;
- display: inline-flex;
- align-items: center;
- margin-left: 5px;
- image {
- width: 20px;
- height: 20px;
- }
- }
- .list {
- padding: 20px 10px;
- }
- .list-item{
- padding: 10px;
- margin-bottom: 10px;
- background-color: #fff;
- border-radius: 12px;
- &-head {
- .phone {
- flex-shrink: 0;
- width: 30px;
- height: 30px;
- }
- &-l {
- flex: 1;
- overflow: hidden;
- margin-left: 10px;
- margin-right: 10px;
- }
- }
- &-copy {
- width: 20px;
- height: 20px;
- }
- &-re {
- font-size: 10px;
- margin-top: 5px;
- }
- &-desc {
- padding: 5px;
- color: #999;
- font-size: 12px;
- }
- .label {
- margin-right: 4px;
- }
- .value-num {
- margin-right: 18px;
- color: #222;
- font-weight: bold;
- }
- .taglist {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- color: #555;
- padding-top: 5px;
- view {
- margin: 0 5px 5px 0;
- }
- }
- &-footer {
- justify-content: flex-end;
- padding: 6px 0;
- .footer-tagbtn {
- color: #1677ff;
- background-color: #e7f2fe;
- border: 1px solid #c9e1fb;
- }
- &-btn {
- height: 26px;
- padding: 0 10px;
- margin-left: 10px;
- background-color: #f5f5f5;
- border-radius: 25px;
- font-weight: 400;
- font-size: 10px;
- line-height: 26px;
- border: 1px solid #f5f5f5;
- box-sizing: border-box;
- }
- }
- }
- </style>
|