修改 app问题
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
// export const MQTT_IP = '192.168.1.24:10215/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
||||||
export const MQTT_IP = 'pqmcn.com:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
export const MQTT_IP = 'pqmcn.com:8085/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
||||||
|
|
||||||
const MQTT_USERNAME = 't_user'//mqtt用户名
|
const MQTT_USERNAME = 't_user'//mqtt用户名
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"name" : "灿能物联",
|
"name" : "灿能物联",
|
||||||
"appid" : "__UNI__88BC25B",
|
"appid" : "__UNI__88BC25B",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.6.0",
|
"versionName" : "1.6.1",
|
||||||
"versionCode" : 160,
|
"versionCode" : 161,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default {
|
|||||||
onNavigationBarButtonTap(e) {
|
onNavigationBarButtonTap(e) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确定要全部标记为已读吗1?',
|
content: '确定要全部标记为已读吗?',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
updateStatus({
|
updateStatus({
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ export default {
|
|||||||
if (messagePage) {
|
if (messagePage) {
|
||||||
uni.setTabBarBadge({
|
uni.setTabBarBadge({
|
||||||
index: 1,
|
index: 1,
|
||||||
text: messagePage ? messagePage + '' : '',
|
text:messagePage ? (messagePage > 99 ? '99+' : messagePage + '') : '',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.removeTabBarBadge({
|
uni.removeTabBarBadge({
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getDevCount } from '../../common/api/device.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -37,8 +38,10 @@ export default {
|
|||||||
userInfo: {},
|
userInfo: {},
|
||||||
messageCount: {},
|
messageCount: {},
|
||||||
timer: null,
|
timer: null,
|
||||||
|
devCount: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.userInfo = uni.getStorageSync('userInfo')
|
this.userInfo = uni.getStorageSync('userInfo')
|
||||||
@@ -76,10 +79,58 @@ export default {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getDevCount() {
|
||||||
|
if (uni.getStorageSync('projectList')[1] != undefined) {
|
||||||
|
getDevCount(uni.getStorageSync('projectList')[1].engineeringId).then((res) => {
|
||||||
|
this.devCount = res.data
|
||||||
|
this.devCount.currentOffLineDevs.forEach((item) => {
|
||||||
|
item.runStatus = 1
|
||||||
|
})
|
||||||
|
this.devCount.offLineDevs.forEach((item) => {
|
||||||
|
item.runStatus = 1
|
||||||
|
})
|
||||||
|
uni.setStorage({
|
||||||
|
key: this.$cacheKey.messageCount,
|
||||||
|
data: this.devCount,
|
||||||
|
})
|
||||||
|
let messagePage =
|
||||||
|
this.devCount.runCount +
|
||||||
|
this.devCount.eventCount +
|
||||||
|
this.devCount.alarmCount +
|
||||||
|
this.devCount.harmonicCount
|
||||||
|
let minePage = this.devCount.feedBackCount
|
||||||
|
|
||||||
|
if (messagePage) {
|
||||||
|
uni.setTabBarBadge({
|
||||||
|
index: 1,
|
||||||
|
text:messagePage ? (messagePage > 99 ? '99+' : messagePage + '') : '',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.removeTabBarBadge({
|
||||||
|
index: 1,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (minePage) {
|
||||||
|
uni.setTabBarBadge({
|
||||||
|
index: 2,
|
||||||
|
text: minePage + '',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.removeTabBarBadge({
|
||||||
|
index: 2,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.setBadgeNumber(messagePage + minePage)
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onLoad(options) {},
|
onLoad(options) {},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.init()
|
this.init()
|
||||||
|
this.getDevCount()
|
||||||
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
|
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
|
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
|
||||||
|
|||||||
@@ -84,11 +84,11 @@ export default {
|
|||||||
}
|
}
|
||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
onShow() {},
|
// onShow() { this.init()},
|
||||||
onNavigationBarButtonTap(e) {
|
onNavigationBarButtonTap(e) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确定要全部标记为已读吗2?',
|
content: '确定要全部标记为已读吗?',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
updateStatus({
|
updateStatus({
|
||||||
@@ -136,8 +136,13 @@ export default {
|
|||||||
this.store.reload()
|
this.store.reload()
|
||||||
},
|
},
|
||||||
jump(item) {
|
jump(item) {
|
||||||
|
console.log(`123`,item);
|
||||||
|
console.log(`123`,this.type);
|
||||||
if (this.type === '0') {
|
if (this.type === '0') {
|
||||||
|
|
||||||
let str = JSON.stringify(item).replace(/%/g, '百分比')
|
let str = JSON.stringify(item).replace(/%/g, '百分比')
|
||||||
|
item.status = '1'
|
||||||
|
|
||||||
uni.navigateTo({ url: '/pages/message/messageDetail?detail=' + encodeURIComponent(str) })
|
uni.navigateTo({ url: '/pages/message/messageDetail?detail=' + encodeURIComponent(str) })
|
||||||
} else {
|
} else {
|
||||||
if (item.status != '1') {
|
if (item.status != '1') {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<view class="about">
|
<view class="about">
|
||||||
<image src="/static/logo.png" class="logo"></image>
|
<image src="/static/logo.png" class="logo"></image>
|
||||||
<view class="name">灿能物联</view>
|
<view class="name">灿能物联</view>
|
||||||
<view class="version">Version 1.6.0</view>
|
<view class="version">Version 1.6.1</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</Cn-page>
|
</Cn-page>
|
||||||
|
|||||||
@@ -2,38 +2,72 @@
|
|||||||
<!-- #ifdef APP-NVUE -->
|
<!-- #ifdef APP-NVUE -->
|
||||||
<cell>
|
<cell>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<view :hover-class="!clickable && !link ? '' : 'uni-list-chat--hover'" class="uni-list-chat" @click.stop="onClick">
|
<view
|
||||||
|
:hover-class="!clickable && !link ? '' : 'uni-list-chat--hover'"
|
||||||
|
class="uni-list-chat"
|
||||||
|
@click.stop="onClick"
|
||||||
|
>
|
||||||
<view :class="{ 'uni-list--border': border, 'uni-list-chat--first': isFirstChild }"></view>
|
<view :class="{ 'uni-list--border': border, 'uni-list-chat--first': isFirstChild }"></view>
|
||||||
<view class="uni-list-chat__container">
|
<view class="uni-list-chat__container">
|
||||||
<view class="uni-list-chat__header-warp">
|
<view class="uni-list-chat__header-warp">
|
||||||
<view v-if="avatarCircle || avatarList.length === 0" class="uni-list-chat__header" :class="{ 'header--circle': avatarCircle }">
|
<view
|
||||||
<image class="uni-list-chat__header-image" :class="{ 'header--circle': avatarCircle }" :src="avatarUrl" mode="aspectFill"></image>
|
v-if="avatarCircle || avatarList.length === 0"
|
||||||
|
class="uni-list-chat__header"
|
||||||
|
:class="{ 'header--circle': avatarCircle }"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="uni-list-chat__header-image"
|
||||||
|
:class="{ 'header--circle': avatarCircle }"
|
||||||
|
:src="avatarUrl"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
</view>
|
</view>
|
||||||
<!-- 头像组 -->
|
<!-- 头像组 -->
|
||||||
<view v-else class="uni-list-chat__header">
|
<view v-else class="uni-list-chat__header">
|
||||||
<view v-for="(item, index) in avatarList" :key="index" class="uni-list-chat__header-box" :class="computedAvatar"
|
<view
|
||||||
:style="{ width: imageWidth + 'px', height: imageWidth + 'px' }">
|
v-for="(item, index) in avatarList"
|
||||||
<image class="uni-list-chat__header-image" :style="{ width: imageWidth + 'px', height: imageWidth + 'px' }" :src="item.url"
|
:key="index"
|
||||||
mode="aspectFill"></image>
|
class="uni-list-chat__header-box"
|
||||||
|
:class="computedAvatar"
|
||||||
|
:style="{ width: imageWidth + 'px', height: imageWidth + 'px' }"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="uni-list-chat__header-image"
|
||||||
|
:style="{ width: imageWidth + 'px', height: imageWidth + 'px' }"
|
||||||
|
:src="item.url"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="badgeText && badgePositon === 'left'" class="uni-list-chat__badge uni-list-chat__badge-pos" :class="[isSingle]">
|
<view
|
||||||
|
v-if="badgeText && badgePositon === 'left'"
|
||||||
|
class="uni-list-chat__badge uni-list-chat__badge-pos"
|
||||||
|
:class="[isSingle]"
|
||||||
|
>
|
||||||
<text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text>
|
<text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-list-chat__content">
|
<view class="uni-list-chat__content">
|
||||||
<view class="uni-list-chat__content-main">
|
<view class="uni-list-chat__content-main">
|
||||||
<text class="uni-list-chat__content-title uni-ellipsis">{{ title }}</text>
|
<text class="uni-list-chat__content-title uni-ellipsis">{{ title }}</text>
|
||||||
<view style="flex-direction: row;">
|
<view style="flex-direction: row">
|
||||||
<text class="draft" v-if="isDraft">[草稿]</text>
|
<text class="draft" v-if="isDraft">[草稿]</text>
|
||||||
<text class="uni-list-chat__content-note uni-ellipsis">{{isDraft?note.slice(14,-1):note}}</text>
|
<text class="uni-list-chat__content-note uni-ellipsis">{{
|
||||||
|
isDraft ? note.slice(14, -1) : note
|
||||||
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-list-chat__content-extra">
|
<view class="uni-list-chat__content-extra">
|
||||||
<slot>
|
<slot>
|
||||||
<text class="uni-list-chat__content-extra-text">{{ time }}</text>
|
<text class="uni-list-chat__content-extra-text">{{ time }}</text>
|
||||||
<view v-if="badgeText && badgePositon === 'right'" class="uni-list-chat__badge" :class="[isSingle, badgePositon === 'right' ? 'uni-list-chat--right' : '']">
|
<view
|
||||||
<text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text>
|
v-if="badgeText && badgePositon === 'right'"
|
||||||
|
class="uni-list-chat__badge"
|
||||||
|
:class="[isSingle, badgePositon === 'right' ? 'uni-list-chat--right' : '']"
|
||||||
|
>
|
||||||
|
<text class="uni-list-chat__badge-text">{{
|
||||||
|
badgeText === 'dot' ? '' : badgeText
|
||||||
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</slot>
|
</slot>
|
||||||
</view>
|
</view>
|
||||||
@@ -47,7 +81,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 头像大小
|
// 头像大小
|
||||||
const avatarWidth = 45;
|
const avatarWidth = 45
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ListChat 聊天列表
|
* ListChat 聊天列表
|
||||||
@@ -77,50 +111,50 @@
|
|||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
},
|
},
|
||||||
note: {
|
note: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
},
|
},
|
||||||
clickable: {
|
clickable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
type: [Boolean, String],
|
type: [Boolean, String],
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
},
|
},
|
||||||
badgeText: {
|
badgeText: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: ''
|
default: '',
|
||||||
},
|
},
|
||||||
badgePositon: {
|
badgePositon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'right'
|
default: 'right',
|
||||||
},
|
},
|
||||||
time: {
|
time: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
},
|
},
|
||||||
avatarCircle: {
|
avatarCircle: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
avatar: {
|
avatar: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: '',
|
||||||
},
|
},
|
||||||
avatarList: {
|
avatarList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default() {
|
default() {
|
||||||
return [];
|
return []
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
// inject: ['list'],
|
// inject: ['list'],
|
||||||
computed: {
|
computed: {
|
||||||
@@ -129,36 +163,38 @@
|
|||||||
},
|
},
|
||||||
isSingle() {
|
isSingle() {
|
||||||
if (this.badgeText === 'dot') {
|
if (this.badgeText === 'dot') {
|
||||||
return 'uni-badge--dot';
|
return 'uni-badge--dot'
|
||||||
} else {
|
} else {
|
||||||
const badgeText = this.badgeText.toString();
|
const badgeText = this.badgeText.toString()
|
||||||
if (badgeText.length > 1) {
|
if (badgeText.length > 1) {
|
||||||
return 'uni-badge--complex';
|
return 'uni-badge--complex'
|
||||||
} else {
|
} else {
|
||||||
return 'uni-badge--single';
|
return 'uni-badge--single'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computedAvatar() {
|
computedAvatar() {
|
||||||
if (this.avatarList.length > 4) {
|
if (this.avatarList.length > 4) {
|
||||||
this.imageWidth = avatarWidth * 0.31;
|
this.imageWidth = avatarWidth * 0.31
|
||||||
return 'avatarItem--3';
|
return 'avatarItem--3'
|
||||||
} else if (this.avatarList.length > 1) {
|
} else if (this.avatarList.length > 1) {
|
||||||
this.imageWidth = avatarWidth * 0.47;
|
this.imageWidth = avatarWidth * 0.47
|
||||||
return 'avatarItem--2';
|
return 'avatarItem--2'
|
||||||
} else {
|
} else {
|
||||||
this.imageWidth = avatarWidth;
|
this.imageWidth = avatarWidth
|
||||||
return 'avatarItem--1';
|
return 'avatarItem--1'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
avatar: {
|
avatar: {
|
||||||
handler(avatar) {
|
handler(avatar) {
|
||||||
if (avatar.includes('://')) {
|
if (avatar.includes('://')) {
|
||||||
uniCloud.getTempFileURL({
|
uniCloud
|
||||||
fileList: [avatar]
|
.getTempFileURL({
|
||||||
}).then(res=>{
|
fileList: [avatar],
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
// 兼容uniCloud私有化部署
|
// 兼容uniCloud私有化部署
|
||||||
let fileList = res.fileList || res.result.fileList
|
let fileList = res.fileList || res.result.fileList
|
||||||
@@ -168,8 +204,8 @@
|
|||||||
this.avatarUrl = avatar
|
this.avatarUrl = avatar
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -177,17 +213,17 @@
|
|||||||
border: true,
|
border: true,
|
||||||
// avatarList: 3,
|
// avatarList: 3,
|
||||||
imageWidth: 50,
|
imageWidth: 50,
|
||||||
avatarUrl:''
|
avatarUrl: '',
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.list = this.getForm()
|
this.list = this.getForm()
|
||||||
if (this.list) {
|
if (this.list) {
|
||||||
if (!this.list.firstChildAppend) {
|
if (!this.list.firstChildAppend) {
|
||||||
this.list.firstChildAppend = true;
|
this.list.firstChildAppend = true
|
||||||
this.isFirstChild = true;
|
this.isFirstChild = true
|
||||||
}
|
}
|
||||||
this.border = this.list.border;
|
this.border = this.list.border
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -195,52 +231,52 @@
|
|||||||
* 获取父元素实例
|
* 获取父元素实例
|
||||||
*/
|
*/
|
||||||
getForm(name = 'uniList') {
|
getForm(name = 'uniList') {
|
||||||
let parent = this.$parent;
|
let parent = this.$parent
|
||||||
let parentName = parent.$options.name;
|
let parentName = parent.$options.name
|
||||||
while (parentName !== name) {
|
while (parentName !== name) {
|
||||||
parent = parent.$parent;
|
parent = parent.$parent
|
||||||
if (!parent) return false
|
if (!parent) return false
|
||||||
parentName = parent.$options.name;
|
parentName = parent.$options.name
|
||||||
}
|
}
|
||||||
return parent;
|
return parent
|
||||||
},
|
},
|
||||||
onClick() {
|
onClick() {
|
||||||
if (this.to !== '') {
|
if (this.to !== '') {
|
||||||
this.openPage();
|
this.openPage()
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.clickable || this.link) {
|
if (this.clickable || this.link) {
|
||||||
this.$emit('click', {
|
this.$emit('click', {
|
||||||
data: {}
|
data: {},
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openPage() {
|
openPage() {
|
||||||
if (['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'].indexOf(this.link) !== -1) {
|
if (['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'].indexOf(this.link) !== -1) {
|
||||||
this.pageApi(this.link);
|
this.pageApi(this.link)
|
||||||
} else {
|
} else {
|
||||||
this.pageApi('navigateTo');
|
this.pageApi('navigateTo')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pageApi(api) {
|
pageApi(api) {
|
||||||
uni[api]({
|
uni[api]({
|
||||||
url: this.to,
|
url: this.to,
|
||||||
success: res => {
|
success: (res) => {
|
||||||
this.$emit('click', {
|
this.$emit('click', {
|
||||||
data: res
|
data: res,
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: (err) => {
|
||||||
this.$emit('click', {
|
this.$emit('click', {
|
||||||
data: err
|
data: err,
|
||||||
});
|
})
|
||||||
console.error(err.errMsg);
|
console.error(err.errMsg)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -471,7 +507,8 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.draft ,.uni-list-chat__content-note {
|
.draft,
|
||||||
|
.uni-list-chat__content-note {
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
color: $note-color;
|
color: $note-color;
|
||||||
font-size: $note-size;
|
font-size: $note-size;
|
||||||
|
|||||||
Reference in New Issue
Block a user