From cf3615b3c9f52ca329a04e2b0df512a46d42302c Mon Sep 17 00:00:00 2001
From: mk <2403457699@qq.com>
Date: Wed, 20 Mar 2024 18:45:29 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=80=E5=87=BA=E7=99=BB?=
=?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3,=E6=B3=A8=E5=86=8C=E5=8A=A0?=
=?UTF-8?q?=E5=AF=86=E7=A0=81=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
miniprogram/pages/formid/formid.js | 15 +++
miniprogram/pages/formid/formid.wxml | 20 +++-
miniprogram/pages/home/home.js | 126 ++++++++++++------------
miniprogram/pages/login/login.js | 14 +--
miniprogram/pages/my/my.js | 46 ++++++---
miniprogram/project.private.config.json | 2 +-
miniprogram/utils/api.js | 4 +
7 files changed, 141 insertions(+), 86 deletions(-)
diff --git a/miniprogram/pages/formid/formid.js b/miniprogram/pages/formid/formid.js
index f579c1a..b76e415 100644
--- a/miniprogram/pages/formid/formid.js
+++ b/miniprogram/pages/formid/formid.js
@@ -568,6 +568,10 @@ Page({
this.showToast('请输入姓名')
return false
}
+ if(this.data.form.password != this.data.checkPassword){
+ this.showToast('两次密码不一致')
+ return false
+ }
if (!this.data.form.identityNo) {
this.showToast('请填写身份证号')
return false
@@ -676,6 +680,17 @@ Page({
visible: false
})
},
+ bindPassWordInput(e){
+ this.setData({
+ 'form.password':e.detail.value
+ })
+ console.log(this.data.form);
+ },
+ bindCheckPassWordInput(e){
+ this.setData({
+ checkPassword:e.detail.value
+ })
+ },
dispose() {
if (!this.data.form.realName) {
this.showToast('请输入姓名')
diff --git a/miniprogram/pages/formid/formid.wxml b/miniprogram/pages/formid/formid.wxml
index 9a3d040..9140ba0 100644
--- a/miniprogram/pages/formid/formid.wxml
+++ b/miniprogram/pages/formid/formid.wxml
@@ -9,7 +9,7 @@
-
+
*
身份证号
@@ -27,6 +27,24 @@
+
+
+ *
+ 密码
+
+
+
+
+
+
+
+ *
+ 确认密码
+
+
+
+
+
*
diff --git a/miniprogram/pages/home/home.js b/miniprogram/pages/home/home.js
index b79fe48..eb23a18 100644
--- a/miniprogram/pages/home/home.js
+++ b/miniprogram/pages/home/home.js
@@ -44,10 +44,10 @@ Page({
},
async onLoad(options) {
- wx.showLoading({
- title: "加载中,请稍后",
- mask: true
- })
+ // wx.showLoading({
+ // title: "加载中,请稍后",
+ // mask: true
+ // })
this.setData({
statusHeight: app.globalData.deviceInfo.statusHeight,
navigationHeight: app.globalData.deviceInfo.navigationHeight,
@@ -82,65 +82,65 @@ Page({
},
// 根据微信code查询用户当前状态
getUserState() {
- let that = this
- wx.showLoading({
- title: '登录中',
- mask:true
- })
- wx.login({
- success(res) {
- if (res.code) {
- let code = res.code
- api.getToken(code).then(res => {
- wx.hideLoading()
- const state = res.data.userState
- app.globalData.infoCompleted = state
- wx.setStorageSync("topGridName", res.data.grid)
- wx.setStorageSync("gridId", res.data.gridId) //当前网格id,新闻、议题、项目分享时用
- wx.setStorageSync("token", res.data.token)
- wx.setStorageSync("userId", res.data.userId)
- that.setData({
- departmentName: res.data.grid,
- departmentId: res.data.gridId,
- userId: res.data.userId
- })
- // that.getComplete()
- // that.getUserLoginlog()
- if (state == "4") {
- // 非扫码进入,通过搜索小程序直接进入的情况
- if (wx.getStorageSync("shareObj")) {
- const para = JSON.parse(wx.getStorageSync("shareObj"))
- app.globalData.tempGridId = "1222489495054602241"
- wx.redirectTo({
- url: "/pages/formid/formid?gid=1222489495054602241"
- })
- } else {
- wx.redirectTo({
- url: "/pages/formid/formid?gid=1222489495054602241"
- })
- }
- } else {
- if (wx.getStorageSync("shareObj")) {
- const para = JSON.parse(wx.getStorageSync("shareObj"))
- if (para.shareType === "newsDetail") {
- wx.navigateTo({
- url: `/subpages/home/pages/newsDetail/newsDetail?id=${para.detailId}`
- })
- } else if (para.shareType === "discussionDetail") {
- wx.navigateTo({
- url: `/subpages/discussion/pages/discussionDetail/discussionDetail?detailId=${para.detailId}&type=${para.type}&showClassify=${para.showClassify}`
- })
- }
- wx.removeStorageSync("shareObj")
- }
- that.initLoad()
- }
- })
- } else {
- console.log("登录失败" + res.errMsg)
- }
- }
- })
+ // let that = this
+ // wx.showLoading({
+ // title: '登录中',
+ // mask:true
+ // })
+ // wx.login({
+ // success(res) {
+ // if (res.code) {
+ // let code = res.code
+ // api.getToken(code).then(res => {
+ // wx.hideLoading()
+ // const state = res.data.userState
+ // app.globalData.infoCompleted = state
+ // wx.setStorageSync("topGridName", res.data.grid)
+ // wx.setStorageSync("gridId", res.data.gridId) //当前网格id,新闻、议题、项目分享时用
+ // wx.setStorageSync("token", res.data.token)
+ // wx.setStorageSync("userId", res.data.userId)
+ // that.setData({
+ // departmentName: res.data.grid,
+ // departmentId: res.data.gridId,
+ // userId: res.data.userId
+ // })
+ // // that.getComplete()
+ // // that.getUserLoginlog()
+ // if (state == "4") {
+ // // 非扫码进入,通过搜索小程序直接进入的情况
+ // if (wx.getStorageSync("shareObj")) {
+ // const para = JSON.parse(wx.getStorageSync("shareObj"))
+ // app.globalData.tempGridId = "1222489495054602241"
+ // wx.redirectTo({
+ // url: "/pages/formid/formid?gid=1222489495054602241"
+ // })
+ // } else {
+ // wx.redirectTo({
+ // url: "/pages/formid/formid?gid=1222489495054602241"
+ // })
+ // }
+ // } else {
+ // if (wx.getStorageSync("shareObj")) {
+ // const para = JSON.parse(wx.getStorageSync("shareObj"))
+ // if (para.shareType === "newsDetail") {
+ // wx.navigateTo({
+ // url: `/subpages/home/pages/newsDetail/newsDetail?id=${para.detailId}`
+ // })
+ // } else if (para.shareType === "discussionDetail") {
+ // wx.navigateTo({
+ // url: `/subpages/discussion/pages/discussionDetail/discussionDetail?detailId=${para.detailId}&type=${para.type}&showClassify=${para.showClassify}`
+ // })
+ // }
+ // wx.removeStorageSync("shareObj")
+ // }
+ // that.initLoad()
+ // }
+ // })
+ // } else {
+ // console.log("登录失败" + res.errMsg)
+ // }
+ // }
+ // })
},
handleXinxin() {
wx.navigateToMiniProgram({
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
index 308130c..9450170 100644
--- a/miniprogram/pages/login/login.js
+++ b/miniprogram/pages/login/login.js
@@ -7,8 +7,8 @@ Page({
* 页面的初始数据
*/
data: {
- userName: '13000000001',
- password: '123456'
+ userName: '',//13000000001
+ password: ''//123456
},
/**
@@ -97,17 +97,16 @@ Page({
wxCode: code
};
api.userLogin(params).then( (res) =>{
- console.log(res);
if (res.code == 0) {
wx.setStorageSync('token', res.data.token);
wx.setStorageSync('userTagKey', res.data.userTagKey);
+ // this.getToken()
wx.setStorageSync('deptDataScopeList', JSON.stringify(res.data.deptDataScopeList));
- wx.redirectTo({
+ wx.switchTab({
url: '/pages/home/home'
- });
+ });
}
else {
- console.log(222);
wx.showToast({
title: res.msg,
icon: 'none',
@@ -120,6 +119,9 @@ Page({
}
});
},
+ // getToken(){
+
+ // },
getUserName(e) {
this.setData({
userName: e.detail.value
diff --git a/miniprogram/pages/my/my.js b/miniprogram/pages/my/my.js
index 9a23258..6ec2c28 100644
--- a/miniprogram/pages/my/my.js
+++ b/miniprogram/pages/my/my.js
@@ -112,30 +112,46 @@ Page({
})
},
logoout() {
+ let than = this
wx.showModal({
title: '提示',
content: '确定退出登录',
success(res) {
if (res.confirm) {
- // wx.setStorageSync("token", res.data.token)
- wx.showLoading({
- title: "退出中,请稍后...",
- mask: true,
- success() {
- setTimeout(() => {
- wx.removeStorage({
- key: 'token',
- })
- wx.reLaunch({
- url: '/pages/login/login'
- })
- }, 1000)
- }
- })
+ than.logout()
+ // wx.showLoading({
+ // title: "退出中,请稍后...",
+ // mask: true,
+ // success() {
+ // setTimeout(() => {
+ // wx.removeStorage({
+ // key: 'token',
+ // })
+
+ // wx.reLaunch({
+ // url: '/pages/login/login'
+ // })
+ // }, 1000)
+ // }
+ // })
}
}
})
},
+ logout(){
+ api.logout().then(res=>{
+ if(res.code === 0){
+ wx.removeStorage({
+ key: 'token',
+ })
+ wx.reLaunch({
+ url: '/pages/login/login'
+ })
+ }
+ }).catch(err=>{
+ console.log(err);
+ })
+ },
tapchangeImg() {
const _this = this;
wx.chooseMedia({
diff --git a/miniprogram/project.private.config.json b/miniprogram/project.private.config.json
index 7b508b0..f3bd151 100644
--- a/miniprogram/project.private.config.json
+++ b/miniprogram/project.private.config.json
@@ -186,7 +186,7 @@
]
}
},
- "libVersion": "2.14.1",
+ "libVersion": "2.19.6",
"setting": {
"compileHotReLoad": true,
"bigPackageSizeSupport": false
diff --git a/miniprogram/utils/api.js b/miniprogram/utils/api.js
index 48bd110..e7136de 100644
--- a/miniprogram/utils/api.js
+++ b/miniprogram/utils/api.js
@@ -1,6 +1,7 @@
var fly = require("./request.js")
module.exports = {
getToken: getToken,
+ logout:logout,
getCompleteName: getCompleteName,
saveWxFormid: saveWxFormid,
getScanSwitch: getScanSwitch,
@@ -76,6 +77,9 @@ function bannerList(position) {
position
})
}
+function logout() {
+ return fly.get("analysis/user/logout")
+}
// function getIssueList(param) {
// return fly.get("events/issue/list", param)