miniprogram

kongweiyu_branch
温雍敬 2 years ago
commit b8d89aac7e

@ -0,0 +1,6 @@
{
"permissions": {
"openapi": [
]
}
}

@ -0,0 +1,9 @@
const saveProfile = require('./saveProfile/index')
// 云函数入口函数
exports.main = async (event, context) => {
switch (event.type) {
case 'saveProfile':
return await getProfile.main(event, context);
}
};

@ -0,0 +1,14 @@
{
"name": "db",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,28 @@
const cloud = require('wx-server-sdk');
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database();
// 保存个人信息云函数入口函数
exports.main = async (event, context) => {
// 返回数据库结果
return db.collection('user_Data').add({
// data 字段表示需新增的 JSON 数据
data: {
// _id: 'todo-identifiant-aleatoire', // 可选自定义 _id在此处场景下用数据库自动分配的就可以了
user_Name: "learn cloud database",
user_Sex: null,
user_Age: null,
user_Phone: null,
user_Addr: null,
isTeacher: false
},
success: function(res) {
// res 是一个对象,其中有 _id 字段标记刚创建的记录的 id
console.log(res)
}
})
};

@ -0,0 +1,6 @@
{
"permissions": {
"openapi": [
]
}
}

@ -0,0 +1,9 @@
const saveProfile = require('./saveProfile/index')
// 云函数入口函数
exports.main = async (event, context) => {
switch (event.type) {
case 'saveProfile':
return await saveProfile.main(event, context);
}
};

File diff suppressed because it is too large Load Diff

@ -0,0 +1,14 @@
{
"name": "db",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,26 @@
// cloud.init({
// env: cloud.DYNAMIC_CURRENT_ENV
// });
const db = wx.cloud.database();
// 保存个人信息云函数入口函数
exports.main = async (event, context) => {
// 返回数据库结果
return db.collection('user_Data').add({
// data 字段表示需新增的 JSON 数据
data: {
// _id: 'todo-identifiant-aleatoire', // 可选自定义 _id在此处场景下用数据库自动分配的就可以了
user_Name: "1",
user_Sex: null,
user_Age: null,
user_Phone: null,
user_Addr: null,
isTeacher: false
},
success: function(res) {
// res 是一个对象,其中有 _id 字段标记刚创建的记录的 id
console.log(res)
}
})
};

@ -1,4 +1,83 @@
const db = wx.cloud.database().collection("teacher_Data")
// pages/Tprofile/Tprofile.js
Page({
<<<<<<< HEAD
=======
/**
* 页面的初始数据
*/
data: {
},
submit: (e)=> {
console.log(e.detail.value)
db.add({
data: e.detail.value,
success: (res) => {
console.log(res)
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
>>>>>>> 6015f30e13144ccd1fb5bbdf8627e332769439a1
})

@ -1,5 +1,6 @@
<!--pages/Tprofile/Tprofile.wxml-->
<view class="container">
<<<<<<< HEAD
<view class="input-group">
<text>姓名:</text>
<input type="text" placeholder="请输入您的姓名" class="input" />
@ -141,3 +142,41 @@
<!-- 添加提交按钮 -->
<button bindtap="submitForm" class="submit-btn">提交</button>
</view>
=======
<form bindsubmit="submit">
<!-- todo: 修改数据,绑定输入 -->
<view class="form-group">
<text>姓名:</text>
<input type="text" placeholder="请输入您的姓名" />
</view>
<view class="form-group">
<text>手机号码:</text>
<input type="tel" placeholder="请输入您的手机号码" />
</view>
<view class="form-group">
<text>电子邮箱:</text>
<input type="email" placeholder="请输入您的电子邮箱" />
</view>
<view class="form-group">
<text>教师证号:</text>
<input type="text" placeholder="请输入您的教师证号" />
</view>
<view class="form-group">
<text>密码:</text>
<input type="password" placeholder="请输入您的密码" />
</view>
<view class="form-group">
<text>确认密码:</text>
<input type="password" placeholder="请再次输入您的密码" />
</view>
<button class="btn-submit">提交</button>
</form>
</view>
>>>>>>> 6015f30e13144ccd1fb5bbdf8627e332769439a1

@ -1,26 +1,47 @@
const db = wx.cloud.database().collection("user_Data");
Page({
//页面数据
data:{
date:"",
birthday: "",
region:"",
},
submit:function(e){
console.log(e);
//表单提交方法
submit: function(e){
console.log(e.detail.value);
//todo: 添加输入检测
//往数据库里插入的方法
db.add({
//传入数据
data: e.detail.value,
//成功后执行的方法
success:(res) => {
console.log(res)
}
})
},
goToPageTpro: function() {
//跳转至教师信息页面
navigateToPageTpro: function() {
wx.navigateTo({
url: '/pages/Tprofile/Tprofile',
})
},
dateChange:function(e){
//更新页面的生日信息
dateChange: function(e){
this.setData({
date:e.detail.value,
birthday: e.detail.value,
});
},
regionChange:function(e){
//更新页面的地区信息
regionChange: function(e){
this.setData({
region:e.detail.value,
region: e.detail.value,
});
},
}
});

@ -1,23 +1,23 @@
<view class="body">
<form bindsubmit="submit">
<view class="button-container" >
<button bindtap="goToPageTpro">Be a teacher</button>
<button bindtap="navigateToPageTpro">Be a teacher</button>
</view>
<view class="section">
<view class="title">昵称:</view>
<input type="nickname" class="input"name="nickname"placeholder="昵称" />
<input type="nickname" class="input" name="nickname" placeholder="昵称" />
</view>
<view class="section">
<view class="title">性别:</view>
<radio-group class="mg" name="gender">
<label >
<radio value="nan" />
<radio value="man" />
</label>
<label >
<radio value="nv" />
<radio value="woman" />
</label>
</radio-group>
@ -25,32 +25,32 @@
<view class="section">
<view class="title">年龄:</view>
<picker bindchange="dateChange" fields="year" value="{{date}}"mode="date"class="input"name="date">
<view class="picker">出生年:{{date}}</view>
<picker bindchange="dateChange" fields="year" value="{{birthday}}" mode="date" class="input" name="birthday">
<view class="picker">出生年:{{birthday}}</view>
</picker>
</view>
<view class="section">
<view class="title">地区:</view>
<picker bindchange="regionChange" value="{{region}}" value="{{region}}"mode="region"class="input"name="region">
<picker bindchange="regionChange" value="{{region}}" value="{{region}}"mode="region" class="input" name="region">
<view class="picker">当前选择:{{region}}</view>
</picker>
</view>
<view class="section">
<view class="title">可以添加到你的联系方式:</view>
<input type="input" class="input"name="code"placeholder="昵称" />
<input type="input" class="input" name="contact" placeholder="请输入" />
</view>
<view class="section">
<view class="title">你的基本情况:</view>
<input type="input" class="input"name="code"placeholder="昵称" />
<input type="input" class="input" name="information" placeholder="请输入" />
</view>
<view class="area">
<button style="margin:30rpx 0"type="primary"
<button style="margin:30rpx 0" type="primary"
form-type="submit">提交</button>
<button style="margin:30rpx 0"type="reset"
<button style="margin:30rpx 0" type="reset"
form-type="submit">重置</button>
</view>
</form>

Loading…
Cancel
Save