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

重新调整

parent 83d014dd
......@@ -242,6 +242,10 @@
this.AccountName=options.AccountName
this.shareUnionId=options.unionId
this.getData()
}else{
uni.reLaunch({
url:'/pages/login/login'
})
}
// uni.showModal({
// title: 'options',
......
......@@ -338,11 +338,6 @@
this.wxUserAuthInfo = uni.getStorageSync('wxUserAuthInfo')
this.erpUserInfo = uni.getStorageSync('erpUserInfo')
this.getData()
let path=`/pages/FriendsAndRelatives/addFriendsAndRelatives?unionId=${this.wxUserAuthInfo.unionid}&AccountName=${this.erpUserInfo.AccountName}`
console.log(path)
uni.navigateTo({
url:path
})
},
onReachBottom() {
......
......@@ -155,6 +155,7 @@
import {
GetStudentPageList,SetMyChild
} from "../../api/erp.js";
import {getLoginAccounts} from '../../api/index.js'
export default {
components: {
bottom,
......@@ -237,16 +238,48 @@
data.loading = false
uni.showLoading()
let res = await SetMyChild(data.form);
console.log(res)
if (res.Code==1) {
let erps=uni.getStorageSync('ErpStus')
erps.push(res.Data)
uni.setStorageSync('ErpStus',erps)
if(res.Data.ClassInAccount){
methods.setAccountsLogin(res.Data.ClassInAccount)
}else{
uni.hideLoading()
data.loading = true
uni.navigateBack({
delta: 1
});
}
}else{
uni.hideLoading()
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() {
uni.showLoading()
......
......@@ -250,6 +250,7 @@
content: '将要删除该数据,是否继续',
success: function (res) {
if (res.confirm) {
uni.showLoading()
let msg = {
Id: item.Id
......@@ -257,6 +258,7 @@
RemoveMyChild(msg).then(r => {
if(r.Code==1){
uni.hideLoading()
methods.delCache(item)
methods.getData();
}else{
uni.hideLoading()
......@@ -275,6 +277,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) {
uni.navigateTo({
......
......@@ -27,6 +27,11 @@ let request = (param) => {
resolve(res.data)
} else {
if (res.data.Code == 10001 || res.data.Code == 10000) {
if(!uni.getStorageSync('userInfo')){
uni.reLaunch({
url:"/pages/login/login"
})
}
// uni.showToast({
// title: "用户凭证失效,请重新授权",
// 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