日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

微信小程序-001-抽签功能-002-新建抽签

發(fā)布時(shí)間:2023/12/20 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 微信小程序-001-抽签功能-002-新建抽签 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

微信小程序-001-抽簽功能-002-新建抽簽

目錄

  • 一、wxml
  • 二、js

pages.chouqian.newqian.newqian

一、wxml

<view class="center">活動(dòng)名稱:</view> <view class="center"><input maxlength="10" placeholder=" 不能為空" bindinput="checkQuestion" placeholder-style="color:#4169E1" placeholder-class="placeholderStyle" style='box-shadow: 0 0 2rpx #272727' /> </view> <text>\n</text> <view class="center">活動(dòng)選項(xiàng):</view><block wx:for="{{lists}}" wx:key="index"><view class="center"><input data-index="{{index}}" placeholder="選項(xiàng)" bindinput='bindKeyInput' placeholder-style="color:#4169E1" placeholder-class="placeholderStyle" style='box-shadow: 0 0 2rpx #272727'></input></view><text>\n</text> </block> <view class=" between"><button class='add-li' bindtap='addList' size="mini">添加選項(xiàng)</button><button class='add-li' bindtap='delList' size="mini">刪除選項(xiàng)</button> </view> <text>\n</text><button bindtap="ochou">抽簽</button>

二、js

Page({/*** 頁(yè)面的初始數(shù)據(jù)*/data: {lists: [{}, {}],qname: '',rid: '',},/*** 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面加載*/onLoad: function (options) {},addList: function () {var lists = this.data.lists;var newData = {};lists.push(newData);//實(shí)質(zhì)是添加lists數(shù)組內(nèi)容,使for循環(huán)多一次this.setData({lists: lists,})},delList: function () {var lists = this.data.lists;lists.pop(); //實(shí)質(zhì)是刪除lists數(shù)組內(nèi)容,使for循環(huán)少一次this.setData({lists: lists,})},//小決定的名稱checkQuestion(e) {var that = this,val = e.detail.valueconsole.log(val)that.setData({qname: val,})},bindKeyInput(e) {var that = this,val = e.detail.value,index = e.currentTarget.dataset.index,lists = that.data.listsfor (let i in lists) {if (index == i) {lists[i].name = val}}that.setData({lists: lists,})console.log(lists)},ochou: function (e) {var that = this,lists = that.data.listsvar that = this,qname = that.data.qnamevar wid = wx.getStorageSync('wid')console.log('名稱' + qname)console.log(lists)console.log(wid)var value = wx.getStorageSync('wid')if (!value) {var that = thiswx.showModal({title: '提示',content: '你的登錄信息過(guò)期了,請(qǐng)重新登錄',})//調(diào)用登錄接口} else {if (qname.length > 0 && lists.length > 0 ) {if( lists.length >1){wx.request({url: 'https://ancientcloud.club/wx/newqian',method: 'GET',data: {lists: lists,qname: qname,wid: wx.getStorageSync('wid'),},header: {'Content-Type': 'application/x-www-form-urlencoded'},success: function (res) {//wx.setStorageSync('rid', rid);that.setData({rid: res.data,}) //var rid = wx.getStorageSync('rid'); wx.navigateTo({url: '/pages/chouqian/zroom/zroom?rid=' + res.data.rid});},fail: function (e) {wx.showToast({title: '服務(wù)器錯(cuò)誤',duration: 2000});}})}else{wx.showModal({title: '提示',content: '一個(gè)選擇的轉(zhuǎn)盤,轉(zhuǎn)不出另一個(gè)選擇。',})}}else{wx.showModal({title: '提示',content: '內(nèi)容和選項(xiàng)不能為空!',})}}} })

總結(jié)

以上是生活随笔為你收集整理的微信小程序-001-抽签功能-002-新建抽签的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。