From 03ac65acaf16c7f2f7677cb6d1066f0bbba8ddf2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=86=8A=E4=B8=BD=E5=90=9B?= <664953382@qq.com>
Date: Fri, 3 Sep 2021 18:50:36 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 2 -
pages.json | 10 +++
pages/index/fillForm.vue | 136 ++++++++++++++++++++++++++++++++++++
pages/index/index.vue | 144 +++++++++++++++++++++++++++++++++++----
4 files changed, 275 insertions(+), 17 deletions(-)
create mode 100644 pages/index/fillForm.vue
diff --git a/App.vue b/App.vue
index 1cb0195..7947eb5 100644
--- a/App.vue
+++ b/App.vue
@@ -15,6 +15,4 @@
diff --git a/pages.json b/pages.json
index 69dc1fa..1ab4ecb 100644
--- a/pages.json
+++ b/pages.json
@@ -12,6 +12,16 @@
"titleNView": false
}
}
+ }, {
+ "path": "pages/index/fillForm",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false,
+ "navigationStyle": "custom",
+ "app-plus": {
+ "titleNView": false
+ }
+ }
}
],
"globalStyle": {
diff --git a/pages/index/fillForm.vue b/pages/index/fillForm.vue
new file mode 100644
index 0000000..90d5cc3
--- /dev/null
+++ b/pages/index/fillForm.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+ 添加收货地址
+
+
+
+
+ {{ codeTips }}
+
+
+
+
+
+ 提交
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/index/index.vue b/pages/index/index.vue
index f3bd94a..73af4a6 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -12,17 +12,27 @@
+
+
+
+ 添加收货地址
+
+
+
+
+ {{ codeTips }}
+
+
+
+
+ 提交
+
+
-
-
-
- 填写收货地址
+
@@ -33,32 +43,106 @@ export default {
return {
info: {},
options: {},
+ form: {
+ name: '',
+ intro: '',
+ phone: '',
+ sex: '',
+ sex3: '',
+ val: '',
+ },
show: false,
- val: '',
- arrCode: []
+ arrCode: [],
+ radio: '',
+ switchVal: false,
+ codeTips: '',
+ rules: {
+ name: [
+ {
+ required: true,
+ message: '请输入姓名',
+ // 可以单个或者同时写两个触发验证方式
+ trigger: ['change', 'blur']
+ }
+ ],
+ intro: [
+ {
+ required: true,
+ min: 5,
+ message: '简介不能少于5个字',
+ trigger: 'blur'
+ }
+ ],
+ sex3: [
+ {
+ required: true,
+ message: '请输入详细地址',
+ trigger: 'blur'
+ }
+ ]
+ }
}
},
onLoad(options) {
- if (!options.id) return uni.$showMsg('请扫描二维码访问')
+ if (!options.id) return this.$u.toast('请扫描二维码访问')
+ // uni.$showMsg('请扫描二维码访问')
this.options = options
getInfo(options).then(({ data }) => {
this.info = data
})
},
methods: {
+ submit() {
+ this.$refs.uForm.validate(valid => {
+ if (valid) {
+ console.log('验证通过')
+ } else {
+ console.log('验证失败')
+ }
+ })
+ },
+ codeChange(text) {
+ this.codeTips = text
+ },
+ // 获取验证码
+ getCode() {
+ if (this.$refs.uCode.canGetCode) {
+ // 模拟向后端请求验证码
+ uni.showLoading({
+ title: '正在获取验证码',
+ mask: true
+ })
+ setTimeout(() => {
+ uni.hideLoading()
+ // 这里此提示会被this.start()方法中的提示覆盖
+ this.$u.toast('验证码已发送')
+ // 通知验证码组件内部开始倒计时
+ this.$refs.uCode.start()
+ }, 2000)
+ } else {
+ this.$u.toast('倒计时结束后再发送')
+ }
+ },
change(e) {
- this.val = e.province.label + e.city.label + e.area.label
+ this.form.val = e.province.label + e.city.label + e.area.label
this.arrCode = [e.province.value, e.city.value, e.area.value]
}
+ },
+ onReady() {
+ this.$refs.uForm.setRules(this.rules)
}
}