This commit is contained in:
weipengfei 2023-09-09 09:06:27 +08:00
commit 7eaa034da5

View File

@ -4,25 +4,39 @@
<!-- <u-navbar @leftClick="leftClick" bgColor="rgba(0,0,0,0)" <!-- <u-navbar @leftClick="leftClick" bgColor="rgba(0,0,0,0)"
leftIconColor=" #fff" :autoBack="false"> leftIconColor=" #fff" :autoBack="false">
</u-navbar> --> </u-navbar> -->
<view class="home_header" :class="!ApproveList.length > 0 ? 'home_header_no_data' : ''"> <view
<view style=" class="home_header"
:class="!ApproveList.length > 0 ? 'home_header_no_data' : ''"
>
<view
style="
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
overflow: hidden; overflow: hidden;
border-radius: 0 0 30rpx 30rpx; border-radius: 0 0 30rpx 30rpx;
"> "
<hx-lottie :options="options" ref="lottie" style=" >
<hx-lottie
:options="options"
ref="lottie"
style="
width: 100vw; width: 100vw;
height: 440rpx; height: 440rpx;
transform: scale(1.2); transform: scale(1.2);
background-color: #0122c7; 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>
<view v-if="uniMP" style="height: 44px;"> <view v-if="uniMP" style="height: 44px">
<u-icon name="arrow-left" color="#fff" size="20" @click="leftClick"></u-icon> <u-icon
name="arrow-left"
color="#fff"
size="20"
@click="leftClick"
></u-icon>
</view> </view>
<view v-else style="height: 30rpx"></view> <view v-else style="height: 30rpx"></view>
<!-- <view v-if="uniMP" style="height: 44px;"></view> --> <!-- <view v-if="uniMP" style="height: 44px;"></view> -->
@ -36,30 +50,46 @@
</view> </view>
<view class="head_img"> <view class="head_img">
<view class="img_box"> <view class="img_box">
<u--image :showLoading="true" width="131.43rpx" height="131.43rpx" class="img_box_img" <u--image
:src="myOaInfo.avatar || '../../static/img/public/avatar.png'" shape="circle"></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> </view>
<text class="head_text">工作证: {{ myOaInfo.nickname }}</text> <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> </view>
<!-- 占位 --> <!-- 占位 -->
<view style="height: 150rpx"></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="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 class="backlog_item flex_a_c_j_sb" v-for="(item, index) in ApproveList.slice(0, 2)" :key="index" <view
@click="clickNotice(item.id)"> 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"> <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, ".")
@ -67,12 +97,16 @@
{{ item.title }} {{ item.title }}
</view> </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>
</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"><uni-icons type="forward"></uni-icons></i> <i class="iconfont icon-you"
><uni-icons type="forward"></uni-icons
></i>
</view> </view>
</view> </view>
</view> </view>
@ -91,7 +125,13 @@
<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 :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 class="title">{{ item.name }}</view>
</view> </view>
</block> </block>
@ -100,7 +140,8 @@
<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>
@ -113,13 +154,20 @@
<!-- <button @click="test">按钮</button> --> <!-- <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 v-for="(item, index) in orderList" :key="index" :goodsInfo="item"> <logistiBriefCard
v-for="(item, index) in orderList"
:key="index"
:goodsInfo="item"
>
</logistiBriefCard> </logistiBriefCard>
<u-loadmore :status="status" />
</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> <view class="tips" v-if="!$store.state.app.token"
>登录后查看配送信息详情</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>
@ -158,48 +206,54 @@
</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 tabbar from '../components/tabbar' // import tabbar from '../components/tabbar'
import { import {
getIndexListAPI, getIndexListAPI,
getTaskListAPI, getTaskListAPI,
getMyTaskListAPI, getMyTaskListAPI,
getApproveListAPI, getApproveListAPI,
getUserIndexAPI, getUserIndexAPI,
} from "@/api/oaApi.js"; } from "@/api/oaApi.js";
import { import {
mapState mapState
} from 'vuex'; } from 'vuex';
import bj from "@/static/animation/home.json" import bj from "@/static/animation/home.json"
import { userInfo } from "@/api/oaUser.js" import {
//#ifdef APP-PLUS userInfo
var jpushModule = uni.requireNativePlugin("JG-JPush"); } from "@/api/oaUser.js"
// #endif //#ifdef APP-PLUS
export default { var jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
export default {
components: { components: {
// tabbar // tabbar
logistiBriefCard, logistiBriefCard,
globalPopup, globalPopup,
}, },
data() { data () {
return { return {
options: { options: {
data: '', data: '',
}, },
status: "loadmore",
page_num: 1,
flag: false,
uniMP: false, uniMP: false,
id: "",
is_captain: 0, is_captain: 0,
notArr: [], notArr: [],
orderList: [], orderList: [],
@ -239,7 +293,7 @@
showOaHomeData: false, // showOaHomeData: false, //
}; };
}, },
async onLoad() { async onLoad () {
await this.$onLaunched; await this.$onLaunched;
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;
@ -248,7 +302,7 @@
// }); // });
//#ifdef APP-PLUS //#ifdef APP-PLUS
let that = this; let that = this;
jpushModule.addNotificationListener(function(result) { jpushModule.addNotificationListener(function (result) {
if (!that.notArr.includes(result.messageID)) { if (!that.notArr.includes(result.messageID)) {
that.$refs.globalPopup.showPopu(); that.$refs.globalPopup.showPopu();
that.getOrderList(); that.getOrderList();
@ -258,12 +312,36 @@
}); });
// #endif // #endif
}, },
async onShow() { onReachBottom () {
if (this.flag) return
let that = this
this.status = "loading"
this.page_num += 1
this.flag = true
getList({
status: this.curNow,
user_id: this.id,
keywords: this.keywords,
user_type: this.is_captain,
page_num: this.page_num
}).then(res => {
that.orderList = that.orderList.concat(res.data.data)
this.flag = false
if (!res.data.data.length) {
this.status = "nomore"
this.flag = true
}
})
},
async onShow () {
// this.getUserIndex() // this.getUserIndex()
// this.getIndexList() // this.getIndexList()
await this.$onLaunched; await this.$onLaunched;
if(uni.getStorageSync('uniMP'))this.uniMP = true; if (uni.getStorageSync('uniMP')) this.uniMP = true;
userInfo().then(({data})=>{ userInfo().then(({
data
}) => {
this.$store.commit('setUserInfo', data); this.$store.commit('setUserInfo', data);
this.initUserInfo(data); this.initUserInfo(data);
this.$store.dispatch('initConfig'); this.$store.dispatch('initConfig');
@ -303,9 +381,11 @@
// }, // },
}, },
watch: { watch: {
'$store.state.app.token':{ '$store.state.app.token': {
handler: function(n, o){ handler: function (n, o) {
userInfo().then(({data})=>{ userInfo().then(({
data
}) => {
// console.log(data); // console.log(data);
this.$store.commit('setUserInfo', data); this.$store.commit('setUserInfo', data);
this.initUserInfo(data); this.initUserInfo(data);
@ -316,7 +396,7 @@
'$store.state.config.config.menu': { '$store.state.config.config.menu': {
immediate: true, immediate: true,
deep: true, deep: true,
handler: function(n, o){ handler: function (n, o) {
const route = '/pages/oaHome/oaHome'; const route = '/pages/oaHome/oaHome';
let arr = []; let arr = [];
n.forEach((item) => { n.forEach((item) => {
@ -336,7 +416,7 @@
}, },
methods: { methods: {
// //
noticeFn() { noticeFn () {
const audioContext = uni.createInnerAudioContext() const audioContext = uni.createInnerAudioContext()
audioContext.src = '/static/mp3/order.mp3' audioContext.src = '/static/mp3/order.mp3'
jpushModule.addNotificationListener(res => { jpushModule.addNotificationListener(res => {
@ -348,33 +428,33 @@
console.log("index的监听") console.log("index的监听")
}) })
}, },
leftClick(e) { leftClick (e) {
uni.sendHostEvent('closeApp', e, (ret) => { uni.sendHostEvent('closeApp', e, (ret) => {
// //
console.log('关闭应用'+JSON.stringify(ret)); console.log('关闭应用' + JSON.stringify(ret));
}); });
}, },
async getOrderList() { async getOrderList () {
let id = JSON.parse(uni.getStorageSync("USER_INFO")).id || ""; this.id = JSON.parse(uni.getStorageSync("USER_INFO")).id || "";
let res = await getList({ let res = await getList({
user_id: id, user_id: this.id,
user_type: this.is_captain user_type: this.is_captain
// courier_id: 167 // courier_id: 167
}); });
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(data=null) { initUserInfo (data = null) {
if(data) return this.myOaInfo = data; if (data) return this.myOaInfo = data;
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); //
@ -398,7 +478,7 @@
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,
@ -406,7 +486,7 @@
}); });
this.ApproveList = res.data.lists; this.ApproveList = res.data.lists;
}, },
async getIndexList() { async getIndexList () {
const { const {
project, project,
task task
@ -422,19 +502,19 @@
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: '加载中',
@ -442,16 +522,16 @@
}); });
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
success() { success () {
uni.hideLoading() uni.hideLoading()
}, },
fail() { fail () {
uni.switchTab({ uni.switchTab({
url: url, url: url,
success() { success () {
uni.hideLoading() uni.hideLoading()
}, },
fail() { fail () {
uni.hideLoading() uni.hideLoading()
} }
}); });
@ -459,7 +539,7 @@
}) })
} 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];
@ -472,13 +552,13 @@
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 = "*";
@ -492,37 +572,37 @@
}); });
} }
}, },
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.$store.dispatch('initConfig'); this.$store.dispatch('initConfig');
// this.getIndexList() // this.getIndexList()
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.oa_home { .oa_home {
padding-bottom: 100rpx; padding-bottom: 100rpx;
} }
.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;
@ -694,13 +774,13 @@
.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;
@ -724,9 +804,9 @@
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;
@ -839,9 +919,9 @@
font-size: 24.56rpx; font-size: 24.56rpx;
} }
} }
} }
.no_login { .no_login {
position: fixed; position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;
@ -879,5 +959,5 @@
align-items: center; align-items: center;
} }
} }
} }
</style> </style>