修复bug

This commit is contained in:
weipengfei 2023-09-07 17:33:57 +08:00
parent c4c747ecd1
commit 2308cb0b4b
5 changed files with 73 additions and 26 deletions

View File

@ -2,7 +2,7 @@
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
import { loginShopAccount } from "@/api/oaUser.js"
import { loginShopAccount, userInfo } from "@/api/oaUser.js"
export default {
onLaunch: async function(info) {
// let noticeArr = []
@ -33,11 +33,13 @@
user: data,
token: res.data.token
})
this.$store.dispatch('initConfig');
let {
data
} = await userInfo();
this.$store.commit('setUserInfo', data);
uni.$emit('home_initUserInfo', data);
// uni.$emit('home_initUserInfo', data);
return ;
}catch(e){
console.log(e);
}

View File

@ -68,4 +68,4 @@ export const destroyAccount = (data) => oahttp.post('/user/destroy_account', dat
/**
* 商城登录
*/
export const loginShopAccount = (data) => oahttp.post('/login/shop_account', data)
export const loginShopAccount = (data) => oahttp.post('/login/shop_account', data, { noAuth: true })

View File

@ -184,6 +184,7 @@
mapState
} from 'vuex';
import bj from "@/static/animation/home.json"
import { userInfo } from "@/api/oaUser.js"
//#ifdef APP-PLUS
var jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
@ -202,7 +203,7 @@
is_captain: 0,
notArr: [],
orderList: [],
// oaHomeData: [],
oaHomeData: [],
src: "https://cdn.uviewui.com/uview/album/1.jpg",
assessData: [{
num: "0",
@ -241,6 +242,9 @@
onLoad() {
this.is_captain = JSON.parse(uni.getStorageSync("USER_INFO")).is_captain
this.options.data = bj;
// uni.$on('home_initUserInfo', (data=null)=>{
// this.initUserInfo(data);
// });
//#ifdef APP-PLUS
let that = this;
jpushModule.addNotificationListener(function(result) {
@ -257,12 +261,17 @@
// this.getUserIndex()
// this.getIndexList()
if(uni.getStorageSync('uniMP'))this.uniMP = true;
userInfo().then(({data})=>{
this.$store.commit('setUserInfo', data);
this.initUserInfo(data);
this.$store.dispatch('initConfig');
// console.log('', data);
});
this.getApproveList();
this.initUserInfo();
this.showToask();
// this.initOaHomeDada();
this.getOrderList();
uni.$on('home_initUserInfo',this.initUserInfo);
//#ifdef APP-PLUS
this.noticeFn();
// #endif
@ -274,21 +283,53 @@
}
},
computed: {
oaHomeData() {
const route = '/pages/oaHome/oaHome';
let arr = [];
this.$store.state.config?.config?.menu?.forEach((item) => {
if (item.paths.includes(route)) {
arr = item.children;
}
})
if (arr.length >= 8) {
arr = arr.slice(0, 7);
let obj = this.$store.state.config?.config?.menu?.find(item => item.paths.includes(
'/pages/moreFun/moreFun'));
arr.push(obj);
// oaHomeData() {
// const route = '/pages/oaHome/oaHome';
// let arr = [];
// this.$store.state.config?.config?.menu?.forEach((item) => {
// if (item.paths.includes(route)) {
// arr = item.children;
// }
// })
// if (arr.length >= 8) {
// arr = arr.slice(0, 7);
// let obj = this.$store.state.config?.config?.menu?.find(item => item.paths.includes(
// '/pages/moreFun/moreFun'));
// arr.push(obj);
// }
// return arr;
// },
},
watch: {
'$store.state.app.token':{
handler: function(n, o){
userInfo().then(({data})=>{
// console.log(data);
this.$store.commit('setUserInfo', data);
this.initUserInfo(data);
this.$store.dispatch('initConfig');
});
}
},
'$store.state.config.config.menu': {
immediate: true,
deep: true,
handler: function(n, o){
const route = '/pages/oaHome/oaHome';
let arr = [];
n.forEach((item) => {
if (item.paths.includes(route)) {
arr = item.children;
}
})
if (arr.length >= 8) {
arr = arr.slice(0, 7);
let obj = n.find(item => item.paths.includes(
'/pages/moreFun/moreFun'));
arr.push(obj);
}
this.oaHomeData = arr;
}
return arr;
}
},
methods: {

View File

@ -128,9 +128,11 @@
name: '签约公司'
}, {
name: '公司财务'
}, {
name: '任务情况'
}],
},
// {
// name: ''
// },
],
loadConfig: {
page: 1,
limit: 15,

View File

@ -67,10 +67,12 @@ function baseRequestTwo(url, method, data, {
reject(res.data);
} else if (res.data.code == 0) {
// uni.hideLoading();
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none',
})
if(res.data.show!=1&&res.data.msg!='无登录信息'){
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none',
})
}
reject(res.data);
} else if (res.data.code == 1) {
store.commit("SET_REQUEST");