diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 8d287c8..119d47f 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -15,6 +15,7 @@ v-model="opinionModel.userName" class="input-content" placeholder="填写姓名" + clearable /> @@ -22,6 +23,7 @@ v-model="opinionModel.userPhone" class="input-content" placeholder="填写电话" + clearable /> @@ -29,6 +31,7 @@ v-model="opinionModel.unit" class="input-content" placeholder="填写归属单位/部门" + clearable /> @@ -36,18 +39,23 @@ v-model="opinionModel.options" placeholder="请输入内容" class="input-content" - style="min-height: 30vh" + :maxlength="500" count - maxlength="500" - /> + style="max-height: 500px; overflow-y: auto" + height="300px" + clearable + > + - + + + @@ -95,13 +103,24 @@ const opinionModel = ref({ unit: '', options: '', }) + const opinionRules = ref({ - userName: { - type: 'string', - required: true, - message: '请填写姓名', - trigger: ['blur', 'change'], - }, + userName: [ + { + type: 'string', + required: true, + message: '请填写姓名', + trigger: ['blur', 'change'], + }, + { + pattern: /^[\u4e00-\u9fa5]{2,6}$/, + // 正则检验前先将值转为字符串 + transform(value) { + return String(value) + }, + message: '请填写正确的姓名', + }, + ], userPhone: [ { type: 'string', @@ -190,9 +209,11 @@ const onConfirm = () => { flex-direction: column; align-items: center; background-color: #f5f5f5; + overflow-y: auto; } ::v-deep .opinion-form { width: 90%; + height: auto; } .input-content { diff --git a/src/utils/http.js b/src/utils/http.js index f247f2d..060d9c8 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -95,7 +95,7 @@ export const http = (options) => { fail(err) { uni.showToast({ icon: 'none', - title: '请求失败', + title: '网络错误,请更换网络后尝试', }) console.log(err, '请求失败') reject(err)