setting.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ?>
  4. <div id="app" v-cloak>
  5. <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1500px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  6. <div slot="header">
  7. <div>
  8. <span>基础设置</span>
  9. </div>
  10. </div>
  11. <div class="form_box">
  12. <el-form :model="ruleForm" size="small" ref="ruleForm" label-width="150px">
  13. <el-card shadow="never">
  14. <div>
  15. <el-row>
  16. <el-col :span="16">
  17. <el-form-item prop="template_no" label="模板编号">
  18. <el-col :span="8" style="width: 100%">
  19. <el-input v-model="ruleForm.template_no" >
  20. </el-input>
  21. </el-col>
  22. <div class="tips-text" style="line-height: 24px;">
  23. </div>
  24. </el-form-item>
  25. <el-form-item prop="template_id" label="模板ID">
  26. <el-col :span="8" style="width: 100%">
  27. <el-input v-model="ruleForm.template_id">
  28. </el-input>
  29. </el-col>
  30. <div class="tips-text" style="line-height: 24px;">
  31. </div>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. </div>
  36. </el-card>
  37. </el-form>
  38. <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 24px;"
  39. @click="store('ruleForm')" size="small">保存
  40. </el-button>
  41. </div>
  42. </el-card>
  43. </div>
  44. <script>
  45. const app = new Vue({
  46. el: '#app',
  47. data() {
  48. return {
  49. loading: false,
  50. btnLoading: false,
  51. ruleForm: {
  52. template_no: '',
  53. template_id: '',
  54. },
  55. }
  56. },
  57. mounted: function () {
  58. this.loadData();
  59. },
  60. methods: {
  61. loadData() {
  62. this.loading = true;
  63. request({
  64. params: {
  65. r: 'course/course-promoter/setting',
  66. },
  67. method: 'get'
  68. }).then(e => {
  69. this.loading = false;
  70. if (e.data.code == 0) {
  71. this.ruleForm = Object.assign(this.ruleForm, e.data.data.list);
  72. }
  73. }).catch(e => {
  74. this.loading = false;
  75. })
  76. },
  77. store(formName) {
  78. this.$refs[formName].validate((valid) => {
  79. if (valid) {
  80. this.btnLoading = true;
  81. request({
  82. params: {
  83. r: 'course/course-promoter/setting',
  84. },
  85. method: 'post',
  86. data: this.ruleForm
  87. }).then(e => {
  88. this.btnLoading = false;
  89. if (e.data.code == 0) {
  90. this.$message.success(e.data.msg);
  91. } else {
  92. this.$message.error(e.data.msg);
  93. }
  94. }).catch(e => {
  95. this.$message.error(e);
  96. this.btnLoading = false;
  97. })
  98. } else {
  99. this.btnLoading = false;
  100. console.log('error submit!!');
  101. return false;
  102. }
  103. });
  104. },
  105. }
  106. });
  107. </script>
  108. <style>
  109. .form_box {
  110. background-color: #f3f3f3;
  111. padding: 0 0 20px;
  112. }
  113. .button-item {
  114. margin-top: 12px;
  115. padding: 9px 25px;
  116. }
  117. .el-input-group__append {
  118. background-color: #fff;
  119. color: #353535;
  120. }
  121. </style>