index.vue 67 KB

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