Blame view

pages/conDetail/conDetail.vue 4.83 KB
290144e9   易尊强   第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  <template>
  	<view class="page">
  		<!-- 文章内容 -->
  		<view class="article-data">
  			<view class="article-top">{{detailData.tItle}}</view>
  			<view class="article-title">
  				<view class="article-title-left">
  					{{ detailData.creatorTime}}
  				</view>
  				<!-- <view class="article-title-right"><image src="../../static/kan.png"></image>{{detailData.ViewCount ? detailData.ViewCount : 0}}人</view> -->
  			</view>
  			<view class="article-content">
  				<view class="" v-html="detailData.content"></view>
  			</view>
  			<view class="article-img" v-show="show" v-for="(it,index) in detailData.image">
  				<image :src="baseUrl + it.url" style="width: 100%;"></image>
  			</view>
9b1c150c   “wangming”   1
18
19
20
21
22
23
24
25
26
27
  			<view class="doc_box" v-if="isDoc">
  				<view class="" v-for="(it,index) in doc" :key="index">
  					<a :href="baseUrl + it.url">{{it.name}}</a>
  				</view>
  			</view>
  			<view class="doc_box" v-if="isPdf">
  				<view class="" v-for="(it,index) in pdf" :key="index">
  					<a :href="baseUrl + it.url">{{it.name}}</a>
  				</view>
  			</view>
290144e9   易尊强   第一次
28
29
  		</view>
  		<!-- 修改与删除 -->
6c679290   易尊强   3/6a上午
30
  		<!-- <view class="buttons" v-show="isAdmin">
290144e9   易尊强   第一次
31
32
  			<button type="primary" size="mini" @click="change(detailData.id)">修改</button>
  			<button type="warn" size="mini" @click="del(detailData.id)">删除</button>
6c679290   易尊强   3/6a上午
33
  		</view> -->
290144e9   易尊强   第一次
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
  	</view>
  </template>
  
  <script>
  	import utils from '../../service/utils';
  	import BASE_URL from '../../common/config.js'
  	import request from '@/utils/request.js'
  	import {
  		vShow
  	} from "vue";
  	export default {
  		data() {
  			return {
  				swiperList: [{
  						id: 0,
  						type: 'image',
  						url: '/static/img/banner_01.png'
  					},
  					{
  						id: 1,
  						type: 'image',
  						url: '/static/img/banner_02.png'
  					},
  					{
  						id: 2,
  						type: 'image',
  						url: '/static/img/banner_03.png'
  					},
  					{
  						id: 3,
  						type: 'image',
  						url: '/static/img/banner_04.png'
  					},
  					{
  						id: 4,
  						type: 'image',
  						url: '/static/img/banner_01.png'
  					},
  					{
  						id: 5,
  						type: 'image',
  						url: '/static/img/banner_01.png'
  					}
  				],
  				isComment: false,
  				isGoods: false,
  				// 需求详情数据
  				detailData: [],
  				// 存放页面跳转传递的数据
  				data: [],
9b1c150c   “wangming”   1
84
  				baseUrl: 'https://www.dygxq-es.cn',
290144e9   易尊强   第一次
85
  				show: false,
9b1c150c   “wangming”   1
86
87
88
89
90
91
92
  				isAdmin: false,
  				// doc文件
  				doc:[],
  				// pdf文件
  				pdf:[],
  				isDoc:false,
  				isPdf:false
290144e9   易尊强   第一次
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
  			};
  		},
  		onLoad(options) {
  			let that = this
  			this.getUser()
  			// 获取页面跳转传递来的数据
  			this.data = JSON.parse(options.data)
  			console.log(that.data)
  			that.getConDetail()
  		},
  		methods: {
  			// 获取用户信息
  			getUser() {
  				if (uni.getStorageSync('user')) {
  					let userCode = uni.getStorageSync('user')
  					// console.log("用户的code", this.userCode)
  					this.userId = userCode.userInfo.userId
  					this.userName = userCode.userInfo.userAccount
  					this.userIcon = userCode.userInfo.headIcon
  					this.organizeName = userCode.userInfo.organizeName
  					// this.isAdmin = userCode.userInfo.isCompany
  					console.log(userCode)
  					if (userCode.userInfo.userId === 'admin') {
  						this.isAdmin = true
  					}
  				} else {
  					uni.showToast({
  						title: '请登录',
  						icon: 'none'
  					})
e6b161ae   易尊强   2/23
123
124
125
126
127
  					// setTimeout(() => {
  					// 	uni.reLaunch({
  					// 		url: '/pages/login/index'
  					// 	})
  					// })
290144e9   易尊强   第一次
128
129
130
131
132
  				}
  			},
  			// 获取需求详情数据
  			getConDetail() {
  				let that = this
bd028579   易尊强   2/28
133
  				let currentId = that.data
290144e9   易尊强   第一次
134
135
136
137
138
139
140
141
142
  				console.log(currentId)
  				that.API.getConstructDetail(currentId).then(res => {
  					console.log(res)
  					let createTime = utils.formatTime(res.data.creatorTime)
  					res.data.creatorTime = createTime
  					that.detailData = res.data
  					if (that.detailData.image.length > 0) {
  						this.show = true
  					}
9b1c150c   “wangming”   1
143
144
145
146
147
148
  					that.doc = that.detailData.fileAtt
  					that.isDoc = that.doc.length > 0
  					that.pdf = that.detailData.fileInfo
  					that.isPdf = that.pdf.length > 0
  					let detailContent = res.data.bodyContent.replace(/<img/g,"<img style='max-width:100%;height:auto;'")
  					that.detailData.bodyContent = detailContent
290144e9   易尊强   第一次
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
  					console.log(that.detailData)
  				})
  			},
  			// 修改信息
  			change(id) {
  				uni.navigateTo({
  					url: `/pages/postCon/postCon?data=${JSON.stringify(id)}`
  				})
  			},
  			// 删除信息
  			del(id) {
  				let that = this
  				uni.showModal({
  					title: "提示",
  					content: "确定删除吗?",
  					success: (res) => {
  						request({
  							url: this.baseUrl + `/api/SubDev/basepartybuilding/${id}`,
  							method: 'delete',
  							data: {}
  						}).then(res => {
  							console.log(res)
  							if (res.code === 200) {
  								uni.showToast({
  									icon: "success",
  									title: '删除成功!',
  									duration:1500
  								}).then(() => {
  									uni.navigateTo({
  										url: '/pages/construct/construct'
  									})
  								})
  							}
  						})
  					}
  				})
  			}
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'ArticleDetails.scss';
  </style>