lilei před 2 roky
rodič
revize
20bf9b3d94

+ 22 - 29
App.vue

@@ -1,5 +1,6 @@
 <script>
 	import skJGPush from '@/libs/jgPush.js'
+	import {openMessagePage} from '@/libs/tools.js'
 	export default {
 		globalData: {  
 			baseUrl: '',
@@ -25,6 +26,7 @@
 		},
 		onLaunch: function() {
 			console.log('App launch')
+			this.$store.state.vuex_tempData = ''
 			let bgAudioManager = uni.getBackgroundAudioManager();
 			if(uni.getSystemInfoSync().platform == "ios"){
 				// 请求定位权限
@@ -39,12 +41,17 @@
 				skJGPush.requestNotificationAuthorization((result)=>{
 					let status = result.status
 					if (status < 2) {
-						uni.showToast({
-							icon: 'none',
-							title: '您还没有打开通知权限',
-							duration: 3000
-						})
-						skJGPush.openSettingsForNotification()
+						uni.showModal({
+							title: '提示',
+							content: '您还没有打开通知权限',
+							success: function (res) {
+								if (res.confirm) {
+									skJGPush.openSettingsForNotification()
+								} else if (res.cancel) {
+									console.log('用户点击取消');
+								}
+							}
+						});
 					}
 				})
 			}else{
@@ -94,31 +101,17 @@
 			console.log('App Hide')
 		},
 		methods:{
-			toAction (data) {
-			  // 急送订单
-			  if (data.extras.bizType == 'TEMP_ORDER') {
-				uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify({ salesBillSn: data.extras.bizSn }) })
-			  }
-			  // 补货订单
-			  if (data.extras.bizType == 'SHELF_REPLENISH') {
-				uni.navigateTo({ url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_CONFIRM' })
-			  }
-			  // 货架订单
-			  if (data.extras.bizType == 'SHELF_ORDER') {
-				uni.navigateTo({ url: '/pages/shelfOrder/orderDetail?pageType=detail&orderBillSn='+data.extras.bizSn })
-			  }
-			  // 货架异常
-			  if (data.extras.bizType == 'SHELF_WARN') {
-				const shelfName = data.content.split('已经超过')[0]
-				uni.navigateTo({ url: '/pages/shelfOrder/shelfOrder?bizType=SHELF_WARN&shelfSn='+data.extras.bizSn+'&shelfName='+shelfName })
-			  }
-			},
 			setRead(item){
 				const api = require("@/api/user.js")
-				api.setReadNotice({'noticeId': item.extras.noticeId}).then(res => {
-					console.log(res,'setRead')                                                                                     
-					this.toAction(item)
-				})
+				const token = getApp().globalData.token
+				if(token){
+					api.setReadNotice({'noticeId': item.extras.noticeId}).then(res => {
+						console.log(res,'setRead')                                                                                     
+						openMessagePage(item)
+					})
+				}else{
+					uni.$emit("openMessage",item)
+				}
 			},
 		}
 	}

+ 1 - 0
api/data.js

@@ -15,6 +15,7 @@ export const listLookUp = (params) => {
   const url = `lookup/queryLike`
   return axios.request({
     url: url,
+	data: params||{},
     method: 'POST'
   }).then(res => res)
 }

+ 8 - 0
api/user.js

@@ -155,6 +155,14 @@ export const setReadAllNotice = params => {
     method: 'get'
   })
 }
+//  公告 详情
+export const noticeUserDetail = (params) => {
+  const url = `notice/findById/${params.id}`
+  return axios.request({
+    url: url,
+    method: 'get'
+  })
+}
 // 获取用户信息
 export const getUserInfo = params => {
   return axios.request({

+ 21 - 0
libs/tools.js

@@ -423,4 +423,25 @@ export const saveImgToAliOss = function(src,callback){
 			console.log(error)
 		}
 	});
+}
+
+// 点击消息打开对应的页面
+export const openMessagePage = function(data){
+	// 急送订单
+	if (data.extras.bizType == 'TEMP_ORDER') {
+		uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify({ salesBillSn: data.extras.bizSn }) })
+	}
+	// 补货订单
+	if (data.extras.bizType == 'SHELF_REPLENISH') {
+		uni.navigateTo({ url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_CONFIRM' })
+	}
+	// 货架订单
+	if (data.extras.bizType == 'SHELF_ORDER') {
+		uni.navigateTo({ url: '/pages/shelfOrder/orderDetail?pageType=detail&orderBillSn='+data.extras.bizSn })
+	}
+	// 货架异常
+	if (data.extras.bizType == 'SHELF_WARN') {
+		const shelfName = data.content.split('已经超过')[0]
+		uni.navigateTo({ url: '/pages/shelfOrder/shelfOrder?bizType=SHELF_WARN&shelfSn='+data.extras.bizSn+'&shelfName='+shelfName })
+	}
 }

+ 2 - 0
manifest.json

@@ -221,6 +221,8 @@
                 "JPUSH_MEIZU_APPID" : "",
                 "JPUSH_XIAOMI_APPKEY" : "",
                 "JPUSH_XIAOMI_APPID" : "",
+                "JPUSH_HUAWEI_APPID" : "",
+                "JPUSH_HONOR_APPID" : "",
                 "__plugin_info__" : {
                     "name" : "JG-JPush",
                     "description" : "极光推送Hbuilder插件",

+ 13 - 1
pages/login/login.vue

@@ -60,7 +60,8 @@ export default {
 			envTips: '',
 			showEnvTips: false,
 			theme: '',
-			isIos: false
+			isIos: false,
+			messageInfo: null
 		};
 	},
 	computed: {
@@ -74,6 +75,15 @@ export default {
 			this.toMain();
 		}
 		this.isIos = uni.getSystemInfoSync().platform == "ios"
+		
+		// 点击消息
+		uni.$on('openMessage',item =>{
+			this.messageInfo = item
+			this.formSubmit()
+		})
+	},
+	onUnload() {
+		uni.$off('openMessage')
 	},
 	onShow() {
 		this.isRemember = this.$store.state.vuex_isRemember;
@@ -183,6 +193,8 @@ export default {
 			});
 		},
 		toMain() {
+			console.log(this.messageInfo)
+			this.$store.state.vuex_tempData = this.messageInfo
 			// 跳转到首页
 			uni.switchTab({
 				url: '/pages/sales/index'

+ 13 - 3
pages/sales/index.vue

@@ -54,9 +54,10 @@
 
 <script>
 	import ListComponent from './listComponent.vue'
-	import { toThousands } from '@/libs/tools'
+	import { toThousands, openMessagePage } from '@/libs/tools'
 	import { bizData } from '@/api/sales'
 	import { listLookUp, getLookUpDatas } from '@/api/data.js'
+	import { setReadNotice } from "@/api/user.js"
 	export default{
 		components: { ListComponent },
 		data(){
@@ -78,7 +79,7 @@
 			  this.listHeight = Math.floor(data.height)
 			}).exec();
 		},
-		onLoad() {
+		onLoad(opts) {
 			const _this = this
 			this.$nextTick(function(){
 				// 监听整改完成后刷新事件
@@ -86,7 +87,15 @@
 					_this.$refs.salesList.refash()
 				})
 			})
-			
+			// 点击消息打开
+			const msg = this.$store.state.vuex_tempData
+			console.log('toMessage',msg)
+			if(msg){
+				setReadNotice({'noticeId': msg.extras.noticeId}).then(res => {
+					openMessagePage(msg)
+				})
+			}
+			// 底部tab
 			const theme = getApp().globalData.theme
 			this.theme = theme
 			uni.setTabBarItem({
@@ -131,6 +140,7 @@
 		},
 		onUnload() {
 			uni.$off('refreshSalesHomeBL')
+			uni.$off('toMessage')
 		},
 		onShow() {
 			this.navInd = 0

+ 1 - 0
pages/userCenter/index.vue

@@ -173,6 +173,7 @@
 						this.$u.vuex('vuex_token', '');
 						this.$u.vuex('vuex_authOrgs','');
 						getApp().globalData.token = '';
+						this.$u.vuex('vuex_tempData', '');
 						setTimeout(function() {
 							uni.reLaunch({
 								url: '/pages/login/login'

+ 8 - 12
pages/xtNotice/xtNotice.vue

@@ -116,27 +116,23 @@
 				  hasRead({msg_id: data.id}).then(res => {
 					// 刷新列表
 					if (res.status == 200){
-					    this.pageInit()
-						if(data.notice&&data.notice.type == 'tx' && type == 1){
-							this.toAction(data)
-						}else{
-							this.goToMessageDetail(data)
-						}
+						data.readFlag = 1
+						this.messageList.splice()
 					}
 				  })
+				} 
+				// 跳转
+				if(data.notice&&data.notice.type == 'tx' && type == 1){
+					this.toAction(data)
 				}else{
-					if(data.notice&&data.notice.type == 'tx' && type == 1){
-						this.toAction(data)
-					}else{
-						this.goToMessageDetail(data)
-					}
+					this.goToMessageDetail(data)
 				}
 			},
 			// 查看详细
 			goToMessageDetail(data){
 				// 跳转到详细页
 				uni.navigateTo({
-				 	url:'./xtNoticeDetail/xtNoticeDetail?item='+ encodeURIComponent(JSON.stringify(data))
+				 	url:'./xtNoticeDetail/xtNoticeDetail?id='+ data.noticeId
 				})
 			},
 			toAction (data) {

+ 70 - 27
pages/xtNotice/xtNoticeDetail/xtNoticeDetail.vue

@@ -1,17 +1,33 @@
 <template>
 	<view class="container">
-		<view class="message">
+		<view class="message" v-if="detailsData">
 			<view class="messageDetail">
-				<view class="messageTitle">{{item.notice.title}}</view>
-				<view class="messageTime">{{item.notice.releaseDate}} 发布</view>
+				<view class="messageTitle">{{detailsData.title}}</view>
+				<view class="messageTime">{{detailsData.releaseDate}} 发布</view>
 			</view>
-			<view class="messageContent" v-if="item.notice.type!='tx'">
-			  <jyf-parser :html="item.notice.content" ref="article"></jyf-parser>
+			<view class="messageContent" v-if="detailsData.type!='tx'">
+			  <jyf-parser :html="detailsData.content" ref="article"></jyf-parser>
+			  <view class="msgFujian">
+				  <view v-if="detailsData.imgPaths&&detailsData.imgPaths.length">
+					  <view class="tits">图片:</view>
+					  <view class="flex justify_between pimgs" style="flex-wrap: wrap;" @click="viewPhoto(detailsData.imgPaths)">
+					  	<u-image v-for="item in detailsData.imgPaths" :src="item" width="150" height='150'></u-image>
+					  </view>
+				  </view>
+				  <view v-if="detailsData.attachList&&detailsData.attachList.length">
+					  <view class="tits">附件(不支持查看和下载附件,请登录pc电脑端查看):</view>
+					  <view class="flex justify_between pimgs" style="flex-wrap: wrap;">
+						  <view style="margin: 0 0 5px;" v-for="(item,index) in detailsData.attachList" :key="index">
+						    <text>{{ item.fileName }}</text>
+						  </view>
+					  </view>
+				  </view>
+			  </view>
 			</view>
 			<view class="messageContent" v-else>
-				<text style="margin-right: 20rpx;">{{item.notice.plainContent}}</text>
-				<u-button @click="toAction(item)" shape="circle" plain size="mini" type="primary">
-				  {{ item.notice.extInfo.bizType == 'SHELF_REPLENISH' ? '立即处理':'点击查看' }}
+				<text style="margin-right: 20rpx;">{{detailsData.plainContent}}</text>
+				<u-button @click="toAction(detailsData)" shape="circle" plain size="mini" type="primary">
+				  {{ detailsData.extInfo.bizType == 'SHELF_REPLENISH' ? '立即处理':'点击查看' }}
 				</u-button>
 			</view>
 		</view>
@@ -20,45 +36,61 @@
 
 <script>
 	import jyfParser from "@/components/jyf-parser/jyf-parser"
+	import {noticeUserDetail} from "@/api/user.js"
 	export default{
 		components: {
 		    jyfParser
 		},
 		data(){
 			return{
-				item: {
-					createDate: '',
-					notice:{
-						title: '',
-						content: ''
-					}
-				}
+				itemId: null,
+				detailsData: null
 			}
 		},
 		onLoad(options) {
-			let  item = JSON.parse(options.item)
-			this.item = Object.assign(this.item,item)
-			// this.item.notice.extInfo = JSON.parse(this.item.notice.extInfo)
-			console.log(item)
+			this.itemId = options.id
+			this.getDetail()
 		},
 		methods:{
+			viewPhoto(images){
+				uni.previewImage({
+					urls: images,
+				});
+			},
+			//  获取详情
+			getDetail () {
+			  noticeUserDetail({ id: this.itemId }).then(res => {
+				  console.log(res)
+			    if (res.status == 200) {
+			      this.detailsData = res.data
+			      if (this.detailsData.extInfo) {
+			        this.detailsData.extInfo = JSON.parse(this.detailsData.extInfo)
+			      }
+				  if(this.detailsData.imgPaths){
+					  this.detailsData.imgPaths = this.detailsData.imgPaths.split(',')
+				  }
+			    } else {
+			      this.detailsData = null
+			    }
+			  })
+			},
 			toAction (data) {
 			  // 急送订单
-			  if (data.notice.extInfo.bizType == 'TEMP_ORDER') {
-				uni.redirectTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify({ salesBillSn: data.notice.extInfo.bizSn }) })
+			  if (data.extInfo.bizType == 'TEMP_ORDER') {
+				uni.redirectTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify({ salesBillSn: data.extInfo.bizSn }) })
 			  }
 			  // 补货订单
-			  if (data.notice.extInfo.bizType == 'SHELF_REPLENISH') {
+			  if (data.extInfo.bizType == 'SHELF_REPLENISH') {
 				uni.redirectTo({ url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_CONFIRM' })
 			  }
 			  // 货架订单
-			  if (data.notice.extInfo.bizType == 'SHELF_ORDER') {
-				uni.redirectTo({ url: '/pages/shelfOrder/orderDetail?pageType=detail&orderBillSn='+data.notice.extInfo.bizSn })
+			  if (data.extInfo.bizType == 'SHELF_ORDER') {
+				uni.redirectTo({ url: '/pages/shelfOrder/orderDetail?pageType=detail&orderBillSn='+data.extInfo.bizSn })
 			  }
 			  // 货架异常
-			  if (data.notice.extInfo.bizType == 'SHELF_WARN') {
-				const shelfName = data.notice.plainContent.split('已经超过')[0]
-				uni.redirectTo({ url: '/pages/shelfOrder/shelfOrder?bizType=SHELF_WARN&shelfSn='+data.notice.extInfo.bizSn+'&shelfName='+shelfName })
+			  if (data.extInfo.bizType == 'SHELF_WARN') {
+				const shelfName = data.plainContent.split('已经超过')[0]
+				uni.redirectTo({ url: '/pages/shelfOrder/shelfOrder?bizType=SHELF_WARN&shelfSn='+data.extInfo.bizSn+'&shelfName='+shelfName })
 			  }
 			},
 		}
@@ -94,6 +126,17 @@
 				word-break: break-all;
 			}
 		}
+		.msgFujian{
+			padding: 20upx 0;
+			.tits{
+				color:#999;
+			}
+			.pimgs{
+				> view{
+					margin-bottom: 20upx;
+				}
+			}
+		}
 	}
 	
 </style>