123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <template>
- <view class="">
- <scroll-view scroll-y="true" class="DrawerPage margin-bottom-xxxl">
- <cu-custom bgColor="bg-blue" :isBack="true">
- <block slot="backText">项目管理</block>
- <block slot="content"></block>
- <block slot="right">
- <view class=" flex justify-center">
- <!-- <button class="margin-top-ssm cu-btn round bg-blue text-blue"><text class="cuIcon-add"></text></button> -->
- </view>
- </block>
- </cu-custom>
- <view class="cu-list menu margin-bottom-xl shadow-lg margin-top-sm">
- <!-- 菜单-->
- <view class="cu-item " style="height: 100%;" v-for="(item,index) in list" :key="index" :class="index==0 ? 'margin-bottom-sm':'' ">
- <view class="content padding-tb-sm" v-if="index==0">
- <view>
- <text class="text-black text-bold text-xl">{{item.project_name}}</text>
- </view>
- <view>
- <text class="text-black text-lg span-wrap">{{item.contractName}}</text>
- </view>
- <view class="flex justify-start">
- <text class="text-gray text-sm">{{item.startTime | timeStamp}} 加入</text>
- <button @click="current(item)" class="cu-btn round line-orange" style="margin-left: auto;" >
- <image class="login-img" src="/static/user/star.png"></image> <text class="text-orange">当前项目</text>
- </button>
- </view>
- </view>
- <view class="content padding-tb-sm content_b" v-else>
- <view>
- <text class="text-black text-bold text-xl">{{item.project_name}}</text>
- </view>
- <view>
- <text class="text-black text-lg span-wrap">{{item.contractName}}</text>
- </view>
- <view class="flex justify-start">
- <text class="text-gray text-sm">{{item.startTime | timeStamp}} 加入</text>
- <button class="cu-btn round line-blue" @click="current(item)" style="margin-left: auto;">
- <text class="text-blue">设为当前</text>
- </button>
- </view>
- </view>
- </view>
- </view>
- <view class="flex justify-center text-gray margin-bottom-big">没有更多内容了~</view>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- data () {
- return {
- list:[],
- type:"",
- }
- },
- onLoad(e) {
- if(e.type){
- this.type=e.type;
- }
- this.findProject();
- },
- filters:{
- timeStamp: function(value) {
- if (!value) return '';
- var now = new Date(value);
- var year = now.getFullYear();
- var month = now.getMonth() + 1;
- if (month < 10) {
- month = '0' + month
- }
- var date = now.getDate();
- if (date < 10) {
- date = '0' + date
- }
- return year + "-" + month + "-" + date
- },
- },
- methods: {
- findProject(){
- var that =this;
- var userInfo = uni.getStorageSync("userInfo")
- that.userInfo = userInfo;
- that.http.request('/app/findProject', { userId:userInfo.id}).then((result)=>{
- let lastData=[];
- let datas = result.datas;
- var project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
- if(project){
- uni.setStorageSync("storeName",project.store_name);
- var id = project.contractId;
- datas.forEach((item,index,arry)=>{
- if(item.contractId!=id){
- lastData.push(item);//存放没有选择的
- }else{
- that.list.push(item)//存放已选择的
- }
- })
- }
- lastData.forEach((item,index,arry)=>{
- that.list.push(item);
- })
- });
- },
- current(data){
- if(this.type==1){//首页跳转过来的
- //如果选择,则设置权限
- uni.setStorageSync("storeName",data.store_name);
- uni.setStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id,data);
- uni.navigateBack({
- delta: 1
- });
- }else{
- //如果选择,则设置权限
- uni.setStorageSync("storeName",data.store_name);
- uni.setStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id,data);
- this.$prompt.none("设置成功");
- setTimeout(function(){
- uni.redirectTo({
- url:'/pages/user/project/project'
- })
- },200)
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .box {
- margin-top:-20rpx;
- }
- .box view.cu-bar {
- margin-top: 20upx;
- }
- .page {
- height: 100Vh;
- width: 100vw;
- }
-
- .page.show {
- overflow: hidden;
- }
- .cu-list.menu-avatar>.cu-item .content {
- position: absolute;
- left: 10px;
- width: calc(100% - 48px - 30px - 60px - 10px);
- line-height: 1.6em;
- }
- .text-black{
- color:#101010;
- }
- .cu-list.menu>.cu-item:after {
- border-bottom: 1px dashed #fff !important;
- }
- .content_b{border-bottom: 1px solid #E3e1e1;}
- .cu-item:last-child .content_b{border-bottom: none;}
- .span-wrap{
- word-break: break-all;white-space: normal;
- }
- </style>
|