Commit 5227b1f9 authored by 罗超's avatar 罗超

重新调整

parent 83d014dd
...@@ -242,6 +242,10 @@ ...@@ -242,6 +242,10 @@
this.AccountName=options.AccountName this.AccountName=options.AccountName
this.shareUnionId=options.unionId this.shareUnionId=options.unionId
this.getData() this.getData()
}else{
uni.reLaunch({
url:'/pages/login/login'
})
} }
// uni.showModal({ // uni.showModal({
// title: 'options', // title: 'options',
......
...@@ -338,11 +338,6 @@ ...@@ -338,11 +338,6 @@
this.wxUserAuthInfo = uni.getStorageSync('wxUserAuthInfo') this.wxUserAuthInfo = uni.getStorageSync('wxUserAuthInfo')
this.erpUserInfo = uni.getStorageSync('erpUserInfo') this.erpUserInfo = uni.getStorageSync('erpUserInfo')
this.getData() this.getData()
let path=`/pages/FriendsAndRelatives/addFriendsAndRelatives?unionId=${this.wxUserAuthInfo.unionid}&AccountName=${this.erpUserInfo.AccountName}`
console.log(path)
uni.navigateTo({
url:path
})
}, },
onReachBottom() { onReachBottom() {
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
import { import {
GetStudentPageList,SetMyChild GetStudentPageList,SetMyChild
} from "../../api/erp.js"; } from "../../api/erp.js";
import {getLoginAccounts} from '../../api/index.js'
export default { export default {
components: { components: {
bottom, bottom,
...@@ -237,17 +238,49 @@ ...@@ -237,17 +238,49 @@
data.loading = false data.loading = false
uni.showLoading() uni.showLoading()
let res = await SetMyChild(data.form); let res = await SetMyChild(data.form);
console.log(res)
if (res.Code==1) { if (res.Code==1) {
uni.hideLoading() let erps=uni.getStorageSync('ErpStus')
data.loading = true erps.push(res.Data)
uni.navigateBack({ uni.setStorageSync('ErpStus',erps)
delta: 1 if(res.Data.ClassInAccount){
}); methods.setAccountsLogin(res.Data.ClassInAccount)
}else{
uni.hideLoading()
data.loading = true
uni.navigateBack({
delta: 1
});
}
}else{ }else{
uni.hideLoading() uni.hideLoading()
data.loading = true data.loading = true
uni.showToast({
title:'添加失败',
icon:"error"
})
} }
}, },
setAccountsLogin(Accounts){
getLoginAccounts({Accounts}).then(r=>{
uni.hideLoading()
data.loading = true
if(r.Data && r.Data.length>0){
let users=uni.getStorageSync('users')?uni.getStorageSync('users'):[]
users.push(r.Data[0])
uni.setStorageSync("users",users)
data.loading = true
uni.navigateBack({
delta: 1
});
}
}).catch(e=>{
uni.hideLoading()
data.loading = true
})
},
getData() { getData() {
uni.showLoading() uni.showLoading()
GetStudentPageList(data.msg).then(res => { GetStudentPageList(data.msg).then(res => {
......
...@@ -250,6 +250,7 @@ ...@@ -250,6 +250,7 @@
content: '将要删除该数据,是否继续', content: '将要删除该数据,是否继续',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
uni.showLoading() uni.showLoading()
let msg = { let msg = {
Id: item.Id Id: item.Id
...@@ -257,6 +258,7 @@ ...@@ -257,6 +258,7 @@
RemoveMyChild(msg).then(r => { RemoveMyChild(msg).then(r => {
if(r.Code==1){ if(r.Code==1){
uni.hideLoading() uni.hideLoading()
methods.delCache(item)
methods.getData(); methods.getData();
}else{ }else{
uni.hideLoading() uni.hideLoading()
...@@ -276,6 +278,43 @@ ...@@ -276,6 +278,43 @@
}); });
}, },
delCache(item){
let users=uni.getStorageSync('users')
let erps=uni.getStorageSync('ErpStus')
let u=uni.getStorageSync('userInfo')
let eu=uni.getStorageSync('erpUserInfo')
let temp=erps.find(x=>x.RealPhone==item.StuRealMobile)
if(temp){
let t=JSON.parse(JSON.stringify(temp))
if(users){
users=users.filter(x=>x.Account!=t.ClassInAccount)
if(users&&users.length>0){
uni.setStorageSync('users',users)
if(u.Account==t.ClassInAccount){
uni.setStorageSync('userInfo',users[0])
}
}else{
uni.removeStorageSync('users')
uni.removeStorageSync('userInfo')
}
}
if(erps){
erps=erps.filter(x=>x.AccountId!=t.AccountId)
if(erps&&erps.length>0){
uni.setStorageSync('ErpStus',erps)
if(eu.AccountId==t.AccountId){
uni.setStorageSync('erpUserInfo',erps[0])
}
}else{
uni.removeStorageSync('ErpStus')
uni.removeStorageSync('erpUserInfo')
}
}
}
},
jumpPage(url) { jumpPage(url) {
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
......
...@@ -26,7 +26,12 @@ let request = (param) => { ...@@ -26,7 +26,12 @@ let request = (param) => {
if (res.data.Code === 1) { if (res.data.Code === 1) {
resolve(res.data) resolve(res.data)
} else { } else {
if (res.data.Code == 10001 || res.data.Code == 10000) { if (res.data.Code == 10001 || res.data.Code == 10000) {
if(!uni.getStorageSync('userInfo')){
uni.reLaunch({
url:"/pages/login/login"
})
}
// uni.showToast({ // uni.showToast({
// title: "用户凭证失效,请重新授权", // title: "用户凭证失效,请重新授权",
// duration: 2000, // duration: 2000,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment