diff --git a/App.vue b/App.vue index 693603f..26812f9 100644 --- a/App.vue +++ b/App.vue @@ -206,7 +206,7 @@ export default { return; } attemptReconnect(); - }, 5000); + }, 50000); }, initWyyx() { diff --git a/components/customTabbar.vue b/components/customTabbar.vue index 614a860..cafb47e 100644 --- a/components/customTabbar.vue +++ b/components/customTabbar.vue @@ -8,88 +8,71 @@ import { getMsgContentTipByType, setTabUnread } from "../pages/NEUIKit/utils/msg"; import { trackInit } from "../pages/NEUIKit/utils/reporter.ts"; export default { - // created() { - // let that = this; - // this.isLogin = uni.getStorageSync("apply-userinfo") ? true : false; - // console.log("createdcreatedcreated"); - // if (this.isLogin) { - // if (uni.$UIKitStore) { - // trackInit("ConversationUIKit"); - // setTimeout(() => { - // // 获取未读信息数 - // setTabUnread(); - // }, 100); - // } else { - // setTimeout(() => { - // // 初始化会话列表 - // trackInit("ConversationUIKit"); - // setTimeout(() => { - // // 获取未读信息数 - // setTabUnread(); - // }, 2000); - // }, 2000); - // } - // } - // // 聊天会话通知触发小红点数量提示 - // uni.$on("newMessage", function (data) { - // console.log("newMessage 接收", data); - // that.setBadge(data); - // }); - // // 用户身份认证权限改变触发 - // uni.$on("userAuthChange", function (data) { - // console.log("newMessage 接收", data); - // that.corpUserFlag = uni.getStorageSync("apply-userinfo").corpUserFlag; - // this.checkUserAuth(); - // }); - // this.checkUserAuth(); - // this.setBadge(); - // }, - onShow() { - console.log(123123123123); - }, created() { - if (this.userInfo.agencyId) { - this.tabbarInfo = [ - { - iconPath: "icon-home g_c_9", - selectedIconPath: "icon-home g_c_main", - pagePath: "/pages/home/index", - text: "首页", - iconSize: 48, - }, - { - iconPath: "icon-fadanhao-32 g_c_9", - selectedIconPath: "icon-fadanhao-32 g_c_main", - pagePath: "/pages/home/order", - text: "发单号", - iconSize: 48, - }, + let that = this; + this.isLogin = uni.getStorageSync("apply-userinfo") ? true : false; + console.log("createdcreatedcreated"); + if (this.isLogin) { + if (uni.$UIKitStore) { + trackInit("ConversationUIKit"); + setTimeout(() => { + // 获取未读信息数 + setTabUnread(); + }, 100); + } else { + setTimeout(() => { + // 初始化会话列表 + trackInit("ConversationUIKit"); + setTimeout(() => { + // 获取未读信息数 + setTabUnread(); + }, 2000); + }, 2000); + } + } + // if (this.userInfo.agencyId) { + // this.tabbarInfo = [ + // { + // iconPath: "icon-home g_c_9", + // selectedIconPath: "icon-home g_c_main", + // pagePath: "/pages/home/index", + // text: "首页", + // iconSize: 48, + // }, + // { + // iconPath: "icon-fadanhao-32 g_c_9", + // selectedIconPath: "icon-fadanhao-32 g_c_main", + // pagePath: "/pages/home/order", + // text: "发单号", + // iconSize: 48, + // }, - { - iconPath: "icon-order_active g_c_9", - selectedIconPath: "icon-order_active g_c_main", - pagePath: "/pages/workBench/index", - text: "工单", - iconSize: 48, - count: 0, - }, - { - iconPath: "icon-message g_c_9", - selectedIconPath: "icon-message g_c_main", - pagePath: "/pages/message/index", - text: "消息", - iconSize: 78, - iconType: "custom", - }, - { - iconPath: "icon-user g_c_9", - selectedIconPath: "icon-user g_c_main", - pagePath: "/pages/person/index", - text: "我的", - iconSize: 48, - }, - ]; - } else { + // { + // iconPath: "icon-order_active g_c_9", + // selectedIconPath: "icon-order_active g_c_main", + // pagePath: "/pages/workBench/index", + // text: "工单", + // iconSize: 48, + // count: 0, + // }, + // { + // iconPath: "icon-message g_c_9", + // selectedIconPath: "icon-message g_c_main", + // pagePath: "/pages/message/index", + // text: "消息", + // iconSize: 78, + // iconType: "custom", + // }, + // { + // iconPath: "icon-user g_c_9", + // selectedIconPath: "icon-user g_c_main", + // pagePath: "/pages/person/index", + // text: "我的", + // iconSize: 48, + // }, + // ]; + // } else { + if (!this.userInfo.agencyId) { this.tabbarInfo = [ { iconPath: "icon-home g_c_9", @@ -114,6 +97,7 @@ export default { text: "消息", iconSize: 78, iconType: "custom", + count: 0, }, { iconPath: "icon-user g_c_9", @@ -124,6 +108,22 @@ export default { }, ]; } + // 聊天会话通知触发小红点数量提示 + uni.$on("newMessage", function (data) { + console.log("newMessage 接收", data); + that.setBadge(data); + }); + // 用户身份认证权限改变触发 + uni.$on("userAuthChange", function (data) { + console.log("newMessage 接收", data); + that.corpUserFlag = uni.getStorageSync("apply-userinfo").corpUserFlag; + // this.checkUserAuth(); + }); + // this.checkUserAuth(); + this.setBadge(); + }, + onShow() { + console.log(123123123123); }, data() { return { @@ -132,46 +132,6 @@ export default { corpUserFlag: uni.getStorageSync("apply-userinfo").corpUserFlag, userInfo: uni.getStorageSync("apply-userinfo"), globalData: getApp().globalData, - - // tabbarInfo: [ - // { - // iconPath: "/static/image/home.png", - // selectedIconPath: "/static/image/home-active.png", - // pagePath: "/pages/home/index", - // text: "首页", - // iconSize: 48, - // }, - // { - // iconPath: "/static/image/apply.png", - // selectedIconPath: "/static/image/apply-active.png", - // pagePath: "/pages/workBench/index", - // text: "工单", - // iconSize: 48, - // }, - // { - // iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/add.svg", - // selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/add.svg", - // pagePath: "/pages/addJob/index", - // text: "", - // iconSize: 78, - // iconType: "custom", - // }, - // { - // iconPath: "/static/image/message.png", - // selectedIconPath: "/static/image/message_active.png", - // pagePath: "/pages/message/index", - // text: "消息", - // iconSize: 48, - // count: 0, - // }, - // { - // iconPath: "/static/image/person.png", - // selectedIconPath: "/static/image/person-active.png", - // pagePath: "/pages/person/index", - // text: "我的", - // iconSize: 48, - // }, - // ], tabbarInfo: [ { iconPath: "icon-home g_c_9", @@ -203,6 +163,7 @@ export default { text: "消息", iconSize: 78, iconType: "custom", + count: 0, }, { iconPath: "icon-user g_c_9", @@ -227,42 +188,44 @@ export default { uploadPage() { uni.vibrateShort(); }, - // setBadge(data) { - // let that = this; - // // console.log("datadatadatadatadatadata", data); - // for (var k in that.tabbarInfo) { - // if (that.tabbarInfo[k].pagePath == "/pages/message/indexcopy") { - // if (data) { - // // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount); - // if (data.type == "message") { - // that.messageCount = data.count || 0; - // } else if (data.type == "notice") { - // that.noticeCount = data.count || 0; - // } - // // console.log(that.messageCount + "-------------------------" + that.noticeCount); - // } else { - // that.messageCount = uni.getStorageSync("chat_info").count || 0; - // that.noticeCount = uni.getStorageSync("notice_info").count || 0; - // } + setBadge(data) { + let that = this; + console.log("datadatadatadatadatadata", data); + for (var k in that.tabbarInfo) { + console.log("that.tabbarInfo[k].pagePath", that.tabbarInfo[k]); + if (that.tabbarInfo[k].pagePath == "/pages/message/index") { + if (data) { + // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount); + if (data.type == "message") { + that.messageCount = data.count || 0; + } else if (data.type == "notice") { + that.noticeCount = data.count || 0; + } + // console.log(that.messageCount + "-------------------------" + that.noticeCount); + } else { + that.messageCount = uni.getStorageSync("chat_info").count || 0; + that.noticeCount = uni.getStorageSync("notice_info").count || 0; + } - // that.tabbarInfo[k].count = that.messageCount + that.noticeCount; - // // console.log("that.tabbarInfo[k].count", that.tabbarInfo[k].count); - // // that.tabbarInfo[k].type = data.type; - // } else if (that.tabbarInfo[k].pagePath == "/pages/workBench/index") { - // if (data) { - // // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount); - // if (data.type == "follow") { - // that.followCount = data.count || 0; - // } + that.tabbarInfo[k].count = that.messageCount + that.noticeCount; + console.log("that.tabbarInfo[k].count", that.tabbarInfo[k].count); + // that.tabbarInfo[k].type = data.type; + } + // else if (that.tabbarInfo[k].pagePath == "/pages/workBench/index") { + // if (data) { + // // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount); + // if (data.type == "follow") { + // that.followCount = data.count || 0; + // } - // // console.log(that.messageCount + "-------------------------" + that.noticeCount); - // } else { - // that.followCount = uni.getStorageSync("follow_info").count || 0; - // } - // that.tabbarInfo[k].count = that.followCount; - // } - // } - // }, + // // console.log(that.messageCount + "-------------------------" + that.noticeCount); + // } else { + // that.followCount = uni.getStorageSync("follow_info").count || 0; + // } + // that.tabbarInfo[k].count = that.followCount; + // } + } + }, // checkUserAuth() { // this.tabbarInfo = [ // { diff --git a/main.js b/main.js index dbdde40..f5effc6 100644 --- a/main.js +++ b/main.js @@ -178,19 +178,21 @@ export function createApp () { /** * 上传到oss */ - uploadImgToOss (callback = () => { }, type = 'default', $num = 1, $sourceType = ['album', 'camera']) { + uploadImgToOss (callback = () => { }, customDir = '', type = 'default', $num = 1, $sourceType = ['album', 'camera']) { var that = this; G.uploadImage($num, (imgRes) => { uni.showLoading({ title: '上传中...', }) + console.log('imgRes', imgRes); let imgPath = JSON.parse(imgRes)[0] console.log('imgPath', imgPath); - G.Get(apiInfo.getOssInfo, {}, ({ data }) => { + G.Get(apiInfo.getOssInfo, { prefix: customDir }, ({ data }) => { console.log('uploadImgToOssresresresres', data); const { policy, signature, accessid, dir, host } = data; + let key = (customDir ? (customDir + '/') : dir) + that.getUUID() const formData = { - "key": dir + that.getUUID() + "_${filename}", + "key": key + "_${filename}", "policy": policy, "OSSAccessKeyId": accessid, signature, @@ -205,7 +207,7 @@ export function createApp () { formData: formData, success: function (res) { if (res.errMsg = "uploadFile:ok") { - const imgUrl = host + "/" + dir + imgPath.split('/').pop(); + const imgUrl = `${host}/${key}_${imgPath.split('/').pop()}`; callback({ status: '上传成功', image: imgUrl diff --git a/pages/NEUIKit/utils/msg.ts b/pages/NEUIKit/utils/msg.ts index fc9f138..49c18d5 100644 --- a/pages/NEUIKit/utils/msg.ts +++ b/pages/NEUIKit/utils/msg.ts @@ -56,13 +56,14 @@ export const getMsgContentTipByType = (msg: { } export const setTabUnread = (val): void => { - console.log(val); + console.log('setTabUnread', val); const routes = getCurrentPages() const curRoute = routes[routes.length - 1].route const tabPaths = [ 'pages/home/index', + 'pages/home/order', 'pages/workBench/index', - 'pages/message/indexcopy', + 'pages/message/index', 'pages/person/index' ] if (curRoute && !tabPaths.includes(curRoute)) { @@ -92,9 +93,9 @@ export const setContactTabUnread = (): void => { const curRoute = routes[routes.length - 1].route const tabPaths = [ 'pages/home/index', + 'pages/home/order', 'pages/workBench/index', - 'pages/addJob/index', - 'pages/message/indexcopy', + 'pages/message/index', 'pages/person/index' ] if (curRoute && !tabPaths.includes(curRoute)) { diff --git a/root/person/avatar.vue b/root/person/avatar.vue index 32ee13c..48be3bd 100644 --- a/root/person/avatar.vue +++ b/root/person/avatar.vue @@ -90,6 +90,7 @@ export default { }, 1500); }); }, + 'avatar', "default", 1, $type