diff --git a/App.vue b/App.vue index 3362217..6dc2038 100644 --- a/App.vue +++ b/App.vue @@ -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); } diff --git a/api/oaUser.js b/api/oaUser.js index e594548..f298d6c 100644 --- a/api/oaUser.js +++ b/api/oaUser.js @@ -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 }) diff --git a/pages/oaHome/oaHome.vue b/pages/oaHome/oaHome.vue index 6672e47..0094e25 100644 --- a/pages/oaHome/oaHome.vue +++ b/pages/oaHome/oaHome.vue @@ -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: { diff --git a/subpkg/companyInfo/companyInfo.vue b/subpkg/companyInfo/companyInfo.vue index cfca9fb..3de3487 100644 --- a/subpkg/companyInfo/companyInfo.vue +++ b/subpkg/companyInfo/companyInfo.vue @@ -128,9 +128,11 @@ name: '签约公司' }, { name: '公司财务' - }, { - name: '任务情况' - }], + }, + // { + // name: '任务情况' + // }, + ], loadConfig: { page: 1, limit: 15, diff --git a/utils/oahttp.js b/utils/oahttp.js index 97c06bb..e83a1dc 100644 --- a/utils/oahttp.js +++ b/utils/oahttp.js @@ -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");