cyl/master-0822
wangxia 3 months ago
parent 7dd8471bb7
commit 55d7b2f3b9

@ -206,7 +206,7 @@ export default {
return; return;
} }
attemptReconnect(); attemptReconnect();
}, 5000); }, 50000);
}, },
initWyyx() { initWyyx() {

@ -8,88 +8,71 @@
import { getMsgContentTipByType, setTabUnread } from "../pages/NEUIKit/utils/msg"; import { getMsgContentTipByType, setTabUnread } from "../pages/NEUIKit/utils/msg";
import { trackInit } from "../pages/NEUIKit/utils/reporter.ts"; import { trackInit } from "../pages/NEUIKit/utils/reporter.ts";
export default { 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() { created() {
if (this.userInfo.agencyId) { let that = this;
this.tabbarInfo = [ this.isLogin = uni.getStorageSync("apply-userinfo") ? true : false;
{ console.log("createdcreatedcreated");
iconPath: "icon-home g_c_9", if (this.isLogin) {
selectedIconPath: "icon-home g_c_main", if (uni.$UIKitStore) {
pagePath: "/pages/home/index", trackInit("ConversationUIKit");
text: "首页", setTimeout(() => {
iconSize: 48, //
}, setTabUnread();
{ }, 100);
iconPath: "icon-fadanhao-32 g_c_9", } else {
selectedIconPath: "icon-fadanhao-32 g_c_main", setTimeout(() => {
pagePath: "/pages/home/order", //
text: "发单号", trackInit("ConversationUIKit");
iconSize: 48, 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", // iconPath: "icon-order_active g_c_9",
selectedIconPath: "icon-order_active g_c_main", // selectedIconPath: "icon-order_active g_c_main",
pagePath: "/pages/workBench/index", // pagePath: "/pages/workBench/index",
text: "工单", // text: "",
iconSize: 48, // iconSize: 48,
count: 0, // count: 0,
}, // },
{ // {
iconPath: "icon-message g_c_9", // iconPath: "icon-message g_c_9",
selectedIconPath: "icon-message g_c_main", // selectedIconPath: "icon-message g_c_main",
pagePath: "/pages/message/index", // pagePath: "/pages/message/index",
text: "消息", // text: "",
iconSize: 78, // iconSize: 78,
iconType: "custom", // iconType: "custom",
}, // },
{ // {
iconPath: "icon-user g_c_9", // iconPath: "icon-user g_c_9",
selectedIconPath: "icon-user g_c_main", // selectedIconPath: "icon-user g_c_main",
pagePath: "/pages/person/index", // pagePath: "/pages/person/index",
text: "我的", // text: "",
iconSize: 48, // iconSize: 48,
}, // },
]; // ];
} else { // } else {
if (!this.userInfo.agencyId) {
this.tabbarInfo = [ this.tabbarInfo = [
{ {
iconPath: "icon-home g_c_9", iconPath: "icon-home g_c_9",
@ -114,6 +97,7 @@ export default {
text: "消息", text: "消息",
iconSize: 78, iconSize: 78,
iconType: "custom", iconType: "custom",
count: 0,
}, },
{ {
iconPath: "icon-user g_c_9", 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() { data() {
return { return {
@ -132,46 +132,6 @@ export default {
corpUserFlag: uni.getStorageSync("apply-userinfo").corpUserFlag, corpUserFlag: uni.getStorageSync("apply-userinfo").corpUserFlag,
userInfo: uni.getStorageSync("apply-userinfo"), userInfo: uni.getStorageSync("apply-userinfo"),
globalData: getApp().globalData, 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: [ tabbarInfo: [
{ {
iconPath: "icon-home g_c_9", iconPath: "icon-home g_c_9",
@ -203,6 +163,7 @@ export default {
text: "消息", text: "消息",
iconSize: 78, iconSize: 78,
iconType: "custom", iconType: "custom",
count: 0,
}, },
{ {
iconPath: "icon-user g_c_9", iconPath: "icon-user g_c_9",
@ -227,42 +188,44 @@ export default {
uploadPage() { uploadPage() {
uni.vibrateShort(); uni.vibrateShort();
}, },
// setBadge(data) { setBadge(data) {
// let that = this; let that = this;
// // console.log("datadatadatadatadatadata", data); console.log("datadatadatadatadatadata", data);
// for (var k in that.tabbarInfo) { for (var k in that.tabbarInfo) {
// if (that.tabbarInfo[k].pagePath == "/pages/message/indexcopy") { console.log("that.tabbarInfo[k].pagePath", that.tabbarInfo[k]);
// if (data) { if (that.tabbarInfo[k].pagePath == "/pages/message/index") {
// // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount); if (data) {
// if (data.type == "message") { // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount);
// that.messageCount = data.count || 0; if (data.type == "message") {
// } else if (data.type == "notice") { that.messageCount = data.count || 0;
// that.noticeCount = data.count || 0; } else if (data.type == "notice") {
// } that.noticeCount = data.count || 0;
// // console.log(that.messageCount + "-------------------------" + that.noticeCount); }
// } else { // console.log(that.messageCount + "-------------------------" + that.noticeCount);
// that.messageCount = uni.getStorageSync("chat_info").count || 0; } else {
// that.noticeCount = uni.getStorageSync("notice_info").count || 0; that.messageCount = uni.getStorageSync("chat_info").count || 0;
// } that.noticeCount = uni.getStorageSync("notice_info").count || 0;
}
// that.tabbarInfo[k].count = that.messageCount + that.noticeCount; that.tabbarInfo[k].count = that.messageCount + that.noticeCount;
// // console.log("that.tabbarInfo[k].count", that.tabbarInfo[k].count); console.log("that.tabbarInfo[k].count", that.tabbarInfo[k].count);
// // that.tabbarInfo[k].type = data.type; // that.tabbarInfo[k].type = data.type;
// } else if (that.tabbarInfo[k].pagePath == "/pages/workBench/index") { }
// if (data) { // else if (that.tabbarInfo[k].pagePath == "/pages/workBench/index") {
// // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount); // if (data) {
// if (data.type == "follow") { // // console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount);
// that.followCount = data.count || 0; // if (data.type == "follow") {
// } // that.followCount = data.count || 0;
// }
// // console.log(that.messageCount + "-------------------------" + that.noticeCount); // // console.log(that.messageCount + "-------------------------" + that.noticeCount);
// } else { // } else {
// that.followCount = uni.getStorageSync("follow_info").count || 0; // that.followCount = uni.getStorageSync("follow_info").count || 0;
// } // }
// that.tabbarInfo[k].count = that.followCount; // that.tabbarInfo[k].count = that.followCount;
// } // }
// } }
// }, },
// checkUserAuth() { // checkUserAuth() {
// this.tabbarInfo = [ // this.tabbarInfo = [
// { // {

@ -178,19 +178,21 @@ export function createApp () {
/** /**
* 上传到oss * 上传到oss
*/ */
uploadImgToOss (callback = () => { }, type = 'default', $num = 1, $sourceType = ['album', 'camera']) { uploadImgToOss (callback = () => { }, customDir = '', type = 'default', $num = 1, $sourceType = ['album', 'camera']) {
var that = this; var that = this;
G.uploadImage($num, (imgRes) => { G.uploadImage($num, (imgRes) => {
uni.showLoading({ uni.showLoading({
title: '上传中...', title: '上传中...',
}) })
console.log('imgRes', imgRes);
let imgPath = JSON.parse(imgRes)[0] let imgPath = JSON.parse(imgRes)[0]
console.log('imgPath', imgPath); console.log('imgPath', imgPath);
G.Get(apiInfo.getOssInfo, {}, ({ data }) => { G.Get(apiInfo.getOssInfo, { prefix: customDir }, ({ data }) => {
console.log('uploadImgToOssresresresres', data); console.log('uploadImgToOssresresresres', data);
const { policy, signature, accessid, dir, host } = data; const { policy, signature, accessid, dir, host } = data;
let key = (customDir ? (customDir + '/') : dir) + that.getUUID()
const formData = { const formData = {
"key": dir + that.getUUID() + "_${filename}", "key": key + "_${filename}",
"policy": policy, "policy": policy,
"OSSAccessKeyId": accessid, "OSSAccessKeyId": accessid,
signature, signature,
@ -205,7 +207,7 @@ export function createApp () {
formData: formData, formData: formData,
success: function (res) { success: function (res) {
if (res.errMsg = "uploadFile:ok") { if (res.errMsg = "uploadFile:ok") {
const imgUrl = host + "/" + dir + imgPath.split('/').pop(); const imgUrl = `${host}/${key}_${imgPath.split('/').pop()}`;
callback({ callback({
status: '上传成功', status: '上传成功',
image: imgUrl image: imgUrl

@ -56,13 +56,14 @@ export const getMsgContentTipByType = (msg: {
} }
export const setTabUnread = (val): void => { export const setTabUnread = (val): void => {
console.log(val); console.log('setTabUnread', val);
const routes = getCurrentPages() const routes = getCurrentPages()
const curRoute = routes[routes.length - 1].route const curRoute = routes[routes.length - 1].route
const tabPaths = [ const tabPaths = [
'pages/home/index', 'pages/home/index',
'pages/home/order',
'pages/workBench/index', 'pages/workBench/index',
'pages/message/indexcopy', 'pages/message/index',
'pages/person/index' 'pages/person/index'
] ]
if (curRoute && !tabPaths.includes(curRoute)) { if (curRoute && !tabPaths.includes(curRoute)) {
@ -92,9 +93,9 @@ export const setContactTabUnread = (): void => {
const curRoute = routes[routes.length - 1].route const curRoute = routes[routes.length - 1].route
const tabPaths = [ const tabPaths = [
'pages/home/index', 'pages/home/index',
'pages/home/order',
'pages/workBench/index', 'pages/workBench/index',
'pages/addJob/index', 'pages/message/index',
'pages/message/indexcopy',
'pages/person/index' 'pages/person/index'
] ]
if (curRoute && !tabPaths.includes(curRoute)) { if (curRoute && !tabPaths.includes(curRoute)) {

@ -90,6 +90,7 @@ export default {
}, 1500); }, 1500);
}); });
}, },
'avatar',
"default", "default",
1, 1,
$type $type

Loading…
Cancel
Save