1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

add miniprogram

This commit is contained in:
2022-11-05 15:28:03 +08:00
parent a410d97efd
commit 470d332fc2
155 changed files with 5371 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
// pages/person/count.js
Page({
/**
* 页面的初始数据
*/
data: {
useranme:'',
name:'',
radio1: [{name:'管理员',value:'1'},{name:'学生',value:'2',checked: 'true'}],
role:'2'
},
radioChange: function(e) {
this.setData({
role:e.detail.value
})
},
username: function (e) {
this.setData({
username: e.detail.value
})
},
name: function (e) {
this.setData({
name: e.detail.value
})
},
submit:function () {
var that = this
wx.request({
url: 'http://127.0.0.1:8080/user/addUser',
data: {
username: this.data.username,
name: this.data.name,
role: this.data.role
},
success: function (d) {
if (d.data.data == "添加成功") {
wx.showToast({
title: d.data.data,
icon: 'success',
duration: 2000,
})
that.onLoad();
}else{
wx.showToast({
title: d.data.data,
icon: 'error',
duration: 2000,
})
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

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

View File

@@ -0,0 +1,21 @@
<view class="perason">
账号/学号(密码默认与账号相同):
<view class="issues-panel">
<input class="issues-input" bindinput="username" />
</view>
姓名:
<view class="issues-panel">
<input class="issues-input" bindinput="name" />
</view>
角色:
<view>
<radio-group class="weui-cell weui-cell_active" style="display: flex;text-align: center;" bindchange="radioChange">
<label class="radio" wx:for="{{radio1}}" style="margin-right: 60px;">
<radio value="{{item.value}}" checked="{{item.checked}}" />{{item.name}}
</label>
</radio-group>
</view>
<view class="submit-btn" bindtap="submit">
<text>提交</text>
</view>
</view>

View File

@@ -0,0 +1,114 @@
/* pages/other/password.wxss *//**issuse.wxss**/
.perason{
background-color: #f6f6f6;
padding: 0 15px;
padding-top: 30rpx;
font-size: 11pt;
box-sizing: border-box;
position: relative;
min-height: 100%;
display: flex;
flex-direction: column;
padding-bottom: 100rpx;
}
.issues-label{
font-size: 10pt;
line-height: 100%;
color: #999;
margin: 25rpx 20rpx 15rpx;
}
.issues-panel{
margin-bottom: 10px;
display: flex;
flex-direction: column;
align-items: stretch;
background-color: #fff;
border-top: 1px solid #e5e5e5;
border-bottom: 1px solid #e5e5e5;
}
.issues-img-panel{
display: flex;
flex-wrap: wrap;
background-color: #fff;
border-top: 1px solid #e5e5e5;
border-bottom: 1px solid #e5e5e5;
padding: 15rpx 25rpx;
}
.issues-input{
border-bottom: 1px solid #e5e5e5;
padding: 15rpx 25rpx;
}
.issues-textarea{
padding: 25rpx;
min-height: 225rpx;
}
.issues-photo-item {
position: relative;
display: flex;
align-items: center;
justify-content: center;
color: #888;
margin: 20rpx;
margin-right: 0;
width: 135rpx;
height: 135rpx;
border: 1rpx solid #e5e5e5;
border-radius: 5rpx;
}
.issues-photo-item:active{
opacity: .8;
}
.issues-photo-item .remind-img{
padding: 0;
}
.issues-photo-item image{
width: 100%;
height: 100%;
}
.add-photo:active {
background: #f0f0f0;
}
.add-photo::before, .add-photo::after{
content: '';
position: absolute;
top: 50%;
left: 50%;
background: #e5e5e5;
}
.add-photo:active::before, .add-photo:active::after{
background: #ddd;
}
.add-photo::before {
width: 10rpx;
height: 80rpx;
margin-top: -40rpx;
margin-left: -5rpx;
}
.add-photo::after {
width: 80rpx;
height: 10rpx;
margin-top: -5rpx;
margin-left: -40rpx;
}
.issues-remind {
flex: 1;
font-size: 9pt;
line-height: 135%;
color: #ccc;
padding: 0 30rpx;
word-break: break-all;
text-indent: 1em;
padding-top: 30rpx;
}
.submit-btn {
display: flex;
align-items: center;
justify-content: center;
margin: 40rpx 3%;
height: 80rpx;
border-radius: 3px;
text-align: center;
background-color: #FF8966;
color: #fff;
font-size: 12pt;
}

View File

@@ -0,0 +1,130 @@
// pages/person/info.js
Page({
/**
* 页面的初始数据
*/
data: {
id:wx.getStorageSync('id'),
name:wx.getStorageSync('name'),
stuId:wx.getStorageSync('stuId'),
img:''
},
personInfo() {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/user/person',
data: {
username: wx.getStorageSync('username'),
},success: function (d) {
that.setData({
img: d.data.img,
name: wx.getStorageSync('name'),
})
}
})
},
uploadImg: function () {
var that = this;
wx.chooseImage({
count: 1,
sizeType: 'compressed',
sourceType: ['album', 'camera'],
success (res) {
let imgbase64 = 'data:image/png;base64,' + wx.getFileSystemManager().readFileSync(res.tempFilePaths[0], "base64")
that.setData({
img: imgbase64,
})
}
})
},
update: function () {
wx.request({
url: 'http://127.0.0.1:8080/user/updateImg',
data: {
id: this.data.id,
img: this.data.img
},success: function (d) {
if (d.data != "修改失败") {
wx.showToast({
title: d.data,
icon: 'success',
duration: 2000,
success: function () {
setTimeout(function() {
wx.switchTab({
url: '../person/person'
})
}, 2000);
}
})
} else {
wx.showToast({
title: d.data,
icon: 'error',
duration: 2000
})
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
this.personInfo()
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

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

View File

@@ -0,0 +1,24 @@
<!--pages/person/info.wxml-->
<view class="person">
<view class="more-list">
<view class="more-btn" style="margin-top: 20px;" bindtap="uploadImg">
<text class="btn-text">头像</text>
<view class="btn-open">
<image class="user-avatar" src="{{img}}" style="margin-right: 10px;"></image>
<image class="btn-enter" src="/icon/person/enter.png"></image>
</view>
</view>
<view class="more-btn">
<text class="btn-text">姓名</text>
<view class="btn-open">{{name}}</view>
</view>
<view class="more-btn">
<text class="btn-text">学号</text>
<view class="btn-open">{{stuId}}</view>
</view>
</view>
<navigator bindtap='update' class="login-btn" url="none">
<text >提交修改</text>
</navigator>
</view>

View File

@@ -0,0 +1,111 @@
/* pages/person/info.wxss */
.person{
padding: 0;
}
.user-info, .more-btn {
display: flex;
min-height: 85rpx;
margin-bottom: 20rpx;
}
/**user-info**/
.user-info-box{
margin-bottom: 40rpx;
margin-top: 30rpx;
}
.user-info {
flex-direction: column;
padding: 25rpx 30rpx 20rpx;
}
.info-hd {
display: flex;
align-items: center;
}
.bind-btn {
color: #aaa;
}
.user-avatar {
width: 120rpx;
height: 120rpx;
border-radius: 5px;
}
.user-title {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 25rpx;
}
.time-box {
display: flex;
flex-direction: column;
align-items: center;
font-size: 10pt;
line-height: 140%;
color: #aaa;
}
.user-name {
font-size: 16pt;
line-height: 160%;
letter-spacing: 1px;
}
.user-id {
font-size: 11pt;
color: #8b8b8b;
}
.info-bd {
display: flex;
justify-content: space-between;
padding: 25rpx 15rpx 0 5rpx;
font-size: 11pt;
line-height: 150%;
color: #8b8b8b;
}
.info-bd-left, .info-bd-right {
display: flex;
flex-direction: column;
}
.info-bd-left{
flex-shrink: 0;
padding-right: 30rpx;
}
/**more-list**/
.more-list {
flex: 1;
display: flex;
flex-direction: column;
}
.more-btn {
align-items: center;
font-size: 13pt;
padding: 0 30rpx;
}
.issue-link, .about-link {
margin-bottom: 20rpx;
}
.btn-icon {
width: 45rpx;
height: 45rpx;
margin-right: 15rpx;
}
.btn-text {
flex: 1;
}
.btn-open {
display: flex;
align-items: center;
justify-content: flex-end;
margin-left: 10rpx;
}
.btn-enter {
width: 18rpx;
height: 27rpx;
}
.login-btn {
font-size: 13pt;
line-height: 85rpx;
height: 85rpx;
background: #e55c5c;
color: #fff;
text-align: center;
border-radius: 5px;
margin: 40rpx 3%;
}

View File

@@ -0,0 +1,63 @@
//issues.js
//获取应用实例
var app = getApp();
var util = require('../../utils/util')
Page({
data: {
title: '',
content: '',
time:''
},
titleInput: function (e) {
this.setData({
title: e.detail.value
})
},
contentInput: function (e) {
this.setData({
content: e.detail.value
})
},
submit:function () {
var TIME = util.formatTime(new Date());
wx.request({
url: 'http://127.0.0.1:8080/other/subFeedback',
data: {
title: this.data.title,
content: this.data.content,
time:TIME,
id:wx.getStorageSync('id')
},
success: function (d) {
if (d.data != "提交失败") {
wx.showToast({
title: d.data,
icon: 'success',
duration: 2000,
success: function () {
setTimeout(function() {
wx.switchTab({
url: '../person/person'
})
}, 2000);
}
})
} else {
wx.showToast({
title: d.data,
icon: 'error',
duration: 2000
})
}
}
})
},
onLoad: function(){
},
});

View File

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

View File

@@ -0,0 +1,10 @@
<!--issues.wxml-->
<view class="perason">
<view class="issues-panel">
<input class="issues-input" placeholder="请输入反馈标题" bindinput="titleInput" />
<textarea class="issues-textarea" placeholder="请输入反馈内容" bindinput="contentInput" auto-height></textarea>
</view>
<view class="submit-btn" bindtap="submit">
<text>提交反馈</text>
</view>
</view>

View File

@@ -0,0 +1,113 @@
/**issuse.wxss**/
.perason{
background-color: #f6f6f6;
padding: 0;
padding-top: 30rpx;
font-size: 11pt;
box-sizing: border-box;
position: relative;
min-height: 100%;
display: flex;
flex-direction: column;
padding-bottom: 100rpx;
}
.issues-label{
font-size: 10pt;
line-height: 100%;
color: #999;
margin: 25rpx 20rpx 15rpx;
}
.issues-panel{
display: flex;
flex-direction: column;
align-items: stretch;
background-color: #fff;
border-top: 1px solid #e5e5e5;
border-bottom: 1px solid #e5e5e5;
}
.issues-img-panel{
display: flex;
flex-wrap: wrap;
background-color: #fff;
border-top: 1px solid #e5e5e5;
border-bottom: 1px solid #e5e5e5;
padding: 15rpx 25rpx;
}
.issues-input{
border-bottom: 1px solid #e5e5e5;
padding: 15rpx 25rpx;
}
.issues-textarea{
padding: 25rpx;
min-height: 225rpx;
}
.issues-photo-item {
position: relative;
display: flex;
align-items: center;
justify-content: center;
color: #888;
margin: 20rpx;
margin-right: 0;
width: 135rpx;
height: 135rpx;
border: 1rpx solid #e5e5e5;
border-radius: 5rpx;
}
.issues-photo-item:active{
opacity: .8;
}
.issues-photo-item .remind-img{
padding: 0;
}
.issues-photo-item image{
width: 100%;
height: 100%;
}
.add-photo:active {
background: #f0f0f0;
}
.add-photo::before, .add-photo::after{
content: '';
position: absolute;
top: 50%;
left: 50%;
background: #e5e5e5;
}
.add-photo:active::before, .add-photo:active::after{
background: #ddd;
}
.add-photo::before {
width: 10rpx;
height: 80rpx;
margin-top: -40rpx;
margin-left: -5rpx;
}
.add-photo::after {
width: 80rpx;
height: 10rpx;
margin-top: -5rpx;
margin-left: -40rpx;
}
.issues-remind {
flex: 1;
font-size: 9pt;
line-height: 135%;
color: #ccc;
padding: 0 30rpx;
word-break: break-all;
text-indent: 1em;
padding-top: 30rpx;
}
.submit-btn {
display: flex;
align-items: center;
justify-content: center;
margin: 40rpx 3%;
height: 80rpx;
border-radius: 3px;
text-align: center;
background-color: #FF8966;
color: #fff;
font-size: 12pt;
}

View File

@@ -0,0 +1,101 @@
// pages/person/person.js
var app = getApp();
Page({
data: {
name:wx.getStorageSync('name'),
img:''
},
personInfo() {
var that = this;
wx.request({
url: 'http://127.0.0.1:8080/user/person',
data: {
username: wx.getStorageSync('username'),
},success: function (d) {
that.setData({
img: d.data.img,
name: wx.getStorageSync('name'),
})
}
})
},
quit: function () {
wx.showModal({
title: '提示',
content: '你确定要退出吗',
success: function (res) {
if (res.confirm) {
wx.clearStorageSync()
wx.navigateTo({
url: '../login/login'
})
wx.showToast({
title: '退出登录成功',
icon: 'success',
duration: 1000
})
} else {
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.personInfo()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

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

View File

@@ -0,0 +1,53 @@
<!--pages/person/person.wxml-->
<view class="person">
<view class="user-info-box">
<navigator url="/pages/person/info" class="user-info">
<view class="info-hd">
<image class="user-avatar" src="{{img}}"></image>
<view class="user-title">
<text class="user-name">{{name}}</text>
</view>
<text class="bind-btn">个人信息</text>
<view class="btn-open">
<image class="btn-enter" src="/icon/person/enter.png"></image>
</view>
</view>
</navigator>
</view>
<view class="more-list">
<navigator url="/pages/other/password" class="issue-link">
<view class="more-btn">
<image class="btn-icon" src="/icon/person/password.png"></image>
<text class="btn-text">修改密码</text>
<view class="btn-open">
<image class="btn-enter" src="/icon/person/enter.png"></image>
</view>
</view>
</navigator>
<navigator url="/pages/person/issues" class="issue-link">
<view class="more-btn">
<image class="btn-icon" src="/icon/person/issue.png"></image>
<text class="btn-text">反馈</text>
<view class="btn-open">
<image class="btn-enter" src="/icon/person/enter.png"></image>
</view>
</view>
</navigator>
<navigator url="/pages/other/about" class="about-link">
<view class="more-btn">
<image class="btn-icon" src="/icon/person/about.png"></image>
<text class="btn-text">关于</text>
<view class="btn-open">
<image class="btn-enter" src="/icon/person/enter.png"></image>
</view>
</view>
</navigator>
</view>
<navigator bindtap='quit' class="login-btn" url="none">
<text >退出登录</text>
</navigator>
</view>

View File

@@ -0,0 +1,114 @@
/**more.wxss**/
.person{
background-color: #f6f6f6;
padding: 0;
}
.user-info, .more-btn {
display: flex;
background-color: #fff;
min-height: 85rpx;
border-top: 1px solid #e5e5e5;
border-bottom: 1px solid #e5e5e5;
}
/**user-info**/
.user-info-box{
margin-bottom: 40rpx;
margin-top: 30rpx;
}
.user-info {
flex-direction: column;
padding: 25rpx 30rpx 20rpx;
}
.info-hd {
display: flex;
align-items: center;
}
.bind-btn {
color: #aaa;
}
.user-avatar {
width: 120rpx;
height: 120rpx;
border-radius: 5px;
}
.user-title {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 25rpx;
}
.time-box {
display: flex;
flex-direction: column;
align-items: center;
font-size: 10pt;
line-height: 140%;
color: #aaa;
}
.user-name {
font-size: 16pt;
line-height: 160%;
letter-spacing: 1px;
}
.user-id {
font-size: 11pt;
color: #8b8b8b;
}
.info-bd {
display: flex;
justify-content: space-between;
padding: 25rpx 15rpx 0 5rpx;
font-size: 11pt;
line-height: 150%;
color: #8b8b8b;
}
.info-bd-left, .info-bd-right {
display: flex;
flex-direction: column;
}
.info-bd-left{
flex-shrink: 0;
padding-right: 30rpx;
}
/**more-list**/
.more-list {
flex: 1;
display: flex;
flex-direction: column;
}
.more-btn {
align-items: center;
font-size: 13pt;
padding: 0 30rpx;
}
.issue-link, .about-link {
margin-bottom: 20rpx;
}
.btn-icon {
width: 45rpx;
height: 45rpx;
margin-right: 15rpx;
}
.btn-text {
flex: 1;
}
.btn-open {
display: flex;
align-items: center;
justify-content: flex-end;
margin-left: 10rpx;
}
.btn-enter {
width: 18rpx;
height: 27rpx;
}
.login-btn {
font-size: 13pt;
line-height: 85rpx;
height: 85rpx;
background: #e55c5c;
color: #fff;
text-align: center;
border-radius: 5px;
margin: 40rpx 3%;
}