index.vue 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998
  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. <el-select v-model="queryParams.companyIdList" placeholder="请选择公司" clearable size="small" multiple>
  95. <el-option
  96. v-for="item in companyOptions"
  97. :key="item.companyId"
  98. :label="item.companyName"
  99. :value="item.companyId"
  100. />
  101. </el-select>
  102. </el-form-item>
  103. <el-form-item label="开营日期开始" prop="periodStartingTime" label-width="120px">
  104. <el-date-picker clearable size="small" style="width: 200px"
  105. v-model="queryParams.periodStartingTime"
  106. type="date"
  107. value-format="yyyy-MM-dd"
  108. placeholder="请选择开营日期开始时间">
  109. </el-date-picker>
  110. </el-form-item>
  111. <el-form-item label="开营日期结束" prop="periodEndTime" label-width="120px">
  112. <el-date-picker clearable size="small" style="width: 300px"
  113. v-model="queryParams.periodEndTime"
  114. type="date"
  115. value-format="yyyy-MM-dd"
  116. placeholder="请选择开营日期结束时间">
  117. </el-date-picker>
  118. </el-form-item>
  119. <el-form-item>
  120. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['course:period:list']">搜索</el-button>
  121. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  122. </el-form-item>
  123. </el-form>
  124. <el-row :gutter="10" class="mb8">
  125. <el-col :span="1.5">
  126. <el-button
  127. type="primary"
  128. plain
  129. icon="el-icon-plus"
  130. size="mini"
  131. @click="handleAdd"
  132. v-hasPermi="['course:period:add']"
  133. >新增</el-button>
  134. </el-col>
  135. <el-col :span="1.5">
  136. <el-button
  137. type="warning"
  138. plain
  139. icon="el-icon-download"
  140. size="mini"
  141. @click="handleExport"
  142. v-hasPermi="['course:period:export']"
  143. >导出</el-button>
  144. </el-col>
  145. <el-col :span="1.5">
  146. <el-button
  147. type="primary"
  148. plain
  149. icon="el-icon-edit"
  150. size="mini"
  151. @click="handleBatchSetRedPacket"
  152. v-hasPermi="['course:period:setRedPacket']"
  153. :disabled="batchSetRedPacketDisabled"
  154. >批量设置红包</el-button>
  155. </el-col>
  156. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  157. </el-row>
  158. <el-table v-loading="loading" :data="periodList" @selection-change="handleSelectionChange" border>
  159. <el-table-column type="selection" width="55" align="center" />
  160. <el-table-column label="营期名称" align="center" prop="periodName" />
  161. <el-table-column label="公司名称" align="center" prop="companyName" />
  162. <el-table-column label="营期状态" align="center" prop="periodStatus" width="100" :formatter="periodStatusFormatter" />
  163. <el-table-column label="营期线" align="center" prop="periodLine" width="180" />
  164. <el-table-column label="开营开始时间" align="center" prop="periodStartingTime" width="180" />
  165. <el-table-column label="开营结束时间" align="center" prop="periodEndTime" width="180" />
  166. <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
  167. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  168. <template slot-scope="scope">
  169. <el-button
  170. size="mini"
  171. type="text"
  172. icon="el-icon-edit"
  173. @click="handleUpdate(scope.row)"
  174. v-hasPermi="['course:period:query']"
  175. >修改</el-button>
  176. <!-- <el-button-->
  177. <!-- size="mini"-->
  178. <!-- type="text"-->
  179. <!-- icon="el-icon-edit"-->
  180. <!-- @click="handleCourse(scope.row)"-->
  181. <!-- v-hasPermi="['course:period:edit']"-->
  182. <!-- >课程管理</el-button>-->
  183. <!-- <el-button-->
  184. <!-- size="mini"-->
  185. <!-- type="text"-->
  186. <!-- icon="el-icon-money"-->
  187. <!-- @click="setRedPacket(scope.row)"-->
  188. <!-- >设置红包</el-button>-->
  189. <el-button
  190. size="mini"
  191. type="text"
  192. icon="el-icon-setting"
  193. @click="handlePeriodSettings(scope.row)"
  194. >营期相关设置</el-button>
  195. <el-button
  196. size="mini"
  197. type="text"
  198. icon="el-icon-circle-close"
  199. @click="handleClosePeriod(scope.row)"
  200. v-hasPermi="['course:period:close']"
  201. >结束营期</el-button>
  202. <el-button
  203. size="mini"
  204. type="text"
  205. icon="el-icon-delete"
  206. @click="handleDelete(scope.row)"
  207. v-hasPermi="['course:period:remove']"
  208. >删除</el-button>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. <pagination
  213. v-show="total>0"
  214. :total="total"
  215. :page.sync="queryParams.pageNum"
  216. :limit.sync="queryParams.pageSize"
  217. @pagination="getList"
  218. />
  219. </el-main>
  220. </el-container>
  221. <!-- 添加或修改会员营期对话框-->
  222. <el-drawer :title="title" :visible.sync="open" size="700px" append-to-body>
  223. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  224. <el-form-item label="营期名称" prop="periodName">
  225. <el-input v-model="form.periodName" placeholder="请输入营期名称" />
  226. </el-form-item>
  227. <el-form-item label="公司" prop="companyId">
  228. <el-select v-model="form.companyId" placeholder="请选择公司" multiple>
  229. <el-option
  230. v-for="item in companyOptions"
  231. :key="item.companyId"
  232. :label="item.companyName"
  233. :value="item.companyId"
  234. />
  235. </el-select>
  236. </el-form-item>
  237. <el-form-item label="课程风格" prop="courseStyle">
  238. <image-upload v-model="form.courseStyle" :limit="1" />
  239. </el-form-item>
  240. <el-form-item label="直播间风格" prop="liveRoomStyle">
  241. <image-upload v-model="form.liveRoomStyle" :limit="1" />
  242. </el-form-item>
  243. <el-form-item label="课程LOGO" prop="courseLogo">
  244. <image-upload v-model="form.courseLogo" :limit="1" />
  245. </el-form-item>
  246. <!-- <el-form-item label="红包发放方式" prop="redPacketGrantMethod">-->
  247. <!-- <el-radio-group v-model="form.redPacketGrantMethod">-->
  248. <!-- <el-radio :label="1" >按课程</el-radio>-->
  249. <!-- <el-radio :label="2" >按营期</el-radio>-->
  250. <!-- </el-radio-group>-->
  251. <!-- </el-form-item>-->
  252. <el-form-item label="营期类型" prop="periodType">
  253. <el-radio-group v-model="form.periodType">
  254. <el-radio :label="1" >多课程</el-radio>
  255. <el-radio :label="2" >单课程</el-radio>
  256. </el-radio-group>
  257. </el-form-item>
  258. <el-form-item label="销售提前查看天数" prop="maxViewNum">
  259. <el-input-number :min="0" v-model="form.maxViewNum" style="width: 200px" />
  260. </el-form-item>
  261. <el-form-item label="开营日期" prop="periodStartingTime">
  262. <el-date-picker
  263. :style="{display: form.periodType == 1 ? '' : 'none !important'}"
  264. v-model="form.dateRange"
  265. @change="timeChange(1)"
  266. type="daterange"
  267. range-separator="至"
  268. start-placeholder="开始日期"
  269. end-placeholder="结束日期"
  270. value-format="yyyy-MM-dd"
  271. :picker-options="{disabledDate}"
  272. :clearable="false"
  273. >
  274. </el-date-picker>
  275. <el-date-picker
  276. :disabled = "isDisabledDateRange"
  277. :style="{display: form.periodType == 2 ? '' : 'none !important'}"
  278. @change="timeChange(2)"
  279. v-model="form.date"
  280. type="date"
  281. value-format="yyyy-MM-dd"
  282. placeholder="选择日期"
  283. :picker-options="{disabledDate}"
  284. :clearable="false"
  285. >
  286. </el-date-picker>
  287. </el-form-item>
  288. <el-form-item prop="periodLine">
  289. <span slot="label">
  290. 营期线
  291. <el-tooltip content="营期首次播放课程的日期" placement="top">
  292. <i class="el-icon-question" style="margin-left: 5px; color: #909399; cursor: help;"></i>
  293. </el-tooltip>
  294. </span>
  295. <el-date-picker
  296. v-model="form.periodLine"
  297. type="date"
  298. placeholder="请选择营期线"
  299. value-format="yyyy-MM-dd"
  300. :clearable="true">
  301. </el-date-picker>
  302. </el-form-item>
  303. </el-form>
  304. <div class="drawer-footer">
  305. <el-button type="primary" @click="submitForm">确 定</el-button>
  306. <el-button @click="cancel">取 消</el-button>
  307. </div>
  308. </el-drawer>
  309. <!-- 添加训练营对话框 -->
  310. <el-dialog :title="campForm.trainingCampId ? '修改训练营' : '新建训练营'" :visible.sync="campDialogVisible" width="500px" append-to-body>
  311. <el-form ref="campForm" :model="campForm" :rules="campRules" label-width="100px">
  312. <el-form-item label="训练营名称" prop="trainingCampName">
  313. <el-input v-model="campForm.trainingCampName" placeholder="请输入训练营名称" />
  314. </el-form-item>
  315. </el-form>
  316. <div slot="footer" class="dialog-footer">
  317. <el-button type="primary" @click="submitCampForm">确 定</el-button>
  318. <el-button @click="cancelCampForm">取 消</el-button>
  319. </div>
  320. </el-dialog>
  321. <!-- &lt;!&ndash; 添加或修改会员营期对话框&ndash;&gt;-->
  322. <!-- <el-dialog title="课程管理" :visible.sync="course.open" width="75%" top="10px" append-to-body style="padding-bottom: 10px">-->
  323. <!-- <el-row :gutter="10" class="mb8">-->
  324. <!-- <el-col :span="1.5">-->
  325. <!-- <el-button-->
  326. <!-- v-if="(getDiff(course.row.periodStartingTime, course.row.periodEndTime) - course.total) > 0"-->
  327. <!-- type="primary"-->
  328. <!-- icon="el-icon-plus"-->
  329. <!-- size="mini"-->
  330. <!-- @click="handleAddCourse"-->
  331. <!-- v-hasPermi="['course:period:add']"-->
  332. <!-- >添加课程</el-button>-->
  333. <!-- </el-col>-->
  334. <!-- </el-row>-->
  335. <!-- <el-table v-loading="course.loading" :data="course.list">-->
  336. <!-- <el-table-column label="课程" align="center" prop="courseName" width="180" />-->
  337. <!-- <el-table-column label="小节" align="center" prop="videoName" />-->
  338. <!-- <el-table-column label="营期时间" align="center" prop="dayDate" width="150" />-->
  339. <!-- <el-table-column label="创建时间" align="center" prop="createTime" width="150" />-->
  340. <!-- </el-table>-->
  341. <!-- <div slot="footer" class="dialog-footer">-->
  342. <!--&lt;!&ndash; <el-button type="primary" @click="saveCourseData">保存</el-button>&ndash;&gt;-->
  343. <!-- </div>-->
  344. <!-- </el-dialog>-->
  345. <!-- 添加课程对话框-->
  346. <el-dialog title="添加课程" :visible.sync="course.addOpen" width="500px" append-to-body>
  347. <el-form ref="courseAddForm" :model="course.form" :rules="courseAddRules" label-width="100px">
  348. <el-form-item label="课程" prop="courseId">
  349. <el-select filterable v-model="course.form.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(course.form.courseId)" style="width: 100%" :value-key="'dictValue'">
  350. <el-option
  351. v-for="dict in courseList"
  352. :key="dict.dictValue"
  353. :label="dict.dictLabel"
  354. :value="parseInt(dict.dictValue)"
  355. />
  356. </el-select>
  357. </el-form-item>
  358. <el-form-item label="小节" prop="videoIds">
  359. <el-select filterable v-model="course.form.videoIds" placeholder="请选择小节" :multiple-limit="getDiff(course.row.periodStartingTime, course.row.periodEndTime) - course.total" multiple clearable size="small" style="width: 100%" :value-key="'dictValue'">
  360. <el-option
  361. v-for="dict in videoList"
  362. :key="dict.dictValue"
  363. :label="dict.dictLabel"
  364. :value="parseInt(dict.dictValue)"
  365. />
  366. </el-select>
  367. </el-form-item>
  368. <el-form-item label="看课时间" prop="timeRange">
  369. <el-time-picker
  370. is-range
  371. v-model="course.form.timeRange"
  372. :picker-options="{
  373. selectableRange: '00:00:00 - 23:59:59'
  374. }"
  375. range-separator="至"
  376. start-placeholder="开始时间"
  377. value-format="HH:mm:ss"
  378. end-placeholder="结束时间">
  379. </el-time-picker>
  380. </el-form-item>
  381. <el-form-item v-if="joinTimeSwitch" label="领取红包时间" prop="lastJoinTime">
  382. <el-time-picker
  383. v-model="course.form.joinTime"
  384. value-format="HH:mm:ss"
  385. placeholder="选择时间范围">
  386. </el-time-picker>
  387. <p style="color: red;margin: 0;font-size: 12px">超过领取红包时间,只允许看课,不允许领取红包</p>
  388. </el-form-item>
  389. </el-form>
  390. <div slot="footer" class="dialog-footer">
  391. <el-button type="primary" @click="submitCourseForm">确 定</el-button>
  392. <el-button @click="closeAddCourse">取 消</el-button>
  393. </div>
  394. </el-dialog>
  395. <el-dialog title="修改看课时间" :visible.sync="updateCourse.open" width="600px" append-to-body>
  396. <el-form ref="courseUpdateForm" :model="updateCourse.form" :rules="courseUpdateRules" label-width="100px">
  397. <el-form-item label="看课时间" prop="timeRange" label-width="110px">
  398. <el-date-picker
  399. v-model="updateCourse.form.timeRange"
  400. type="datetimerange"
  401. range-separator="至"
  402. start-placeholder="开始时间"
  403. end-placeholder="结束时间"
  404. value-format="yyyy-MM-dd HH:mm:ss"
  405. :default-time="['00:00:00', '23:59:59']"
  406. :picker-options="{
  407. shortcuts: [{
  408. text: '今天',
  409. onClick(picker) {
  410. const end = new Date();
  411. const start = new Date();
  412. picker.$emit('pick', [start, end]);
  413. }
  414. }]
  415. }"
  416. >
  417. </el-date-picker>
  418. </el-form-item>
  419. <el-form-item v-if="joinTimeSwitch" label="领取红包时间" prop="joinTime" label-width="110px">
  420. <el-date-picker
  421. v-model="updateCourse.form.joinTime"
  422. type="datetime"
  423. placeholder="选择时间"
  424. value-format="yyyy-MM-dd HH:mm:ss"
  425. :default-time="'23:59:59'"
  426. >
  427. </el-date-picker>
  428. <p style="color: red;margin: 0;font-size: 12px">超过领取红包时间,只允许看课,不允许领取红包</p>
  429. </el-form-item>
  430. </el-form>
  431. <div slot="footer" class="dialog-footer">
  432. <el-button type="primary" @click="submitUpdateCourseForm">确 定</el-button>
  433. <el-button @click="closeUpdateCourse">取 消</el-button>
  434. </div>
  435. </el-dialog>
  436. <el-dialog title="修改营期时间" :visible.sync="updatePeriodDate.open" width="500px" append-to-body>
  437. <el-form ref="courseUpdateForm" :model="updatePeriodDate.form" label-width="100px">
  438. <el-form-item label="营期时间" prop="dayDate">
  439. <el-date-picker
  440. v-model="updatePeriodDate.form.dayDate"
  441. :selectableRange="updatePeriodDate.form.dayDate"
  442. value-format="yyyy-MM-dd"
  443. type="date"
  444. placeholder="选择日期">
  445. </el-date-picker>
  446. </el-form-item>
  447. </el-form>
  448. <div slot="footer" class="dialog-footer">
  449. <el-button type="primary" @click="updatePeriodDateSubmit">确 定</el-button>
  450. <el-button @click="updatePeriodDate.open = false">取 消</el-button>
  451. </div>
  452. </el-dialog>
  453. <!-- <red-packet-->
  454. <!-- :visible.sync="redPacketVisible"-->
  455. <!-- :periodId="currentRedPacketData.periodId"-->
  456. <!-- :videoId="currentRedPacketData.videoId"-->
  457. <!-- @success="handleRedPacketSuccess"-->
  458. <!-- />-->
  459. <!-- 营期相关设置抽屉 -->
  460. <el-drawer
  461. title="营期相关设置"
  462. :visible.sync="periodSettingsVisible"
  463. direction="rtl"
  464. size="74%"
  465. :destroy-on-close="true"
  466. append-to-body
  467. custom-class="period-settings-drawer"
  468. >
  469. <div class="drawer-content" style="margin-left: 25px">
  470. <el-tabs v-model="activeTab" @tab-click="handleTabClick">
  471. <el-tab-pane label="课程管理" name="course">
  472. <el-row :gutter="10" class="mb8">
  473. <el-col :span="1.5">
  474. <el-button
  475. v-if="(getDiff(periodSettingsData.periodStartingTime, periodSettingsData.periodEndTime) - course.total) > 0"
  476. type="primary"
  477. icon="el-icon-plus"
  478. size="mini"
  479. @click="handleAddCourse"
  480. v-hasPermi="['course:period:addCourse']"
  481. >添加课程</el-button>
  482. </el-col>
  483. <!-- <el-col :span="1.5">-->
  484. <!-- <el-button-->
  485. <!-- type="primary"-->
  486. <!-- size="mini"-->
  487. <!-- :disabled="updateCourse.ids.length <= 0"-->
  488. <!-- @click="handleUpdatePeriodDate"-->
  489. <!-- >修改营期时间</el-button>-->
  490. <!-- </el-col>-->
  491. <el-col :span="1.5">
  492. <el-button
  493. type="primary"
  494. size="mini"
  495. :disabled="updateCourse.ids.length <= 0"
  496. @click="handleUpdateCourse"
  497. v-hasPermi="['course:period:updateCourseTime']"
  498. >修改看课时间</el-button>
  499. </el-col>
  500. <el-col :span="1.5">
  501. <el-button
  502. type="warning"
  503. size="mini"
  504. icon="el-icon-delete"
  505. :disabled="updateCourse.ids.length <= 0"
  506. @click="handleDeleteCourse"
  507. v-hasPermi="['course:period:dayRemove']"
  508. >删除课程</el-button>
  509. </el-col>
  510. </el-row>
  511. <el-table ref="courseTable" v-loading="course.loading" :data="course.list" @selection-change="handleSelectionCourseChange" border>
  512. <el-table-column type="selection" width="55" align="center" />
  513. <el-table-column label="课程" align="center" prop="courseName" width="180" />
  514. <el-table-column label="小节" align="center" prop="videoName" />
  515. <el-table-column label="开课状态" align="center" prop="status" width="100" :formatter="courseStatusFormatter" />
  516. <el-table-column label="营期时间" align="center" prop="dayDate" width="100"/>
  517. <el-table-column label="开始时间" align="center" prop="startDateTime" width="100">
  518. <!-- <template slot-scope="scope">-->
  519. <!-- <el-tag>{{scope.row.startDateTime}}</el-tag>-->
  520. <!-- </template>-->
  521. </el-table-column>
  522. <el-table-column label="结束时间" align="center" prop="endDateTime" width="100">
  523. <!-- <template slot-scope="scope">-->
  524. <!-- <el-tag type="success">{{parseTime(scope.row.endDateTime, '{h}:{i}:{s}')}}</el-tag>-->
  525. <!-- </template>-->
  526. </el-table-column>
  527. <el-table-column label="领取红包时间" align="center" prop="lastJoinTime" width="160">
  528. <template slot-scope="scope">
  529. <el-tag type="danger">{{scope.row.lastJoinTime}}</el-tag>
  530. </template>
  531. </el-table-column>
  532. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  533. <template slot-scope="scope">
  534. <el-button
  535. size="mini"
  536. type="text"
  537. icon="el-icon-top"
  538. @click="handleTop(scope.row)"
  539. v-hasPermi="['course:period:courseMove']"
  540. >上移</el-button>
  541. <el-button
  542. size="mini"
  543. type="text"
  544. icon="el-icon-bottom"
  545. @click="handleBottom(scope.row)"
  546. v-hasPermi="['course:period:courseMove']"
  547. >下移</el-button>
  548. <el-button
  549. size="mini"
  550. type="text"
  551. icon="el-icon-edit"
  552. @click="handleUpdateDate(scope.row)"
  553. >修改营期时间</el-button>
  554. <el-button
  555. size="mini"
  556. type="text"
  557. icon="el-icon-delete"
  558. @click="handleDeleteCourse(scope.row)"
  559. v-hasPermi="['course:period:dayRemove']"
  560. >删除课程</el-button>
  561. </template>
  562. </el-table-column>
  563. </el-table>
  564. <pagination
  565. v-show="course.total > 0"
  566. :total="course.total"
  567. :page.sync="course.queryParams.pageNum"
  568. :limit.sync="course.queryParams.pageSize"
  569. @pagination="getCourseList"
  570. style="height: 40px"
  571. />
  572. </el-tab-pane>
  573. <el-tab-pane label="公司列表" name="company">
  574. <red-packet
  575. :visible.sync="redPacketVisible"
  576. :activeTab="activeTab"
  577. :periodId="periodSettingsData.periodId"
  578. @success="handleRedPacketSuccess"
  579. />
  580. </el-tab-pane>
  581. <el-tab-pane label="课程统计" name="statistics">
  582. <course-statistics
  583. :periodId="periodSettingsData.periodId"
  584. :active="activeTab === 'statistics'"
  585. />
  586. </el-tab-pane>
  587. </el-tabs>
  588. </div>
  589. </el-drawer>
  590. <batch-red-packet
  591. :visible.sync="batchRedPacketVisible"
  592. :selected-data="selectedPeriods"
  593. @success="handleBatchRedPacketSuccess"
  594. />
  595. </div>
  596. </template>
  597. <script>
  598. import {addPeriod, delPeriod, exportPeriod, getPeriod, pagePeriod, updatePeriod, getDays, addCourse,delPeriodDay, updateCourseTime, updateCourseDate, updateListCourseData, periodCourseMove, closePeriod} from "@/api/course/userCoursePeriod";
  599. import {getCompanyList} from "@/api/company/company";
  600. import { listCamp, addCamp, editCamp, delCamp, copyCamp } from "@/api/course/userCourseCamp";
  601. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  602. import RedPacket from './redPacket.vue'
  603. import BatchRedPacket from './batchRedPacket.vue'
  604. import CourseStatistics from './statistics.vue'
  605. import Da from "element-ui/src/locale/lang/da";
  606. import { getConfigByKey } from '@/api/system/config'
  607. export default {
  608. name: "Period",
  609. components: {
  610. RedPacket,
  611. BatchRedPacket,
  612. CourseStatistics
  613. },
  614. data() {
  615. return {
  616. // 遮罩层
  617. loading: true,
  618. updateDateOpen: false,
  619. // 左侧遮罩层
  620. leftLoading: true,
  621. // 选中数组
  622. ids: [],
  623. // 非单个禁用
  624. single: true,
  625. // 非多个禁用
  626. multiple: true,
  627. // 显示搜索条件
  628. showSearch: true,
  629. // 总条数
  630. total: 0,
  631. // 左侧总条数
  632. leftTotal: 0,
  633. // 会员营期表格数据
  634. periodList: [],
  635. // 左侧列表数据
  636. leftList: [],
  637. videoList: [],
  638. // 弹出层标题
  639. title: "",
  640. isDisabledDateRange: false, //是否禁用开营日期
  641. // 是否显示弹出层
  642. open: false,
  643. // 查询参数
  644. queryParams: {
  645. pageNum: 1,
  646. pageSize: 10,
  647. periodName: null,
  648. periodStartingTime: null,
  649. periodEndTime: null,
  650. companyIdList: []
  651. },
  652. // 左侧查询参数
  653. leftQueryParams: {
  654. pageNum: 1,
  655. pageSize: 10,
  656. hasNextPage: false,
  657. scs: 'order_number(desc),training_camp_id(desc)',
  658. trainingCampName: null
  659. },
  660. // 表单参数
  661. form: {},
  662. // 课程相关数据
  663. course: {
  664. open: false,
  665. row:{},
  666. list:[],
  667. queryParams: {
  668. pageNum: 1,
  669. pageSize: 10,
  670. },
  671. loading: true,
  672. total: 0,
  673. addOpen: false,
  674. form: {},
  675. },
  676. //修改营期时间参数
  677. updatePeriodDate: {
  678. open: false,
  679. loading: true,
  680. ids: [],
  681. form: {},
  682. },
  683. joinTimeSwitch:true,
  684. updateCourse: {
  685. open: false,
  686. loading: true,
  687. ids: [],
  688. form: {
  689. timeRange: null,
  690. joinTime: null
  691. },
  692. },
  693. // 表单校验
  694. rules: {
  695. periodName: [
  696. { required: true, message: '营期名称不能为空', trigger: 'blur' }
  697. ],
  698. companyId: [
  699. { required: true, message: '公司不能为空', trigger: 'change' }
  700. ],
  701. courseStyle: [
  702. { required: true, message: '课程风格不能为空', trigger: 'change' }
  703. ],
  704. // redPacketGrantMethod: [
  705. // { required: true, message: '红包发放方式不能为空', trigger: 'change' }
  706. // ],
  707. periodType: [
  708. { required: true, message: '营期类型不能为空', trigger: 'change' }
  709. ],
  710. maxViewNum: [
  711. { required: true, message: '销售可查看天数不能为空', trigger: 'blur' }
  712. ],
  713. periodStartingTime: [
  714. { required: true, message: '开营日期不能为空', trigger: 'change' }
  715. ]
  716. },
  717. // 公司选项
  718. companyOptions: [],
  719. // 训练营列表
  720. campList: [],
  721. // 激活的训练营索引
  722. activeCampIndex: null,
  723. // 训练营对话框是否显示
  724. campDialogVisible: false,
  725. courseList: false,
  726. // 训练营表单
  727. campForm: {
  728. trainingCampId: null,
  729. trainingCampName: ''
  730. },
  731. // 训练营表单校验
  732. campRules: {
  733. trainingCampName: [
  734. { required: true, message: '训练营名称不能为空', trigger: 'blur' },
  735. { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' }
  736. ]
  737. },
  738. // 添加课程表单校验
  739. courseAddRules: {
  740. courseId: [
  741. { required: true, message: '请选择课程', trigger: 'change' }
  742. ],
  743. videoIds: [
  744. { required: true, message: '请选择小节', trigger: 'change' },
  745. { type: 'array', min: 1, message: '请至少选择一个小节', trigger: 'change' }
  746. ]
  747. },
  748. // 修改看课时间表单校验
  749. courseUpdateRules: {
  750. timeRange: [
  751. {
  752. required: true,
  753. validator: (rule, value, callback) => {
  754. if (!value || !Array.isArray(value) || value.length !== 2) {
  755. callback(new Error('请选择完整的看课时间范围'));
  756. } else {
  757. // 检查时间格式是否正确(yyyy-MM-dd HH:mm:ss)
  758. const timeRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
  759. if (!timeRegex.test(value[0]) || !timeRegex.test(value[1])) {
  760. callback(new Error('时间格式不正确'));
  761. } else if (value[0] >= value[1]) {
  762. callback(new Error('结束时间必须大于开始时间'));
  763. } else {
  764. callback();
  765. }
  766. }
  767. },
  768. trigger: 'change'
  769. }
  770. ],
  771. joinTime: [
  772. {
  773. required: true,
  774. validator: (rule, value, callback) => {
  775. if (!value) {
  776. callback(new Error('请选择领取红包时间'));
  777. } else {
  778. // 检查时间格式是否正确(yyyy-MM-dd HH:mm:ss)
  779. const timeRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
  780. if (!timeRegex.test(value)) {
  781. callback(new Error('时间格式不正确'));
  782. } else {
  783. // 检查领取红包时间是否在看课时间范围内
  784. const timeRange = this.updateCourse.form.timeRange;
  785. if (timeRange && Array.isArray(timeRange) && timeRange.length === 2) {
  786. if (value < timeRange[0] || value > timeRange[1]) {
  787. callback(new Error('领取红包时间必须在看课时间范围内'));
  788. } else {
  789. callback();
  790. }
  791. } else {
  792. callback();
  793. }
  794. }
  795. }
  796. },
  797. trigger: 'change'
  798. }
  799. ]
  800. },
  801. // 滚动节流标志
  802. scrollThrottle: false,
  803. // 加载更多状态
  804. loadingMore: false,
  805. // 设置红包对话框
  806. redPacketVisible: false,
  807. periodCompanyList: [],
  808. currentRedPacketData: {
  809. periodId: '',
  810. videoId: ''
  811. },
  812. // 营期相关设置抽屉
  813. periodSettingsVisible: false,
  814. activeTab: 'course',
  815. periodSettingsData: {},
  816. companyList: [],
  817. courseDialogVisible: false,
  818. redPacketList: [],
  819. currentCompany: null,
  820. // 选中的营期数据
  821. selectedPeriods: [],
  822. // 批量设置红包按钮是否禁用
  823. batchSetRedPacketDisabled: true,
  824. // 批量设置红包弹出框
  825. batchRedPacketVisible: false,
  826. };
  827. },
  828. created() {
  829. courseList().then(response => {
  830. this.courseList = response.list;
  831. });
  832. // this.getList();
  833. this.getLeftList();
  834. this.getCompanyList();
  835. },
  836. methods: {
  837. /** 删除按钮操作 */
  838. async handleDeleteCourse(row) {
  839. const periodDayIds = row.id || this.updateCourse.ids;
  840. try {
  841. await this.$confirm('是否确认删除该课程?', "提示", {
  842. confirmButtonText: "确定",
  843. cancelButtonText: "取消",
  844. type: "warning"
  845. });
  846. const res = await delPeriodDay(periodDayIds);
  847. if (res && res.code === 200) {
  848. this.getCourseList();// 刷新列表
  849. this.$message.success('删除成功');
  850. } else {
  851. this.$message.error(res.msg);
  852. }
  853. } catch (error) {
  854. }
  855. },
  856. /** 查询会员营期列表 */
  857. getList() {
  858. this.loading = true;
  859. const params = { ...this.queryParams };
  860. pagePeriod(params).then(response => {
  861. this.periodList = response.rows;
  862. this.total = response.total;
  863. this.loading = false;
  864. });
  865. },
  866. /** 查询左侧列表 */
  867. getLeftList() {
  868. this.leftLoading = true;
  869. // 重置页码和加载更多状态
  870. this.leftQueryParams.pageNum = 1;
  871. this.loadingMore = false;
  872. // 训练营数据
  873. listCamp(this.leftQueryParams).then(response => {
  874. if (response && response.code === 200) {
  875. this.campList = response.data.list || [];
  876. this.leftQueryParams.hasNextPage = response.data.hasNextPage;
  877. this.activeCampIndex = this.campList.length > 0 ? 0 : null;
  878. this.selectCamp(this.activeCampIndex);
  879. // 如果当前显示的列表高度不足以触发滚动,但还有更多数据,自动加载下一页
  880. this.$nextTick(() => {
  881. const scrollEl = this.$refs.campList;
  882. if (scrollEl && this.leftQueryParams.hasNextPage && scrollEl.scrollHeight <= scrollEl.clientHeight) {
  883. this.loadMoreCamps();
  884. }
  885. });
  886. } else {
  887. this.$message.error(response.msg || '获取训练营列表失败');
  888. this.campList = [];
  889. this.leftQueryParams.hasNextPage = false;
  890. }
  891. this.leftLoading = false;
  892. }).catch(error => {
  893. console.error('获取训练营列表失败:', error);
  894. this.$message.error('获取训练营列表失败');
  895. this.campList = [];
  896. this.leftQueryParams.hasNextPage = false;
  897. this.leftLoading = false;
  898. });
  899. },
  900. /** 搜索按钮操作 */
  901. handleQuery() {
  902. this.queryParams.pageNum = 1;
  903. this.getList();
  904. },
  905. /** 左侧搜索按钮操作 */
  906. handleLeftQuery() {
  907. // 重置页码和列表
  908. this.leftQueryParams.pageNum = 1;
  909. this.campList = [];
  910. this.getLeftList();
  911. },
  912. /** 重置按钮操作 */
  913. resetQuery() {
  914. this.resetForm("queryForm");
  915. this.queryParams.companyIdList = [];
  916. this.handleQuery();
  917. },
  918. /** 多选框选中数据 */
  919. handleSelectionChange(selection) {
  920. this.ids = selection.map(item => item.periodId)
  921. this.single = selection.length!==1
  922. this.multiple = !selection.length
  923. // 更新批量设置红包相关数据
  924. this.selectedPeriods = selection;
  925. this.batchSetRedPacketDisabled = selection.length === 0;
  926. },
  927. handleSelectionCourseChange(selection) {
  928. this.updateCourse.ids = selection.map(item => item.id)
  929. },
  930. /** 新增按钮操作 */
  931. handleAdd() {
  932. this.reset();
  933. this.open = true;
  934. this.title = "添加会员营期";
  935. this.isDisabledDateRange = false;
  936. },
  937. /** 修改按钮操作 */
  938. handleUpdate(row) {
  939. this.reset();
  940. const periodId = row.periodId || this.ids
  941. getPeriod(periodId).then(response => {
  942. this.form = response.data;
  943. if (this.form.companyId) {
  944. this.form.companyId = this.form.companyId.split(',').map(id => Number(id));
  945. }
  946. // 设置看课时间范围(回显)
  947. if (this.form.viewStartTime && this.form.viewEndTime) {
  948. this.form.timeRange = [this.form.viewStartTime, this.form.viewEndTime];
  949. }
  950. if(this.form.periodType == 1){
  951. this.$set(this.form,'dateRange',[this.form.periodStartingTime, this.form.periodEndTime])
  952. }
  953. if(this.form.periodType == 2){
  954. this.$set(this.form,'date',this.form.periodStartingTime)
  955. }
  956. this.open = true;
  957. this.title = "修改会员营期";
  958. this.isDisabledDateRange = true;
  959. });
  960. },
  961. /** 提交按钮 */
  962. submitForm() {
  963. this.$refs["form"].validate(valid => {
  964. if (valid) {
  965. let data = JSON.parse(JSON.stringify(this.form));
  966. // 处理看课时间范围
  967. if (data.timeRange && data.timeRange.length === 2) {
  968. data.viewStartTime = data.timeRange[0];
  969. data.viewEndTime = data.timeRange[1];
  970. }
  971. data.companyId = data.companyId.join()
  972. data.trainingCampId = this.queryParams.trainingCampId
  973. if (data.periodId != null) {
  974. updatePeriod(data).then(response => {
  975. if (response.code === 200) {
  976. this.msgSuccess("修改成功");
  977. this.open = false;
  978. this.getList();
  979. }
  980. });
  981. } else {
  982. addPeriod(data).then(response => {
  983. if (response.code === 200) {
  984. this.msgSuccess("新增成功");
  985. this.open = false;
  986. this.getList();
  987. }
  988. });
  989. }
  990. }
  991. });
  992. },
  993. /** 删除按钮操作 */
  994. async handleDelete(row) {
  995. const periodIds = row.periodId || this.ids;
  996. try {
  997. await this.$confirm('是否确认删除该营期?', "提示", {
  998. confirmButtonText: "确定",
  999. cancelButtonText: "取消",
  1000. type: "warning"
  1001. });
  1002. const res = await delPeriod(periodIds);
  1003. if (res && res.code === 200) {
  1004. this.getList(); // 刷新列表
  1005. this.$message.success('删除成功');
  1006. } else {
  1007. this.$message.error(res.msg);
  1008. }
  1009. } catch (error) {
  1010. }
  1011. },
  1012. /** 导出按钮操作 */
  1013. handleExport() {
  1014. const queryParams = this.queryParams;
  1015. this.$confirm('是否确认导出所有会员营期数据项?', "警告", {
  1016. confirmButtonText: "确定",
  1017. cancelButtonText: "取消",
  1018. type: "warning"
  1019. }).then(function() {
  1020. return exportPeriod(queryParams);
  1021. }).then(response => {
  1022. this.download(response.msg);
  1023. }).catch(function() {});
  1024. },
  1025. /** 批量设置红包 */
  1026. handleBatchSetRedPacket() {
  1027. if (this.selectedPeriods.length === 0) {
  1028. this.$message.warning('请至少选择一个营期');
  1029. return;
  1030. }
  1031. this.batchRedPacketVisible = true;
  1032. },
  1033. /** 处理批量设置红包保存 */
  1034. // handleBatchRedPacketSave(data) {
  1035. // // 这里等待接口提供后补充具体实现
  1036. // // 示例代码:
  1037. // // batchSetRedPacket(data).then(response => {
  1038. // // if (response.code === 200) {
  1039. // // this.$message.success('批量设置成功');
  1040. // // this.getList();
  1041. // // }
  1042. // // });
  1043. // this.batchRedPacketVisible = false;
  1044. // },
  1045. /** 获取公司下拉列表*/
  1046. getCompanyList() {
  1047. this.loading = true;
  1048. getCompanyList().then(response => {
  1049. this.companyOptions = response.data;
  1050. this.loading = false;
  1051. });
  1052. },
  1053. // 取消按钮
  1054. cancel() {
  1055. this.open = false;
  1056. this.reset();
  1057. },
  1058. // 表单重置
  1059. reset() {
  1060. this.form = {
  1061. periodId: null,
  1062. periodName: null,
  1063. companyId: null,
  1064. courseId: null,
  1065. videoId: null,
  1066. trainingCampId: null,
  1067. createTime: null,
  1068. updateTime: null,
  1069. courseStyle: null,
  1070. liveRoomStyle: null,
  1071. redPacketGrantMethod: 1,
  1072. periodType: 1,
  1073. periodStartingTime: null,
  1074. dateRange: [],
  1075. date: null,
  1076. days: [],
  1077. maxViewNum: 0,
  1078. periodEndTime: null,
  1079. timeRange: [], // 看课时间范围
  1080. viewStartTime: null, // 看课开始时间
  1081. viewEndTime: null, // 看课结束时间
  1082. lastJoinTime: null // 领取红包时间
  1083. };
  1084. this.resetForm("form");
  1085. },
  1086. // 处理训练营列表的逻辑
  1087. handleDeleteCamp(item) {
  1088. this.$confirm(`确定要删除训练营"${item.trainingCampName}"吗?`, '提示', {
  1089. confirmButtonText: '删除',
  1090. cancelButtonText: '取消',
  1091. type: 'warning'
  1092. }).then(() => {
  1093. // 调用删除训练营API
  1094. const trainingCampId = item.trainingCampId;
  1095. this.leftLoading = true;
  1096. delCamp(trainingCampId).then(response => {
  1097. if (response.code === 200) {
  1098. this.$message.success('删除成功');
  1099. // 从列表中移除
  1100. const index = this.campList.findIndex(camp => camp.trainingCampId === trainingCampId);
  1101. if (index !== -1) {
  1102. this.campList.splice(index, 1);
  1103. }
  1104. // 如果删除的是当前选中的训练营,则重置选中状态
  1105. if (this.activeCampIndex === index) {
  1106. this.activeCampIndex = this.campList.length > 0 ? 0 : null;
  1107. if (this.activeCampIndex !== null) {
  1108. // 更新右侧列表
  1109. this.selectCamp(this.activeCampIndex);
  1110. } else {
  1111. // 没有训练营了,清空右侧列表
  1112. this.periodList = [];
  1113. }
  1114. }
  1115. } else {
  1116. this.$message.error(response.msg || '删除失败');
  1117. }
  1118. this.leftLoading = false;
  1119. }).catch(error => {
  1120. // this.$message.error('删除失败: ' + error.message);
  1121. this.leftLoading = false;
  1122. });
  1123. }).catch(() => {
  1124. this.$message.info('已取消删除');
  1125. });
  1126. },
  1127. /** 复制训练营 */
  1128. handleCopyCamp(item) {
  1129. // 调用添加训练营API
  1130. copyCamp(item.trainingCampId).then(response => {
  1131. if (response.code === 200) {
  1132. this.$message.success('复制成功');
  1133. // 重新加载训练营列表
  1134. this.getLeftList();
  1135. } else {
  1136. this.$message.error(response.msg || '复制训练营失败');
  1137. }
  1138. }).catch(error => {
  1139. this.$message.error('复制训练营失败: ' + error.message);
  1140. });
  1141. },
  1142. /** 修改训练营按钮操作 */
  1143. handleEditCamp(item) {
  1144. this.resetCampForm();
  1145. this.leftLoading = true;
  1146. // 获取最新的训练营数据
  1147. const trainingCampId = item.trainingCampId;
  1148. // 应该调用获取训练营详情的API
  1149. setTimeout(() => {
  1150. // 填充表单数据
  1151. this.campForm = {
  1152. trainingCampId: item.trainingCampId,
  1153. trainingCampName: item.trainingCampName,
  1154. orderNumber: item.orderNumber || 1,
  1155. status: item.status !== undefined ? item.status : 1
  1156. };
  1157. this.campDialogVisible = true;
  1158. this.leftLoading = false;
  1159. }, 300);
  1160. },
  1161. /** 新建训练营按钮操作 */
  1162. handleAddTrainingCamp() {
  1163. this.resetCampForm();
  1164. this.campDialogVisible = true;
  1165. },
  1166. /** 重置训练营表单 */
  1167. resetCampForm() {
  1168. this.campForm = {
  1169. trainingCampId: null,
  1170. trainingCampName: ''
  1171. };
  1172. // 如果表单已经创建,则重置校验结果
  1173. if (this.$refs.campForm) {
  1174. this.$refs.campForm.resetFields();
  1175. }
  1176. },
  1177. /** 取消训练营表单 */
  1178. cancelCampForm() {
  1179. this.campDialogVisible = false;
  1180. this.resetCampForm();
  1181. },
  1182. /** 提交训练营表单 */
  1183. submitCampForm() {
  1184. this.$refs.campForm.validate(valid => {
  1185. if (valid) {
  1186. // 显示加载中
  1187. this.leftLoading = true;
  1188. // 准备提交的数据
  1189. const submitData = JSON.parse(JSON.stringify(this.campForm));
  1190. // 判断是新增还是修改
  1191. if (submitData.trainingCampId) {
  1192. // 修改训练营
  1193. editCamp(submitData).then(response => {
  1194. if (response.code === 200) {
  1195. this.$message.success('修改训练营成功');
  1196. this.campDialogVisible = false;
  1197. // 更新列表中的数据
  1198. const index = this.campList.findIndex(camp => camp.trainingCampId === submitData.trainingCampId);
  1199. if (index !== -1) {
  1200. this.campList[index] = { ...this.campList[index], ...submitData };
  1201. // 如果修改的是当前选中的训练营,更新右侧列表
  1202. if (this.activeCampIndex === index) {
  1203. this.selectCamp(index);
  1204. }
  1205. }
  1206. // 重新加载训练营列表
  1207. this.getLeftList();
  1208. } else {
  1209. this.$message.error(response.msg || '修改训练营失败');
  1210. this.leftLoading = false;
  1211. }
  1212. }).catch(error => {
  1213. this.$message.error('修改训练营失败: ' + (error.message || '未知错误'));
  1214. this.leftLoading = false;
  1215. });
  1216. } else {
  1217. // 新增训练营
  1218. addCamp(submitData).then(response => {
  1219. if (response.code === 200) {
  1220. this.$message.success('新建训练营成功');
  1221. this.campDialogVisible = false;
  1222. // 重新加载训练营列表
  1223. this.getLeftList();
  1224. } else {
  1225. this.$message.error(response.msg || '新建训练营失败');
  1226. this.leftLoading = false;
  1227. }
  1228. }).catch(error => {
  1229. this.$message.error('新建训练营失败: ' + (error.message || '未知错误'));
  1230. this.leftLoading = false;
  1231. });
  1232. }
  1233. }
  1234. });
  1235. },
  1236. /** 排序方式改变 */
  1237. handleSortChange(value) {
  1238. this.leftQueryParams.scs = value;
  1239. // 重置页码和列表
  1240. this.leftQueryParams.pageNum = 1;
  1241. this.campList = [];
  1242. this.getLeftList();
  1243. },
  1244. /** 选中训练营 */
  1245. selectCamp(index) {
  1246. if(index == null || index == undefined) return;
  1247. this.activeCampIndex = index;
  1248. // 加载对应的训练营营期数据
  1249. const selectedCamp = this.campList[index];
  1250. this.queryParams.trainingCampId = selectedCamp.trainingCampId;
  1251. this.getList();
  1252. },
  1253. /** 处理滚动事件,实现滚动到底部加载更多 */
  1254. handleScroll() {
  1255. // 如果正在节流中或者正在加载中,则不处理
  1256. if (this.scrollThrottle || this.loadingMore) return;
  1257. // 设置节流,200ms内不再处理滚动事件
  1258. this.scrollThrottle = true;
  1259. setTimeout(() => {
  1260. this.scrollThrottle = false;
  1261. }, 200);
  1262. const scrollEl = this.$refs.campList;
  1263. if (!scrollEl) return;
  1264. // 判断是否滚动到底部:滚动高度 + 可视高度 >= 总高度 - 30(添加30px的容差,提前触发加载)
  1265. const isBottom = scrollEl.scrollTop + scrollEl.clientHeight >= scrollEl.scrollHeight - 30;
  1266. // 如果滚动到底部,且有下一页数据,且当前不在加载中,则加载更多
  1267. if (isBottom && this.leftQueryParams.hasNextPage && !this.leftLoading && !this.loadingMore) {
  1268. this.loadMoreCamps();
  1269. }
  1270. },
  1271. /** 加载更多训练营数据 */
  1272. loadMoreCamps() {
  1273. // 已在加载中,防止重复加载
  1274. if (this.leftLoading || this.loadingMore) return;
  1275. // 设置加载状态
  1276. this.loadingMore = true;
  1277. // 页码加1
  1278. this.leftQueryParams.pageNum += 1;
  1279. // 加载下一页数据
  1280. listCamp(this.leftQueryParams).then(response => {
  1281. if (response && response.code === 200) {
  1282. // 将新数据追加到列表中
  1283. const newList = response.data.list || [];
  1284. if (newList.length > 0) {
  1285. this.campList = [...this.campList, ...newList];
  1286. }
  1287. // 更新是否有下一页的标志
  1288. this.leftQueryParams.hasNextPage = response.data.hasNextPage;
  1289. // 如果当前显示的列表高度不足以触发滚动,但还有更多数据,自动加载下一页
  1290. this.$nextTick(() => {
  1291. const scrollEl = this.$refs.campList;
  1292. if (scrollEl && this.leftQueryParams.hasNextPage && scrollEl.scrollHeight <= scrollEl.clientHeight) {
  1293. // 延迟一点再加载下一页,避免过快加载
  1294. setTimeout(() => {
  1295. this.loadMoreCamps();
  1296. }, 300);
  1297. }
  1298. });
  1299. } else {
  1300. this.$message.error(response.msg || '加载更多训练营失败');
  1301. }
  1302. this.loadingMore = false;
  1303. }).catch(error => {
  1304. console.error('加载更多训练营失败:', error);
  1305. this.$message.error('加载更多训练营失败');
  1306. this.loadingMore = false;
  1307. });
  1308. },
  1309. timeChange(type) {
  1310. if (type == 1) {
  1311. this.form.periodStartingTime = this.form.dateRange[0];
  1312. this.form.periodEndTime = this.form.dateRange[1];
  1313. if (!Array.isArray(this.form.days)) {
  1314. this.form.days = [];
  1315. }
  1316. this.form.days = [];
  1317. let days = this.getDiff(this.form.periodStartingTime, this.form.periodEndTime);
  1318. for (let i = 0; i < days; i++) {
  1319. this.form.days.push({ lesson: i + 1 });
  1320. }
  1321. }
  1322. if (type == 2) {
  1323. this.form.periodStartingTime = this.form.date;
  1324. this.form.periodEndTime = this.form.date;
  1325. this.form.days = [];
  1326. }
  1327. },
  1328. getDiff(start, end) {
  1329. if(start == null || start == undefined || start == '') return 0;
  1330. if(end == null || end == undefined || end == '') return 0;
  1331. if(start == end) 1;
  1332. const startDate = this.getUTCDate(start);
  1333. const endDate = this.getUTCDate(end);
  1334. const timeDiff = endDate - startDate;
  1335. return (Math.floor(timeDiff / (1000 * 3600 * 24))) + 1; // 直接取整
  1336. },
  1337. getUTCDate(dateStr) {
  1338. const [year, month, day] = dateStr.split('-').map(Number);
  1339. return new Date(Date.UTC(year, month - 1, day)); // 月份从0开始
  1340. },
  1341. // handleCourse(row){
  1342. // this.course = {
  1343. // open: false,
  1344. // row:{},
  1345. // list:[],
  1346. // queryParams: {
  1347. // pageNum: 1,
  1348. // pageSize: 3, // 修改为每页显示3条
  1349. // },
  1350. // loading: true,
  1351. // total: 0,
  1352. // addOpen: false,
  1353. // form: {},
  1354. // };
  1355. // this.course.open = true;
  1356. // this.course.row = row;
  1357. // this.course.queryParams.periodId = row.periodId;
  1358. // this.getCourseList();
  1359. // },
  1360. getCourseList(){
  1361. this.course.loading = true;
  1362. getDays(this.course.queryParams).then(e => {
  1363. this.course.list = e.rows;
  1364. this.course.total = e.total;
  1365. this.course.loading = false;
  1366. });
  1367. },
  1368. handleAddCourse() {
  1369. const key = "joinTime.switch.config"
  1370. getConfigByKey(key).then(response => {
  1371. const {code,data} = response
  1372. if (code === 200) {
  1373. let value = data?.configValue
  1374. console.log(value)
  1375. if (value) {
  1376. this.joinTimeSwitch = value=='0'?true:false;
  1377. }
  1378. }
  1379. });
  1380. this.course.addOpen = true;
  1381. this.course.form = {
  1382. periodId: this.course.queryParams.periodId,
  1383. courseId: null,
  1384. timeRange: ['00:00:00', '23:59:59'],
  1385. joinTime: '23:59:59',
  1386. videoIds: []
  1387. };
  1388. // 重置表单
  1389. this.$nextTick(() => {
  1390. if (this.$refs.courseAddForm) {
  1391. this.$refs.courseAddForm.resetFields();
  1392. }
  1393. });
  1394. },
  1395. handleUpdateCourse() {
  1396. const key = "joinTime.switch.config"
  1397. getConfigByKey(key).then(response => {
  1398. const {code,data} = response
  1399. if (code === 200) {
  1400. let value = data?.configValue
  1401. console.log(value)
  1402. if (value) {
  1403. this.joinTimeSwitch = value=='0'?true:false;
  1404. }
  1405. }
  1406. })
  1407. this.updateCourse.open = true;
  1408. this.updateCourse.form = {
  1409. ids: this.updateCourse.ids,
  1410. timeRange: null,
  1411. joinTime: null
  1412. };
  1413. // 重置表单校验状态(但不清空选中状态)
  1414. this.$nextTick(() => {
  1415. if (this.$refs.courseUpdateForm) {
  1416. this.$refs.courseUpdateForm.resetFields();
  1417. }
  1418. });
  1419. },
  1420. closeAddCourse() {
  1421. this.course.addOpen = false;
  1422. this.course.form = {
  1423. periodId: null,
  1424. courseId: null,
  1425. timeRange: null,
  1426. joinTime: null,
  1427. videoIds: []
  1428. };
  1429. // 重置表单
  1430. if (this.$refs.courseAddForm) {
  1431. this.$refs.courseAddForm.resetFields();
  1432. }
  1433. },
  1434. closeUpdateCourse() {
  1435. this.updateCourse.open = false;
  1436. // 清空选中的课程id,使【修改看课时间】按钮变为禁用状态
  1437. this.updateCourse.ids = [];
  1438. // 清空课程列表的选中状态
  1439. this.$nextTick(() => {
  1440. if (this.$refs.courseTable) {
  1441. this.$refs.courseTable.clearSelection();
  1442. }
  1443. });
  1444. // 重置表单数据
  1445. this.updateCourse.form = {
  1446. ids: [],
  1447. timeRange: null,
  1448. joinTime: null
  1449. };
  1450. // 重置表单校验
  1451. this.$nextTick(() => {
  1452. if (this.$refs.courseUpdateForm) {
  1453. this.$refs.courseUpdateForm.resetFields();
  1454. }
  1455. });
  1456. },
  1457. courseChange(row){
  1458. this.course.form.videoIds = [];
  1459. videoList(row).then(response => {
  1460. this.videoList=response.list
  1461. });
  1462. },
  1463. submitCourseForm(){
  1464. this.$refs.courseAddForm.validate(valid => {
  1465. if (valid) {
  1466. if(this.course.form.timeRange != null && this.course.form.timeRange.length === 2){
  1467. this.course.form.startTime = this.course.form.timeRange[0];
  1468. this.course.form.endTime1 = this.course.form.timeRange[1];
  1469. }
  1470. // 提交数据
  1471. addCourse(this.course.form).then(response => {
  1472. this.$message.success('添加成功');
  1473. this.course.addOpen = false;
  1474. // 重新加载训练营列表
  1475. this.getCourseList();
  1476. });
  1477. }
  1478. });
  1479. },
  1480. submitUpdateCourseForm(){
  1481. this.$refs.courseUpdateForm.validate(valid => {
  1482. if (valid) {
  1483. // 检查时间范围是否正确
  1484. if (this.updateCourse.form.timeRange &&
  1485. Array.isArray(this.updateCourse.form.timeRange) &&
  1486. this.updateCourse.form.timeRange.length === 2) {
  1487. this.updateCourse.form.startTime = this.updateCourse.form.timeRange[0];
  1488. this.updateCourse.form.endTime1 = this.updateCourse.form.timeRange[1];
  1489. } else {
  1490. this.$message.error('请先选择正确的看课时间范围');
  1491. return;
  1492. }
  1493. // 检查领取红包时间是否正确
  1494. if (!this.updateCourse.form.joinTime&&this.joinTimeSwitch) {
  1495. this.$message.error('请选择领取红包时间');
  1496. return;
  1497. }
  1498. // 提交数据
  1499. updateCourseTime(this.updateCourse.form).then(response => {
  1500. this.$message.success('修改成功');
  1501. this.updateCourse.open = false;
  1502. // 清空选中的课程ID,使【修改看课时间】按钮变为禁用状态
  1503. this.updateCourse.ids = [];
  1504. // 清空课程列表的选中状态
  1505. this.$nextTick(() => {
  1506. if (this.$refs.courseTable) {
  1507. this.$refs.courseTable.clearSelection();
  1508. }
  1509. });
  1510. // 重新加载训练营列表
  1511. this.getCourseList();
  1512. }).catch(error => {
  1513. this.$message.error('修改失败:' + (error.message || '未知错误'));
  1514. });
  1515. }
  1516. });
  1517. },
  1518. updatePeriodDateSubmit(){
  1519. updateCourseDate(this.updatePeriodDate.form).then(response => {
  1520. this.$message.success('修改成功');
  1521. this.updatePeriodDate.open = false;
  1522. // 重新加载课程列表
  1523. this.getCourseList();
  1524. });
  1525. },
  1526. // saveCourseData(){
  1527. // updateListCourseData(this.course.list).then(response => {
  1528. // this.$message.success('保存成功');
  1529. // this.getCourseList();
  1530. // });
  1531. // },
  1532. // setRedPacket(row) {
  1533. // this.currentRedPacketData = {
  1534. // periodId: row.periodId
  1535. // // videoId: row.videoId
  1536. // };
  1537. // this.redPacketVisible = true;
  1538. // },
  1539. handleRedPacketSuccess() {
  1540. this.getCourseList();
  1541. },
  1542. handlePeriodSettings(row) {
  1543. this.periodSettingsData = row;
  1544. this.periodSettingsVisible = true;
  1545. // 初始化课程列表
  1546. this.course.queryParams.periodId = row.periodId;
  1547. // 根据当前激活的tab加载对应数据
  1548. this.handleTabClick({ name: this.activeTab });
  1549. },
  1550. // 结束营期
  1551. handleClosePeriod(row) {
  1552. const msg = `注: 1.确认结束营期,该营期的开营结束时间改为当天24点。2.当天正在播放中的课程不变。3.第二天如有未开始的课程,统一改为已结束。是否确认结束 ${row.periodName} 营期吗?`
  1553. this.$confirm(msg, "警告", {
  1554. confirmButtonText: "确定",
  1555. cancelButtonText: "取消",
  1556. type: "warning"
  1557. }).then(() => {
  1558. closePeriod({id: row.periodId}).then(response => {
  1559. if (response.code === 200) {
  1560. this.getList()
  1561. } else {
  1562. this.$message.error(response.msg)
  1563. }
  1564. })
  1565. }).catch(() => {})
  1566. },
  1567. handleBatchRedPacketSuccess() {
  1568. this.batchRedPacketVisible = false;
  1569. this.getCourseList();
  1570. },
  1571. /** 处理tab切换 */
  1572. handleTabClick(tab) {
  1573. if (tab.name === 'course') {
  1574. this.getCourseList();
  1575. } else if (tab.name === 'company') {
  1576. this.redPacketVisible = true;
  1577. }
  1578. },
  1579. /** 上移课程 */
  1580. handleTop(row) {
  1581. const currentIndex = this.course.list.findIndex(item => item.id === row.id);
  1582. if (currentIndex <= 0) {
  1583. this.$message.warning('已经是第一条数据');
  1584. return;
  1585. }
  1586. // 获取上一条数据
  1587. const prevRow = this.course.list[currentIndex - 1];
  1588. console.log({
  1589. id: row.id,
  1590. targetId: prevRow.id,
  1591. type: 1 //上移
  1592. })
  1593. periodCourseMove({
  1594. id: row.id,
  1595. targetId: prevRow.id,
  1596. type: 1 //上移
  1597. }).then(response => {
  1598. if (response.code === 200) {
  1599. this.$message.success('上移成功');
  1600. this.getCourseList();
  1601. } else {
  1602. this.$message.error(response.msg || '上移失败');
  1603. }
  1604. }).catch(() => {
  1605. this.$message.error('上移失败');
  1606. });
  1607. },
  1608. /** 下移课程 */
  1609. handleBottom(row) {
  1610. const currentIndex = this.course.list.findIndex(item => item.id === row.id);
  1611. if (currentIndex === -1 || currentIndex >= this.course.list.length - 1) {
  1612. this.$message.warning('已经是最后一条数据');
  1613. return;
  1614. }
  1615. // 获取下一条数据
  1616. const nextRow = this.course.list[currentIndex + 1];
  1617. periodCourseMove({
  1618. id: row.id,
  1619. targetId: nextRow.id,
  1620. type: 2 //下移
  1621. }).then(response => {
  1622. if (response.code === 200) {
  1623. this.$message.success('下移成功');
  1624. this.getCourseList(); // 重新加载列表
  1625. } else {
  1626. this.$message.error(response.msg || '下移失败');
  1627. }
  1628. }).catch(() => {
  1629. this.$message.error('下移失败');
  1630. });
  1631. },
  1632. /** 营期状态格式化 */
  1633. periodStatusFormatter(row) {
  1634. const statusMap = {
  1635. 1: '未开始',
  1636. 2: '进行中',
  1637. 3: '已结束'
  1638. };
  1639. return statusMap[row.periodStatus] || '未知状态';
  1640. },
  1641. /** 开课状态格式化 */
  1642. courseStatusFormatter(row) {
  1643. const statusMap = {
  1644. 0: '未开始',
  1645. 1: '进行中',
  1646. 2: '已结束'
  1647. };
  1648. return statusMap[row.status] || '未知状态';
  1649. },
  1650. /** 营期状态格式化 */
  1651. handleUpdateDate(row) {
  1652. this.updatePeriodDate.form = {id: row.id, dayDate: row.dayDate};
  1653. this.updatePeriodDate.open = true;
  1654. },
  1655. disabledDate(time) {
  1656. return time.getTime() < new Date(new Date().setHours(0,0,0,0));
  1657. },
  1658. getPickerOptions() {
  1659. // 如果已选择看课时间范围,则领取红包时间应在看课时间范围内
  1660. if (this.updateCourse.form.timeRange &&
  1661. Array.isArray(this.updateCourse.form.timeRange) &&
  1662. this.updateCourse.form.timeRange.length === 2) {
  1663. return {
  1664. selectableRange: `${this.updateCourse.form.timeRange[0]} - ${this.updateCourse.form.timeRange[1]}`
  1665. };
  1666. }
  1667. // 默认全天可选
  1668. return {
  1669. selectableRange: '00:00:00 - 23:59:59'
  1670. };
  1671. },
  1672. onTimeRangeChange() {
  1673. // 当看课时间范围改变时,清空领取红包时间
  1674. this.updateCourse.form.joinTime = null;
  1675. // 强制更新组件以刷新领取红包时间的可选范围
  1676. this.$forceUpdate();
  1677. },
  1678. },
  1679. };
  1680. </script>
  1681. <style scoped>
  1682. .left-aside {
  1683. background-color: #fff;
  1684. border-right: 1px solid #EBEEF5;
  1685. padding: 0;
  1686. display: flex;
  1687. flex-direction: column;
  1688. height: 800px;
  1689. }
  1690. .left-header {
  1691. padding: 10px;
  1692. border-bottom: 1px solid #EBEEF5;
  1693. }
  1694. .left-header-top {
  1695. display: flex;
  1696. justify-content: space-between;
  1697. align-items: center;
  1698. margin-bottom: 10px;
  1699. }
  1700. .search-btn {
  1701. width: 50%;
  1702. height: 36px;
  1703. background-color: #409EFF;
  1704. color: white;
  1705. border: none;
  1706. }
  1707. .search-input-wrapper {
  1708. margin-bottom: 10px;
  1709. }
  1710. .sort-wrapper {
  1711. display: flex;
  1712. align-items: center;
  1713. margin-bottom: 10px;
  1714. }
  1715. .sort-label {
  1716. width: 70px;
  1717. font-size: 14px;
  1718. font-weight: 600;
  1719. color: #909399;
  1720. }
  1721. .sort-select {
  1722. margin-left: 10px;
  1723. width: 280px;
  1724. }
  1725. .color-wrapper {
  1726. display: flex;
  1727. align-items: center;
  1728. margin-bottom: 10px;
  1729. }
  1730. .color-label {
  1731. width: 70px;
  1732. color: #606266;
  1733. }
  1734. .color-hint {
  1735. margin-left: 10px;
  1736. color: #606266;
  1737. font-size: 12px;
  1738. }
  1739. .color-help {
  1740. margin-left: 5px;
  1741. color: #909399;
  1742. cursor: pointer;
  1743. }
  1744. .hint-text {
  1745. color: #606266;
  1746. font-size: 12px;
  1747. margin-top: 5px;
  1748. }
  1749. .camp-list {
  1750. flex: 1;
  1751. overflow-y: auto;
  1752. padding: 3px;
  1753. }
  1754. .camp-item {
  1755. margin-bottom: 5px;
  1756. padding: 15px;
  1757. background-color: #ffffff;
  1758. position: relative;
  1759. cursor: pointer;
  1760. display: flex;
  1761. justify-content: space-between;
  1762. border: 1px solid #eaedf2;
  1763. }
  1764. .camp-item:last-child {
  1765. margin-bottom: 0;
  1766. }
  1767. .camp-item:hover {
  1768. background-color: #f5f9ff;
  1769. }
  1770. .camp-item.active {
  1771. background-color: #eaf4ff;
  1772. border-left: 1px solid #75b8fc;
  1773. }
  1774. .camp-content {
  1775. flex: 1;
  1776. padding-right: 10px;
  1777. }
  1778. .camp-title {
  1779. font-weight: bold;
  1780. font-size: 16px;
  1781. margin-bottom: 8px;
  1782. color: #333;
  1783. display: flex;
  1784. align-items: center;
  1785. }
  1786. .camp-icon {
  1787. font-size: 16px;
  1788. margin-right: 6px;
  1789. color: #409EFF;
  1790. }
  1791. .camp-info {
  1792. display: flex;
  1793. justify-content: space-between;
  1794. margin-bottom: 8px;
  1795. font-size: 12px;
  1796. color: #c4c1c1;
  1797. line-height: 1.5;
  1798. }
  1799. .camp-stats {
  1800. display: flex;
  1801. justify-content: space-between;
  1802. font-size: 12px;
  1803. color: #666;
  1804. background-color: #f5f9ff;
  1805. padding: 6px 10px;
  1806. border-radius: 4px;
  1807. line-height: 1.5;
  1808. }
  1809. .stat-item {
  1810. display: flex;
  1811. align-items: center;
  1812. }
  1813. .stat-item i {
  1814. margin-right: 4px;
  1815. font-size: 14px;
  1816. color: #409EFF;
  1817. }
  1818. .camp-actions {
  1819. display: flex;
  1820. flex-direction: column;
  1821. justify-content: center;
  1822. align-items: flex-end;
  1823. gap: 8px;
  1824. border-left: 1px dashed #eaedf2;
  1825. padding-left: 12px;
  1826. min-width: 50px;
  1827. }
  1828. .action-btn {
  1829. padding: 2px 5px;
  1830. font-size: 12px;
  1831. border-radius: 4px;
  1832. transition: all 0.2s;
  1833. }
  1834. .action-btn:hover {
  1835. background-color: rgba(255, 255, 255, 0.8);
  1836. }
  1837. .delete-btn {
  1838. color: #f56c6c;
  1839. }
  1840. .delete-btn:hover {
  1841. background-color: rgba(245, 108, 108, 0.1);
  1842. }
  1843. .copy-btn {
  1844. color: #409EFF;
  1845. }
  1846. .copy-btn:hover {
  1847. background-color: rgba(64, 158, 255, 0.1);
  1848. }
  1849. .warning-icon {
  1850. color: #E6A23C;
  1851. font-size: 16px;
  1852. margin-left: 5px;
  1853. }
  1854. .el-main {
  1855. padding: 10px;
  1856. }
  1857. /* 添加训练营表单样式 */
  1858. .drawer-footer {
  1859. /* position: absolute; */
  1860. bottom: 0;
  1861. left: 0;
  1862. right: 0;
  1863. padding: 20px;
  1864. background: #fff;
  1865. text-align: right;
  1866. border-top: 1px solid #e8e8e8;
  1867. }
  1868. .el-input-number {
  1869. width: 100%;
  1870. }
  1871. /* 加载更多样式 */
  1872. .loading-more {
  1873. display: flex;
  1874. align-items: center;
  1875. justify-content: center;
  1876. padding: 12px 0;
  1877. color: #909399;
  1878. font-size: 14px;
  1879. }
  1880. .loading-more i {
  1881. margin-right: 5px;
  1882. font-size: 16px;
  1883. }
  1884. /* 无更多数据提示 */
  1885. .no-more-data {
  1886. display: flex;
  1887. align-items: center;
  1888. justify-content: center;
  1889. padding: 12px 0;
  1890. color: #c0c4cc;
  1891. font-size: 13px;
  1892. }
  1893. .no-more-data span {
  1894. position: relative;
  1895. display: flex;
  1896. align-items: center;
  1897. }
  1898. </style>