index.vue 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567
  1. <template>
  2. <div class="app-container">
  3. <el-container>
  4. <!-- 左侧区域 -->
  5. <el-aside width="360px" class="left-aside">
  6. <!-- 顶部区域 -->
  7. <div class="left-header">
  8. <div class="left-header-top">
  9. <el-button type="primary" class="search-btn" @click="handleLeftQuery" v-hasPermi="['course:trainingCamp:list']">搜索</el-button>
  10. <el-button type="primary" style="width: 50%" icon="el-icon-plus" @click="handleAddTrainingCamp" v-hasPermi="['course:trainingCamp:add']">新建训练营</el-button>
  11. </div>
  12. <div class="search-input-wrapper">
  13. <el-input
  14. v-model="leftQueryParams.trainingCampName"
  15. placeholder="请输入训练营名称"
  16. prefix-icon="el-icon-search"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleLeftQuery"
  20. />
  21. </div>
  22. <div class="sort-wrapper">
  23. <span class="sort-label">排序方式</span>
  24. <el-select v-model="leftQueryParams.scs"
  25. placeholder="按序号倒序"
  26. size="small"
  27. class="sort-select"
  28. @change="handleSortChange"
  29. >
  30. <el-option label="按序号倒序" value="order_number(desc),training_camp_id(desc)" />
  31. <el-option label="按序号顺序" value="order_number(asc),training_camp_id(desc)" />
  32. </el-select>
  33. </div>
  34. </div>
  35. <!-- 训练营列表 -->
  36. <div class="camp-list" ref="campList" @scroll="handleScroll" v-loading="leftLoading">
  37. <div
  38. v-for="(item, index) in campList"
  39. :key="index"
  40. class="camp-item"
  41. :class="{ 'active': activeCampIndex === index }"
  42. @click="selectCamp(index)"
  43. >
  44. <div class="camp-content">
  45. <div class="camp-title">
  46. <i class="el-icon-s-flag camp-icon"></i>
  47. {{ item.trainingCampName }}
  48. </div>
  49. <div class="camp-info">
  50. <span>序号:{{ item.orderNumber }}</span>
  51. <span>最新营期开课:{{ item.recentDate || '-' }}</span>
  52. </div>
  53. <div class="camp-stats">
  54. <span class="stat-item">
  55. <i class="el-icon-s-data"></i>
  56. 营期数:{{ item.periodCount || 0 }}
  57. </span>
  58. <span class="stat-item">
  59. <i class="el-icon-user"></i>
  60. 会员总数:{{ item.vipCount || 0 }}
  61. </span>
  62. </div>
  63. </div>
  64. <div class="camp-actions">
  65. <el-button type="text" class="action-btn delete-btn" @click.stop="handleDeleteCamp(item)" v-hasPermi="['course:trainingCamp:remove']">删除</el-button>
  66. <!-- <el-button type="text" class="action-btn copy-btn" @click.stop="handleCopyCamp(item)" v-hasPermi="['course:trainingCamp:copy']">复制</el-button>-->
  67. <el-button type="text" class="action-btn copy-btn" @click.stop="handleEditCamp(item)" v-hasPermi="['course:trainingCamp:edit']">编辑</el-button>
  68. </div>
  69. </div>
  70. <!-- 底部加载更多提示 -->
  71. <div v-if="loadingMore" class="loading-more">
  72. <i class="el-icon-loading"></i>
  73. <span>加载中...</span>
  74. </div>
  75. <!-- 所有数据加载完毕提示 -->
  76. <div v-if="campList.length > 0 && !leftQueryParams.hasNextPage && !loadingMore" class="no-more-data">
  77. <span>—— 已加载全部训练营 ——</span>
  78. </div>
  79. </div>
  80. </el-aside>
  81. <!-- 右侧区域 -->
  82. <el-main>
  83. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  84. <el-form-item label="营期名称" prop="periodName">
  85. <el-input
  86. v-model="queryParams.periodName"
  87. placeholder="请输入营期名称"
  88. clearable
  89. size="small"
  90. @keyup.enter.native="handleQuery"
  91. />
  92. </el-form-item>
  93. <el-form-item label="公司" prop="companyIdList">
  94. <div style="display: flex; gap: 10px; align-items: center;">
  95. <el-select v-model="queryParams.companyIdList" placeholder="请选择公司" clearable size="small" multiple style="flex: 1;">
  96. <el-option
  97. v-for="item in companyOptions"
  98. :key="item.companyId"
  99. :label="item.companyName"
  100. :value="item.companyId"
  101. />
  102. </el-select>
  103. <el-button
  104. type="primary"
  105. size="small"
  106. @click="handleSelectAllCompanies('query')"
  107. :disabled="!companyOptions || companyOptions.length === 0"
  108. >
  109. {{ isAllCompaniesSelected('query') ? '取消全选' : '全选' }}
  110. </el-button>
  111. </div>
  112. </el-form-item>
  113. <el-form-item label="开营日期开始" prop="periodStartingTime" label-width="120px">
  114. <el-date-picker clearable size="small" style="width: 200px"
  115. v-model="queryParams.periodStartingTime"
  116. type="date"
  117. value-format="yyyy-MM-dd"
  118. placeholder="请选择开营日期开始时间">
  119. </el-date-picker>
  120. </el-form-item>
  121. <el-form-item label="开营日期结束" prop="periodEndTime" label-width="120px">
  122. <el-date-picker clearable size="small" style="width: 300px"
  123. v-model="queryParams.periodEndTime"
  124. type="date"
  125. value-format="yyyy-MM-dd"
  126. placeholder="请选择开营日期结束时间">
  127. </el-date-picker>
  128. </el-form-item>
  129. <el-form-item>
  130. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['course:period:list']">搜索</el-button>
  131. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  132. </el-form-item>
  133. </el-form>
  134. <el-row :gutter="10" class="mb8">
  135. <el-col :span="1.5">
  136. <el-button
  137. type="primary"
  138. plain
  139. icon="el-icon-plus"
  140. size="mini"
  141. @click="handleAdd"
  142. v-hasPermi="['course:period:add']"
  143. >新增</el-button>
  144. </el-col>
  145. <el-col :span="1.5">
  146. <el-button
  147. type="warning"
  148. plain
  149. icon="el-icon-download"
  150. size="mini"
  151. @click="handleExport"
  152. v-hasPermi="['course:period:export']"
  153. >导出</el-button>
  154. </el-col>
  155. <el-col :span="1.5">
  156. <el-button
  157. type="primary"
  158. plain
  159. icon="el-icon-edit"
  160. size="mini"
  161. @click="handleBatchSetRedPacket"
  162. v-hasPermi="['course:period:setRedPacket']"
  163. :disabled="batchSetRedPacketDisabled"
  164. >批量设置红包
  165. </el-button>
  166. </el-col>
  167. <el-col :span="1.5">
  168. <el-button
  169. type="primary"
  170. plain
  171. icon="el-icon-plus"
  172. size="mini"
  173. @click="handleAddExistCampPeriod"
  174. v-hasPermi="['course:period:add']"
  175. >复制现有营期</el-button>
  176. </el-col>
  177. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  178. </el-row>
  179. <el-table v-loading="loading" :data="periodList" @selection-change="handleSelectionChange" border>
  180. <el-table-column type="selection" width="55" align="center" />
  181. <el-table-column label="营期名称" align="center" prop="periodName" />
  182. <el-table-column label="公司名称" align="center" prop="companyName" />
  183. <el-table-column label="营期状态" align="center" prop="periodStatus" width="100" :formatter="periodStatusFormatter" />
  184. <el-table-column label="自由模式" align="center" prop="freeMode" width="100">
  185. <template slot-scope="scope">
  186. <el-tag :type="scope.row.freeMode === 1 ? 'success' : 'info'">
  187. {{ scope.row.freeMode === 1 ? '开启' : '关闭' }}
  188. </el-tag>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="营期线" align="center" prop="periodLine" width="180" />
  192. <el-table-column label="开营开始时间" align="center" prop="periodStartingTime" width="180" />
  193. <el-table-column label="开营结束时间" align="center" prop="periodEndTime" width="180" />
  194. <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
  195. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  196. <template slot-scope="scope">
  197. <el-button
  198. size="mini"
  199. type="text"
  200. icon="el-icon-edit"
  201. @click="handleUpdate(scope.row)"
  202. v-hasPermi="['course:period:edit']"
  203. >修改</el-button>
  204. <!-- <el-button-->
  205. <!-- size="mini"-->
  206. <!-- type="text"-->
  207. <!-- icon="el-icon-edit"-->
  208. <!-- @click="handleCourse(scope.row)"-->
  209. <!-- v-hasPermi="['course:period:edit']"-->
  210. <!-- >课程管理</el-button>-->
  211. <!-- <el-button-->
  212. <!-- size="mini"-->
  213. <!-- type="text"-->
  214. <!-- icon="el-icon-money"-->
  215. <!-- @click="setRedPacket(scope.row)"-->
  216. <!-- >设置红包</el-button>-->
  217. <el-button
  218. size="mini"
  219. type="text"
  220. icon="el-icon-setting"
  221. @click="handlePeriodSettings(scope.row)"
  222. >营期相关设置</el-button>
  223. <el-button
  224. size="mini"
  225. type="text"
  226. icon="el-icon-circle-close"
  227. @click="handleClosePeriod(scope.row)"
  228. v-hasPermi="['course:period:close']"
  229. >结束营期</el-button>
  230. <el-button
  231. size="mini"
  232. type="text"
  233. icon="el-icon-delete"
  234. @click="handleDelete(scope.row)"
  235. v-hasPermi="['course:period:remove']"
  236. >删除</el-button>
  237. </template>
  238. </el-table-column>
  239. </el-table>
  240. <pagination
  241. v-show="total>0"
  242. :total="total"
  243. :page.sync="queryParams.pageNum"
  244. :limit.sync="queryParams.pageSize"
  245. @pagination="getList"
  246. />
  247. </el-main>
  248. </el-container>
  249. <!-- 添加或修改会员营期对话框-->
  250. <el-drawer :title="title" :visible.sync="open" size="700px" append-to-body>
  251. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  252. <el-form-item label="营期名称" prop="periodName">
  253. <el-input v-model="form.periodName" placeholder="请输入营期名称" />
  254. </el-form-item>
  255. <el-form-item label="公司" prop="companyId">
  256. <div style="display: flex; gap: 10px; align-items: flex-start;">
  257. <el-select v-model="form.companyId" placeholder="请选择公司" multiple style="flex: 1;">
  258. <el-option
  259. v-for="item in companyOptions"
  260. :key="item.companyId"
  261. :label="item.companyName"
  262. :value="item.companyId"
  263. />
  264. </el-select>
  265. <el-button
  266. type="primary"
  267. size="small"
  268. @click="handleSelectAllCompanies('form')"
  269. :disabled="!companyOptions || companyOptions.length === 0"
  270. >
  271. {{ isAllCompaniesSelected('form') ? '取消全选' : '全选' }}
  272. </el-button>
  273. </div>
  274. </el-form-item>
  275. <el-form-item label="课程风格" prop="courseStyle">
  276. <image-upload v-model="form.courseStyle" :limit="1" />
  277. </el-form-item>
  278. <el-form-item label="直播间风格" prop="liveRoomStyle">
  279. <image-upload v-model="form.liveRoomStyle" :limit="1" />
  280. </el-form-item>
  281. <el-form-item label="课程LOGO" prop="courseLogo">
  282. <image-upload v-model="form.courseLogo" :limit="1" />
  283. </el-form-item>
  284. <!-- <el-form-item label="红包发放方式" prop="redPacketGrantMethod">-->
  285. <!-- <el-radio-group v-model="form.redPacketGrantMethod">-->
  286. <!-- <el-radio :label="1" >按课程</el-radio>-->
  287. <!-- <el-radio :label="2" >按营期</el-radio>-->
  288. <!-- </el-radio-group>-->
  289. <!-- </el-form-item>-->
  290. <el-form-item label="营期类型" prop="periodType">
  291. <el-radio-group v-model="form.periodType">
  292. <el-radio :label="1" >多课程</el-radio>
  293. <el-radio :label="2" >单课程</el-radio>
  294. </el-radio-group>
  295. </el-form-item>
  296. <el-form-item label="销售提前查看天数" prop="maxViewNum">
  297. <el-input-number :min="0" v-model="form.maxViewNum" style="width: 200px" />
  298. </el-form-item>
  299. <el-form-item prop="freeMode">
  300. <span slot="label">
  301. 是否开启自由模式
  302. <el-tooltip content="开启后,学员可以自由安排学习进度,不受营期时间限制" placement="top">
  303. <i class="el-icon-question" style="margin-left: 5px; color: #909399; cursor: help;"></i>
  304. </el-tooltip>
  305. </span>
  306. <el-radio-group v-model="form.freeMode">
  307. <el-radio :label="1">开启</el-radio>
  308. <el-radio :label="0">关闭</el-radio>
  309. </el-radio-group>
  310. </el-form-item>
  311. <el-form-item label="开营日期" prop="periodStartingTime">
  312. <div style="display: flex; flex-direction: column; gap: 10px; width: 100%;">
  313. <div style="display: flex; align-items: center; gap: 10px;">
  314. <el-date-picker
  315. :style="{display: form.periodType == 1 ? '' : 'none !important', flex: 1}"
  316. v-model="form.dateRange"
  317. @change="timeChange(1)"
  318. type="daterange"
  319. range-separator="至"
  320. start-placeholder="开始日期"
  321. end-placeholder="结束日期"
  322. value-format="yyyy-MM-dd"
  323. :picker-options="{}"
  324. :clearable="false"
  325. >
  326. </el-date-picker>
  327. <el-date-picker
  328. :disabled = "isDisabledDateRange"
  329. :style="{display: form.periodType == 2 ? '' : 'none !important', flex: 1}"
  330. @change="timeChange(2)"
  331. v-model="form.date"
  332. type="date"
  333. value-format="yyyy-MM-dd"
  334. placeholder="选择日期"
  335. :picker-options="{}"
  336. :clearable="false"
  337. >
  338. </el-date-picker>
  339. <el-button
  340. v-if="form.periodType == 1"
  341. type="warning"
  342. size="small"
  343. icon="el-icon-setting"
  344. @click="setEndDateTo2099"
  345. title="一键将结束日期设置为2099-12-31"
  346. >
  347. 永久营期
  348. </el-button>
  349. </div>
  350. <div v-if="form.periodType == 1" style="color: #909399; font-size: 12px;">
  351. <i class="el-icon-info"></i> 点击"永久营期"可将结束日期设置为2099-12-31
  352. </div>
  353. </div>
  354. </el-form-item>
  355. <el-form-item prop="periodLine">
  356. <span slot="label">
  357. 营期线
  358. <el-tooltip content="营期首次播放课程的日期" placement="top">
  359. <i class="el-icon-question" style="margin-left: 5px; color: #909399; cursor: help;"></i>
  360. </el-tooltip>
  361. </span>
  362. <el-date-picker
  363. v-model="form.periodLine"
  364. type="date"
  365. placeholder="请选择营期线"
  366. value-format="yyyy-MM-dd"
  367. :clearable="true">
  368. </el-date-picker>
  369. </el-form-item>
  370. <el-form-item label="课程选择" prop="courseId" v-if="courseSelectionIsAdd">
  371. <el-select v-model="form.courseId" placeholder="请选课程" filterable clearable size="small" >
  372. <el-option
  373. v-for="dict in courseSelection"
  374. :key="dict.courseId"
  375. :label="dict.courseName"
  376. :value="dict.courseId"
  377. />
  378. </el-select>
  379. </el-form-item>
  380. </el-form>
  381. <div class="drawer-footer">
  382. <el-button type="primary" @click="submitForm">确 定</el-button>
  383. <el-button @click="cancel">取 消</el-button>
  384. </div>
  385. </el-drawer>
  386. <!-- 添加训练营对话框 -->
  387. <el-dialog :title="campForm.trainingCampId ? '修改训练营' : '新建训练营'" :visible.sync="campDialogVisible" width="500px" append-to-body>
  388. <el-form ref="campForm" :model="campForm" :rules="campRules" label-width="100px">
  389. <el-form-item label="训练营名称" prop="trainingCampName">
  390. <el-input v-model="campForm.trainingCampName" placeholder="请输入训练营名称" />
  391. </el-form-item>
  392. </el-form>
  393. <div slot="footer" class="dialog-footer">
  394. <el-button type="primary" @click="submitCampForm">确 定</el-button>
  395. <el-button @click="cancelCampForm">取 消</el-button>
  396. </div>
  397. </el-dialog>
  398. <!-- &lt;!&ndash; 添加或修改会员营期对话框&ndash;&gt;-->
  399. <!-- <el-dialog title="课程管理" :visible.sync="course.open" width="75%" top="10px" append-to-body style="padding-bottom: 10px">-->
  400. <!-- <el-row :gutter="10" class="mb8">-->
  401. <!-- <el-col :span="1.5">-->
  402. <!-- <el-button-->
  403. <!-- v-if="(getDiff(course.row.periodStartingTime, course.row.periodEndTime) - course.total) > 0"-->
  404. <!-- type="primary"-->
  405. <!-- icon="el-icon-plus"-->
  406. <!-- size="mini"-->
  407. <!-- @click="handleAddCourse"-->
  408. <!-- v-hasPermi="['course:period:add']"-->
  409. <!-- >添加课程</el-button>-->
  410. <!-- </el-col>-->
  411. <!-- </el-row>-->
  412. <!-- <el-table v-loading="course.loading" :data="course.list">-->
  413. <!-- <el-table-column label="课程" align="center" prop="courseName" width="180" />-->
  414. <!-- <el-table-column label="小节" align="center" prop="videoName" />-->
  415. <!-- <el-table-column label="营期时间" align="center" prop="dayDate" width="150" />-->
  416. <!-- <el-table-column label="创建时间" align="center" prop="createTime" width="150" />-->
  417. <!-- </el-table>-->
  418. <!-- <div slot="footer" class="dialog-footer">-->
  419. <!--&lt;!&ndash; <el-button type="primary" @click="saveCourseData">保存</el-button>&ndash;&gt;-->
  420. <!-- </div>-->
  421. <!-- </el-dialog>-->
  422. <!-- 添加课程对话框-->
  423. <el-dialog title="添加课程" :visible.sync="course.addOpen" width="500px" append-to-body>
  424. <el-form ref="courseAddForm" :model="course.form" :rules="courseAddRules" label-width="100px">
  425. <el-form-item label="课程" prop="courseId">
  426. <el-select filterable v-model="course.form.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(course.form.courseId)" style="width: 100%" :value-key="'dictValue'">
  427. <el-option
  428. v-for="dict in courseList"
  429. :key="dict.dictValue"
  430. :label="dict.dictLabel"
  431. :value="parseInt(dict.dictValue)"
  432. />
  433. </el-select>
  434. </el-form-item>
  435. <el-form-item label="小节" prop="videoIds">
  436. <div style="display: flex; align-items: center; gap: 10px; width: 100%;">
  437. <el-select
  438. filterable
  439. v-model="course.form.videoIds"
  440. placeholder="请选择小节"
  441. :multiple-limit="getDiff(periodSettingsData.periodStartingTime, periodSettingsData.periodEndTime) - course.total"
  442. multiple
  443. clearable
  444. size="small"
  445. style="flex: 1"
  446. :value-key="'dictValue'"
  447. >
  448. <el-option
  449. v-for="dict in videoList"
  450. :key="dict.dictValue"
  451. :label="dict.dictLabel"
  452. :value="parseInt(dict.dictValue)"
  453. />
  454. </el-select>
  455. <el-button
  456. type="primary"
  457. size="small"
  458. @click="handleBatchSelectSections"
  459. :disabled="!course.form.courseId || !videoList || videoList.length === 0"
  460. title="一键选择所有可用小节"
  461. >
  462. 批量选择
  463. </el-button>
  464. </div>
  465. </el-form-item>
  466. <el-form-item label="看课时间" prop="timeRange">
  467. <el-time-picker
  468. is-range
  469. v-model="course.form.timeRange"
  470. :picker-options="{
  471. selectableRange: '00:00:00 - 23:59:59'
  472. }"
  473. range-separator="至"
  474. start-placeholder="开始时间"
  475. value-format="HH:mm:ss"
  476. end-placeholder="结束时间">
  477. </el-time-picker>
  478. </el-form-item>
  479. <el-form-item v-if="joinTimeSwitch" label="领取红包时间" prop="lastJoinTime">
  480. <el-time-picker
  481. v-model="course.form.joinTime"
  482. value-format="HH:mm:ss"
  483. placeholder="选择时间范围">
  484. </el-time-picker>
  485. <p style="color: red;margin: 0;font-size: 12px">超过领取红包时间,只允许看课,不允许领取红包</p>
  486. </el-form-item>
  487. </el-form>
  488. <div slot="footer" class="dialog-footer">
  489. <el-button type="primary" @click="submitCourseForm">确 定</el-button>
  490. <el-button @click="closeAddCourse">取 消</el-button>
  491. </div>
  492. </el-dialog>
  493. <el-dialog title="修改看课时间" :visible.sync="updateCourse.open" width="600px" append-to-body>
  494. <el-form ref="courseUpdateForm" :model="updateCourse.form" :rules="courseUpdateRules" label-width="100px">
  495. <el-form-item label="看课时间" prop="timeRange" label-width="110px">
  496. <el-date-picker
  497. v-model="updateCourse.form.timeRange"
  498. type="datetimerange"
  499. range-separator="至"
  500. start-placeholder="开始时间"
  501. end-placeholder="结束时间"
  502. value-format="yyyy-MM-dd HH:mm:ss"
  503. :default-time="['00:00:00', '23:59:59']"
  504. :picker-options="{
  505. shortcuts: [{
  506. text: '今天',
  507. onClick(picker) {
  508. const end = new Date();
  509. const start = new Date();
  510. picker.$emit('pick', [start, end]);
  511. }
  512. }]
  513. }"
  514. >
  515. </el-date-picker>
  516. </el-form-item>
  517. <el-form-item v-if="joinTimeSwitch" label="领取红包时间" prop="joinTime" label-width="110px">
  518. <el-date-picker
  519. v-model="updateCourse.form.joinTime"
  520. type="datetime"
  521. placeholder="选择时间"
  522. value-format="yyyy-MM-dd HH:mm:ss"
  523. :default-time="'23:59:59'"
  524. >
  525. </el-date-picker>
  526. <p style="color: red;margin: 0;font-size: 12px">超过领取红包时间,只允许看课,不允许领取红包</p>
  527. </el-form-item>
  528. </el-form>
  529. <div slot="footer" class="dialog-footer">
  530. <el-button type="primary" @click="submitUpdateCourseForm">确 定</el-button>
  531. <el-button @click="closeUpdateCourse">取 消</el-button>
  532. </div>
  533. </el-dialog>
  534. <el-dialog title="修改营期时间" :visible.sync="updatePeriodDate.open" width="500px" append-to-body>
  535. <el-form ref="courseUpdateForm" :model="updatePeriodDate.form" label-width="100px">
  536. <el-form-item label="营期时间" prop="dayDate">
  537. <el-date-picker
  538. v-model="updatePeriodDate.form.dayDate"
  539. :selectableRange="updatePeriodDate.form.dayDate"
  540. value-format="yyyy-MM-dd"
  541. type="date"
  542. placeholder="选择日期">
  543. </el-date-picker>
  544. </el-form-item>
  545. </el-form>
  546. <div slot="footer" class="dialog-footer">
  547. <el-button type="primary" @click="updatePeriodDateSubmit">确 定</el-button>
  548. <el-button @click="updatePeriodDate.open = false">取 消</el-button>
  549. </div>
  550. </el-dialog>
  551. <!-- <red-packet-->
  552. <!-- :visible.sync="redPacketVisible"-->
  553. <!-- :periodId="currentRedPacketData.periodId"-->
  554. <!-- :videoId="currentRedPacketData.videoId"-->
  555. <!-- @success="handleRedPacketSuccess"-->
  556. <!-- />-->
  557. <!-- 营期相关设置抽屉 -->
  558. <el-drawer
  559. title="营期相关设置"
  560. :visible.sync="periodSettingsVisible"
  561. direction="rtl"
  562. size="74%"
  563. :destroy-on-close="true"
  564. append-to-body
  565. custom-class="period-settings-drawer"
  566. >
  567. <div class="drawer-content" style="margin-left: 25px">
  568. <el-tabs v-model="activeTab" @tab-click="handleTabClick">
  569. <el-tab-pane label="课程管理" name="course">
  570. <el-row :gutter="10" class="mb8">
  571. <el-col :span="1.5">
  572. <el-button
  573. v-if="(getDiff(periodSettingsData.periodStartingTime, periodSettingsData.periodEndTime) - course.total) > 0"
  574. type="primary"
  575. icon="el-icon-plus"
  576. size="mini"
  577. @click="handleAddCourse"
  578. v-hasPermi="['course:period:addCourse']"
  579. >添加课程</el-button>
  580. </el-col>
  581. <!-- <el-col :span="1.5">-->
  582. <!-- <el-button-->
  583. <!-- type="primary"-->
  584. <!-- size="mini"-->
  585. <!-- :disabled="updateCourse.ids.length <= 0"-->
  586. <!-- @click="handleUpdatePeriodDate"-->
  587. <!-- >修改营期时间</el-button>-->
  588. <!-- </el-col>-->
  589. <el-col :span="1.5">
  590. <el-button
  591. type="primary"
  592. size="mini"
  593. :disabled="updateCourse.ids.length <= 0"
  594. @click="handleUpdateCourse"
  595. v-hasPermi="['course:period:updateCourseTime']"
  596. >修改看课时间</el-button>
  597. </el-col>
  598. <el-col :span="1.5">
  599. <el-button
  600. type="warning"
  601. size="mini"
  602. icon="el-icon-delete"
  603. :disabled="updateCourse.ids.length <= 0"
  604. @click="handleDeleteCourse"
  605. v-hasPermi="['course:period:dayRemove']"
  606. >删除课程</el-button>
  607. </el-col>
  608. </el-row>
  609. <el-table ref="courseTable" v-loading="course.loading" :data="course.list" @selection-change="handleSelectionCourseChange" border>
  610. <el-table-column type="selection" width="55" align="center" />
  611. <el-table-column label="课程" align="center" prop="courseName" width="180" />
  612. <el-table-column label="小节" align="center" prop="videoName" />
  613. <el-table-column label="开课状态" align="center" prop="status" width="100">
  614. <template slot-scope="scope">
  615. <span v-if="periodSettingsData.freeMode === 1">
  616. <el-tag type="success">进行中</el-tag>
  617. </span>
  618. <span v-else>{{ courseStatusFormatter(scope.row) }}</span>
  619. </template>
  620. </el-table-column>
  621. <el-table-column label="营期时间" align="center" prop="dayDate" width="100"/>
  622. <el-table-column label="开始时间" align="center" prop="startDateTime" width="100">
  623. <!-- <template slot-scope="scope">-->
  624. <!-- <el-tag>{{scope.row.startDateTime}}</el-tag>-->
  625. <!-- </template>-->
  626. </el-table-column>
  627. <el-table-column label="结束时间" align="center" prop="endDateTime" width="120">
  628. <template slot-scope="scope">
  629. <span v-if="periodSettingsData.freeMode === 1">
  630. <el-tag type="warning">永不过期</el-tag>
  631. </span>
  632. <span v-else>{{ scope.row.endDateTime }}</span>
  633. </template>
  634. </el-table-column>
  635. <el-table-column label="领取红包时间" align="center" prop="lastJoinTime" width="160">
  636. <template slot-scope="scope">
  637. <el-tag type="danger">{{scope.row.lastJoinTime}}</el-tag>
  638. </template>
  639. </el-table-column>
  640. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  641. <template slot-scope="scope">
  642. <el-button
  643. size="mini"
  644. type="text"
  645. icon="el-icon-top"
  646. @click="handleTop(scope.row)"
  647. v-hasPermi="['course:period:courseMove']"
  648. >上移</el-button>
  649. <el-button
  650. size="mini"
  651. type="text"
  652. icon="el-icon-bottom"
  653. @click="handleBottom(scope.row)"
  654. v-hasPermi="['course:period:courseMove']"
  655. >下移</el-button>
  656. <el-button
  657. size="mini"
  658. type="text"
  659. icon="el-icon-edit"
  660. @click="handleUpdateDate(scope.row)"
  661. >修改营期时间</el-button>
  662. <el-button
  663. size="mini"
  664. type="text"
  665. icon="el-icon-delete"
  666. @click="handleDeleteCourse(scope.row)"
  667. v-hasPermi="['course:period:dayRemove']"
  668. >删除课程</el-button>
  669. </template>
  670. </el-table-column>
  671. </el-table>
  672. <pagination
  673. v-show="course.total > 0"
  674. :total="course.total"
  675. :page.sync="course.queryParams.pageNum"
  676. :limit.sync="course.queryParams.pageSize"
  677. @pagination="getCourseList"
  678. style="height: 40px"
  679. />
  680. </el-tab-pane>
  681. <el-tab-pane label="公司列表" name="company">
  682. <red-packet
  683. :visible.sync="redPacketVisible"
  684. :activeTab="activeTab"
  685. :periodId="periodSettingsData.periodId"
  686. @success="handleRedPacketSuccess"
  687. />
  688. </el-tab-pane>
  689. <el-tab-pane label="课程统计" name="statistics">
  690. <course-statistics
  691. :periodId="periodSettingsData.periodId"
  692. :active="activeTab === 'statistics'"
  693. />
  694. </el-tab-pane>
  695. </el-tabs>
  696. </div>
  697. </el-drawer>
  698. <batch-red-packet
  699. :visible.sync="batchRedPacketVisible"
  700. :selected-data="selectedPeriods"
  701. @success="handleBatchRedPacketSuccess"
  702. />
  703. <el-dialog
  704. :title="addExistCampPeriodName"
  705. :visible.sync="addExistCampPeriod"
  706. width="1000px"
  707. append-to-body
  708. @close="handleDialogClose"
  709. >
  710. <el-form ref="createCampPeriodForm" :model="createCampPeriodForm" :rules="campRules" label-width="500px">
  711. <el-form-item label="营期创建方式" prop="campPeriodType">
  712. <el-radio-group v-model="createCampPeriodForm.campPeriodType" @change="handlePeriodTypeChange">
  713. <el-radio :label="1">从当前训练营复制</el-radio>
  714. <el-radio :label="2">从其他训练营复制</el-radio>
  715. <el-radio :label="3">我要新建一个训练营</el-radio>
  716. </el-radio-group>
  717. </el-form-item>
  718. <!-- 从当前训练营复制 -->
  719. <el-form-item
  720. v-if="createCampPeriodForm.campPeriodType === 1"
  721. label="选择当前营期"
  722. prop="periodId"
  723. >
  724. <el-select
  725. v-model="createCampPeriodForm.periodId"
  726. placeholder="请选择当前营期"
  727. clearable
  728. >
  729. <el-option
  730. v-for="item in currentCampPeriods"
  731. :key="item.periodId"
  732. :label="item.periodName"
  733. :value="item.periodId"
  734. />
  735. </el-select>
  736. </el-form-item>
  737. <!-- 从其他训练营复制 -->
  738. <el-form-item
  739. v-if="createCampPeriodForm.campPeriodType === 2"
  740. label="选择其他营期"
  741. prop="periodId"
  742. >
  743. <el-select
  744. v-model="createCampPeriodForm.trainingCampId"
  745. placeholder="请选择训练营"
  746. :loading="loadingNew"
  747. clearable
  748. filterable
  749. @change="handleTrainingCampChange"
  750. >
  751. <el-option
  752. v-for="item in trainingCampList"
  753. :key="item.trainingCampId"
  754. :label="item.trainingCampName"
  755. :value="item.trainingCampId"
  756. />
  757. </el-select>
  758. <el-select
  759. v-model="createCampPeriodForm.periodId"
  760. placeholder="请选择营期"
  761. :loading="loadingNew"
  762. clearable
  763. filterable
  764. >
  765. <el-option
  766. v-for="item in otherCampPeriods"
  767. :key="item.periodId"
  768. :label="item.periodName"
  769. :value="item.periodId"
  770. />
  771. </el-select>
  772. <div v-if="loadingNew" class="loading-text">
  773. <i class="el-icon-loading"></i> 加载中...
  774. </div>
  775. </el-form-item>
  776. <!-- 新建营期 -->
  777. <el-form-item
  778. v-if="createCampPeriodForm.campPeriodType === 3"
  779. label="新建营期名称"
  780. prop="trainingCampName"
  781. >
  782. <el-input
  783. v-model="createCampPeriodForm.trainingCampName"
  784. placeholder="请输入新训练营名称"
  785. style="width: 300px"
  786. maxlength="50"
  787. show-word-limit
  788. />
  789. </el-form-item>
  790. </el-form>
  791. <div slot="footer" class="dialog-footer">
  792. <el-button type="primary" @click="copySubmitCampForm" :loading="submitLoading">确 定</el-button>
  793. <el-button @click="cancelExistCampPeriod" :disabled="submitLoading">取 消</el-button>
  794. </div>
  795. </el-dialog>
  796. </div>
  797. </template>
  798. <script>
  799. import {addPeriod, delPeriod, exportPeriod, getPeriod, pagePeriod, updatePeriod, getDays, addCourse,delPeriodDay, updateCourseTime, updateCourseDate, updateListCourseData, periodCourseMove, closePeriod, batchAddCourseSections,copyExistCampPeriod} from "@/api/course/userCoursePeriod";
  800. import {getCompanyList} from "@/api/company/company";
  801. import {listCamp, addCamp, editCamp, delCamp, copyCamp, getScreeningCampPeriod} from "@/api/course/userCourseCamp";
  802. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  803. import RedPacket from './redPacket.vue'
  804. import BatchRedPacket from './batchRedPacket.vue'
  805. import CourseStatistics from './statistics.vue'
  806. import Da from "element-ui/src/locale/lang/da";
  807. import { getConfigByKey } from '@/api/system/config'
  808. import {listUserCourse} from "@/api/course/userCourse";
  809. export default {
  810. name: "Period",
  811. components: {
  812. RedPacket,
  813. BatchRedPacket,
  814. CourseStatistics
  815. },
  816. data() {
  817. return {
  818. // 遮罩层
  819. loading: true,
  820. updateDateOpen: false,
  821. // 左侧遮罩层
  822. leftLoading: true,
  823. // 选中数组
  824. ids: [],
  825. // 非单个禁用
  826. single: true,
  827. // 非多个禁用
  828. multiple: true,
  829. // 显示搜索条件
  830. showSearch: true,
  831. // 总条数
  832. total: 0,
  833. // 左侧总条数
  834. leftTotal: 0,
  835. // 会员营期表格数据
  836. periodList: [],
  837. // 左侧列表数据
  838. leftList: [],
  839. videoList: [],
  840. // 弹出层标题
  841. title: "",
  842. isDisabledDateRange: false, //是否禁用开营日期
  843. // 是否显示弹出层
  844. open: false,
  845. // 查询参数
  846. queryParams: {
  847. pageNum: 1,
  848. pageSize: 10,
  849. periodName: null,
  850. periodStartingTime: null,
  851. periodEndTime: null,
  852. companyIdList: []
  853. },
  854. // 左侧查询参数
  855. leftQueryParams: {
  856. pageNum: 1,
  857. pageSize: 10,
  858. hasNextPage: false,
  859. scs: 'order_number(desc),training_camp_id(desc)',
  860. trainingCampName: null
  861. },
  862. // 表单参数
  863. form: {},
  864. // 课程相关数据
  865. course: {
  866. open: false,
  867. row:{},
  868. list:[],
  869. queryParams: {
  870. pageNum: 1,
  871. pageSize: 10,
  872. },
  873. loading: true,
  874. total: 0,
  875. addOpen: false,
  876. form: {},
  877. },
  878. //修改营期时间参数
  879. updatePeriodDate: {
  880. open: false,
  881. loading: true,
  882. ids: [],
  883. form: {},
  884. },
  885. joinTimeSwitch:true,
  886. updateCourse: {
  887. open: false,
  888. loading: true,
  889. ids: [],
  890. form: {
  891. timeRange: null,
  892. joinTime: null
  893. },
  894. },
  895. // 表单校验
  896. rules: {
  897. periodName: [
  898. { required: true, message: '营期名称不能为空', trigger: 'blur' }
  899. ],
  900. companyId: [
  901. { required: true, message: '公司不能为空', trigger: 'change' }
  902. ],
  903. courseStyle: [
  904. { required: true, message: '课程风格不能为空', trigger: 'change' }
  905. ],
  906. // redPacketGrantMethod: [
  907. // { required: true, message: '红包发放方式不能为空', trigger: 'change' }
  908. // ],
  909. periodType: [
  910. { required: true, message: '营期类型不能为空', trigger: 'change' }
  911. ],
  912. maxViewNum: [
  913. { required: true, message: '销售可查看天数不能为空', trigger: 'blur' }
  914. ],
  915. periodStartingTime: [
  916. { required: true, message: '开营日期不能为空', trigger: 'change' }
  917. ]
  918. },
  919. // 公司选项
  920. companyOptions: [],
  921. // 训练营列表
  922. campList: [],
  923. // 激活的训练营索引
  924. activeCampIndex: null,
  925. // 训练营对话框是否显示
  926. campDialogVisible: false,
  927. courseList: false,
  928. // 训练营表单
  929. campForm: {
  930. trainingCampId: null,
  931. trainingCampName: ''
  932. },
  933. // 训练营表单校验
  934. campRules: {
  935. trainingCampName: [
  936. { required: true, message: '训练营名称不能为空', trigger: 'blur' },
  937. { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' }
  938. ]
  939. },
  940. // 添加课程表单校验
  941. courseAddRules: {
  942. courseId: [
  943. { required: true, message: '请选择课程', trigger: 'change' }
  944. ],
  945. videoIds: [
  946. { required: true, message: '请选择小节', trigger: 'change' },
  947. { type: 'array', min: 1, message: '请至少选择一个小节', trigger: 'change' }
  948. ]
  949. },
  950. // 修改看课时间表单校验
  951. courseUpdateRules: {
  952. timeRange: [
  953. {
  954. required: true,
  955. validator: (rule, value, callback) => {
  956. if (!value || !Array.isArray(value) || value.length !== 2) {
  957. callback(new Error('请选择完整的看课时间范围'));
  958. } else {
  959. // 检查时间格式是否正确(yyyy-MM-dd HH:mm:ss)
  960. const timeRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
  961. if (!timeRegex.test(value[0]) || !timeRegex.test(value[1])) {
  962. callback(new Error('时间格式不正确'));
  963. } else if (value[0] >= value[1]) {
  964. callback(new Error('结束时间必须大于开始时间'));
  965. } else {
  966. callback();
  967. }
  968. }
  969. },
  970. trigger: 'change'
  971. }
  972. ],
  973. joinTime: [
  974. {
  975. required: true,
  976. validator: (rule, value, callback) => {
  977. if (!value) {
  978. callback(new Error('请选择领取红包时间'));
  979. } else {
  980. // 检查时间格式是否正确(yyyy-MM-dd HH:mm:ss)
  981. const timeRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
  982. if (!timeRegex.test(value)) {
  983. callback(new Error('时间格式不正确'));
  984. } else {
  985. // 检查领取红包时间是否在看课时间范围内
  986. const timeRange = this.updateCourse.form.timeRange;
  987. if (timeRange && Array.isArray(timeRange) && timeRange.length === 2) {
  988. if (value < timeRange[0] || value > timeRange[1]) {
  989. callback(new Error('领取红包时间必须在看课时间范围内'));
  990. } else {
  991. callback();
  992. }
  993. } else {
  994. callback();
  995. }
  996. }
  997. }
  998. },
  999. trigger: 'change'
  1000. }
  1001. ]
  1002. },
  1003. // 滚动节流标志
  1004. scrollThrottle: false,
  1005. // 加载更多状态
  1006. loadingMore: false,
  1007. // 设置红包对话框
  1008. redPacketVisible: false,
  1009. periodCompanyList: [],
  1010. currentRedPacketData: {
  1011. periodId: '',
  1012. videoId: ''
  1013. },
  1014. // 营期相关设置抽屉
  1015. periodSettingsVisible: false,
  1016. activeTab: 'course',
  1017. periodSettingsData: {},
  1018. companyList: [],
  1019. courseDialogVisible: false,
  1020. redPacketList: [],
  1021. currentCompany: null,
  1022. // 选中的营期数据
  1023. selectedPeriods: [],
  1024. // 批量设置红包按钮是否禁用
  1025. batchSetRedPacketDisabled: true,
  1026. // 批量设置红包弹出框
  1027. batchRedPacketVisible: false,
  1028. //课程选择
  1029. courseSelection: [],
  1030. courseSelectionIsAdd: true, // 默认新增状态,编辑时会设为false
  1031. // 训练营对话框是否显示
  1032. addExistCampPeriod: false,
  1033. addExistCampPeriodName: "新增已存在营期",
  1034. loadingNew: false,
  1035. submitLoading: false,
  1036. // 表单数据
  1037. createCampPeriodForm: {
  1038. campPeriodType: 1,
  1039. periodId: null,
  1040. trainingCampName: null,
  1041. },
  1042. // 数据列表
  1043. currentCampPeriods: [], // 当前训练营的期数列表
  1044. otherCampPeriods: [], // 其他训练营的期数列表
  1045. // 缓存数据避免重复请求
  1046. periodDataCache: new Map(),
  1047. trainingCampList:[],
  1048. };
  1049. },
  1050. created() {
  1051. courseList().then(response => {
  1052. this.courseList = response.list;
  1053. });
  1054. // this.getList();
  1055. this.getLeftList();
  1056. this.getCompanyList();
  1057. /** 获取课程下拉框*/
  1058. listUserCourse().then(response => {
  1059. this.courseSelection = response.rows;
  1060. });
  1061. },
  1062. methods: {
  1063. /** 删除按钮操作 */
  1064. async handleDeleteCourse(row) {
  1065. const periodDayIds = row.id || this.updateCourse.ids;
  1066. try {
  1067. await this.$confirm('是否确认删除该课程?', "提示", {
  1068. confirmButtonText: "确定",
  1069. cancelButtonText: "取消",
  1070. type: "warning"
  1071. });
  1072. const res = await delPeriodDay(periodDayIds);
  1073. if (res && res.code === 200) {
  1074. this.getCourseList();// 刷新列表
  1075. this.$message.success('删除成功');
  1076. } else {
  1077. this.$message.error(res.msg);
  1078. }
  1079. } catch (error) {
  1080. }
  1081. },
  1082. /** 查询会员营期列表 */
  1083. getList() {
  1084. this.loading = true;
  1085. const params = { ...this.queryParams };
  1086. pagePeriod(params).then(response => {
  1087. this.periodList = response.rows;
  1088. this.total = response.total;
  1089. this.loading = false;
  1090. });
  1091. },
  1092. /** 查询左侧列表 */
  1093. getLeftList() {
  1094. this.leftLoading = true;
  1095. // 重置页码和加载更多状态
  1096. this.leftQueryParams.pageNum = 1;
  1097. this.loadingMore = false;
  1098. // 训练营数据
  1099. listCamp(this.leftQueryParams).then(response => {
  1100. if (response && response.code === 200) {
  1101. this.campList = response.data.list || [];
  1102. this.leftQueryParams.hasNextPage = response.data.hasNextPage;
  1103. this.activeCampIndex = this.campList.length > 0 ? 0 : null;
  1104. this.selectCamp(this.activeCampIndex);
  1105. // 如果当前显示的列表高度不足以触发滚动,但还有更多数据,自动加载下一页
  1106. this.$nextTick(() => {
  1107. const scrollEl = this.$refs.campList;
  1108. if (scrollEl && this.leftQueryParams.hasNextPage && scrollEl.scrollHeight <= scrollEl.clientHeight) {
  1109. this.loadMoreCamps();
  1110. }
  1111. });
  1112. } else {
  1113. this.$message.error(response.msg || '获取训练营列表失败');
  1114. this.campList = [];
  1115. this.leftQueryParams.hasNextPage = false;
  1116. }
  1117. this.leftLoading = false;
  1118. }).catch(error => {
  1119. console.error('获取训练营列表失败:', error);
  1120. this.$message.error('获取训练营列表失败');
  1121. this.campList = [];
  1122. this.leftQueryParams.hasNextPage = false;
  1123. this.leftLoading = false;
  1124. });
  1125. },
  1126. /** 搜索按钮操作 */
  1127. handleQuery() {
  1128. this.queryParams.pageNum = 1;
  1129. this.getList();
  1130. },
  1131. /** 左侧搜索按钮操作 */
  1132. handleLeftQuery() {
  1133. // 重置页码和列表
  1134. this.leftQueryParams.pageNum = 1;
  1135. this.campList = [];
  1136. this.getLeftList();
  1137. },
  1138. /** 重置按钮操作 */
  1139. resetQuery() {
  1140. this.resetForm("queryForm");
  1141. this.queryParams.companyIdList = [];
  1142. this.handleQuery();
  1143. },
  1144. /** 多选框选中数据 */
  1145. handleSelectionChange(selection) {
  1146. this.ids = selection.map(item => item.periodId)
  1147. this.single = selection.length!==1
  1148. this.multiple = !selection.length
  1149. // 更新批量设置红包相关数据
  1150. this.selectedPeriods = selection;
  1151. this.batchSetRedPacketDisabled = selection.length === 0;
  1152. },
  1153. handleSelectionCourseChange(selection) {
  1154. this.updateCourse.ids = selection.map(item => item.id)
  1155. },
  1156. /** 新增按钮操作 */
  1157. handleAdd() {
  1158. this.courseSelectionIsAdd = true;
  1159. this.reset();
  1160. this.open = true;
  1161. this.title = "添加会员营期";
  1162. this.isDisabledDateRange = false;
  1163. },
  1164. /** 修改按钮操作 */
  1165. handleUpdate(row) {
  1166. this.courseSelectionIsAdd = false;
  1167. this.reset();
  1168. const periodId = row.periodId || this.ids
  1169. getPeriod(periodId).then(response => {
  1170. this.form = response.data;
  1171. if (this.form.companyId) {
  1172. this.form.companyId = this.form.companyId.split(',').map(id => Number(id));
  1173. }
  1174. // 设置看课时间范围(回显)
  1175. if (this.form.viewStartTime && this.form.viewEndTime) {
  1176. this.form.timeRange = [this.form.viewStartTime, this.form.viewEndTime];
  1177. }
  1178. if(this.form.periodType == 1){
  1179. this.$set(this.form,'dateRange',[this.form.periodStartingTime, this.form.periodEndTime])
  1180. }
  1181. if(this.form.periodType == 2){
  1182. this.$set(this.form,'date',this.form.periodStartingTime)
  1183. }
  1184. this.open = true;
  1185. this.title = "修改会员营期";
  1186. this.isDisabledDateRange = true;
  1187. });
  1188. },
  1189. /** 提交按钮 */
  1190. submitForm() {
  1191. this.$refs["form"].validate(valid => {
  1192. if (valid) {
  1193. // 显示加载提示(全屏遮罩+转圈)
  1194. const loading = this.$loading({
  1195. lock: true, // 锁定屏幕滚动
  1196. text: '提交中,请稍候...', // 提示文本
  1197. spinner: 'el-icon-loading', // 加载图标
  1198. background: 'rgba(0, 0, 0, 0.7)' // 背景遮罩
  1199. });
  1200. let data = JSON.parse(JSON.stringify(this.form));
  1201. // 处理看课时间范围
  1202. if (data.timeRange && data.timeRange.length === 2) {
  1203. data.viewStartTime = data.timeRange[0];
  1204. data.viewEndTime = data.timeRange[1];
  1205. }
  1206. data.companyId = data.companyId.join();
  1207. data.trainingCampId = this.queryParams.trainingCampId;
  1208. const request = data.periodId != null ? updatePeriod(data) : addPeriod(data);
  1209. request.then(response => {
  1210. if (response.code === 200) {
  1211. this.msgSuccess(data.periodId != null ? "修改成功" : "新增成功");
  1212. this.open = false;
  1213. this.getList();
  1214. }
  1215. }).finally(() => {
  1216. // 无论成功失败,都关闭加载提示
  1217. loading.close();
  1218. });
  1219. }
  1220. });
  1221. },
  1222. /** 删除按钮操作 */
  1223. async handleDelete(row) {
  1224. const periodIds = row.periodId || this.ids;
  1225. try {
  1226. await this.$confirm('是否确认删除该营期?', "提示", {
  1227. confirmButtonText: "确定",
  1228. cancelButtonText: "取消",
  1229. type: "warning"
  1230. });
  1231. const res = await delPeriod(periodIds);
  1232. if (res && res.code === 200) {
  1233. this.getList(); // 刷新列表
  1234. this.$message.success('删除成功');
  1235. } else {
  1236. this.$message.error(res.msg);
  1237. }
  1238. } catch (error) {
  1239. }
  1240. },
  1241. /** 导出按钮操作 */
  1242. handleExport() {
  1243. const queryParams = this.queryParams;
  1244. this.$confirm('是否确认导出所有会员营期数据项?', "警告", {
  1245. confirmButtonText: "确定",
  1246. cancelButtonText: "取消",
  1247. type: "warning"
  1248. }).then(function() {
  1249. return exportPeriod(queryParams);
  1250. }).then(response => {
  1251. this.download(response.msg);
  1252. }).catch(function() {});
  1253. },
  1254. /** 批量设置红包 */
  1255. handleBatchSetRedPacket() {
  1256. if (this.selectedPeriods.length === 0) {
  1257. this.$message.warning('请至少选择一个营期');
  1258. return;
  1259. }
  1260. this.batchRedPacketVisible = true;
  1261. },
  1262. /** 处理批量设置红包保存 */
  1263. // handleBatchRedPacketSave(data) {
  1264. // // 这里等待接口提供后补充具体实现
  1265. // // 示例代码:
  1266. // // batchSetRedPacket(data).then(response => {
  1267. // // if (response.code === 200) {
  1268. // // this.$message.success('批量设置成功');
  1269. // // this.getList();
  1270. // // }
  1271. // // });
  1272. // this.batchRedPacketVisible = false;
  1273. // },
  1274. /** 获取公司下拉列表*/
  1275. getCompanyList() {
  1276. this.loading = true;
  1277. getCompanyList().then(response => {
  1278. this.companyOptions = response.data;
  1279. this.loading = false;
  1280. });
  1281. },
  1282. // 取消按钮
  1283. cancel() {
  1284. this.open = false;
  1285. this.reset();
  1286. },
  1287. // 表单重置
  1288. reset() {
  1289. this.form = {
  1290. periodId: null,
  1291. periodName: null,
  1292. companyId: null,
  1293. courseId: null,
  1294. videoId: null,
  1295. trainingCampId: null,
  1296. createTime: null,
  1297. updateTime: null,
  1298. courseStyle: null,
  1299. liveRoomStyle: null,
  1300. redPacketGrantMethod: 1,
  1301. periodType: 1,
  1302. periodStartingTime: null,
  1303. dateRange: [],
  1304. date: null,
  1305. days: [],
  1306. maxViewNum: 0,
  1307. periodEndTime: null,
  1308. timeRange: [], // 看课时间范围
  1309. viewStartTime: null, // 看课开始时间
  1310. viewEndTime: null, // 看课结束时间
  1311. lastJoinTime: null, // 领取红包时间
  1312. freeMode: 0 // 是否开启自由模式,默认关闭
  1313. };
  1314. this.resetForm("form");
  1315. },
  1316. // 处理训练营列表的逻辑
  1317. handleDeleteCamp(item) {
  1318. this.$confirm(`确定要删除训练营"${item.trainingCampName}"吗?`, '提示', {
  1319. confirmButtonText: '删除',
  1320. cancelButtonText: '取消',
  1321. type: 'warning'
  1322. }).then(() => {
  1323. // 调用删除训练营API
  1324. const trainingCampId = item.trainingCampId;
  1325. this.leftLoading = true;
  1326. delCamp(trainingCampId).then(response => {
  1327. if (response.code === 200) {
  1328. this.$message.success('删除成功');
  1329. // 从列表中移除
  1330. const index = this.campList.findIndex(camp => camp.trainingCampId === trainingCampId);
  1331. if (index !== -1) {
  1332. this.campList.splice(index, 1);
  1333. }
  1334. // 如果删除的是当前选中的训练营,则重置选中状态
  1335. if (this.activeCampIndex === index) {
  1336. this.activeCampIndex = this.campList.length > 0 ? 0 : null;
  1337. if (this.activeCampIndex !== null) {
  1338. // 更新右侧列表
  1339. this.selectCamp(this.activeCampIndex);
  1340. } else {
  1341. // 没有训练营了,清空右侧列表
  1342. this.periodList = [];
  1343. }
  1344. }
  1345. } else {
  1346. this.$message.error(response.msg || '删除失败');
  1347. }
  1348. this.leftLoading = false;
  1349. }).catch(error => {
  1350. // this.$message.error('删除失败: ' + error.message);
  1351. this.leftLoading = false;
  1352. });
  1353. }).catch(() => {
  1354. this.$message.info('已取消删除');
  1355. });
  1356. },
  1357. /** 复制训练营 */
  1358. handleCopyCamp(item) {
  1359. // 调用添加训练营API
  1360. copyCamp(item.trainingCampId).then(response => {
  1361. if (response.code === 200) {
  1362. this.$message.success('复制成功');
  1363. // 重新加载训练营列表
  1364. this.getLeftList();
  1365. } else {
  1366. this.$message.error(response.msg || '复制训练营失败');
  1367. }
  1368. }).catch(error => {
  1369. this.$message.error('复制训练营失败: ' + error.message);
  1370. });
  1371. },
  1372. /** 修改训练营按钮操作 */
  1373. handleEditCamp(item) {
  1374. this.resetCampForm();
  1375. this.leftLoading = true;
  1376. // 获取最新的训练营数据
  1377. const trainingCampId = item.trainingCampId;
  1378. // 应该调用获取训练营详情的API
  1379. setTimeout(() => {
  1380. // 填充表单数据
  1381. this.campForm = {
  1382. trainingCampId: item.trainingCampId,
  1383. trainingCampName: item.trainingCampName,
  1384. orderNumber: item.orderNumber || 1,
  1385. status: item.status !== undefined ? item.status : 1
  1386. };
  1387. this.campDialogVisible = true;
  1388. this.leftLoading = false;
  1389. }, 300);
  1390. },
  1391. /** 新建训练营按钮操作 */
  1392. handleAddTrainingCamp() {
  1393. this.resetCampForm();
  1394. this.campDialogVisible = true;
  1395. },
  1396. /** 重置训练营表单 */
  1397. resetCampForm() {
  1398. this.campForm = {
  1399. trainingCampId: null,
  1400. trainingCampName: ''
  1401. };
  1402. // 如果表单已经创建,则重置校验结果
  1403. if (this.$refs.campForm) {
  1404. this.$refs.campForm.resetFields();
  1405. }
  1406. },
  1407. /** 取消训练营表单 */
  1408. cancelCampForm() {
  1409. this.campDialogVisible = false;
  1410. this.resetCampForm();
  1411. },
  1412. /** 提交训练营表单 */
  1413. submitCampForm() {
  1414. this.$refs.campForm.validate(valid => {
  1415. if (valid) {
  1416. // 显示加载中
  1417. this.leftLoading = true;
  1418. // 准备提交的数据
  1419. const submitData = JSON.parse(JSON.stringify(this.campForm));
  1420. // 判断是新增还是修改
  1421. if (submitData.trainingCampId) {
  1422. // 修改训练营
  1423. editCamp(submitData).then(response => {
  1424. if (response.code === 200) {
  1425. this.$message.success('修改训练营成功');
  1426. this.campDialogVisible = false;
  1427. // 更新列表中的数据
  1428. const index = this.campList.findIndex(camp => camp.trainingCampId === submitData.trainingCampId);
  1429. if (index !== -1) {
  1430. this.campList[index] = { ...this.campList[index], ...submitData };
  1431. // 如果修改的是当前选中的训练营,更新右侧列表
  1432. if (this.activeCampIndex === index) {
  1433. this.selectCamp(index);
  1434. }
  1435. }
  1436. // 重新加载训练营列表
  1437. this.getLeftList();
  1438. } else {
  1439. this.$message.error(response.msg || '修改训练营失败');
  1440. this.leftLoading = false;
  1441. }
  1442. }).catch(error => {
  1443. this.$message.error('修改训练营失败: ' + (error.message || '未知错误'));
  1444. this.leftLoading = false;
  1445. });
  1446. } else {
  1447. // 新增训练营
  1448. addCamp(submitData).then(response => {
  1449. if (response.code === 200) {
  1450. this.$message.success('新建训练营成功');
  1451. this.campDialogVisible = false;
  1452. // 重新加载训练营列表
  1453. this.getLeftList();
  1454. } else {
  1455. this.$message.error(response.msg || '新建训练营失败');
  1456. this.leftLoading = false;
  1457. }
  1458. }).catch(error => {
  1459. this.$message.error('新建训练营失败: ' + (error.message || '未知错误'));
  1460. this.leftLoading = false;
  1461. });
  1462. }
  1463. }
  1464. });
  1465. },
  1466. /** 排序方式改变 */
  1467. handleSortChange(value) {
  1468. this.leftQueryParams.scs = value;
  1469. // 重置页码和列表
  1470. this.leftQueryParams.pageNum = 1;
  1471. this.campList = [];
  1472. this.getLeftList();
  1473. },
  1474. /** 选中训练营 */
  1475. selectCamp(index) {
  1476. if(index == null || index == undefined) return;
  1477. this.activeCampIndex = index;
  1478. // 加载对应的训练营营期数据
  1479. const selectedCamp = this.campList[index];
  1480. this.queryParams.trainingCampId = selectedCamp.trainingCampId;
  1481. this.trainingCampIdValue=selectedCamp.trainingCampId;
  1482. this.getList();
  1483. },
  1484. /** 处理滚动事件,实现滚动到底部加载更多 */
  1485. handleScroll() {
  1486. // 如果正在节流中或者正在加载中,则不处理
  1487. if (this.scrollThrottle || this.loadingMore) return;
  1488. // 设置节流,200ms内不再处理滚动事件
  1489. this.scrollThrottle = true;
  1490. setTimeout(() => {
  1491. this.scrollThrottle = false;
  1492. }, 200);
  1493. const scrollEl = this.$refs.campList;
  1494. if (!scrollEl) return;
  1495. // 判断是否滚动到底部:滚动高度 + 可视高度 >= 总高度 - 30(添加30px的容差,提前触发加载)
  1496. const isBottom = scrollEl.scrollTop + scrollEl.clientHeight >= scrollEl.scrollHeight - 30;
  1497. // 如果滚动到底部,且有下一页数据,且当前不在加载中,则加载更多
  1498. if (isBottom && this.leftQueryParams.hasNextPage && !this.leftLoading && !this.loadingMore) {
  1499. this.loadMoreCamps();
  1500. }
  1501. },
  1502. /** 加载更多训练营数据 */
  1503. loadMoreCamps() {
  1504. // 已在加载中,防止重复加载
  1505. if (this.leftLoading || this.loadingMore) return;
  1506. // 设置加载状态
  1507. this.loadingMore = true;
  1508. // 页码加1
  1509. this.leftQueryParams.pageNum += 1;
  1510. // 加载下一页数据
  1511. listCamp(this.leftQueryParams).then(response => {
  1512. if (response && response.code === 200) {
  1513. // 将新数据追加到列表中
  1514. const newList = response.data.list || [];
  1515. if (newList.length > 0) {
  1516. this.campList = [...this.campList, ...newList];
  1517. }
  1518. // 更新是否有下一页的标志
  1519. this.leftQueryParams.hasNextPage = response.data.hasNextPage;
  1520. // 如果当前显示的列表高度不足以触发滚动,但还有更多数据,自动加载下一页
  1521. this.$nextTick(() => {
  1522. const scrollEl = this.$refs.campList;
  1523. if (scrollEl && this.leftQueryParams.hasNextPage && scrollEl.scrollHeight <= scrollEl.clientHeight) {
  1524. // 延迟一点再加载下一页,避免过快加载
  1525. setTimeout(() => {
  1526. this.loadMoreCamps();
  1527. }, 300);
  1528. }
  1529. });
  1530. } else {
  1531. this.$message.error(response.msg || '加载更多训练营失败');
  1532. }
  1533. this.loadingMore = false;
  1534. }).catch(error => {
  1535. console.error('加载更多训练营失败:', error);
  1536. this.$message.error('加载更多训练营失败');
  1537. this.loadingMore = false;
  1538. });
  1539. },
  1540. timeChange(type) {
  1541. if (type == 1) {
  1542. this.form.periodStartingTime = this.form.dateRange[0];
  1543. this.form.periodEndTime = this.form.dateRange[1];
  1544. if (!Array.isArray(this.form.days)) {
  1545. this.form.days = [];
  1546. }
  1547. this.form.days = [];
  1548. let days = this.getDiff(this.form.periodStartingTime, this.form.periodEndTime);
  1549. for (let i = 0; i < days; i++) {
  1550. this.form.days.push({ lesson: i + 1 });
  1551. }
  1552. }
  1553. if (type == 2) {
  1554. this.form.periodStartingTime = this.form.date;
  1555. this.form.periodEndTime = this.form.date;
  1556. this.form.days = [];
  1557. }
  1558. },
  1559. /** 一键设置结束日期为2099-12-31 */
  1560. setEndDateTo2099() {
  1561. // 检查是否有开始日期
  1562. if (!this.form.dateRange || !this.form.dateRange[0]) {
  1563. this.$message.warning('请先选择开始日期');
  1564. return;
  1565. }
  1566. this.$confirm('是否将结束日期设置为 2099-12-31?', '提示', {
  1567. confirmButtonText: '确定',
  1568. cancelButtonText: '取消',
  1569. type: 'info'
  1570. }).then(() => {
  1571. // 保持开始日期,修改结束日期
  1572. this.form.dateRange = [this.form.dateRange[0], '2099-12-31'];
  1573. // 触发时间变更事件
  1574. this.timeChange(1);
  1575. this.$message.success('已将结束日期设置为 2099-12-31');
  1576. }).catch(() => {
  1577. this.$message.info('已取消操作');
  1578. });
  1579. },
  1580. getDiff(start, end) {
  1581. if(start == null || start == undefined || start == '') return 0;
  1582. if(end == null || end == undefined || end == '') return 0;
  1583. if(start == end) 1;
  1584. const startDate = this.getUTCDate(start);
  1585. const endDate = this.getUTCDate(end);
  1586. const timeDiff = endDate - startDate;
  1587. return (Math.floor(timeDiff / (1000 * 3600 * 24))) + 1; // 直接取整
  1588. },
  1589. getUTCDate(dateStr) {
  1590. const [year, month, day] = dateStr.split('-').map(Number);
  1591. return new Date(Date.UTC(year, month - 1, day)); // 月份从0开始
  1592. },
  1593. // handleCourse(row){
  1594. // this.course = {
  1595. // open: false,
  1596. // row:{},
  1597. // list:[],
  1598. // queryParams: {
  1599. // pageNum: 1,
  1600. // pageSize: 3, // 修改为每页显示3条
  1601. // },
  1602. // loading: true,
  1603. // total: 0,
  1604. // addOpen: false,
  1605. // form: {},
  1606. // };
  1607. // this.course.open = true;
  1608. // this.course.row = row;
  1609. // this.course.queryParams.periodId = row.periodId;
  1610. // this.getCourseList();
  1611. // },
  1612. getCourseList(){
  1613. this.course.loading = true;
  1614. getDays(this.course.queryParams).then(e => {
  1615. this.course.list = e.rows;
  1616. this.course.total = e.total;
  1617. this.course.loading = false;
  1618. });
  1619. },
  1620. handleAddCourse() {
  1621. const key = "joinTime.switch.config"
  1622. getConfigByKey(key).then(response => {
  1623. const {code,data} = response
  1624. if (code === 200) {
  1625. let value = data?.configValue
  1626. console.log(value)
  1627. if (value) {
  1628. this.joinTimeSwitch = value=='0'?true:false;
  1629. }
  1630. }
  1631. });
  1632. this.course.addOpen = true;
  1633. this.course.form = {
  1634. periodId: this.course.queryParams.periodId,
  1635. courseId: null,
  1636. timeRange: ['00:00:00', '23:59:59'],
  1637. joinTime: '23:59:59',
  1638. videoIds: []
  1639. };
  1640. // 重置表单
  1641. this.$nextTick(() => {
  1642. if (this.$refs.courseAddForm) {
  1643. this.$refs.courseAddForm.resetFields();
  1644. }
  1645. });
  1646. },
  1647. handleUpdateCourse() {
  1648. const key = "joinTime.switch.config"
  1649. getConfigByKey(key).then(response => {
  1650. const {code,data} = response
  1651. if (code === 200) {
  1652. let value = data?.configValue
  1653. console.log(value)
  1654. if (value) {
  1655. this.joinTimeSwitch = value=='0'?true:false;
  1656. }
  1657. }
  1658. })
  1659. this.updateCourse.open = true;
  1660. this.updateCourse.form = {
  1661. ids: this.updateCourse.ids,
  1662. timeRange: null,
  1663. joinTime: null
  1664. };
  1665. // 重置表单校验状态(但不清空选中状态)
  1666. this.$nextTick(() => {
  1667. if (this.$refs.courseUpdateForm) {
  1668. this.$refs.courseUpdateForm.resetFields();
  1669. }
  1670. });
  1671. },
  1672. closeAddCourse() {
  1673. this.course.addOpen = false;
  1674. this.course.form = {
  1675. periodId: null,
  1676. courseId: null,
  1677. timeRange: null,
  1678. joinTime: null,
  1679. videoIds: []
  1680. };
  1681. // 重置表单
  1682. if (this.$refs.courseAddForm) {
  1683. this.$refs.courseAddForm.resetFields();
  1684. }
  1685. },
  1686. closeUpdateCourse() {
  1687. this.updateCourse.open = false;
  1688. // 清空选中的课程id,使【修改看课时间】按钮变为禁用状态
  1689. this.updateCourse.ids = [];
  1690. // 清空课程列表的选中状态
  1691. this.$nextTick(() => {
  1692. if (this.$refs.courseTable) {
  1693. this.$refs.courseTable.clearSelection();
  1694. }
  1695. });
  1696. // 重置表单数据
  1697. this.updateCourse.form = {
  1698. ids: [],
  1699. timeRange: null,
  1700. joinTime: null
  1701. };
  1702. // 重置表单校验
  1703. this.$nextTick(() => {
  1704. if (this.$refs.courseUpdateForm) {
  1705. this.$refs.courseUpdateForm.resetFields();
  1706. }
  1707. });
  1708. },
  1709. courseChange(row){
  1710. this.course.form.videoIds = [];
  1711. videoList(row).then(response => {
  1712. this.videoList=response.list
  1713. });
  1714. },
  1715. submitCourseForm(){
  1716. this.$refs.courseAddForm.validate(valid => {
  1717. if (valid) {
  1718. if(this.course.form.timeRange != null && this.course.form.timeRange.length === 2){
  1719. this.course.form.startTime = this.course.form.timeRange[0];
  1720. this.course.form.endTime1 = this.course.form.timeRange[1];
  1721. }
  1722. // 检查是否有选择的小节
  1723. if (!this.course.form.videoIds || this.course.form.videoIds.length === 0) {
  1724. this.$message.warning('请选择至少一个小节');
  1725. return;
  1726. }
  1727. // 如果选择了多个小节,使用批量添加接口
  1728. if (this.course.form.videoIds.length > 1) {
  1729. const batchData = {
  1730. periodId: this.course.form.periodId,
  1731. courseId: this.course.form.courseId,
  1732. videoIds: this.course.form.videoIds,
  1733. startTime: this.course.form.startTime,
  1734. endTime1: this.course.form.endTime1,
  1735. endDateTime: this.course.form.endTime1, // 添加endDateTime参数
  1736. joinTime: this.course.form.joinTime
  1737. };
  1738. // 调用批量添加小节接口
  1739. batchAddCourseSections(batchData).then(response => {
  1740. if (response.code === 200) {
  1741. this.$message.success('批量添加课程成功');
  1742. this.course.addOpen = false;
  1743. this.getCourseList();
  1744. } else {
  1745. this.$message.error(response.msg || '批量添加课程失败');
  1746. }
  1747. }).catch(error => {
  1748. this.$message.error('批量添加课程失败:' + (error.message || '未知错误'));
  1749. });
  1750. } else {
  1751. // 单个小节,使用原来的接口
  1752. addCourse(this.course.form).then(response => {
  1753. this.$message.success('添加成功');
  1754. this.course.addOpen = false;
  1755. this.getCourseList();
  1756. }).catch(error => {
  1757. this.$message.error('添加失败:' + (error.message || '未知错误'));
  1758. });
  1759. }
  1760. }
  1761. });
  1762. },
  1763. /** 批量选择小节 */
  1764. handleBatchSelectSections() {
  1765. if (!this.course.form.courseId) {
  1766. this.$message.warning('请先选择课程');
  1767. return;
  1768. }
  1769. if (!this.videoList || this.videoList.length === 0) {
  1770. this.$message.warning('该课程下暂无可选择的小节');
  1771. return;
  1772. }
  1773. this.$confirm('确认要批量选择所有小节吗?', '提示', {
  1774. confirmButtonText: '确定',
  1775. cancelButtonText: '取消',
  1776. type: 'info'
  1777. }).then(() => {
  1778. // 获取所有可用的小节ID
  1779. const allVideoIds = this.videoList.map(video => parseInt(video.dictValue));
  1780. // 获取剩余可选择数量
  1781. const remainingLimit = this.getDiff(this.periodSettingsData.periodStartingTime, this.periodSettingsData.periodEndTime) - this.course.total;
  1782. // 调试信息
  1783. console.log('批量选择调试信息:', {
  1784. 营期开始时间: this.periodSettingsData.periodStartingTime,
  1785. 营期结束时间: this.periodSettingsData.periodEndTime,
  1786. 营期总天数: this.getDiff(this.periodSettingsData.periodStartingTime, this.periodSettingsData.periodEndTime),
  1787. 已有课程数: this.course.total,
  1788. 剩余可选择数量: remainingLimit,
  1789. 可用小节总数: allVideoIds.length
  1790. });
  1791. // 只选择剩余数量内的小节
  1792. const selectedVideoIds = allVideoIds.slice(0, remainingLimit);
  1793. if (selectedVideoIds.length === 0) {
  1794. this.$message.warning('已达到营期天数限制,无法添加更多小节');
  1795. return;
  1796. }
  1797. // 将选中的小节ID设置到表单中(只是选择,不调用API)
  1798. this.course.form.videoIds = selectedVideoIds;
  1799. this.$message.success(`批量选择成功,已选择 ${selectedVideoIds.length} 个小节`);
  1800. }).catch(() => {
  1801. this.$message.info('已取消批量选择');
  1802. });
  1803. },
  1804. submitUpdateCourseForm(){
  1805. this.$refs.courseUpdateForm.validate(valid => {
  1806. if (valid) {
  1807. // 检查时间范围是否正确
  1808. if (this.updateCourse.form.timeRange &&
  1809. Array.isArray(this.updateCourse.form.timeRange) &&
  1810. this.updateCourse.form.timeRange.length === 2) {
  1811. this.updateCourse.form.startTime = this.updateCourse.form.timeRange[0];
  1812. this.updateCourse.form.endTime1 = this.updateCourse.form.timeRange[1];
  1813. } else {
  1814. this.$message.error('请先选择正确的看课时间范围');
  1815. return;
  1816. }
  1817. // 检查领取红包时间是否正确
  1818. if (!this.updateCourse.form.joinTime&&this.joinTimeSwitch) {
  1819. this.$message.error('请选择领取红包时间');
  1820. return;
  1821. }
  1822. // 提交数据
  1823. updateCourseTime(this.updateCourse.form).then(response => {
  1824. this.$message.success('修改成功');
  1825. this.updateCourse.open = false;
  1826. // 清空选中的课程ID,使【修改看课时间】按钮变为禁用状态
  1827. this.updateCourse.ids = [];
  1828. // 清空课程列表的选中状态
  1829. this.$nextTick(() => {
  1830. if (this.$refs.courseTable) {
  1831. this.$refs.courseTable.clearSelection();
  1832. }
  1833. });
  1834. // 重新加载训练营列表
  1835. this.getCourseList();
  1836. }).catch(error => {
  1837. this.$message.error('修改失败:' + (error.message || '未知错误'));
  1838. });
  1839. }
  1840. });
  1841. },
  1842. updatePeriodDateSubmit(){
  1843. updateCourseDate(this.updatePeriodDate.form).then(response => {
  1844. this.$message.success('修改成功');
  1845. this.updatePeriodDate.open = false;
  1846. // 重新加载课程列表
  1847. this.getCourseList();
  1848. });
  1849. },
  1850. // saveCourseData(){
  1851. // updateListCourseData(this.course.list).then(response => {
  1852. // this.$message.success('保存成功');
  1853. // this.getCourseList();
  1854. // });
  1855. // },
  1856. // setRedPacket(row) {
  1857. // this.currentRedPacketData = {
  1858. // periodId: row.periodId
  1859. // // videoId: row.videoId
  1860. // };
  1861. // this.redPacketVisible = true;
  1862. // },
  1863. handleRedPacketSuccess() {
  1864. this.getCourseList();
  1865. },
  1866. handlePeriodSettings(row) {
  1867. this.periodSettingsData = row;
  1868. this.periodSettingsVisible = true;
  1869. // 初始化课程列表
  1870. this.course.queryParams.periodId = row.periodId;
  1871. // 根据当前激活的tab加载对应数据
  1872. this.handleTabClick({ name: this.activeTab });
  1873. },
  1874. // 结束营期
  1875. handleClosePeriod(row) {
  1876. const msg = `注: 1.确认结束营期,该营期的开营结束时间改为当天24点。2.当天正在播放中的课程不变。3.第二天如有未开始的课程,统一改为已结束。是否确认结束 ${row.periodName} 营期吗?`
  1877. this.$confirm(msg, "警告", {
  1878. confirmButtonText: "确定",
  1879. cancelButtonText: "取消",
  1880. type: "warning"
  1881. }).then(() => {
  1882. closePeriod({id: row.periodId}).then(response => {
  1883. if (response.code === 200) {
  1884. this.getList()
  1885. } else {
  1886. this.$message.error(response.msg)
  1887. }
  1888. })
  1889. }).catch(() => {})
  1890. },
  1891. handleBatchRedPacketSuccess() {
  1892. this.batchRedPacketVisible = false;
  1893. this.getCourseList();
  1894. },
  1895. /** 处理tab切换 */
  1896. handleTabClick(tab) {
  1897. if (tab.name === 'course') {
  1898. this.getCourseList();
  1899. } else if (tab.name === 'company') {
  1900. this.redPacketVisible = true;
  1901. }
  1902. },
  1903. /** 上移课程 */
  1904. handleTop(row) {
  1905. const currentIndex = this.course.list.findIndex(item => item.id === row.id);
  1906. if (currentIndex <= 0) {
  1907. this.$message.warning('已经是第一条数据');
  1908. return;
  1909. }
  1910. // 获取上一条数据
  1911. const prevRow = this.course.list[currentIndex - 1];
  1912. console.log({
  1913. id: row.id,
  1914. targetId: prevRow.id,
  1915. type: 1 //上移
  1916. })
  1917. periodCourseMove({
  1918. id: row.id,
  1919. targetId: prevRow.id,
  1920. type: 1 //上移
  1921. }).then(response => {
  1922. if (response.code === 200) {
  1923. this.$message.success('上移成功');
  1924. this.getCourseList();
  1925. } else {
  1926. this.$message.error(response.msg || '上移失败');
  1927. }
  1928. }).catch(() => {
  1929. this.$message.error('上移失败');
  1930. });
  1931. },
  1932. /** 下移课程 */
  1933. handleBottom(row) {
  1934. const currentIndex = this.course.list.findIndex(item => item.id === row.id);
  1935. if (currentIndex === -1 || currentIndex >= this.course.list.length - 1) {
  1936. this.$message.warning('已经是最后一条数据');
  1937. return;
  1938. }
  1939. // 获取下一条数据
  1940. const nextRow = this.course.list[currentIndex + 1];
  1941. periodCourseMove({
  1942. id: row.id,
  1943. targetId: nextRow.id,
  1944. type: 2 //下移
  1945. }).then(response => {
  1946. if (response.code === 200) {
  1947. this.$message.success('下移成功');
  1948. this.getCourseList(); // 重新加载列表
  1949. } else {
  1950. this.$message.error(response.msg || '下移失败');
  1951. }
  1952. }).catch(() => {
  1953. this.$message.error('下移失败');
  1954. });
  1955. },
  1956. /** 营期状态格式化 */
  1957. periodStatusFormatter(row) {
  1958. const statusMap = {
  1959. 1: '未开始',
  1960. 2: '进行中',
  1961. 3: '已结束'
  1962. };
  1963. return statusMap[row.periodStatus] || '未知状态';
  1964. },
  1965. /** 开课状态格式化 */
  1966. courseStatusFormatter(row) {
  1967. const statusMap = {
  1968. 0: '未开始',
  1969. 1: '进行中',
  1970. 2: '已结束'
  1971. };
  1972. return statusMap[row.status] || '未知状态';
  1973. },
  1974. /** 营期状态格式化 */
  1975. handleUpdateDate(row) {
  1976. this.updatePeriodDate.form = {id: row.id, dayDate: row.dayDate};
  1977. this.updatePeriodDate.open = true;
  1978. },
  1979. // disabledDate(time) {
  1980. // return time.getTime() < new Date(new Date().setHours(0,0,0,0));
  1981. // },
  1982. getPickerOptions() {
  1983. // 如果已选择看课时间范围,则领取红包时间应在看课时间范围内
  1984. if (this.updateCourse.form.timeRange &&
  1985. Array.isArray(this.updateCourse.form.timeRange) &&
  1986. this.updateCourse.form.timeRange.length === 2) {
  1987. return {
  1988. selectableRange: `${this.updateCourse.form.timeRange[0]} - ${this.updateCourse.form.timeRange[1]}`
  1989. };
  1990. }
  1991. // 默认全天可选
  1992. return {
  1993. selectableRange: '00:00:00 - 23:59:59'
  1994. };
  1995. },
  1996. onTimeRangeChange() {
  1997. // 当看课时间范围改变时,清空领取红包时间
  1998. this.updateCourse.form.joinTime = null;
  1999. // 强制更新组件以刷新领取红包时间的可选范围
  2000. this.$forceUpdate();
  2001. },
  2002. /** 新建存在训练营按钮操作 */
  2003. handleAddExistCampPeriod() {
  2004. this.resetForm();
  2005. this.addExistCampPeriod = true;
  2006. // 初始化当前训练营的期数列表
  2007. this.initCurrentCampPeriods();
  2008. },
  2009. /** 初始化当前训练营期数列表 */
  2010. initCurrentCampPeriods() {
  2011. this.currentCampPeriods = [...(this.periodList || [])];
  2012. },
  2013. /** 处理创建方式变更 */
  2014. async handlePeriodTypeChange(value) {
  2015. this.createCampPeriodForm.periodId = null;
  2016. this.createCampPeriodForm.trainingCampName = null;
  2017. if (value === 1) {
  2018. // 从当前训练营复制 - 使用本地数据
  2019. this.initCurrentCampPeriods();
  2020. } else if (value === 2) {
  2021. // 从其他训练营复制 - 需要请求接口
  2022. await this.loadOtherCampPeriods();
  2023. }
  2024. },
  2025. /** 加载其他训练营期数列表 */
  2026. async loadOtherCampPeriods() {
  2027. // 清空营期数据和选中项,避免显示旧数据
  2028. this.otherCampPeriods = [];
  2029. this.createCampPeriodForm.periodId = ''; // 清空已选营期
  2030. this.createCampPeriodForm.trainingCampId = ''; // 清空已选训练营
  2031. // 检查缓存 - 使用固定键名,因为训练营列表不依赖当前训练营ID
  2032. // const cacheKey = 'trainingCampList';
  2033. // if (this.periodDataCache.has(cacheKey)) {
  2034. // this.trainingCampList = this.periodDataCache.get(cacheKey);
  2035. // return;
  2036. // }
  2037. this.loadingNew = true;
  2038. try {
  2039. const requestParams = {
  2040. periodId: this.trainingCampIdValue,
  2041. campPeriodType: this.createCampPeriodForm.campPeriodType
  2042. };
  2043. const response = await getScreeningCampPeriod(requestParams);
  2044. if (response && Array.isArray(response.resultList)) {
  2045. this.trainingCampList = response.resultList;
  2046. // 缓存数据 - 使用固定键名
  2047. //this.periodDataCache.set(cacheKey, response.resultList);
  2048. } else {
  2049. console.warn('接口返回格式异常:', response);
  2050. this.trainingCampList = [];
  2051. }
  2052. } catch (error) {
  2053. console.error('接口请求失败:', error);
  2054. this.$message.error('查询失败,请重试');
  2055. this.trainingCampList = [];
  2056. } finally {
  2057. this.loadingNew = false;
  2058. }
  2059. },
  2060. /** 提交表单 */
  2061. copySubmitCampForm() {
  2062. try {
  2063. // 表单验证
  2064. const valid = this.$refs.createCampPeriodForm.validate();
  2065. if (!valid) return ;
  2066. this.submitLoading = true;
  2067. const submitData = this.buildSubmitData();
  2068. if (submitData.campPeriodType===3){
  2069. // 新增训练营
  2070. addCamp(submitData).then(response => {
  2071. if (response.code === 200) {
  2072. this.$message.success('新建训练营成功');
  2073. this.addExistCampPeriod = false;
  2074. // 重新加载训练营列表
  2075. this.getLeftList();
  2076. } else {
  2077. this.$message.error(response.msg || '新建训练营失败');
  2078. }
  2079. }).catch(error => {
  2080. this.$message.error('新建训练营失败: ' + (error.message || '未知错误'));
  2081. });
  2082. }else {
  2083. // 显示全屏加载圈和遮蔽层
  2084. const loadingInstance = this.$loading({
  2085. lock: true,
  2086. text: '复制营期中,请耐心等待...',
  2087. spinner: 'el-icon-loading',
  2088. background: 'rgba(0, 0, 0, 0.7)'
  2089. });
  2090. // 调用批量添加小节接口
  2091. copyExistCampPeriod(submitData).then(response => {
  2092. if (response.code === 200) {
  2093. this.$message.success('复制营期成功');
  2094. this.course.addOpen = false;
  2095. this.addExistCampPeriod = false;
  2096. // 重新加载训练营列表
  2097. this.getList();
  2098. } else {
  2099. this.$message.error(response.msg || '复制营期失败');
  2100. }
  2101. }).catch(error => {
  2102. this.$message.error('复制营期失败:' + (error.message || '未知错误'));
  2103. }).finally(() => {
  2104. loadingInstance.close(); // 关闭加载圈
  2105. });
  2106. }
  2107. } catch (error) {
  2108. this.$message.error('提交失败:' + (error.message || '未知错误'));
  2109. } finally {
  2110. this.submitLoading = false;
  2111. }
  2112. },
  2113. /** 组装提交数据 */
  2114. buildSubmitData() {
  2115. const { campPeriodType, periodId, trainingCampName } = this.createCampPeriodForm;
  2116. const baseData = {
  2117. campPeriodType,
  2118. trainingCampId: this.trainingCampIdValue // 这里已经正确添加了 trainingCampId
  2119. };
  2120. switch (campPeriodType) {
  2121. case 1: // 从当前训练营复制
  2122. case 2: // 从其他训练营复制
  2123. if (!periodId) {
  2124. throw new Error('请选择要复制的营期');
  2125. }
  2126. return { ...baseData, periodId };
  2127. case 3: // 新建营期
  2128. if (!trainingCampName?.trim()) {
  2129. throw new Error('请输入营期名称');
  2130. }
  2131. return { ...baseData, trainingCampName: trainingCampName.trim() };
  2132. default:
  2133. throw new Error('未知的创建方式');
  2134. }
  2135. },
  2136. /** 取消新建存在训练营 */
  2137. cancelExistCampPeriod() {
  2138. this.addExistCampPeriod = false;
  2139. this.resetForm();
  2140. },
  2141. /** 对话框关闭事件 */
  2142. handleDialogClose() {
  2143. this.resetForm();
  2144. },
  2145. /** 重置表单 */
  2146. resetForm() {
  2147. this.createCampPeriodForm = {
  2148. campPeriodType: 1,
  2149. periodId: null,
  2150. trainingCampName: null,
  2151. };
  2152. this.currentCampPeriods = [];
  2153. this.otherCampPeriods = [];
  2154. this.trainingCampList=[]
  2155. this.loading = false;
  2156. this.submitLoading = false;
  2157. // 清除表单验证
  2158. if (this.$refs.createCampPeriodForm) {
  2159. this.$refs.createCampPeriodForm.clearValidate();
  2160. }
  2161. },
  2162. /** 全选/取消全选公司 */
  2163. handleSelectAllCompanies(type) {
  2164. if (!this.companyOptions || this.companyOptions.length === 0) {
  2165. this.$message.warning('暂无可选公司');
  2166. return;
  2167. }
  2168. if (type === 'form') {
  2169. // 营期表单中的公司选择
  2170. if (this.isAllCompaniesSelected('form')) {
  2171. // 当前已全选,则取消全选
  2172. this.form.companyId = [];
  2173. } else {
  2174. // 当前未全选,则全选
  2175. this.form.companyId = this.companyOptions.map(item => item.companyId);
  2176. }
  2177. } else if (type === 'query') {
  2178. // 查询条件中的公司选择
  2179. if (this.isAllCompaniesSelected('query')) {
  2180. // 当前已全选,则取消全选
  2181. this.queryParams.companyIdList = [];
  2182. } else {
  2183. // 当前未全选,则全选
  2184. this.queryParams.companyIdList = this.companyOptions.map(item => item.companyId);
  2185. }
  2186. }
  2187. },
  2188. /** 判断是否已全选公司 */
  2189. isAllCompaniesSelected(type) {
  2190. if (!this.companyOptions || this.companyOptions.length === 0) {
  2191. return false;
  2192. }
  2193. let selectedCompanies = [];
  2194. if (type === 'form') {
  2195. selectedCompanies = this.form.companyId || [];
  2196. } else if (type === 'query') {
  2197. selectedCompanies = this.queryParams.companyIdList || [];
  2198. }
  2199. return selectedCompanies.length === this.companyOptions.length;
  2200. },
  2201. handleTrainingCampChange(trainingCampId){
  2202. this.otherCampPeriods = [];
  2203. this.createCampPeriodForm.periodId = '';
  2204. const params = {
  2205. ...this.queryParams,
  2206. trainingCampId: trainingCampId // 更新训练营ID
  2207. };
  2208. pagePeriod(params).then(response => {
  2209. if (response.code === 200) {
  2210. this.otherCampPeriods = response.rows;
  2211. } else {
  2212. this.$message.error(response.msg || '查询营期失败');
  2213. }
  2214. }).catch(error => {
  2215. this.$message.error('查询营期失败: ' + (error.message || '查询营期失败'));
  2216. });
  2217. },
  2218. },
  2219. };
  2220. </script>
  2221. <style scoped>
  2222. .left-aside {
  2223. background-color: #fff;
  2224. border-right: 1px solid #EBEEF5;
  2225. padding: 0;
  2226. display: flex;
  2227. flex-direction: column;
  2228. height: 800px;
  2229. }
  2230. .left-header {
  2231. padding: 10px;
  2232. border-bottom: 1px solid #EBEEF5;
  2233. }
  2234. .left-header-top {
  2235. display: flex;
  2236. justify-content: space-between;
  2237. align-items: center;
  2238. margin-bottom: 10px;
  2239. }
  2240. .search-btn {
  2241. width: 50%;
  2242. height: 36px;
  2243. background-color: #409EFF;
  2244. color: white;
  2245. border: none;
  2246. }
  2247. .search-input-wrapper {
  2248. margin-bottom: 10px;
  2249. }
  2250. .sort-wrapper {
  2251. display: flex;
  2252. align-items: center;
  2253. margin-bottom: 10px;
  2254. }
  2255. .sort-label {
  2256. width: 70px;
  2257. font-size: 14px;
  2258. font-weight: 600;
  2259. color: #909399;
  2260. }
  2261. .sort-select {
  2262. margin-left: 10px;
  2263. width: 280px;
  2264. }
  2265. .color-wrapper {
  2266. display: flex;
  2267. align-items: center;
  2268. margin-bottom: 10px;
  2269. }
  2270. .color-label {
  2271. width: 70px;
  2272. color: #606266;
  2273. }
  2274. .color-hint {
  2275. margin-left: 10px;
  2276. color: #606266;
  2277. font-size: 12px;
  2278. }
  2279. .color-help {
  2280. margin-left: 5px;
  2281. color: #909399;
  2282. cursor: pointer;
  2283. }
  2284. .hint-text {
  2285. color: #606266;
  2286. font-size: 12px;
  2287. margin-top: 5px;
  2288. }
  2289. .camp-list {
  2290. flex: 1;
  2291. overflow-y: auto;
  2292. padding: 3px;
  2293. }
  2294. .camp-item {
  2295. margin-bottom: 5px;
  2296. padding: 15px;
  2297. background-color: #ffffff;
  2298. position: relative;
  2299. cursor: pointer;
  2300. display: flex;
  2301. justify-content: space-between;
  2302. border: 1px solid #eaedf2;
  2303. }
  2304. .camp-item:last-child {
  2305. margin-bottom: 0;
  2306. }
  2307. .camp-item:hover {
  2308. background-color: #f5f9ff;
  2309. }
  2310. .camp-item.active {
  2311. background-color: #eaf4ff;
  2312. border-left: 1px solid #75b8fc;
  2313. }
  2314. .camp-content {
  2315. flex: 1;
  2316. padding-right: 10px;
  2317. }
  2318. .camp-title {
  2319. font-weight: bold;
  2320. font-size: 16px;
  2321. margin-bottom: 8px;
  2322. color: #333;
  2323. display: flex;
  2324. align-items: center;
  2325. }
  2326. .camp-icon {
  2327. font-size: 16px;
  2328. margin-right: 6px;
  2329. color: #409EFF;
  2330. }
  2331. .camp-info {
  2332. display: flex;
  2333. justify-content: space-between;
  2334. margin-bottom: 8px;
  2335. font-size: 12px;
  2336. color: #c4c1c1;
  2337. line-height: 1.5;
  2338. }
  2339. .camp-stats {
  2340. display: flex;
  2341. justify-content: space-between;
  2342. font-size: 12px;
  2343. color: #666;
  2344. background-color: #f5f9ff;
  2345. padding: 6px 10px;
  2346. border-radius: 4px;
  2347. line-height: 1.5;
  2348. }
  2349. .stat-item {
  2350. display: flex;
  2351. align-items: center;
  2352. }
  2353. .stat-item i {
  2354. margin-right: 4px;
  2355. font-size: 14px;
  2356. color: #409EFF;
  2357. }
  2358. .camp-actions {
  2359. display: flex;
  2360. flex-direction: column;
  2361. justify-content: center;
  2362. align-items: flex-end;
  2363. gap: 8px;
  2364. border-left: 1px dashed #eaedf2;
  2365. padding-left: 12px;
  2366. min-width: 50px;
  2367. }
  2368. .action-btn {
  2369. padding: 2px 5px;
  2370. font-size: 12px;
  2371. border-radius: 4px;
  2372. transition: all 0.2s;
  2373. }
  2374. .action-btn:hover {
  2375. background-color: rgba(255, 255, 255, 0.8);
  2376. }
  2377. .delete-btn {
  2378. color: #f56c6c;
  2379. }
  2380. .delete-btn:hover {
  2381. background-color: rgba(245, 108, 108, 0.1);
  2382. }
  2383. .copy-btn {
  2384. color: #409EFF;
  2385. }
  2386. .copy-btn:hover {
  2387. background-color: rgba(64, 158, 255, 0.1);
  2388. }
  2389. .warning-icon {
  2390. color: #E6A23C;
  2391. font-size: 16px;
  2392. margin-left: 5px;
  2393. }
  2394. .el-main {
  2395. padding: 10px;
  2396. }
  2397. /* 添加训练营表单样式 */
  2398. .drawer-footer {
  2399. /* position: absolute; */
  2400. bottom: 0;
  2401. left: 0;
  2402. right: 0;
  2403. padding: 20px;
  2404. background: #fff;
  2405. text-align: right;
  2406. border-top: 1px solid #e8e8e8;
  2407. }
  2408. .el-input-number {
  2409. width: 100%;
  2410. }
  2411. /* 加载更多样式 */
  2412. .loading-more {
  2413. display: flex;
  2414. align-items: center;
  2415. justify-content: center;
  2416. padding: 12px 0;
  2417. color: #909399;
  2418. font-size: 14px;
  2419. }
  2420. .loading-more i {
  2421. margin-right: 5px;
  2422. font-size: 16px;
  2423. }
  2424. /* 无更多数据提示 */
  2425. .no-more-data {
  2426. display: flex;
  2427. align-items: center;
  2428. justify-content: center;
  2429. padding: 12px 0;
  2430. color: #c0c4cc;
  2431. font-size: 13px;
  2432. }
  2433. .no-more-data span {
  2434. position: relative;
  2435. display: flex;
  2436. align-items: center;
  2437. }
  2438. </style>