jishuquan.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. <template>
  2. <div>
  3. <el-radio-group v-model="tab" size="small" @change="getList">
  4. <el-radio-button label="ad">活动直播管理</el-radio-button>
  5. <el-radio-button label="topic">文章管理</el-radio-button>
  6. <el-radio-button label="video">视频管理</el-radio-button>
  7. <el-radio-button label="kol">KOL管理</el-radio-button>
  8. </el-radio-group>
  9. <br/>
  10. <template v-if="tab==='ad'">
  11. <div>
  12. <el-button type="success" style="margin-top: 20px;" @click="showAdEdit(null)">添加活动</el-button>
  13. </div>
  14. <div class="content" v-if="ads">
  15. <el-table :data="ads" height="100%" border style="width: 100%">
  16. <el-table-column prop="title" label="活动标题"></el-table-column>
  17. <el-table-column prop="position_name" label="位置"></el-table-column>
  18. <el-table-column label="基本数据">
  19. <template slot-scope="ad" v-if="tab==='ad'">
  20. <el-tag type="success">浏览{{ad.row.view_count}}</el-tag>
  21. </template>
  22. </el-table-column>
  23. <el-table-column prop="status_name" label="状态"></el-table-column>
  24. <el-table-column prop="created_at" label="创建时间"></el-table-column>
  25. <el-table-column label="操作" width="300px;">
  26. <template slot-scope="ad" v-if="tab==='ad'">
  27. <el-button type="primary" @click="showAdEdit(ad.row)">
  28. 编辑
  29. <i class="el-icon-edit el-icon--right"></i>
  30. </el-button>
  31. <el-button type="danger" @click="deleteAd(ad.row.id)">
  32. 删除
  33. <i class="el-icon-delete el-icon--right"></i>
  34. </el-button>
  35. </template>
  36. </el-table-column>
  37. </el-table>
  38. </div>
  39. <el-pagination
  40. class="order-footer"
  41. background
  42. layout="prev, pager, next"
  43. :page-size="20"
  44. :total="total"
  45. @current-change="handleCurrentChange"
  46. />
  47. </template>
  48. <template v-if="tab==='topic'">
  49. <el-radio-group v-model="labelTab" size="small" @change="getList" style="margin-top: 20px;">
  50. <el-radio-button label>全部</el-radio-button>
  51. <el-radio-button label="is_top">置顶</el-radio-button>
  52. <el-radio-button label="is_must_see">进站必看</el-radio-button>
  53. <el-radio-button label="is_hot">热门</el-radio-button>
  54. <el-radio-button label="is_good">优质</el-radio-button>
  55. <el-radio-button label="is_new">最新</el-radio-button>
  56. <el-radio-button label="is_ad">广告</el-radio-button>
  57. </el-radio-group>
  58. <div class="content" v-if="topics">
  59. <el-table :data="topics" height="100%" border style="width: 100%">
  60. <el-table-column :className="`clickable`" prop="title" label="文章标题">
  61. <template slot-scope="scope">
  62. <span @click="goTopic(scope.row)">{{scope.row.title}}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column :className="`clickable`" prop="nickname" label="作者">
  66. <template slot-scope="scope">
  67. <span @click="goRooterUser(scope.row)">{{scope.row.nickname}}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="created_at" label="发布时间"></el-table-column>
  71. <el-table-column label="基本数据" width="280px">
  72. <template slot-scope="topic" v-if="tab==='topic'">
  73. <el-tag type="success">浏览{{topic.row.view_count}}</el-tag>
  74. <el-tag type="info">点赞{{topic.row.like_count}}</el-tag>
  75. <el-tag type="warning">收藏{{topic.row.favorite_count}}</el-tag>
  76. <el-tag type="danger">评论{{topic.row.reply_count}}</el-tag>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="当前标签" width="280px">
  80. <template slot-scope="label" v-if="tab==='topic'">
  81. <el-tag type="info" v-if="label.row.is_top==1" class="custom-label">置顶</el-tag>
  82. <el-tag type="info" v-if="label.row.is_must_see==1" class="custom-label">进站必看</el-tag>
  83. <el-tag type="info" v-if="label.row.is_hot==1" class="custom-label">热门</el-tag>
  84. <el-tag type="info" v-if="label.row.is_good==1" class="custom-label">优质</el-tag>
  85. <el-tag type="info" v-if="label.row.is_new==1" class="custom-label">最新</el-tag>
  86. <el-tag type="info" v-if="label.row.is_ad==1" class="custom-label">广告</el-tag>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="操作" width="260px" v-if="tab==='topic'">
  90. <template slot-scope="topic" v-if="tab==='topic'">
  91. <template>
  92. <el-button type="primary" @click="editLabel(topic.row)">
  93. 标签管理
  94. <i class="el-icon-setting el-icon--right"></i>
  95. </el-button>
  96. </template>
  97. <el-button type="danger" @click="delTopic(topic.row.id)">
  98. 删除
  99. <i class="el-icon-delete el-icon--right"></i>
  100. </el-button>
  101. </template>
  102. </el-table-column>
  103. </el-table>
  104. </div>
  105. <el-pagination
  106. class="order-footer"
  107. background
  108. layout="prev, pager, next"
  109. :page-size="20"
  110. :total="total"
  111. @current-change="handleCurrentChange"
  112. />
  113. </template>
  114. <template v-if="tab==='video'">
  115. <div class="content" v-if="videos">
  116. <el-table :data="videos" height="100%" border style="width: 100%">
  117. <el-table-column prop="title" :className="`clickable`" label="视频简介">
  118. <template slot-scope="scope">
  119. <span @click="goVideo(scope.row)">{{scope.row.title}}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column prop="nickname" :className="`clickable`" label="作者">
  123. <template slot-scope="scope">
  124. <span @click="goRooterUser(scope.row)">{{scope.row.nickname}}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column prop="created_at" label="发布时间"></el-table-column>
  128. <el-table-column label="基本数据" width="340px">
  129. <template slot-scope="video" v-if="tab==='video'">
  130. <el-tag type="success">浏览:{{video.row.view_count}}</el-tag>
  131. <el-tag type="info">点赞:{{video.row.like_count}}</el-tag>
  132. <el-tag type="warning">收藏:{{video.row.favorite_count}}</el-tag>
  133. <el-tag type="danger">评论:{{video.row.reply_count}}</el-tag>
  134. </template>
  135. </el-table-column>
  136. <el-table-column prop="status_name" label="状态"></el-table-column>
  137. <el-table-column label="操作" width="340px">
  138. <template slot-scope="video" v-if="tab==='video'">
  139. <el-button
  140. type="primary"
  141. v-if="video.row.status==1"
  142. @click="approveVideo(video.row.id)"
  143. >
  144. 下架
  145. <i class="el-icon-bottom el-icon--right"></i>
  146. </el-button>
  147. <el-button
  148. type="primary"
  149. v-if="video.row.status==0"
  150. @click="approveVideo(video.row.id)"
  151. >
  152. 上架
  153. <i class="el-icon-top el-icon--right"></i>
  154. </el-button>
  155. <el-button type="danger" @click="deleteVideo(video.row.id)">
  156. 删除
  157. <i class="el-icon-delete el-icon--right"></i>
  158. </el-button>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. </div>
  163. <el-pagination
  164. class="order-footer"
  165. background
  166. layout="prev, pager, next"
  167. :page-size="20"
  168. :total="total"
  169. @current-change="handleCurrentChange"
  170. />
  171. </template>
  172. <template v-if="tab==='kol'">
  173. <div>
  174. <el-button type="success" style="margin-top: 20px;" @click="onAddAu(null)">添加KOL</el-button>
  175. </div>
  176. <div class="content" v-if="kols">
  177. <el-table :data="kols" height="100%" border style="width: 100%">
  178. <el-table-column prop="name" :className="`clickable`" label="作者名">
  179. <template slot-scope="scope">
  180. <span>{{scope.row.name}}</span>
  181. </template>
  182. </el-table-column>
  183. <el-table-column prop="introduction" :className="`clickable`" label="简介">
  184. <template slot-scope="scope">
  185. <span>{{scope.row.introduction}}</span>
  186. </template>
  187. </el-table-column>
  188. <el-table-column prop="is_signing" label="是否签约">
  189. <template slot-scope="scope">
  190. <div v-if="scope.row.is_signing ==1">
  191. 签约
  192. </div>
  193. <div v-else>未签约</div>
  194. </template>
  195. </el-table-column>
  196. <el-table-column prop="uid" label="客栈UID"></el-table-column>
  197. <el-table-column label="关联渠道">
  198. <template slot-scope="scope">
  199. <div v-for="item in scope.row.channle">
  200. {{item.code}}
  201. </div>
  202. </template>
  203. </el-table-column>
  204. <el-table-column prop="re_article_num" label="文章数"></el-table-column>
  205. <el-table-column prop="to_read_num" label="阅读数"></el-table-column>
  206. <el-table-column prop="to_praise_num" label="获赞数"></el-table-column>
  207. <el-table-column prop="to_follow_num" label="粉丝数"></el-table-column>
  208. <!-- <el-table-column label="关联领域">-->
  209. <!-- <template slot-scope="scope">-->
  210. <!-- <el-tag type="success">浏览:{{scope.row.name}}</el-tag>-->
  211. <!-- <el-tag type="danger">评论:</el-tag>-->
  212. <!-- </template>-->
  213. <!-- </el-table-column>-->
  214. <el-table-column label="操作">
  215. <template slot-scope="scope">
  216. <el-link icon="el-icon-edit" @click="onEditAu(scope.row.id)">编辑</el-link>
  217. </template>
  218. </el-table-column>
  219. </el-table>
  220. </div>
  221. <el-pagination
  222. class="order-footer"
  223. background
  224. layout="prev, pager, next"
  225. :page-size="20"
  226. :total="total"
  227. @current-change="handleCurrentChange"
  228. />
  229. </template>
  230. <el-dialog title="活动管理" :visible.sync="dialogFormVisible">
  231. <el-form :model="form">
  232. <el-form-item label="活动标题" :label-width="formLabelWidth">
  233. <el-input v-model="form.title" autocomplete="off"></el-input>
  234. </el-form-item>
  235. <el-form-item label="链接" :label-width="formLabelWidth">
  236. <el-input v-model="form.url" autocomplete="off"></el-input>
  237. </el-form-item>
  238. <el-form-item label="用户UID" :label-width="formLabelWidth">
  239. <el-input v-model="form.uid" autocomplete="off"></el-input>
  240. </el-form-item>
  241. <el-form-item label="话题标签" :label-width="formLabelWidth">
  242. <el-input v-model="form.tags" autocomplete="off"></el-input>
  243. </el-form-item>
  244. <el-form-item label="状态" :label-width="formLabelWidth">
  245. <el-select v-model="form.status" placeholder="请选择上架/下架">
  246. <el-option label="上架" value="1"></el-option>
  247. <el-option label="下架" value="0"></el-option>
  248. </el-select>
  249. </el-form-item>
  250. <el-form-item label="类型" :label-width="formLabelWidth">
  251. <el-select v-model="form.type" placeholder="请选择类型">
  252. <el-option label="文章" value="1"></el-option>
  253. <el-option label="视频" value="2"></el-option>
  254. </el-select>
  255. </el-form-item>
  256. <el-form-item label="广告位置" :label-width="formLabelWidth">
  257. <el-select v-model="form.position" placeholder="请选择位置">
  258. <el-option label="广告位1" value="1"></el-option>
  259. <el-option label="广告位2" value="2"></el-option>
  260. </el-select>
  261. </el-form-item>
  262. </el-form>
  263. <div slot="footer" class="dialog-footer">
  264. <el-button @click="dialogFormVisible = false">取 消</el-button>
  265. <el-button type="primary" @click="editAd">确 定</el-button>
  266. </div>
  267. </el-dialog>
  268. <el-dialog title="KOL管理" :visible.sync="kolFormVisible" :closeOnClickModal="false" :closeOnPressEscape="false">
  269. <el-form :model="kolform">
  270. <el-form-item label="作者名" :label-width="formLabelWidth">
  271. <el-input v-model="kolform.name" autocomplete="off"></el-input>
  272. </el-form-item>
  273. <el-form-item label="简介" :label-width="formLabelWidth">
  274. <el-input v-model="kolform.introduction" autocomplete="off"></el-input>
  275. </el-form-item>
  276. <el-form-item label="账号创建" :label-width="formLabelWidth" v-if="!isEdit">
  277. <el-radio v-model="radio" label="1" checked>自动创建新账号</el-radio>
  278. <el-radio v-model="radio" label="2">指定UID</el-radio>
  279. </el-form-item>
  280. <el-form-item label="客栈UID" :label-width="formLabelWidth" v-show="radio == 2 || isEdit">
  281. <el-input v-model="kolform.uid" autocomplete="off" :disabled="isEdit"></el-input>
  282. </el-form-item>
  283. <el-form-item label="是否签约" :label-width="formLabelWidth">
  284. <el-switch v-model="kolform.is_signing"></el-switch>
  285. </el-form-item>
  286. <el-form-item :label-width="formLabelWidth">
  287. <template>
  288. <el-row :gutter="20">
  289. <el-col :span="6">
  290. <div class="grid-content bg-purple">渠道</div>
  291. </el-col>
  292. <el-col :span="6">
  293. <div class="grid-content bg-purple">通道ID</div>
  294. </el-col>
  295. <el-col :span="6">
  296. <div class="grid-content bg-purple">渠道URL</div>
  297. </el-col>
  298. <!-- <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>-->
  299. </el-row>
  300. <template v-for="(item,index) in channelData">
  301. <el-row :gutter="20" style="margin-top: 5px">
  302. <el-col :span="6">
  303. <div class="grid-content bg-purple">
  304. <el-select v-model="channelData[index].code" placeholder="请选择">
  305. <el-option
  306. v-for="item in options"
  307. :key="item.value"
  308. :label="item.label"
  309. :value="item.value">
  310. </el-option>
  311. </el-select>
  312. </div>
  313. </el-col>
  314. <el-col :span="6">
  315. <div class="grid-content bg-purple">
  316. <el-input v-model="item.channel_id" placeholder="请输入内容"></el-input>
  317. </div>
  318. </el-col>
  319. <el-col :span="6">
  320. <div class="grid-content bg-purple">
  321. <el-input v-model="item.url" placeholder="请输入内容"></el-input>
  322. </div>
  323. </el-col>
  324. <el-col :span="6">
  325. <div class="grid-content bg-purple">
  326. <el-button
  327. @click="deleteChannleRow(index)"
  328. type="text"
  329. size="small" v-if="index != 0">
  330. 移除
  331. </el-button>
  332. <el-button
  333. @click="addChannleRow()"
  334. type="text"
  335. size="small">
  336. 添加
  337. </el-button>
  338. </div>
  339. </el-col>
  340. </el-row>
  341. </template>
  342. </template>
  343. </el-form-item>
  344. </el-form>
  345. <div slot="footer" class="dialog-footer">
  346. <el-button @click="kolFormVisible = false">取 消</el-button>
  347. <el-button type="primary" @click="editAu">确 定</el-button>
  348. </div>
  349. </el-dialog>
  350. <el-dialog title="标签管理" :visible.sync="labelEditFormVisible">
  351. <el-form :model="form">
  352. <el-form-item label="当前标签" :label-width="formLabelWidth">
  353. <el-tag
  354. type="info"
  355. v-if="this.currentLabel.is_top===1"
  356. class="custom-label"
  357. closable
  358. :disable-transitions="false"
  359. @close="handleClose('is_top')"
  360. >置顶
  361. </el-tag>
  362. <el-tag
  363. type="info"
  364. v-if="this.currentLabel.is_must_see===1"
  365. class="custom-label"
  366. closable
  367. :disable-transitions="false"
  368. @close="handleClose('is_must_see')"
  369. >进站必看
  370. </el-tag>
  371. <el-tag
  372. type="info"
  373. v-if="this.currentLabel.is_hot===1"
  374. class="custom-label"
  375. closable
  376. :disable-transitions="false"
  377. @close="handleClose('is_hot')"
  378. >热门
  379. </el-tag>
  380. <el-tag
  381. type="info"
  382. v-if="this.currentLabel.is_good===1"
  383. class="custom-label"
  384. closable
  385. :disable-transitions="false"
  386. @close="handleClose('is_good')"
  387. >优质
  388. </el-tag>
  389. <el-tag
  390. type="info"
  391. v-if="this.currentLabel.is_new===1"
  392. class="custom-label"
  393. closable
  394. :disable-transitions="false"
  395. @close="handleClose('is_new')"
  396. >最新
  397. </el-tag>
  398. <el-tag
  399. type="info"
  400. v-if="this.currentLabel.is_ad===1"
  401. class="custom-label"
  402. closable
  403. :disable-transitions="false"
  404. @close="handleClose('is_ad')"
  405. >广告
  406. </el-tag>
  407. </el-form-item>
  408. <el-form-item label="添加标签" :label-width="formLabelWidth">
  409. <el-select v-model="addCurrentLabel" placeholder="请选择位置">
  410. <el-option label="暂不添加" value></el-option>
  411. <el-option label="置顶" value="is_top"></el-option>
  412. <el-option label="进站必看" value="is_must_see"></el-option>
  413. <el-option label="热门" value="is_hot"></el-option>
  414. <el-option label="优质" value="is_good"></el-option>
  415. <el-option label="最新" value="is_new"></el-option>
  416. <el-option label="广告" value="is_ad"></el-option>
  417. </el-select>
  418. </el-form-item>
  419. </el-form>
  420. <div slot="footer" class="dialog-footer">
  421. <el-button type="primary" @click="addLabel">添 加</el-button>
  422. <el-button @click="labelEditFormVisible = false;getList()">关闭</el-button>
  423. </div>
  424. </el-dialog>
  425. </div>
  426. </template>
  427. <script>
  428. export default {
  429. data() {
  430. return {
  431. labelTab: "",
  432. page: 1,
  433. size: 20,
  434. tab: "ad",
  435. total: 1,
  436. ads: [],
  437. topics: [],
  438. videos: [],
  439. kols: [], //作者
  440. addCurrentLabel: "",
  441. form: {
  442. title: "",
  443. url: "",
  444. type: "1",
  445. tags: "",
  446. status: "1",
  447. position: "1"
  448. },
  449. kolform: {
  450. portrait: './',
  451. name: "",
  452. introduction: "",
  453. uid: "",
  454. is_signing: true,
  455. },
  456. options: [{
  457. value: 'wechat',
  458. label: 'wechat'
  459. }, {
  460. value: 'juejin',
  461. label: 'juejin'
  462. }, {
  463. value: 'zhihu',
  464. label: 'zhihu'
  465. }, {
  466. value: 'csdn',
  467. label: 'csdn'
  468. }],
  469. currentLabel: {
  470. is_ad: 0,
  471. is_new: 0,
  472. is_good: 0,
  473. is_hot: 0,
  474. is_must_see: 0,
  475. is_top: 0
  476. },
  477. radio: '1',
  478. currentId: 0,
  479. dialogFormVisible: false,
  480. formLabelWidth: "120px",
  481. labelEditFormVisible: false,
  482. kolFormVisible: false, //kol
  483. isEdit: false,
  484. channelData: [
  485. {
  486. channel_id: '',
  487. url: '',
  488. code: 'wechat'
  489. }
  490. ] //
  491. }
  492. },
  493. mounted() {
  494. this.getList();
  495. },
  496. methods: {
  497. goTopic(topic) {
  498. console.log(topic);
  499. window.open(
  500. this.$store.state.domainConfig.jishuinUrl + "/p/" + topic.id + ".html"
  501. );
  502. },
  503. goVideo(topic) {
  504. console.log(topic);
  505. window.open(
  506. this.$store.state.domainConfig.jishuinUrl + "/video/" + topic.video_id
  507. );
  508. },
  509. goRooterUser(topic) {
  510. window.open(
  511. this.$store.state.domainConfig.siteUrl + "/rooter/user/" + topic.user_id
  512. );
  513. },
  514. addLabel() {
  515. if (this.addCurrentLabel) {
  516. let res = this.$post("/api/admin/jishuquan/add_label", {
  517. id: this.currentId,
  518. type: this.addCurrentLabel
  519. }).then(res => {
  520. if (res.status === 1) {
  521. this.currentLabel[this.addCurrentLabel] = 1;
  522. this.$message({
  523. type: "success",
  524. message: "添加成功!"
  525. });
  526. }
  527. });
  528. }
  529. },
  530. handleClose(type) {
  531. this.$confirm("此操作将永久删除该标签, 是否继续?", "提示", {
  532. confirmButtonText: "确定",
  533. cancelButtonText: "取消",
  534. type: "warning"
  535. })
  536. .then(() => {
  537. let res = this.$post("/api/admin/jishuquan/remove_label", {
  538. id: this.currentId,
  539. type: type
  540. }).then(res => {
  541. if (res.status === 1) {
  542. this.currentLabel[type] = 0;
  543. this.$message({
  544. type: "success",
  545. message: "删除成功!"
  546. });
  547. }
  548. });
  549. })
  550. .catch(() => {
  551. this.$message({
  552. type: "info",
  553. message: "已取消删除"
  554. });
  555. });
  556. },
  557. editLabel(topic) {
  558. this.currentLabel = {
  559. is_ad: 0,
  560. is_new: 0,
  561. is_good: 0,
  562. is_hot: 0,
  563. is_must_see: 0,
  564. is_top: 0
  565. }; //复位
  566. this.currentId = topic.id;
  567. if (Number(topic.is_ad) === 1) this.currentLabel.is_ad = 1;
  568. if (Number(topic.is_new) === 1) this.currentLabel.is_new = 1;
  569. if (Number(topic.is_hot) === 1) this.currentLabel.is_hot = 1;
  570. if (Number(topic.is_top) === 1) this.currentLabel.is_top = 1;
  571. if (Number(topic.is_good) === 1) this.currentLabel.is_good = 1;
  572. if (Number(topic.is_must_see) === 1) this.currentLabel.is_must_see = 1;
  573. this.labelEditFormVisible = true;
  574. },
  575. delTopic(id) {
  576. this.$confirm("此操作将永久删除该文章, 是否继续?", "提示", {
  577. confirmButtonText: "确定",
  578. cancelButtonText: "取消",
  579. type: "warning"
  580. })
  581. .then(() => {
  582. let res = this.$post("/api/admin/jishuquan/delete_topic", {
  583. id: id
  584. }).then(res => {
  585. if (res.status == 1) {
  586. this.$message({
  587. type: "success",
  588. message: "删除成功!"
  589. });
  590. this.getList();
  591. }
  592. });
  593. })
  594. .catch(() => {
  595. this.$message({
  596. type: "info",
  597. message: "已取消删除"
  598. });
  599. });
  600. },
  601. approveVideo(id) {
  602. this.$confirm("更改视频状态", "提示", {
  603. confirmButtonText: "确定",
  604. cancelButtonText: "取消",
  605. type: "warning"
  606. })
  607. .then(() => {
  608. let res = this.$post("/api/admin/jishuquan/audit_video", {
  609. id: id
  610. }).then(res => {
  611. if (res.status == 1) {
  612. this.$message({
  613. type: "success",
  614. message: "操作成功!"
  615. });
  616. this.getList();
  617. }
  618. });
  619. })
  620. .catch(() => {
  621. this.$message({
  622. type: "info",
  623. message: "已取消"
  624. });
  625. });
  626. },
  627. deleteVideo(id) {
  628. this.$confirm("此操作将永久删除该视频, 是否继续?", "提示", {
  629. confirmButtonText: "确定",
  630. cancelButtonText: "取消",
  631. type: "warning"
  632. })
  633. .then(() => {
  634. let res = this.$post("/api/admin/jishuquan/delete_video", {
  635. id: id
  636. }).then(res => {
  637. if (res.status == 1) {
  638. this.$message({
  639. type: "success",
  640. message: "删除成功!"
  641. });
  642. this.getList();
  643. }
  644. });
  645. })
  646. .catch(() => {
  647. this.$message({
  648. type: "info",
  649. message: "已取消删除"
  650. });
  651. });
  652. },
  653. showAdEdit(item) {
  654. console.log(item);
  655. if (item != null) {
  656. this.form.id = item.id;
  657. this.form.title = item.title;
  658. this.form.url = item.url;
  659. this.form.type = item.type;
  660. this.form.tags = item.tags;
  661. this.form.status = item.status;
  662. this.form.position = item.position;
  663. this.form.uid = item.uid;
  664. }
  665. this.dialogFormVisible = true;
  666. },
  667. deleteAd(id) {
  668. this.$confirm("此操作将永久删除该活动, 是否继续?", "提示", {
  669. confirmButtonText: "确定",
  670. cancelButtonText: "取消",
  671. type: "warning"
  672. })
  673. .then(() => {
  674. let res = this.$post("/api/admin/jishuquan/delete_ad", {
  675. id: id
  676. }).then(res => {
  677. if (res.status == 1) {
  678. this.$message({
  679. type: "success",
  680. message: "删除成功!"
  681. });
  682. this.getList();
  683. }
  684. });
  685. })
  686. .catch(() => {
  687. this.$message({
  688. type: "info",
  689. message: "已取消删除"
  690. });
  691. });
  692. },
  693. async editAd() {
  694. let form = this.form;
  695. if (form.id) {
  696. let res = await this.$post("/api/admin/jishuquan/update_ad", form);
  697. console.log(res);
  698. if (res.status == 1) {
  699. this.$message({
  700. type: "success",
  701. message: "修改成功"
  702. });
  703. }
  704. } else {
  705. let res = this.$post("/api/admin/jishuquan/create_ad", form);
  706. if (res.status == 1) {
  707. this.$message.success("创建成功");
  708. this.form = {
  709. title: "",
  710. url: "",
  711. type: "1",
  712. tags: "",
  713. status: "1",
  714. position: "1"
  715. };
  716. }
  717. }
  718. this.getList();
  719. this.dialogFormVisible = false;
  720. },
  721. handleCurrentChange(val) {
  722. this.page = val;
  723. this.getList();
  724. },
  725. async getList() {
  726. const page = this.page;
  727. const size = this.size;
  728. const data = {
  729. page,
  730. size
  731. };
  732. let res;
  733. switch (this.tab) {
  734. case "ad":
  735. res = await this.$post("/api/admin/jishuquan/get_ads", data);
  736. this.ads = res.data.ads;
  737. this.total = res.data.total;
  738. break;
  739. case "video":
  740. res = await this.$post("/api/admin/jishuquan/get_videos", data);
  741. this.videos = res.data.videos;
  742. this.total = res.data.total;
  743. break;
  744. case "topic":
  745. if (this.labelTab) data.type = this.labelTab;
  746. res = await this.$post("/api/admin/jishuquan/get_topics", data);
  747. this.topics = res.data.topics;
  748. this.total = res.data.total;
  749. break;
  750. case "kol":
  751. res = await this.$post("/api/admin/author/get_aus", data);
  752. this.kols = res.data.aus;
  753. this.total = res.data.total;
  754. break;
  755. }
  756. },
  757. async contact(id) {
  758. const data = {
  759. id
  760. };
  761. let res = await this.$post("/api/admin/jishuquan/get_ads", data);
  762. this.$message({
  763. message: res.info,
  764. type: "success"
  765. });
  766. },
  767. deleteChannleRow(index) {
  768. this.channelData.splice(index, 1);
  769. },
  770. addChannleRow() {
  771. this.channelData.push({channel_id: '', url: '', code: 'wechat'})
  772. },
  773. onEditAu(id) {
  774. this.isEdit = true;
  775. let res = this.$post("/api/admin/author/get_row", {id: id})
  776. .then(res => {
  777. if (res.status == 1) {
  778. this.kolform = res.data;
  779. this.kolform.is_signing = res.data.is_signing == 1 ? true : false;
  780. this.channelData = res.data.channel.length >= 1 ? res.data.channel : [
  781. {
  782. channel_id: '',
  783. url: '',
  784. code: 'wechat'
  785. }
  786. ];
  787. this.kolFormVisible = true;
  788. }
  789. }).catch((re) => {
  790. this.$message({
  791. type: "error",
  792. message: "网络连接错误"
  793. });
  794. });
  795. },
  796. onAddAu(item) {
  797. this.clearA();
  798. this.kolFormVisible = true;
  799. },
  800. async editAu() {
  801. let form = this.kolform;
  802. form.is_signing = form.is_signing ? 1 : 0;
  803. form.channelData = JSON.stringify(this.channelData);
  804. if (form.id) {
  805. let res = this.$post("/api/admin/author/update_au", form)
  806. .then(res => {
  807. if (res.status == 1) {
  808. this.$message({
  809. type: "success",
  810. message: "修改成功!"
  811. });
  812. this.clearA();
  813. this.kolFormVisible = false;
  814. }
  815. }).catch((re) => {
  816. this.$message({
  817. type: "error",
  818. message: "修改失败"
  819. });
  820. });
  821. } else {
  822. if (this.radio == '1') {
  823. form.uid = '';
  824. }
  825. let res = await this.$post("/api/admin/author/create_au", form)
  826. .then(res => {
  827. if (res.status == 1) {
  828. this.$message({
  829. type: "success",
  830. message: "添加成功!"
  831. });
  832. this.clearA();
  833. this.kolFormVisible = false;
  834. }
  835. }).catch((re) => {
  836. this.$message({
  837. type: "error",
  838. message: "添加失败"
  839. });
  840. });
  841. }
  842. },
  843. clearA() {
  844. this.isEdit = false;
  845. this.kolform = {
  846. portrait: './',
  847. name: "",
  848. introduction: "",
  849. uid: '',
  850. is_signing: true,
  851. };
  852. this.channelData = [{channel_id: '', url: '', code: 'wechat'}];
  853. this.getList();
  854. }
  855. }
  856. };
  857. </script>
  858. <style lang="scss" scoped>
  859. .count-list {
  860. padding-bottom: 10px;
  861. display: flex;
  862. align-items: center;
  863. }
  864. .count-item {
  865. margin-right: 20px;
  866. font-size: 16px;
  867. }
  868. .content {
  869. margin-top: 30px;
  870. white-space: nowrap;
  871. overflow-x: scroll;
  872. height: calc(100vh - 150px);
  873. }
  874. .btn {
  875. width: 80px;
  876. }
  877. .order-footer {
  878. margin-top: 10px;
  879. }
  880. .custom-label {
  881. margin-bottom: 5px;
  882. }
  883. </style>