收到新请求,应答功能和特定答案后,我们必须等待后续操作在微信小程序上开发答题系统怎么样,因此让我们首先上传我的一个答案提示。
上面的图片将首先为您显示效果
在这种情况下,将有一个小问题,即先前选择的答案也将被清除,因此我将在将来看到如何解决一系列错误,然后为您更新最新的一个。
出什么问题了?也就是说,我导入了更多数据,并且数据格式是相对固定的,因此,如果我没有最终的需求,我只能先使用它。我的想法是单击后命名数组,将答案存储在其中,判断是否存在答案,然后循环判断它是否存在以及是否对其进行修改。注释全部在代码上。

wxml代码
{{list[idx].name}} {{item}} 上一题 上一题 下一题 下一题 提交
css代码
.title-vi{ margin-left: 5%; } .title-name{ margin-top: 50rpx; } .title-select{ margin-top: 20rpx; width: 25%; background: #73E600; border-radius: 1rpx; border: 1px solid #73E600; height: 60rpx; line-height: 60rpx; } .select-title{ margin-top: 20rpx; width: 25%; height: 60rpx; line-height: 60rpx; } .select-sure{ display: flex; flex-direction: row; align-items: center; margin-top: 150rpx; } .top-sure{ width: 30%; text-align: center; margin-left: 10%; border-radius: 1rpx; border: 1px solid; height: 60rpx; line-height: 60rpx; } .bottom-sure{ width: 30%; text-align: center; margin-left: 20%; border-radius: 1rpx; border: 1px solid; height: 60rpx; line-height: 60rpx; } .top-sure1{ width: 30%; text-align: center; margin-left: 10%; border-radius: 1rpx; border: 1px solid #e3e3e3; height: 60rpx; line-height: 60rpx; color: #e3e3e3; } .bottom-sure1{ width: 30%; text-align: center; margin-left: 20%; border-radius: 1rpx; border: 1px solid #e3e3e3; height: 60rpx; line-height: 60rpx; color: #e3e3e3; } .title-end{ width: 30%; text-align: center; margin-left: 20%; border-radius: 1rpx; border: 1px solid; height: 60rpx; line-height: 60rpx; margin-left: 35%; margin-top: 100rpx; }
js代码
// pages/agin/agin.js Page({ /** * 页面的初始数据 */ data: { list: [{ name: '1: 1 + 1 = ?', select_title: ["A、1", "B、2", "C、3", "D、4"], sure_title: 'C' }, { name: '2: 2 + 2 = ?', select_title: ["A、4", "B、5", "C、6", "D、7"], sure_title: 'C' }], idx: 0,//题目下标 num: 0,//分数 }, jumpBackTitle(e){ var that = this var idx = that.data.idx//第几题 var idz = that.data.idz//选择答案 console.log("k",idx) this.setData({ idx: idx - 1, idz: -1,//重置本题答案 }) }, jumpNavTitle(e){ var that = this var idx = that.data.idx var idz = that.data.idz console.log("k",idx) this.setData({ idx: idx + 1, idz: -1, }) }, selectTitle(e){ var index = e.currentTarget.dataset.index this.setData({ idz: index, }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })