Commit 70def8c0 by jscat

nyx weapp, 主流程

1. 为竞答创建新的问题。
parent 6d602742
{ {
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"pages/my/my-members/my-members", "pages/my/my-members/my-members",
"pages/member/activity-post/activity-submit/activity-submit", "pages/member/activity-post/activity-submit/activity-submit",
"pages/member/activity-post/activity-edit/activity-edit", "pages/member/activity-post/activity-edit/activity-edit",
"pages/member/quiz-post/quiz-edit/quiz-edit", "pages/member/quiz-post/quiz-edit/quiz-edit",
"pages/mall/order/order", "pages/mall/order/order",
"pages/member/schedule/schedule", "pages/member/schedule/schedule",
"pages/member/activity-post/activity-post", "pages/member/activity-post/activity-post",
......
// pages/member/quiz-post/quiz-edit/quiz-edit.js // pages/member/quiz-post/quiz-edit/quiz-edit.js
...@@ -8,17 +8,7 @@ var util = require('./../../../../utils/util.js') ...@@ -8,17 +8,7 @@ var util = require('./../../../../utils/util.js')
Page({ Page({
data: { data: {
quizInfo : { quizList : [],
questionId : "qid_001",
questionName : "今天一起去看流星雨",
answer : "2",
choiceString : [
"仙女座",
"英仙座",
"猎户座",
"狮子座",
]
},
//阿里云 OSS相关参数 //阿里云 OSS相关参数
accessid: "", accessid: "",
...@@ -33,16 +23,48 @@ Page({ ...@@ -33,16 +23,48 @@ Page({
onLoad: function () { onLoad: function () {
var that = this; var _this = this;
wx.getSystemInfo({ wx.getSystemInfo({
success: function (res) { success: function (res) {
var a = res.windowHeight; var a = res.windowHeight;
that.setData({ _this.setData({
scrollTop: a-200 scrollTop: a-200
}) })
} }
}) })
var quizInfo_1 = {
questionId : "qid_001",
questionName : "叁年间2020年最受欢迎的活动是?",
answer : "B",
choiceString : [
"Tunight盲品活动",
"'奥地利'「月选酒」套装, 一天不到700支",
"周年庆,烧烤海鲜自助",
"Royi·叁年间的酒市集",
]
}
var quizInfo_2 = {
questionId : "qid_001",
questionName : "与勃艮第( Burgundy)的黑比诺( Pinot Noir )相比,新西兰的黑比诺葡萄酒具有什么特点? ",
answer : "D",
choiceString : [
"酸度更高,酒体更饱满",
"酸度较低,酒体更饱满",
"果香更加浓郁",
"B 和 C ",
]
}
var quizList = []
quizList.push(quizInfo_1)
quizList.push(quizInfo_2)
_this.setData({
quizList: quizList
})
}, },
onReady: function (e) { onReady: function (e) {
var _this = this; var _this = this;
...@@ -77,24 +99,27 @@ Page({ ...@@ -77,24 +99,27 @@ Page({
app.globalData.postData.photoTag = e.detail.value app.globalData.postData.photoTag = e.detail.value
}, },
addList: function(){ addList: function(e){
var _this = this; var _this = this;
var quizInfo = _this.data.quizInfo; var dataId = e.currentTarget.dataset.id
var newData = "白羊座"; var quizList = _this.data.quizList;
quizInfo.choiceString.push(newData);//实质是添加lists数组内容,使for循环多一次 var newData = "索诺玛( Sonoma)";
quizList[dataId].choiceString.push(newData);//实质是添加lists数组内容,使for循环多一次
this.setData({ this.setData({
quizInfo: quizInfo, quizList: quizList,
}) })
}, },
delList: function (e) { delList: function (e) {
var _this = this; var _this = this;
var dataId = e.currentTarget.dataset.id var idxId = e.currentTarget.id;
var quizInfo = _this.data.quizInfo; var subId = e.currentTarget.dataset.id
quizInfo.choiceString.splice( dataId,1); var quizList = _this.data.quizList;
quizList[idxId].choiceString.splice( subId,1);;//实质是添加lists数组内容,使for循环多一次
this.setData({ this.setData({
quizInfo: quizInfo, quizList: quizList,
}) })
}, },
switchTab() { switchTab() {
...@@ -106,6 +131,38 @@ Page({ ...@@ -106,6 +131,38 @@ Page({
}); });
}, },
addMore: function(){
var _this = this;
var quizList = _this.data.quizList;
var quizInfo = {
questionName : "新西兰的优质黑比诺( Pinot Noir )产区有?",
answer : "",
choiceString : [
"中奥塔哥( Central Otago )",
]
}
quizList.push(quizInfo);//实质是添加lists数组内容,使for循环多一次
this.setData({
quizList: quizList,
})
},
// start of aliyun oss // start of aliyun oss
// Date Flow // Date Flow
// 提交oss和数据库 // 提交oss和数据库
......
<!-- /page/member/quiz-post/quiz-edit/quiz-edit 添加分类的标签,以及自定义标签 --> <!-- /page/member/quiz-post/quiz-edit/quiz-edit 添加分类的标签,以及自定义标签 -->
...@@ -24,21 +24,35 @@ ...@@ -24,21 +24,35 @@
</view> </view>
</view> </view>
<view class="weui-cells__title">#添加题目</view> <view class="weui-cells__title">#添加问题</view>
<block wx:for="{{quizList}}" wx:for-item="quizInfo" wx:for-index="idx" wx:key="{{idx}}">
<view class='table'> <view class='table'>
<!-- 题目所在行 --> <!-- 题目所在行 -->
<view class='table_header'> <view class='table_header'>
<view class="th-question" style='width:15%;background-color:white'>
<view class='centerclass cell_label'>问题{{idx+1}}</view>
</view>
<view class='th-question' style='width:70%;'>
<view class="table_Text_class">{{quizInfo.questionName}}</view>
</view>
<view class="th-question" style='width:15%;background-color:white'>
<view class='centerclass cell_label'>
</view>
</view>
</view>
<!-- 答案所在行 -->
<view class='table_header'>
<view class="th" style='width:15%;background-color:white'> <view class="th" style='width:15%;background-color:white'>
<view class='centerclass cell_label'>问题</view> <view class='centerclass cell_label'>答案</view>
</view> </view>
<view class='th' style='width:70%;'> <view class='th' style='width:70%;'>
<view class="cell_label centerclass">{{quizInfo.questionName}}</view> <view class="cell_label centerclass">{{quizInfo.answer}}</view>
</view> </view>
<view class="th" style='width:15%;background-color:white'> <view class="th" style='width:15%;background-color:white'>
<view class='centerclass cell_label'> <view class='centerclass cell_label'>
</view> </view>
</view> </view>
</view> </view>
...@@ -60,7 +74,7 @@ ...@@ -60,7 +74,7 @@
<!-- start 删除新行按钮 --> <!-- start 删除新行按钮 -->
<view class="th" style='width:15%;background-color:white'> <view class="th" style='width:15%;background-color:white'>
<view class='centerclass cell_label' bindtap='delList' data-id="{{index}}"> <view class='centerclass cell_label' bindtap='delList' id="{{idx}}" data-id="{{index}}">
<image src="../../../../icon/del.png" style="width: 50rpx;height: 50rpx;"></image> <image src="../../../../icon/del.png" style="width: 50rpx;height: 50rpx;"></image>
</view> </view>
</view> </view>
...@@ -71,29 +85,20 @@ ...@@ -71,29 +85,20 @@
<!-- start 添加新行按钮 --> <!-- start 添加新行按钮 -->
<view class='table_header'> <view class='table_header'>
<view class="th" style='width:15%;background-color:white'> <view class="th" style='width:15%;background-color:white'>
<view class='centerclass cell_label' bindtap='addList'> <view class='centerclass cell_label' bindtap='addList' data-id="{{idx}}">
<image src="../../../../icon/add.png" style="width: 50rpx;height: 50rpx;"></image> <image src="../../../../icon/add.png" style="width: 50rpx;height: 50rpx;"></image>
</view> </view>
</view> </view>
</view> </view>
<!-- end 添加新行按钮 --> <!-- end 添加新行按钮 -->
</view>
<!-- 答案所在行 --> <view class="weui-cells__title"></view>
<view class='table_header'> </block>
<view class="th" style='width:15%;background-color:white'>
<view class='centerclass cell_label'>答案</view>
</view>
<view class='th' style='width:70%;'>
<view class="cell_label centerclass">{{quizInfo.answer}}</view>
</view>
<view class="th" style='width:15%;background-color:white'>
<view class='centerclass cell_label'>
</view>
</view>
</view>
</view> <block>
<button type="default" bindtap="addMore">新增一题</button>
</block>
</view> </view>
\ No newline at end of file
page{ page{
...@@ -31,6 +31,19 @@ page{ ...@@ -31,6 +31,19 @@ page{
display: inline-flex; display: inline-flex;
} }
.th-question {
display: flex;
flex-direction: column;
width: 70%;
height: 140rpx;
background: rgba(241, 252, 255, 1);
border-right: 1rpx solid rgba(218, 217, 217, 1);
border-bottom: 1rpx solid rgba(218, 217, 217, 1);
justify-content: center;
align-items: center;
overflow-x: auto;
}
.th { .th {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -78,10 +91,9 @@ page{ ...@@ -78,10 +91,9 @@ page{
align-items: center; align-items: center;
height: 60rpx; height: 60rpx;
font-size: 30rpx; font-size: 30rpx;
color: rgba(55, 134, 244, 1); color: rgb(152, 18, 8);
width: 100%; width: 100%;
word-break: normal; word-break: normal;
border-bottom: 1rpx solid rgba(218, 217, 217, 1);
} }
.table_Text_last_class{ .table_Text_last_class{
display: flex; display: flex;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论