|
|
@@ -293,6 +293,12 @@
|
|
|
<el-tag type="danger">{{ parseTime(scope.row.lastJoinTime, '{h}:{i}:{s}') }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" type="text" @click="copyCourseSortLink(scope.row)"
|
|
|
+ >复制短链</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="课程统计" name="statistics">
|
|
|
@@ -330,7 +336,7 @@ import {
|
|
|
updateCourseDate,
|
|
|
updateListCourseData,
|
|
|
periodCourseMove,
|
|
|
- closePeriod
|
|
|
+ closePeriod,courseSortLink
|
|
|
} from "@/api/course/userCoursePeriod";
|
|
|
import {getCompanyList} from "@/api/company/company";
|
|
|
import {courseList, videoList} from '@/api/course/courseRedPacketLog'
|
|
|
@@ -339,6 +345,16 @@ import BatchRedPacket from './batchRedPacket.vue'
|
|
|
import CourseStatistics from './statistics.vue'
|
|
|
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ companyId: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ companyUserId: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
name: "Period",
|
|
|
components: {
|
|
|
RedPacket,
|
|
|
@@ -470,6 +486,76 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ copyCourseSortLink(row) {
|
|
|
+ this.imSendForm = {
|
|
|
+ userIds: this.userIds,
|
|
|
+ companyUserId: this.companyUserId,
|
|
|
+ companyId: this.companyId,
|
|
|
+ id: row.id,
|
|
|
+ periodId: row.periodId,
|
|
|
+ courseId: row.courseId,
|
|
|
+ videoId: row.videoId,
|
|
|
+ projectId: row.projectId,
|
|
|
+ }
|
|
|
+ courseSortLink(this.imSendForm).then(res => {
|
|
|
+ // 假设返回的URL在res.data或res.url中,根据你的API调整
|
|
|
+ const url = res.data || res.url;
|
|
|
+
|
|
|
+ if (url) {
|
|
|
+ // 方法1: 使用现代Clipboard API(推荐)
|
|
|
+ if (navigator.clipboard && window.isSecureContext) {
|
|
|
+ navigator.clipboard.writeText(url)
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success('链接已复制到剪贴板');
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error('复制失败:', err);
|
|
|
+ this.fallbackCopyText(url); // 降级方案
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 方法2: 降级方案 - 使用document.execCommand
|
|
|
+ this.fallbackCopyText(url);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('未获取到链接');
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('获取链接失败:', error);
|
|
|
+ this.$message.error('获取链接失败');
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+// 降级复制方法
|
|
|
+ fallbackCopyText(text) {
|
|
|
+ const textArea = document.createElement('textarea');
|
|
|
+ textArea.value = text;
|
|
|
+
|
|
|
+ // 避免屏幕滚动
|
|
|
+ textArea.style.position = 'fixed';
|
|
|
+ textArea.style.left = '-999999px';
|
|
|
+ textArea.style.top = '-999999px';
|
|
|
+ document.body.appendChild(textArea);
|
|
|
+ textArea.focus();
|
|
|
+ textArea.select();
|
|
|
+
|
|
|
+ try {
|
|
|
+ const successful = document.execCommand('copy');
|
|
|
+ if (successful) {
|
|
|
+ this.$message.success('链接已复制到剪贴板');
|
|
|
+ } else {
|
|
|
+ this.$message.error('复制失败,请手动复制');
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.error('复制失败:', err);
|
|
|
+ this.$message.error('复制失败,请手动复制');
|
|
|
+ }
|
|
|
+
|
|
|
+ document.body.removeChild(textArea);
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/** 查询会员营期列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
@@ -1144,6 +1230,8 @@ export default {
|
|
|
},
|
|
|
handlePeriodSettings(row) {
|
|
|
this.periodSettingsData = row;
|
|
|
+ this.companyId = row.companyId;
|
|
|
+ this.companyUserId = row.companyUserId;
|
|
|
this.periodSettingsVisible = true;
|
|
|
// 初始化课程列表
|
|
|
this.course.queryParams.periodId = row.periodId;
|