新增任务组件

This commit is contained in:
weipengfei 2023-08-04 11:32:51 +08:00
parent aa9db5216c
commit 4bbebdf2b5
6 changed files with 326 additions and 150 deletions

25
components/task/index.vue Normal file
View File

@ -0,0 +1,25 @@
<template>
<view class="c_task">
<taskItem></taskItem>
</view>
</template>
<script>
import taskItem from "./taskItem.vue"
export default {
name:"task",
components: {taskItem},
data() {
return {
};
}
}
</script>
<style lang="scss">
.c_task{
padding-top: 28rpx;
padding-bottom: 100rpx;
}
</style>

View File

@ -0,0 +1,108 @@
<template>
<view class="c_task_item">
<view class="top">
<view class="left">
<view>任务名称:</view>
<view class="text">宣传配送</view>
</view>
<view class="right">
<image class="icon" src="../../static/icons/ok_c.png"></image>
<!-- <image src="../../static/icons/err_c.png"></image> -->
</view>
</view>
<view class="item">
<view class="left">
<view>任务进度:</view>
<view class="text">30%</view>
</view>
<view class="right">30.00<text class="price"></text></view>
</view>
<view class="item">
<view class="left">
<view>任务进度:</view>
<view class="text">2023.08.05</view>
</view>
<view class="right">
<text>进入任务<uni-icons type="right" color="#3175f9"></uni-icons></text>
</view>
</view>
</view>
</template>
<script>
export default {
name: "task",
data() {
return {
};
}
}
</script>
<style lang="scss">
.c_task_item {
margin: 0 auto;
margin-bottom: 28rpx;
width: 694rpx;
background: #FFFFFF;
border-radius: 14rpx 14rpx 14rpx 14rpx;
opacity: 1;
font-size: 25rpx;
font-weight: 400;
color: #999999;
line-height: 39rpx;
.text {
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 39rpx;
margin-left: 18rpx;
}
.top {
display: flex;
justify-content: space-between;
padding: 28rpx;
border-bottom: 1rpx solid #F5F5F5FF;
.left {
display: flex;
justify-content: left;
align-items: center;
}
.right {
.icon {
width: 43rpx;
height: 43rpx;
}
}
}
.item {
display: flex;
justify-content: space-between;
margin: 18rpx 28rpx 0 28rpx;
&:last-child {
padding-bottom: 18rpx;
}
.left {
display: flex;
}
.right{
font-size: 32rpx;
font-weight: 400;
color: #3274F9;
line-height: 39rpx;
.price{
font-size: 25rpx;
}
}
}
}
</style>

BIN
static/icons/err_c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/icons/ok_c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,19 +1,23 @@
<template> <template>
<view class=""> <view class="">
<view class="fixed_box"> <u-sticky bgColor="#fff">
<u-tabs :list="tabLists" @click="changeCurrent" lineColor='#3274F9' :scrollable="false" lineWidth='40'
inactiveStyle='color:#666' activeStyle="color:#3274F9"></u-tabs>
</u-sticky>
<!-- <view class="fixed_box">
<scroll-view :scroll-x="true" style="background-color: #fff;"> <scroll-view :scroll-x="true" style="background-color: #fff;">
<view class="top_box"> <view class="top_box">
<view class="item" :class="current==0?'active':''" @click="current=0">我的公司</view> <view class="item" :class="current==0?'active':''" @click="current=0">我的公司</view>
<view class="item" :class="current==1?'active':''" @click="current=1">签约公司</view> <view class="item" :class="current==1?'active':''" @click="current=1">签约公司</view>
<view class="item" :class="current==2?'active':''" @click="current=2">公司财务</view> <view class="item" :class="current==2?'active':''" @click="current=2">公司财务</view>
<view class="item" :class="current==3?'active':''" @click="naviTo()">任务情况</view> <view class="item" :class="current==3?'active':''" @click="current=3">任务情况</view>
</view> </view>
</scroll-view> </scroll-view>
<view class="top_box top_box2" v-if="current==1"> <view class="top_box top_box2" v-if="current==1">
<view class="item" :class="currentChild==0?'active':''" @click="currentChild=0;initLoad()">已签约</view> <view class="item" :class="currentChild==0?'active':''" @click="currentChild=0;initLoad()">已签约</view>
<view class="item" :class="currentChild==1?'active':''" @click="currentChild=1;initLoad()">未签约</view> <view class="item" :class="currentChild==1?'active':''" @click="currentChild=1;initLoad()">未签约</view>
</view> </view>
</view> </view> -->
<view> <view>
<view class="company_info" v-show="current==0"> <view class="company_info" v-show="current==0">
<company></company> <company></company>
@ -27,7 +31,7 @@
</view> </view>
<view class="btn">详情<uni-icons type="forward" color="#666666"></uni-icons></view> <view class="btn">详情<uni-icons type="forward" color="#666666"></uni-icons></view>
</view> </view>
<u-line ></u-line> <u-line></u-line>
<view class="bottom"> <view class="bottom">
<image src="../../static/img/contract/company.png"></image> <image src="../../static/img/contract/company.png"></image>
<view class="text"> <view class="text">
@ -41,26 +45,41 @@
</view> </view>
</view> </view>
</view> </view>
<u-loadmore :status="loadConfig.status" :loading-text="loadConfig.loadingText" :loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" /> <u-loadmore :status="loadConfig.status" :loading-text="loadConfig.loadingText"
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
<mybtn text="新建签约" @click="naviTo('/subpkg/companyUnsign/companyUnsign')"></mybtn>
</view> </view>
<view class="company_info" v-show="current==2"> <view class="company_info" v-show="current==2">
<companyFinance></companyFinance> <companyFinance></companyFinance>
</view> </view>
<view class="company_info" v-show="current==3">
<task></task>
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { companyIndex, companyUnsigned } from "@/api/company.js" import { companyIndex } from "@/api/company.js"
import { Toast } from '@/libs/uniApi.js' import { Toast } from '@/libs/uniApi.js'
import companyFinance from "@/components/companyFinance/companyFinance.vue" import companyFinance from "@/components/companyFinance/companyFinance.vue"
import task from "@/components/task/index.vue"
export default { export default {
components:{companyFinance}, components: { companyFinance, task },
data() { data() {
return { return {
current: 0, current: 0,
currentChild: 0, currentChild: 0,
loadConfig:{ tabLists: [{
name: '我的公司',
}, {
name: '签约公司'
}, {
name: '公司财务'
}, {
name: '任务情况'
}],
loadConfig: {
page: 1, page: 1,
limit: 15, limit: 15,
lastpage: '', lastpage: '',
@ -80,29 +99,24 @@
this.loadCompanyList(); this.loadCompanyList();
}, },
methods: { methods: {
initLoad(){ initLoad() {
this.loadConfig.page = 1; this.loadConfig.page = 1;
this.loadConfig.status = "loadmore"; this.loadConfig.status = "loadmore";
this.companyList = []; this.companyList = [];
this.loadCompanyList(); this.loadCompanyList();
}, },
// //
async loadCompanyList(){ async loadCompanyList() {
if(this.loadConfig.status=="nomore")return; if (this.loadConfig.status == "nomore") return;
this.loadConfig.status="loading"; this.loadConfig.status = "loading";
let res; let res = await companyIndex({
if(this.currentChild==0) res = await companyIndex({
page: this.loadConfig.page, page: this.loadConfig.page,
limit: this.loadConfig.limit limit: this.loadConfig.limit
}) })
else res = await companyUnsigned({ this.loadConfig.status = "loadmore"
page: this.loadConfig.page, if (res.data.data.length < this.loadConfig.limit) {
limit: this.loadConfig.limit this.loadConfig.status = "nomore"
}) } else {
this.loadConfig.status="loadmore"
if(res.data.data.length<this.loadConfig.limit){
this.loadConfig.status="nomore"
}else {
this.loadConfig.page++; this.loadConfig.page++;
} }
this.companyList = [...this.companyList, ...res.data?.data] this.companyList = [...this.companyList, ...res.data?.data]
@ -113,19 +127,22 @@
url: url url: url
}) : Toast('暂未开放') }) : Toast('暂未开放')
}, },
naviBack(){ naviBack() {
uni.navigateBack() uni.navigateBack()
}, },
copyPhone(str="", type="号码"){ copyPhone(str = "", type = "号码") {
if(str) uni.setClipboardData({ if (str) uni.setClipboardData({
data:str+"", data: str + "",
success: (e) => { success: (e) => {
Toast(type+'已复制') Toast(type + '已复制')
}, },
fail: (e) => { fail: (e) => {
Toast('复制失败') Toast('复制失败')
} }
}) })
},
changeCurrent(e){
this.current = e.index;
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
@ -135,124 +152,141 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.fixed_box{ .fixed_box {
width: 100%; width: 100%;
position: fixed; position: fixed;
/* #ifdef APP-PLUS */ /* #ifdef APP-PLUS */
top:0; top: 0;
/* #endif */ /* #endif */
/* #ifdef H5 */ /* #ifdef H5 */
top:44px; top: 44px;
/* #endif */ /* #endif */
left: 0; left: 0;
z-index: 999; z-index: 999;
} }
.top_box{ .top_box {
background-color: #fff; background-color: #fff;
display: flex;
.item{
flex-shrink: 0; /* 禁止缩小 */
width: 155rpx;
height: 53rpx;
background: #F5F5F5FF;
color: #999999FF;
border-radius: 35rpx 35rpx 35rpx 35rpx;
opacity: 1;
display: flex; display: flex;
justify-content: center;
align-items: center; .item {
margin: 28rpx 0; flex-shrink: 0;
margin-left: 28rpx; /* 禁止缩小 */
} width: 155rpx;
.active{ height: 53rpx;
background: $theme-oa-color; background: #F5F5F5FF;
color: #fff; color: #999999FF;
} border-radius: 35rpx 35rpx 35rpx 35rpx;
} opacity: 1;
.top_box2{
.item{
margin-top: 0;
width: 120rpx;
}
}
.company_info{
margin-top: 110rpx;
}
.company_list{
padding-bottom: 32rpx;
margin-top: 190rpx;
display: flex;
flex-direction: column;
align-items: center;
.info_card{
width: 694rpx;
// height: 300rpx;
background: #FFFFFF;
border-radius: 21rpx 21rpx 21rpx 21rpx;
margin-top: 28rpx;
padding: 24rpx;
.top{
display: flex; display: flex;
justify-content: space-between; justify-content: center;
align-items: center; align-items: center;
margin-bottom: 28rpx; margin: 28rpx 0;
.info_name{ margin-left: 28rpx;
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
.have{
&::before{
content: "已签约";
border-radius: 14rpx;
border: 5rpx solid #5ac725;
color: #5ac725;
padding: 3rpx 6rpx;
font-size: 28rpx;
margin-right: 10rpx;
}
}
.no{
&::before{
content: "未签约";
border-radius: 14rpx;
border: 5rpx solid #f56c6c;
color: #f56c6c;
padding: 3rpx 6rpx;
font-size: 28rpx;
margin-right: 10rpx;
}
}
.info_type{
font-size: 25rpx;
font-weight: 500;
color: $theme-oa-color;
margin-top: 10rpx;
}
.btn{
font-size: 25rpx;
font-weight: 400;
color: #666666;
display: flex;
align-items: center;
}
} }
.bottom{
display: flex; .active {
margin-top: 28rpx; background: $theme-oa-color;
image{ color: #fff;
height: 140rpx;
width: 140rpx;
margin-right: 28rpx;
}
.text{
display: flex;
flex-direction: column;
justify-content: space-between;
}
} }
} }
}
.top_box2 {
.item {
margin-top: 0;
width: 120rpx;
}
}
.company_info {
// margin-top: 110rpx;
}
.company_list {
padding-bottom: 32rpx;
// margin-top: 190rpx;
display: flex;
flex-direction: column;
align-items: center;
.info_card {
width: 694rpx;
// height: 300rpx;
background: #FFFFFF;
border-radius: 21rpx 21rpx 21rpx 21rpx;
margin-top: 28rpx;
padding: 24rpx;
.top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 28rpx;
.info_name {
font-size: 32rpx;
font-weight: 500;
color: #333333;
}
.have {
&::before {
content: "已签约";
border-radius: 14rpx;
border: 5rpx solid #5ac725;
color: #5ac725;
padding: 3rpx 6rpx;
font-size: 28rpx;
margin-right: 10rpx;
}
}
.no {
&::before {
content: "未签约";
border-radius: 14rpx;
border: 5rpx solid #f56c6c;
color: #f56c6c;
padding: 3rpx 6rpx;
font-size: 28rpx;
margin-right: 10rpx;
}
}
.info_type {
font-size: 25rpx;
font-weight: 500;
color: $theme-oa-color;
margin-top: 10rpx;
}
.btn {
font-size: 25rpx;
font-weight: 400;
color: #666666;
display: flex;
align-items: center;
}
}
.bottom {
display: flex;
margin-top: 28rpx;
image {
height: 140rpx;
width: 140rpx;
margin-right: 28rpx;
}
.text {
display: flex;
flex-direction: column;
justify-content: space-between;
}
}
}
}
</style> </style>

View File

@ -3,6 +3,7 @@ import {
HEADER, HEADER,
TOKENNAME, TOKENNAME,
} from '@/config/app'; } from '@/config/app';
import { Toast } from '../libs/uniApi';
// import { checkLogin } from '../libs/login'; // import { checkLogin } from '../libs/login';
import store from '../store'; import store from '../store';
@ -55,6 +56,14 @@ function baseRequestTwo(url, method, data, {
store.commit("LOGOUT"); store.commit("LOGOUT");
reject(res.data); reject(res.data);
} }
else if (res.data.code == 0){
uni.hideLoading();
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none'
})
reject(res.data);
}
else if (res.data.code == 1) else if (res.data.code == 1)
reslove(res.data); reslove(res.data);
else if (res.data.code == 200) else if (res.data.code == 200)
@ -63,12 +72,12 @@ function baseRequestTwo(url, method, data, {
toLogin(); toLogin();
reject(res.data); reject(res.data);
} else if (res.data.code == 501) { } else if (res.data.code == 501) {
uni.reLaunch({ // uni.reLaunch({
url: '/pages/error/index' // url: '/pages/error/index'
}) // })
reject(res.data); reject(res.data);
} else { } else {
uni.hideLoading(); // uni.hideLoading();
uni.showToast({ uni.showToast({
title: res.data.msg || '请检查网络', title: res.data.msg || '请检查网络',
icon: 'none' icon: 'none'
@ -77,7 +86,7 @@ function baseRequestTwo(url, method, data, {
} }
}, },
fail: (message) => { fail: (message) => {
uni.hideLoading() // uni.hideLoading()
reject('请求失败'); reject('请求失败');
} }
}) })