Commit c6412858 by jscat

nyx: 产品-页面

完成活动竞答+活动结果页面
parent 62bc767e
// pages/index/note-info/note-info.js // pages/index/note-info/note-info.js
...@@ -104,10 +104,10 @@ Page({ ...@@ -104,10 +104,10 @@ Page({
} }
  // 来自页面内的按钮的转发   // 来自页面内的按钮的转发
  if( options.from == 'button' ){   if( options.from == 'button' ){
//     var eData = options.target.dataset;     // var eData = options.target.dataset;
    console.log( eData.id); // shareBtn     // console.log( eData.id); // shareBtn
    // 此处可以修改 shareObj 中的内容     // 此处可以修改 shareObj 中的内容
    shareObj.path = '/pages/goods/goods?goodId=';     shareObj.path = '/pages/goods/goods?goodId=123';
  }   }
return shareObj; return shareObj;
}, },
...@@ -141,4 +141,14 @@ Page({ ...@@ -141,4 +141,14 @@ Page({
// console.log("newScrollLeft: ", newScrollLeft) // console.log("newScrollLeft: ", newScrollLeft)
}, },
//跳转到知识竞答页面
toGame: function (e) {
wx.navigateTo({
url: "/pages/key/matchDaily/matchDaily"
});
},
}) })
\ No newline at end of file
<view class="page"> <view class="page">
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
<text>首页</text> <text>首页</text>
</view> </view>
<view class="items"> <view class="items">
<!-- <image src="../../../icon/activity/share.png"></image> -->
<button class="share" open-type="share"> <button class="share" open-type="share">
</button> </button>
<image src="../../../icon/activity/share.png"></image> <image src="../../../icon/activity/share.png"></image>
...@@ -57,7 +56,7 @@ ...@@ -57,7 +56,7 @@
<button class="button-brown" bindtap="toBuy" formType="submit">我要收藏</button> <button class="button-brown" bindtap="toBuy" formType="submit">我要收藏</button>
</view></view> </view></view>
<view class="weui-flex__item weui-flex justify align"><view class="placeholder"> <view class="weui-flex__item weui-flex justify align"><view class="placeholder">
<button class="button-red" bindtap="toBuy" formType="submit">立即参与</button> <button class="button-red" bindtap="toGame">立即参与</button>
</view></view> </view></view>
</view> </view>
</view> </view>
......
// pages/key/matchDaily/matchDaily.js // pages/key/matchDaily/matchDaily.js
...@@ -66,6 +66,10 @@ Page({ ...@@ -66,6 +66,10 @@ Page({
inputContentToValue: "", inputContentToValue: "",
autoFocus: true, //对话框默认为focus autoFocus: true, //对话框默认为focus
/* 模态框 */
showModal: false,
}, },
/** /**
...@@ -269,7 +273,7 @@ Page({ ...@@ -269,7 +273,7 @@ Page({
//逻辑判断 //逻辑判断
//超过了10题,溢出了,直接进入doneDaily //超过了10题,溢出了,直接进入doneDaily
if(current_index >= 10) if(current_index >= 1)
{ {
_this.doneDaily() _this.doneDaily()
} }
...@@ -351,26 +355,29 @@ Page({ ...@@ -351,26 +355,29 @@ Page({
// 如果完成了10道题 // 如果完成了10道题
doneDaily: function (res) { doneDaily: function (res) {
var _this = this var _this = this
wx.showModal({     this.setData({
title: '恭喜你完成本次学习',       showModal: true
content: '正确率'+_this.__data__.score + '/10',     })
showCancel: false, // 将cancel按钮disable掉 // wx.showModal({
confirmText: '谢谢老师', // title: '恭喜你完成本次活动',
success(res) { // content: '获得'+_this.__data__.score + '积分,打败80%的玩家',
if (res.confirm) { // showCancel: false, // 将cancel按钮disable掉
// 用户点击了确定属性的按钮,于是跳转到tabbar /pages/key/key // confirmText: '谢谢老师',
// wx.navigateTo 和 wx.redirectto都无法跳转到tabbar // success(res) {
_this.setData({ // if (res.confirm) {
isStudyDone: true, // // 用户点击了确定属性的按钮,于是跳转到tabbar /pages/key/key
item_index : 9, // // wx.navigateTo 和 wx.redirectto都无法跳转到tabbar
}) // _this.setData({
// 基于用户交互原则,不直接跳转到/pages/key/key页面, 让用户自主选择 // isStudyDone: true,
// wx.switchTab({ // item_index : 9,
// url: '/pages/key/key' // })
// }); // // 基于用户交互原则,不直接跳转到/pages/key/key页面, 让用户自主选择
} // // wx.switchTab({
} // // url: '/pages/key/key'
}) // // });
// }
// }
// })
}, },
...@@ -694,4 +701,24 @@ Page({ ...@@ -694,4 +701,24 @@ Page({
}, },
  // 外面的弹窗
  btn: function () {
    this.setData({
      showModal: true
    })
  },
 
  // 禁止屏幕滚动
  preventTouchMove: function () {
  },
 
  // 弹出层里面的弹窗
  ok: function () {
    this.setData({
      showModal: false
    })
  }
}) })
\ No newline at end of file
{ {
{ {
"usingComponents": {}, "usingComponents": {},
"navigationBarTitleText": "随便看看" "navigationBarTitleText": "活动竞答"
} }
\ No newline at end of file
<!--pages/key/matchTest/matchTest.wxml--> <!--pages/key/matchTest/matchTest.wxml-->
...@@ -3,6 +3,42 @@ ...@@ -3,6 +3,42 @@
<view class="page bottom_fixed_page" style="min-height:{{ windowHeight }}px"> <view class="page bottom_fixed_page" style="min-height:{{ windowHeight }}px">
<!-- 微信小程序自定义弹框 https://blog.csdn.net/qq_39702981/article/details/85104827 -->
<!-- 微信小程序自定义弹框 https://blog.csdn.net/qq_39702981/article/details/85320926 -->
<!-- start 遮罩层 -->
<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>
<!-- 弹出层 -->
<view class="modalDlg" wx:if="{{showModal}}">
<!-- 二维码或其他图片 -->
<view class="text">
<text style="color:#666666">恭喜你获得 </text>
<text style="font-weight:bold;">10</text>
<text style="color:#666666"> 积分</text>
</view>
<view class="weui-flex weui-width">
<view class="weui-flex__item"><view class="placeholder-modal">
<view class="items">
<image src="../../../icon/activity/points.png"></image>
<text>查看积分</text>
</view>
</view></view>
<view class="weui-flex__item"><view class="placeholder-modal">
<view class="items">
<button class="share" open-type="share">
</button>
<image src="../../../icon/activity/share.png"></image>
<text>分享给好友</text>
</view>
</view></view>
</view>
    <view bindtap="ok" class="ok">取消</view>
</view>
<!-- end 遮罩层 -->
<view class="weui-flex"> <view class="weui-flex">
<view class="weui-flex__item"><view class="placeholder">题目:{{item_index+1}}/10题</view></view> <view class="weui-flex__item"><view class="placeholder">题目:{{item_index+1}}/10题</view></view>
<view class="weui-flex__item"><view class="placeholder">分数:{{score}}</view></view> <view class="weui-flex__item"><view class="placeholder">分数:{{score}}</view></view>
......
page{background-color:#EDEDED;} page{background-color:#EDEDED;}
...@@ -164,3 +164,99 @@ page{background-color:#EDEDED;} ...@@ -164,3 +164,99 @@ page{background-color:#EDEDED;}
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
} }
/* 小程序自定义弹框 */
/* 遮罩层 */
.mask{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
z-index: 9000;
opacity: 0.5;
}
/* 弹出层 */
.modalDlg{
width: 70%;
height: 360rpx;
position: fixed;
top: 50px;
left: 0;
right: 0;
z-index: 9999;
margin: 0 auto;
background-color: #fff;
border-radius:5px;
display: flex;
flex-direction: column;
align-items: center;
}
/* 弹出层里面的图片 */
/* 弹出层里面的按钮 */
.ok{
width: 100%;
height: 2rpx;
background: #ccc;
text-align: center;
font-size: 38rpx;
color: #666666;
}
/* 弹出层里面的文字 */
.text{
text-align: center;
font-size: 38rpx;
color: rgb(255, 0, 0);
width: 80%;
/* margin: 20rpx; */
padding: 30rpx;
}
/* 图片+文字 */
.weui-width{
width: 80%;
}
.placeholder-modal{
margin: 0px;
text-align: center;
vertical-align: middle;
line-height: 2.3em;
background-color: #fff;
}
.items{
width: 100%;
display: flex;
flex-direction: column;
text-align: center;
align-items: center;
}
.items image{
width: 80rpx;
height: 80rpx;
margin-top: 10rpx;
font-size: 0;
}
.items text{
/* display: block; */
text-align: center;
padding: 0rpx;
font-size: 30rpx;
color:#666666
}
/* 分享按钮 */
.share {
position: absolute;
background-size: 50rpx 50rpx;
opacity: 0;
border:none;
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论