index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="营期名称" prop="periodName">
  5. <el-input
  6. v-model="queryParams.periodName"
  7. placeholder="请输入营期名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="开营日期开始" prop="periodStartingTime" label-width="120px">
  14. <el-date-picker clearable size="small" style="width: 200px"
  15. v-model="queryParams.periodStartingTime"
  16. type="date"
  17. value-format="yyyy-MM-dd"
  18. placeholder="请选择开营日期开始时间">
  19. </el-date-picker>
  20. </el-form-item>
  21. <el-form-item label="开营日期结束" prop="periodEndTime" label-width="120px">
  22. <el-date-picker clearable size="small" style="width: 300px"
  23. v-model="queryParams.periodEndTime"
  24. type="date"
  25. value-format="yyyy-MM-dd"
  26. placeholder="请选择开营日期结束时间">
  27. </el-date-picker>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  31. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  32. </el-form-item>
  33. </el-form>
  34. <el-row :gutter="10" class="mb8">
  35. <!-- <el-col :span="1.5">-->
  36. <!-- <el-button-->
  37. <!-- type="primary"-->
  38. <!-- plain-->
  39. <!-- icon="el-icon-plus"-->
  40. <!-- size="mini"-->
  41. <!-- @click="handleAdd"-->
  42. <!-- v-hasPermi="['course:period:add']"-->
  43. <!-- >新增-->
  44. <!-- </el-button>-->
  45. <!-- </el-col>-->
  46. <!-- <el-col :span="1.5">-->
  47. <!-- <el-button-->
  48. <!-- type="warning"-->
  49. <!-- plain-->
  50. <!-- icon="el-icon-download"-->
  51. <!-- size="mini"-->
  52. <!-- @click="handleExport"-->
  53. <!-- v-hasPermi="['course:period:export']"-->
  54. <!-- >导出-->
  55. <!-- </el-button>-->
  56. <!-- </el-col>-->
  57. <!-- <el-col :span="1.5">-->
  58. <!-- <el-button-->
  59. <!-- type="primary"-->
  60. <!-- plain-->
  61. <!-- icon="el-icon-edit"-->
  62. <!-- size="mini"-->
  63. <!-- @click="handleBatchSetRedPacket"-->
  64. <!-- v-hasPermi="['course:period:export']"-->
  65. <!-- :disabled="batchSetRedPacketDisabled"-->
  66. <!-- >批量设置红包-->
  67. <!-- </el-button>-->
  68. </el-col>
  69. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  70. </el-row>
  71. <el-table v-loading="loading" :data="periodList" @selection-change="handleSelectionChange">
  72. <el-table-column type="selection" width="55" align="center"/>
  73. <el-table-column label="营期名称" align="center" prop="periodName"/>
  74. <el-table-column label="营期状态" align="center" prop="periodStatus" width="100"
  75. :formatter="periodStatusFormatter"/>
  76. <el-table-column label="开营开始时间" align="center" prop="periodStartingTime" width="180"/>
  77. <el-table-column label="开营结束时间" align="center" prop="periodEndTime" width="180"/>
  78. <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
  79. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  80. <template slot-scope="scope">
  81. <el-button
  82. size="mini"
  83. type="text"
  84. icon="el-icon-edit"
  85. @click="handleUpdate(scope.row)"
  86. v-hasPermi="['course:period:edit']"
  87. >详情
  88. </el-button>
  89. <el-button
  90. size="mini"
  91. type="text"
  92. icon="el-icon-setting"
  93. @click="handlePeriodSettings(scope.row)"
  94. >营期相关设置
  95. </el-button>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <pagination
  100. v-show="total>0"
  101. :total="total"
  102. :page.sync="queryParams.pageNum"
  103. :limit.sync="queryParams.pageSize"
  104. @pagination="getList"
  105. />
  106. <!-- 添加或修改会员营期对话框-->
  107. <el-drawer :title="title" :visible.sync="open" size="700px" append-to-body>
  108. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  109. <el-form-item label="营期名称" prop="periodName">
  110. <el-input disabled v-model="form.periodName" placeholder="请输入营期名称"/>
  111. </el-form-item>
  112. <el-form-item label="课程风格" prop="courseStyle">
  113. <image-upload disabled v-model="form.courseStyle" :limit="1"/>
  114. </el-form-item>
  115. <el-form-item label="直播间风格" prop="liveRoomStyle">
  116. <image-upload disabled v-model="form.liveRoomStyle" :limit="1"/>
  117. </el-form-item>
  118. <el-form-item label="红包发放方式" prop="redPacketGrantMethod">
  119. <el-radio-group disabled v-model="form.redPacketGrantMethod">
  120. <el-radio :label="1">按课程</el-radio>
  121. <el-radio :label="2">按营期</el-radio>
  122. </el-radio-group>
  123. </el-form-item>
  124. <el-form-item label="营期类型" prop="periodType">
  125. <el-radio-group disabled v-model="form.periodType">
  126. <el-radio :label="1">多课程</el-radio>
  127. <el-radio :label="2">单课程</el-radio>
  128. </el-radio-group>
  129. </el-form-item>
  130. <el-form-item label="开营日期" prop="periodStartingTime">
  131. <el-date-picker
  132. disabled
  133. :style="{display: form.periodType == 1 ? '' : 'none !important'}"
  134. v-model="form.dateRange"
  135. @change="timeChange(1)"
  136. type="daterange"
  137. range-separator="至"
  138. start-placeholder="开始日期"
  139. end-placeholder="结束日期"
  140. value-format="yyyy-MM-dd">
  141. </el-date-picker>
  142. <el-date-picker
  143. disabled
  144. :style="{display: form.periodType == 2 ? '' : 'none !important'}"
  145. @change="timeChange(2)"
  146. v-model="form.date"
  147. type="date"
  148. value-format="yyyy-MM-dd"
  149. placeholder="选择日期">
  150. </el-date-picker>
  151. </el-form-item>
  152. </el-form>
  153. </el-drawer>
  154. <!-- 添加训练营对话框 -->
  155. <el-dialog :title="campForm.trainingCampId ? '修改训练营' : '新建训练营'" :visible.sync="campDialogVisible"
  156. width="500px" append-to-body>
  157. <el-form ref="campForm" :model="campForm" :rules="campRules" label-width="100px">
  158. <el-form-item label="训练营名称" prop="trainingCampName">
  159. <el-input v-model="campForm.trainingCampName" placeholder="请输入训练营名称"/>
  160. </el-form-item>
  161. </el-form>
  162. <div slot="footer" class="dialog-footer">
  163. <el-button type="primary" @click="submitCampForm">确 定</el-button>
  164. <el-button @click="cancelCampForm">取 消</el-button>
  165. </div>
  166. </el-dialog>
  167. <!-- 添加课程对话框-->
  168. <el-dialog title="添加课程" :visible.sync="course.addOpen" width="500px" append-to-body>
  169. <el-form ref="courseAddForm" :model="course.form" label-width="100px">
  170. <el-form-item label="课程" prop="courseId">
  171. <el-select filterable v-model="course.form.courseId" placeholder="请选择课程" clearable size="small"
  172. @change="courseChange(course.form.courseId)" style="width: 100%" :value-key="'dictValue'">
  173. <el-option
  174. v-for="dict in courseList"
  175. :key="dict.dictValue"
  176. :label="dict.dictLabel"
  177. :value="parseInt(dict.dictValue)"
  178. />
  179. </el-select>
  180. </el-form-item>
  181. <el-form-item label="小节" prop="videoId">
  182. <el-select filterable v-model="course.form.videoIds" placeholder="请选择小节"
  183. :multiple-limit="getDiff(course.row.periodStartingTime, course.row.periodEndTime) - course.total"
  184. multiple clearable size="small" style="width: 100%" :value-key="'dictValue'">
  185. <el-option
  186. v-for="dict in videoList"
  187. :key="dict.dictValue"
  188. :label="dict.dictLabel"
  189. :value="parseInt(dict.dictValue)"
  190. />
  191. </el-select>
  192. </el-form-item>
  193. </el-form>
  194. <div slot="footer" class="dialog-footer">
  195. <el-button type="primary" @click="submitCourseForm">确 定</el-button>
  196. <el-button @click="closeAddCourse">取 消</el-button>
  197. </div>
  198. </el-dialog>
  199. <el-dialog title="修改看课时间" :visible.sync="updateCourse.open" width="500px" append-to-body>
  200. <el-form ref="courseUpdateForm" :model="updateCourse.form" label-width="100px">
  201. <el-form-item label="看课时间" prop="timeRange">
  202. <el-time-picker
  203. is-range
  204. v-model="updateCourse.form.timeRange"
  205. range-separator="至"
  206. start-placeholder="开始时间"
  207. value-format="HH:mm:ss"
  208. end-placeholder="结束时间"
  209. placeholder="选择时间范围">
  210. </el-time-picker>
  211. </el-form-item>
  212. <el-form-item label="领取红包时间" prop="lastJoinTime">
  213. <el-time-picker
  214. v-model="updateCourse.form.joinTime"
  215. :selectableRange="updateCourse.form.timeRange"
  216. value-format="HH:mm:ss"
  217. placeholder="选择时间范围">
  218. </el-time-picker>
  219. <p style="color: red;margin: 0;font-size: 12px">超过领取红包时间,只允许看课,不允许领取红包</p>
  220. </el-form-item>
  221. </el-form>
  222. <div slot="footer" class="dialog-footer">
  223. <el-button type="primary" @click="submitUpdateCourseForm">确 定</el-button>
  224. <el-button @click="closeUpdateCourse">取 消</el-button>
  225. </div>
  226. </el-dialog>
  227. <el-dialog title="修改营期时间" :visible.sync="updateDateOpen" width="500px" append-to-body>
  228. <el-form ref="courseUpdateForm" :model="form" label-width="100px">
  229. <el-form-item label="营期时间" prop="dayDate">
  230. <el-date-picker
  231. v-model="form.dayDate"
  232. :selectableRange="form.dayDate"
  233. value-format="yyyy-MM-dd"
  234. type="date"
  235. placeholder="选择时间">
  236. </el-date-picker>
  237. </el-form-item>
  238. </el-form>
  239. <div slot="footer" class="dialog-footer">
  240. <el-button type="primary" @click="updateDate">确 定</el-button>
  241. <el-button @click="updateDateOpen = false">取 消</el-button>
  242. </div>
  243. </el-dialog>
  244. <!-- <red-packet-->
  245. <!-- :visible.sync="redPacketVisible"-->
  246. <!-- :periodId="currentRedPacketData.periodId"-->
  247. <!-- :videoId="currentRedPacketData.videoId"-->
  248. <!-- @success="handleRedPacketSuccess"-->
  249. <!-- />-->
  250. <!-- 营期相关设置抽屉 -->
  251. <el-drawer
  252. title="营期相关设置"
  253. :visible.sync="periodSettingsVisible"
  254. direction="rtl"
  255. size="70%"
  256. :destroy-on-close="true"
  257. append-to-body
  258. custom-class="period-settings-drawer"
  259. >
  260. <div class="drawer-content" style="margin-left: 25px">
  261. <el-tabs v-model="activeTab" @tab-click="handleTabClick">
  262. <el-tab-pane label="课程管理" name="course">
  263. <el-table v-loading="course.loading" :data="course.list" @selection-change="handleSelectionCourseChange">
  264. <el-table-column label="课程" align="center" prop="courseName" width="180"/>
  265. <el-table-column label="小节" align="center" prop="videoName"/>
  266. <el-table-column label="营期时间" align="center" prop="dayDate"/>
  267. <el-table-column label="开始时间" align="center" prop="startDateTime" width="100">
  268. <template slot-scope="scope">
  269. <el-tag>{{ parseTime(scope.row.startDateTime, '{h}:{i}:{s}') }}</el-tag>
  270. </template>
  271. </el-table-column>
  272. <el-table-column label="结束时间" align="center" prop="endDateTime" width="100">
  273. <template slot-scope="scope">
  274. <el-tag type="success">{{ parseTime(scope.row.endDateTime, '{h}:{i}:{s}') }}</el-tag>
  275. </template>
  276. </el-table-column>
  277. <el-table-column label="领取红包时间" align="center" prop="lastJoinTime" width="100">
  278. <template slot-scope="scope">
  279. <el-tag type="danger">{{ parseTime(scope.row.lastJoinTime, '{h}:{i}:{s}') }}</el-tag>
  280. </template>
  281. </el-table-column>
  282. </el-table>
  283. </el-tab-pane>
  284. <el-tab-pane label="课程统计" name="statistics">
  285. <course-statistics
  286. :periodId="periodSettingsData.periodId"
  287. :active="activeTab === 'statistics'"
  288. />
  289. </el-tab-pane>
  290. </el-tabs>
  291. </div>
  292. </el-drawer>
  293. <batch-red-packet
  294. :visible.sync="batchRedPacketVisible"
  295. :selected-data="selectedPeriods"
  296. @success="handleBatchRedPacketSuccess"
  297. />
  298. </div>
  299. </template>
  300. <script>
  301. import {
  302. addPeriod,
  303. delPeriod,
  304. exportPeriod,
  305. getPeriod,
  306. pagePeriod,
  307. updatePeriod,
  308. getDays,
  309. addCourse,
  310. updateCourseTime,
  311. updateCourseDate,
  312. updateListCourseData,
  313. periodCourseMove,
  314. closePeriod
  315. } from "@/api/course/userCoursePeriod";
  316. import {getCompanyList} from "@/api/company/company";
  317. import {courseList, videoList} from '@/api/course/courseRedPacketLog'
  318. import RedPacket from './redPacket.vue'
  319. import BatchRedPacket from './batchRedPacket.vue'
  320. import CourseStatistics from './statistics.vue'
  321. export default {
  322. name: "Period",
  323. components: {
  324. RedPacket,
  325. BatchRedPacket,
  326. CourseStatistics
  327. },
  328. data() {
  329. return {
  330. // 遮罩层
  331. loading: true,
  332. updateDateOpen: false,
  333. // 左侧遮罩层
  334. leftLoading: true,
  335. // 选中数组
  336. ids: [],
  337. // 非单个禁用
  338. single: true,
  339. // 非多个禁用
  340. multiple: true,
  341. // 显示搜索条件
  342. showSearch: true,
  343. // 总条数
  344. total: 0,
  345. // 左侧总条数
  346. leftTotal: 0,
  347. // 会员营期表格数据
  348. periodList: [],
  349. // 左侧列表数据
  350. leftList: [],
  351. videoList: [],
  352. // 弹出层标题
  353. title: "",
  354. isDisabledDateRange: false, //是否禁用开营日期
  355. // 是否显示弹出层
  356. open: false,
  357. // 查询参数
  358. queryParams: {
  359. pageNum: 1,
  360. pageSize: 10,
  361. periodName: null,
  362. periodStartingTime: null,
  363. periodEndTime: null,
  364. companyIdList: []
  365. },
  366. // 左侧查询参数
  367. leftQueryParams: {
  368. pageNum: 1,
  369. pageSize: 10,
  370. hasNextPage: false,
  371. scs: 'order_number(desc),training_camp_id(desc)',
  372. trainingCampName: null
  373. },
  374. // 表单参数
  375. form: {},
  376. course: {
  377. open: false,
  378. row: {},
  379. list: [],
  380. queryParams: {
  381. pageNum: 1,
  382. pageSize: 10,
  383. },
  384. loading: true,
  385. total: 0,
  386. addOpen: false,
  387. form: {},
  388. },
  389. updateCourse: {
  390. open: false,
  391. loading: true,
  392. ids: [],
  393. form: {},
  394. },
  395. // 表单校验
  396. rules: {},
  397. // 公司选项
  398. companyOptions: [],
  399. // 训练营列表
  400. campList: [],
  401. // 激活的训练营索引
  402. activeCampIndex: null,
  403. // 训练营对话框是否显示
  404. campDialogVisible: false,
  405. courseList: false,
  406. // 训练营表单
  407. campForm: {
  408. trainingCampId: null,
  409. trainingCampName: ''
  410. },
  411. // 训练营表单校验
  412. campRules: {
  413. trainingCampName: [
  414. {required: true, message: '训练营名称不能为空', trigger: 'blur'},
  415. {min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur'}
  416. ]
  417. },
  418. // 滚动节流标志
  419. scrollThrottle: false,
  420. // 加载更多状态
  421. loadingMore: false,
  422. // 设置红包对话框
  423. redPacketVisible: false,
  424. periodCompanyList: [],
  425. currentRedPacketData: {
  426. periodId: '',
  427. videoId: ''
  428. },
  429. // 营期相关设置抽屉
  430. periodSettingsVisible: false,
  431. activeTab: 'course',
  432. periodSettingsData: {},
  433. companyList: [],
  434. courseDialogVisible: false,
  435. redPacketList: [],
  436. currentCompany: null,
  437. // 选中的营期数据
  438. selectedPeriods: [],
  439. // 批量设置红包按钮是否禁用
  440. batchSetRedPacketDisabled: true,
  441. // 批量设置红包弹出框
  442. batchRedPacketVisible: false,
  443. };
  444. },
  445. created() {
  446. courseList().then(response => {
  447. this.courseList = response.list;
  448. });
  449. this.getCompanyList();
  450. this.getList();
  451. },
  452. methods: {
  453. /** 查询会员营期列表 */
  454. getList() {
  455. this.loading = true;
  456. const params = {...this.queryParams};
  457. pagePeriod(params).then(response => {
  458. this.periodList = response.rows;
  459. this.total = response.total;
  460. this.loading = false;
  461. });
  462. },
  463. /** 查询左侧列表 */
  464. getLeftList() {
  465. this.leftLoading = true;
  466. // 重置页码和加载更多状态
  467. this.leftQueryParams.pageNum = 1;
  468. this.loadingMore = false;
  469. // 训练营数据
  470. listCamp(this.leftQueryParams).then(response => {
  471. if (response && response.code === 200) {
  472. this.campList = response.data.list || [];
  473. this.leftQueryParams.hasNextPage = response.data.hasNextPage;
  474. this.activeCampIndex = this.campList.length > 0 ? 0 : null;
  475. this.selectCamp(this.activeCampIndex);
  476. // 如果当前显示的列表高度不足以触发滚动,但还有更多数据,自动加载下一页
  477. this.$nextTick(() => {
  478. const scrollEl = this.$refs.campList;
  479. if (scrollEl && this.leftQueryParams.hasNextPage && scrollEl.scrollHeight <= scrollEl.clientHeight) {
  480. this.loadMoreCamps();
  481. }
  482. });
  483. } else {
  484. this.$message.error(response.msg || '获取训练营列表失败');
  485. this.campList = [];
  486. this.leftQueryParams.hasNextPage = false;
  487. }
  488. this.leftLoading = false;
  489. }).catch(error => {
  490. console.error('获取训练营列表失败:', error);
  491. this.$message.error('获取训练营列表失败');
  492. this.campList = [];
  493. this.leftQueryParams.hasNextPage = false;
  494. this.leftLoading = false;
  495. });
  496. },
  497. /** 搜索按钮操作 */
  498. handleQuery() {
  499. this.queryParams.pageNum = 1;
  500. this.getList();
  501. },
  502. /** 左侧搜索按钮操作 */
  503. handleLeftQuery() {
  504. // 重置页码和列表
  505. this.leftQueryParams.pageNum = 1;
  506. this.campList = [];
  507. this.getLeftList();
  508. },
  509. /** 重置按钮操作 */
  510. resetQuery() {
  511. this.resetForm("queryForm");
  512. this.queryParams.companyIdList = [];
  513. this.handleQuery();
  514. },
  515. /** 多选框选中数据 */
  516. handleSelectionChange(selection) {
  517. this.ids = selection.map(item => item.periodId)
  518. this.single = selection.length !== 1
  519. this.multiple = !selection.length
  520. // 更新批量设置红包相关数据
  521. this.selectedPeriods = selection;
  522. this.batchSetRedPacketDisabled = selection.length === 0;
  523. },
  524. handleSelectionCourseChange(selection) {
  525. this.updateCourse.ids = selection.map(item => item.id)
  526. },
  527. /** 新增按钮操作 */
  528. handleAdd() {
  529. this.reset();
  530. this.open = true;
  531. this.title = "添加会员营期";
  532. this.isDisabledDateRange = false;
  533. },
  534. /** 修改按钮操作 */
  535. handleUpdate(row) {
  536. this.reset();
  537. const periodId = row.periodId || this.ids
  538. getPeriod(periodId).then(response => {
  539. this.form = response.data;
  540. if (this.form.companyId) {
  541. this.form.companyId = this.form.companyId.split(',').map(id => Number(id));
  542. }
  543. // 设置看课时间范围(回显)
  544. if (this.form.viewStartTime && this.form.viewEndTime) {
  545. this.form.timeRange = [this.form.viewStartTime, this.form.viewEndTime];
  546. }
  547. if (this.form.periodType == 1) {
  548. this.form.dateRange = [this.form.periodStartingTime, this.form.periodEndTime];
  549. }
  550. if (this.form.periodType == 1) {
  551. this.form.date = this.form.periodStartingTime;
  552. }
  553. this.open = true;
  554. this.title = "修改会员营期";
  555. this.isDisabledDateRange = true;
  556. });
  557. },
  558. /** 提交按钮 */
  559. submitForm() {
  560. this.$refs["form"].validate(valid => {
  561. if (valid) {
  562. let data = JSON.parse(JSON.stringify(this.form));
  563. // 处理看课时间范围
  564. if (data.timeRange && data.timeRange.length === 2) {
  565. data.viewStartTime = data.timeRange[0];
  566. data.viewEndTime = data.timeRange[1];
  567. }
  568. data.companyId = data.companyId.join()
  569. data.trainingCampId = this.queryParams.trainingCampId
  570. if (data.periodId != null) {
  571. updatePeriod(data).then(response => {
  572. if (response.code === 200) {
  573. this.msgSuccess("修改成功");
  574. this.open = false;
  575. this.getList();
  576. }
  577. });
  578. } else {
  579. addPeriod(data).then(response => {
  580. if (response.code === 200) {
  581. this.msgSuccess("新增成功");
  582. this.open = false;
  583. this.getList();
  584. }
  585. });
  586. }
  587. }
  588. });
  589. },
  590. /** 删除按钮操作 */
  591. handleDelete(row) {
  592. //添加删除判断,只能删除未开始的营期
  593. console.log(row.periodStatus)
  594. if (row.periodStatus !== 1) {
  595. this.$message.error('营期处于进行中或者结束,不能删除');
  596. return;
  597. }
  598. const periodIds = row.periodId || this.ids;
  599. this.$confirm('是否确认删除该营期?', "警告", {
  600. confirmButtonText: "确定",
  601. cancelButtonText: "取消",
  602. type: "warning"
  603. }).then(function () {
  604. return delPeriod(periodIds);
  605. }).then(() => {
  606. this.getList();
  607. this.msgSuccess("删除成功");
  608. }).catch(function () {
  609. });
  610. },
  611. /** 导出按钮操作 */
  612. handleExport() {
  613. const queryParams = this.queryParams;
  614. this.$confirm('是否确认导出所有会员营期数据项?', "警告", {
  615. confirmButtonText: "确定",
  616. cancelButtonText: "取消",
  617. type: "warning"
  618. }).then(function () {
  619. return exportPeriod(queryParams);
  620. }).then(response => {
  621. this.download(response.msg);
  622. }).catch(function () {
  623. });
  624. },
  625. /** 批量设置红包 */
  626. handleBatchSetRedPacket() {
  627. if (this.selectedPeriods.length === 0) {
  628. this.$message.warning('请至少选择一个营期');
  629. return;
  630. }
  631. this.batchRedPacketVisible = true;
  632. },
  633. /** 处理批量设置红包保存 */
  634. // handleBatchRedPacketSave(data) {
  635. // // 这里等待接口提供后补充具体实现
  636. // // 示例代码:
  637. // // batchSetRedPacket(data).then(response => {
  638. // // if (response.code === 200) {
  639. // // this.$message.success('批量设置成功');
  640. // // this.getList();
  641. // // }
  642. // // });
  643. // this.batchRedPacketVisible = false;
  644. // },
  645. /** 获取公司下拉列表*/
  646. getCompanyList() {
  647. this.loading = true;
  648. getCompanyList().then(response => {
  649. this.companyOptions = response.data;
  650. this.loading = false;
  651. });
  652. },
  653. // 取消按钮
  654. cancel() {
  655. this.open = false;
  656. this.reset();
  657. },
  658. // 表单重置
  659. reset() {
  660. this.form = {
  661. periodId: null,
  662. periodName: null,
  663. companyId: null,
  664. courseId: null,
  665. videoId: null,
  666. trainingCampId: null,
  667. createTime: null,
  668. updateTime: null,
  669. courseStyle: null,
  670. liveRoomStyle: null,
  671. redPacketGrantMethod: 1,
  672. periodType: 1,
  673. periodStartingTime: null,
  674. dateRange: [],
  675. date: null,
  676. days: [],
  677. periodEndTime: null,
  678. timeRange: [], // 看课时间范围
  679. viewStartTime: null, // 看课开始时间
  680. viewEndTime: null, // 看课结束时间
  681. lastJoinTime: null // 领取红包时间
  682. };
  683. this.resetForm("form");
  684. },
  685. // 处理训练营列表的逻辑
  686. handleDeleteCamp(item) {
  687. this.$confirm(`确定要删除训练营"${item.trainingCampName}"吗?`, '提示', {
  688. confirmButtonText: '删除',
  689. cancelButtonText: '取消',
  690. type: 'warning'
  691. }).then(() => {
  692. // 调用删除训练营API
  693. const trainingCampId = item.trainingCampId;
  694. this.leftLoading = true;
  695. delCamp(trainingCampId).then(response => {
  696. if (response.code === 200) {
  697. this.$message.success('删除成功');
  698. // 从列表中移除
  699. const index = this.campList.findIndex(camp => camp.trainingCampId === trainingCampId);
  700. if (index !== -1) {
  701. this.campList.splice(index, 1);
  702. }
  703. // 如果删除的是当前选中的训练营,则重置选中状态
  704. if (this.activeCampIndex === index) {
  705. this.activeCampIndex = this.campList.length > 0 ? 0 : null;
  706. if (this.activeCampIndex !== null) {
  707. // 更新右侧列表
  708. this.selectCamp(this.activeCampIndex);
  709. } else {
  710. // 没有训练营了,清空右侧列表
  711. this.periodList = [];
  712. }
  713. }
  714. } else {
  715. this.$message.error(response.msg || '删除失败');
  716. }
  717. this.leftLoading = false;
  718. }).catch(error => {
  719. this.$message.error('删除失败: ' + error.message);
  720. this.leftLoading = false;
  721. });
  722. }).catch(() => {
  723. this.$message.info('已取消删除');
  724. });
  725. },
  726. /** 复制训练营 */
  727. handleCopyCamp(item) {
  728. // 调用添加训练营API
  729. copyCamp(item.trainingCampId).then(response => {
  730. if (response.code === 200) {
  731. this.$message.success('复制成功');
  732. // 重新加载训练营列表
  733. this.getLeftList();
  734. } else {
  735. this.$message.error(response.msg || '复制训练营失败');
  736. }
  737. }).catch(error => {
  738. this.$message.error('复制训练营失败: ' + error.message);
  739. });
  740. },
  741. /** 修改训练营按钮操作 */
  742. handleEditCamp(item) {
  743. this.resetCampForm();
  744. this.leftLoading = true;
  745. // 获取最新的训练营数据
  746. const trainingCampId = item.trainingCampId;
  747. // 应该调用获取训练营详情的API
  748. setTimeout(() => {
  749. // 填充表单数据
  750. this.campForm = {
  751. trainingCampId: item.trainingCampId,
  752. trainingCampName: item.trainingCampName,
  753. orderNumber: item.orderNumber || 1,
  754. status: item.status !== undefined ? item.status : 1
  755. };
  756. this.campDialogVisible = true;
  757. this.leftLoading = false;
  758. }, 300);
  759. },
  760. /** 新建训练营按钮操作 */
  761. handleAddTrainingCamp() {
  762. this.resetCampForm();
  763. this.campDialogVisible = true;
  764. },
  765. /** 重置训练营表单 */
  766. resetCampForm() {
  767. this.campForm = {
  768. trainingCampId: null,
  769. trainingCampName: ''
  770. };
  771. // 如果表单已经创建,则重置校验结果
  772. if (this.$refs.campForm) {
  773. this.$refs.campForm.resetFields();
  774. }
  775. },
  776. /** 取消训练营表单 */
  777. cancelCampForm() {
  778. this.campDialogVisible = false;
  779. this.resetCampForm();
  780. },
  781. /** 提交训练营表单 */
  782. submitCampForm() {
  783. this.$refs.campForm.validate(valid => {
  784. if (valid) {
  785. // 显示加载中
  786. this.leftLoading = true;
  787. // 准备提交的数据
  788. const submitData = JSON.parse(JSON.stringify(this.campForm));
  789. // 判断是新增还是修改
  790. if (submitData.trainingCampId) {
  791. // 修改训练营
  792. editCamp(submitData).then(response => {
  793. if (response.code === 200) {
  794. this.$message.success('修改训练营成功');
  795. this.campDialogVisible = false;
  796. // 更新列表中的数据
  797. const index = this.campList.findIndex(camp => camp.trainingCampId === submitData.trainingCampId);
  798. if (index !== -1) {
  799. this.campList[index] = {...this.campList[index], ...submitData};
  800. // 如果修改的是当前选中的训练营,更新右侧列表
  801. if (this.activeCampIndex === index) {
  802. this.selectCamp(index);
  803. }
  804. }
  805. // 重新加载训练营列表
  806. this.getLeftList();
  807. } else {
  808. this.$message.error(response.msg || '修改训练营失败');
  809. this.leftLoading = false;
  810. }
  811. }).catch(error => {
  812. this.$message.error('修改训练营失败: ' + (error.message || '未知错误'));
  813. this.leftLoading = false;
  814. });
  815. } else {
  816. // 新增训练营
  817. addCamp(submitData).then(response => {
  818. if (response.code === 200) {
  819. this.$message.success('新建训练营成功');
  820. this.campDialogVisible = false;
  821. // 重新加载训练营列表
  822. this.getLeftList();
  823. } else {
  824. this.$message.error(response.msg || '新建训练营失败');
  825. this.leftLoading = false;
  826. }
  827. }).catch(error => {
  828. this.$message.error('新建训练营失败: ' + (error.message || '未知错误'));
  829. this.leftLoading = false;
  830. });
  831. }
  832. }
  833. });
  834. },
  835. /** 排序方式改变 */
  836. handleSortChange(value) {
  837. this.leftQueryParams.scs = value;
  838. // 重置页码和列表
  839. this.leftQueryParams.pageNum = 1;
  840. this.campList = [];
  841. this.getLeftList();
  842. },
  843. /** 选中训练营 */
  844. selectCamp(index) {
  845. if (index == null || index == undefined) return;
  846. this.activeCampIndex = index;
  847. // 加载对应的训练营营期数据
  848. const selectedCamp = this.campList[index];
  849. this.queryParams.trainingCampId = selectedCamp.trainingCampId;
  850. this.getList();
  851. },
  852. /** 处理滚动事件,实现滚动到底部加载更多 */
  853. handleScroll() {
  854. // 如果正在节流中或者正在加载中,则不处理
  855. if (this.scrollThrottle || this.loadingMore) return;
  856. // 设置节流,200ms内不再处理滚动事件
  857. this.scrollThrottle = true;
  858. setTimeout(() => {
  859. this.scrollThrottle = false;
  860. }, 200);
  861. const scrollEl = this.$refs.campList;
  862. if (!scrollEl) return;
  863. // 判断是否滚动到底部:滚动高度 + 可视高度 >= 总高度 - 30(添加30px的容差,提前触发加载)
  864. const isBottom = scrollEl.scrollTop + scrollEl.clientHeight >= scrollEl.scrollHeight - 30;
  865. // 如果滚动到底部,且有下一页数据,且当前不在加载中,则加载更多
  866. if (isBottom && this.leftQueryParams.hasNextPage && !this.leftLoading && !this.loadingMore) {
  867. this.loadMoreCamps();
  868. }
  869. },
  870. /** 加载更多训练营数据 */
  871. loadMoreCamps() {
  872. // 已在加载中,防止重复加载
  873. if (this.leftLoading || this.loadingMore) return;
  874. // 设置加载状态
  875. this.loadingMore = true;
  876. // 页码加1
  877. this.leftQueryParams.pageNum += 1;
  878. // 加载下一页数据
  879. listCamp(this.leftQueryParams).then(response => {
  880. if (response && response.code === 200) {
  881. // 将新数据追加到列表中
  882. const newList = response.data.list || [];
  883. if (newList.length > 0) {
  884. this.campList = [...this.campList, ...newList];
  885. }
  886. // 更新是否有下一页的标志
  887. this.leftQueryParams.hasNextPage = response.data.hasNextPage;
  888. // 如果当前显示的列表高度不足以触发滚动,但还有更多数据,自动加载下一页
  889. this.$nextTick(() => {
  890. const scrollEl = this.$refs.campList;
  891. if (scrollEl && this.leftQueryParams.hasNextPage && scrollEl.scrollHeight <= scrollEl.clientHeight) {
  892. // 延迟一点再加载下一页,避免过快加载
  893. setTimeout(() => {
  894. this.loadMoreCamps();
  895. }, 300);
  896. }
  897. });
  898. } else {
  899. this.$message.error(response.msg || '加载更多训练营失败');
  900. }
  901. this.loadingMore = false;
  902. }).catch(error => {
  903. console.error('加载更多训练营失败:', error);
  904. this.$message.error('加载更多训练营失败');
  905. this.loadingMore = false;
  906. });
  907. },
  908. timeChange(type) {
  909. if (type == 1) {
  910. this.form.periodStartingTime = this.form.dateRange[0];
  911. this.form.periodEndTime = this.form.dateRange[1];
  912. // 转换为天数
  913. let days = this.getDiff(this.form.periodStartingTime, this.form.periodEndTime);
  914. for (let i = 0; i < days; i++) {
  915. this.form.days.push({lesson: i + 1});
  916. }
  917. }
  918. if (type == 2) {
  919. this.form.periodStartingTime = this.form.date;
  920. this.form.periodEndTime = this.form.date;
  921. }
  922. },
  923. getDiff(start, end) {
  924. if (start == null || start == undefined || start == '') return 0;
  925. if (end == null || end == undefined || end == '') return 0;
  926. if (start == end) 1;
  927. const startDate = this.getUTCDate(start);
  928. const endDate = this.getUTCDate(end);
  929. const timeDiff = endDate - startDate;
  930. return (Math.floor(timeDiff / (1000 * 3600 * 24))) + 1; // 直接取整
  931. },
  932. getUTCDate(dateStr) {
  933. const [year, month, day] = dateStr.split('-').map(Number);
  934. return new Date(Date.UTC(year, month - 1, day)); // 月份从0开始
  935. },
  936. handleCourse(row) {
  937. this.course = {
  938. open: false,
  939. row: {},
  940. list: [],
  941. queryParams: {
  942. pageNum: 1,
  943. pageSize: 9999,
  944. },
  945. loading: true,
  946. total: 0,
  947. addOpen: false,
  948. form: {},
  949. };
  950. this.course.open = true;
  951. this.course.row = row;
  952. this.course.queryParams.periodId = row.periodId;
  953. this.getCourseList();
  954. },
  955. getCourseList() {
  956. this.course.loading = true;
  957. getDays(this.course.queryParams).then(e => {
  958. this.course.list = e.rows;
  959. this.course.total = e.total;
  960. this.course.loading = false;
  961. });
  962. },
  963. handleAddCourse() {
  964. this.course.addOpen = true;
  965. this.course.form = {
  966. periodId: this.course.queryParams.periodId,
  967. courseId: null,
  968. videoIds: []
  969. };
  970. // 重置表单
  971. this.$nextTick(() => {
  972. if (this.$refs.courseAddForm) {
  973. this.$refs.courseAddForm.resetFields();
  974. }
  975. });
  976. },
  977. handleUpdateCourse() {
  978. this.updateCourse.open = true;
  979. this.updateCourse.form = {
  980. ids: this.updateCourse.ids,
  981. joinTime: [],
  982. };
  983. },
  984. closeAddCourse() {
  985. this.course.addOpen = false;
  986. this.course.form = {
  987. periodId: null,
  988. courseId: null,
  989. videoIds: []
  990. };
  991. // 重置表单
  992. if (this.$refs.courseAddForm) {
  993. this.$refs.courseAddForm.resetFields();
  994. }
  995. },
  996. closeUpdateCourse() {
  997. this.course.open = false;
  998. },
  999. courseChange(row) {
  1000. this.course.form.videoIds = [];
  1001. videoList(row).then(response => {
  1002. this.videoList = response.list
  1003. });
  1004. },
  1005. submitCourseForm() {
  1006. this.$refs.courseAddForm.validate(valid => {
  1007. if (valid) {
  1008. if (this.course.form.timeRange != null && this.course.form.timeRange.length === 2) {
  1009. this.course.form.startTime = this.course.form.timeRange[0];
  1010. this.course.form.endTime1 = this.course.form.timeRange[1];
  1011. }
  1012. // 提交数据
  1013. addCourse(this.course.form).then(response => {
  1014. this.$message.success('添加成功');
  1015. this.course.addOpen = false;
  1016. // 重新加载训练营列表
  1017. this.getCourseList();
  1018. });
  1019. }
  1020. });
  1021. },
  1022. submitUpdateCourseForm() {
  1023. this.$refs.courseUpdateForm.validate(valid => {
  1024. if (valid) {
  1025. if (this.updateCourse.form.timeRange != null && this.updateCourse.form.timeRange.length === 2) {
  1026. this.updateCourse.form.startTime = this.updateCourse.form.timeRange[0];
  1027. this.updateCourse.form.endTime1 = this.updateCourse.form.timeRange[1];
  1028. }
  1029. // 提交数据
  1030. updateCourseTime(this.updateCourse.form).then(response => {
  1031. this.$message.success('添加成功');
  1032. this.updateCourse.open = false;
  1033. // 重新加载训练营列表
  1034. this.getCourseList();
  1035. });
  1036. }
  1037. });
  1038. },
  1039. updateDate() {
  1040. updateCourseDate(this.form).then(response => {
  1041. this.$message.success('修改成功');
  1042. this.updateDateOpen = false;
  1043. // 重新加载训练营列表
  1044. this.getCourseList();
  1045. });
  1046. },
  1047. saveCourseData() {
  1048. updateListCourseData(this.course.list).then(response => {
  1049. this.$message.success('保存成功');
  1050. this.getCourseList();
  1051. });
  1052. },
  1053. setRedPacket(row) {
  1054. this.currentRedPacketData = {
  1055. periodId: row.periodId
  1056. // videoId: row.videoId
  1057. };
  1058. this.redPacketVisible = true;
  1059. },
  1060. handleRedPacketSuccess() {
  1061. this.getCourseList();
  1062. },
  1063. handlePeriodSettings(row) {
  1064. this.periodSettingsData = row;
  1065. this.periodSettingsVisible = true;
  1066. // 初始化课程列表
  1067. this.course.queryParams.periodId = row.periodId;
  1068. // 根据当前激活的tab加载对应数据
  1069. this.handleTabClick({name: this.activeTab});
  1070. },
  1071. // 结束营期
  1072. handleClosePeriod(row) {
  1073. const msg = `注: 1.确认结束营期,该营期的开营结束时间改为当天24点。2.当天正在播放中的课程不变。3.第二天如有未开始的课程,统一改为已结束。是否确认结束 ${row.periodName} 营期吗?`
  1074. this.$confirm(msg, "警告", {
  1075. confirmButtonText: "确定",
  1076. cancelButtonText: "取消",
  1077. type: "warning"
  1078. }).then(() => {
  1079. closePeriod({id: row.periodId}).then(response => {
  1080. if (response.code === 200) {
  1081. this.getList()
  1082. } else {
  1083. this.$message.error(response.msg)
  1084. }
  1085. })
  1086. }).catch(() => {
  1087. })
  1088. },
  1089. handleBatchRedPacketSuccess() {
  1090. this.batchRedPacketVisible = false;
  1091. this.getCourseList();
  1092. },
  1093. /** 处理tab切换 */
  1094. handleTabClick(tab) {
  1095. if (tab.name === 'course') {
  1096. this.getCourseList();
  1097. } else if (tab.name === 'company') {
  1098. this.redPacketVisible = true;
  1099. }
  1100. },
  1101. /** 上移课程 */
  1102. handleTop(row) {
  1103. const currentIndex = this.course.list.findIndex(item => item.id === row.id);
  1104. if (currentIndex <= 0) {
  1105. this.$message.warning('已经是第一条数据');
  1106. return;
  1107. }
  1108. // 获取上一条数据
  1109. const prevRow = this.course.list[currentIndex - 1];
  1110. console.log({
  1111. id: row.id,
  1112. targetId: prevRow.id,
  1113. type: 1 //上移
  1114. })
  1115. periodCourseMove({
  1116. id: row.id,
  1117. targetId: prevRow.id,
  1118. type: 1 //上移
  1119. }).then(response => {
  1120. if (response.code === 200) {
  1121. this.$message.success('上移成功');
  1122. this.getCourseList();
  1123. } else {
  1124. this.$message.error(response.msg || '上移失败');
  1125. }
  1126. }).catch(() => {
  1127. this.$message.error('上移失败');
  1128. });
  1129. },
  1130. /** 下移课程 */
  1131. handleBottom(row) {
  1132. const currentIndex = this.course.list.findIndex(item => item.id === row.id);
  1133. if (currentIndex === -1 || currentIndex >= this.course.list.length - 1) {
  1134. this.$message.warning('已经是最后一条数据');
  1135. return;
  1136. }
  1137. // 获取下一条数据
  1138. const nextRow = this.course.list[currentIndex + 1];
  1139. periodCourseMove({
  1140. id: row.id,
  1141. targetId: nextRow.id,
  1142. type: 2 //下移
  1143. }).then(response => {
  1144. if (response.code === 200) {
  1145. this.$message.success('下移成功');
  1146. this.getCourseList(); // 重新加载列表
  1147. } else {
  1148. this.$message.error(response.msg || '下移失败');
  1149. }
  1150. }).catch(() => {
  1151. this.$message.error('下移失败');
  1152. });
  1153. },
  1154. /** 营期状态格式化 */
  1155. periodStatusFormatter(row) {
  1156. const statusMap = {
  1157. 1: '未开始',
  1158. 2: '进行中',
  1159. 3: '已结束'
  1160. };
  1161. return statusMap[row.periodStatus] || '未知状态';
  1162. },
  1163. /** 开课状态格式化 */
  1164. courseStatusFormatter(row) {
  1165. const statusMap = {
  1166. 0: '未开始',
  1167. 1: '进行中',
  1168. 2: '已结束'
  1169. };
  1170. return statusMap[row.status] || '未知状态';
  1171. },
  1172. /** 营期状态格式化 */
  1173. handleUpdateDate(row) {
  1174. this.form = {id: row.id, dayDate: row.dayDate};
  1175. this.updateDateOpen = true;
  1176. },
  1177. },
  1178. };
  1179. </script>
  1180. <style scoped>
  1181. .left-aside {
  1182. background-color: #fff;
  1183. border-right: 1px solid #EBEEF5;
  1184. padding: 0;
  1185. display: flex;
  1186. flex-direction: column;
  1187. height: 800px;
  1188. }
  1189. .left-header {
  1190. padding: 10px;
  1191. border-bottom: 1px solid #EBEEF5;
  1192. }
  1193. .left-header-top {
  1194. display: flex;
  1195. justify-content: space-between;
  1196. align-items: center;
  1197. margin-bottom: 10px;
  1198. }
  1199. .search-btn {
  1200. width: 50%;
  1201. height: 36px;
  1202. background-color: #409EFF;
  1203. color: white;
  1204. border: none;
  1205. }
  1206. .search-input-wrapper {
  1207. margin-bottom: 10px;
  1208. }
  1209. .sort-wrapper {
  1210. display: flex;
  1211. align-items: center;
  1212. margin-bottom: 10px;
  1213. }
  1214. .sort-label {
  1215. width: 70px;
  1216. font-size: 14px;
  1217. font-weight: 600;
  1218. color: #909399;
  1219. }
  1220. .sort-select {
  1221. margin-left: 10px;
  1222. width: 280px;
  1223. }
  1224. .color-wrapper {
  1225. display: flex;
  1226. align-items: center;
  1227. margin-bottom: 10px;
  1228. }
  1229. .color-label {
  1230. width: 70px;
  1231. color: #606266;
  1232. }
  1233. .color-hint {
  1234. margin-left: 10px;
  1235. color: #606266;
  1236. font-size: 12px;
  1237. }
  1238. .color-help {
  1239. margin-left: 5px;
  1240. color: #909399;
  1241. cursor: pointer;
  1242. }
  1243. .hint-text {
  1244. color: #606266;
  1245. font-size: 12px;
  1246. margin-top: 5px;
  1247. }
  1248. .camp-list {
  1249. flex: 1;
  1250. overflow-y: auto;
  1251. padding: 3px;
  1252. }
  1253. .camp-item {
  1254. margin-bottom: 5px;
  1255. padding: 15px;
  1256. background-color: #ffffff;
  1257. position: relative;
  1258. cursor: pointer;
  1259. display: flex;
  1260. justify-content: space-between;
  1261. border: 1px solid #eaedf2;
  1262. }
  1263. .camp-item:last-child {
  1264. margin-bottom: 0;
  1265. }
  1266. .camp-item:hover {
  1267. background-color: #f5f9ff;
  1268. }
  1269. .camp-item.active {
  1270. background-color: #eaf4ff;
  1271. border-left: 1px solid #75b8fc;
  1272. }
  1273. .camp-content {
  1274. flex: 1;
  1275. padding-right: 10px;
  1276. }
  1277. .camp-title {
  1278. font-weight: bold;
  1279. font-size: 16px;
  1280. margin-bottom: 8px;
  1281. color: #333;
  1282. display: flex;
  1283. align-items: center;
  1284. }
  1285. .camp-icon {
  1286. font-size: 16px;
  1287. margin-right: 6px;
  1288. color: #409EFF;
  1289. }
  1290. .camp-info {
  1291. display: flex;
  1292. justify-content: space-between;
  1293. margin-bottom: 8px;
  1294. font-size: 12px;
  1295. color: #c4c1c1;
  1296. line-height: 1.5;
  1297. }
  1298. .camp-stats {
  1299. display: flex;
  1300. justify-content: space-between;
  1301. font-size: 12px;
  1302. color: #666;
  1303. background-color: #f5f9ff;
  1304. padding: 6px 10px;
  1305. border-radius: 4px;
  1306. line-height: 1.5;
  1307. }
  1308. .stat-item {
  1309. display: flex;
  1310. align-items: center;
  1311. }
  1312. .stat-item i {
  1313. margin-right: 4px;
  1314. font-size: 14px;
  1315. color: #409EFF;
  1316. }
  1317. .camp-actions {
  1318. display: flex;
  1319. flex-direction: column;
  1320. justify-content: center;
  1321. align-items: flex-end;
  1322. gap: 8px;
  1323. border-left: 1px dashed #eaedf2;
  1324. padding-left: 12px;
  1325. min-width: 50px;
  1326. }
  1327. .action-btn {
  1328. padding: 2px 5px;
  1329. font-size: 12px;
  1330. border-radius: 4px;
  1331. transition: all 0.2s;
  1332. }
  1333. .action-btn:hover {
  1334. background-color: rgba(255, 255, 255, 0.8);
  1335. }
  1336. .delete-btn {
  1337. color: #f56c6c;
  1338. }
  1339. .delete-btn:hover {
  1340. background-color: rgba(245, 108, 108, 0.1);
  1341. }
  1342. .copy-btn {
  1343. color: #409EFF;
  1344. }
  1345. .copy-btn:hover {
  1346. background-color: rgba(64, 158, 255, 0.1);
  1347. }
  1348. .warning-icon {
  1349. color: #E6A23C;
  1350. font-size: 16px;
  1351. margin-left: 5px;
  1352. }
  1353. .el-main {
  1354. padding: 10px;
  1355. }
  1356. /* 添加训练营表单样式 */
  1357. .drawer-footer {
  1358. position: absolute;
  1359. bottom: 0;
  1360. left: 0;
  1361. right: 0;
  1362. padding: 20px;
  1363. background: #fff;
  1364. text-align: right;
  1365. border-top: 1px solid #e8e8e8;
  1366. }
  1367. .el-input-number {
  1368. width: 100%;
  1369. }
  1370. /* 加载更多样式 */
  1371. .loading-more {
  1372. display: flex;
  1373. align-items: center;
  1374. justify-content: center;
  1375. padding: 12px 0;
  1376. color: #909399;
  1377. font-size: 14px;
  1378. }
  1379. .loading-more i {
  1380. margin-right: 5px;
  1381. font-size: 16px;
  1382. }
  1383. /* 无更多数据提示 */
  1384. .no-more-data {
  1385. display: flex;
  1386. align-items: center;
  1387. justify-content: center;
  1388. padding: 12px 0;
  1389. color: #c0c4cc;
  1390. font-size: 13px;
  1391. }
  1392. .no-more-data span {
  1393. position: relative;
  1394. display: flex;
  1395. align-items: center;
  1396. }
  1397. </style>