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

View File

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

View File

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