admin.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="app-content">
  3. <view>
  4. <form @submit="formSubmit">
  5. <div class="module-com input-line-wrap">
  6. <tui-list-cell class="line-cell" :hover="false">
  7. <div class="tui-title">名称</div>
  8. <input v-model="form.name" type="text" placeholder-class="phcolor" @focus="form.name=''" placeholder-style="color:#CCCCCC" class="tui-input" name="name" placeholder="请填写名称" />
  9. </tui-list-cell>
  10. <tui-list-cell class="line-cell" :hover="false">
  11. <div class="tui-title">微信ID</div>
  12. <input v-model="form.ghsOpenId" type="text" placeholder-class="phcolor" @focus="form.ghsOpenId=''" style="font-size:22upx;"
  13. placeholder-style="color:#CCCCCC" class="tui-input" name="ghsOpenId" placeholder="请填写微信ID" />
  14. </tui-list-cell>
  15. </div>
  16. <div class="confirm-btn">
  17. <button class="admin-button-com big blue" formType="submit">提交</button>
  18. </div>
  19. </form>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import TuiListCell from "@/components/plugin/list-cell";
  25. const form = require("@/utils/formValidation.js");
  26. import { updateAdmin,getInfo } from "@/api/admin";
  27. export default {
  28. name: "admin",
  29. components: {
  30. TuiListCell
  31. },
  32. data() {
  33. return {
  34. form: {
  35. name: "",
  36. ghsOpenId: ""
  37. }
  38. };
  39. },
  40. onLoad() {},
  41. onShow() {
  42. },
  43. methods: {
  44. init() {
  45. getInfo().then(res=>{
  46. if(res.code == 1){
  47. this.form.name = res.data.info.name ? res.data.info.name : ''
  48. this.form.ghsOpenId = res.data.info.ghsOpenId ? res.data.info.ghsOpenId : ''
  49. }
  50. })
  51. },
  52. formSubmit(e) {
  53. let rules = [
  54. { name: "name", rule: ["required"], msg: ["请填写名称"] }
  55. ]
  56. let formData = e.detail.value;
  57. let checkRes = form.validation(formData, rules);
  58. if (!checkRes) {
  59. this.form.id = this.option.id;
  60. updateAdmin(this.form).then(res => {
  61. this.$msg('修改成功');
  62. setTimeout(() => {
  63. uni.navigateBack()
  64. },1000)
  65. })
  66. } else {
  67. this.$msg(checkRes)
  68. }
  69. }
  70. }
  71. };
  72. </script>
  73. <style lang="scss" scoped>
  74. .app-content {
  75. min-height: calc(100vh - 20upx);
  76. padding-top: 20upx;
  77. }
  78. .prompt-text {
  79. color: $fontColor3;
  80. padding-left: 30upx;
  81. margin-bottom: 30upx;
  82. }
  83. .module-com {
  84. margin-bottom: 20upx;
  85. .member-wrap {
  86. .member-det {
  87. font-size: 24upx;
  88. margin-left: 20upx;
  89. }
  90. }
  91. .remark-wrap {
  92. align-items: flex-start;
  93. .remark {
  94. height: 240upx;
  95. }
  96. }
  97. }
  98. .confirm-btn {
  99. width: calc(100% - 60upx);
  100. margin: 60upx 30upx 20upx;
  101. .admin-button-com {
  102. width: 100%;
  103. }
  104. }
  105. </style>