Blame view

pages/my/myDemand/myDemand.vue 2.9 KB
290144e9   易尊强   第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  <template>
  	<view class="page">
  		<view class="notHave" v-if="isShow" style="transform: translateX(-50%);
  		left: 50%;
  		position: fixed;
  		top: 350px;">
  				暂时还未发布招聘
  			</view>
  		<view class="item" v-else v-for="(it,index) in proList" :key="index">
  			<view class="top">
  				<view class="title">
  					{{it.title}}
  				</view>
  				<view class="time">
  					<!-- 2024-02-19 16:36:53 -->
  					{{it.creatorTime}}
  				</view>
  			</view>
  			<view class="bottom">
  				<button type="primary" @click="GoodsDetails(it)">详情</button>
5bbfac44   易尊强   28号下午提交
21
  				<button type="warn" @click="deleteDemand(it.id)">删除</button>
290144e9   易尊强   第一次
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  			</view>
  		</view>
  	</view>
  </template>
  
  <script>
  	import request from '@/utils/request.js'
  import utils from '../../../service/utils'
  	export default {
  		data() {
  			return {
  				proList:[],
  				baseUrl: 'http://deyanggaoxin.fengshiyun.com',
  				isShow:false
  			}
  		},
  		onLoad() {
  			this.getSelfDemandCount()
  		},
  		methods: {
  			// 获取自己发布的需求
  			getSelfDemandCount() {
  				request({
  					url: this.baseUrl + '/api/Extend/demandrelease',
  					method: 'get',
6c679290   易尊强   3/6a上午
47
48
49
  					data: {
  						pageSize:10000
  					}
290144e9   易尊强   第一次
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
  				}).then(res => {
  					if (res.code === 200) {
  						console.log(res)
  						this.proList = res.data.list.map(it=>{
  							return {
  								...it,
  								creatorTime:utils.formatTime(it.creatorTime)
  							}
  						})
  						if (this.proList.length === 0) {
  							this.isShow = true
  						}
  					} else {
  						uni.showToast({
  							icon: "error",
  							title: res.msg
  						})
  					}
  				})
  			},
  			// 跳转到需求详情页面
  			GoodsDetails(item) {
  				uni.navigateTo({
  					url: `/pages/ArticleDetails/ArticleDetails?data=${JSON.stringify(item)}`
  				})
  			},
  			// 删除该需求
  			deleteDemand(id){
  				uni.showModal({
  					title:"提示",
  					content:"确定删除该需求吗?",
  					success: (res) => {
  						request({
  							url:this.baseUrl + `/api/Extend/demandrelease/${id}`,
  							method:'delete',
  							data:{}
  						}).then(res=>{
  							console.log(res)
  							if(res.code === 200){
  								uni.showToast({
  									icon:"success",
  									title:'删除需求成功!'
  								}).then(res=>{
  									this.getSelfDemandCount()
  								})
  								
  							}
  							
  						})
  					}
  				})
  				
  			}
  		}
  	}
  </script>
  
  <style lang="scss" scoped>
  .page{
  	width: 100%;
  	height: 100vh;
  	background-color: #f3f3f3;
  	margin: 0 auto;
  	border-radius: 20rpx;
  	overflow-y: scroll;
  }
  .item{
  	width: 96%;
  	margin: 0 auto;
  	background-color: white;
  	margin-top: 20rpx;
  	padding-bottom: 40rpx;
  	border-radius: 20rpx;
  	overflow: hidden;
  	// height: 150rpx;
  	.top{
  		width: 96%;
  		margin: 0 auto;
  		display: flex;
  		margin-top: 40rpx;
  		.title{
  			width: 50%;
  			text-align: center;
  			font-weight: bold;
  		}
  		.time{
  			text-align: center;
  			width: 50%;
  		}
  	}
  	.bottom{
  		display: flex;
  		margin-top: 20rpx;
  		button{
  			width: 240rpx;
  			font-size: 30rpx;
  			height: 70rpx;
  			line-height: 70rpx;
  		}
  	}
  }
  </style>