conghelong пре 1 година
родитељ
комит
88ba7a36fb

+ 43 - 0
api/handleAffairs/dept.js

@@ -0,0 +1,43 @@
+import request from '@/utils/request'
+	
+
+// 查询部门列表
+export function listdept(query) {
+  return request({
+    url: '/system/matter/listdept',
+    method: 'get',
+    params: query
+  })
+}
+
+// // 查询部门详细
+// export function getDept(id) {
+//   return request({
+//     url: '/system/department/lists/' + id,
+//     method: 'get'
+//   })
+// }
+// // 新增部门
+// export function addDept(data) {
+//   return request({
+//     url: '/system/department/add',
+//     method: 'post',
+//     data: data
+//   })
+// }
+
+// // 修改部门
+// export function updateDept(data) {
+//   return request({
+//     url: '/system/department/update/',
+//     method: 'put',
+//     data: data
+//   })
+// }
+
+// // 删除部门
+// export function delDept(id) {
+//   return request({
+//     url: '/system/department/delete/' + id,
+//     method: 'delete'
+//   })}

+ 1 - 1
api/handleAffairs/matter.js

@@ -34,7 +34,7 @@ export function getDept(id) {
 // 新增事项
 export function addsc(data) {
   return request({
-    url: '/system/collect/add',
+    url: '/system/matter/add',
     method: 'post',
     data: data
   })

+ 79 - 0
pages/gridQuery/mattercontent.vue

@@ -0,0 +1,79 @@
+<template>
+
+	<view>
+		<view class="rnwdList">
+		
+		
+			<ul >
+				<li >
+					
+					<h3>{{matterlist.title }}</h3>
+				    <p>{{ matterlist.content }}</p>
+					   <button @click="toggleFavorite">{{ isFavorite ? '❤️' : '🤍' }}</button>
+				</li>
+				</ul>
+			
+			
+		</view>
+	</view>
+
+
+</template>
+
+<script>
+	import {
+		 getDept, addsc, delDept, getsc 
+	} from '@/api/handleAffairs/matter.js';
+
+	export default {
+		data() {
+			return {
+				matterlist:[],
+				 isFavorite: false,
+			};
+		},
+		created() {
+		    this.getList();
+			
+		},
+		
+	
+		methods: {
+		      getList(){
+		        const _that = this;
+		        const id = uni.getStorageSync('id');
+				console.log(uni.getStorageSync('id'),"11111111")
+		        getDept(id).then(res =>{
+		          _that.matterlist = res.data
+					this.checkFavorite();
+		        })
+		      },
+		      toggleFavorite() {
+		        const userId = getApp().globalData.userId;
+		        if (this.isFavorite) {
+		          delDept(this.matterlist.id).then(() => {
+		            this.isFavorite = false;
+		          });
+		        } else {
+					const userId = getApp().globalData.userId
+					const matterId = this.matterlist.id 
+		         addsc({ matterId:this.matterlist.id , userId }).then(() => {
+		             this.isFavorite = true;
+		         });
+		        }
+		      },
+		    
+		    checkFavorite() {
+				const userId = getApp().globalData.userId
+		      getsc(userId).then(res => {
+		        this.isFavorite = res.data;
+		      });
+		    },
+		  
+	},
+	}
+</script>
+<style scoped>
+
+</style>
+

+ 162 - 0
pages/handleAffairs/matter.vue

@@ -0,0 +1,162 @@
+<template>
+    <view>
+        <!-- 使用分段器来切换推荐和收藏列表 -->
+        <view class="segmented-control">
+            <view class="segmented-control-item" :class="{ active: activeTab === 'recommend' }" @click="changeTab('recommend')">推荐</view>
+            <view class="segmented-control-item" :class="{ active: activeTab === 'favorite' }" @click="changeTab('favorite')">收藏</view>
+        </view>
+
+        <!-- 根据选中的标签显示对应的列表 -->
+        <view v-if="activeTab === 'recommend'">
+            <view class="rnwdList">
+                <ul>
+                    <li v-for="(item,index) in recommendList" :key="index">
+                        <p @click="getmatter(item)">{{ item.title }}</p>
+                    </li>
+                </ul>
+            </view>
+        </view>
+        <view v-if="activeTab === 'favorite'">
+            <view class="rnwdList">
+                <ul>
+                    <li v-for="(item,index) in favoriteList" :key="index">
+                        <p @click="getmatter(item)">{{ item.title }}</p>
+                    </li>
+                </ul>
+            </view>
+        </view>
+        <!-- 新加一个加号点击事件 -->
+        <view class="add-button" @click="addNewItem">+</view>
+		<view>
+			<uni-row class="demo-uni-row" :width="nvueWidth">
+				<uni-col :span="120">
+					<button align="center" @click="dept">部门导航</button>
+				</uni-col>
+			</uni-row>
+		</view>
+    </view>
+</template>
+
+<script>
+import { listDept,collectlist } from '@/api/handleAffairs/matter.js';
+
+
+export default {
+    data() {
+        return {
+            activeTab: 'recommend', // 默认选中推荐列表
+            recommendList: [], // 推荐列表数据
+            favoriteList: [], // 收藏列表数据
+			  userList: [], // 收藏列表数据
+        };
+    },
+    created() {
+        this.getList();
+		this.getLists();
+		
+    },
+    methods: {
+        getmatter(item) {
+            uni.setStorageSync('id', item.id);
+            uni.navigateTo({
+                url: '/pages/gridQuery/mattercontent',
+            });
+        },
+		addNewItem(item) {
+		  
+		    uni.navigateTo({
+		        url: '/pages/mattersAdd/mattersAdd',
+		    });
+		},
+        changeTab(tab) {
+            this.activeTab = tab;
+			
+			this.getList()
+			
+			this.getLists()
+        },
+		dept(){
+		
+			uni.navigateTo({
+				url: '/pages/topic/dept',
+			});
+		},
+        getList() {
+            const _that = this;
+            let query = { yesOrNoShow: "0" };
+            // 获取推荐列表数据
+            listDept(query).then(res => {
+                _that.recommendList = res.rows;
+		
+            });
+        
+        },
+		getLists(){
+		   
+		   const userId = getApp().globalData.userId;
+		  collectlist(userId).then(res =>{
+			  console.log("00000000000000000",res)
+		    this.favoriteList = res.rows
+			console.log("777777777777777", this.favoriteList)
+
+		  })
+		}
+				
+		  
+    }
+}
+</script>
+
+<style scoped>
+.segmented-control {
+    display: flex;
+    justify-content: space-around;
+    background-color: #f0f0f0;
+}
+
+.segmented-control-item {
+    padding: 10px;
+    cursor: pointer;
+}
+
+.segmented-control-item.active {
+    color: #007aff;
+}
+
+.rnwdList {
+    width: 100%;
+    display: flex;
+    justify-content: space-between;
+    margin: 20rpx 0;
+}
+.uni-header-image {
+
+		width: 30px;
+		height: 30px;
+		display: block;
+		margin: 0 auto;
+	}
+
+	/* 主导航 */
+	.mainNav {
+		width: 100%;
+		background: #fff;
+
+	}
+
+	.input-view {
+		/* #ifndef APP-PLUS-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		// width: 500rpx;
+		flex: 1;
+		background-color: #f8f8f8;
+		height: $nav-height;
+		border-radius: 15px;
+		padding: 0 15px;
+		flex-wrap: nowrap;
+		margin: 7px 0;
+		line-height: $nav-height;
+	}
+</style>

+ 122 - 131
pages/mattersAdd/mattersAdd.vue

@@ -8,21 +8,22 @@
 	<view>
 		<uni-forms :rules="rules" :value="formData" ref="form" validate-trigger="bind" err-show-type="undertext" class="uniForm">
 			<uni-group title="基本信息" top="0">
-				<uni-forms-item name="name" required label="事项标题">
-					<uni-easyinput type="text" :inputBorder="true" v-model="formData.titleName" placeholder="请输入事项标题"></uni-easyinput>
+				<uni-forms-item name="title" required label="事项标题">
+					<uni-easyinput type="text" :inputBorder="true" v-model="formData.title" placeholder="请输入事项标题"></uni-easyinput>
 				</uni-forms-item>
 				<!-- 使用原生input,需要绑定binddata -->
-				<uni-forms-item name="textDetails" required label="正文">
-					<uni-easyinput type="textarea" v-model="formData.textDetails" :maxlength="50" @blur="binddata('textDetails', $event.detail.value)" placeholder="请输入正文"></uni-easyinput>
+				<uni-forms-item name="content" required label="正文">
+					<uni-easyinput type="textarea" v-model="formData.content" :maxlength="50" @blur="binddata('textDetails', $event.detail.value)" placeholder="请输入正文"></uni-easyinput>
 				</uni-forms-item>
-				<uni-forms-item label="电话" required name="phone">
+				<uni-forms-item label="电话"  name="phone">
 					<uni-easyinput v-model="formData.phone" placeholder="请输入电话" />
 				</uni-forms-item>
-				<uni-forms-item name="address" required label="地址">
+				<uni-forms-item name="address"  label="地址">
 					<uni-easyinput type="text" :inputBorder="true" v-model="formData.address" placeholder="请输入地址"></uni-easyinput>
 				</uni-forms-item>
-				<uni-forms-item name="checked" label="主题类型" label-width="30%">
+				<uni-forms-item name="type" label="主题类型" required label-width="30%">
 					<uni-data-select
+							
 						  style="width: 30%;margin: auto;"
 						  v-model="formData.type"
 						  placeholder="请选择主题类型"
@@ -30,8 +31,9 @@
 						  :localdata="topicTypeList"
 					></uni-data-select>
 				</uni-forms-item>
-				<uni-forms-item name="checked" label="所属部门" label-width="30%">
+				<uni-forms-item name="department" label="所属部门" required label-width="30%">
 					<uni-data-select
+					
 						  style="width: 30%;margin: auto;"
 						  v-model="formData.department"
 						  placeholder="请选择所属部门"
@@ -39,11 +41,9 @@
 						  :localdata="departmentList"
 					></uni-data-select>
 				</uni-forms-item>
-				<uni-forms-item name="checked" label="是否常办" label-width="30%">
-					<switch :checked="formData.isTop" @change="change(' isTop', $event.detail.value)" style="margin-top: 2%;"/>
-				</uni-forms-item>
-				<uni-forms-item name="urlList" required label="图片">
-					<upload :imgArr="imageList" :fileSize="1" :limit="3" @updateImg="updateImg"></upload>
+			
+				<uni-forms-item name="picture"  label="图片">
+					<upload :imgArr="imageList"  :fileSize="1" :limit="3" @updateImg="updateImg"></upload>
 				</uni-forms-item>
 			</uni-group>
 			<view>
@@ -64,6 +64,8 @@
 		getListDepts ,
 	} from '@/api/me/matters/matters.js'
 	import upload from '@/components/upload/index.vue'
+	import {addsc} from '@/api/handleAffairs/matter.js'
+	
 	export default {
 		components: {
 			upload
@@ -73,7 +75,7 @@
 				e.rows.forEach(v => {
 					this.topicTypeList.push({
 						text:v.deptName,
-						value:v.id
+						value:v.deptName
 					})
 				})
 			})
@@ -89,14 +91,12 @@
 		data() {
 			return {
 				formData: {
-					titleName: '',
+					title: '',
 					textDetails: '',
 					address:'',
 					phone:'',
-					email: '',
-					sex: '0',
-					hobby: [0, 2],
-					remarks: '热爱学习,热爱生活',
+                    content:'',
+	                picture:'',
 					isGovernment: false,
 					isTop: false,
 					country: 2,
@@ -108,36 +108,10 @@
 				imageList:[],
 				topicTypeList:[],
 				departmentList:[],
-				sex: [{
-						text: '男',
-						value: '0'
-					},
-					{
-						text: '女',
-						value: '1'
-					},
-					{
-						text: '未知',
-						value: '2'
-					}
-				],
-				hobby: [{
-						text: '足球',
-						value: 0
-					},
-					{
-						text: '篮球',
-						value: 1
-					},
-					{
-						text: '游泳',
-						value: 2
-					}
-				],
-				range: ['中国', '美国', '澳大利亚'],
+			
 				show: false,
 				rules: {
-					titleName: {
+					title: {
 						rules: [{
 								required: true,
 								errorMessage: '请输入标题'
@@ -148,123 +122,140 @@
 							}
 						]
 					},
-					textDetails: {
+					content: {
 						rules: [{
 								required: true,
 								errorMessage: '请输入正文'
 							},
 							{
-								minLength: 10,
-								errorMessage: '正文不得少于 {minLength} 字'
+								minLength: 1,
+								errorMessage: '正文不得为空'
 							}
 						]
 					},
-					weight: {
+					type: {
 						rules: [{
-								format: 'number',
-								errorMessage: '体重必须是数字'
-							},
-							{
-								minimum: 100,
-								maximum: 200,
-								errorMessage: '体重应该大于 {minimum} 斤,小于 {maximum} 斤'
-							}
-						]
-					},
-					birth: {
-						rules: [
-							{
 								required: true,
-								errorMessage: '请选择时间'
+								errorMessage: '请选择主题类型'
 							},
 							{
-								format: 'timestamp',
-								errorMessage: '必须是时间戳'
+								minLength: 1,
+								errorMessage: '主题类型不得为空'
 							}
 						]
 					},
-					email: {
-						rules: [{
-							format: 'email',
-							errorMessage: '请输入正确的邮箱地址'
-						}]
-					},
-					isGovernment: {
-						rules: [{
-							format: 'bool'
-						}]
-					},
-					isTop: {
+					department: {
 						rules: [{
-							format: 'bool'
-						}]
-					},
-					sex: {
-						rules: [{
-							format: 'string'
-						}]
-					},
-					hobby: {
-						rules: [{
-								format: 'array'
+								required: true,
+								errorMessage: '请选择所属部门'
 							},
 							{
-								validateFunction: function(rule, value, data, callback) {
-									if (value.length < 2) {
-										callback('请至少勾选两个兴趣爱好')
-									}
-									return true
-								}
+								minLength: 1,
+								errorMessage: '所属部门不得为空'
 							}
 						]
-					}
+					},
+				// 	textDetails: {
+				// 		rules: [{
+				// 				required: true,
+				// 				errorMessage: '请输入正文'
+				// 			},
+				// 			{
+				// 				minLength: 10,
+				// 				errorMessage: '正文不得少于 {minLength} 字'
+				// 			}
+				// 		]
+				// 	},
+				
+
 				}
 			}
 		},
 		methods: {
-			change(name, value) {
-				this.formData.checked = value
-				this.$refs.form.setValue(name, value)
-			},
- 
+		
 			submitForm(form) {
-				this.$refs[form]
-					.submit()
-					.then(res => {
-						console.log('表单的值:', res)
-						uni.showToast({
-							title: '验证成功'
-						})
-					})
-					.catch(errors => {
-						console.error('验证失败:', errors)
-					})
+			    this.$refs[form]
+			        .submit()
+			        .then(res => {
+			            console.log("222222222222222222", res);
+			            uni.showModal({
+			                title: '确认',
+			                content: '是否添加该事项?',
+			                success: (res) => {
+			                    console.log("1111111111111", res);
+			                    if (res.confirm) {
+			                        // 用户点击确定按钮
+			                   
+			                    addsc(this.formData).then(response => {
+										console.log("7777777", this.formData);
+			                            this.$modal.msgSuccess("新增成功");
+			                             uni.navigateBack();
+			               
+			                        }).catch(error => {
+			                            console.error("新增方法出错:", error);
+			                        });
+			                    } else if (res.cancel) {
+			                        // 用户点击取消按钮
+			                        uni.showToast({
+			                            title: '已取消',
+			                            icon: 'none'
+			                        });
+			                    }
+			                }
+			            });
+			        })
+			        .catch(error => {
+			            console.error("表单提交出错:", error);
+			        });
 			},
+
+
+ 
+			// submitForm(form) {
+			// 	this.$refs[form]
+			// 		.submit()
+			// 		.then(res => {
+			// 			console.log('表单的值:', res)
+			// 			uni.showToast({
+			// 				title: '验证成功'
+			// 			})
+			// 		})
+			// 		.catch(errors => {
+			// 			console.error('验证失败:', errors)
+			// 		})
+			// },
  
-			//重置表单 。原生的组件input组件不能重置表单
+		
 			resetForm() {
 				this.$refs.form.resetFields()
 			},
-			validateField(form) {
-				this.$refs[form]
-					.validateField(['name', 'email'])
-					.then(res => {
-						uni.showToast({
-							title: '验证成功'
-						})
-						console.log('表单的值:', res)
-					})
-					.catch(errors => {
-						console.error('验证失败:', errors)
-					})
-			},
+			// validateField(form) {
+			// 	this.$refs[form]
+			// 		.validateField(['name', 'email'])
+			// 		.then(res => {
+			// 			uni.showToast({
+			// 				title: '验证成功'
+			// 			})
+			// 			console.log('表单的值:', res)
+			// 		})
+			// 		.catch(errors => {
+			// 			console.error('验证失败:', errors)
+			// 		})
+			// },
 			updateImg(imgList){
 				this.imageList = imgList;
+				//  this.formData.picture =this.imageList
+				 // this.formData.picture = JSON.stringify(this.imageList);
+				const pictureString = '"' + this.imageList.join('","') + '"';
+				
+				// 将转换后的字符串赋值给 this.formData.picture
+				this.formData.picture = pictureString;
+				// console.log("1111111111111",)
 			},
-			clearValidate(form, name) {
-				if (!name) name = []
-				this.$refs[form].clearValidate(name)
-			}
+			// clearValidate(form, name) {
+			// 	if (!name) name = []
+			// 	this.$refs[form].clearValidate(name)
+			// }
 		}
 	}
 </script>

+ 125 - 0
pages/topic/dept.vue

@@ -0,0 +1,125 @@
+<template>
+	<view>
+		<view style="height: 20%;">
+			<button v-for="(item,index) in userType" @click="onclick(item)">{{item.dictLabel}}
+			</button>
+		</view>
+		<view>
+			<uni-grid :column="2" :square="false" :highlight="false">
+				<uni-grid-item v-for="(item, index) in dataList" :index="index" :key="index">
+						<view class="grid-item-box" @click="onMatters(item)">
+					
+						<text class="text">{{ item.name }}</text>
+					</view>
+				</uni-grid-item>
+			</uni-grid>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import {
+		getDicts
+	} from "@/api/system/dict/data.js"
+	import {
+		listdept
+		} from "@/api/handleAffairs/dept.js"
+	export default {
+
+		data() {
+			return {
+				userType: [], // 初始化用户类型为空
+				dataList: [],
+
+			}
+		},
+		created() {
+			this.getdictData()//初始化字典按钮
+			this.getdataList()//初始化数据
+		},
+		methods: {
+			onMatters(data){
+				uni.setStorageSync('data', {department:data.name,examine:1})
+				uni.navigateTo({
+					url: '/pages/matterAll/matterAll',
+				});
+			},
+			getdataList(data){
+				let _that = this
+				if (!data) {
+					data = {
+						application: 0,
+						shows: "0"
+					}
+				}
+				listdept(data).then(res => {
+					_that.dataList = res.data
+					console.log("9999999999999999999999",_that.dataList)
+				})
+				
+			},
+			onclick(row) {
+				
+				let data = {
+					application: row.dictValue,
+					shows: "0"
+				}
+				this.getdataList(data)
+			},
+			getdictData() {
+				let _that = this
+				getDicts("object_application").then(res => {
+					_that.userType = res.data
+				})
+			},
+			changeUserType(type) {
+				this.userType = type
+			}
+		},
+
+	}
+</script>
+
+<style>
+	/* view {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		height: 100vh;
+	} */
+
+	button {
+		margin-bottom: 10px;
+	}
+
+	.selected {
+		background-color: #007bff;
+		color: #fff;
+	}
+
+	.grid-item-box {
+		flex: 1;
+		// position: relative;
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		padding: 15px 0;
+	}
+
+	.grid-item-box-row {
+		flex: 1;
+		// position: relative;
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		align-items: center;
+		justify-content: center;
+		padding: 15px 0;
+	}
+</style>