index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <view class="column flex-1 hb">
  3. <!-- <view class="headnav x-bc">
  4. <view :class="activeTab == 0 ? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(0)">
  5. <view>直播计划</view>
  6. <view class="headnav-num">3</view>
  7. <image src="@/static/images/idle.png" mode="aspectFill"></image>
  8. </view>
  9. <view :class="activeTab == 1? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(1)">
  10. <view>今日直播</view>
  11. <view class="headnav-num">3</view>
  12. <image src="@/static/images/streaming.png" mode="aspectFill"></image>
  13. </view>
  14. <view :class="activeTab == 2 ? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(2)">
  15. <view>往日直播</view>
  16. <view class="headnav-num">3</view>
  17. <image src="@/static/images/finished.png" mode="aspectFill"></image>
  18. </view>
  19. </view> -->
  20. <view>
  21. <dropdownPanel :filterData='filterData' @onChange="onChange" @confirm="confirm" @reset="reset">
  22. <view class="column flex-1 hb hidden">
  23. <view v-if="searchbarNav == 0">
  24. <view class="p20 fs28 column flex-1 scrolly">
  25. <view v-for="(item,index) in courseOne" :key="item.index"
  26. :class="courseid==item.courseId?'actNav':''" class="m10 p10 center"
  27. style="border-bottom: 2rpx solid #eee;" @click="getCourseOne(item.courseId)">
  28. {{item.courseName}}
  29. </view>
  30. </view>
  31. </view>
  32. <view v-else class="p20 fs28 column flex-1 hidden">
  33. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabled"
  34. :refresher-triggered="triggered" refresher-background="rgba(0,0,0,0)"
  35. @refresherrefresh="pullDownRefresh" @refresherrestore="triggered = false"
  36. :upper-threshold="100" :lower-threshold="100" @refresherabort="triggered = false"
  37. @scrolltolower="reachBottom">
  38. <view v-for="(item,index) in courseTwo" :key="item.index"
  39. :class="courseids==item.videoId?'actNav':''" class="m10 p10 center"
  40. style="border-bottom: 2rpx solid #eee;" @click="getCourseTwo(item.videoId)">
  41. {{item.title}}
  42. </view>
  43. <u-loadmore :status="status" />
  44. <view class="ptb40"></view>
  45. </scroll-view>
  46. </view>
  47. </view>
  48. </dropdownPanel>
  49. </view>
  50. <view class="bgf m20 radius8 column flex-1 scrolly" style="max-height: 100%;">
  51. <view class="column flex-1 scrolly">
  52. <u-collapse ref="collapseRef" :border="false" :value="collapseValue" @change="changeCollapse">
  53. <u-collapse-item name="course">
  54. <text slot="title" class="bold fs32">课程统计</text>
  55. <text slot="value" class="base-color fs24">{{collapseValue.includes('course')?'收回':'展开'}}</text>
  56. <view slot="right-icon">
  57. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  58. </view>
  59. <view class="justify-around ">
  60. <view class="base-bg-f8 radius16 p30 flex-1">
  61. <view class="mb12 bold">营期</view>
  62. <view class="base-color"><text class="bold fs40">
  63. {{courselist.course}}</text>期</view>
  64. </view>
  65. <view class="base-bg-f8 radius16 p20 flex-1 mlr20">
  66. <view class="mb12 bold">课程数</view>
  67. <view class="base-color"><text class="bold fs40">
  68. {{courselist.count}}</text>课</view>
  69. </view>
  70. <view class="base-bg-f8 radius16 p20 flex-1">
  71. <view class="mb12 bold">参与会员</view>
  72. <view class="base-color"><text class="bold fs40">
  73. {{courselist.watchCount}}</text>人</view>
  74. </view>
  75. </view>
  76. </u-collapse-item>
  77. <!-- <u-collapse-item name="questions">
  78. <text slot="title" class="bold fs32">直播统计</text>
  79. <text slot="value"
  80. class="base-color fs24">{{collapseValue.includes('questions')?'收回':'展开'}}</text>
  81. <view slot="right-icon">
  82. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  83. </view>
  84. <view class="justify-around ">
  85. <view class="base-bg-f8 radius16 p30 flex-1">
  86. <view class="mb12 bold">观看人次</view>
  87. <view class="base-color"><text class="bold fs40">3</text>人</view>
  88. </view>
  89. <view class="base-bg-f8 radius16 p20 flex-1 mlr20">
  90. <view class="mb12 bold">完播人次</view>
  91. <view class="base-color"><text class="bold fs40">3</text>人</view>
  92. </view>
  93. <view class="base-bg-f8 radius16 p20 flex-1">
  94. <view class="mb12 bold">完播率</view>
  95. <view class="base-color"><text class="bold fs40">3</text>%</view>
  96. </view>
  97. </view>
  98. </u-collapse-item> -->
  99. <u-collapse-item name="redenvelope">
  100. <text slot="title" class="bold fs32">答题统计</text>
  101. <text slot="value"
  102. class="base-color fs24">{{collapseValue.includes('redenvelope')?'收回':'展开'}}</text>
  103. <view slot="right-icon">
  104. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  105. </view>
  106. <view class="justify-around ">
  107. <view class="base-bg-f8 radius16 p30 flex-1">
  108. <view class="mb12 bold">答题人次</view>
  109. <view class="base-color"><text class="bold fs40">
  110. {{answerlist.count}}</text>人</view>
  111. </view>
  112. <view class="base-bg-f8 radius16 p20 flex-1 mlr20">
  113. <view class="mb12 bold">正确人次</view>
  114. <view class="base-color"><text class="bold fs40">
  115. {{answerlist.completeCount}}</text>人</view>
  116. </view>
  117. <view class="base-bg-f8 radius16 p20 flex-1">
  118. <view class="mb12 bold">正确率</view>
  119. <view class="base-color"><text class="bold fs40">
  120. {{answerlist.rate}}</text>%</view>
  121. </view>
  122. </view>
  123. </u-collapse-item>
  124. <u-collapse-item name="live">
  125. <text slot="title" class="bold fs32">红包统计</text>
  126. <text slot="value" class="base-color fs24">{{collapseValue.includes('live')?'收回':'展开'}}</text>
  127. <view slot="right-icon">
  128. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  129. </view>
  130. <view class="justify-around ">
  131. <view class="base-bg-f8 radius16 p30 flex-1">
  132. <view class="mb12 bold">红包个数</view>
  133. <view class="base-color"><text class="bold fs40">
  134. {{redbaglist.count}}</text>个</view>
  135. </view>
  136. <view class="base-bg-f8 radius16 p20 mlr20 justify-start align-center">
  137. <image src="../../../static/images/redenvelope.png" class="w102 h102"></image>
  138. <view class="ml20">
  139. <view class="mb12 bold">答题红包金额</view>
  140. <view class="base-color">
  141. <text class="bold fs40">{{redbaglist.amount}}</text>元
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. </u-collapse-item>
  147. <u-collapse-item name="funnel">
  148. <text slot="title" class="bold fs32">转化漏斗图</text>
  149. <text slot="value" class="base-color fs24">{{collapseValue.includes('funnel')?'收回':'展开'}}</text>
  150. <view slot="right-icon">
  151. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  152. </view>
  153. <view>
  154. <funnelChart :getratelist="getrateimg" />
  155. </view>
  156. </u-collapse-item>
  157. <u-collapse-item name="rank">
  158. <text slot="title" class="bold fs32">排行榜</text>
  159. <text slot="value" class="base-color fs24">{{collapseValue.includes('rank')?'收回':'展开'}}</text>
  160. <view slot="right-icon">
  161. <u-icon name="arrow-right" color="#1677ff" size="12"></u-icon>
  162. </view>
  163. <view class="flex-1">
  164. <view class="mt40">
  165. <view class="justify-between align-center">
  166. <view class="base-color-3 bold fs32">群管排行榜</view>
  167. <view class="justify-start" @click="ordergroup(1)" v-if="orderGroup=='asc'">
  168. <u-icon name="list-dot" size="20"></u-icon>
  169. <view>按正序(前20名)</view>
  170. </view>
  171. <view class="justify-start" @click="ordergroup(0)" v-else>
  172. <u-icon name="list-dot" size="20"></u-icon>
  173. <view>按倒序(后20名)</view>
  174. </view>
  175. </view>
  176. <view class="centerV">
  177. <u-tabs :list="list1" @click="clickTab" lineColor='#1773ff' lineWidth='40'
  178. activeStyle="font-weight:bold"></u-tabs>
  179. </view>
  180. <view class="justify-start align-center mtb28" v-for="(item,index) in rankListA"
  181. :key="index">
  182. <u-avatar :src="item.avatar" size="40"></u-avatar>
  183. <view class="flex-1 ml20">
  184. <view class="justify-between mb16">
  185. <view class="base-color-3">{{item.name}}</view>
  186. <view>{{item.rate}}%</view>
  187. </view>
  188. <u-line-progress :percentage="30" activeColor='#1773ff' />
  189. </view>
  190. </view>
  191. <view v-if="rankListA.length==0" class="center mtb32">暂无数据</view>
  192. </view>
  193. <view class="mt60 column flex-1">
  194. <view class="justify-between align-center">
  195. <view class="base-color-3 bold fs32">课程排行榜</view>
  196. <view class="justify-start" @click="ordergroupB(1)" v-if="orderGroupB=='asc'">
  197. <u-icon name="list-dot" size="20"></u-icon>
  198. <view>按正序(前20名)</view>
  199. </view>
  200. <view class="justify-start" @click="ordergroupB(0)" v-else>
  201. <u-icon name="list-dot" size="20"></u-icon>
  202. <view>按倒序(后20名)</view>
  203. </view>
  204. </view>
  205. <view class="centerV">
  206. <u-tabs :list="list1" @click="clickTabB" lineColor='#1773ff' lineWidth='40'
  207. activeStyle="font-weight:bold"></u-tabs>
  208. </view>
  209. <view class="justify-start align-center" v-for="(item,index) in rankListB" :key="index">
  210. <view class="flex-1 ml20">
  211. <view class="justify-between mb16">
  212. <view class="base-color-3">{{item.name}}</view>
  213. <view>{{item.rate}}%</view>
  214. </view>
  215. <u-line-progress :percentage="30" activeColor='#ed0922' />
  216. </view>
  217. </view>
  218. <view v-if="rankListB.length==0" class="center mtb32">暂无数据</view>
  219. </view>
  220. </view>
  221. </u-collapse-item>
  222. </u-collapse>
  223. </view>
  224. <view class="h120"></view>
  225. </view>
  226. </view>
  227. </template>
  228. <script>
  229. import {
  230. getFsCourseList,
  231. getCourseVdieoList,
  232. getshopCoursenum,
  233. getQuesCount,
  234. getRecPacketCount,
  235. getcourseRate,
  236. getGroupRanklist,
  237. getCourseRanklist
  238. } from "@/api/courseManage.js"
  239. import dropdownPanel from "../components/dropdownPanel.vue"
  240. import parse from "../../../uni_modules/uview-ui/libs/config/props/parse"
  241. import funnelChart from "../components/chart.vue"
  242. export default {
  243. components: {
  244. dropdownPanel,
  245. funnelChart,
  246. },
  247. data() {
  248. return {
  249. activeTab: 0,
  250. showCalendar: false,
  251. user: {},
  252. filterData: [{
  253. name: '训练营-营期',
  254. value: 1,
  255. },
  256. {
  257. name: '课程',
  258. value: 2,
  259. }
  260. ],
  261. searchbarNav: 0,
  262. collapseValue: ['course', 'questions', 'redenvelope', 'live', 'funnel', 'rank'],
  263. courseOne: [],
  264. courseTwo: [],
  265. courseid: '',
  266. courseids: '',
  267. triggered: false,
  268. status: 'loadmore',
  269. isEnabled: true,
  270. pageNum: 1,
  271. pageSize: 10,
  272. courselist: [],
  273. answerlist: [],
  274. redbaglist: [],
  275. getrateimg: {},
  276. list1: [{
  277. name: '按完播率',
  278. }, {
  279. name: '按正确率'
  280. }],
  281. orderGroup: 'asc',
  282. orderGroupB: 'asc',
  283. rankListA: {},
  284. rankListB: {},
  285. activeA: 1,
  286. activeB: 1,
  287. }
  288. },
  289. async mounted() {
  290. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  291. this.getCoursestatistics()
  292. this.getquslist()
  293. this.getredbaglist()
  294. this.getrateList()
  295. this.getrankgroup()
  296. await this.getrankCourse()
  297. this.$nextTick(() => {
  298. setTimeout(()=>{
  299. this.$refs?.collapseRef?.init()
  300. },1000)
  301. })
  302. },
  303. methods: {
  304. ordergroup(item) {
  305. if (item == 0) {
  306. this.orderGroup = 'asc'
  307. this.getrankgroup()
  308. } else {
  309. this.orderGroup = 'desc'
  310. this.getrankgroup()
  311. }
  312. },
  313. ordergroupB(item) {
  314. if (item == 0) {
  315. this.orderGroupB = 'asc'
  316. this.getrankCourse()
  317. } else {
  318. this.orderGroupB = 'desc'
  319. this.getrankCourse()
  320. }
  321. },
  322. getrankCourse() {
  323. //获取课程排行
  324. // console.log(this.orderGroupB)
  325. const params = {
  326. companyId: this.user.companyId,
  327. endTime: '',
  328. startTime: '',
  329. courseId: this.courseid,
  330. videoId: this.courseids,
  331. order: this.orderGroupB,
  332. type: this.activeB, // 0:经销商/1:群管
  333. }
  334. getCourseRanklist(params).then(res => {
  335. if (res.code == 200) {
  336. // console.log(res)
  337. this.rankListB = res.data
  338. } else {
  339. uni.showToast({
  340. icon: 'none',
  341. title: res.msg
  342. })
  343. }
  344. })
  345. },
  346. getrankgroup() {
  347. //获取群管排行
  348. const params = {
  349. companyId: this.user.companyId,
  350. endTime: '',
  351. startTime: '',
  352. courseId: this.courseid,
  353. videoId: this.courseids,
  354. order: this.orderGroup,
  355. type: this.activeA, // 0:经销商/1:群管
  356. }
  357. getGroupRanklist(params).then(res => {
  358. if (res.code == 200) {
  359. // console.log(res)
  360. this.rankListA = res.data
  361. } else {
  362. uni.showToast({
  363. icon: 'none',
  364. title: res.msg
  365. })
  366. }
  367. })
  368. },
  369. getrateList() {
  370. //获取漏斗图
  371. const params = {
  372. companyId: this.user.companyId,
  373. companyUserId: this.user.userId,
  374. endTime: '',
  375. startTime: '',
  376. courseId: this.courseid,
  377. videoId: this.courseids,
  378. type: this.user.userType == '00' ? 0 : 1, // 0:经销商/1:群管
  379. }
  380. getcourseRate(params).then(res => {
  381. if (res.code == 200) {
  382. this.getrateimg = res
  383. } else {
  384. uni.showToast({
  385. icon: 'none',
  386. title: res.msg
  387. })
  388. }
  389. })
  390. },
  391. getredbaglist() {
  392. //红包统计
  393. const params = {
  394. companyId: this.user.companyId,
  395. companyUserId: this.user.userId,
  396. type: this.user.userType == '00' ? 0 : 1, // 0:经销商/1:群管
  397. courseId: this.courseid,
  398. videoId: this.courseids,
  399. endTime: '',
  400. startTime: '',
  401. }
  402. getRecPacketCount(params).then(res => {
  403. if (res.code == 200) {
  404. // console.log(res)
  405. this.redbaglist = res.data
  406. } else {
  407. uni.showToast({
  408. icon: 'none',
  409. title: res.msg
  410. })
  411. }
  412. })
  413. },
  414. getquslist() {
  415. //答题统计
  416. const params = {
  417. companyId: this.user.companyId,
  418. companyUserId: this.user.userId,
  419. type: this.user.userType == '00' ? 0 : 1, // 0:经销商/1:群管
  420. courseId: this.courseid,
  421. videoId: this.courseids,
  422. endTime: '',
  423. startTime: '',
  424. }
  425. getQuesCount(params).then(res => {
  426. if (res.code == 200) {
  427. // console.log(res)
  428. this.answerlist = res.data
  429. } else {
  430. uni.showToast({
  431. icon: 'none',
  432. title: res.msg
  433. })
  434. }
  435. })
  436. },
  437. getCoursestatistics() {
  438. //课程统计
  439. const params = {
  440. companyId: this.user.companyId,
  441. companyUserId: this.user.userId,
  442. type: this.user.userType == '00' ? 0 : 1, // 0:经销商/1:群管
  443. courseId: this.courseid,
  444. // videoId:this.courseids,
  445. endTime: '',
  446. startTime: '',
  447. }
  448. getshopCoursenum(params).then(res => {
  449. if (res.code == 200) {
  450. // console.log(res)
  451. this.courselist = res.data
  452. } else {
  453. uni.showToast({
  454. icon: 'none',
  455. title: res.msg
  456. })
  457. }
  458. })
  459. },
  460. pullDownRefresh() {
  461. // 下拉
  462. this.triggered = true; //下拉了状态为true
  463. setTimeout(() => {
  464. this.triggered = false;
  465. uni.stopPullDownRefresh()
  466. this.pageNum = 1;
  467. this.getCourseListsmall('refresh') //触底 不穿执行else
  468. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  469. // 请求接口
  470. }, 1000)
  471. },
  472. reachBottom() {
  473. // status这个是加载状态
  474. console.log(111);
  475. if (this.status === 'loadmore') {
  476. this.status = 'loading'
  477. uni.showNavigationBarLoading()
  478. setTimeout(() => {
  479. this.pageNum++
  480. this.getCourseListsmall() //触底 不穿执行else
  481. uni.hideNavigationBarLoading()
  482. }, 1000);
  483. }
  484. },
  485. getCourseOne(id) {
  486. this.courseid = id
  487. },
  488. getCourseTwo(id) {
  489. this.courseids = id
  490. },
  491. getCourseList() {
  492. const param = {
  493. companyId: this.user.companyId,
  494. companyUserId: this.user.userId,
  495. type: this.user.userType == '00' ? 0 : 1, // 0:经销商/1:群管
  496. }
  497. getFsCourseList(param).then(res => {
  498. if (res.code == 200) {
  499. this.courseOne = res.data
  500. // console.log(res)
  501. } else {
  502. uni.showToast({
  503. icon: 'none',
  504. title: res.msg
  505. })
  506. }
  507. })
  508. },
  509. getCourseListsmall(type) {
  510. const param = {
  511. courseId: this.courseid,
  512. pageNum: this.pageNum,
  513. pageSize: this.pageSize, //
  514. status: ''
  515. }
  516. getCourseVdieoList(param).then(res => {
  517. if (res.code == 200) {
  518. // refresh 下拉
  519. if (type == 'refresh') {
  520. this.courseTwo = res.data.list
  521. } else {
  522. // 加载更多 当前页和下一页合并
  523. this.courseTwo = [...this.courseTwo, ...res.data.list]
  524. }
  525. if (this.pageNum >= res.data.pages) {
  526. this.status = 'nomore'
  527. } else {
  528. this.status = 'loadmore'
  529. }
  530. } else {
  531. }
  532. })
  533. },
  534. changeCollapse(e) {
  535. this.collapseValue = e.filter(item => item.status == 'open').map(it => it.name)
  536. },
  537. handleNav(type) {
  538. this.activeTab = type
  539. },
  540. onChange(index) {
  541. this.searchbarNav = index
  542. if (index == 0) {
  543. this.getCourseList()
  544. } else {
  545. this.pageNum = 1
  546. if (this.courseid == 0) {
  547. uni.showToast({
  548. icon: 'none',
  549. title: "请先选择训练营-营期"
  550. })
  551. } else {
  552. this.getCourseListsmall('refresh')
  553. }
  554. }
  555. },
  556. confirm() {
  557. this.getCoursestatistics()
  558. this.getquslist()
  559. this.getredbaglist()
  560. this.getrateList()
  561. this.getrankgroup()
  562. this.getrankCourse()
  563. },
  564. reset() {
  565. console.log(this.searchbarNav)
  566. if (this.searchbarNav == 0) {
  567. this.courseid = ''
  568. } else {
  569. this.courseids = ''
  570. }
  571. },
  572. clickTab(item) {
  573. this.activeA = item.index + 1
  574. this.getrankgroup()
  575. console.log(this.activeA)
  576. },
  577. clickTabB(item) {
  578. this.activeB = item.index + 1
  579. this.getrankCourse()
  580. console.log(this.activeA)
  581. },
  582. }
  583. }
  584. </script>
  585. <style lang="scss" scoped>
  586. .headnav {
  587. padding: 15px 12px;
  588. margin: 0 -10px -10px 0;
  589. box-sizing: border-box;
  590. background-color: #fff;
  591. image {
  592. height: 60px;
  593. width: 50px;
  594. position: absolute;
  595. z-index: 0;
  596. bottom: 0;
  597. right: 0;
  598. display: none;
  599. }
  600. &-item {
  601. flex: 1;
  602. font-size: 16px;
  603. padding: 10px;
  604. border-radius: 10px;
  605. background: #f8f8f8;
  606. margin: 0 10px 10px 0;
  607. position: relative;
  608. z-index: 1;
  609. overflow: hidden;
  610. color: #555;
  611. }
  612. &-active {
  613. background-color: rgb(231, 241, 255) !important;
  614. .headnav-num {
  615. color: #1677ff !important;
  616. }
  617. image {
  618. display: block !important;
  619. }
  620. }
  621. &-num {
  622. font-family: DIN, DIN;
  623. font-weight: bold;
  624. font-size: 25px;
  625. margin: 5px 0;
  626. }
  627. }
  628. .actNav {
  629. color: #1677ff !important;
  630. background-color: #e7f2fe;
  631. }
  632. </style>