王西霖.branch^2
王壕 3 years ago
parent 3719f76121
commit 0a867b0480

@ -1 +0,0 @@
Subproject commit 97989f10ff0550c04566286966fcb0a8db53f446

@ -0,0 +1,47 @@
{
"pages": [
"pages/index/index",
"pages/menu/menu",
"pages/my/my",
"pages/bd/bd",
"pages/uploadfile/uploadfile",
"pages/list/list",
"pages/operation/operation",
"pages/list1/list1",
"pages/operation1/operation1",
"pages/mmm/mmm",
"pages/submit/submit",
"pages/dragon/dragon"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "班级通",
"navigationBarTextStyle": "black"
},
"tabBar": {
"selectedColor": "#33a3dc",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "/static/index/index.png",
"selectedIconPath": "/static/index/index_active.png"
},
{
"pagePath": "pages/menu/menu",
"text": "菜单",
"iconPath": "/static/menu/menu.png",
"selectedIconPath": "/static/menu/menu_active.png"
},
{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "/static/my/my.png",
"selectedIconPath": "/static/my/my_active.png"
}
]
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

@ -0,0 +1,20 @@
// app.ts
App<IAppOption>({
globalData: {
},
onLaunch() {
// 展示本地存储能力
// const logs = wx.getStorageSync('logs') || []
// logs.unshift(Date.now())
// wx.setStorageSync('logs', logs)
// 登录
// wx.login({
// success: res => {
// console.log(res.code)
// 发送 res.code 到后台换取 openId, sessionKey, unionId
// },
// })
},
})

@ -0,0 +1,6 @@
/**app.wxss**/
page {
height: 100%;
overflow-y: scroll;
background: rgb(243, 243, 243);
}

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "任务信息列表"
}

@ -0,0 +1,138 @@
// pages/list/list.js
Page({
/**
*
*/
data: {
list:[]
},
/**
* --
*/
onLoad: function () {
},
/**
* --
*/
onReady: function () {
},
/**
* --
* Show
*/
onShow: function () {
//这里的this是指窗口而在request中this是指onShow方法(因为是页面调用onShow,onShow调用request),所以要先定义
var that = this;
wx.request({
//后端接口提供的url
url: 'http://localhost:81/task/taskList',
method:'GET',
//需要传入的参数
data:{},
success:function(res :any){
var list = res.data.data;
if(list == null){
//如果获取数据失败,提示使用者
var toastText = '获取数据失败' + res.data.msg;
wx.showToast({
title: toastText,
//显示时长为2s
duration:2000
})
}else{
that.setData({
list:list
})
}
}
})
},
/**
* --
*/
onHide: function () {
},
/**
* --
*/
onUnload: function () {
},
/**
* --
*/
onPullDownRefresh: function () {
},
/**
*
*/
onReachBottom: function () {
},
/**
*
*/
onShareAppMessage: function () {
},
addTask: function(){
wx.navigateTo({
url: '../operation/operation',
})
},
//e表示响应的控件
delTask: function(e :any){
var that = this;
//相当于confirm窗口
wx.showModal({
title: '提示',
//这里的变量名需要与响应控件的data-后面的变量名相同
content: '确认要删除['+e.target.dataset.name+']吗?',
success:function(sm){
if(sm.confirm){
wx.request({
url: 'http://localhost:81/task/delete',
data: {'id':e.target.dataset.id},
header: {
//默认是 'content-type': 'application/json'要传post的参数必须写成这样要传delete参数则为null
"content-type": "application/x-www-form-urlencoded"
},
method: 'DELETE',
success: function(res:any) {
var result = res.data.success;
var toastText='删除成功';
if(result == true){
that.data.list.splice(e.target.dataset.index,1);
that.setData({
list:that.data.list
});
}else{
toastText = '删除失败';
}
wx.showToast({
title: toastText,
duration:2000
})
},
})
}
}
})
}
})

@ -0,0 +1,31 @@
<!--pages/list/list.wxml-->
<view class='container'>
<view class='widget'>
<text class='column'>您发布的任务信息如下:</text>
</view>
<scroll-view scroll-y="true">
<!--遍历list变量名要和js中的名字相同且item是定值不可修改 -->
<block class='widget' wx:for="{{list}}">
<view class='widget'>
<text class='row'>ID:</text>
<text class='row'>{{item.id}}</text>
<text class='column'>名字:</text>
<text class='column'>{{item.name}}</text>
<view>
<text class='column'>信息:</text>
<text class='column'>{{item.property}}</text>
</view>
<text class='column'>时间:</text>
<text class='column'>{{item.deadtime}}</text>
<text class='link-row'>任务编辑:</text>
<view class='link-row'>
<navigator class='link' url='../operation/operation?id={{item.id}}'>编辑</navigator>|
<text class='link' bindtap='delTask' data-id='{{item.id}}' data-index='{{index}}' data-name='{{item.name}}'>删除
</text>
</view>
</view>
</block>
<button type='primary' bindtap='addTask'>添加任务信息</button>
</scroll-view>
</view>

@ -0,0 +1,40 @@
/* pages/list/list.wxss */
.container{
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
padding-top: 10rpx;
padding-bottom: 10rpx;
}
.widget{
position: relative;
margin-top: 5rpx;
margin-bottom: 5rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
padding-left: 5rpx;
padding-right: 4rpx;
border: rgb(16, 196, 157) 1px solid;
}
.row{
width: 3rem;
display: table-cell;
}
.form-box picker{
margin: 30rpx 30rpx 0 0;
color: rgb(187, 19, 19);
}
.link-row{
width: 5rem;
display: table-cell;
}
.link{
color: blue;
display: inline-table;
}

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,99 @@
// pages/mmm/mmm.ts
Page({
/**
*
*/
data: {
mmm:'',
releaseFlag: false
},
/**
* --
*/
onLoad: function () {
},
atbutton(){
let skey = wx.getStorageSync('skey')
var that = this
wx.request({ //请求地址
url: 'http://127.0.0.1:81/getrcode',
method: 'GET',
data:{
skey:skey},
header: { //请求头
'content-type': 'application/json'
// "Content-Type": "application/x-www-form-urlencoded"
},
success: function (res:any) {
wx.showModal({
title: '验证码',
content: res.data
})
if (res.confirm) {//这里是点击了确定以后
console.log('用户点击确定')
} else {//这里是点击了取消以后
console.log('用户点击取消')
}
},
})
},
/**
* --
*/
onReady() {
},
/**
* --
*/
onShow() {
},
/**
* --
*/
onHide() {
},
/**
* --
*/
onUnload() {
},
/**
* --
*/
onPullDownRefresh() {
},
/**
*
*/
onReachBottom() {
},
/**
*
*/
onShareAppMessage() {
}
})

@ -0,0 +1,6 @@
<!--pages/mmm/mmm.wxml-->
<view class="page-body">
<view class="btn-area" id="buttonContainer" catchtap="atbutton">
<button type="primary" >获取验证码</button>
</view>
</view>

@ -0,0 +1,5 @@
/* pages/mmm/mmm.wxss */
button{
margin-top: 30rpx;
margin-bottom: 30rpx;
}

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "任务信息表单"
}

@ -0,0 +1,147 @@
// logs.ts
// const util = require('../../utils/util.js')
import { formatTime } from '../../utils/util'
Page({
data: {
logs: [],
taskList: [],
taskFlag: false,
releaseFlag: false,
id:undefined,
name:'',
property:'',
stuid:'',
deadtime:'',
addUrl:'http://localhost:81/task/addTask',
updateUrl:'http://localhost:81/task/taskInfo',
from: {
taskName: "",
end: ""
}
},
inputFrom(event:any) {
if (event.currentTarget.dataset.gater == "from.end") {
let num = event.detail.value;
if (num.length == 4) num += "-";
if (num.length == 7) num += "-";
this.setData({ [`from.end`]: num })
} else if(event.currentTarget.dataset.gater == "from.taskName"){
this.setData({
[`${event.currentTarget.dataset.gater}`]: event.detail.value
})
}else{
this.setData({
[`${event.currentTarget.dataset.gater}`]: event.detail.value
})
}
},
addSelect() {
const { taskName, end } = this.data.from;
if (end.length != 10) return;
if (!taskName || !end) {
wx.showToast({
title: "请填写任务名称和任务进度",
icon: 'error',
});
return;
}
const list = wx.getStorageSync("taskList") || [];
const index = list.findIndex((item:any) => item.title == taskName);
if (index >= 0) {
wx.showToast({
title: "任务名称重复",
icon: 'error',
});
return;
}
const data = {
id: list.length + 1,
title: taskName,
startTime: formatTime(new Date), endTime: end, end: '40',
}
list.push(data)
wx.setStorageSync("taskList", list);
wx.showToast({
title: "发布成功",
icon: 'success',
});
this.setData({
taskList: wx.getStorageSync("taskList") || []
});
},
formSubmit:function(e:any){
var that = this;
//获取表单值
var formData = e.detail.value;
var url = this.data.addUrl;
if(this.data.id != undefined){
//如果是编辑按钮跳转
formData.id = this.data.id;
url = this.data.updateUrl;
}
console.log(JSON.stringify(formData));
wx.request({
url: url,
//将其转换成JSON
data: JSON.stringify(formData),
method: 'POST',
success: function(res:any) {
var result = res.data.success;
var toastText = '请求成功';
if(!result){
toastText = '请求失败'+res.data.msg;
}
wx.showToast({
title: toastText,
duration: 2000,
})
if(result){
wx.redirectTo({
//操作结束后跳转回列表页
url: '../list/list',
})
}
},
})
},
atTaskFlag() {
this.setData({ taskFlag: !this.data.taskFlag })
},
onShow() {
this.setData({
taskList: wx.getStorageSync("taskList") || []
});
},
onLoad: function (options:any) {
//options为页面跳转带来的参数
var that = this;
if(options.id != undefined){
//若是由编辑按钮跳转过来的
that.setData({
id:options.id
});
wx.request({
url: 'http://localhost:81/task/one',
data: {'id':options.id},
method: 'GET',
success: function(res:any) {
var result = res.data.success;
if(result){
that.setData({
areaName:res.data.data.name,
priority: res.data.data.priority
});
}else{
wx.showToast({
title: '请求失败'+res.data.msg,
duration: 2000,
});
}
},
})
}
},
})

@ -0,0 +1,19 @@
<view class="release-view">
<form bindsubmit='formSubmit' bindreset='formReset'>
<label>任务名称
<input type='text' name='name' placeholder='请输入任务名' value='{{name}}'></input>
</label>
<label>任务结束时间
<input type="text" name="deadtime" value="{{deadtime}}" placeholder="输入任务结束时间" ></input>
</label>
<label>任务详情
<input type="text" name="property" value="{{property}}" placeholder="输入任务详情" ></input>
</label>
<view class='row'>
<button type='primary' form-type='submit' catchtap="addSelect">提交</button>
<button type='primary' form-type='reset'>清空</button>
</view>
</form>
</view>

@ -0,0 +1,69 @@
/* pages/opration/opration.wxss */
.row input {
font-size: 0.7rem;
flex-grow: 3;
border: ipx solid #09c;
display: inline-block;
border-radius: 0.3rem;
box-shadow: 0 0 0.15rem #aaa;
padding: 0.3rem;
}
.row button {
padding: 0.3rem;
margin: 3rem 1rem;
}
.container {
padding: 1rem;
font-size: 0.9rem;
line-height: 1.5rem;
}
.row {
display: flex;
align-items: center;
margin-bottom: 0.8rem;
}
.row text {
flex-grow: 1.5;
text-align: right;
}
.form-box picker{
margin: 30rpx 30rpx 0 0;
color: rgb(153, 153, 153);
}
.title {
background: #fff;
display: inline-block;
border-radius: 4px;
padding: 4px;
margin: 10px 0;
position: relative;
}
.title::after {
content: "";
position: absolute;
top: 50%;
width: 100vw;
height: 4px;
background: #fff;
}
.release-view{
padding: 8px;
background-color: #fff;
border-radius: 4px;
}
.release-view input{
border: 1px #ccc solid;
border-radius: 4px;
margin: 6px 0;
padding: 4px;
}

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "请完成任务提交"
}

@ -0,0 +1,140 @@
// sumbit.ts
// pages/list/list.js
Page({
/**
*
*/
data: {
id:"",
name: "",
property:""
},
onUpload(){
let that=this
let skey=wx.getStorageSync('skey')
wx.chooseMessageFile({
count:1,
success(res) {
const tempFilePaths = res.tempFiles;
console.log(tempFilePaths[0])
//that.filename = res.tempFiles[0].name
//将保存在微信暂存区的文件上传到你项目的保存地址
//将保存在微信暂存区的文件上传到你项目的保存地址
wx.uploadFile({
url: 'http://127.0.0.1:81/taskupload',//这里的url是你项目文件上传的接口
filePath: tempFilePaths[0].path,//这是你上传文件到微信暂存区的 路径
name: 'file',
//这里也是为小程序在真机测试校验协议时能够被通过,
//你可以直接在 data里面定义这个变量上面那个方法里面的headers可以不定义。
header:{
'Content-Type': "multipart/form-data"
},
//这个是上传文件 需要的参数,具体看你们项目接口需要提交的参数
formData: {
skey:skey,
Task_id:that.data.id
},
success (res){
const data = res.data
if(res.data == "upload successful"){
console.log("success")
}else{
console.log("fail")
}
}
})
},
});
},
/**
* --
*/
onLoad: function(option){
//获取通信通道
var that = this;
const eventChannel = this.getOpenerEventChannel()
// 监听acceptDataFromOpenerPage事件获取上一页面通过eventChannel传送到当前页面的数据
eventChannel.on('id', function(data) {
//对发送过来的数据进行处理
console.log(data.id)
that.setData({
id: data.id
})
})
eventChannel.on('name', function(data) {
//对发送过来的数据进行处理
console.log(data),
that.setData({
name: data.id
})
})
eventChannel.on('property', function(data) {
//对发送过来的数据进行处理
console.log(data),
that.setData({
property: data.id
})
})
//向上一页面发送数据
eventChannel.emit('acceptDataFromOpenedPage', {data: 'test'});
eventChannel.emit('someEvent', {data: 'test'});
},
/**
* --
*/
onReady: function () {
},
/**
* --
* Show
*/
onShow: function () {
console.log('通过缓存传递参数',wx.getStorageSync('id'))
},
/**
* --
*/
onHide: function () {
},
/**
* --
*/
onUnload: function () {
},
/**
* --
*/
onPullDownRefresh: function () {
},
/**
*
*/
onReachBottom: function () {
},
/**
*
*/
onShareAppMessage: function () {
},
submitTask: function(){
wx.navigateTo({
url: '../submit/submit',
})
},
})

@ -0,0 +1,32 @@
<!--pages/submit/submit.wxml-->
<!-- <view class="task-item -title"><test>任务名称:</test> {{item.id}}</view> -->
<swiper indicator-dots="{{true}}" autoplay="{{true}}" interval="{{4000}}">
<swiper-item>
<view class="swiper-item">
<image src="/static/sumbit/OIP-C.jpg"></image>
</view>
</swiper-item>
</swiper>
<scroll-view scroll-y="true">
<!--遍历list变量名要和js中的名字相同且item是定值不可修改 -->
<block class='widget'>
<view class='widget'>
<text class='column'>您提交的任务信息如下:</text>
</view>
<view class='widget'>
<view class="column">
<text class='column'>ID{{id}}</text>
</view>
<view class="column">
<test>任务名称: {{name}}</test>
</view>
<view class="column">
<test>任务内容: {{property}} </test>
</view>
</view>
<button type='primary' bindtap='onUpload'>选择文件</button>
</block>
</scroll-view>

@ -0,0 +1,67 @@
/* pages/submit/submit.wxss */
.wrip-view {
height: 100%;
}
.image {
height: 120%;
position: relative;
}
.swip {
background: rgb(243, 243, 243);
position: relative;
}
.swip-text {
position: absolute;
width: 100%;
z-index: 100;
text-align: center;
font-size: 20px;
color: rgb(95, 95, 95);
}
.container{
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
padding-top: 10rpx;
padding-bottom: 10rpx;
}
.widget{
position: relative;
margin-top: 5rpx;
margin-bottom: 5rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
padding-left: 5rpx;
padding-right: 4rpx;
border: rgb(16, 196, 157) 1px solid;
}
.row{
width: 3rem;
font-size:larger;
display: table-cell;
}
.column{
font-size:larger;
}
.form-box picker{
margin: 30rpx 30rpx 0 0;
color: rgb(187, 19, 19);
}
.link-row{
width: 5rem;
display: table-cell;
}
.link{
color: blue;
display: inline-table;
}

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -0,0 +1,19 @@
export const formatTime = (date: 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: number) => {
const s = n.toString()
return s[1] ? s : '0' + s
}
Loading…
Cancel
Save