添加图片

main
青飞扬 5 months ago
parent 1384db2c19
commit 158a86602f

@ -1,2 +1,4 @@
# 1234
链接https://pan.baidu.com/s/1OPFDPqgfQn7PwjFeNSHZeg?pwd=6666
提取码6666

@ -0,0 +1,11 @@
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
},
globalData: {
userInfo: null,
questions: []
}
})

@ -0,0 +1,14 @@
{
"pages": [
"pages/index/index",
"pages/test/test",
"pages/result/result",
"pages/wrongAnswer/wrongAnswer"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#99ffcc",
"navigationBarTitleText": "小学五年级数学测试",
"navigationBarTextStyle": "black"
}
}

@ -0,0 +1,12 @@
/**app.wxss**/
@import "weui.wxss";
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

@ -0,0 +1,86 @@
// pages/conn/conn.js
Page({
/**
* 页面的初始数据
*/
data: {
},
bindtest: function () {
wx.request({
url: 'http://111.230.50.64:8080/WxMath/ServletTest',
data: {
},
method: 'GET',
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
console.log(res.data);
},
fail: function (res) {
console.log(".....fail.....");
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,5 @@
<!--pages/conn/conn.wxml-->
<text>pages/conn/conn.wxml</text>
<view>
<button bindtap='bindtest'>test</button>
</view>

@ -0,0 +1 @@
/* pages/conn/conn.wxss */

@ -0,0 +1,76 @@
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
//事件处理函数
beginAnswer: function () {
wx.navigateTo({
url: '../test/test'
})
},
onLoad: function () {
/* 请求数据 */
wx.request({
url: '',
data: {
},
method: 'GET',
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
//var questionList = [];
app.globalData.questions = res.data;
console.log(res.data);
},
fail: function (res) {
console.log(".....fail.....");
}
})
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse){
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
},
getUserInfo: function(e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})

@ -0,0 +1,5 @@
<!--index.wxml-->
<view class="begininfo">
<view class='ep'></view>
<button bindtap='beginAnswer'> 开始测试 </button>
</view>

File diff suppressed because one or more lines are too long

@ -0,0 +1,111 @@
// pages/result/result.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
wrong: 0,
wrongList: [],
accuracy:0,
mytrue:0,
grade:0,
answerArrays1:[],
answerArrays2:[],
answerArrays3:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log(options.wrongList);
// console.log(JSON.parse(options.wrongList));
// console.log(typeof JSON.parse(options.wrongList));
// console.log(options.answerArrays2);
// console.log(options.answerArrays2.length);
// console.log(typeof options.answerArrays2);
//设置标题
wx.setNavigationBarTitle({
title: "测试结果"
})
this.setData({
wrong: options.wrong - 0,
wrongList: options.wrongList,
answerArrays1: options.answerArrays1,
answerArrays2: options.answerArrays2,
answerArrays3: options.answerArrays3
})
this.setData({
mytrue: 20 - this.data.wrong,
})
this.setData({
accuracy: 5*this.data.mytrue,
})
this.setData({
grade: this.data.mytrue*5
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
reset: function(){
wx.redirectTo({
url: '../index/index',
})
},
wrongAnswer:function(){
wx.redirectTo({
url: '../wrongAnswer/wrongAnswer?wrongList=' + this.data.wrongList + '&answerArrays1=' + this.data.answerArrays1 + '&answerArrays2=' + this.data.answerArrays2 + '&answerArrays3=' + this.data.answerArrays3
})
}
})

@ -0,0 +1,19 @@
<!--pages/result/result.wxml-->
<view>
<view class='result_title'>
<view><text>恭喜您答题结束</text></view>
</view>
<view class='result'>
<view><text>本次测试总共20道题</text></view>
<view><text>答对{{mytrue}}道题</text></view>
<view><text>答错{{wrong}}道题</text></view>
<view><text>正确率为{{accuracy}}%</text></view>
<view><text>本次测试得{{grade}}分</text></view>
</view>
<view class='mybutton'>
<button bindtap='wrongAnswer' class='blbutton'>查看错题</button>
<button bindtap='reset' class='brbutton'>返回首页</button>
</view>
</view>

File diff suppressed because one or more lines are too long

@ -0,0 +1,217 @@
// pages/test/test.js
const app = getApp()
var W
var wrongLists
Page({
/**
* 页面的初始数据
*/
data: {
index: 0,
realIndex: 0,
questionCount: 0,
optionCount: 0,
wrong: 0,
myoption: ["A", "B", "C", "D", "E", "F"],
isSelected: false,
questionArrays: [],
answerArrays1: ["A", "B", "C"], //三个选项题目乱序前的数组
answerArrays2: ["A", "B", "C", "D"], //四个选项题目乱序前的数组
answerArrays3: ["A", "B", "C", "D", "E", "F"], //六个选项题目乱序前的数组
setColor: "green",
icon: ["circle", "circle", "circle", "circle", "circle", "circle"],
wrongList:[],
count:20 //显示多少道题目
},
//乱序算法
randSort: function () {
return Math.random() > 0.5 ? 1 : -1;
},
//对数组乱序
setList: function () {
var newList = this.data.questionArrays.sort(this.randSort);
this.setData({
list: newList,
});
},
//对三个选项乱序
setOption1: function () {
var newOption1 = this.data.answerArrays1.sort(this.randSort);
this.setData({
answerArrays1: newOption1
})
},
//对四个选项乱序
setOption2: function () {
var newOption2 = this.data.answerArrays2.sort(this.randSort);
this.setData({
answerArrays2: newOption2
})
},
//对六个选项乱序
setOption3: function () {
var newOption3 = this.data.answerArrays3.sort(this.randSort);
this.setData({
answerArrays3: newOption3
})
},
//点击选项触发函数
select: function (event) {
setTimeout(function () {
this.setData({
icon: ["circle", "circle", "circle", "circle", "circle", "circle"]
})
}.bind(this), 200);
var value = event.currentTarget.dataset.value;
var chooseOption = event.currentTarget.dataset.option;
var trueOption = app.globalData.questions[this.data.realIndex].true;
var trueVaule = app.globalData.questions[this.data.realIndex].option[trueOption];
console.log("选择的选项是:" + chooseOption + " 选择的值:" + value);
console.log("本题乱序前的选项是:" + trueOption + " 值是:" + trueVaule);
if (value != trueVaule) {
var icons = ["circle", "circle", "circle", "circle", "circle", "circle"];
var tmp= {"order":"","trueOption":"","wrongOption":""};
icons[chooseOption] = "cancel";
tmp.order = this.data.realIndex;
tmp.trueOption = trueOption;
tmp.wrongOption = this.data.myoption[chooseOption];
console.log(tmp);
wrongLists.push(tmp);
console.log(wrongLists);
this.setData({
icon: icons,
wrong: this.data.wrong + 1,
wrongList: wrongLists
})
console.log("order---:"+this.data.wrongList[0].order);
W = JSON.stringify(this.data.wrongList)
} else {
var icons = ["circle", "circle", "circle", "circle", "circle", "circle"];
icons[chooseOption] = "success";
this.setData({
icon: icons
})
}
if (this.data.index < this.data.count - 1) {
this.setData({
isSelected: false,
index: this.data.index + 1,
})
this.setData({
realIndex: this.data.questionArrays[this.data.index]
})
this.setData({
//questionDetail: app.globalData.questions[this.data.realIndex].question,
options: app.globalData.questions[this.data.realIndex].option,
questionImage: app.globalData.questions[this.data.realIndex].question,
optionnumber: app.globalData.questions[this.data.realIndex].number
})
// console.log("选择后的index:" + this.data.index);
// console.log("选择后的realIndex:" + this.data.realIndex);
} else {
var aw1 = JSON.stringify(this.data.answerArrays1),
aw2 = JSON.stringify(this.data.answerArrays2),
aw3 = JSON.stringify(this.data.answerArrays3);
wx.navigateTo({
url: '/pages/result/result?wrong=' + this.data.wrong + '&wrongList=' + W + '&answerArrays1=' + aw1 + '&answerArrays2=' + aw2 + '&answerArrays3=' + aw3
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//设置标题
wx.setNavigationBarTitle({
title: "答题区"
})
wrongLists = [];
//在js中初始化一个数组数组里存储正序的题号。这里题号从1开始
this.setData({
questionCount: app.globalData.questions.length
})
var questionArray = [];
for (var i = 0; i < this.data.questionCount; i++) {
questionArray.push(i);
}
this.setData({
questionArrays: questionArray,
})
//乱序题号数组、选项数组
this.setList();
console.log("乱序后的题号数组:" + this.data.questionArrays)
this.setOption1();
this.setOption2();
this.setOption3();
console.log("乱序后的选项数组:" + this.data.answerArrays1 + "\n" + this.data.answerArrays2 + "\n" + this.data.answerArrays3)
//初始化第一个题目
this.setData({
realIndex: this.data.questionArrays[this.data.index]
})
console.log("onLoad时的index:" + this.data.index);
console.log("onLoad时的realIndex:" + this.data.realIndex);
this.setData({
//questionDetail: app.globalData.questions[this.data.realIndex].question,
options: app.globalData.questions[this.data.realIndex].option,
questionImage: app.globalData.questions[this.data.realIndex].question,
optionnumber: app.globalData.questions[this.data.realIndex].number
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,40 @@
<!--pages/test/test.wxml-->
<view class="page" hover='true' hover-stay-time="20000">
<view class='page__hd'>
<view class="page__title">{{index+1}}、
<view class='page_title_question'><image wx:if="{{questionImage!=''}}" src="{{questionImage}}" class='myimage' mode="widthFix"></image></view>
</view>
</view>
<view class="page__bd">
<view class="weui-cells weui-cells_after-title">
<!-- 判断选项个数是3个还是4还是6个 -->
<view wx:if="{{optionnumber == '3'}}">
<view class="weui-cell " hover-class="weui-cell_active" bindtap='select' data-value="{{options[answerArrays1[index]]}}" data-option="{{index}}" wx:for="{{answerArrays1}}" wx:key="index">
<icon type="{{icon[index]}}" size="23"></icon>
<view>{{myoption[index]}}、<image src="{{options[answerArrays1[index]]}}" class='myoptionimage' mode="widthFix"></image></view>
</view>
</view>
<view wx:elif="{{optionnumber == '4'}}">
<view class="weui-cell " hover-class="weui-cell_active" bindtap='select' data-value="{{options[answerArrays2[index]]}}" data-option="{{index}}" wx:for="{{answerArrays2}}" wx:key="index">
<icon type="{{icon[index]}}" size="23"></icon>
<view class='myFloat'>{{myoption[index]}}、<image src="{{options[answerArrays2[index]]}}" class='myoptionimage' mode="widthFix"></image></view>
</view>
</view>
<view wx:else>
<view class="weui-cell " hover-class="weui-cell_active" bindtap='select' data-value="{{options[answerArrays3[index]]}}" data-option="{{index}}" wx:for="{{answerArrays3}}" wx:key="index">
<icon type="{{icon[index]}}" size="23"></icon>
<view>{{myoption[index]}}、<image src="{{options[answerArrays3[index]]}}" class='myoptionimage' mode="widthFix"></image></view>
</view>
</view>
</view>
</view>
</view>

File diff suppressed because one or more lines are too long

@ -0,0 +1,138 @@
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data:{
wrongList:[],
answerArrays1: [],
answerArrays2: [],
answerArrays3: [],
indexs:0,
myoption: ["A", "B", "C", "D", "E", "F"],
trueoption:[]
},
//判断正确选项乱序后的位置
TrueOptionFunction:function(){
var trueoptions = [];
for(var i = 0;i < this.data.wrongList.length;i++){
if (app.globalData.questions[this.data.wrongList[i].order].number == '3'){
for(var j = 0;j < 3;j++){
if(this.data.wrongList[i].trueOption == this.data.answerArrays1[j])
{
trueoptions.push(j);
}
}
}
else if (app.globalData.questions[this.data.wrongList[i].order].number == '4') {
for (var j = 0; j < 4; j++) {
if (this.data.wrongList[i].trueOption == this.data.answerArrays2[j]) {
trueoptions.push(j);
}
}
}
else {
for (var j = 0; j < 6; j++) {
if (this.data.wrongList[i].trueOption == this.data.answerArrays3[j]) {
trueoptions.push(j);
}
}
}
this.setData({
trueoption: trueoptions
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log(JSON.parse(options.wrongList));
// console.log(typeof JSON.parse(options.wrongList));
//设置标题
wx.setNavigationBarTitle({
title: "错题集"
})
this.setData({
wrongList:JSON.parse(options.wrongList),
answerArrays1: JSON.parse(options.answerArrays1),
answerArrays2: JSON.parse(options.answerArrays2),
answerArrays3: JSON.parse(options.answerArrays3)
})
this.setData({
wrongquestionImage: app.globalData.questions[this.data.wrongList[this.data.indexs].order].question,
//wrongquestionDetail: app.globalData.questions[this.data.wrongList[this.data.indexs].order].question,
wrongoptionnumber: app.globalData.questions[this.data.wrongList[this.data.indexs].order].number,
wrongoptions: app.globalData.questions[this.data.wrongList[this.data.indexs].order].option
})
this.TrueOptionFunction();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
next:function(){
if(this.data.indexs < this.data.wrongList.length - 1){
this.setData({
indexs:this.data.indexs+1
})
this.setData({
wrongquestionImage: app.globalData.questions[this.data.wrongList[this.data.indexs].order].question,
//wrongquestionDetail: app.globalData.questions[this.data.wrongList[this.data.indexs].order].question,
wrongoptionnumber: app.globalData.questions[this.data.wrongList[this.data.indexs].order].number,
wrongoptions: app.globalData.questions[this.data.wrongList[this.data.indexs].order].option
})
}
},
goFirst:function(){
wx.redirectTo({
url: '../index/index'
})
}
})

@ -0,0 +1,48 @@
<view class="page" hover='true' hover-stay-time="20000" >
<view class='page__hd'>
<view class="page__title">{{indexs+1}}、
<view class='page_title_question'><image wx:if="{{wrongquestionImage!=''}}" src="{{wrongquestionImage}}" class='myimage' mode="widthFix"></image></view>
</view>
</view>
<view class="page__bd">
<view class="weui-cells weui-cells_after-title">
<view wx:if="{{wrongoptionnumber == '3'}}">
<view class="weui-cell " wx:for="{{answerArrays1}}" wx:key="index">
<view>{{myoption[index]}}、<image src="{{wrongoptions[answerArrays1[index]]}}" class='myoptionimage' mode="widthFix"></image></view>
</view>
</view>
<view wx:elif="{{wrongoptionnumber == '4'}}">
<view class="weui-cell " wx:for="{{answerArrays2}}" wx:key="index">
<view>{{myoption[index]}}、<image src="{{wrongoptions[answerArrays2[index]]}}" class='myoptionimage' mode="widthFix"></image></view>
</view>
</view>
<view wx:else>
<view class="weui-cell " wx:for="{{answerArrays3}}" wx:key="index">
<view>{{myoption[index]}}、<image src="{{wrongoptions[answerArrays3[index]]}}" class='myoptionimage' mode="widthFix"></image></view>
</view>
</view>
</view>
</view>
<view class='page_ft'>
<view>
<view class='wronganswer'><text>您的答案为{{wrongList[indexs].wrongOption}}</text></view>
<view class='trueanswer'><text>正确答案为{{myoption[trueoption[indexs]]}}</text></view>
</view>
<view class='mybutton'>
<button bindtap='goFirst' wx:if="{{indexs == wrongList.length-1}}">返回首页</button>
<button bindtap='next' wx:else>下一题</button>
</view>
</view>
</view>

File diff suppressed because one or more lines are too long

@ -0,0 +1,38 @@
{
"description": "项目配置文件。",
"setting": {
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"compileType": "miniprogram",
"libVersion": "3.4.9",
"appid": "wxcc2f96e8099af69a",
"projectname": "z",
"condition": {
"miniprogram": {
"list": [
{
"name": "test",
"pathName": "pages/index/index",
"query": ""
}
]
}
},
"packOptions": {
"ignore": [],
"include": []
},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "z",
"setting": {
"compileHotReLoad": true
}
}

@ -0,0 +1,19 @@
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save