update-info.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="container">
  3. <div class="title">
  4. Edit Information
  5. <div></div>
  6. </div>
  7. <n-form ref="formRef" label-placement="left" label-align="left" :model="form" :rules="rules" size="large" require-mark-placement="left">
  8. <n-form-item :label="t('reportPop.phone')+':'" path="contact">
  9. <n-input v-model:value="form.contact" type="number" :placeholder="t('reportPop.phonePlaceholder')" />
  10. </n-form-item>
  11. <n-form-item :label="t('reportPop.companyName')+':'" path="companyName">
  12. <n-input v-model:value="form.companyName" type="text" :placeholder="t('reportPop.companyNamePlaceholder')" />
  13. </n-form-item>
  14. <n-form-item :label="t('reportPop.position')+':'" path="addr">
  15. <n-input v-model:value="form.addr" type="text" :placeholder="t('reportPop.positionPlaceholder')" />
  16. </n-form-item>
  17. <n-form-item :label="t('reportPop.email')+':'" path="email">
  18. <n-input v-model:value="form.email" type="text" :placeholder="t('reportPop.emailPlaceholder')" />
  19. </n-form-item>
  20. </n-form>
  21. <n-button class="login-btn" attr-type="button" type="info" color="#18A058" :disabled="submitLoading" @click="handleSure">
  22. {{ submitLoading ? t('reportPop.submitLoading') : t('reportPop.submit') }}
  23. </n-button>
  24. </div>
  25. </template>
  26. <script lang="ts" setup>
  27. import { useI18n } from "#imports";
  28. import { ref, reactive, onMounted } from "vue";
  29. import {
  30. // NForm,
  31. // NFormItem,
  32. // NInput,
  33. // NButton,
  34. // FormRules,
  35. // FormItemRule,
  36. createDiscreteApi,
  37. } from "naive-ui";
  38. const emit = defineEmits(["closeSginDialog"]);
  39. const props = defineProps({
  40. info: {
  41. type: Object,
  42. default: () => {},
  43. },
  44. });
  45. const { t } = useI18n();
  46. const formRef = ref();
  47. const submitLoading = ref(false);
  48. const form = reactive({
  49. contact: "",
  50. companyName: "",
  51. addr: "",
  52. email: "",
  53. });
  54. const rules: FormRules = {
  55. contact: [
  56. {
  57. required: true,
  58. message: t("reportPop.phoneRequired"),
  59. trigger: ["input", "blur"],
  60. },
  61. ],
  62. };
  63. const handleSure = () => {
  64. formRef.value?.validate(async (errors: any) => {
  65. if (!errors) {
  66. submitLoading.value = true;
  67. try {
  68. const { code } = await updateInfo_Api(form);
  69. if (code === 200) {
  70. message.message.success(t("reportPop.submitSuccess"));
  71. emit("closeSginDialog", "success");
  72. }
  73. } catch (error) {}
  74. submitLoading.value = false;
  75. }
  76. });
  77. };
  78. // onMounted(() => {
  79. for (let key in form) {
  80. form[key] = props.info[key];
  81. }
  82. // });
  83. const message = createDiscreteApi(["message"]);
  84. </script>
  85. <style lang="scss" scoped>
  86. @import "~/assets/css/tool.scss";
  87. .container {
  88. padding: 30px 58px 45px;
  89. background: #ffffff;
  90. border-radius: 20px;
  91. .title {
  92. font-size: 38px;
  93. font-family: Arial, Arial-Bold;
  94. font-weight: 700;
  95. text-align: center;
  96. color: #1a1a1a;
  97. > div {
  98. width: 71px;
  99. height: 6px;
  100. background: linear-gradient(90deg, #719d59 2%, #479f82 98%);
  101. border-radius: 3px;
  102. margin: auto;
  103. }
  104. }
  105. .login-btn {
  106. width: 100%;
  107. height: 58px;
  108. background: linear-gradient(90deg, #60ab91, #84a86c);
  109. border-radius: 8px;
  110. font-size: 18px;
  111. margin-top: 10px;
  112. :deep(.n-button__content) {
  113. display: block;
  114. }
  115. }
  116. .n-form {
  117. margin-top: 30px;
  118. }
  119. :deep(.n-form-item-blank) {
  120. border-bottom: 1px solid #e6e6e6;
  121. }
  122. :deep(.n-form-item-label) {
  123. color: #666666;
  124. font-size: var(--size-14);
  125. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  126. line-height: var(--size-20);
  127. padding: 10px 10px 10px 0;
  128. border-bottom: 1px solid #e6e6e6;
  129. }
  130. :deep(.n-form-item-label__text) {
  131. height: 30px;
  132. }
  133. :deep(.n-input-wrapper) {
  134. font-size: var(--size-14);
  135. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  136. line-height: var(--size-20);
  137. padding: 0px 0 10px;
  138. }
  139. :deep(.n-form-item-blank--error .n-input) {
  140. --n-border-error: var(--size-1) solid transparent !important;
  141. --n-border-focus-error: var(--size-1) solid transparent !important;
  142. --n-border-hover-error: var(--size-1) solid transparent !important;
  143. --n-box-shadow-focus-error: var(--size-1) solid transparent !important;
  144. }
  145. :deep(input::-ms-reveal) {
  146. display: none;
  147. }
  148. }
  149. </style>