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

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

@ -0,0 +1,95 @@
// 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/dragon/addDragon',
updateUrl:'http://localhost:81/dragon/dragonInfo',
from: {
taskName: "",
end: ""
}
},
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: '../list1/list1',
})
}
},
})
},
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/dragon/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,18 @@
<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;
}

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

@ -1,140 +0,0 @@
// 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',
})
},
})

@ -1,32 +0,0 @@
<!--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>

@ -1,67 +0,0 @@
/* 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;
}
Loading…
Cancel
Save