| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <template>
- <view class="course-send-container">
- <view class="course-list" v-if="courseList.length>0">
- <view v-for="(item, index) in courseList" :key="index" class="course-item">
- <view class="course-content es-mr-10">
- <view class="course-desc textTwo">{{ item.dictLabel }}
- </view>
- </view>
- <view class="send-button es-fs-28 u-f-ajc" @tap="sendCourseAppFun(item)">发送</view>
- </view>
- </view>
- <u-empty style="padding-top: 20vh;" mode="data" v-else="imgurl"
- icon="https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png" text="暂无数据"></u-empty>
- </view>
- </template>
- <script>
- import {
- getVideoListByCourse,
- sendCourseApp
- } from '@/api/course.js'
- export default {
- data() {
- return {
- courseList: [],
- courseId: null,
- corpId: null,
- qwUserId: null,
- sendUserId: null,
- };
- },
- onLoad(options) {
- if (options.sendUserId) {
- this.sendUserId = options.sendUserId
- }
- if (options.id) {
- this.courseId = options.id
- this.getVideoListByCourseFun(options.id)
- }
- if (options.corpId) {
- this.corpId = options.corpId
- }
- if (options.qwUserId) {
- this.qwUserId = options.qwUserId
- }
- },
- methods: {
- async getVideoListByCourseFun(id) {
- const res = await getVideoListByCourse(id)
- if (res.code == 200) {
- this.courseList = res.list
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- },
- async sendCourseAppFun(e) {
- let params = {
- userId: this.sendUserId,
- courseId: this.courseId,
- videoId: e.dictValue,
- companyUserId: uni.getStorageSync('companyUserId') || '',
- qwUserId: this.qwUserId,
- corpId: this.corpId
- }
- const res = await sendCourseApp(params)
- if (res.code == 200) {
- uni.showToast({
- icon: 'none',
- title: '发送成功!'
- })
- setTimeout(() => {
- uni.navigateBack({
- delta: 2
- })
- }, 1000)
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- }
- }
- };
- </script>
- <style lang="scss">
- .course-send-container {
- padding: 20rpx;
- .course-list {
- .course-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx;
- background-color: #fff;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- .course-content {
- flex: 1;
- .course-title {
- font-size: 32rpx;
- font-weight: bold;
- }
- .course-desc {
- font-size: 28rpx;
- color: #222222;
- }
- }
- .send-button {
- width: 104rpx;
- height: 56rpx;
- background-color: #ff7f00;
- color: #fff;
- border-radius: 30rpx;
- }
- }
- }
- }
- </style>
|