feat: app更新移到login_.vue,引入下载进度
This commit is contained in:
parent
1a3e4b7d1a
commit
ca87016f7d
162
App.vue
162
App.vue
|
@ -1,67 +1,67 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
// 此处globalData为了演示其作用,不是uView框架的一部分
|
// 此处globalData为了演示其作用,不是uView框架的一部分
|
||||||
globalData: {
|
globalData: {
|
||||||
appid: 'wxf7d6140f507466be'
|
appid: 'wxf7d6140f507466be'
|
||||||
},
|
},
|
||||||
getUserRange() {
|
// getUserRange() {
|
||||||
let that = this;
|
// let that = this;
|
||||||
that.$u.api.deptList({
|
// that.$u.api.deptList({
|
||||||
page: 0,
|
// page: 0,
|
||||||
type__in: 'rparty,dept',
|
// type__in: 'rparty,dept',
|
||||||
query: '{id, name, parent, type}'
|
// query: '{id, name, parent, type}'
|
||||||
}).then(res => {
|
// }).then(res => {
|
||||||
let list1 = res;
|
// let list1 = res;
|
||||||
let list2 = [];
|
// let list2 = [];
|
||||||
let reqList = [];
|
// let reqList = [];
|
||||||
list1.forEach(function(item) {
|
// list1.forEach(function(item) {
|
||||||
reqList.push(that.$u.api.userList({
|
// reqList.push(that.$u.api.userList({
|
||||||
page: 0,
|
// page: 0,
|
||||||
belong_dept: item.id,
|
// belong_dept: item.id,
|
||||||
is_active: true,
|
// is_active: true,
|
||||||
query: '{id, name, belong_dept}'
|
// query: '{id, name, belong_dept}'
|
||||||
}))
|
// }))
|
||||||
})
|
// })
|
||||||
Promise.all(reqList).then(res => {
|
// Promise.all(reqList).then(res => {
|
||||||
for (let i = 0; i < res.length; i++) {
|
// for (let i = 0; i < res.length; i++) {
|
||||||
list1[i].children = res[i]
|
// list1[i].children = res[i]
|
||||||
}
|
// }
|
||||||
list1.forEach(item=>{
|
// list1.forEach(item=>{
|
||||||
if(item.type == 'dept'){
|
// if(item.type == 'dept'){
|
||||||
list2.push({ ...item })
|
// list2.push({ ...item })
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
that.$u.vuex('vuex_userRange', that.parseData(list1))
|
// that.$u.vuex('vuex_userRange', that.parseData(list1))
|
||||||
that.$u.vuex('vuex_userRange2', that.parseData(list2))
|
// that.$u.vuex('vuex_userRange2', that.parseData(list2))
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
},
|
// },
|
||||||
parseData(data) {
|
// parseData(data) {
|
||||||
// * 先生成parent建立父子关系
|
// // * 先生成parent建立父子关系
|
||||||
const obj = {};
|
// const obj = {};
|
||||||
data.forEach((item) => {
|
// data.forEach((item) => {
|
||||||
obj[item.id] = item;
|
// obj[item.id] = item;
|
||||||
});
|
// });
|
||||||
const parentList = [];
|
// const parentList = [];
|
||||||
data.forEach((item) => {
|
// data.forEach((item) => {
|
||||||
const parent = obj[item.parent];
|
// const parent = obj[item.parent];
|
||||||
if (parent) {
|
// if (parent) {
|
||||||
// * 当前项有父节点
|
// // * 当前项有父节点
|
||||||
parent.children = parent.children || [];
|
// parent.children = parent.children || [];
|
||||||
parent.children.unshift(item);
|
// parent.children.unshift(item);
|
||||||
} else {
|
// } else {
|
||||||
parentList.push(item);
|
// parentList.push(item);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
return parentList;
|
// return parentList;
|
||||||
},
|
// },
|
||||||
onLaunch() {
|
onLaunch() {
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
let client = plus.push.getClientInfo();
|
let client = plus.push.getClientInfo();
|
||||||
let qyjyClientId = client.clientid;
|
let qyjyClientId = client.clientid;
|
||||||
uni.setStorageSync('qyjyClientId', qyjyClientId)
|
uni.setStorageSync('qyjyClientId', qyjyClientId)
|
||||||
|
|
||||||
console.log("设备唯一标识:",qyjyClientId)
|
console.log("设备唯一标识:",qyjyClientId)
|
||||||
// #endif
|
// #endif
|
||||||
var that = this
|
var that = this
|
||||||
|
@ -119,36 +119,36 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// #endif
|
// #endif
|
||||||
uni.getSystemInfo({
|
// uni.getSystemInfo({
|
||||||
success(res) {
|
// success(res) {
|
||||||
console.log(res)
|
// console.log(res)
|
||||||
that.$u.vuex('vuex_version', res.appVersion)
|
// that.$u.vuex('vuex_version', res.appVersion)
|
||||||
// #ifdef APP-PLUS
|
// // #ifdef APP-PLUS
|
||||||
if (res.platform == 'android') {
|
// if (res.platform == 'android') {
|
||||||
that.$u.api.apkCheck().then(res1 => {
|
// that.$u.api.apkCheck().then(res1 => {
|
||||||
if (res.appVersion < res1.version) {
|
// if (res.appVersion < res1.version) {
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
title: "版本更新",
|
// title: "版本更新",
|
||||||
content: '有新的版本发布, 请下载新版本',
|
// content: '有新的版本发布, 请下载新版本',
|
||||||
confirmText: '立即更新',
|
// confirmText: '立即更新',
|
||||||
showCancel: false,
|
// showCancel: false,
|
||||||
success: function(res2) {
|
// success: function(res2) {
|
||||||
if (res2.confirm) {
|
// if (res2.confirm) {
|
||||||
if(res1.file.indexOf("http") == 0){
|
// if(res1.file.indexOf("http") == 0){
|
||||||
plus.runtime.openURL(res1.file)
|
// plus.runtime.openURL(res1.file)
|
||||||
}else{
|
// }else{
|
||||||
plus.runtime.openURL(that.vuex_host + res1.file)
|
// plus.runtime.openURL(that.vuex_host + res1.file)
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
// #endif
|
// // #endif
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -434,64 +434,10 @@
|
||||||
// })
|
// })
|
||||||
}).catch(e => {})
|
}).catch(e => {})
|
||||||
// #endif
|
// #endif
|
||||||
that.getUserRange();
|
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getUserRange() {
|
|
||||||
let that = this;
|
|
||||||
that.$u.api.deptList({
|
|
||||||
page: 0,
|
|
||||||
type__in: 'rparty,dept',
|
|
||||||
query: '{id, name, parent, type}'
|
|
||||||
}).then(res => {
|
|
||||||
let list1 = res;
|
|
||||||
let list2 = [];
|
|
||||||
let reqList = [];
|
|
||||||
list1.forEach(function(item) {
|
|
||||||
reqList.push(that.$u.api.userList({
|
|
||||||
page: 0,
|
|
||||||
belong_dept: item.id,
|
|
||||||
is_active: true,
|
|
||||||
query: '{id, name, belong_dept}'
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
Promise.all(reqList).then(res => {
|
|
||||||
for (let i = 0; i < res.length; i++) {
|
|
||||||
list1[i].children = res[i]
|
|
||||||
}
|
|
||||||
list1.forEach(item => {
|
|
||||||
if (item.type == 'dept') {
|
|
||||||
list2.push({
|
|
||||||
...item
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
that.$u.vuex('vuex_userRange', that.parseData(list1))
|
|
||||||
that.$u.vuex('vuex_userRange2', that.parseData(list2))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
parseData(data) {
|
|
||||||
// * 先生成parent建立父子关系
|
|
||||||
const obj = {};
|
|
||||||
data.forEach((item) => {
|
|
||||||
obj[item.id] = item;
|
|
||||||
});
|
|
||||||
const parentList = [];
|
|
||||||
data.forEach((item) => {
|
|
||||||
const parent = obj[item.parent];
|
|
||||||
if (parent) {
|
|
||||||
// * 当前项有父节点
|
|
||||||
parent.children = parent.children || [];
|
|
||||||
parent.children.unshift(item);
|
|
||||||
} else {
|
|
||||||
parentList.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return parentList;
|
|
||||||
},
|
|
||||||
formSubmit2(e) {
|
formSubmit2(e) {
|
||||||
var that = this;
|
var that = this;
|
||||||
const obj = e.target.value;
|
const obj = e.target.value;
|
||||||
|
@ -499,7 +445,6 @@
|
||||||
that.$u.api.codeLogin(obj).then(res => {
|
that.$u.api.codeLogin(obj).then(res => {
|
||||||
that.$u.vuex('vuex_token', res.access)
|
that.$u.vuex('vuex_token', res.access)
|
||||||
that.$u.vuex('vuex_refresh', res.refresh)
|
that.$u.vuex('vuex_refresh', res.refresh)
|
||||||
that.getUserRange();
|
|
||||||
that.$u.api.getUserInfo().then(res => {
|
that.$u.api.getUserInfo().then(res => {
|
||||||
if (res.avatar) {
|
if (res.avatar) {
|
||||||
res.avatar = this.vuex_host + res.avatar
|
res.avatar = this.vuex_host + res.avatar
|
||||||
|
@ -619,7 +564,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
that.getUserRange()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue