我的页面

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
+10 -15
View File
@@ -5,22 +5,17 @@ App({
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
wx.setStorage({
key:"key",
data:"登录过,存到了缓存flag,跳转首页"
wx.getStorage({
key: 'X-Access-Token',
success: (res) =>{// 缓存中登录过,直接进小程序
wx.switchTab({
url: 'pages/home/home',
})
},
fail: function(){
// 缓存中没有登录过默认app.json的登录页
}
})
// wx.getStorage({
// key: 'key',
// success (res) {// 缓存中登录过,直接进小程序
// console.log(res.data)
// wx.switchTab({
// url: '../home/home',
// })
// },
// fail: function(){
// // 缓存中没有登录过默认app.json的登录页
// }
// })
// 登录
wx.login({
success: res => {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"pages":[
"pages/home/home",
"pages/login/login",
"pages/home/home",
"pages/mine/mine",
"pages/index/index",
"pages/logs/logs",
+1 -1
View File
@@ -10,7 +10,7 @@ let baseUrl = 'http://10.0.1.9:8080'
// let baseUrl = 'http://localhost:8080'
const http = (method, url, data, header= headerDefault) => {
let Authorization = wx.getStorageSync(TokenKey) ? wx.getStorageSync(TokenKey) : '';
header[TokenKey] = Authorization == '' ? '' : JSON.parse(Authorization)
header[TokenKey] = Authorization == '' ? '' : Authorization
return new Promise((resolve, reject) => {
wx.showLoading({
title: '加载中...',
+6 -1
View File
@@ -22,12 +22,17 @@ const UserApi = {
codeLogin: (params) => http.post(`${URL_CONFIG}company/smsLogin`, params),
// 设置密码
setPassword: (params) => http.post(`${URL_CONFIG}company/changePassword`, params),
// 退出
logout: (params) => http.post(`${URL_CONFIG}sys/logout`, params),
// 短信验证码修改密码
updatePassword: (params) => http.post(`${URL_CONFIG}company/verificationChangePassword`, params),
// 个人信息
mineInfo: (params) => http.get(`${URL_CONFIG}company/payContactsManagement/queryByIdMeeting`, params),
// 编辑个人信息提交
editMineInfo: (params) => http.get(`${URL_CONFIG}company/payContactsManagement/companyEdit`, params),
editMineInfo: (params) => http.post(`${URL_CONFIG}company/payContactsManagement/companyEdit`, params),
// 我的资料
dataList: (params) => http.get(`${URL_CONFIG}project/payWorkingGroupDistributionRecord/listForFile`, params),
// 首页接口
// 来款项目分页
projectList: (params) => http.get(`${URL_CONFIG}project/payCommonProject/queryCompanyPageList`, params),
File diff suppressed because it is too large Load Diff
-2
View File
@@ -1,6 +1,4 @@
// import JSEncrypt from '../jsencrypt/jsencrypt'
// import JSEncrypt from '../jsencrypt/jsencryptInit'
import JSEncrypt from '../jsencrypt/jsencryptInit'
export function encrypt(publicKey, message) {
const encrypt = new JSEncrypt()
+29
View File
@@ -0,0 +1,29 @@
const date = new Date()
const years = []
const months = []
for (let i = 1990; i <= date.getFullYear(); i++) {
years.push(i)
}
for (let i = 1; i <= 12; i++) {
months.push(i)
}
Page({
data: {
years: years,
year: date.getFullYear(),
months: months,
month: 2,
value: [9999, 1, 1],
},
bindChange: function (e) {
const val = e.detail.value
this.setData({
year: this.data.years[val[0]],
month: this.data.months[val[1]],
})
console.log(this.data)
}
})
@@ -1,3 +1,4 @@
{
"component": true,
"usingComponents": {}
}
+14
View File
@@ -0,0 +1,14 @@
<view class="i-modal-mask {{ visible ? 'i-modal-mask-show' : '' }}" catchtap='outClick'>
<view class="box">
<view class="title">{{year}}年{{month}}月</view>
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{value}}"
bindchange="bindChange">
<picker-view-column>
<view wx:for="{{years}}" class="item">{{item}}年</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{months}}" class="item">{{item}}月</view>
</picker-view-column>
</picker-view>
</view>
</view>
+16
View File
@@ -0,0 +1,16 @@
.box{
height: 300px;
}
.title{
width: 100%;
text-align: center;
margin: 20px 0;
}
.item{
text-align: center;
line-height: 50px
}
.intro {
margin: 30px;
text-align: center;
}
-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 () {
}
})
-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;
}
+3 -3
View File
@@ -22,9 +22,9 @@
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": false,
"useApiHook": false,
"useApiHostProcess": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],