123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544 |
- <template>
- <view class="container">
- <view class="headbox">
- <dropdownPanel :filterData='filterData' @onChange="onChange" @confirm="confirm" @reset="reset">
- <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
- :refresher-triggered="triggereds" refresher-background="rgba(0,0,0,0)"
- @refresherrefresh="pullDownRefreshs" @refresherrestore="triggereds = false"
- :upper-threshold="100" :lower-threshold="100" @refresherabort="triggereds = false"
- @scrolltolower="reachBottoms">
- <view class="justify-between align-center mb20 mlr20 ">
- <!-- <u-search placeholder="请输入课程名称" v-model="keyword" :showAction="false" height="30px"
- @search='searchKeyword'></u-search> -->
- </view>
- <view v-if="searchbarNav == 0">
- <view class="boxnav x-bc">
- <view class="boxnav-item" v-for="(item,index) in courseList" :key="index">
- <view class="boxnav-item-info one-t "
- :class="courserIndex == index ? 'boxnav-active':''"
- @click="handleCourse(item,index)">{{item.courseName}}</view>
- </view>
- </view>
- </view>
- <u-loadmore :status="status" />
- </scroll-view>
- </dropdownPanel>
- </view>
- <view class="justify-between align-center mb20 mlr20 mt20 ">
- <u-search placeholder="请输入课程小节名称" v-model="keywordlist" :showAction="false" height="30px"
- @search='searchKeywordlist' bgColor='#fff'></u-search>
- </view>
- <view class="container-right" >
- <!-- <view>首次进入页面{{msg122}}</view>
- <view>课程接口{{msg123}}</view>
- <view>课程小节接口{{msg124}}</view> -->
- <scroll-view style="height:100%" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="triggered"
- refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefresh" :scroll-top='scrollTop'
- @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
- @refresherabort="triggered = false" @scrolltolower="reachBottom" @scroll="scroll">
- <view class="list">
- <courseItem :from="'course'" :activeTab="1" v-for="(item,index) in dataList" :key="index"
- :info="item" :parent-method="parentMethod" :config="configadk" @child-click="handleChildClick"/>
- <u-loadmore :status="loadStatus" />
- </view>
- </scroll-view>
- <u-popup :show="showShare" :closeOnClickOverlay="true" :round='20' @close="closeShare">
- <view class="sharePop x-ac">
- <view class="sharePop-item y-f" @click="sendInput()">
- <image src="@/static/images/link_icon.png" mode="aspectFill"></image>
- <view style="font-weight: bold;margin-bottom: 4px;">发送课程</view>
- <view style="font-size: 12px;color: #888;">一键发送到输入框</view>
- </view>
- </view>
- </u-popup>
- </view>
- </view>
- </template>
- <script>
- import {
- getFsCourseList,
- createPhoneLink
- } from "@/api/courseManage.js"
- import {
- getOperationlist,
- getcourselist
- } from "@/api/user.js";
- import dropdownPanel from "@/components/dropdownPanel.vue"
- import courseItem from "@/components/courseItem.vue"
- export default {
- name:"liveCourse",
- components: {
- courseItem,
- dropdownPanel
- },
- props: ['parentMethod'],
- data() {
- return {
- user: {},
- filterData: [{
- name: '请点击选择课程',
- value: 0,
- },
- ],
- contentH: 0,
- activeTab: 1,
- courseList: [],
- courseId: '',
- searchbarNav: 0,
- courserIndex: '',
- searchbar: [{
- name: '训练营-营期'
- },
- {
- name: '课程状态'
- }
- ],
- mescroll: null,
- downOption: {
- use: true,
- auto: false
- },
- dataList: [],
- params: {
- pageNum: 1,
- pageSize: 10
- },
- triggered: false,
- loadStatus: 'loadmore',
- pageNum:1,
- pageSize: 10,
- triggereds: false,
- status: 'loadmore',
- keyword:'',
- isEnableds:true,
- keywordlist:'',
- actid:'',
- scrollTop: 0,
- old: {
- scrollTop: 0
- },
- shareConfig:'',
- selname:'',
- qwUserId:'',
- url:'',
- configadk:{},
- showShare:false,
- agentConfigSignature:'',
- configSignature:"",
- configSignature:'',
- nonceStr:'',
- corpId:'',
- timestamp:"",
- agentId:"",
- code:"",
- info:{},
- msg122:'',
- msg123:'',
- msg124:''
- }
- },
- onLoad(options) {
- this.qwUserId=options.userId
- this.url=window.location.href;
- this.code=options.code;
- this.msg122=uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
- },
- mounted() {
- const windowHeight = uni.getSystemInfoSync().windowHeight
- this.contentH = `calc(${windowHeight}px - 132px - 56px)`
- this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
- this.getFsCourseList()
- },
- methods: {
- // 判断是否为手机端企业微信
- isMobileQyWechat() {
- const ua = navigator.userAgent.toLowerCase();
- return ua.indexOf('mobile') > -1;
- },
- sendInput(){
- this.setupMobileShare()
- },
- setupMobileShare() {
- uni.showLoading({
- title: '加载中'
- });
- var corpId=uni.getStorageSync("corpId");
- var qwUserId=uni.getStorageSync("qwUserId");
- var qwarrid=uni.getStorageSync("qwarrid");
- var fsUserId=uni.getStorageSync("fsUserId");
- const param = {
- videoId:this.info.videoId,
- corpId:corpId,
- qwUserId:qwUserId,
- courseId:this.info.courseId,
- title:this.info.title,
- externalUserId:qwarrid,
- fsUserId:fsUserId,
- }
- createPhoneLink(param).then(res=>{
- if(res.code==200){
- uni.hideLoading()
- setTimeout(() => {
- uni.$emit('course', res.data);
- // uni.$emit('course', this.configadk);
- uni.navigateBack({
- delta: 1
- });
- }, 200);
- }
- // wx.shareAppMessage({
- // // title: res.data.linkTitle,
- // // desc: res.data.linkDescribe,
- // // link: res.data.linkUrl,
- // // imgUrl: res.data.linkImageUrl,
- // })
- })
- },
- handleChildClick(params) { // 接收子组件传递的参数
- if (this.isMobileQyWechat()) {
- // console.log(11111122222)
- // this.setupMobileShare(); // 手机端调用 JS-SDK 分享
- // console.log('父组件方法被调用了', params);
- this.showShare=params.show
- this.info=params.list
- }
- },
- closeShare() {
- this.showShare = false
- },
- scroll: function(e) {
- this.old.scrollTop = e.detail.scrollTop
- },
- onChange(index) {
- this.searchbarNav = index
- },
- reset() {
- this.courseId = ''
- this.keyword=''
- this.courseList=[]
- this.getFsCourseList()
- },
- handleCourse(item,index) {
- console.log(index)
- this.courserIndex = index
- this.actid=item.courseId
- this.selname=item.courseName
- },
- confirm() {
- if(this.actid==''){
-
- }else{
- this.courseId = this.actid
- }
- this.params.pageNum=1
- this.filterData[0].name=this.selname
- this.dataList=[]
- this.getListData()
- },
- searchKeyword(value){
- this.courseList=[]
- this.keyword = value
- this.getFsCourseList()
- },
- searchKeywordlist(value){
- this.dataList=[]
- this.keywordlist = value
- this.getListData()
- },
- pullDownRefreshs() {
- this.triggereds = true; //下拉了状态为true
- setTimeout(() => {
- this.triggereds = false;
- uni.stopPullDownRefresh()
- this.pageNum = 1;
- this.getFsCourseList('refresh') //触底 不穿执行else
- }, 1000)
- },
- reachBottoms() {
- if (this.status === 'loadmore') {
- this.status = 'loading'
- uni.showNavigationBarLoading()
- setTimeout(() => {
- this.pageNum++
- this.getFsCourseList() //触底 不穿执行else
- uni.hideNavigationBarLoading()
- }, 1000);
- }
- },
- getFsCourseList(type) {
- const day = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
- const param = {
- pageNum:this.pageNum,
- pageSize:this.pageSize,
- keyword:this.keyword,
- // companyId: 11,
- corpId:uni.getStorageSync("corpId"),
- qwUserId:uni.getStorageSync('qwUserId'),
- // corpId:'ww44239b22628b206c',
- // qwUserId:'ZhaoGuangDong_3',
-
- }
- getOperationlist(param).then(res => {
- if (res.code == 200) {
- this.msg123=uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
- if (type == 'refresh') {
- this.courseList = res.data.list
- } else {
- this.courseList = [...this.courseList, ...res.data.list]
- }
- if ( res.data.isLastPage) {
- this.status = 'nomore'
- } else {
- this.status = 'loadmore'
- // this.filterData[0].name=this.courseList[0].courseName
- }
- this.selname=this.courseList[0].courseName
- this.courseId=this.courseList[0].courseId
- console.log(this.courseId)
- setTimeout(()=>{
- this.getListInit()
- },100)
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- })
- },
- handleNav(type) {
- this.activeTab = type
- },
- clickSearchbar(type) {
- this.searchbarNav = type == this.searchbarNav ? 'colse' : type
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- getListInit() {
- this.params.pageNum = 1
- this.getListData('refresh')
- },
- getListData(type) {
- uni.showLoading({
- title: "加载中..."
- })
- this.loadStatus = 'loading'
- console.log(this.courseId)
- const param ={
- keyword:this.keywordlist,
- corpId:uni.getStorageSync("corpId"),
- qwUserId:uni.getStorageSync('qwUserId'),
- // corpId:'ww44239b22628b206c',
- // qwUserId:"ZhaoGuangDong_3",
- courseId:this.courseId,
- ...this.params
- }
- getcourselist(param).then(res => {
- uni.hideLoading()
- if(res.code==200){
- this.msg124=uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
- if (type == 'refresh') {
- this.dataList = res.data.list
- } else {
- this.dataList = [...this.dataList, ...res.data.list]
- }
- if (res.data.isLastPage) {
- this.loadStatus = 'nomore';
- } else {
- this.loadStatus = 'loadmore';
- }
- if (this.params.pageNum === 1) {
- this.scrollTop = this.old.scrollTop
- this.$nextTick(function() {
- this.scrollTop = 0
- });
- }
- }else{
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- })
- },
- reachBottom(options) {
- if (this.loadStatus === 'loadmore') {
- this.loadStatus = 'loading'
- uni.showNavigationBarLoading()
- setTimeout(() => {
- this.params.pageNum += 1;
- this.getListData('more')
- uni.hideNavigationBarLoading()
- }, 500);
- }
- },
- pullDownRefresh(options) {
- this.triggered = true;
- setTimeout(() => {
- this.triggered = false;
- uni.stopPullDownRefresh()
- this.params.pageNum = 1;
- this.getListData('refresh')
- }, 500)
- }
- }
- }
- </script>
- <style lang="scss">
- page{
- background-color: #F5F7FA;
- }
- .container {
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 14px;
- color: #222;
- display: flex;
- flex-direction: column;
- /* #ifdef MP-WEIXIN */
- height: 100vh;
- /* #endif */
- }
- .sharePop {
- background-color: #fff;
- padding: 20px 0;
- // padding-bottom: 100px;
- border-radius: 20px 20px 0 0;
-
- &-item {
- padding: 0 10px;
- box-sizing: border-box;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 14px;
- display: inline-flex !important;
-
- image {
- height: 48px;
- width: 48px;
- margin-bottom: 10px;
- }
- }
- }
- .boxnav {
- flex-wrap: wrap;
- padding: 0 0 0 10px;
- &-item {
- width: 100%;
- overflow: hidden;
- }
- &-item-info {
- border: 1px solid #f5f5f5;
- text-align: center;
- color: #222;
- background-color: #f5f5f5;
- border-radius: 3px;
- padding: 5px;
- margin: 0 10px 10px 0;
- }
- &-active {
- border: 1px solid #1677ff !important;
- color: #1677ff !important;
- background-color: #e7f1fe !important;
- }
- }
- .headbox {
- background-color: #fff;
- }
- .headnav {
- padding: 15px 12px;
- margin: 0 -10px -10px 0;
- box-sizing: border-box;
- image {
- height: 60px;
- width: 50px;
- position: absolute;
- z-index: 0;
- bottom: 0;
- right: 0;
- display: none;
- }
- &-item {
- flex: 1;
- font-size: 16px;
- padding: 10px;
- border-radius: 10px;
- background: #f5f5f5;
- margin: 0 10px 10px 0;
- position: relative;
- z-index: 1;
- overflow: hidden;
- color: #555;
- }
- &-active {
- background-color: rgb(231, 241, 255) !important;
- .headnav-num {
- color: #1677ff !important;
- }
- image {
- display: block !important;
- }
- }
- &-num {
- font-family: DIN, DIN;
- font-weight: bold;
- font-size: 25px;
- margin: 5px 0;
- }
- }
- .searchbar {
- flex: 1;
- padding-bottom: 10px;
- .arrow-down {
- margin-left: 5px;
- }
- &-active {
- color: #1677ff !important;
- .arrow-down {
- transform: rotate(180deg);
- }
- }
- }
- .coursebox {
- position: relative;
- overflow-y: auto;
- box-sizing: border-box;
- }
- .courselist {
- padding: 12px;
- box-sizing: border-box;
- }
- .container-right {
- flex: 1;
- height: calc(100% - 80rpx);
- overflow-y: scroll;
- // padding-bottom: 80rpx;
- .list {
- padding: 10px;
- box-sizing: border-box;
- width: 100%;
- }
- }
- </style>
|