290144e9
易尊强
第一次
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<template>
<view class="page">
<!-- 反馈内容 -->
<view class="feedback-data">
<view class="titleall-box">
<view class="titleall-left">
<view class="titleall-left-line"></view>填写党建信息
</view>
</view>
<uni-forms ref="valiForm" :rules="rules" :modelValue="valiFormData" style="width: 96%;margin: 0 auto;">
<uni-forms-item label="标题" required name="title">
<uni-easyinput v-model="valiFormData.title" placeholder="请输入" />
</uni-forms-item>
<uni-forms-item label="摘要" required name="subTitle">
<uni-easyinput v-model="valiFormData.subTitle" placeholder="请输入" />
</uni-forms-item>
<uni-forms-item label="党的建设详细内容">
<uni-easyinput type="textarea" v-model="valiFormData.bodyContent" placeholder="请输入" />
</uni-forms-item>
</uni-forms>
<view class="example-body">
<uni-file-picker limit="9" @select="select" title="信息图片"></uni-file-picker>
</view>
|
bd028579
易尊强
2/28
|
24
25
26
27
28
29
30
31
|
<view class="isNotice">
<view class="lef" style="margin-left: 30rpx;">
已选择<span>{{companysId.length}}</span>家企业
</view>
<view class="rig">
<button type="primary" @click="toTellInfo()" style="border-radius: 40rpx;">通知信息填写</button>
</view>
</view>
|
290144e9
易尊强
第一次
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
</view>
<!-- 提交 -->
<view v-if="have" class="submit-btn" @click="submitContent('valiForm')">
<text>发布</text>
</view>
<view v-else class="submit-btn" @click="updateEvent('valiForm')">
<text>保存</text>
</view>
</view>
</template>
<script>
import {
data
} from '../../uview-ui/libs/mixin/mixin';
import request from '@/utils/request.js'
|
bd028579
易尊强
2/28
|
49
|
import utils from '../../service/utils';
|
290144e9
易尊强
第一次
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
export default {
data() {
return {
userCode: {},
// 选择图片路径
filePath: [],
uploadPath: [],
type: "",
lastModifyUserId: '',
// 校验表单数据
valiFormData: {
title: '',
bodyContent: '',
subTitle: '',
},
|
bd028579
易尊强
2/28
|
65
66
67
68
|
// 通知信息标题
noticeTitle:'',
// 通知详情
noticeDesc:'',
|
290144e9
易尊强
第一次
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
creater: '',
rules: {
title: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
subTitle: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
},
baseUrl: "http://deyanggaoxin.fengshiyun.com",
// 判断是否传了id
|
bd028579
易尊强
2/28
|
86
87
88
89
90
91
|
isId: '',
have: false,
detailData: [],
// 需要通知的公司的id
companysId: [],
tellInfo:[]
|
290144e9
易尊强
第一次
|
92
93
94
95
96
97
|
};
},
// onShow() {
// this.getType()
// },
|
bd028579
易尊强
2/28
|
98
99
100
101
|
onUnload() {
uni.$off('idInfo')
uni.$off('tellInfo')
},
|
290144e9
易尊强
第一次
|
102
|
onLoad(options) {
|
bd028579
易尊强
2/28
|
103
104
105
106
107
108
109
110
111
112
113
114
|
console.log("options", options)
uni.$on('idInfo', res => {
console.log("选择公司页面返回的公司ID", res)
if(res.length > 0)
this.companysId = res
})
uni.$on('tellInfo', res => {
console.log("tell信息", res)
if(res.length > 0)
this.tellInfo = res
})
if (JSON.stringify(options) == "{}") {
|
290144e9
易尊强
第一次
|
115
|
this.have = true
|
bd028579
易尊强
2/28
|
116
|
} else {
|
290144e9
易尊强
第一次
|
117
|
this.isId = JSON.parse(options.data)
|
bd028579
易尊强
2/28
|
118
|
console.log("Id", this.isId)
|
290144e9
易尊强
第一次
|
119
120
121
122
123
124
125
126
127
128
129
130
131
|
this.getConDetail(this.isId)
}
this.getUser()
let user = uni.getStorageSync('user')
this.lastModifyUserId = user.userInfo.userId
},
methods: {
// 获取上传状态
select(e) {
console.log('选择文件:', e)
this.filePath = e.tempFilePaths
},
|
bd028579
易尊强
2/28
|
132
133
134
135
136
137
|
// 跳转到选择通知企业页面
toTellInfo() {
uni.navigateTo({
url: '/pages/tellInfo/tellInfo'
})
},
|
290144e9
易尊强
第一次
|
138
139
140
141
142
143
144
145
146
147
148
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
|
// 获取用户信息
getUser() {
if (uni.getStorageSync('user')) {
this.userCode = uni.getStorageSync('user').userInfo
// this.userInfo = this.userCode.userAccount
// this.userInfo = '123456'
console.log('用户已登录!', this.userCode)
} else {
uni.showToast({
title: '请登录',
icon: 'none'
})
setTimeout(() => {
uni.reLaunch({
url: '/pages/login/index'
})
})
}
},
// 提交内容
submitContent(ref) {
let that = this
this.$refs[ref].validate().then(res => {
console.log('success', res);
uni.showToast({
title: `校验通过`
})
this.uploadPath = []
for (let i = 0; i < this.filePath.length; i++) {
uni.uploadFile({
url: "http://deyanggaoxin.fengshiyun.com/api/file/Uploader/1",
filePath: this.filePath[i],
name: 'file',
success: (res) => {
console.log(JSON.parse(res.data))
let data = JSON.parse(res.data).data
console.log(data)
this.uploadPath.push(data)
}
})
}
console.log('需要', this.uploadPath)
|
bd028579
易尊强
2/28
|
181
|
setTimeout(function() {
|
290144e9
易尊强
第一次
|
182
|
that.postAll()
|
bd028579
易尊强
2/28
|
183
|
}, 1500)
|
290144e9
易尊强
第一次
|
184
185
186
187
188
189
190
191
192
193
194
|
})
},
// 上传所有
postAll() {
console.log("进入POST")
let that = this
if (that.uploadPath) {
console.log('jinru')
// console.log(uni.getStorageSync('token'))
var info = {
|
bd028579
易尊强
2/28
|
195
196
197
198
199
|
tItle: that.valiFormData.title,
content: that.valiFormData.bodyContent,
creatorUserId: that.userCode.userId,
summary: that.valiFormData.subTitle,
image: that.uploadPath,
|
290144e9
易尊强
第一次
|
200
201
|
}
console.log(info)
|
bd028579
易尊强
2/28
|
202
203
204
|
this.API.sc(info).then(res => {
console.log("1111", res);
console.log("res", res);
|
290144e9
易尊强
第一次
|
205
206
|
if (res.code == 200) {
console.log("上传后的值", res)
|
bd028579
易尊强
2/28
|
207
208
209
|
if(this.companysId.length > 0){
this.tellNotice(res.data.Id)
}
|
290144e9
易尊强
第一次
|
210
211
212
|
uni.showToast({
icon: "success",
title: "发布成功!"
|
bd028579
易尊强
2/28
|
213
|
}).then(() => {
|
290144e9
易尊强
第一次
|
214
|
uni.navigateTo({
|
bd028579
易尊强
2/28
|
215
|
url: '/pages/construct/construct'
|
290144e9
易尊强
第一次
|
216
217
218
|
})
})
}
|
bd028579
易尊强
2/28
|
219
|
}).catch((err) => {
|
290144e9
易尊强
第一次
|
220
221
|
console.log(err)
})
|
290144e9
易尊强
第一次
|
222
|
}
|
bd028579
易尊强
2/28
|
223
224
|
|
290144e9
易尊强
第一次
|
225
226
227
228
229
230
231
232
233
|
},
// /**
// * 反馈类型
// * @param {Object}
// */
// FeedbackTypeCh(val) {
// console.log(val);
// this.TypeIndex = val.detail.value;
// }
|
bd028579
易尊强
2/28
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
// 进行通知
tellNotice(id){
// 进行通知
request({
url:'/api/extend/demo/SendMessageByApp',
method:'post',
data:{
title:this.tellInfo[0],
companys:this.companysId,
desc:this.tellInfo[1],
reid:id,
link:'/pages/conDetail/conDetail',
fangshi:'通知'
}
}).then(res=>{
console.log('通知结果',res)
})
},
|
290144e9
易尊强
第一次
|
252
|
// 获取信息
|
bd028579
易尊强
2/28
|
253
|
getConDetail(id) {
|
290144e9
易尊强
第一次
|
254
255
256
|
let that = this
let currentId = id
console.log(currentId)
|
bd028579
易尊强
2/28
|
257
|
that.API.getConstructDetail(currentId).then(res => {
|
290144e9
易尊强
第一次
|
258
259
260
261
262
263
264
265
266
267
|
console.log(res)
let createTime = utils.formatTime(res.data.creatorTime)
res.data.creatorTime = createTime
that.detailData = res.data
console.log(that.detailData)
this.valiFormData.title = that.detailData.tItle
this.valiFormData.subTitle = that.detailData.summary
this.valiFormData.bodyContent = that.detailData.content
})
},
|
bd028579
易尊强
2/28
|
268
|
|
290144e9
易尊强
第一次
|
269
|
// 信息更新
|
bd028579
易尊强
2/28
|
270
|
updateEvent(ref) {
|
290144e9
易尊强
第一次
|
271
272
273
274
275
276
|
let that = this
this.$refs[ref].validate().then(res => {
console.log('success', res);
uni.showToast({
title: `校验通过`
})
|
bd028579
易尊强
2/28
|
277
|
|
290144e9
易尊强
第一次
|
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
this.uploadPath = []
for (let i = 0; i < this.filePath.length; i++) {
uni.uploadFile({
url: "http://deyanggaoxin.fengshiyun.com/api/file/Uploader/1",
filePath: this.filePath[i],
name: 'file',
success: (res) => {
console.log(JSON.parse(res.data))
let data = JSON.parse(res.data).data
console.log(data)
this.uploadPath.push(data)
}
})
}
console.log('需要', this.uploadPath)
|
bd028579
易尊强
2/28
|
293
|
setTimeout(function() {
|
290144e9
易尊强
第一次
|
294
|
that.updateData()
|
bd028579
易尊强
2/28
|
295
|
}, 1500)
|
290144e9
易尊强
第一次
|
296
297
298
|
})
},
// 更新接口
|
bd028579
易尊强
2/28
|
299
|
updateData() {
|
290144e9
易尊强
第一次
|
300
301
302
303
304
|
let that = this
if (that.uploadPath) {
console.log('jinru')
// console.log(uni.getStorageSync('token'))
var info = {
|
bd028579
易尊强
2/28
|
305
306
307
308
309
310
|
tItle: that.valiFormData.title,
content: that.valiFormData.bodyContent,
creatorUserId: that.userCode.userId,
summary: that.valiFormData.subTitle,
image: that.uploadPath,
id: this.isId
|
290144e9
易尊强
第一次
|
311
312
|
}
console.log(info)
|
bd028579
易尊强
2/28
|
313
314
315
|
this.API.modifyCon(info).then(res => {
console.log("1111", res);
console.log("res", res);
|
290144e9
易尊强
第一次
|
316
317
318
319
320
|
if (res.code == 200) {
console.log("上传后的值", res)
uni.showToast({
icon: "success",
title: "更新成功!"
|
bd028579
易尊强
2/28
|
321
|
}).then(() => {
|
e6b161ae
易尊强
2/23
|
322
|
uni.navigateTo({
|
bd028579
易尊强
2/28
|
323
|
url: "/pages/construct/construct"
|
e6b161ae
易尊强
2/23
|
324
|
})
|
290144e9
易尊强
第一次
|
325
326
|
})
}
|
bd028579
易尊强
2/28
|
327
|
}).catch((err) => {
|
290144e9
易尊强
第一次
|
328
329
|
console.log(err)
})
|
bd028579
易尊强
2/28
|
330
|
}
|
290144e9
易尊强
第一次
|
331
|
}
|
bd028579
易尊强
2/28
|
332
|
},
|
290144e9
易尊强
第一次
|
333
334
335
336
337
338
|
}
</script>
<style scoped lang="scss">
@import 'Feedback.scss';
</style>
|