| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <view class="app-content">
- <view>
- <form @submit="formSubmit">
- <div class="module-com input-line-wrap">
- <tui-list-cell class="line-cell" :hover="false">
- <div class="tui-title">名称</div>
- <input v-model="form.name" type="text" placeholder-class="phcolor" @focus="form.name=''" placeholder-style="color:#CCCCCC" class="tui-input" name="name" placeholder="请填写名称" />
- </tui-list-cell>
- <tui-list-cell class="line-cell" :hover="false">
- <div class="tui-title">微信ID</div>
- <input v-model="form.ghsOpenId" type="text" placeholder-class="phcolor" @focus="form.ghsOpenId=''" style="font-size:22upx;"
- placeholder-style="color:#CCCCCC" class="tui-input" name="ghsOpenId" placeholder="请填写微信ID" />
- </tui-list-cell>
- </div>
- <div class="confirm-btn">
- <button class="admin-button-com big blue" formType="submit">提交</button>
- </div>
- </form>
- </view>
- </view>
- </template>
- <script>
- import TuiListCell from "@/components/plugin/list-cell";
- const form = require("@/utils/formValidation.js");
- import { updateAdmin,getInfo } from "@/api/admin";
- export default {
- name: "admin",
- components: {
- TuiListCell
- },
- data() {
- return {
- form: {
- name: "",
- ghsOpenId: ""
- }
- };
- },
- onLoad() {},
- onShow() {
- },
- methods: {
- init() {
- getInfo().then(res=>{
- if(res.code == 1){
- this.form.name = res.data.info.name ? res.data.info.name : ''
- this.form.ghsOpenId = res.data.info.ghsOpenId ? res.data.info.ghsOpenId : ''
- }
- })
- },
- formSubmit(e) {
- let rules = [
- { name: "name", rule: ["required"], msg: ["请填写名称"] }
- ]
- let formData = e.detail.value;
- let checkRes = form.validation(formData, rules);
- if (!checkRes) {
- this.form.id = this.option.id;
- updateAdmin(this.form).then(res => {
- this.$msg('修改成功');
- setTimeout(() => {
- uni.navigateBack()
- },1000)
- })
- } else {
- this.$msg(checkRes)
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .app-content {
- min-height: calc(100vh - 20upx);
- padding-top: 20upx;
- }
- .prompt-text {
- color: $fontColor3;
- padding-left: 30upx;
- margin-bottom: 30upx;
- }
- .module-com {
- margin-bottom: 20upx;
- .member-wrap {
- .member-det {
- font-size: 24upx;
- margin-left: 20upx;
- }
- }
- .remark-wrap {
- align-items: flex-start;
- .remark {
- height: 240upx;
- }
- }
- }
- .confirm-btn {
- width: calc(100% - 60upx);
- margin: 60upx 30upx 20upx;
- .admin-button-com {
- width: 100%;
- }
- }
- </style>
|