Blame view

pages/tellInfo/tellInfo.vue 4.62 KB
bd028579   易尊强   2/28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  <template>
  	<view class="page">
  		<!-- 反馈内容 -->
  		<view class="feedback-data">
  			<view class="titleall-box">
  				<view class="titleall-left">
  					<view class="titleall-left-line"></view>填写通知信息
  				</view>
  			</view>
  			<view class="noticeInfo" style="width: 96%;margin: 0 auto;">
  				<uni-forms-item label="通知标题">
  					<uni-easyinput v-model="noticeTitle" placeholder="请输入" />
  				</uni-forms-item>
  				<uni-forms-item label="通知详细内容">
  					<uni-easyinput type="textarea" v-model="noticeDesc" placeholder="请输入" />
  				</uni-forms-item>
  			</view>
6c679290   易尊强   3/6a上午
18
  			<view class="isNotice" style="display: flex; align-items: center; margin-top: 20rpx;justify-content: space-between;">
bd028579   易尊强   2/28
19
20
21
  				<view class="lef" style="margin-left: 30rpx;">
  					已选择<span>{{companysId.length}}</span>家企业
  				</view>
6c679290   易尊强   3/6a上午
22
23
24
25
26
27
28
  				<view class="rig" @click="toChooseCom()" style="display: flex;align-items: center;">
  					<text>选择企业</text>
  					<view class="more-content">
  						<view class="more-content-img">
  							<image src="../../static/right2.png"></image>
  						</view>
  					</view>
bd028579   易尊强   2/28
29
30
31
32
33
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
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
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
  				</view>
  			</view>
  		</view>
  		<view class="submit-btn" @click="toPostVue()">
  			<text>确认</text>
  		</view>
  	</view>
  </template>
  
  <script>
  	import {
  		data
  	} from '../../uview-ui/libs/mixin/mixin';
  	import request from '@/utils/request.js'
  	import utils from '../../service/utils';
  	export default {
  		data() {
  			return {
  				userCode: {},
  				// 选择图片路径
  				filePath: [],
  				uploadPath: [],
  				type: "",
  				lastModifyUserId: '',
  				// 校验表单数据
  				valiFormData: {
  					title: '',
  					bodyContent: '',
  					subTitle: '',
  				},
  				// 通知信息标题
  				noticeTitle:'',
  				// 通知详情
  				noticeDesc:'',
  				creater: '',
  				rules: {
  					title: {
  						rules: [{
  							required: true,
  							errorMessage: '不能为空'
  						}]
  					},
  					subTitle: {
  						rules: [{
  							required: true,
  							errorMessage: '不能为空'
  						}]
  					},
  				},
  				baseUrl: "http://deyanggaoxin.fengshiyun.com",
  				// 判断是否传了id
  				isId: '',
  				have: false,
  				detailData: [],
  				// 需要通知的公司的id
  				companysId: []
  			};
  
  		},
  		// onShow() {
  		// 	this.getType()
  		// },
  		onUnload() {
  			uni.$off('idInfo')
  		},
  		onLoad(options) {
  			console.log("options", options)
  			uni.$on('idInfo', res => {
  				console.log("选择公司页面返回的公司ID", res)
  				if(res.length > 0)
  				this.companysId = res
  			})
  			if (JSON.stringify(options) == "{}") {
  				this.have = true
  			} else {
  				this.isId = JSON.parse(options.data)
  				console.log("Id", this.isId)
  				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
  			},
  			// 跳转到选择通知企业页面
  			toChooseCom() {
  				uni.navigateTo({
  					url: '/pages/chooseCom/chooseCom'
  				})
  			},
  			// 返回到发布内容页面
  			toPostVue(){
  				uni.$emit('tellInfo',[this.noticeTitle,this.noticeDesc])
  				uni.navigateBack({
  					delta:1
  				})
  			},
  			// 获取用户信息
  			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)
  					setTimeout(function() {
  						that.postAll()
  					}, 1500)
  				})
  			},
  		},
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'Feedback.scss';
6c679290   易尊强   3/6a上午
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
  	.more-content{
  		display: flex;
  		align-items: center;
  		image{
  			width: 100rpx;
  			height: 100rpx;
  			border-radius: 100%;
  		}
  		.more-content-img {
  			image {
  				width: 24rpx;
  				height: 24rpx;
  			}
  		}
  	}
bd028579   易尊强   2/28
201
  </style>