推送功能修复

This commit is contained in:
THK3121 2023-08-29 16:45:34 +08:00
parent 7f23c975c5
commit eac42fd42c
5 changed files with 780 additions and 766 deletions

28
App.vue
View File

@ -5,6 +5,18 @@
// #endif
export default {
onLaunch: async function() {
// let noticeArr = []
// jpushModule.addNotificationListener(res => {
// if (!noticeArr.includes(res.messageID)) {
// const audioContext = uni.createInnerAudioContext()
// //
// audioContext.src = `/static/audio/order.mp3`;
// // console.log(res.messageID)
// audioContext.play()
// noticeArr.push(res.messageID)
// console.log("app")
// }
// })
console.log('App Launch')
this.$store.dispatch('initConfig');
try {
@ -20,22 +32,14 @@
onShow: function() {
const audioContext = uni.createInnerAudioContext()
//
audioContext.src = './static/mp3/order.mp3'
let noticeArr = []
audioContext.src = '/static/mp3/order.mp3'
//
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
if (!noticeArr.includes(res.messageID)) {
console.log(res.messageID)
if (res.notificationEventType == 'notificationOpened') return
audioContext.play()
noticeArr.push(res.messageID)
console.log("app的")
uni.vibrateLong({
success: function() {
console.log('success');
}
});
}
uni.vibrateLong();
console.log("app的监听")
})
//
// Updater.update({

View File

@ -2,12 +2,10 @@
<view class="oa_home" style="oaColor">
<!-- <image class="header_bg" src="../../static/img/home/head-bg.png"></image> -->
<view
class="home_header"
:class="!ApproveList.length > 0 ? 'home_header_no_data' : ''"
>
<view class="home_header" :class="!ApproveList.length > 0 ? 'home_header_no_data' : ''">
<view style="position: absolute;bottom: 0;left: 0;overflow: hidden;border-radius: 0 0 30rpx 30rpx;">
<hx-lottie :options="options" ref="lottie" style="width: 100vw;height: 440rpx;transform: scale(1.2);background-color: #0122c7;"/>
<hx-lottie :options="options" ref="lottie"
style="width: 100vw;height: 440rpx;transform: scale(1.2);background-color: #0122c7;" />
</view>
<!-- #ifdef APP-PLUS||H5 -->
<view style="height: var(--status-bar-height)"></view>
@ -22,46 +20,30 @@
</view>
<view class="head_img">
<view class="img_box">
<u--image
:showLoading="true"
width="131.43rpx"
height="131.43rpx"
class="img_box_img"
:src="myOaInfo.avatar || '../../static/img/public/avatar.png'"
shape="circle"
></u--image>
<u--image :showLoading="true" width="131.43rpx" height="131.43rpx" class="img_box_img"
:src="myOaInfo.avatar || '../../static/img/public/avatar.png'" shape="circle"></u--image>
</view>
<text class="head_text">工作证: {{ myOaInfo.nickname }}</text>
<text class="head_text" style="flex-shrink: 0"
>身份: {{ myOaInfo.admin_id ? "管理员" : "普通用户" }}</text
>
<text class="head_text" style="flex-shrink: 0">身份: {{ myOaInfo.admin_id ? "管理员" : "普通用户" }}</text>
</view>
</view>
<!-- 占位 -->
<view style="height: 150rpx"></view>
<view
class="backlog"
:class="!ApproveList.length > 0 ? 'backlog_no_data' : ''"
>
<view class="backlog" :class="!ApproveList.length > 0 ? 'backlog_no_data' : ''">
<view class="head_title flex_a_c_j_sb">
<view class="title">公告列表</view>
<view class="flex_a_c" @click="navTo('/subpkg/noticeList/noticeList')"
>更多
<view class="flex_a_c" @click="navTo('/subpkg/noticeList/noticeList')">更多
<view class="iconfont icon-you">
<uni-icons type="forward"></uni-icons>
</view>
</view>
</view>
<block v-if="ApproveList.length > 0">
<view
class="backlog_item flex_a_c_j_sb"
v-for="(item, index) in ApproveList.slice(0, 2)"
:key="index"
@click="clickNotice(item.id)"
>
<view class="backlog_item flex_a_c_j_sb" v-for="(item, index) in ApproveList.slice(0, 2)"
:key="index" @click="clickNotice(item.id)">
<view class="text">
<text class="text_time">{{
item.create_time.substring(0, 10).replace(/-/g, ".")
@ -69,16 +51,12 @@
{{ item.title }}
</view>
<i class="iconfont icon-you"
><uni-icons type="forward"></uni-icons
></i>
<i class="iconfont icon-you"><uni-icons type="forward"></uni-icons></i>
</view>
</block>
<view v-else class="backlog_no flex_a_c_j_sb">
<view class="text">暂无更多消息</view>
<i class="iconfont icon-you"
><uni-icons type="forward"></uni-icons
></i>
<i class="iconfont icon-you"><uni-icons type="forward"></uni-icons></i>
</view>
</view>
</view>
@ -97,13 +75,8 @@
<view class="fast_track">
<block v-for="(item, index) in oaHomeData" :key="item.id">
<view class="track_item" @click="navTwo(item.paths, index)">
<u--image
:showLoading="true"
:src="item.icon"
mode="widthFix"
width="77.19rpx"
height="77.19rpx"
></u--image>
<u--image :showLoading="true" :src="item.icon" mode="widthFix" width="77.19rpx"
height="77.19rpx"></u--image>
<view class="title">{{ item.name }}</view>
</view>
</block>
@ -112,8 +85,7 @@
<view class="my_task">
<view class="task_title flex_a_c_j_sb">
<view class="title">配送信息</view>
<view class="flex_a_c" @click="goOrderList"
>更多
<view class="flex_a_c" @click="goOrderList">更多
<view class="iconfont icon-you">
<uni-icons type="forward"></uni-icons>
</view>
@ -123,21 +95,16 @@
<!-- <block v-if="myTaskList.length>0">
<taskCard></taskCard>
</block> -->
<!-- <button @click="test">按钮</button> -->
<view v-if="orderList.length > 0">
<globalPopup ref="globalPopup"></globalPopup>
<logistiBriefCard
v-for="(item, index) in orderList"
:key="index"
:goodsInfo="item"
>
<logistiBriefCard v-for="(item, index) in orderList" :key="index" :goodsInfo="item">
</logistiBriefCard>
</view>
<view v-else class="no_task">
<view class="title">暂无配送信息</view>
<view class="tips" v-if="!$store.state.app.token"
>登录后查看配送信息详情</view
>
<view class="tips" v-if="!$store.state.app.token">登录后查看配送信息详情</view>
</view>
<!-- <view class="head_title flex_a_c_j_sb">
<view class="">我的任务</view>
@ -190,7 +157,9 @@ import {
import {
noticeList
} from "@/api/notice.js";
import { mapState } from "@/store/index.js"
import {
mapState
} from "@/store/index.js"
// import tabbar from '../components/tabbar'
import {
getIndexListAPI,
@ -255,17 +224,28 @@ export default {
onLoad() {
this.is_captain = JSON.parse(uni.getStorageSync("USER_INFO")).is_captain
this.options.data = bj;
//#ifdef APP-PLUS
let that = this;
jpushModule.addNotificationListener(function (result) {
if (!that.notArr.includes(result.messageID)) {
that.$refs.globalPopup.showPopu();
that.getOrderList();
console.log("idnex的");
that.notArr.push(result.messageID);
}
});
// #endif
// jpushModule.addNotificationListener(res => {
// // if (res.notificationEventType == 'notificationOpened') return
// // audioContext.play()
// // console.log("app")
// console.log("index")
// })
// //#ifdef APP-PLUS
// let that = this;
// jpushModule.addNotificationListener(function(result) {
// that.getOrderList()
// console.log("idnex dde")
// // if (!that.notArr.includes(result.messageID)) {
// // that.$refs.globalPopup.showPopu();
// // that.getOrderList();
// // console.log("idnex");
// // that.notArr.push(result.messageID);
// // }
// });
// // #endif
},
onShow() {
@ -276,6 +256,8 @@ export default {
this.showToask();
// this.initOaHomeDada();
this.getOrderList();
this.test()
},
computed: {
oaHomeData() {
@ -288,7 +270,8 @@ export default {
})
if (arr.length >= 8) {
arr = arr.slice(0, 7);
let obj = this.$store.state.config?.config?.menu?.find(item=>item.paths.includes('/pages/moreFun/moreFun'));
let obj = this.$store.state.config?.config?.menu?.find(item => item.paths.includes(
'/pages/moreFun/moreFun'));
arr.push(obj);
}
return arr;
@ -296,10 +279,25 @@ export default {
},
methods: {
test() {
// const audioContext = uni.createInnerAudioContext()
// // //
// audioContext.src = '/static/mp3/order.mp3'
// audioContext.play()
// console.log("sdsdsd")
const audioContext = uni.createInnerAudioContext()
//
audioContext.src = '/static/mp3/order.mp3'
jpushModule.addNotificationListener(res => {
if (res.notificationEventType == 'notificationOpened') return
audioContext.play()
uni.vibrateLong();
this.getOrderList()
this.$refs.globalPopup.showPopu();
console.log("index的监听")
})
},
async getOrderList() {
console.log("列表")
// console.log("")
let id = JSON.parse(uni.getStorageSync("USER_INFO")).id || "";
let res = await getList({
user_id: id,
@ -447,6 +445,7 @@ export default {
},
},
onPullDownRefresh() {
this.getOrderList();
// this.getIndexList()
uni.stopPullDownRefresh();
@ -508,6 +507,7 @@ export default {
transform: translate(-50%, -50%);
}
}
.head_text {
font-size: 33rpx;
text-overflow: ellipsis;

View File

@ -63,7 +63,7 @@
<view class="btns">
<u-button type="primary" @click="showPop=true" style="margin-bottom: 20rpx;width: 100%;" color="#FF7C32"
text="申请驳回"></u-button>
<u-button type="primary" text="生成合同" color="#0122C7"></u-button>
<u-button type="primary" text="生成合同" @tap="contractFn" color="#0122C7"></u-button>
</view>
<view class="">
<u-modal :show="showPop" @close="showPop=false" @confirm="confirm" :closeOnClickOverlay="true"
@ -86,6 +86,9 @@
contractApi,
overruleApi
} from "@/api/property.js"
import {
Toast
} from "../../libs/uniApi"
export default {
data() {
return {
@ -98,7 +101,15 @@
methods: {
confirm() {
console.log(this.overruleValue)
overruleApi().then(res => {
Toast("操作成功")
this.showPop = false
})
},
contractFn() {
contractApi().then(res => {
Toast("操作成功")
})
},
navTo(url) {
uni.navigateTo({
@ -113,11 +124,9 @@
<style lang="scss" scoped>
.date {
padding: 10rpx 28rpx 0;
}
.cards {
margin: 28rpx;
width: 694rpx;
background: #ffffff;

View File

@ -201,7 +201,7 @@
data() {
return {
applicationList: [1, 1],
isNewCheck: true,
// isNewCheck: true,
showPop: false,
dataList: [1, 2, 3],
tabLists: [{
@ -241,7 +241,8 @@
if (!this.newCarNum) return
// leaseApi().then(res=>{})
this.showPop = false
this.isNewCheck = true
Toast("操作成功")
// this.isNewCheck = true
},

View File

@ -22,7 +22,7 @@
<view class="personnel_list" @click="toDetail('/subpkg/property/vehicle')">
<view class="cards">
<view class="cards_head">
<text><!-- <!-- {{datas.}} --> --></text>
<text><!-- <!-- {{datas.}} --></text>
</view>
<view class="cards_content">
<view class="right">