diff --git a/api/phaseTwo/homePage.js b/api/phaseTwo/homePage.js index b684ff6..05d28d1 100644 --- a/api/phaseTwo/homePage.js +++ b/api/phaseTwo/homePage.js @@ -1,4 +1,5 @@ import request from '@/utils/request_new' +import request_yn from '@/utils/request_new_yn' // 获取首页数据 export function getHomePageListApi(data) { @@ -18,7 +19,7 @@ export function getHomePageSelectApi() { } // 首页二级页面--作业计划详情-作业计划列表 export function getWorkPlanDetailsApi(data) { - return request({ + return request_yn({ url: '/ynPlan/home/getjhxxq', method: 'post', data @@ -26,7 +27,7 @@ export function getWorkPlanDetailsApi(data) { } // 首页二级页面--作业计划详情-作业人员及持证信息 export function getWorkPersonnelApi(data) { - return request({ + return request_yn({ url: '/ynPlan/home/getDayUser', method: 'post', data @@ -34,7 +35,7 @@ export function getWorkPersonnelApi(data) { } // 首页二级页面--作业计划详情-作业票、站班会照片 export function getStandGuardImgApi(data) { - return request({ + return request_yn({ url: '/ynPlan/home/getZbhPhotos', method: 'post', data @@ -42,7 +43,7 @@ export function getStandGuardImgApi(data) { } // 首页二级页面--作业计划详情-持证信息详情 export function getHoldCardInfoApi(data) { - return request({ + return request_yn({ url: '/ynPlan/home/getDayUserCZ', method: 'post', data diff --git a/config.js b/config.js index a42952c..ce261ef 100644 --- a/config.js +++ b/config.js @@ -26,6 +26,8 @@ module.exports = { realBmwUrl: 'http://192.168.0.14:1911/bmw', //实名制移动端 -- 新 realNewBmwUrl: 'http://192.168.0.14:1911', + //实名制移动端 -- 新 + realNewYnUrl: 'http://192.168.0.14:1918', // 应用信息 appInfo: { diff --git a/pages/realName/workPlan-details/index.vue b/pages/realName/workPlan-details/index.vue index 74a09f1..084b680 100644 --- a/pages/realName/workPlan-details/index.vue +++ b/pages/realName/workPlan-details/index.vue @@ -225,7 +225,7 @@ export default { const response = await getStandGuardImgApi(params) this.workPersonList = res.data - console.log('人员信息---', res.data) + console.log('人员信息---', res) this.holdCardList = res.datac this.standGuardList = response.data diff --git a/pages/workPlan/index/components/risk-calendar.vue b/pages/workPlan/index/components/risk-calendar.vue index ad9cfe9..de95b07 100644 --- a/pages/workPlan/index/components/risk-calendar.vue +++ b/pages/workPlan/index/components/risk-calendar.vue @@ -18,10 +18,19 @@ class="uni-calendar--hook" :range="true" :showMonth="false" - :selected="info.selected" @change="change" @monthSwitch="monthSwitch" - /> + > + + @@ -38,10 +47,35 @@ export default { range: true, insert: false, selected: [] + }, + customInfo: { + '2024-10-01': '重要', + '2024-10-15': '假期' + }, + events: { + '2024-10-01': { type: 'important', text: '重要' }, + '2024-10-15': { type: 'holiday', text: '假期' }, + '2024-10-20': { type: 'birthday', text: '生日' } } } }, methods: { + onChange(e) { + console.log('选择的日期变化:', e) + }, + onMonthSwitch(e) { + console.log('月份切换:', e) + }, + hasEvent(date) { + const dateString = `${date.year}-${String(date.month).padStart(2, '0')}-${String(date.day).padStart(2, '0')}` + return !!this.events[dateString] + }, + getInfoClass(info) { + if (info === '重要') return 'info-important' + if (info === '假期') return 'info-holiday' + if (info === '生日') return 'info-birthday' + return '' + }, change() { console.log('日期变化---') }, @@ -89,4 +123,43 @@ export default { display: flex; align-items: center; } + +.custom-day { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; + position: relative; +} + +.day-number { + font-size: 14px; +} + +.custom-info { + font-size: 10px; + margin-top: 2px; +} + +.info-important { + color: #ff4d4f; +} + +.info-holiday { + color: #52c41a; +} + +.info-birthday { + color: #1890ff; +} + +.event-dot { + width: 4px; + height: 4px; + border-radius: 50%; + background-color: #1890ff; + position: absolute; + bottom: 2px; +} diff --git a/utils/request_new_yn.js b/utils/request_new_yn.js new file mode 100644 index 0000000..c316ac7 --- /dev/null +++ b/utils/request_new_yn.js @@ -0,0 +1,85 @@ +import store from '@/store' +import config from '@/config' +import { getToken, setToken } from '@/utils/auth' +import errorCode from '@/utils/errorCode' +import { toast, showConfirm, tansParams } from '@/utils/common' + +let timeout = 60000 +const baseUrl = config.realNewYnUrl +console.log('baseUrl-请求', baseUrl) + +const request = config => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + config.header = config.header || {} + if (getToken() && !isToken) { + config.header['Authorization'] = 'Bearer ' + getToken() + } + // get请求映射params参数 + if (config.params) { + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.url = url + } + + if (config.method === 'post') { + config.header = { + ...config.header, + 'Content-Type': 'application/x-www-form-urlencoded' + } + // config.data = JSON.stringify(config.data); + } + return new Promise((resolve, reject) => { + uni + .request({ + method: config.method || 'get', + timeout: config.timeout || timeout, + url: baseUrl + config.url, + data: config.data, + header: config.header, + dataType: 'json' + }) + .then(response => { + // console.log(response) + let [error, res] = response + if (error) { + toast('后端接口连接异常') + reject('后端接口连接异常') + return + } + const code = res.data.code || 200 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + if (code === 401) { + showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { + if (res.confirm) { + store.dispatch('LogOut').then(res => { + uni.reLaunch({ url: '/pages/login' }) + }) + } + }) + reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + toast(msg) + reject(msg) + } else if (code !== 200) { + toast(msg) + reject(msg) + } + resolve(res.data) + }) + .catch(error => { + let { message } = error + if (message === 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + toast(message) + reject(error) + }) + }) +} + +export default request