index.php 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-share-pop');
  4. ?>
  5. <style>
  6. .table-body {
  7. padding: 20px;
  8. background-color: #fff;
  9. }
  10. .input-item {
  11. display: inline-block;
  12. width: 250px;
  13. margin: 0 0 20px;
  14. }
  15. .input-item .el-input__inner {
  16. border-right: 0;
  17. }
  18. .input-item .el-input__inner:hover {
  19. border: 1px solid #dcdfe6;
  20. border-right: 0;
  21. outline: 0;
  22. }
  23. .input-item .el-input__inner:focus {
  24. border: 1px solid #dcdfe6;
  25. border-right: 0;
  26. outline: 0;
  27. }
  28. .input-item .el-input-group__append {
  29. background-color: #fff;
  30. border-left: 0;
  31. width: 10%;
  32. padding: 0;
  33. }
  34. .input-item .el-input-group__append .el-button {
  35. padding: 0;
  36. }
  37. .input-item .el-input-group__append .el-button {
  38. margin: 0;
  39. }
  40. .el-table__body-wrapper .el-button {
  41. padding: 0 !important;
  42. border: 0;
  43. margin: 0 5px;
  44. }
  45. .el-table th > .cell {
  46. color: #333;
  47. font-weight: bold;
  48. font-size: 14px;
  49. }
  50. .el-table__footer-wrapper, .el-table__header-wrapper {
  51. border-bottom: 1.4px solid #D6D6D6;
  52. }
  53. .label {
  54. margin-right: 10px;
  55. }
  56. .default-goods{
  57. max-width: 50px;
  58. max-height: 50px;
  59. }
  60. .flex-x-between {
  61. display: -webkit-box;
  62. display: -webkit-flex;
  63. display: flex;
  64. -webkit-box-pack: space-between;
  65. -webkit-justify-content: space-between;
  66. -ms-flex-pack: space-between;
  67. justify-content: space-between;
  68. }
  69. .cont-title {
  70. font-size: 15px;
  71. padding-top: 20px;
  72. padding-bottom: 10px;
  73. font-weight: 700;
  74. }
  75. .cont-num {
  76. font-size: 14px;
  77. font-weight: 700;
  78. padding-bottom: 10px;
  79. }
  80. .center {
  81. text-align: center;
  82. }
  83. .el-dialog__header .el-dialog__title{
  84. font-size: 18px;
  85. }
  86. .el-dialog__wrapper .el-dialog__body{
  87. padding: 3px 20px;
  88. }
  89. /*头像样式 start*/
  90. .default-avatar{
  91. width: 50px;
  92. height: 50px;
  93. border-radius: 50%;
  94. }
  95. .user_img{
  96. position: relative;
  97. margin-right: 8px;
  98. height: 50px;
  99. width: 50px;
  100. }
  101. .el-table_1_column_2 .cell { /*-2 表示在第二行*/
  102. display: flex;
  103. }
  104. /*头像样式 end*/
  105. .comment-top{
  106. margin-bottom: 15px;
  107. font-size: 13px;
  108. }
  109. .comment-top .notes-img{
  110. width: 100px;
  111. height: 80px;
  112. margin-right: 15px;
  113. background: #F6F6F6;
  114. }
  115. .comment-top-title{
  116. font-size: 16px;
  117. font-weight: 600;
  118. flex: 1;
  119. }
  120. .comment-center-infos{
  121. height: 300px;
  122. overflow-y: auto;
  123. }
  124. .add-comment,.comment-center-info{
  125. margin-bottom: 10px;
  126. }
  127. .comment-center-info{
  128. margin-right: 5px;
  129. }
  130. .a-comment{
  131. margin-bottom: 4px;
  132. }
  133. .comment-user-info{
  134. font-size: 13px;
  135. line-height: 23px;
  136. }
  137. .comment-text{
  138. margin-left: 58px;
  139. margin-top: 6px;
  140. }
  141. .comment-reply{
  142. background: #F2F2F2;
  143. padding: 10px;
  144. }
  145. .reply-list{
  146. margin-left: 50px;
  147. }
  148. .reply-pull{
  149. text-align: center;
  150. }
  151. .reply-pull span:hover{
  152. cursor: pointer;
  153. }
  154. .serach-inpug{
  155. margin-right: 20px
  156. }
  157. </style>
  158. <div id="app" v-cloak>
  159. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  160. <div slot="header">
  161. <div>
  162. <!-- <span>种草管理</span>-->
  163. <!-- <el-select v-model="link_note_type" @change='newNote' class="select" size="small">
  164. <el-option :key="0" label="发布内容" :value="0"></el-option>
  165. <el-option :key="1" label="发布图文" :value="1"></el-option>
  166. <el-option :key="2" label="发布视频" :value="2"></el-option>
  167. <el-option :key="3" label="发布广告" :value="3"></el-option>
  168. </el-select> -->
  169. <!-- split-button type="primary" trigger="click" -->
  170. <el-dropdown size="medium" type="primary" @command="newNote">
  171. <el-button size="medium" type="primary">发布内容<i class="el-icon-arrow-down el-icon--right"></i></el-button>
  172. <!-- <span class="el-dropdown-link">
  173. </span> -->
  174. <el-dropdown-menu slot="dropdown">
  175. <el-dropdown-item command="1">发布图文</el-dropdown-item>
  176. <el-dropdown-item command="2">发布视频</el-dropdown-item>
  177. <el-dropdown-item command="3">发布广告</el-dropdown-item>
  178. </el-dropdown-menu>
  179. </el-dropdown>
  180. </div>
  181. </template>
  182. </div>
  183. <div class="table-body el-input--small">
  184. <el-form size="small" :inline="true" flex="dir:left cross:center" style="margin-bottom: 12px;">
  185. <div class="item-box serach-inpug" flex="dir:left cross:center">
  186. <div class="label">标题名称</div>
  187. <el-input style="width: 150px" v-model="search.title" placeholder="请输入文章标题"></el-input>
  188. </div>
  189. <div class="item-box serach-inpug" flex="dir:left cross:center">
  190. <div class="label">发布类型</div>
  191. <el-select v-model="search.note_type" @change='searchs' class="select" size="small">
  192. <el-option :key="0" label="全部" :value="0"></el-option>
  193. <el-option :key="1" label="图文" :value="1"></el-option>
  194. <el-option :key="2" label="视频" :value="2"></el-option>
  195. <el-option :key="3" label="广告" :value="3"></el-option>
  196. </el-select>
  197. </div>
  198. <div class="item-box serach-inpug" flex="dir:left cross:center">
  199. <div class="label">状态</div>
  200. <el-select v-model="search.is_release" @change='searchs' class="select" size="small">
  201. <el-option :key="-1" label="全部" :value="-1"></el-option>
  202. <el-option :key="1" label="已发布" :value="1"></el-option>
  203. <el-option :key="0" label="未发布" :value="0"></el-option>
  204. </el-select>
  205. </div>
  206. <!-- <div class="item-box serach-inpug" flex="dir:left cross:center">-->
  207. <div class="label">分类</div>
  208. <el-select size="small" v-model="search.cate_id" @change='searchs' class="select">
  209. <el-option key="all" label="全部" value=""></el-option>
  210. <el-option :key="index" :label="item.name" :value="item.id"
  211. v-for="(item, index) in cate_list"></el-option>
  212. </el-select>
  213. <!-- </div>-->
  214. <div class="item-box serach-inpug" flex="dir:left cross:center">
  215. <el-button type="primary" size="small" @click="searchs">搜索</el-button>
  216. </div>
  217. </el-form>
  218. <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
  219. <el-table-column label="标题" min-width="80" align="center">
  220. <template slot-scope="scope">
  221. <p>{{scope.row.title}}</p>
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="发布者" width="180" >
  225. <template slot-scope="scope">
  226. <div class="user_img" v-if="scope.row.user_id>0">
  227. <el-image class="default-avatar" :src="scope.row.user.avatar_url">
  228. <div slot="error" class="image-slot">
  229. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  230. </div>
  231. </el-image>
  232. </div>
  233. <div class="user_img" v-else>
  234. <el-image class="default-avatar" :src="scope.row.user_avatar_url">
  235. <div slot="error" class="image-slot">
  236. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  237. </div>
  238. </el-image>
  239. </div>
  240. <div>
  241. <div style="color:#000;" v-if="scope.row.user_id>0">{{scope.row.user.nickname}}</div>
  242. <div style="color:#000;" v-else>平台</div>
  243. <div style="font-size: 13px;" v-if="scope.row.user_id>0">{{scope.row.user.mobile}}</div>
  244. </div>
  245. </template>
  246. </el-table-column>
  247. <el-table-column label="分类" min-width="80" align="center">
  248. <template slot-scope="scope">
  249. <p>{{scope.row.cate_name}}</p>
  250. </template>
  251. </el-table-column>
  252. <el-table-column label="发布类型" min-width="80" align="center">
  253. <template slot-scope="scope">
  254. <p>{{scope.row.note_type_name}}</p>
  255. </template>
  256. </el-table-column>
  257. <el-table-column prop="scope" width="160" label="创建时间">
  258. <template slot-scope="scope">
  259. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  260. </template>
  261. </el-table-column>
  262. <!-- <el-table-column label="浏览人数/浏览次数" min-width="80" align="center">-->
  263. <el-table-column label="浏览次数" min-width="80" align="center">
  264. <template slot-scope="scope">
  265. <p> {{scope.row.views_num}} </p>
  266. </template>
  267. </el-table-column>
  268. <!-- <el-table-column label="平均浏览时长" min-width="80" align="center">-->
  269. <!-- <template slot-scope="scope">-->
  270. <!-- <p>{{scope.row.average_time}}</p>-->
  271. <!-- </template>-->
  272. <!-- </el-table-column>-->
  273. <el-table-column label="点赞数" min-width="80" align="center">
  274. <template slot-scope="scope">
  275. <p>{{scope.row.likes_num}}</p>
  276. </template>
  277. </el-table-column>
  278. <el-table-column label="状态" min-width="80" align="center">
  279. <template slot-scope="scope">
  280. <div>
  281. <div style="color:#000;" v-if="scope.row.is_release==1">已发布</div>
  282. <div style="color:#000;" v-else>未发布</div>
  283. </div>
  284. </template>
  285. </el-table-column>
  286. <el-table-column
  287. label="操作"
  288. min-width="180"
  289. align="center">
  290. <template slot-scope="scope">
  291. <el-button v-if="scope.row.note_type != 3" circle size="mini" type="text" @click="openCommentPop(scope.$index)">
  292. 评论
  293. </el-button>
  294. <el-button circle size="mini" type="text" @click="detail(scope.row)">
  295. 数据
  296. </el-button>
  297. <el-button circle size="mini" type="text" @click="edit(scope.row)">
  298. 编辑
  299. </el-button>
  300. <!-- <el-button circle size="mini" type="text" @click="openSharePop(scope.row)">
  301. 推广
  302. </el-button> -->
  303. <com-share-pop :url="shareUrl">
  304. <template slot="share-button" slot-scope="data" v-if="scope.row.note_type == 1 || scope.row.note_type == 2">
  305. <el-button circle size="mini" type="text" @click="openSharePop(scope.row,data.show)">
  306. 推广
  307. </el-button>
  308. </template>
  309. </com-share-pop>
  310. <el-button v-if="scope.row.is_top == 0" circle size="mini" type="text" @click="toUpdate(scope.row,1,'top')">
  311. 置顶
  312. </el-button>
  313. <el-button v-if="scope.row.is_top == 1" circle size="mini" type="text" @click="toUpdate(scope.row,0,'top')">
  314. 取消置顶
  315. </el-button>
  316. <el-button v-if="scope.row.is_release == 0" circle size="mini" type="text" @click="toUpdate(scope.row,1,'release')">
  317. 发布
  318. </el-button>
  319. <el-button v-if="scope.row.is_release == 1" circle size="mini" type="text" @click="toUpdate(scope.row,0,'release')">
  320. 取消发布
  321. </el-button>
  322. <el-button circle size="mini" type="text" @click="handle('delete',scope.row)">
  323. 删除
  324. </el-button>
  325. </template>
  326. </el-table-column>
  327. </el-table>
  328. <div style="text-align: right;margin: 20px 0;">
  329. <el-pagination v-if="pagination" :page-size="pagination.pageSize"
  330. style="display: inline-block;float: right;" background @current-change="pageChange"
  331. layout="prev, pager, next" :total="pagination.total_count">
  332. </el-pagination>
  333. </div>
  334. </div>
  335. </el-card>
  336. <!-- “数据”弹窗 -->
  337. <el-dialog title="数据" :visible.sync="dialogFormVisible">
  338. <!-- <el-dialog title="数据详情" :visible.sync="dialogFormVisible" >-->
  339. <div class="flex-x-between">
  340. <div>文章标题:{{data_list.title}}</div>
  341. <div style="color: #999;" v-if="data_list.created_at">
  342. 发布时间:{{data_list.created_at | dateTimeFormat("Y-m-d H:i:s")}}
  343. </div>
  344. </div>
  345. <!-- <div class="dialog-cont">-->
  346. <!-- <div class="cont-title">基本信息</div>-->
  347. <!-- <el-row :gutter="20" style="padding: 0px 10px;">-->
  348. <!-- <dl>正文:<span style="margin-left: 20px;">{{data_list.main_text}}</span></dl>-->
  349. <!-- </el-row>-->
  350. <!-- <el-row :gutter="20" style="padding: 0px 10px;">-->
  351. <!-- <div style="float: left" v-if="data_list && data_list.source.type == 1">图片:</div>-->
  352. <!-- <div style="float: left" v-else>视频:</div>-->
  353. <!-- <div style="float: left;margin-left: 20px;">-->
  354. <!-- <div v-if="data_list && data_list.source.type == 1" class="demo-image__preview">-->
  355. <!-- <el-image v-for="item in data_list.source.source" style="width: 80px; height: 80px;margin-left: 10px;" :src="item" :preview-src-list="data_list.source.source"> </el-image>-->
  356. <!-- </div>-->
  357. <!-- <div v-else>-->
  358. <!-- <video ref="videoPlayer" controls :src="data_list.source.source" :poster="data_list.source.source" controlslist="nodownload" style="width: 50%; height: 50%; object-fit: fill">-->
  359. <!-- </video>-->
  360. <!-- </div>-->
  361. <!-- </div>-->
  362. <!---->
  363. <!-- </el-row>-->
  364. <!-- </div>-->
  365. <div class="dialog-cont" :data="data_list">
  366. <!-- <div class="cont-title">互动数据</div>-->
  367. <el-row :gutter="20" style="padding: 10px 0">
  368. <el-col :span="6">
  369. <div class="cont-num center">{{data_list.views_num}}</div>
  370. <div class="center">浏览次数</div>
  371. </el-col>
  372. <!-- <el-col :span="6">-->
  373. <!-- <div class="cont-num center">{{data_list.views_people_num}}</div>-->
  374. <!-- <div class="center">浏览人数</div>-->
  375. <!-- </el-col>-->
  376. <el-col :span="6">
  377. <div class="cont-num center">{{data_list.share_num}}</div>
  378. <div class="center">分享次数</div>
  379. </el-col>
  380. <!-- <el-col :span="6">-->
  381. <!-- <div class="cont-num center">{{data_list.share_visit_num}}</div>-->
  382. <!-- <div class="center">分享访问次数</div>-->
  383. <!-- </el-col>-->
  384. <el-col :span="6">
  385. <div class="cont-num center">{{data_list.pay_people_num}}</div>
  386. <div class="center">付费观看数</div>
  387. </el-col>
  388. <el-col :span="6">
  389. <div class="cont-num center">{{data_list.pay_amount}}</div>
  390. <div class="center">付费金额总计</div>
  391. </el-col>
  392. <el-col :span="6">
  393. <div class="cont-num center">{{data_list.pay_score_amount}}</div>
  394. <div class="center">付费积分总计</div>
  395. </el-col>
  396. </el-row>
  397. </div>
  398. <div class="dialog-cont">
  399. <div class="cont-title">引导购买商品</div>
  400. <el-table :data = "goods_data" height="250" style="width: 100%" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}">
  401. <el-table-column label="商品" align="center">
  402. <template slot-scope="scope">
  403. <div v-if="scope.row.goods != ''&& scope.row.goods != null">
  404. <div style="float: left; width:60px">
  405. <img width='60px' height='60px'
  406. style="float: left;"
  407. v-if="scope.row.goods.cover_pic"
  408. :src="scope.row.goods.cover_pic"
  409. />
  410. </div>
  411. <div style="float: left; width: 50%;margin-left: 10px; text-align: left;">
  412. <com-ellipsis :line="1" :title="scope.row.goods.goods_name">{{scope.row.goods.goods_name}}</com-ellipsis>
  413. <p style="color: red;">¥{{scope.row.goods.price}}</p>
  414. </div>
  415. </div>
  416. <samp v-else>--</samp>
  417. </template>
  418. </el-table-column>
  419. <el-table-column prop="view_number" label="引导进商详页人数" width="180">
  420. <template slot-scope="scope">
  421. <span :title="scope.row.view_number" class="">{{scope.row.goods_views_count}}</span>
  422. </template>
  423. </el-table-column>
  424. <el-table-column prop="bought_number" label="引导付款人数">
  425. <template slot-scope="scope">
  426. <span :title="scope.row.bought_number" class="">{{scope.row.order_people_num}}</span>
  427. </template>
  428. </el-table-column>
  429. <el-table-column prop="amount" label="引导付款金额">
  430. <template slot-scope="scope">
  431. <span :title="scope.row.amount" class="">{{scope.row.order_amount}}</span>
  432. </template>
  433. </el-table-column>
  434. </el-table>
  435. </div>
  436. </el-dialog>
  437. <el-dialog :visible.sync="commentPop" width="45%">
  438. <div class="comment-top" v-if="selIndex != -1" flex>
  439. <el-image class="notes-img" fit="contain" :src="list[selIndex].cover_img"></el-image>
  440. <div flex="dir:top">
  441. <div class="comment-top-title">
  442. {{list[selIndex].title}}
  443. </div>
  444. <div>
  445. 发布时间:{{list[selIndex].created_at|dateTimeFormat('Y-m-d H:i:s')}}
  446. </div>
  447. </div>
  448. </div>
  449. <div style="margin-bottom: 15px" flex="cross:center">
  450. <div style="flex: 1;">共{{commentCount}}条评论</div>
  451. <div flex style="flex-shrink: 0;">
  452. <el-input v-model="commentSearch" size="medium" placeholder="请输入会员名称/手机号" @change="searchComment" ></el-input>
  453. <el-button style="margin-left: 10px;" size="medium" type="primary" v-loading="dataLoading == 'search'" @click="searchComment">搜索</el-button>
  454. </div>
  455. </div>
  456. <div class="comment-center" v-loading="dataLoading == 'commentList'">
  457. <div class="add-comment" flex>
  458. <el-input v-model="commentContent" :placeholder="replyId?'请输入要回复内容':'请输入评价内容'"></el-input>
  459. <el-button style="margin-left: 10px;" type="primary" v-loading="dataLoading == 'add'" @click="addComment">{{replyId?'回复':'发布'}}</el-button>
  460. </div>
  461. <div class="comment-center-infos">
  462. <div class="comment-center-info" v-for="(item,index) in commentList" :key="index">
  463. <div class="a-comment">
  464. <div class="comment-user-info" flex>
  465. <div class="user_img">
  466. <el-image class="default-avatar" fit="contain" :src="item.user?item.user.avatar_url : item.user">
  467. <div slot="error" class="image-slot">
  468. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  469. </div>
  470. </el-image>
  471. </div>
  472. <div>
  473. <div style="color:#000;">{{item.user?item.user.nickname:'后台'}}</div>
  474. <div>{{item.user?item.user.mobile:''}}</div>
  475. </div>
  476. </div>
  477. <div class="comment-text">
  478. {{item.content}}
  479. </div>
  480. <div flex="cross:center">
  481. <div style="flex: 1;color: #B5B5B5;">
  482. {{item.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  483. </div>
  484. <div>
  485. <el-button type="text" icon="el-icon-chat-line-square" v-loading="dataLoading == 'reply' + item.id" @click="getReply(item.id)">{{item.id == replyId?'取消回复':item.reply?item.reply.count:'回复'}}</el-button>
  486. <el-button type="text" icon="el-icon-upload2" @click="commentTopOrDel(item.id)">{{item.is_top?'取消置顶':'置顶'}}</el-button>
  487. <el-button type="text" icon="el-icon-delete" @click="commentTopOrDel(item.id,0)">删除</el-button>
  488. </div>
  489. </div>
  490. </div>
  491. <div class="comment-reply" v-if="item.replyList && item.replyList.length && replyId == item.id">
  492. <div class="reply-list" v-for="(replyItem,replyIndex) in item.replyList" :key="replyIndex" v-show="replyAllBoo?true:replyIndex == 0">
  493. <div class="comment-user-info" flex>
  494. <div class="user_img">
  495. <el-image class="default-avatar" fit="contain" :src="replyItem.user?replyItem.user.avatar_url:replyItem.user">
  496. <div slot="error" class="image-slot">
  497. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  498. </div>
  499. </el-image>
  500. </div>
  501. <div>
  502. <div style="color:#000;">{{replyItem.user?replyItem.user.nickname:'后台'}}</div>
  503. <div>{{replyItem.user?replyItem.user.mobile:''}}</div>
  504. </div>
  505. </div>
  506. <div class="comment-text">
  507. {{replyItem.content}}
  508. </div>
  509. <div flex="cross:center">
  510. <div style="flex: 1;color: #B5B5B5;">
  511. {{replyItem.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  512. </div>
  513. <div>
  514. <el-button type="text" icon="el-icon-chat-line-square" @click="commentTopOrDel(replyItem.id,0)">删除</el-button>
  515. </div>
  516. </div>
  517. </div>
  518. <div class="reply-pull" v-if="item.replyList.length > 1">
  519. <span v-if="!replyAllBoo" @click="replyAllBoo = true">
  520. 展开全部{{replyCount}}条回复
  521. <i class="el-icon-arrow-down"></i>
  522. </span>
  523. <span v-else @click="replyAllBoo = false">
  524. 收起
  525. <i class="el-icon-arrow-up"></i>
  526. </span>
  527. </div>
  528. </div>
  529. </div>
  530. </div>
  531. </div>
  532. <div slot="footer">
  533. <el-pagination background layout="prev, pager, next" :page-count="dataPageCount" :current-page="dataPage" @current-change="commentPage"></el-pagination>
  534. </div>
  535. </el-dialog>
  536. </div>
  537. <script>
  538. const app = new Vue({
  539. el: '#app',
  540. data() {
  541. return {
  542. link_note_type:0,
  543. listLoading: false,
  544. page: 1,
  545. pageCount: 0,
  546. pageUrl: '',
  547. shareUrl: '',
  548. cate_list:{},
  549. //基础数据
  550. editBasisData: {
  551. materialTypeList: [],
  552. },
  553. //本地存时间,请求时不发送
  554. time: [],
  555. search: {
  556. keyword: '',
  557. user_id: '',
  558. title: '',
  559. user_name: '',
  560. check_status: '1',
  561. date_start: null,
  562. date_end: null,
  563. note_type: 0,
  564. is_release: -1,
  565. cate_id: '',
  566. },
  567. note_type:'',
  568. list: [],
  569. //弹框配置
  570. addForm: {
  571. id: '',
  572. name: '',
  573. },
  574. title: "",
  575. dialogFormVisible: false, //数据弹窗
  576. data_list: {
  577. source:{"type":1,"source": ['1','2']},
  578. },//数据
  579. goods_data:[],//详细数据
  580. dialogAddgsVisible: false,
  581. // 对话框显示与否
  582. dialogVisible: false,
  583. dataloading: false,
  584. pagination:null,
  585. // 评论弹窗
  586. commentPop: false,
  587. commentSearch: '',
  588. commentList: [],
  589. commentCount: 0,
  590. selIndex: -1, //选中的下标
  591. commentContent: '',
  592. replyId: 0,
  593. replyAllBoo: false,
  594. replyCount: 0,
  595. dataLoading: '',
  596. dataPage: 1,
  597. dataPageCount: 1,
  598. testUrl: 'https://shuzixiangdao.oss-cn-guangzhou.aliyuncs.com/images/2022/01/19/image_1642556873_dxm5RnCj.png',
  599. };
  600. },
  601. methods: {
  602. newNote(command){
  603. this.link_note_type = command;
  604. if (this.link_note_type > 0) {
  605. navigateTo({
  606. r: 'operating-note/notes/edit',
  607. link_note_type: this.link_note_type
  608. })
  609. }
  610. console.log()
  611. // if (id) {
  612. // navigateTo({
  613. // r: 'operating-note/notes/edit',
  614. // type:23
  615. // })
  616. // } else {
  617. // navigateTo({
  618. // r: 'material/default/edit',
  619. // });
  620. // }
  621. },
  622. searchs() {
  623. this.page = 1;
  624. this.getList();
  625. },
  626. pageChange(currentPage) {
  627. let self = this;
  628. self.page = currentPage;
  629. self.getList();
  630. },
  631. getList() {
  632. let self = this;
  633. self.listLoading = true;
  634. // 检查是否选择了搜索时间
  635. if (!self.time) {
  636. self.search.date_start = '';
  637. self.search.date_end = '';
  638. } else {
  639. self.search.date_start = self.time[0];
  640. self.search.date_end = self.time[1];
  641. }
  642. request({
  643. method: 'post',
  644. params: {
  645. r: 'operating-note/notes/index',
  646. },
  647. data: {
  648. page: self.page,
  649. // keyword: self.search.keyword,
  650. // user_id: self.search.user_id,
  651. // mobile: self.search.mobile,
  652. // user_name: self.search.user_name,
  653. // check_status: self.search.check_status,
  654. // date_start: self.search.date_start,
  655. // date_end: self.search.date_end,
  656. title: self.search.title,
  657. note_type: self.search.note_type,
  658. is_release: self.search.is_release,
  659. cate_id: self.search.cate_id,
  660. },
  661. }).then(e => {
  662. self.listLoading = false;
  663. e.data.data.list.forEach(v => {
  664. v.cover_img = isJSON(v.cover_img)?JSON.parse(v.cover_img):v.cover_img;
  665. })
  666. self.list = e.data.data.list;
  667. this.pagination = e.data.data.pagination;
  668. this.pagination.pageSize = e.data.data.page_size;
  669. this.cate_list = e.data.data.cate;
  670. this.pagination.total_count = e.data.data.count;
  671. this.pageUrl = e.data.data.domain;
  672. }).catch(e => {
  673. console.log(e);
  674. });
  675. },
  676. detail(data) {
  677. console.log(data);
  678. this.data_list = [];
  679. this.goods_data = [];
  680. this.dialogFormVisible = true;
  681. this.data_list = data;
  682. this.goods_data.push(data);
  683. },
  684. edit(data){
  685. navigateTo({
  686. r: 'operating-note/notes/edit',
  687. link_note_type: data.note_type,
  688. id:data.id
  689. })
  690. console.log(data)
  691. },
  692. toUpdate(data,now_state,type){
  693. if(type == 'top'){
  694. data.is_top = now_state;
  695. }
  696. if(type == 'release'){
  697. data.is_release = now_state;
  698. }
  699. console.log(now_state)
  700. console.log(data);
  701. request({
  702. params: {
  703. r: 'operating-note/notes/edit',
  704. },
  705. method: 'post',
  706. data:data,
  707. }).then(e => {
  708. self.listLoading = false;
  709. if (e.data.code === 0) {
  710. self.$message.success(e.data.msg);
  711. } else {
  712. self.$message.error(e.data.msg);
  713. }
  714. self.getList();
  715. }).catch(e => {
  716. console.log(e);
  717. });
  718. },
  719. handle(type,data = null){
  720. switch (type) {
  721. case 'delete':// 删除
  722. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send({id: data.id,status:-1,type:'1'});})
  723. break;
  724. case 'enable':
  725. var status = 0;
  726. if(data.status=='0') status = 1;
  727. this.send({id: data.id,status: status,type:'1'});
  728. break;
  729. }
  730. },
  731. send(data){
  732. let self = this;
  733. self.listLoading = true;
  734. request({
  735. params: {
  736. r: 'operating-note/notes/edit',
  737. },
  738. method: 'post',
  739. data:data,
  740. }).then(e => {
  741. self.listLoading = false;
  742. if (e.data.code === 0) {
  743. self.$message.success(e.data.msg);
  744. } else {
  745. self.$message.error(e.data.msg);
  746. }
  747. self.getList();
  748. }).catch(e => {
  749. console.log(e);
  750. });
  751. },
  752. /**
  753. *关闭或取消模态框,清空值
  754. * @param
  755. */
  756. closeDialogAddgsVisible() {
  757. this.$refs.addForm.resetFields();//element封装的方法,清空模态框的值
  758. this.title = "" //初始化title的值
  759. this.addForm = {//初始化addForm中的值
  760. title: "",
  761. }
  762. },
  763. // 评论
  764. openCommentPop(index){
  765. this.selIndex = index;
  766. this.commentPop = true;
  767. this.commentSearch = '';
  768. this.commentContent = '';
  769. this.replyId = 0;
  770. this.dataPage = 1;
  771. this.dataPageCount = 1;
  772. this.replyAllBoo = false;
  773. this.getCommentList();
  774. },
  775. getCommentList(){
  776. let that = this;
  777. this.dataLoading = 'commentList'
  778. request({
  779. method: 'post',
  780. params: {
  781. r: 'operating-note/notes/search-comment',
  782. },
  783. data: {
  784. note_content_id: this.list[this.selIndex].id,
  785. keyword: this.commentSearch,
  786. page: this.dataPage,
  787. },
  788. }).then(res => {
  789. if(res.data.code == 0){
  790. let resData = res.data.data;
  791. that.commentCount = resData.count;
  792. that.commentList = resData.list;
  793. that.dataPage = resData.page;
  794. that.dataPageCount = resData.page_count;
  795. }
  796. }).catch(e => {
  797. console.log(e);
  798. }).finally(v => {
  799. this.dataLoading = '';
  800. });
  801. },
  802. addComment(){
  803. if(!this.commentContent.trim().length){
  804. this.$message({
  805. message: this.replyId?'请输入你要回复的内容':'请输入你要评论的内容',
  806. type: 'warning',
  807. });
  808. return
  809. }
  810. this.dataLoading = 'add';
  811. let that = this;
  812. request({
  813. method: 'post',
  814. params: {
  815. r: 'operating-note/notes/admin-reply',
  816. },
  817. data: {
  818. note_content_id: this.list[this.selIndex].id,
  819. content: this.commentContent,
  820. reply_id: this.replyId,
  821. },
  822. }).then(res => {
  823. if(res.data.code == 0){
  824. that.$message({
  825. message: this.replyId?'回复成功':'评论成功',
  826. type: 'success',
  827. });
  828. if(that.replyId){
  829. let index = that.commentList.findIndex(v => v.id == that.replyId);
  830. if(!that.commentList[index].reply){
  831. that.$set(that.commentList[index],'reply',{
  832. count: 1
  833. });
  834. } else {
  835. that.commentList[index].reply.count++;
  836. }
  837. that.getReply(that.replyId,'refresh')
  838. } else {
  839. that.getCommentList();
  840. }
  841. } else {
  842. that.$message({
  843. message: res.data.data.msg,
  844. type: 'warning',
  845. });
  846. }
  847. }).catch(e => {
  848. console.log(e);
  849. }).finally(e => {
  850. that.dataLoading = '';
  851. that.commentContent = '';
  852. })
  853. },
  854. searchComment(){
  855. this.commentDataReset();
  856. this.getCommentList();
  857. },
  858. getReply(id,type){
  859. if(type != 'refresh' && this.replyId == id){
  860. this.replyId = 0;
  861. return;
  862. }
  863. let that = this;
  864. let index = that.commentList.findIndex(v => v.id == id);
  865. this.replyId = id;
  866. if(type != 'refresh'){
  867. this.replyAllBoo = false;
  868. }
  869. if(type != 'refresh' && that.commentList[index].replyList){
  870. return;
  871. }
  872. this.dataLoading = 'reply' + id;
  873. request({
  874. method: 'get',
  875. params: {
  876. r: 'operating-note/notes/get-reply',
  877. note_content_id: this.list[this.selIndex].id,
  878. reply_id: this.replyId,
  879. },
  880. }).then(res => {
  881. let resData = res.data.data;
  882. if(res.data.code == 0){
  883. if(index != -1){
  884. that.commentList[index]
  885. that.$set(that.commentList[index],'replyList',resData.list);
  886. }
  887. this.replyCount = resData.count;
  888. }
  889. }).catch(err => {
  890. console.log(err);
  891. }).finally(e => {
  892. that.dataLoading = '';
  893. })
  894. },
  895. openSharePop(row,fun){
  896. this.shareUrl = row.share_url_base + row.id;
  897. setTimeout(() => {
  898. fun();
  899. },300)
  900. },
  901. commentPage(page){
  902. this.dataPage = page;
  903. this.getCommentList();
  904. },
  905. commentTopOrDel(commentId,type = 1){
  906. let that = this;
  907. request({
  908. method: 'post',
  909. params: {
  910. r: 'operating-note/notes/comment-edit',
  911. },
  912. data: {
  913. note_comment_id: commentId,
  914. type
  915. }
  916. }).then(res => {
  917. if(res.data.code == 0){
  918. let resData = res.data.data;
  919. that.commentDataReset();
  920. that.getCommentList();
  921. that.$message({
  922. message: type == 1?'置顶成功':'删除成功',
  923. type: 'success',
  924. });
  925. } else{
  926. that.$message({
  927. message: res.data.data.msg,
  928. type: 'warning',
  929. });
  930. }
  931. })
  932. },
  933. commentDataReset(){
  934. this.replyId = 0;
  935. this.dataPage = 1;
  936. this.dataPageCount = 1;
  937. this.replyAllBoo = false;
  938. }
  939. },
  940. mounted: function () {
  941. this.getList();
  942. }
  943. });
  944. </script>