This commit is contained in:
weipengfei 2023-08-19 16:12:54 +08:00
commit 76483664e5

View File

@ -15,8 +15,8 @@
<view class="img_box"> <view class="img_box">
<u--image <u--image
:showLoading="true" :showLoading="true"
width="150.28rpx" width="131.43rpx"
height="150.28rpx" height="131.43rpx"
:src="myOaInfo.avatar || '../../static/img/public/avatar.png'" :src="myOaInfo.avatar || '../../static/img/public/avatar.png'"
shape="circle" shape="circle"
></u--image> ></u--image>
@ -194,113 +194,104 @@
</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 } from "@/api/logistics.js";
getList import { Toast } from "@/libs/uniApi.js";
} from "@/api/logistics.js" import { oaHomeData } from "@/static/server/server.js";
import { import { noticeList } from "@/api/notice.js";
Toast
} from '@/libs/uniApi.js'
import {
oaHomeData
} from '@/static/server/server.js'
import {
noticeList
} 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";
//#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 {
notArr: [], notArr: [],
orderList: [], orderList: [],
oaHomeData: [], oaHomeData: [],
src: 'https://cdn.uviewui.com/uview/album/1.jpg', src: "https://cdn.uviewui.com/uview/album/1.jpg",
assessData: [{ assessData: [
num: '0', {
name: '任务' num: "0",
}, name: "任务",
{ },
num: '0', {
name: '已完成' num: "0",
}, name: "已完成",
{ },
num: '0', {
name: '未完成' num: "0",
}, name: "未完成",
{ },
num: '0%', {
name: '完成率' num: "0%",
}, name: "完成率",
},
], ],
project: {}, project: {},
task: {}, task: {},
page: 1, page: 1,
myTaskList: [], myTaskList: [],
flowState: '#47B347', // flowState: "#47B347", //
priority: '', // priority: "", //
myOaInfo: { myOaInfo: {
avatar: '', avatar: "",
nickname: '', nickname: "",
mobile: '', mobile: "",
did_name: '', did_name: "",
label_name: '', label_name: "",
}, },
ApproveList: [] ApproveList: [],
} };
}, },
onReady () { onReady() {
uni.setNavigationBarColor({ uni.setNavigationBarColor({
frontColor: '#ffffff', frontColor: "#ffffff",
backgroundColor: '#3175f9' backgroundColor: "#3175f9",
}) });
}, },
onLoad () { onLoad() {
//#ifdef APP-PLUS //#ifdef APP-PLUS
const audioContext = uni.createInnerAudioContext() const audioContext = uni.createInnerAudioContext();
audioContext.volume = 1 audioContext.volume = 1;
audioContext.src = '../../static/mp3/order.mp3' audioContext.src = "../../static/mp3/order.mp3";
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();
console.log("idnex的") console.log("idnex的");
audioContext.play() audioContext.play();
} }
that.notArr.push(result.messageID) that.notArr.push(result.messageID);
}) });
// #endif // #endif
}, },
onShow () { onShow() {
// this.getUserIndex() // this.getUserIndex()
// this.getIndexList() // this.getIndexList()
this.getApproveList() this.getApproveList();
this.initUserInfo() this.initUserInfo();
this.showToask() this.showToask();
this.initOaHomeDada() this.initOaHomeDada();
this.getOrderList() this.getOrderList();
}, },
computed: {}, computed: {},
methods: { methods: {
test () { test() {
this.$refs.globalPopup.showPopu(); this.$refs.globalPopup.showPopu();
}, },
// test() { // test() {
@ -315,140 +306,141 @@ export default {
// } // }
// }) // })
// }, // },
async getOrderList () { async getOrderList() {
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({
courier_id: id courier_id: id,
// 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 () { initUserInfo() {
this.$store.state.app.userInfo ? this.myOaInfo = this.$store.state.app.userInfo : this.myOaInfo.avatar = this.$store.state.app.userInfo
''; ? (this.myOaInfo = this.$store.state.app.userInfo)
: (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); //
this.oaHomeData = arr; this.oaHomeData = arr;
} else { } else {
// this.oaHomeData = oaHomeData; // this.oaHomeData = oaHomeData;
let arr = oaHomeData.filter(item => !item.captain); // let arr = oaHomeData.filter((item) => !item.captain); //
this.oaHomeData = arr; this.oaHomeData = arr;
} }
if (this.$store.state.app.userInfo?.company?.company_type_name == '平台公司') { if (
this.oaHomeData = this.oaHomeData.filter(item => { this.$store.state.app.userInfo?.company?.company_type_name == "平台公司"
return item.text == '人员管理' ? false : true; ) {
}) this.oaHomeData = this.oaHomeData.filter((item) => {
return item.text == "人员管理" ? false : true;
});
} }
// //
if (this.oaHomeData >= 8) { if (this.oaHomeData >= 8) {
this.oaHomeData[7] = this.oaHomeData[this.oaHomeData.length - 1]; this.oaHomeData[7] = this.oaHomeData[this.oaHomeData.length - 1];
} else { } else {
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,
page_size: 2 page_size: 2,
}) });
this.ApproveList = res.data.lists this.ApproveList = res.data.lists;
}, },
async getIndexList () { async getIndexList() {
const { const { project, task } = await getIndexListAPI();
project, console.log(task, "222");
task this.assessData[0].num = project.count;
} = await getIndexListAPI() this.assessData[1].num = project.count_ok;
console.log(task, '222'); this.assessData[2].num = project.count_no;
this.assessData[0].num = project.count this.assessData[3].num = project.count_lv + "%";
this.assessData[1].num = project.count_ok this.assessData[4].num = task.count;
this.assessData[2].num = project.count_no this.assessData[5].num = task.count_ok;
this.assessData[3].num = project.count_lv + '%' this.assessData[6].num = task.count_no;
this.assessData[4].num = task.count this.assessData[7].num = task.count_lv + "%";
this.assessData[5].num = task.count_ok this.myTaskList = task.list;
this.assessData[6].num = task.count_no
this.assessData[7].num = task.count_lv + '%'
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) {
url ? url
uni.navigateTo({ ? uni.navigateTo({
url: url, url: url,
fail () { fail() {
uni.switchTab({ uni.switchTab({
url: url url: url,
}) });
} },
}) : Toast('暂未开放') })
: 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];
if (role_id && role_id[0] == 9) { if (role_id && role_id[0] == 9) {
if (arr.indexOf(key) == -1) { if (arr.indexOf(key) == -1) {
Toast('请先成立公司后开放') Toast("请先成立公司后开放");
return false return false;
} }
} }
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 = "*";
return item; return item;
}) });
} else { } else {
// //
this.assessData = this.assessData.map(item => { this.assessData = this.assessData.map((item) => {
item.num = '0'; item.num = "0";
return item; return item;
}) });
} }
}, },
login () { login() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/oaLogin/oaLogin' url: "/pages/oaLogin/oaLogin",
}) });
},
async getUserIndex() {
const res = await getUserIndexAPI();
this.myOaInfo = res;
}, },
async getUserIndex () {
const res = await getUserIndexAPI()
this.myOaInfo = res
}
}, },
onPullDownRefresh () { onPullDownRefresh() {
// this.getIndexList() // this.getIndexList()
uni.stopPullDownRefresh() uni.stopPullDownRefresh();
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
@ -474,21 +466,23 @@ export default {
border-radius: 0 0 30rpx 30rpx; border-radius: 0 0 30rpx 30rpx;
.head_img { .head_img {
position: relative;
background-color: #ff7c32; background-color: #ff7c32;
width: 100%; width: 100%;
border-radius: 70rpx 50rpx 50rpx 70rpx; height: 105.14rpx;
height: 130.28rpx; line-height: 105.14rpx;
border-radius: 35.05rpx 35.05rpx 35.05rpx 35.05rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-right: 50rpx; padding-right: 50rpx;
line-height: 130rpx;
color: white; color: white;
font-size: 34rpx; font-size: 34rpx;
.img_box { .img_box {
width: 150.28rpx; width: 131.43rpx;
height: 150.28rpx; height: 131.43rpx;
translate: -10rpx -10rpx; position: absolute;
border: 1px dashed #707070; border: 1px dashed #707070;
} }
@ -799,4 +793,4 @@ export default {
} }
} }
} }
</style> </style>