表单
This commit is contained in:
		| @@ -13,15 +13,16 @@ | ||||
|       </div> | ||||
|     </div> | ||||
|     <div class="microphone-info"> | ||||
|       <p class="loading" v-if="isStart">语音录制中...</p> | ||||
|       <div class="microphone-img" @touchstart="start" @touchend="end"> | ||||
|         <!-- <img src="./img/microphone.png" alt="" @longpress="">  --> | ||||
|         <u-icon name="mic" color="#fff" size="140" style="margin-top:20px;"></u-icon> | ||||
|       </div> | ||||
|       <p class="text">{{isStart ? '松开结束说话' : '按住说话'}}</p> | ||||
|       <div class="btn"> | ||||
|       <!-- <div class="btn"> | ||||
|         <p class="cancel" @click="cancel">取消</p> | ||||
|         <!-- <p class="confirm" @click="confirm" v-if="text">确定</p> --> | ||||
|       </div> | ||||
|         <p class="confirm" @click="confirm" v-if="text">确定</p> | ||||
|       </div> --> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
| @@ -41,6 +42,7 @@ export default { | ||||
|     ...mapState(['user']), | ||||
|   }, | ||||
|   onLoad() { | ||||
|     this.text = '' | ||||
|     this.injectJWeixin(['startRecord','stopRecord', 'translateVoice']) | ||||
|   }, | ||||
|   onShow() { | ||||
| @@ -159,6 +161,13 @@ uni-page-body { | ||||
|       color: #222; | ||||
|       margin-bottom: 64px; | ||||
|     } | ||||
|     .loading { | ||||
|       font-family: PingFangSC-Regular; | ||||
|       font-size: 28px; | ||||
|       color: #666; | ||||
|       margin-bottom: 32px; | ||||
|       text-align: center; | ||||
|     } | ||||
|     .btn { | ||||
|       text-align: center; | ||||
|       font-family: PingFangSC-Regular; | ||||
|   | ||||
| @@ -60,9 +60,9 @@ | ||||
|       </div> | ||||
|     </div> | ||||
|     <div class="bottom-btn"> | ||||
|       <div class="confirm" @click="confirm('保存成功')">保存内容</div> | ||||
|       <!-- <div class="confirm" @click="confirm('保存成功')">保存内容</div> --> | ||||
|       <div class="confirm" @click="confirm('提交成功')">提交</div> | ||||
|       <div class="cancel">取消</div> | ||||
|       <div class="cancel" @click="back">返回录制</div> | ||||
|     </div> | ||||
|     <u-picker mode="time" v-model="showDate" :params="deteParams" start-year="1930" @confirm="dateConfirm">请选择</u-picker> | ||||
|     <u-select v-model="showSex" :list="$dict.getDict('sex')" label-name="dictName" value-name="dictValue" @confirm="confirmSex"/> | ||||
| @@ -89,9 +89,9 @@ export default { | ||||
|     ...mapState(['user']), | ||||
|   }, | ||||
|   onLoad(option) { | ||||
|     this.word = option.word | ||||
|     this.info = JSON.parse(option.info) | ||||
|     this.$dict.load('sex', 'nation').then(() => { | ||||
|       this.getInfo() | ||||
|       // this.getInfo() | ||||
|     }) | ||||
|   }, | ||||
|   onShow() { | ||||
| @@ -99,7 +99,7 @@ export default { | ||||
|   }, | ||||
|   methods: { | ||||
|     getInfo() { | ||||
|       uni.showLoading({title: '加载中'}) | ||||
|       uni.showLoading({title: '读取中'}) | ||||
|       this.$http.post(`/app/appbaiduai/queryByInfo?word=${this.word}`).then((res) => { | ||||
|         if (res.code === 0) { | ||||
|           this.info = {...res.data} | ||||
| @@ -120,25 +120,28 @@ export default { | ||||
|       this.info.birthday = `${e.year}-${e.month}-${e.day}` | ||||
|     }, | ||||
|     confirm(successText) { | ||||
|       if(this.info.name == null || !this.info.name) { | ||||
|         return this.$u.toast('请输入户主姓名') | ||||
|       } | ||||
|       if(this.info.sex == null) { | ||||
|         return this.$u.toast('请选择性别') | ||||
|       } | ||||
|       if(this.info.phone == null || !this.info.phone) { | ||||
|         return this.$u.toast('请输入联系电话') | ||||
|       } | ||||
|       if(this.info.birthday == null) { | ||||
|         return this.$u.toast('请选择出生日期') | ||||
|       } | ||||
|       if(this.info.nation == null) { | ||||
|         return this.$u.toast('请选择民族') | ||||
|       } | ||||
|       if(this.info.householdNumber == null || !this.info.householdNumber) { | ||||
|         return this.$u.toast('请输入家庭人口数') | ||||
|       } | ||||
|       // if(this.info.name == null || !this.info.name) { | ||||
|       //   return this.$u.toast('请输入户主姓名') | ||||
|       // } | ||||
|       // if(this.info.sex == null) { | ||||
|       //   return this.$u.toast('请选择性别') | ||||
|       // } | ||||
|       // if(this.info.phone == null || !this.info.phone) { | ||||
|       //   return this.$u.toast('请输入联系电话') | ||||
|       // } | ||||
|       // if(this.info.birthday == null) { | ||||
|       //   return this.$u.toast('请选择出生日期') | ||||
|       // } | ||||
|       // if(this.info.nation == null) { | ||||
|       //   return this.$u.toast('请选择民族') | ||||
|       // } | ||||
|       // if(this.info.householdNumber == null || !this.info.householdNumber) { | ||||
|       //   return this.$u.toast('请输入家庭人口数') | ||||
|       // } | ||||
|       this.$u.toast(successText) | ||||
|     }, | ||||
|     back() { | ||||
|       uni.navigateBack({delta: 2}) | ||||
|     } | ||||
|   }, | ||||
| } | ||||
| @@ -227,5 +230,8 @@ uni-page-body { | ||||
|       border: 1px solid #CCC; | ||||
|     } | ||||
|   } | ||||
|   ::v-deep .u-input__right-icon { | ||||
|     display: none; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|   | ||||
| @@ -116,7 +116,7 @@ export default { | ||||
|   }, | ||||
|   methods: { | ||||
|     getInfo() { | ||||
|       uni.showLoading({title: '加载中'}) | ||||
|       uni.showLoading({title: '读取中'}) | ||||
|       this.$http.post(`/app/appbaiduai/queryByInfo?word=${this.word}`).then((res) => { | ||||
|         if (res.code === 0) { | ||||
|           this.info = {...res.data} | ||||
| @@ -137,25 +137,26 @@ export default { | ||||
|       this.info.birthday = `${e.year}-${e.month}-${e.day}` | ||||
|     }, | ||||
|     toConfirm() { | ||||
|       if(this.info.name == null || !this.info.name) { | ||||
|         return this.$u.toast('请输入户主姓名') | ||||
|       } | ||||
|       if(this.info.sex == null) { | ||||
|         return this.$u.toast('请选择性别') | ||||
|       } | ||||
|       if(this.info.phone == null || !this.info.phone) { | ||||
|         return this.$u.toast('请输入联系电话') | ||||
|       } | ||||
|       if(this.info.birthday == null) { | ||||
|         return this.$u.toast('请选择出生日期') | ||||
|       } | ||||
|       if(this.info.nation == null) { | ||||
|         return this.$u.toast('请选择民族') | ||||
|       } | ||||
|       if(this.info.householdNumber == null || !this.info.householdNumber) { | ||||
|         return this.$u.toast('请输入家庭人口数') | ||||
|       } | ||||
|       uni.navigateTo({url: `./formConfirm?word=${this.word}`}) | ||||
|       // if(this.info.name == null || !this.info.name) { | ||||
|       //   return this.$u.toast('请输入户主姓名') | ||||
|       // } | ||||
|       // if(this.info.sex == null) { | ||||
|       //   return this.$u.toast('请选择性别') | ||||
|       // } | ||||
|       // if(this.info.phone == null || !this.info.phone) { | ||||
|       //   return this.$u.toast('请输入联系电话') | ||||
|       // } | ||||
|       // if(this.info.birthday == null) { | ||||
|       //   return this.$u.toast('请选择出生日期') | ||||
|       // } | ||||
|       // if(this.info.nation == null) { | ||||
|       //   return this.$u.toast('请选择民族') | ||||
|       // } | ||||
|       // if(this.info.householdNumber == null || !this.info.householdNumber) { | ||||
|       //   return this.$u.toast('请输入家庭人口数') | ||||
|       // } | ||||
|       var info = JSON.stringify(this.info) | ||||
|       uni.navigateTo({url: `./formConfirm?info=${info}`}) | ||||
|     }, | ||||
|     back() { | ||||
|       uni.navigateBack() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user