index.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <style>
  2. .table-body {
  3. padding: 20px;
  4. background-color: #fff;
  5. }
  6. .input-item {
  7. display: inline-block;
  8. width: 250px;
  9. margin: 0 0 20px;
  10. }
  11. .input-item .el-input__inner {
  12. border-right: 0;
  13. }
  14. .input-item .el-input__inner:hover {
  15. border: 1px solid #dcdfe6;
  16. border-right: 0;
  17. outline: 0;
  18. }
  19. .input-item .el-input__inner:focus {
  20. border: 1px solid #dcdfe6;
  21. border-right: 0;
  22. outline: 0;
  23. }
  24. .input-item .el-input-group__append {
  25. background-color: #fff;
  26. border-left: 0;
  27. width: 10%;
  28. padding: 0;
  29. }
  30. .input-item .el-input-group__append .el-button {
  31. padding: 0;
  32. }
  33. .input-item .el-input-group__append .el-button {
  34. margin: 0;
  35. }
  36. .table-body .el-button {
  37. padding: 0 !important;
  38. border: 0;
  39. margin: 0 5px;
  40. }
  41. .form-body {
  42. background-color: #fff;
  43. margin-bottom: 20px;
  44. }
  45. .el-tabs__header{
  46. background-color: #fff;
  47. }
  48. .el-tabs__item{
  49. width: 100px;
  50. text-align: center;
  51. }
  52. .el-table th>.cell{
  53. color: #333;
  54. font-weight: bold;
  55. font-size: 14px;
  56. }
  57. .el-table__footer-wrapper, .el-table__header-wrapper{
  58. border-bottom: 1.4px solid #D6D6D6;
  59. }
  60. .user_img{
  61. position: relative;
  62. margin-right: 8px;
  63. /* height: 50px;
  64. width: 50px; */
  65. }
  66. .default-avatar{
  67. width: 50px;
  68. height: 50px;
  69. border-radius: 50%;
  70. margin-right: 8px;
  71. }
  72. .uer-nickname {
  73. flex: 1;
  74. }
  75. </style>
  76. <div id="app" v-cloak>
  77. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  78. <div slot="header">
  79. <div>
  80. <span>评论管理</span>
  81. <div style="float: right">
  82. <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="add">添加评论
  83. </el-button>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="table-body">
  88. <!-- <div class="input-item">
  89. <el-input @keyup.enter.native="search" size="small"
  90. placeholder="请输入课程名称"
  91. v-model="keyword"
  92. clearable
  93. @clear="search">
  94. <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
  95. </el-input>
  96. </div> -->
  97. <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
  98. <el-table-column label="会员ID" prop="user_id" min-width="80" align="center">
  99. <template slot-scope="scope">
  100. <div size="small" v-if="scope.row.uid != 0">{{scope.row.uid}}</div>
  101. <div size="small"v-if="scope.row.uid == 0">--</div>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="会员信息" >
  105. <template slot-scope="scope">
  106. <div class="user_img" flex="cross:center">
  107. <el-image class="default-avatar" :src="scope.row.avatar_url">
  108. <div slot="error" class="image-slot">
  109. <com-image src="resources/img/mall/default_avatar_url.png"></com-image>
  110. </div>
  111. </el-image>
  112. <div class="uer-nickname over1" v-if="scope.row.uid">{{scope.row.nickname}}</div>
  113. <div class="uer-nickname over1" v-else >系统管理员</div>
  114. </div>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="手机号" prop="mobile" min-width="80" align="center">
  118. <template slot-scope="scope">
  119. <div size="small" v-if="scope.row.mobile">{{scope.row.mobile}}</div>
  120. <div size="small" v-else>--</div>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="评论课程" prop="course_name" min-width="80" align="center">
  124. <template slot-scope="scope">
  125. <div size="small">{{scope.row.course_name}}</div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="评分" prop="score" min-width="100" align="center">
  129. <template slot-scope="scope">
  130. <div size="small">{{scope.row.score}} 星</div>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="评论内容" prop="content" min-width="100" align="center">
  134. <template slot-scope="scope">
  135. <div size="small">{{scope.row.content}}</div>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="是否屏蔽" prop="content" min-width="100" align="center">
  139. <template slot-scope="scope">
  140. <el-switch v-model="scope.row.is_shield" :active-value="1" :inactive-value="0" active-text="屏蔽" inactive-text="不屏蔽" @change="shield($event, scope.row.id)"> </el-switch>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="操作" min-width="100" align="center">
  144. <template slot-scope="scope" >
  145. <el-button type="text" size="mini" @click="edit(scope.row.id)" style="width:56px;height: 24px;">
  146. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  147. <img src="resources/img/mall/edit.png" alt="">
  148. </el-tooltip>
  149. </el-button>
  150. <el-button circle type="text" size="mini" @click="discussDelete(scope.row.id, scope.$index)">
  151. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  152. <img src="resources/img/mall/del.png" alt="">
  153. </el-tooltip>
  154. </el-button>
  155. </template>
  156. </el-table-column>
  157. </el-table>
  158. <div style="text-align: right;margin: 20px 0;">
  159. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  160. </div>
  161. </div>
  162. </el-card>
  163. </div>
  164. <script>
  165. const app = new Vue({
  166. el: '#app',
  167. data() {
  168. return {
  169. status:0,
  170. list: [],
  171. keyword: '',
  172. listLoading: false,
  173. page: 1,
  174. pageCount: 0,
  175. // dialogFormVisible : false, //充值弹窗
  176. lableLoading : false,
  177. btnLoading : false,
  178. addStatus : 1, //默认是增加
  179. // selectIndex : 0, //充值item的索引
  180. selectRow : {},
  181. form:{
  182. user_id : null,
  183. username : '',
  184. mobile : '',
  185. co_name: '',
  186. score: 0,
  187. content: ''
  188. },
  189. rules: {
  190. add_money: [
  191. {required: true, message: '请输入金额', trigger: 'change'},
  192. ],
  193. },
  194. };
  195. },
  196. methods: {
  197. search() {
  198. this.page = 1;
  199. this.getList();
  200. },
  201. pagination(currentPage) {
  202. let self = this;
  203. self.page = currentPage;
  204. self.getList();
  205. },
  206. // 0.1 获取卡券列表
  207. getList() {
  208. let self = this;
  209. self.listLoading = true;
  210. request({
  211. params: {
  212. r: 'course/discuss/index',
  213. page: self.page,
  214. keyword: this.keyword
  215. },
  216. method: 'get',
  217. }).then(e => {
  218. self.listLoading = false;
  219. self.list = e.data.data.list;
  220. self.pageCount = e.data.data.page_count;
  221. }).catch(e => {
  222. console.log(e);
  223. });
  224. },
  225. // 新建
  226. add() {
  227. navigateTo({
  228. r: 'course/discuss/edit',
  229. });
  230. },
  231. // 编辑
  232. edit(id) {
  233. navigateTo({
  234. r: 'course/discuss/edit',
  235. id: id,
  236. });
  237. },
  238. discussDelete(id, index) {
  239. let self = this;
  240. self.$confirm('是否删除评论?', '提示', {
  241. confirmButtonText: '确定',
  242. cancelButtonText: '取消',
  243. type: 'warning'
  244. }).then(() => {
  245. self.listLoading = true;
  246. // console.log(id,'1111')
  247. request({
  248. params: {
  249. r: 'course/discuss/delete',
  250. },
  251. method: 'post',
  252. data: {
  253. id: id,
  254. }
  255. }).then(e => {
  256. self.listLoading = false;
  257. if (e.data.code === 0) {
  258. self.$message.success(e.data.msg);
  259. self.list.splice(index, 1);
  260. } else {
  261. self.$message.error(e.data.msg);
  262. }
  263. }).catch(e => {
  264. console.log(e);
  265. });
  266. }).catch(() => {
  267. self.$message.info('已取消删除')
  268. });
  269. },
  270. // 屏蔽状态切换
  271. shield($event, id) {
  272. let self = this;
  273. self.listLoading = true;
  274. request({
  275. params: {
  276. r: 'course/discuss/switch-shield'
  277. },
  278. method: 'post',
  279. data: {id: id, val: $event}
  280. }).then(e => {
  281. self.listLoading = false;
  282. if (e.data.code === 0) {
  283. self.$message.success(e.data.msg);
  284. } else {
  285. self.$message.error(e.data.msg);
  286. }
  287. }).catch(e => {
  288. console.log(e);
  289. });
  290. }
  291. },
  292. mounted: function () {
  293. this.getList();
  294. }
  295. });
  296. </script>