| | |
| | | import Vue from 'vue' |
| | | import Vuex from 'vuex' |
| | | import { webSocketUrl } from '@/api/request.js' |
| | | import { webSocketUrl,BaseUrl } from '@/api/request.js' |
| | | // 请求相关 |
| | | import { |
| | | reqGet, |
| | | } from '@/api/index.js' |
| | | Vue.use(Vuex) |
| | | |
| | | // 动态底部tabbar |
| | |
| | | selectedIconPath: '../../static/tabBar-icon/Bmine57.png', |
| | | text: '我的' |
| | | } |
| | | ] |
| | | ], |
| | | fourth: [{ |
| | | pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar', |
| | | iconPath: '../../static/tabBar-icon/home.png', |
| | | selectedIconPath: '../../static/tabBar-icon/homeblue.png', |
| | | text: '进场' |
| | | },{ |
| | | pagePath: 'pages/doorkeeper-page/doorkeeper-index/exit-index', |
| | | iconPath: '../../static/tabBar-icon/home.png', |
| | | selectedIconPath: '../../static/tabBar-icon/homeblue.png', |
| | | text: '出场' |
| | | }, |
| | | { |
| | | pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar', |
| | | iconPath: '../../static/tabBar-icon/Gmine10.png', |
| | | selectedIconPath: '../../static/tabBar-icon/Bmine57.png', |
| | | text: '我的' |
| | | }, |
| | | |
| | | ], |
| | | five:[{ |
| | | pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar', |
| | | iconPath: '../../static/tabBar-icon/home.png', |
| | | selectedIconPath: '../../static/tabBar-icon/homeblue.png', |
| | | text: '首页' |
| | | }, |
| | | { |
| | | pagePath: 'pages/loadUnload-page/orderPlanList/index', |
| | | iconPath: '../../static/tabBar-icon/Gmine10.png', |
| | | selectedIconPath: '../../static/tabBar-icon/Bmine57.png', |
| | | text: '日计划' |
| | | }, |
| | | { |
| | | pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar', |
| | | iconPath: '../../static/tabBar-icon/Gmine10.png', |
| | | selectedIconPath: '../../static/tabBar-icon/Bmine57.png', |
| | | text: '我的' |
| | | }, |
| | | ] |
| | | } |
| | | const store = new Vuex.Store({ |
| | | state: { |
| | |
| | | confirmWeighContent: '', |
| | | // 称重稳定态 0/稳定 1/非稳定 非稳定态不能点称重 |
| | | globalWarning: false, |
| | | filedId:'', //煤场id |
| | | bunkerList:'', //煤仓list |
| | | }, |
| | | mutations: { |
| | | setUserInfo(state, identity) { |
| | |
| | | state.userTabbar = userRoleTabbar.second |
| | | uni.setStorageSync('userTabbar', state.userTabbar) |
| | | } else if (roleType == 5) { |
| | | state.userTabbar = userRoleTabbar.three |
| | | state.userTabbar = userRoleTabbar.five |
| | | uni.setStorageSync('userTabbar', state.userTabbar) |
| | | }else if (roleType == 6) { |
| | | state.userTabbar = userRoleTabbar.fourth |
| | | uni.setStorageSync('userTabbar', state.userTabbar) |
| | | } |
| | | }, |
| | |
| | | changeWarning(state, payload) { |
| | | state.globalWarning = payload |
| | | }, |
| | | // 煤场filedId的获取 |
| | | getFiledId(state, payload) { |
| | | console.log(payload,'filedId=====') |
| | | state.filedId = payload |
| | | uni.setStorageSync('filedId', state.filedId) |
| | | }, |
| | | getBunkerList(state, payload) { |
| | | console.log('我执行了getBunkerList====',payload) |
| | | state.bunkerList = payload |
| | | uni.setStorageSync('bunkerList', state.bunkerList) |
| | | } |
| | | }, |
| | | actions: { |
| | | websocketInit({ state, dispatch, commit }) { |
| | | // #ifdef H5 |
| | | let wsUrl = `access_token=${uni.getStorageSync('token')}` |
| | | // #endif |
| | | // #ifndef H5 |
| | | let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}` |
| | | // #endif |
| | | state.socketTask = uni.connectSocket({ |
| | | url: wsUrl, |
| | | header: { clientToc: 'Y' }, |
| | | header: { |
| | | clientToc: 'Y' , |
| | | 'CLIENT_TOC': 'Y', |
| | | }, |
| | | success: res => { |
| | | console.log(res, 'socketSuccess') |
| | | if (res.errMsg === 'connectSocket:ok') { |
| | |
| | | dispatch('websocketInit') |
| | | }, 5000) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | //filedId |
| | | async getBunkerList({ state,dispatch, commit }) { //获取filedId |
| | | // this.$reqGet(`getList/${this.deptId}`).then(res => { |
| | | // console.log(res,'想得到filedId') |
| | | // }) |
| | | let deptId = uni.getStorageSync('userInfo').deptIds |
| | | console.log(deptId,'deptId====') |
| | | await uni.request({ //获取deptId |
| | | url: `/wrzs/jccoalfiled/list/${deptId}`, |
| | | method: 'GET', |
| | | header: { |
| | | Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'), |
| | | clientToc: 'Y', |
| | | 'CLIENT_TOC': 'Y', |
| | | }, |
| | | success: res => { |
| | | console.log(res,'filedId接口000000000000') |
| | | commit('getFiledId',res.data.data[0].id || '') |
| | | dispatch('getFiledIdCoalBunker') |
| | | // console.log(res,'shuj------') |
| | | // this.filedId = res.data?.data.length > 0 ? res.data.data[0].id : ''; |
| | | // this.getFiledIdCoalBunker() |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | getFiledIdCoalBunker({ state, commit }) { //煤仓列表(采样地点) |
| | | let filedId = uni.getStorageSync('filedId') |
| | | console.log(filedId,'最终的filedId=============') |
| | | reqGet('getFiledIdCoalBunker', {filedId: filedId}).then(res => { |
| | | console.log(res,'res----煤仓') |
| | | commit('getBunkerList',res.data) |
| | | }) |
| | | }, |
| | | } |
| | | }) |
| | | |