@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Eslint config file
|
||||
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
||||
* Install the Eslint extension before using this feature.
|
||||
*/
|
||||
module.exports = {
|
||||
env: {
|
||||
es6: true,
|
||||
browser: true,
|
||||
node: true,
|
||||
},
|
||||
ecmaFeatures: {
|
||||
modules: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
wx: true,
|
||||
App: true,
|
||||
Page: true,
|
||||
getCurrentPages: true,
|
||||
getApp: true,
|
||||
Component: true,
|
||||
requirePlugin: true,
|
||||
requireMiniProgram: true,
|
||||
},
|
||||
// extends: 'eslint:recommended',
|
||||
rules: {},
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
# 云开发 quickstart
|
||||
|
||||
这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力:
|
||||
|
||||
- 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库
|
||||
- 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理
|
||||
- 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码
|
||||
|
||||
## 参考文档
|
||||
|
||||
- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)
|
||||
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/1/1",
|
||||
"pages/3/3",
|
||||
"pages/2/2",
|
||||
"pages/4/4",
|
||||
"pages/5-1/5-1",
|
||||
"pages/52/52",
|
||||
"pages/53/53",
|
||||
"pages/54/54",
|
||||
"pages/42/42",
|
||||
"pages/31/31",
|
||||
"pages/index/index"
|
||||
],
|
||||
"window": {
|
||||
"backgroundColor": "#F6F6F6",
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#F6F6F6",
|
||||
"navigationBarTitleText": "云开发-点名系统",
|
||||
"navigationBarTextStyle": "black"
|
||||
},
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"style": "v2"
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
// miniprogram/components/cloudTipModal/index.js
|
||||
const { isMac } = require('../../envList.js');
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
showUploadTip: false,
|
||||
tipText: isMac ? 'sh ./uploadCloudFunction.sh' : './uploadCloudFunction.bat'
|
||||
},
|
||||
properties: {
|
||||
showUploadTipProps: Boolean
|
||||
},
|
||||
observers: {
|
||||
showUploadTipProps: function(showUploadTipProps) {
|
||||
this.setData({
|
||||
showUploadTip: showUploadTipProps
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCheckEnv(){
|
||||
wx.showLoading({
|
||||
title: '',
|
||||
});
|
||||
wx.cloud
|
||||
.callFunction({
|
||||
name: 'quickstartFunctions',
|
||||
data: {
|
||||
type: 'getOpenId',
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
wx.hideLoading();
|
||||
this.setData({
|
||||
showUploadTip: !this.data.showUploadTip
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
// 报错信息提示环境不存在
|
||||
wx.hideLoading();
|
||||
if(e.message.includes('env not exists') || e.message.includes('Environment not found') || e.message.includes('env check invalid be filterd')){
|
||||
wx.showToast({
|
||||
title: '环境未找到',
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onCheckEnvCancel(){
|
||||
this.setData({
|
||||
showUploadTip: !this.data.showUploadTip
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"component": true
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
.install_tip_back {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.install_tip_detail {
|
||||
position: fixed;
|
||||
background-color: white;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
top: 65%;
|
||||
border-radius: 40rpx 40rpx 0 0;
|
||||
padding: 50rpx;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.install_tip_detail_title {
|
||||
font-weight: 400;
|
||||
font-size: 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.install_tip_detail_tip {
|
||||
font-size: 25rpx;
|
||||
color: rgba(0,0,0,0.4);
|
||||
margin-top: 20rpx;
|
||||
text-align: left;
|
||||
}
|
||||
.install_tip_detail_buttons {
|
||||
padding-top: 50rpx;
|
||||
display: flex;
|
||||
}
|
||||
.install_tip_detail_button {
|
||||
color: #07C160;
|
||||
font-weight: 500;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
width: 40%;
|
||||
text-align: center;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 10rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.install_tip_detail_button_primary {
|
||||
background-color: #07C160;
|
||||
color: #fff;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
Component({
|
||||
data: {
|
||||
modalVisible: false,
|
||||
tipText: '云开发>云模板>模板中心',
|
||||
},
|
||||
properties: {
|
||||
installModulePageTitleProps: String,
|
||||
modalVisibleProps: Boolean,
|
||||
tipTextProps: String,
|
||||
installModuleNameProps: String,
|
||||
},
|
||||
observers: {
|
||||
modalVisibleProps: function (modalVisibleProps) {
|
||||
this.setData({
|
||||
modalVisible: modalVisibleProps,
|
||||
});
|
||||
},
|
||||
tipTextProps: function (tipTextProps) {
|
||||
this.setData({
|
||||
tipText: tipTextProps,
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
hideModal() {
|
||||
if (this.data.modalVisible) {
|
||||
this.setData({
|
||||
modalVisible: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
onViewDetail() {
|
||||
this.hideModal();
|
||||
wx.navigateTo({
|
||||
url: `/pages/cloudbaseModuleInstallTips/index?moduleName=${this.properties.installModuleNameProps}&title=${this.properties.installModulePageTitleProps}`,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"component": true
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<!-- miniprogram/components/cloudTipModal/index.wxml -->
|
||||
<view class="install_tip" wx:if="{{ modalVisible }}">
|
||||
<view class="install_tip_back" bindtap="hideModal" />
|
||||
<view class="install_tip_detail">
|
||||
<view class="install_tip_detail_title">体验前需安装云模板</view>
|
||||
<view class="install_tip_detail_tip">请按照以下路径安装对应云模板</view>
|
||||
<view class="install_tip_detail_shell">{{ tipText }}</view>
|
||||
<view bindtap="onViewDetail" class="install_tip_detail_button">查看详情{{ installModuleName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -0,0 +1,57 @@
|
||||
.install_tip_back {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.install_tip_detail {
|
||||
position: fixed;
|
||||
background-color: white;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
top: 60%;
|
||||
border-radius: 40rpx 40rpx 0 0;
|
||||
padding: 50rpx;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.install_tip_detail_title {
|
||||
font-weight: 400;
|
||||
font-size: 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.install_tip_detail_tip {
|
||||
font-size: 25rpx;
|
||||
color: rgba(0,0,0,0.4);
|
||||
margin-top: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.install_tip_detail_shell {
|
||||
margin: 70rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.install_tip_detail_copy {
|
||||
color: #546488;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.install_tip_detail_button {
|
||||
color: #07C160;
|
||||
font-weight: 500;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
width: 60%;
|
||||
text-align: center;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 10rpx;
|
||||
margin: 0 auto;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
// components/cloudbaseModuleInstallPath/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
installModuleName: String,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<view class="tip">可以在“云开发>云模板>模板中心>{{installModuleName}}”找到该模板</view>
|
@ -0,0 +1,7 @@
|
||||
.tip {
|
||||
font-size: 23rpx;
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
margin: 30rpx auto 0 auto;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
Component({
|
||||
data: {
|
||||
modalVisible: false,
|
||||
},
|
||||
properties: {
|
||||
visible: Boolean,
|
||||
imageSrc: String,
|
||||
},
|
||||
observers: {
|
||||
visible: function (visible) {
|
||||
this.setData({
|
||||
modalVisible: visible
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClose() {
|
||||
this.setData({ modalVisible: false });
|
||||
}
|
||||
}
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"component": true
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<view class="modal_container" wx:if="{{ modalVisible }}">
|
||||
<view class="icon_close" bind:tap="onClose">
|
||||
<view>X</view>
|
||||
</view>
|
||||
<view class="image_container">
|
||||
<image class="code_img" src="{{ imageSrc }}" />
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,95 @@
|
||||
.modal_container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.icon_close {
|
||||
position: fixed;
|
||||
right: 40rpx;
|
||||
top: 40rpx;
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* background-color: #07c160; */
|
||||
background-color: rgba(0,0,0,0.7);
|
||||
color: white;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.code_img {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
margin-top: 50%;
|
||||
margin-left: 50%;
|
||||
transform: translateX(-50%);
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
|
||||
.install_tip_back {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.install_tip_detail {
|
||||
position: fixed;
|
||||
background-color: white;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
top: 60%;
|
||||
border-radius: 40rpx 40rpx 0 0;
|
||||
padding: 50rpx;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.install_tip_detail_title {
|
||||
font-weight: 400;
|
||||
font-size: 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.install_tip_detail_tip {
|
||||
font-size: 25rpx;
|
||||
color: rgba(0,0,0,0.4);
|
||||
margin-top: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.install_tip_detail_shell {
|
||||
margin: 70rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.install_tip_detail_copy {
|
||||
color: #546488;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.install_tip_detail_button {
|
||||
color: #07C160;
|
||||
font-weight: 500;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
width: 60%;
|
||||
text-align: center;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 10rpx;
|
||||
margin: 0 auto;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
const envList = [];
|
||||
const isMac = false;
|
||||
module.exports = {
|
||||
envList,
|
||||
isMac
|
||||
};
|
After Width: | Height: | Size: 646 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 906 B |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 888 B |
After Width: | Height: | Size: 666 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 779 B |
After Width: | Height: | Size: 789 B |
After Width: | Height: | Size: 917 B |
After Width: | Height: | Size: 888 B |
After Width: | Height: | Size: 873 B |
After Width: | Height: | Size: 879 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 711 B |
After Width: | Height: | Size: 620 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 646 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 140 KiB |
@ -0,0 +1,66 @@
|
||||
// pages/1/1.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<!--pages/news.wxml-->
|
||||
|
||||
<view class="box">
|
||||
<text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <navigator url="../logs/logs" open-type="navigate">点我跳转 -->
|
||||
<!-- </navigator> -->
|
||||
<image src="../../image/logo.png" style="width: 100%;" >
|
||||
</image>
|
||||
<view style="height: 100rpx;">
|
||||
|
||||
</view>
|
||||
<button type="default" ><navigator url="../2/2" open-type="redirect">点击进入</navigator>
|
||||
</button>
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
|
@ -0,0 +1,6 @@
|
||||
/* pages/1/1.wxss */
|
||||
.box{
|
||||
width: auto;
|
||||
height: 300rpx;
|
||||
background-color:white;
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
// pages/2/2.js
|
||||
const db = wx.cloud.database(); // 获取数据库实例
|
||||
const app = getApp(); // 获取全局应用实例
|
||||
|
||||
Page({
|
||||
|
||||
async selectRandomIndexAndSetChosen() {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 加载中的提示文字
|
||||
mask: true // 防止触摸穿透
|
||||
});
|
||||
|
||||
const score_list = []; // 用于存储所有数据的score
|
||||
const index_list = []; // 用于存储所有数据的index
|
||||
const MAX_LIMIT = 20; // 每次获取数据的最大数量
|
||||
|
||||
try {
|
||||
// 获取所有数据并存入score_list和index_list
|
||||
const total = await db.collection('demolist').count().then(res => res.total);
|
||||
const batchTimes = Math.ceil(total / MAX_LIMIT);
|
||||
|
||||
const tasks = [];
|
||||
for (let i = 0; i < batchTimes; i++) {
|
||||
const promise = db.collection('demolist').skip(i * MAX_LIMIT).limit(MAX_LIMIT).get().then(res => {
|
||||
res.data.forEach(item => {
|
||||
score_list.push(item.score);
|
||||
index_list.push(item.index);
|
||||
});
|
||||
});
|
||||
tasks.push(promise);
|
||||
}
|
||||
|
||||
await Promise.all(tasks); // 等待所有数据请求完成
|
||||
|
||||
// 根据score_list中的值生成权重
|
||||
const maxScore = 60;
|
||||
const weights = score_list.map(score => maxScore - score);
|
||||
|
||||
// 计算权重总和
|
||||
const totalWeight = weights.reduce((sum, weight) => sum + weight, 0);
|
||||
|
||||
// 生成一个介于 0 和 totalWeight 之间的随机数
|
||||
const randomWeight = Math.random() * totalWeight;
|
||||
|
||||
// 根据随机数选择index
|
||||
let cumulativeWeight = 0;
|
||||
for (let i = 0; i < weights.length; i++) {
|
||||
cumulativeWeight += weights[i];
|
||||
if (randomWeight <= cumulativeWeight) {
|
||||
// 将选中的 index 赋值给 app.js 中的 chosen_index 变量
|
||||
getApp().globalData.chosen_index = index_list[i];
|
||||
console.log('选中的 index:', index_list[i]);
|
||||
|
||||
// 隐藏加载动画
|
||||
wx.hideLoading();
|
||||
|
||||
// 跳转到 pages/3/3 页面
|
||||
wx.redirectTo({
|
||||
url: '../3/3'
|
||||
});
|
||||
return; // 跳转后结束函数
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取数据失败:', error);
|
||||
// 如果出错也隐藏加载动画
|
||||
wx.hideLoading();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
// selectRandomIndexAndSetChosen()
|
||||
// .then(() => {
|
||||
// console.log('index 已成功赋值给 chosen_index');
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.error('获取数据失败:', err);
|
||||
// });
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<!--pages/news.wxml-->
|
||||
|
||||
<view class="box">
|
||||
<text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <navigator url="../logs/logs" open-type="navigate">点我跳转 -->
|
||||
<!-- </navigator> -->
|
||||
<image src="../../image/xinyuu.png" style="width: 100%;" >
|
||||
</image>
|
||||
<view style="height: 100rpx;">
|
||||
|
||||
</view>
|
||||
<button type="default" bind:tap="selectRandomIndexAndSetChosen">开始抽点
|
||||
</button>
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
|
@ -0,0 +1,6 @@
|
||||
/* pages/1/1.wxss */
|
||||
.box{
|
||||
width: auto;
|
||||
height: 300rpx;
|
||||
background-color:white;
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
// pages/3/3.js
|
||||
const db = wx.cloud.database();
|
||||
const app = getApp(); // 获取全局应用实例
|
||||
|
||||
Page({
|
||||
data: {
|
||||
dataobj: undefined
|
||||
},
|
||||
async updateScoreForIndex_j1() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score + 1; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../31/31'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
async updateScoreForIndex_fu1() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score - 1; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../42/42'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
get_data() {
|
||||
const chosenIndex = app.globalData.chosen_index; // 获取 chosen_index
|
||||
db.collection("demolist").where({ index: chosenIndex }).get({
|
||||
success: res => {
|
||||
console.log(res);
|
||||
if (res.data.length > 0) {
|
||||
this.setData({
|
||||
dataobj: res.data[0]
|
||||
}, () => {
|
||||
console.log(this.data.dataobj);
|
||||
});
|
||||
} else {
|
||||
console.log("没有数据");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.get_data()
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<!--pages/news.wxml-->
|
||||
|
||||
<view class="box">
|
||||
<text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <navigator url="../logs/logs" open-type="navigate">点我跳转 -->
|
||||
<!-- </navigator> -->
|
||||
<image src="../../image/shenpan.jpg" style="width: 100%;" >
|
||||
</image>
|
||||
|
||||
<view style="height: 100rpx;">
|
||||
|
||||
</view>
|
||||
<view>姓名:{{dataobj.name}}</view>
|
||||
<view>学号:{{dataobj.xuehao}}</view>
|
||||
|
||||
<view >
|
||||
分数:{{dataobj.score}}
|
||||
|
||||
</view>
|
||||
<view style="height: 100rpx;">
|
||||
该同学到了吗
|
||||
</view>
|
||||
<button type="default" bind:tap="updateScoreForIndex_j1">是</button>
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
<button type="default" bind:tap="updateScoreForIndex_fu1">否</button>
|
||||
|
@ -0,0 +1,6 @@
|
||||
/* pages/1/1.wxss */
|
||||
.box{
|
||||
width: auto;
|
||||
height: 150rpx;
|
||||
background-color:white;
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
// pages/3/3.js
|
||||
const db = wx.cloud.database();
|
||||
const app = getApp(); // 获取全局应用实例
|
||||
|
||||
Page({
|
||||
data: {
|
||||
dataobj: undefined
|
||||
},
|
||||
async updateScoreForIndex_j05() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score + 0.5; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../4/4'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
async updateScoreForIndex_jian1() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score - 1; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../42/42'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
get_data() {
|
||||
const chosenIndex = app.globalData.chosen_index; // 获取 chosen_index
|
||||
db.collection("demolist").where({ index: chosenIndex }).get({
|
||||
success: res => {
|
||||
console.log(res);
|
||||
if (res.data.length > 0) {
|
||||
this.setData({
|
||||
dataobj: res.data[0]
|
||||
}, () => {
|
||||
console.log(this.data.dataobj);
|
||||
});
|
||||
} else {
|
||||
console.log("没有数据");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.get_data()
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<!--pages/news.wxml-->
|
||||
|
||||
<view class="box">
|
||||
<text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <navigator url="../logs/logs" open-type="navigate">点我跳转 -->
|
||||
<!-- </navigator> -->
|
||||
<image src="../../image/shenpan.jpg" style="width: 100%;" >
|
||||
</image>
|
||||
|
||||
<view style="height: 100rpx;">
|
||||
|
||||
</view>
|
||||
<view>姓名:{{dataobj.name}}</view>
|
||||
<view>学号:{{dataobj.xuehao}}</view>
|
||||
|
||||
<view>
|
||||
分数:{{dataobj.score}}
|
||||
|
||||
</view>
|
||||
<view style="height: 100rpx;">
|
||||
积分加1但是请重复刚才的问题
|
||||
</view>
|
||||
<button type="default" bind:tap="updateScoreForIndex_j05">我记得</button>
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
<button type="default" bind:tap="updateScoreForIndex_jian1">忘了
|
||||
</button>
|
||||
|
@ -0,0 +1,6 @@
|
||||
/* pages/1/1.wxss */
|
||||
.box{
|
||||
width: auto;
|
||||
height: 150rpx;
|
||||
background-color:white;
|
||||
}
|
@ -0,0 +1,250 @@
|
||||
// pages/4/4.js
|
||||
const db = wx.cloud.database(); // 获取数据库实例
|
||||
const app = getApp(); // 获取全局应用实例
|
||||
|
||||
|
||||
Page({
|
||||
async updateScoreForIndex_05() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score + 0.5; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../5-1/5-1'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
async updateScoreForIndex_1() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score + 1; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../52/52'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
async updateScoreForIndex_2() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score + 2; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../53/53'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
async updateScoreForIndex_3() {
|
||||
try {
|
||||
// 显示加载动画
|
||||
wx.showLoading({
|
||||
title: '加载中...', // 可以自定义加载中的提示文字
|
||||
mask: true // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
|
||||
// 查找 index 为 chosen_index 的记录
|
||||
const res = await db.collection('demolist').where({ index: app.globalData.chosen_index }).get();
|
||||
const data = res.data;
|
||||
|
||||
if (data.length === 0) {
|
||||
console.log('没有找到 index 为 chosen_index 的数据');
|
||||
wx.hideLoading(); // 隐藏加载动画
|
||||
return;
|
||||
}
|
||||
|
||||
const record = data[0];
|
||||
const newScore = record.score + 3; // 更新后的 score 值
|
||||
|
||||
// 更新记录中的 score 属性
|
||||
await db.collection('demolist').doc(record._id).update({
|
||||
data: {
|
||||
score: newScore
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`更新成功,新的 score 值为:${newScore}`);
|
||||
|
||||
// 数据更新成功后隐藏加载动画并跳转
|
||||
wx.hideLoading();
|
||||
wx.redirectTo({
|
||||
url: '../54/54'
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('更新失败:', error);
|
||||
wx.hideLoading(); // 如果出错也隐藏加载动画
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
get_data() {
|
||||
const chosenIndex = app.globalData.chosen_index; // 获取 chosen_index
|
||||
db.collection("demolist").where({ index: chosenIndex }).get({
|
||||
success: res => {
|
||||
console.log(res);
|
||||
if (res.data.length > 0) {
|
||||
this.setData({
|
||||
dataobj: res.data[0]
|
||||
}, () => {
|
||||
console.log(this.data.dataobj);
|
||||
});
|
||||
} else {
|
||||
console.log("没有数据");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
dataobj: undefined
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.get_data()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<!--pages/4/4.wxml-->
|
||||
|
||||
<view class="box">
|
||||
<text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <navigator url="../logs/logs" open-type="navigate">点我跳转 -->
|
||||
<!-- </navigator> -->
|
||||
<image src="../../image/shenpan.jpg" style="width: 100%;" >
|
||||
</image>
|
||||
<view>姓名:{{dataobj.name}}</view>
|
||||
<view>学号:{{dataobj.xuehao}}</view>
|
||||
|
||||
<view>
|
||||
分数:{{dataobj.score}}
|
||||
|
||||
</view>
|
||||
<view style="height: 200rpx;">
|
||||
积分加0.5但是请回答这个问题
|
||||
</view>
|
||||
|
||||
<button type="default" bind:tap="updateScoreForIndex_05">不会,嘴硬</button>
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
<button type="default" bind:tap="updateScoreForIndex_1">看我操作</button>
|
||||
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
<button type="default" bind:tap="updateScoreForIndex_2">包会的</button>
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
<button type="default" bind:tap="updateScoreForIndex_3">恭喜,完美回答</button>
|
@ -0,0 +1,6 @@
|
||||
/* pages/1/1.wxss */
|
||||
.box{
|
||||
width: auto;
|
||||
height: 100rpx;
|
||||
background-color:white;
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
// pages/42/42.js
|
||||
const db = wx.cloud.database();
|
||||
const app = getApp(); // 获取全局应用实例
|
||||
Page({
|
||||
data: {
|
||||
dataobj: undefined
|
||||
},
|
||||
get_data() {
|
||||
const chosenIndex = app.globalData.chosen_index; // 获取 chosen_index
|
||||
db.collection("demolist").where({ index: chosenIndex }).get({
|
||||
success: res => {
|
||||
console.log(res);
|
||||
if (res.data.length > 0) {
|
||||
this.setData({
|
||||
dataobj: res.data[0]
|
||||
}, () => {
|
||||
console.log(this.data.dataobj);
|
||||
});
|
||||
} else {
|
||||
console.log("没有数据");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.get_data()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<!--pages/news.wxml-->
|
||||
|
||||
<view class="box">
|
||||
<text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <navigator url="../logs/logs" open-type="navigate">点我跳转 -->
|
||||
<!-- </navigator> -->
|
||||
<image src="../../image/shenpaizhang.jpg" style="width: 100%;" >
|
||||
</image>
|
||||
<view style="height: 50rpx;">
|
||||
减一分
|
||||
</view>
|
||||
|
||||
<view>姓名:{{dataobj.name}}</view>
|
||||
<view>学号:{{dataobj.xuehao}}</view>
|
||||
<view >
|
||||
分数:{{dataobj.score}}
|
||||
</view>
|
||||
<button type="default"><navigator url="../2/2" open-type="redirect">有请下一位</navigator>
|
||||
</button>
|
||||
<view style="height: 50rpx;">
|
||||
</view>
|
||||
<button type="default" ><navigator url="../1/1" open-type="redirect">结束本次点名</navigator>
|
||||
</button>
|
||||
|
@ -0,0 +1,6 @@
|
||||
/* pages/1/1.wxss */
|
||||
.box{
|
||||
width: auto;
|
||||
height: 100rpx;
|
||||
background-color:white;
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
// pages/5-1/5-1.js
|
||||
const db = wx.cloud.database();
|
||||
const app = getApp(); // 获取全局应用实例
|
||||
|
||||
Page({
|
||||
data: {
|
||||
dataobj: undefined
|
||||
},
|
||||
get_data() {
|
||||
const chosenIndex = app.globalData.chosen_index; // 获取 chosen_index
|
||||
db.collection("demolist").where({ index: chosenIndex }).get({
|
||||
success: res => {
|
||||
console.log(res);
|
||||
if (res.data.length > 0) {
|
||||
this.setData({
|
||||
dataobj: res.data[0]
|
||||
}, () => {
|
||||
console.log(this.data.dataobj);
|
||||
});
|
||||
} else {
|
||||
console.log("没有数据");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.get_data()
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
/* pages/1/1.wxss */
|
||||
.box{
|
||||
width: auto;
|
||||
height: 100rpx;
|
||||
background-color:white;
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
// pages/52/52.js
|
||||
const db = wx.cloud.database();
|
||||
const app = getApp(); // 获取全局应用实例
|
||||
|
||||
Page({
|
||||
data: {
|
||||
dataobj: undefined
|
||||
},
|
||||
get_data() {
|
||||
const chosenIndex = app.globalData.chosen_index; // 获取 chosen_index
|
||||
db.collection("demolist").where({ index: chosenIndex }).get({
|
||||
success: res => {
|
||||
console.log(res);
|
||||
if (res.data.length > 0) {
|
||||
this.setData({
|
||||
dataobj: res.data[0]
|
||||
}, () => {
|
||||
console.log(this.data.dataobj);
|
||||
});
|
||||
} else {
|
||||
console.log("没有数据");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.get_data()
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|