Bläddra i källkod

处理提诉求页面及接口

306132416@qq.com 4 år sedan
förälder
incheckning
59601a02e4
7 ändrade filer med 328 tillägg och 55 borttagningar
  1. 1 3
      pages.json
  2. 7 7
      pages/appeal/appealCard.vue
  3. 40 0
      pages/appeal/appeal_detail.vue
  4. 57 16
      pages/appeal/index.vue
  5. 42 3
      pages/appeal/myAppeal.vue
  6. 181 26
      pages/appeal/putAppeal.vue
  7. BIN
      static/del.png

+ 1 - 3
pages.json

@@ -20,9 +20,7 @@
 			"style": {
 				"navigationBarTitleText": "我的",
 				"navigationStyle": "custom",
-			    "app-plus": {  
-			      "popGesture": "none"  
-			    }  
+			   "navigationBarTextStyle": "white"
 			}
 		},
 		{

+ 7 - 7
pages/appeal/appealCard.vue

@@ -14,24 +14,24 @@
       v-if="otherAppeal.state === 0"
     />
     <div class="details" v-if="otherAppeal.state === 1">
-      <img :src="otherAppeal.image" class="icon" />
+      <img src="/static/appeal/avator.png" class="icon" />
       <p class="msg">
-        <span class="name">{{ otherAppeal.name }}</span
+        <span class="name">{{ otherAppeal.department_name }}</span
         >:
-        <span class="msg_body">{{ otherAppeal.msg }}</span>
+        <span class="msg_body">{{ otherAppeal.reply }}</span>
       </p>
     </div>
     <div class="details" v-else-if="otherAppeal.state === 0">
       <p class="msg">
-        <span class="msg_body_waiting">{{ otherAppeal.msg }}</span>
+        <span class="msg_body_waiting">{{ otherAppeal.reply }}</span>
       </p>
     </div>
     <div class="details" v-else>
-      <img :src="otherAppeal.image" class="icon" />
+      <img src="/static/appeal/avator.png" class="icon" />
       <p class="msg">
-        <span class="name">{{ otherAppeal.name }}</span
+        <span class="name">{{ otherAppeal.department_name }}</span
         >:
-        <span class="msg_body">{{ otherAppeal.msg }}</span>
+        <span class="msg_body">{{ otherAppeal.reply }}</span>
       </p>
     </div>
   </div>

+ 40 - 0
pages/appeal/appeal_detail.vue

@@ -39,6 +39,7 @@
   </div>
 </template>
 <script>
+import md5 from "@/common/md5.js";	
 export default {
   data() {
     return {
@@ -59,7 +60,46 @@ export default {
   onLoad: function (e) {
     this.$set(this.info,'status',e.id)
     this.isLoad = true
+	this.pageDetail(e.id)
   },
+  methods:{
+	  pageDetail(infoId){
+		  let md5Sign = md5(
+		    "method=" +
+		      "consult" +
+		      "&timestamp=" +
+		      getApp().globalData.globalTimestamp +
+		      "&secret=" +
+		      getApp().globalData.secret
+		  );
+		  let url =
+		    getApp().globalData.shareUrl +
+		    "api/api.php" +
+		    "?method=consult&source=consult&action=info_by_id&timestamp=" +
+		    getApp().globalData.globalTimestamp +
+		    "&sign=" +
+		    md5Sign;
+		  uni.request({
+		    url: url,
+		    method: "POST",
+		    header: {
+		      "content-type": "application/x-www-form-urlencoded",
+		    },
+		    data: {
+				openId:getApp().globalData.open_id,
+				id:infoId
+		    },
+		    success: (res) => {
+		  	  console.log(res)
+		      if (res.data.code === 200) {
+		  	}
+		    },
+		    fail: () => {
+		      console.log("连接失败");
+		    },
+		  });
+	  }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 57 - 16
pages/appeal/index.vue

@@ -25,7 +25,7 @@
       <div
         v-for="(otherAppeal, index) in otherAppealList"
         :key="index"
-        @tap="toDetail(index)"
+        @tap="toDetail(otherAppeal.id)"
       >
         <appealCard :otherAppeal="otherAppeal"></appealCard>
       </div>
@@ -34,6 +34,7 @@
 </template>
 
 <script>
+import md5 from "@/common/md5.js";
 import appealCard from "./appealCard.vue";
 export default {
   components: {
@@ -43,26 +44,66 @@ export default {
     return {
       bannerSrc: "/static/appeal/banner.png",
       otherAppealList: [
-        {
-          title: "航投大厦餐厅服务建议",
-          name: "市场服务与监督管理局",
-          msg: "尊敬的市民您好!空港市场监管分局已与餐厅负责人取得了电话联系,根据您所提出的建议,餐厅将有针对性的进行整改,加强……",
-          image: "/static/appeal/avator.png",
-        },
-        {
-          title: "拉土车夜间噪音问题整改诉求",
-          name: "市场服务与监督管理局",
-          msg: "尊敬的市民您好!收到您的留言,我们十分重视!正平大街开展拉土作业的车辆为西安(咸阳)机场三期扩建工程建设项目运输……",
-          image: "/static/appeal/avator.png",
-        },
+        // {
+        //   title: "航投大厦餐厅服务建议",
+        //   name: "市场服务与监督管理局",
+        //   msg: "尊敬的市民您好!空港市场监管分局已与餐厅负责人取得了电话联系,根据您所提出的建议,餐厅将有针对性的进行整改,加强……",
+        //   image: "/static/appeal/avator.png",
+        // },
+        // {
+        //   title: "拉土车夜间噪音问题整改诉求",
+        //   name: "市场服务与监督管理局",
+        //   msg: "尊敬的市民您好!收到您的留言,我们十分重视!正平大街开展拉土作业的车辆为西安(咸阳)机场三期扩建工程建设项目运输……",
+        //   image: "/static/appeal/avator.png",
+        // },
       ],
     };
   },
-  onLoad() {},
+  onLoad() {
+	  
+  },
+  onShow() {
+  	this.getList()
+  },
   methods: {
-    toDetail(index) {
+	getList(){
+		let md5Sign = md5(
+		  "method=" +
+		    "consult" +
+		    "&timestamp=" +
+		    getApp().globalData.globalTimestamp +
+		    "&secret=" +
+		    getApp().globalData.secret
+		);
+		let url =
+		  getApp().globalData.shareUrl +
+		  "api/api.php" +
+		  "?method=consult&source=consult&action=list&timestamp=" +
+		  getApp().globalData.globalTimestamp +
+		  "&sign=" +
+		  md5Sign;
+		uni.request({
+		  url: url,
+		  method: "POST",
+		  header: {
+		    "content-type": "application/x-www-form-urlencoded",
+		  },
+		  data: {
+		  },
+		  success: (res) => {
+			  console.log(res)
+		    if (res.data.code === 200) {
+				this.otherAppealList = res.data.data.list
+			}
+		  },
+		  fail: () => {
+		    console.log("连接失败");
+		  },
+		});
+	},
+    toDetail(id) {
       uni.navigateTo({
-        url: "/pages/appeal/appeal_detail?id=" + index,
+        url: "/pages/appeal/appeal_detail?id=" + id,
       });
     },
   },

+ 42 - 3
pages/appeal/myAppeal.vue

@@ -3,12 +3,13 @@
     <div v-for="(otherAppeal, index) in otherAppealList" :key="index">
       <appealCard
         :otherAppeal="otherAppeal"
-        @tap="toDetail(index)"
+        @tap="toDetail(otherAppeal.id)"
       ></appealCard>
     </div>
   </div>
 </template>
 <script>
+import md5 from "@/common/md5.js";	
 import appealCard from "./appealCard.vue";
 export default {
   components: {
@@ -33,12 +34,50 @@ export default {
       ],
     };
   },
+  onLoad() {
+  	this.getMyList();
+  },
   methods: {
-    toDetail(index) {
+    toDetail(infoId) {
       uni.navigateTo({
-        url: "/pages/appeal/appeal_detail?id="+index,
+        url: "/pages/appeal/appeal_detail?id="+infoId,
       });
     },
+	getMyList(){
+		  let md5Sign = md5(
+			"method=" +
+			  "consult" +
+			  "&timestamp=" +
+			  getApp().globalData.globalTimestamp +
+			  "&secret=" +
+			  getApp().globalData.secret
+		  );
+		  let url =
+			getApp().globalData.shareUrl +
+			"api/api.php" +
+			"?method=consult&source=consult&action=my_list&timestamp=" +
+			getApp().globalData.globalTimestamp +
+			"&sign=" +
+			md5Sign;
+		  uni.request({
+			url: url,
+			method: "POST",
+			header: {
+			  "content-type": "application/x-www-form-urlencoded",
+			},
+			data: {
+				openId:getApp().globalData.open_id,
+			},
+			success: (res) => {
+			  console.log(res)
+			  if (res.data.code === 200) {
+			}
+			},
+			fail: () => {
+			  console.log("连接失败");
+			},
+		  });
+	}
   },
 };
 </script>

+ 181 - 26
pages/appeal/putAppeal.vue

@@ -3,30 +3,34 @@
     <div class="explain">
       <div class="title">问题说明:</div>
       <textarea
-        v-model="question.explain"
+        v-model="question.content"
         class="input card"
         placeholder="您反映的内容要体现一下几个重点信息:事情有关的地址,具体事情概述以及您的期望是什么?内容不少于5个字。"
       ></textarea>
     </div>
     <div class="update_photo">
       <div class="title">选择图片:</div>
-      <div class="update_container card">
-        <div class="update_button">
-          <div>
+      <div class="update_container card upload-parent-box">
+        <div class="update_button display-flex" >
+          <div class="display-flex upload-box" @click="getImage('album')">
             <img src="/static/appeal/photo.png" />
+			<div class="txt">上传</div>
           </div>
-          <div class="txt">上传</div>
+		  <div class="display-flex upload-box-photo" v-for="(item,index) in uploadList" :key="index">
+		    <image :src="item" mode="aspectFit" style="width: 100%;height: 100%;" @click="showLarge(item)"/>
+			<image src="../../static/del.png" class="del-icon" mode="aspectFit" @click="delPhoto(index)"></image>
+		  </div>
         </div>
       </div>
     </div>
     <div class="info">
       <div class="name info_msg">
         <label>联系人:</label>
-        <input type="text" class="card ipt" v-model="question.info.name" />
+        <input type="text" class="card ipt" v-model="question.contact_name" />
       </div>
       <div class="tel info_msg">
         <label>联系方式:</label>
-        <input type="text" class="card ipt" v-model="question.info.tel" />
+        <input type="text" class="card ipt" v-model="question.contact_phone" disabled="true" />
       </div>
     </div>
     <!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
@@ -37,32 +41,157 @@
   </div>
 </template>
 <script>
+import md5 from "@/common/md5.js";
 export default {
   data() {
     return {
       msg: "提出诉求",
+	  uploadList:[],
+	  imgIdList:[],
       question: {
-        explain: "",
-        info: {
-          name: "",
-          tel: "",
-        },
+          content: "",
+		  contact_name: "",
+		  contact_phone:getApp().globalData.user_phone,
       },
     };
   },
   methods: {
-    // getPhoneNumber(e) {
-    //   console.log(e);
-    //   let pc = new WXBizDataCrypt("wx5bb130cfb50e6b36");
-    //   let data = pc.decryptData(e.detail.encryptedData, e.detail.iv);
-    //   console.log(data);
-    // },
-    // getInfo(val) {
-    //   console.log(val);
-    // },
-    // submit(){
-    //   console.log(this.question);
-    // }
+	  getImage(type){
+	  	let that = this;
+		if(that.uploadList.length >= 3){
+			uni.showToast({
+				title:'最多上传3张图片',
+				icon:'none',
+				duration:2500
+			})
+			return
+		}
+	  	uni.chooseImage({
+	  		sourceType:[type],
+			count:3 - that.uploadList.length,
+	  		sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+	  		success: (res)=>{
+	  			for(let i=0;i<res.tempFilePaths.length;i++){
+					that.uploadList.push(res.tempFilePaths[i]) 
+					that.uploadFileRequest(res.tempFilePaths[i])
+	  				// uni.getImageInfo({
+	  				// 	src: res.tempFilePaths[i],
+	  				// 	success: (image)=>{
+	  				// 		let msg = {textValue:res.tempFilePaths[i]};
+	  				// 		console.log(msg)
+	  				// 	    //that.uploadFileRequest(msg,4)
+	  				// 	}
+	  				// });
+	  			}
+	  		}
+	  	});
+	  },
+	  uploadFileRequest(fileVal){
+		uni.showLoading({
+			title:'上传中',
+			mask:true
+		})  
+	  	let that = this;
+		let md5Sign = md5(
+		  "method=" +
+		    "upload" +
+		    "&timestamp=" +
+		    getApp().globalData.globalTimestamp +
+		    "&secret=" +
+		    getApp().globalData.secret
+		);
+		let url = getApp().globalData.shareUrl +
+		  "api/api.php" +
+		  "?method=upload&source=consult&timestamp=" +
+		  getApp().globalData.globalTimestamp +
+		  "&sign=" +
+		  md5Sign;
+	  	uni.uploadFile({
+	  		url:url, //需要设置为全局
+	  		filePath:fileVal,
+	  		name:'file',
+	  		formData: {
+	  			file:fileVal,
+	  		},
+	  		success: res => {
+				let tmpres=JSON.parse(res.data);
+				console.log(tmpres)
+				uni.hideLoading()
+				that.imgIdList.push(tmpres.data.id)
+	  		},
+	  		fail:res=>{
+	  			console.log("上传请求失败");
+	  			console.log(res);
+	  		}
+	  	});
+	  },
+	  delPhoto(idx){
+		  this.uploadList.splice(idx,1);
+		  this.imgIdList.splice(idx,1)
+	  },
+	  showLarge(src){
+		   uni.previewImage({
+			  urls: [src],
+			  longPressActions: {
+				  itemList: ['发送给朋友', '保存图片'],
+				  success: function(data) {
+				  },
+				  fail: function(err) {
+					  console.log(err.errMsg);
+				  }
+			    }
+			  });
+	  },
+    submit(){
+      let md5Sign = md5(
+        "method=" +
+          "consult" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=consult&source=consult&action=add&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: {
+          content:this.question.content,
+          contact_name:this.question.contact_name,
+          contact_phone:this.question.contact_phone,
+		  attach_ids:(this.imgIdList).join(),
+		  openId:getApp().globalData.open_id
+        },
+        success: (res) => {
+          if (res.data.code === 200) {
+			   uni.showToast({
+			   	title:'诉求提交成功',
+				icon:'none',
+				duration:2500,
+			   })
+			   setTimeout(()=>{uni.navigateBack({})},2500)
+			  }else {
+				uni.showToast({
+					title:res.data.msg,
+					icon:'none',
+					duration:2500,
+				})  
+			  }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    }
   },
 };
 </script>
@@ -104,12 +233,38 @@ export default {
     }
   }
   }
+  .upload-parent-box {
+	  height: 150rpx;
+	  padding-top: 25rpx;
+	  padding-left: 20rpx;
+  }
+  .upload-box {
+	  width: 25%;
+	  background-color: #E0E0E0;
+	  height: 110rpx;
+	  border-radius: 10rpx;
+	  padding-top: 15rpx;
+  }
+  .upload-box-photo {
+  	  width: 25%;
+  	  height: 110rpx;
+  	  border-radius: 10rpx;
+  	  padding-top: 15rpx;
+	  position: relative;
+  }
+  .del-icon {
+	  position: absolute;
+	  right: 0;
+	  width: 30rpx;
+	  height: 30rpx;
+  }
   img {
-    width: 100rpx;
-    height: 100rpx;
+    width: 60rpx;
+    height: 60rpx;
   }
   .update_button {
     text-align: center;
+	display: flex;
   }
   .submit {
     color: white;

BIN
static/del.png