推送功能修复

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

View File

@ -2,12 +2,10 @@
<view class="oa_home" style="oaColor"> <view class="oa_home" style="oaColor">
<!-- <image class="header_bg" src="../../static/img/home/head-bg.png"></image> --> <!-- <image class="header_bg" src="../../static/img/home/head-bg.png"></image> -->
<view <view class="home_header" :class="!ApproveList.length > 0 ? 'home_header_no_data' : ''">
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;"> <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> </view>
<!-- #ifdef APP-PLUS||H5 --> <!-- #ifdef APP-PLUS||H5 -->
<view style="height: var(--status-bar-height)"></view> <view style="height: var(--status-bar-height)"></view>
@ -22,46 +20,30 @@
</view> </view>
<view class="head_img"> <view class="head_img">
<view class="img_box"> <view class="img_box">
<u--image <u--image :showLoading="true" width="131.43rpx" height="131.43rpx" class="img_box_img"
:showLoading="true" :src="myOaInfo.avatar || '../../static/img/public/avatar.png'" shape="circle"></u--image>
width="131.43rpx"
height="131.43rpx"
class="img_box_img"
:src="myOaInfo.avatar || '../../static/img/public/avatar.png'"
shape="circle"
></u--image>
</view> </view>
<text class="head_text">工作证: {{ myOaInfo.nickname }}</text> <text class="head_text">工作证: {{ myOaInfo.nickname }}</text>
<text class="head_text" style="flex-shrink: 0" <text class="head_text" style="flex-shrink: 0">身份: {{ myOaInfo.admin_id ? "管理员" : "普通用户" }}</text>
>身份: {{ myOaInfo.admin_id ? "管理员" : "普通用户" }}</text
>
</view> </view>
</view> </view>
<!-- 占位 --> <!-- 占位 -->
<view style="height: 150rpx"></view> <view style="height: 150rpx"></view>
<view <view class="backlog" :class="!ApproveList.length > 0 ? 'backlog_no_data' : ''">
class="backlog"
:class="!ApproveList.length > 0 ? 'backlog_no_data' : ''"
>
<view class="head_title flex_a_c_j_sb"> <view class="head_title flex_a_c_j_sb">
<view class="title">公告列表</view> <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"> <view class="iconfont icon-you">
<uni-icons type="forward"></uni-icons> <uni-icons type="forward"></uni-icons>
</view> </view>
</view> </view>
</view> </view>
<block v-if="ApproveList.length > 0"> <block v-if="ApproveList.length > 0">
<view <view class="backlog_item flex_a_c_j_sb" v-for="(item, index) in ApproveList.slice(0, 2)"
class="backlog_item flex_a_c_j_sb" :key="index" @click="clickNotice(item.id)">
v-for="(item, index) in ApproveList.slice(0, 2)"
:key="index"
@click="clickNotice(item.id)"
>
<view class="text"> <view class="text">
<text class="text_time">{{ <text class="text_time">{{
item.create_time.substring(0, 10).replace(/-/g, ".") item.create_time.substring(0, 10).replace(/-/g, ".")
@ -69,16 +51,12 @@
{{ item.title }} {{ item.title }}
</view> </view>
<i class="iconfont icon-you" <i class="iconfont icon-you"><uni-icons type="forward"></uni-icons></i>
><uni-icons type="forward"></uni-icons
></i>
</view> </view>
</block> </block>
<view v-else class="backlog_no flex_a_c_j_sb"> <view v-else class="backlog_no flex_a_c_j_sb">
<view class="text">暂无更多消息</view> <view class="text">暂无更多消息</view>
<i class="iconfont icon-you" <i class="iconfont icon-you"><uni-icons type="forward"></uni-icons></i>
><uni-icons type="forward"></uni-icons
></i>
</view> </view>
</view> </view>
</view> </view>
@ -97,13 +75,8 @@
<view class="fast_track"> <view class="fast_track">
<block v-for="(item, index) in oaHomeData" :key="item.id"> <block v-for="(item, index) in oaHomeData" :key="item.id">
<view class="track_item" @click="navTwo(item.paths, index)"> <view class="track_item" @click="navTwo(item.paths, index)">
<u--image <u--image :showLoading="true" :src="item.icon" mode="widthFix" width="77.19rpx"
:showLoading="true" height="77.19rpx"></u--image>
:src="item.icon"
mode="widthFix"
width="77.19rpx"
height="77.19rpx"
></u--image>
<view class="title">{{ item.name }}</view> <view class="title">{{ item.name }}</view>
</view> </view>
</block> </block>
@ -112,8 +85,7 @@
<view class="my_task"> <view class="my_task">
<view class="task_title flex_a_c_j_sb"> <view class="task_title flex_a_c_j_sb">
<view class="title">配送信息</view> <view class="title">配送信息</view>
<view class="flex_a_c" @click="goOrderList" <view class="flex_a_c" @click="goOrderList">更多
>更多
<view class="iconfont icon-you"> <view class="iconfont icon-you">
<uni-icons type="forward"></uni-icons> <uni-icons type="forward"></uni-icons>
</view> </view>
@ -123,21 +95,16 @@
<!-- <block v-if="myTaskList.length>0"> <!-- <block v-if="myTaskList.length>0">
<taskCard></taskCard> <taskCard></taskCard>
</block> --> </block> -->
<!-- <button @click="test">按钮</button> -->
<view v-if="orderList.length > 0"> <view v-if="orderList.length > 0">
<globalPopup ref="globalPopup"></globalPopup> <globalPopup ref="globalPopup"></globalPopup>
<logistiBriefCard <logistiBriefCard v-for="(item, index) in orderList" :key="index" :goodsInfo="item">
v-for="(item, index) in orderList"
:key="index"
:goodsInfo="item"
>
</logistiBriefCard> </logistiBriefCard>
</view> </view>
<view v-else class="no_task"> <view v-else class="no_task">
<view class="title">暂无配送信息</view> <view class="title">暂无配送信息</view>
<view class="tips" v-if="!$store.state.app.token" <view class="tips" v-if="!$store.state.app.token">登录后查看配送信息详情</view>
>登录后查看配送信息详情</view
>
</view> </view>
<!-- <view class="head_title flex_a_c_j_sb"> <!-- <view class="head_title flex_a_c_j_sb">
<view class="">我的任务</view> <view class="">我的任务</view>
@ -176,40 +143,42 @@
</template> </template>
<script> <script>
import logistiBriefCard from "@/components/logistiComptent/logistiCard/logistiBriefCard.vue"; import logistiBriefCard from "@/components/logistiComptent/logistiCard/logistiBriefCard.vue";
import globalPopup from "@/components/GlobalPopup/GlobalPopup.vue"; import globalPopup from "@/components/GlobalPopup/GlobalPopup.vue";
import { import {
getList getList
} from "@/api/logistics.js"; } from "@/api/logistics.js";
import { import {
Toast Toast
} from "@/libs/uniApi.js"; } from "@/libs/uniApi.js";
import { import {
oaHomeData oaHomeData
} from "@/static/server/server.js"; } from "@/static/server/server.js";
import { import {
noticeList noticeList
} from "@/api/notice.js"; } from "@/api/notice.js";
import { mapState } from "@/store/index.js" import {
// import tabbar from '../components/tabbar' mapState
import { } from "@/store/index.js"
// import tabbar from '../components/tabbar'
import {
getIndexListAPI, getIndexListAPI,
getTaskListAPI, getTaskListAPI,
getMyTaskListAPI, getMyTaskListAPI,
getApproveListAPI, getApproveListAPI,
getUserIndexAPI, getUserIndexAPI,
} from "@/api/oaApi.js"; } from "@/api/oaApi.js";
import bj from "@/static/animation/home.json" import bj from "@/static/animation/home.json"
//#ifdef APP-PLUS //#ifdef APP-PLUS
var jpushModule = uni.requireNativePlugin("JG-JPush"); var jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif // #endif
export default { export default {
components: { components: {
// tabbar // tabbar
logistiBriefCard, logistiBriefCard,
globalPopup, globalPopup,
}, },
data () { data() {
return { return {
options: { options: {
data: '', data: '',
@ -252,23 +221,34 @@ export default {
ApproveList: [], ApproveList: [],
}; };
}, },
onLoad () { onLoad() {
this.is_captain = JSON.parse(uni.getStorageSync("USER_INFO")).is_captain this.is_captain = JSON.parse(uni.getStorageSync("USER_INFO")).is_captain
this.options.data = bj; this.options.data = bj;
//#ifdef APP-PLUS
let that = this; // jpushModule.addNotificationListener(res => {
jpushModule.addNotificationListener(function (result) { // // if (res.notificationEventType == 'notificationOpened') return
if (!that.notArr.includes(result.messageID)) { // // audioContext.play()
that.$refs.globalPopup.showPopu(); // // console.log("app")
that.getOrderList(); // console.log("index")
console.log("idnex的");
that.notArr.push(result.messageID);
} // })
}); // //#ifdef APP-PLUS
// #endif // 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 () { onShow() {
// this.getUserIndex() // this.getUserIndex()
// this.getIndexList() // this.getIndexList()
this.getApproveList(); this.getApproveList();
@ -276,30 +256,48 @@ export default {
this.showToask(); this.showToask();
// this.initOaHomeDada(); // this.initOaHomeDada();
this.getOrderList(); this.getOrderList();
this.test()
}, },
computed: { computed: {
oaHomeData(){ oaHomeData() {
const route = getCurrentPages()[0]?.route; const route = getCurrentPages()[0]?.route;
let arr = []; let arr = [];
this.$store.state.config?.config?.menu?.forEach((item)=>{ this.$store.state.config?.config?.menu?.forEach((item) => {
if(item.paths.includes(route)){ if (item.paths.includes(route)) {
arr=item.children; arr = item.children;
} }
}) })
if(arr.length>=8){ if (arr.length >= 8) {
arr = arr.slice(0, 7); 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); arr.push(obj);
} }
return arr; return arr;
} }
}, },
methods: { methods: {
test () { 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(); this.$refs.globalPopup.showPopu();
console.log("index的监听")
})
}, },
async getOrderList () { async getOrderList() {
console.log("列表") // console.log("")
let id = JSON.parse(uni.getStorageSync("USER_INFO")).id || ""; let id = JSON.parse(uni.getStorageSync("USER_INFO")).id || "";
let res = await getList({ let res = await getList({
user_id: id, user_id: id,
@ -308,17 +306,17 @@ export default {
}); });
this.orderList = res.data.data; this.orderList = res.data.data;
}, },
goOrderList () { goOrderList() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/logistics/index", url: "/pages/logistics/index",
}); });
}, },
initUserInfo () { initUserInfo() {
this.$store.state.app.userInfo ? this.$store.state.app.userInfo ?
(this.myOaInfo = this.$store.state.app.userInfo) : (this.myOaInfo = this.$store.state.app.userInfo) :
(this.myOaInfo.avatar = ""); (this.myOaInfo.avatar = "");
}, },
initOaHomeDada () { initOaHomeDada() {
if (this.$store.state.app.userInfo.admin_id == 0) { if (this.$store.state.app.userInfo.admin_id == 0) {
// //
let arr = oaHomeData.filter((item) => !item.admin); // let arr = oaHomeData.filter((item) => !item.admin); //
@ -342,7 +340,7 @@ export default {
this.oaHomeData.splice(this.oaHomeData.length - 1, 1); this.oaHomeData.splice(this.oaHomeData.length - 1, 1);
} }
}, },
async getApproveList () { async getApproveList() {
const res = await noticeList({ const res = await noticeList({
keyword: "", keyword: "",
page_no: 1, page_no: 1,
@ -350,7 +348,7 @@ export default {
}); });
this.ApproveList = res.data.lists; this.ApproveList = res.data.lists;
}, },
async getIndexList () { async getIndexList() {
const { const {
project, project,
task task
@ -366,20 +364,20 @@ export default {
this.assessData[7].num = task.count_lv + "%"; this.assessData[7].num = task.count_lv + "%";
this.myTaskList = task.list; this.myTaskList = task.list;
}, },
async getMyTask () { async getMyTask() {
let data = { let data = {
page: this.page, page: this.page,
limit: 10, limit: 10,
}; };
const res = getMyTaskListAPI(data); const res = getMyTaskListAPI(data);
}, },
naviTaskDetails (id) { naviTaskDetails(id) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/views/task_details?id=${id}`, url: `/pages/views/task_details?id=${id}`,
}); });
}, },
navTo (url) { navTo(url) {
if(url){ if (url) {
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
@ -389,7 +387,7 @@ export default {
success() { success() {
uni.hideLoading() uni.hideLoading()
}, },
fail () { fail() {
uni.switchTab({ uni.switchTab({
url: url, url: url,
success() { success() {
@ -401,9 +399,9 @@ export default {
}); });
}, },
}) })
}else Toast('暂未开放') } else Toast('暂未开放')
}, },
navTwo (url, key) { navTwo(url, key) {
// let role_id = this.$store.state.app?.userInfo?.admin?.role_id || null; // let role_id = this.$store.state.app?.userInfo?.admin?.role_id || null;
// var arr = [3, 6]; // var arr = [3, 6];
@ -416,13 +414,13 @@ export default {
this.navTo(url); this.navTo(url);
}, },
// //
clickNotice (e) { clickNotice(e) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/oaNews/oaNews?id=${e}`, url: `/pages/oaNews/oaNews?id=${e}`,
}); });
}, },
// , // ,
showToask () { showToask() {
if (!this.$store.state.app.token) { if (!this.$store.state.app.token) {
this.assessData = this.assessData.map((item) => { this.assessData = this.assessData.map((item) => {
item.num = "*"; item.num = "*";
@ -436,36 +434,37 @@ export default {
}); });
} }
}, },
login () { login() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/oaLogin/oaLogin", url: "/pages/oaLogin/oaLogin",
}); });
}, },
async getUserIndex () { async getUserIndex() {
const res = await getUserIndexAPI(); const res = await getUserIndexAPI();
this.myOaInfo = res; this.myOaInfo = res;
}, },
}, },
onPullDownRefresh () { onPullDownRefresh() {
this.getOrderList(); this.getOrderList();
// this.getIndexList() // this.getIndexList()
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.oa_home { .oa_home {
// padding-bottom: rpx; // padding-bottom: rpx;
} }
.header_bg { .header_bg {
position: absolute; position: absolute;
width: 100%; width: 100%;
// z-index: -1; // z-index: -1;
} }
.home_header { .home_header {
position: relative; position: relative;
padding: 28rpx; padding: 28rpx;
// height: 607.02rpx; // height: 607.02rpx;
@ -508,6 +507,7 @@ export default {
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
} }
.head_text { .head_text {
font-size: 33rpx; font-size: 33rpx;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -636,13 +636,13 @@ export default {
.backlog_no_data { .backlog_no_data {
bottom: -70rpx; bottom: -70rpx;
} }
} }
.home_header_no_data { .home_header_no_data {
margin-bottom: 93.33rpx; margin-bottom: 93.33rpx;
} }
.fast_track { .fast_track {
width: 694rpx; width: 694rpx;
// height: 331rpx; // height: 331rpx;
display: flex; display: flex;
@ -666,9 +666,9 @@ export default {
margin-top: 14.04rpx; margin-top: 14.04rpx;
} }
} }
} }
.my_task { .my_task {
width: 694.74rpx; width: 694.74rpx;
margin: 0 auto; margin: 0 auto;
// margin-top: 31.58rpx; // margin-top: 31.58rpx;
@ -781,9 +781,9 @@ export default {
font-size: 24.56rpx; font-size: 24.56rpx;
} }
} }
} }
.no_login { .no_login {
position: fixed; position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;
@ -821,5 +821,5 @@ export default {
align-items: center; align-items: center;
} }
} }
} }
</style> </style>

View File

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

View File

@ -201,7 +201,7 @@
data() { data() {
return { return {
applicationList: [1, 1], applicationList: [1, 1],
isNewCheck: true, // isNewCheck: true,
showPop: false, showPop: false,
dataList: [1, 2, 3], dataList: [1, 2, 3],
tabLists: [{ tabLists: [{
@ -241,7 +241,8 @@
if (!this.newCarNum) return if (!this.newCarNum) return
// leaseApi().then(res=>{}) // leaseApi().then(res=>{})
this.showPop = false 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="personnel_list" @click="toDetail('/subpkg/property/vehicle')">
<view class="cards"> <view class="cards">
<view class="cards_head"> <view class="cards_head">
<text><!-- <!-- {{datas.}} --> --></text> <text><!-- <!-- {{datas.}} --></text>
</view> </view>
<view class="cards_content"> <view class="cards_content">
<view class="right"> <view class="right">