Uniapp提交表单
<form> <uni-view data-v-13695da5="" data-v-96bbcaca="" class="forecastContainer"> <uni-scroll-view data-v-13695da5="" class="scroll-view" style="margin-bottom: 10px; height: 272px;"> <div class="uni-scroll-view"> <div class="uni-scroll-view" style="overflow: hidden auto;"> <div class="uni-scroll-view-content"> <!----> <uni-view data-v-13695da5="" class="jjj"> 赠送好友 </uni-view> <uni-view data-v-13695da5="" class="jjj"> 好友id <uni-text data-v-13695da5=""> <input v-model="addressData.haoyouid" placeholder="请输入好友id" maxlength="140" step="" enterkeyhint="done" autocomplete="off" type="" class="uni-input-input" > </uni-text> </uni-view> <uni-view data-v-13695da5="" class="jjj"> 赠送金额 <uni-text data-v-13695da5=""> <input v-model="addressData.mobile" placeholder="请输入赠送金额" maxlength="140" step="" enterkeyhint="done" autocomplete="off" type="" class="uni-input-input" > </uni-text> </uni-view> <uni-view data-v-13695da5="" class="jjj"> 手续费 <uni-text data-v-13695da5=""> <checkbox :checked="isChecked" @click="cd1()" />扣自己 <checkbox :checked="!isChecked" @click="cd2()" />扣对方 </uni-text> <!-- <view> <checkbox-group> <label > <checkbox v-model="addressData.rank1" value="ziji" :checked="isChecked" @click="isChecked=!isChecked" />选中 </label> <label > <checkbox v-model="addressData.rank2" value="duifang" :checked="!isChecked" @click="isChecked=!isChecked" />未选中 </label> </checkbox-group> </view> --> </uni-view> </div> </div> </div> </uni-scroll-view> <uni-view data-v-13695da5="" class="fotter"> <uni-view data-v-13695da5="" class="fotter_money"> <uni-text data-v-13695da5=""> <!-- <span>0</span> --> </uni-text> </uni-view> <uni-view data-v-13695da5="" class="fotter_text" > <uni-view data-v-13695da5="" class="affirmContent"> <uni-button data-v-13695da5="" class="gui-button affirm" type="default" @click="confirm()"> <uni-text data-v-13695da5="" style="font-size: 11px;"> <button type="submit"> 确认 </button> </uni-text> </uni-button> </uni-view> </uni-view> </uni-view> </uni-view> </form>
参数
data() { return { textvalue:'0', type: 'top', isChecked:false, addressData: { haoyouid: '', mobile: '', rank: 2, } } },
方法:
confirm() { let userid = uni.getStorageSync('userInfo').uid; let data = this.addressData; uni.request({ method: 'POST', url: "/api/study/zhuanzhang", data: { userid:userid, haoyouid: data.haoyouid,//that.userInfo.uid, jine: data.mobile, rank:data.rank,//2 扣对方 1扣自己 }, header: { 'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息 }, success(res) { if (res.data.code === "1") { uni.showModal({ title: '提示', content: res.data.message, success: function (res) { if (res.confirm) { // console.log('用户点击确定'); } else if (res.cancel) { // console.log('用户点击取消'); } } }); } else { uni.showModal({ title: '提示', content: res.data.message, success: function (res) { if (res.confirm) { // console.log('用户点击确定'); } else if (res.cancel) { // console.log('用户点击取消'); } } }); } } }) },
标签:Uniapp,console,log,res,userid,表单,提交,uni,data From: https://www.cnblogs.com/79524795-Tian/p/17060939.html