ShopConfigContactUsManage.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <el-table :data="items">
  3. <el-table-column label="KEY" prop="key"></el-table-column>
  4. <el-table-column label="名称" prop="description">
  5. </el-table-column>
  6. <el-table-column label="内容类型" prop="editType" :formatter="formatEditType">
  7. </el-table-column>
  8. <el-table-column label="操作">
  9. <template slot-scope="scope">
  10. <el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
  11. <template v-if="scope.row.editType == 1">
  12. <a :href="serverPath + 'info/preview/' + scope.row.key" target="_blank">
  13. <el-button type="text" size="small">预览</el-button>
  14. </a>
  15. </template>
  16. <el-button type="text" size="small" @click="release(scope.row)">发布</el-button>
  17. </template>
  18. </el-table-column>
  19. </el-table>
  20. </template>
  21. <script>
  22. export default {
  23. data: function() {
  24. return {
  25. items: [{id: 2,key: 'contact_us',editType: 1,description: '联系我们'}],
  26. serverPath: process.env.SERVER_PATH
  27. }
  28. },
  29. methods: {
  30. formatEditType: function(row){
  31. if (row.editType == 1){
  32. return '富文本';
  33. }else if (row.editType == 2){
  34. return "文本";
  35. }
  36. },
  37. goEdit: function(row) {
  38. if (row.editType == 1){
  39. this.$router.push({ path: '/editSysConfig', query: { key: row.key } })
  40. }else if (row.editType == 2){
  41. this.$router.push({ path: '/editShopConfigType2', query: { key: row.key } })
  42. }else{
  43. this.$message({
  44. message: '未知类型',
  45. type: 'warning'
  46. })
  47. }
  48. },
  49. release: function(row) {
  50. this.$confirm('您确定要发布配置信息吗 , 是否继续?', '提示', {
  51. confirmButtonText: '确定',
  52. cancelButtonText: '取消',
  53. type: 'warning'
  54. }).then(() => {
  55. this.$http.releaseSysConfig({ key: row.key }, this).then(res => {
  56. this.$message({
  57. message: '操作成功',
  58. type: 'success'
  59. })
  60. })
  61. })
  62. }
  63. },
  64. mounted: function() {
  65. // this.$http.getAllSysConfig({}, this).then(res => {
  66. // if (res.code === 0) {
  67. // this.items = res.obj
  68. // }
  69. // })
  70. }
  71. }
  72. </script>
  73. <style scoped>
  74. .online {
  75. color: #67c23a;
  76. }
  77. .offline {
  78. color: #f56c6c;
  79. }
  80. </style>