diff --git a/App.vue b/App.vue index f67f4da..61c08ab 100644 --- a/App.vue +++ b/App.vue @@ -64,13 +64,23 @@ } }, onShow: function() { - const audioContext = uni.createInnerAudioContext() - // 设置音频文件地址 - audioContext.src = '/static/mp3/order.mp3' + jpushModule.initJPushService() + // const audioContext = uni.createInnerAudioContext() + // // 设置音频文件地址 + // audioContext.src = '/static/mp3/order.mp3' // 播放音频 //#ifdef APP-PLUS jpushModule.addNotificationListener(res => { + const audioContext = uni.createInnerAudioContext() + if(res.content.includes(':')){ + audioContext.src = '/static/mp3/im.wav' + audioContext.play() + uni.vibrateLong(); + console.log("im") + return + } if (res.notificationEventType == 'notificationOpened') return + audioContext.src = '/static/mp3/order.mp3' audioContext.play() uni.vibrateLong(); console.log("app的监听") diff --git a/config/app.js b/config/app.js index 1db8661..dfa40af 100644 --- a/config/app.js +++ b/config/app.js @@ -3,8 +3,8 @@ let httpApi; // 总域名 let httpApiTwo; // 物流系统域名 let httpApiTest -const env = 'dev'; // 开发 -// const env = 'prod'; // 生产 +// const env = 'dev'; // 开发 +const env = 'prod'; // 生产 // const env = 'prew'; // 预上线 switch (env) { @@ -22,7 +22,7 @@ switch (env) { httpApi = 'https://ceshi-worker-task.lihaink.cn' //测试 httpApiThree = 'https://ceshi-worker-task.lihaink.cn' //测试 httpApiTwo = 'https://ceshi-logistics.lihaink.cn' //测试环境 - httpApiTest = 'http://192.168.1.9:8081' //测试环境 + httpApiTest = 'http://192.168.1.13:8081' //测试环境 } diff --git a/pages.json b/pages.json index 61c09e0..edb8cd7 100644 --- a/pages.json +++ b/pages.json @@ -31,10 +31,8 @@ "navigationBarTitleText": "商机信息", "navigationBarBackgroundColor": "#0122C7", "navigationBarTextStyle": "white", - "app-plus": { - //手机软键盘升起不让其将页面头部上推 - "softinputMode": "adjustResize" - } + "enablePullDownRefresh": true + } }, @@ -277,6 +275,16 @@ "navigationBarTextStyle": "white" } + },{ + "path": "chatMang/index", + "style": { + "navigationBarTitleText": "聊天", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#0122C7", + "navigationBarTextStyle": "white", + "enablePullDownRefresh": true + } + }, { "path": "topUp/topUp", "style": { @@ -593,6 +601,15 @@ "navigationBarTextStyle": "white" } + }, { + "path": "property/buyCar", + "style": { + "navigationBarTitleText": "车辆购买", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#0122C7", + "navigationBarTextStyle": "white" + } + }, { "path": "property/success", "style": { diff --git a/pages/business/business.vue b/pages/business/business.vue index ba3f1fb..ba66194 100644 --- a/pages/business/business.vue +++ b/pages/business/business.vue @@ -1,14 +1,16 @@ - - - \ No newline at end of file diff --git a/pages/oaHome/oaHome.vue b/pages/oaHome/oaHome.vue index 6b9cea5..d7f7181 100644 --- a/pages/oaHome/oaHome.vue +++ b/pages/oaHome/oaHome.vue @@ -110,6 +110,25 @@ + + + + + + {{managerInfo.manager_name}} + + + + + 99 + + + + + + + + 工作管理 @@ -215,6 +234,9 @@ import { import { noticeList } from "@/api/notice.js"; +import { + getAreaManagerApi + } from "@/api/bussness.js" // import tabbar from '../components/tabbar' import { getIndexListAPI, @@ -241,6 +263,7 @@ export default { }, data () { return { + brange:0, options: { data: '', }, @@ -248,6 +271,7 @@ export default { page_num: 1, flag: false, uniMP: false, + managerInfo:{}, id: "", is_captain: 0, notArr: [], @@ -292,11 +316,16 @@ export default { await this.$onLaunched; this.is_captain = JSON.parse(uni.getStorageSync("USER_INFO")||'{}')?.is_captain this.options.data = bj; + let user_id= JSON.parse( uni.getStorageSync("USER_INFO")).id + getAreaManagerApi({user_id}).then(res=>{ + console.log(res.data) + this.managerInfo=res.data + }) //#ifdef APP-PLUS let that = this; jpushModule.addNotificationListener(function (result) { if (!that.notArr.includes(result.messageID)) { - that.$refs.globalPopup.showPopu(); + // that.$refs.globalPopup.showPopu(); that.getOrderList(); console.log("idnex的"); that.notArr.push(result.messageID); @@ -408,14 +437,21 @@ export default { methods: { // 通知 noticeFn () { - const audioContext = uni.createInnerAudioContext() - audioContext.src = '/static/mp3/order.mp3' - jpushModule.addNotificationListener(res => { + jpushModule.addNotificationListener(res => { + const audioContext = uni.createInnerAudioContext() + if(res.content.includes(':')){ + audioContext.src = '/static/mp3/im.wav' + audioContext.play() + uni.vibrateLong(); + console.log("im") + return + } if (res.notificationEventType == 'notificationOpened') return + audioContext.src = '/static/mp3/order.mp3' audioContext.play() uni.vibrateLong(); this.getOrderList() - this.$refs.globalPopup.showPopu(); + // this.$refs.globalPopup.showPopu(); console.log("index的监听") }) }, @@ -958,4 +994,32 @@ export default { } } } +.chat{ + margin-top: 1000px; + // margin-top: 2000rpx; + width: 694.74rpx; + margin: 0 auto; + background-color: white; + border-radius: 12px; + padding:20rpx; + // padding-top: 10rpx; + padding-right: 24rpx; + display: flex; + justify-content: space-between; + align-items: center; + .chat-l{ + display: flex; + align-items: center; + } +} +.brange{ + color: white; + background-color: red; + width: 40rpx; + height: 40rpx; + border-radius: 40rpx; + font-size: 12px; + text-align: center; + lighting-color: 40rpx; +} \ No newline at end of file diff --git a/static/mp3/im.mp3 b/static/mp3/im.mp3 new file mode 100644 index 0000000..dc94c50 Binary files /dev/null and b/static/mp3/im.mp3 differ diff --git a/static/mp3/im.wav b/static/mp3/im.wav new file mode 100644 index 0000000..b3a2c2e Binary files /dev/null and b/static/mp3/im.wav differ diff --git a/pages/business/talkDetail.vue b/subpkg/chatMang/index.vue similarity index 51% rename from pages/business/talkDetail.vue rename to subpkg/chatMang/index.vue index 1f2d4ad..f6c738f 100644 --- a/pages/business/talkDetail.vue +++ b/subpkg/chatMang/index.vue @@ -1,29 +1,21 @@ - \ No newline at end of file diff --git a/utils/aa.js b/utils/aa.js index 1a7164a..ce76829 100644 --- a/utils/aa.js +++ b/utils/aa.js @@ -1,118 +1,127 @@ import { - httpApiTest, - HEADER, - TOKENNAME, + HTTP_REQUEST_URL_THREE, + HEADER, + TOKENNAME, } from '@/config/app'; import { - Toast + Toast } from '../libs/uniApi'; // import { checkLogin } from '../libs/login'; import store from '../store'; function toLogin() { - uni.showToast({ - title: '请先登录', - icon: 'none', - duration: 1000 - }); + uni.showToast({ + title: '请先登录', + icon: 'none', + duration: 1000 + }); } function baseRequestTwo(url, method, data, { - noAuth = false, - noVerify = false + noAuth = false, + noVerify = false, + onReLogin = false }) { - let Url = httpApiTest, - header = HEADER; - if (!noAuth) { - // 已经未登录了,禁止请求 - if (!store.state.config.request) return Promise.reject({ - msg: '未登录' - }); - //登录过期自动登录 - if (!store.state.app.token) { - toLogin(); - store.commit("SET_REQUEST", false); - return Promise.reject({ - msg: '未登录' - }); - } - } + let Url = HTTP_REQUEST_URL_THREE, + header = HEADER; + if (!noAuth) { + // 已经未登录了,禁止请求 + if (!store.state.config.request) return Promise.reject({ + msg: '未登录' + }); + //登录过期自动登录 + if (!store.state.app.token) { + toLogin(); + store.commit("SET_REQUEST", false); + return Promise.reject({ + msg: '未登录' + }); + } + } - // if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token; - if (store.state.app.token) header[TOKENNAME] = store.state.app.token; + // if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token; + if (store.state.app.token) header[TOKENNAME] = store.state.app.token; - // header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv'; - return new Promise((reslove, reject) => { - // uni.showLoading({ - // title: '加载中' - // }) - uni.request({ - // url: Url + '/api/v1' + url, - url: Url + url, - method: method || 'GET', - header: { - ...header - - }, - data: method != 'GET' ? data || {} : {}, - params: method == 'GET' ? data : {}, - success: (res) => { - // uni.hideLoading() - if (noVerify) - // reslove(res.data, res); - reslove(res.data); - else if (res.data.code == -1) { - store.commit("LOGOUT"); - store.commit("SET_REQUEST", false); - reject(res.data); - } else if (res.data.code == 0) { - // uni.hideLoading(); - 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"); - reslove(res.data); - } else if (res.data.code == 200) { - store.commit("SET_REQUEST"); - reslove(res.data.data); - } else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) { - toLogin(); - reject(res.data); - } else if (res.data.code == 501) { - // uni.reLaunch({ - // url: '/pages/error/index' - // }) - reject(res.data); - } else { - // uni.hideLoading(); - uni.showToast({ - title: res.data.msg || '请检查网络', - icon: 'none' - }) - reject(res.data.msg || '请检查网络'); - } - }, - fail: (message) => { - // uni.hideLoading() - uni.showToast({ - title: '网络错误', - icon: 'none' - }) - reject('请求失败'); - } - }) - }); + // header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv'; + return new Promise((reslove, reject) => { + // uni.showLoading({ + // title: '加载中' + // }) + uni.request({ + // url: Url + '/api/v1' + url, + url: Url + url, + method: method || 'GET', + header: { + ...header + }, + data: method != 'GET' ? data || {} : {}, + params: method == 'GET' ? data : {}, + success: (res) => { + if (noVerify) + reslove(res.data); + else if (res.data.code == -1) { + if(onReLogin) { + store.commit('LOGOUT'); + return reject(); + } + // 如果登录超时,自动重新登录并且继续发送请求 + store.dispatch("RE_LOGIN", { + url: url, + method: method, + data: data, + opt: { + noAuth, + noVerify + } + }).then((e)=>{ + reslove(e); + }).catch((err)=>{ + reject(res.data); + }) + // store.commit("SET_REQUEST", false); + } else if (res.data.code == 0) { + if (res.data.msg != '无登录信息') { + uni.showToast({ + title: res.data.msg || '请检查网络', + icon: 'none', + }) + } + reject(res.data); + } else if (res.data.code == 1) { + store.commit("SET_REQUEST"); + reslove(res.data); + } else if (res.data.code == 200) { + store.commit("SET_REQUEST"); + reslove(res.data.data); + } else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) { + toLogin(); + reject(res.data); + } else if (res.data.code == 501) { + reject(res.data); + } else { + uni.showToast({ + title: res.data.msg || '请检查网络', + icon: 'none' + }) + reject(res.data.msg || '请检查网络'); + } + }, + fail: (message) => { + // uni.hideLoading() + uni.showToast({ + title: '网络错误', + icon: 'none' + }) + reject('请求失败'); + } + }) + }); } const oahttp = {}; ['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => { - oahttp[method] = (api, data, opt) => baseRequestTwo(api, method, data, opt || {}) + oahttp[method] = (api, data, opt) => baseRequestTwo(api, method, data, opt || {}) }); export default oahttp; \ No newline at end of file