index.vue 47 KB

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