我的页面

This commit is contained in:
姚亚男
2021-10-11 16:49:22 +08:00
parent e4e2740c0b
commit 224833685d
28 changed files with 216 additions and 5738 deletions
-66
View File
@@ -1,66 +0,0 @@
// pages/meeting/meeting.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
-3
View File
@@ -1,3 +0,0 @@
{
"usingComponents": {}
}
-4
View File
@@ -1,4 +0,0 @@
<!--pages/meeting/meeting.wxml-->
<view>
<text>资料网员</text>
</view>
-20
View File
@@ -1,20 +0,0 @@
/* pages/meeting/meeting.wxss */
.select-list {
height: 92rpx;
display: flex;
align-items: center;
background-color: #F5F5F5;
}
.select-item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
.select-item image {
width: 21rpx;
height: 12rpx;
margin-left: 20rpx;
}
+4 -2
View File
@@ -20,13 +20,15 @@ Page({
if(index === 0) { // 来款项目
url = '../project/project'
} else if(index === 1) { // 工作组
url = '../work/work'
// url = '../work/work'
url = '../project/project'
} else if(index === 2) { // 分标委
url = '../committee/committee'
} else if(index === 3) { // 会议活动
url = '../meeting/meeting'
} else{ // 资料网员
url = '../data/data'
// url = '../data/data'
url = '../project/project'
}
wx.navigateTo({
url,
+27 -15
View File
@@ -1,6 +1,6 @@
// pages/mine/mine.js
import UserApi from '../../assets/js/http/userApi'
import {JSEncrypt} from '../../assets/js/jsencrypt/jsencrypt'
import { encrypt } from '../../assets/js/jsencrypt/rsa'
var countdown = 60; // 倒计时秒数
Page({
data: {
@@ -65,26 +65,37 @@ Page({
},
// 登录
formSubmit(e) {
console.log('form发生了submit事件,携带数据为:', e.detail.value)
if (e.detail.value.phone && e.detail.value.captcha) {
wx.showLoading({
title: '正在登录...',
icon: 'loading'
})
// 新建JSEncrypt对象
let encrypt = new JSEncrypt()
encrypt.setPublicKey(this.data.rsaPublicKey) // 公钥加密
let params = {
username: encrypt.encrypt(e.detail.value.phone), // 手机号加密
username: encrypt(this.data.rsaPublicKey,e.detail.value.phone), // 手机号加密
captcha: e.detail.value.captcha,
rsaPublicKey: this.data.rsaPublicKey
}
// 请求短信登录start
UserApi.codeLogin(params).then(res => {
if (res.success) {
wx.hideLoading()
// 存token和userInfo
wx.setStorage({
key: 'X-Access-Token',
data: res.result.token
})
wx.setStorage({
key: 'userInfo',
data: res.result.userInfo
})
if(res.message === "updatePassword") {
// 跳转设置密码页
wx.navigateTo({
url: '../setPassword/setPassword',
})
}else{
// 跳转设置密码页
wx.switchTab({
url: '../home/home',
})
}
} else {
wx.hideLoading()
wx.showToast({
title: '登录失败',
icon: 'error',
@@ -99,9 +110,6 @@ Page({
icon: 'none',
duration: 2000
})
wx.navigateTo({
url: '../setPassword/setPassword',
})
}
},
@@ -128,6 +136,10 @@ Page({
this.setData({
rsaPublicKey: res.result
})
wx.setStorage({
key: 'rsaPublicKey',
data: res.result
})
}
})
},
+23 -2
View File
@@ -1,11 +1,12 @@
// pages/mine/mine.js
import UserApi from '../../assets/js/http/userApi'
Page({
/**
* 页面的初始数据
*/
data: {
userId: ''
},
// 个人信息
mineInfo(){
@@ -41,11 +42,31 @@ Page({
url: '../mineContract/mineContract',
})
},
// 退出登录
logout(){
wx.showModal({
cancelColor: '取消',
content: '确定退出登录?',
confirmColor: '#069F99',
success (res) {
if (res.confirm) {
UserApi.logout().then(res=>{
if(res.success){
wx.clearStorage()
wx.redirectTo({
url: '../login/login',
})
}
})
} else if (res.cancel) {}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
+1 -1
View File
@@ -72,6 +72,6 @@
</view>
</view>
<view class="logout">
<text>退出登录</text>
<text bindtap="logout">退出登录</text>
</view>
</view>
+20 -44
View File
@@ -1,65 +1,41 @@
import UserApi from '../../assets/js/http/userApi'
Page({
/**
* 页面的初始数据
*/
data: {
list: [1,1,1,1,,1,1,1]
list: [],
pageNo: 1,
pageSize: 10
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
loadData(){
let params = {
pageNo: this.data.pageNo,
pageSize: this.data.pageSize
}
UserApi.dataList(params).then(res=>{
if(res.success){
console.log(res.result.records)
this.setData({
list: res.result.records
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.loadData()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
this.data.pageNo++
this.loadData()
}
})
+1 -1
View File
@@ -1,4 +1,4 @@
{
"navigationBarTitleText": "我的资料",
"navigationBarTitleText": "资料下载",
"usingComponents": {}
}
+2 -7
View File
@@ -1,13 +1,8 @@
<view class="list-box">
<view class="list-item" wx:for="list" wx:key="item">
<text class="list-time">2021-10-12 12:00:00</text>
<text class="list-time">{{item.uploadTime}}</text>
<view class="list-files">
<text>1文件名称列表文件名称列表文件名称列表文件名称列表.PDF</text>
<text>2文件名称列表文件名称列表文件名称列表文件名称列表.PDF</text>
<text>3文件名称文件名称列表文件名称列表.PDF</text>
<text>4文件名称列表文件名称列表文件名称列表文件名称列表.PDF</text>
<text>5文件名称列表文件名称列表文件名称列表文件名称列表.PDF</text>
<text>6文件名称.PDF</text>
<text>{{item.fileName}}</text>
</view>
</view>
</view>
+17 -19
View File
@@ -1,6 +1,6 @@
// pages/meeting/meeting.js
import UserApi from '../../assets/js/http/userApi'
import {JSEncrypt} from '../../assets/js/jsencrypt/jsencrypt'
import { encrypt } from '../../assets/js/jsencrypt/rsa'
Page({
/**
* 页面的初始数据
@@ -67,26 +67,19 @@ Page({
return
}
if (this.data.flag) {
wx.showLoading({
title: '正在登录...',
icon: 'loading'
})
// 新建JSEncrypt对象
let encrypt = new JSEncrypt()
encrypt.setPublicKey(this.data.rsaPublicKey) // 公钥加密
let params = {
newPassword: encrypt.encrypt(e.detail.value.newPassword),
verifyPassword: encrypt.encrypt(e.detail.value.verifyPassword),
newPassword: encrypt(this.data.rsaPublicKey, e.detail.value.newPassword),
verifyPassword: encrypt(this.data.rsaPublicKey, e.detail.value.verifyPassword),
rsaPublicKey: this.data.rsaPublicKey
}
console.log('form发生了submit事件,携带数据为:', e.detail.value)
// 请求短信登录start
UserApi.setPassword(params).then(res => {
console.log(res)
if (res.success) {
wx.hideLoading()
// 成功设置密码,跳转首页
wx.navigateTo({
url: '../home/home',
})
} else {
wx.hideLoading()
wx.showToast({
title: '登录失败',
icon: 'error',
@@ -108,18 +101,23 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
UserApi.getRSAPublicKey().then(res => {
if (res.success) {
this.setData({
rsaPublicKey: res.result
const that = this
wx.getStorage({
key: 'rsaPublicKey',
success (res) {
that.setData({
rsaPublicKey: res.data
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
},
+39 -77
View File
@@ -1,8 +1,6 @@
// pages/meeting/meeting.js
import UserApi from '../../assets/js/http/userApi'
import {
JSEncrypt
} from '../../assets/js/jsencrypt/jsencrypt'
import { encrypt } from '../../assets/js/jsencrypt/rsa'
var countdown = 60; // 倒计时秒数
Page({
@@ -21,11 +19,16 @@ Page({
},
showGetCaptcha: true
},
bindInputPhone(e) {
this.setData({
"form.phone": e.detail.value
})
},
// 获取验证码
getVerCode() {
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.phone)) {
if (/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.form.phone)) {
UserApi.sendCode({
phone: this.data.phone
phone: this.data.form.phone
}).then(res => {
// 获取成功,倒计时 start
if (res.success) {
@@ -121,50 +124,33 @@ Page({
return
}
console.log('form发生了submit事件,携带数据为:', e.detail.value)
// 新建JSEncrypt对象
let encrypt = new JSEncrypt()
encrypt.setPublicKey(this.data.rsaPublicKey) // 公钥加密
let params = {
phone: encrypt.encrypt(e.detail.value.phone),
phone: encrypt(this.data.rsaPublicKey, e.detail.value.phone),
newPassword: encrypt(this.data.rsaPublicKey, e.detail.value.newPassword),
verifyPassword: encrypt(this.data.rsaPublicKey, e.detail.value.verifyPassword),
verifyCode: e.detail.value.verifyCode,
newPassword: encrypt.encrypt(e.detail.value.newPassword),
verifyPassword: encrypt.encrypt(e.detail.value.verifyPassword)
rsaPublicKey: this.data.rsaPublicKey,
}
console.log(params)
if(this.data.flag){
UserApi.updatePassword(params).then(res => {
console.log(res)
if(res.success){
wx.showToast({
title: res.result,
})
wx.navigateBack()
}
}).catch(err => {
wx.hideToast()
})
}
UserApi.updatePassword(params).then(res => {
console.log(res)
wx.hideToast()
}).catch(err => {
wx.hideToast()
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 性别处理
if (this.data.form.gender === '1') {
this.data.sexArr[0].checked = "true"
this.setData({
sexArr: this.data.sexArr,
})
console.log(this.data.sexArr)
}
if (this.data.form.gender === '2') {
this.data.sexArr[1].checked = "true"
this.setData({
sexArr: this.data.sexArr,
})
console.log(2)
}
let params = {
id: wx.getStorage('id') // 用户id
}
UserApi.mineInfo(params).then(res => {
console.log(res)
wx.hideToast()
}).catch(err => {
wx.hideToast()
})
},
/**
@@ -178,41 +164,17 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
const that = this
wx.getStorage({
key: 'rsaPublicKey',
success (res) {
that.setData({
rsaPublicKey: res.data
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
}
})
+1 -1
View File
@@ -4,7 +4,7 @@
<view class="form-item">
<view class="text-label">手机号</view>
<view class="text-value">
<input name="phone" value="{{phone}}" placeholder="请输入手机号" />
<input name="phone" bindinput="bindInputPhone" value="{{phone}}" placeholder="请输入手机号" />
</view>
</view>
<view class="form-item">
-66
View File
@@ -1,66 +0,0 @@
// pages/meeting/meeting.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
-3
View File
@@ -1,3 +0,0 @@
{
"usingComponents": {}
}
-4
View File
@@ -1,4 +0,0 @@
<!--pages/meeting/meeting.wxml-->
<view>
<text>工作组</text>
</view>
-20
View File
@@ -1,20 +0,0 @@
/* pages/meeting/meeting.wxss */
.select-list {
height: 92rpx;
display: flex;
align-items: center;
background-color: #F5F5F5;
}
.select-item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
.select-item image {
width: 21rpx;
height: 12rpx;
margin-left: 20rpx;
}