From a94d46abe031d827c0e3bc49999cc02782ec09b8 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期五, 21 七月 2023 15:34:47 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- api/information.js | 17 pages/tabBar/information/information.vue | 257 ++++++++++++++ pages/tabBar/notice/notice.vue | 53 ++ static/send.png | 0 pages.json | 32 + .hbuilderx/launch.json | 2 unpackage/cache/certdata | 4 App.vue | 129 ++++++ common/constant.js | 4 pages/tabBar/examine/examine.vue | 86 ++- pages/tabBar/response/response.vue | 1 store/index.js | 14 pages/tabBar/notice/detail.vue | 176 ++++++-- manifest.json | 177 +++++++++ static/shu.jpg | 0 static/send_selected.png | 0 pages/index/index.vue | 70 +++ pages/tabBar/utils/tabBar.js | 6 18 files changed, 866 insertions(+), 162 deletions(-) diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 0c2e437..9c80382 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -2,7 +2,7 @@ "version" : "1.0", "configurations" : [ { - "playground" : "standard", + "playground" : "custom", "type" : "uni-app:app-android" }, { diff --git a/App.vue b/App.vue index 5e8094b..290aca9 100644 --- a/App.vue +++ b/App.vue @@ -1,23 +1,118 @@ <script> + +var jpushModule = uni.requireNativePlugin("JG-JPush") export default { - onLaunch: function() { - console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!') - console.log('App Launch') - // uni.hideTabBar({}); - // uni.clearStorageSync(); - // uni.clearStorage(); - }, - onShow: function() { - console.log('App Show') - // uni.hideTabBar(); - // uni.clearStorageSync(); - // uni.clearStorage(); - }, - onHide: function() { - // uni.clearStorageSync(); - console.log('App Hide') + onLaunch: function() { + console.log('App Launch',jpushModule) + jpushModule.initJPushService(); + jpushModule.setLoggerEnable(true); + jpushModule.addConnectEventListener(result=>{ + let connectEnable = result.connectEnable + uni.$emit('connectStatusChange',connectEnable) + }); + //消息回调——点击通知栏消息 跳转指定页面 + jpushModule.addNotificationListener(result=>{ + if (result.notificationEventType == "notificationOpened") { + //判断是否登录 + if (uni.getStorageSync('tk')) { + //工作通知——工作人员工作通知页 + if (result.title.includes('工作通知')){ + uni.switchTab({ + url: '/pages/tabBar/notice/notice', + }) + //信息审核——领导审核页 + }else if(result.title == '您有新的信息需要审批'){ + uni.switchTab({ + url: '/pages/tabBar/examine/examine', + }) + //审核结果——首页(后续加pc端信息发布页) + }else if(result.title.includes('信息审核')){ + uni.switchTab({ + url: '/pages/tabBar/information/information', + }) + } + }else { + console.log("未登录") + //未登录跳转首页 + uni.navigateTo({ + url: '/pages/index/index', + complete(res) { + console.log(res); + } + }) + uni.showToast({ + icon: 'none', + title: '请先登录', + duration: 3000 + }) + } + } + }); + jpushModule.addCustomMessageListener(result=>{ + let type = result.type + let messageType = result.messageType + let content = result.content + uni.showToast({ + icon: 'none', + title: JSON.stringify(result), + duration: 3000 + }) + }); + jpushModule.addLocalNotificationListener(result=>{ + let messageID = result.messageID + let title = result.title + let content = result.content + let extras = result.extras + uni.showToast({ + icon: 'none', + title: JSON.stringify(result), + duration: 3000 + }) + }) + + + + + // jpushModule.addGeofenceListener(result => { + // let code = result.code + // let type = result.type + // let geofenceId = result.geofenceId + // let userInfo = result.userInfo + // uni.showToast({ + // icon: 'none', + // title: '触发地理围栏', + // duration: 3000 + // }) + // }) + // jpushModule.setIsAllowedInMessagePop(true) + // jpushModule.pullInMessage(result => { + // let code = result.code + // console.log(code) + // }) + + // jpushModule.addInMessageListener(result => { + // let eventType = result.eventType + // let messageType = result.messageType + // let content = result.content + // console.log('inMessageListener', eventType, messageType, content) + + // uni.showToast({ + // icon: 'none', + // title: JSON.stringify(result), + // duration: 3000 + // }) + // }) + + }, + onShow: function() { + console.log('App Show') + }, + onHide: function() { + // jpushModule.initJPushService(); + console.log('App Hide') + } } - } + </script> <style lang="scss"> diff --git a/api/information.js b/api/information.js new file mode 100644 index 0000000..1ab35b3 --- /dev/null +++ b/api/information.js @@ -0,0 +1,17 @@ +import {service} from '../common/request.js'; + +export function getInfo(data) { + return service({ + url: '/app/warninfo/waitForPublish/Page', + method: 'POST', + data + }) +} + +export function publishInfo(data) { + return service({ + url: '/app/warninfo/publishById', + method: 'GET', + data + }) +} \ No newline at end of file diff --git a/common/constant.js b/common/constant.js index 0bcd72d..2399a22 100644 --- a/common/constant.js +++ b/common/constant.js @@ -1,8 +1,8 @@ let VUE_APP_BASE_URL= null; if (process.env.NODE_ENV == 'development') { - VUE_APP_BASE_URL = 'http://192.168.0.38:8086' - // VUE_APP_BASE_URL = 'http://121.239.169.30:13001' + // VUE_APP_BASE_URL = 'http://192.168.0.38:8086' + VUE_APP_BASE_URL = 'http://121.239.169.30:13001' }else { VUE_APP_BASE_URL = 'http://121.239.169.30:13001' } diff --git a/manifest.json b/manifest.json index b95ba81..a70c77e 100644 --- a/manifest.json +++ b/manifest.json @@ -16,7 +16,9 @@ "autoclose" : true, "delay" : 0 }, - "modules" : {}, + "modules" : { + "Push" : {} + }, /* 模块配置 */ "distribute" : { /* 应用发布信息 */ @@ -45,7 +47,8 @@ }, /* ios打包配置 */ "sdkConfigs" : { - "ad" : {} + "ad" : {}, + "push" : {} }, "icons" : { "android" : { @@ -79,6 +82,176 @@ } } } + }, + "nativePlugins" : { + "JG-JCore" : { + "JPUSH_APPKEY_ANDROID" : "d6ee424771aad696af857325", + "JPUSH_APPKEY_IOS" : "", + "JPUSH_CHANNEL_ANDROID" : "developer-default", + "JPUSH_CHANNEL_IOS" : "", + "__plugin_info__" : { + "name" : "极光JCore官方SDK", + "description" : "极光JCore官方SDK HBuilder插件版本", + "platforms" : "Android,iOS", + "url" : "https://ext.dcloud.net.cn/plugin?id=4028", + "android_package_name" : "com.natural.calamities", + "ios_bundle_id" : "", + "isCloud" : true, + "bought" : 1, + "pid" : "4028", + "parameters" : { + "JPUSH_APPKEY_ANDROID" : { + "des" : "[Android]极光portal配置应用信息时分配的AppKey", + "key" : "d6ee424771aad696af857325", + "value" : "" + }, + "JPUSH_APPKEY_IOS" : { + "des" : "[iOS]极光portal配置应用信息时分配的AppKey", + "key" : "JCore:APP_KEY", + "value" : "" + }, + "JPUSH_CHANNEL_ANDROID" : { + "des" : "[Android]用于统计分发渠道,不需要可填默认值developer-default", + "key" : "JPUSH_CHANNEL", + "value" : "" + }, + "JPUSH_CHANNEL_IOS" : { + "des" : "[iOS]用于统计分发渠道,不需要可填默认值developer-default", + "key" : "JCore:CHANNEL", + "value" : "" + } + } + } + }, + "JG-JPush" : { + "JPUSH_ADVERTISINGID_IOS" : "", + "JPUSH_DEFAULTINITJPUSH_IOS" : "", + "JPUSH_GOOGLE_API_KEY" : "", + "JPUSH_GOOGLE_APP_ID" : "", + "JPUSH_GOOGLE_PROJECT_ID" : "", + "JPUSH_GOOGLE_PROJECT_NUMBER" : "", + "JPUSH_GOOGLE_STORAGE_BUCKET" : "", + "JPUSH_HONOR_APPID" : "", + "JPUSH_HUAWEI_APPID" : "", + "JPUSH_ISPRODUCTION_IOS" : "", + "JPUSH_MEIZU_APPID" : "", + "JPUSH_MEIZU_APPKEY" : "", + "JPUSH_OPPO_APPID" : "", + "JPUSH_OPPO_APPKEY" : "", + "JPUSH_OPPO_APPSECRET" : "", + "JPUSH_VIVO_APPID" : "", + "JPUSH_VIVO_APPKEY" : "", + "JPUSH_XIAOMI_APPID" : "", + "JPUSH_XIAOMI_APPKEY" : "", + "__plugin_info__" : { + "name" : "极光JPush官方SDK", + "description" : "极光JPush官方SDK HBuilder插件版本", + "platforms" : "Android,iOS", + "url" : "https://ext.dcloud.net.cn/plugin?id=4035", + "android_package_name" : "com.natural.calamities", + "ios_bundle_id" : "", + "isCloud" : true, + "bought" : 1, + "pid" : "4035", + "parameters" : { + "JPUSH_ADVERTISINGID_IOS" : { + "des" : "[iOS]广告标识符(IDFA)如果不需要使用IDFA,可不填", + "key" : "JPush:ADVERTISINGID", + "value" : "" + }, + "JPUSH_DEFAULTINITJPUSH_IOS" : { + "des" : "[iOS]是否默认初始化,是填true,不是填false或者不填", + "key" : "JPush:DEFAULTINITJPUSH", + "value" : "" + }, + "JPUSH_GOOGLE_API_KEY" : { + "des" : "厂商google api_key,示例:asxa1232", + "key" : "google_api_key", + "value" : "" + }, + "JPUSH_GOOGLE_APP_ID" : { + "des" : "厂商google mobilesdk_app_id,示例:12346578", + "key" : "google_app_id", + "value" : "" + }, + "JPUSH_GOOGLE_PROJECT_ID" : { + "des" : "厂商google project_id ,示例:12346578", + "key" : "project_id", + "value" : "" + }, + "JPUSH_GOOGLE_PROJECT_NUMBER" : { + "des" : "厂商google project_number,示例:12346578", + "key" : "gcm_defaultSenderId", + "value" : "" + }, + "JPUSH_GOOGLE_STORAGE_BUCKET" : { + "des" : "厂商google storage_bucket,示例:12346578", + "key" : "google_storage_bucket", + "value" : "" + }, + "JPUSH_HONOR_APPID" : { + "des" : "厂商HONOR-appId,示例:12346578", + "key" : "com.hihonor.push.app_id", + "value" : "" + }, + "JPUSH_HUAWEI_APPID" : { + "des" : "厂商HUAWEI-appId,示例:appid=12346578", + "key" : "com.huawei.hms.client.appid", + "value" : "" + }, + "JPUSH_ISPRODUCTION_IOS" : { + "des" : "[iOS]是否是生产环境,是填true,不是填false或者不填", + "key" : "JPush:ISPRODUCTION", + "value" : "" + }, + "JPUSH_MEIZU_APPID" : { + "des" : "厂商MEIZU-appId,示例:MZ-12345678", + "key" : "MEIZU_APPID", + "value" : "" + }, + "JPUSH_MEIZU_APPKEY" : { + "des" : "厂商MEIZU-appKey,示例:MZ-12345678", + "key" : "MEIZU_APPKEY", + "value" : "" + }, + "JPUSH_OPPO_APPID" : { + "des" : "厂商OPPO-appId,示例:OP-12345678", + "key" : "OPPO_APPID", + "value" : "" + }, + "JPUSH_OPPO_APPKEY" : { + "des" : "厂商OPPO-appkey,示例:OP-12345678", + "key" : "OPPO_APPKEY", + "value" : "" + }, + "JPUSH_OPPO_APPSECRET" : { + "des" : "厂商OPPO-appSecret,示例:OP-12345678", + "key" : "OPPO_APPSECRET", + "value" : "" + }, + "JPUSH_VIVO_APPID" : { + "des" : "厂商VIVO-appId,示例:12345678", + "key" : "com.vivo.push.app_id", + "value" : "" + }, + "JPUSH_VIVO_APPKEY" : { + "des" : "厂商VIVO-appkey,示例:12345678", + "key" : "com.vivo.push.api_key", + "value" : "" + }, + "JPUSH_XIAOMI_APPID" : { + "des" : "厂商XIAOMI-appId,示例:MI-12345678", + "key" : "XIAOMI_APPID", + "value" : "" + }, + "JPUSH_XIAOMI_APPKEY" : { + "des" : "厂商XIAOMI-appKey,示例:MI-12345678", + "key" : "XIAOMI_APPKEY", + "value" : "" + } + } + } + } } }, /* SDK配置 */ diff --git a/pages.json b/pages.json index 108d9a3..99edc45 100644 --- a/pages.json +++ b/pages.json @@ -59,6 +59,23 @@ } }, { + "path" : "pages/tabBar/information/information", + "style" : + { + "navigationStyle": "custom", + "navigationBarTitleText": "", + "enablePullDownRefresh": true, + "app-plus": { + "scrollIndicator": "none", + "pullToRefresh": { + "support": true, + "color": "#000000", + "style": "circle" + } + } + } + }, + { "path" : "pages/tabBar/examine/examine", "style" : { @@ -110,27 +127,18 @@ "list": [ { "pagePath": "pages/tabBar/notice/notice" - // "iconPath": "static/notice1.png", - // "selectedIconPath": "static/notice1-selected.png", - // "text": "工作通知" }, { "pagePath": "pages/tabBar/response/response" - // "iconPath": "static/mine1.png", - // "selectedIconPath": "static/mine1-selected.png", - // "text": "我的叫应" + }, + { + "pagePath": "pages/tabBar/information/information" }, { "pagePath": "pages/tabBar/examine/examine" - // "iconPath": "static/notice1.png", - // "selectedIconPath": "static/notice1-selected.png", - // "text": "通知审核" }, { "pagePath": "pages/tabBar/count/count" - // "iconPath": "static/mine1.png", - // "selectedIconPath": "static/mine1-selected.png", - // "text": "信息统计" } ] diff --git a/pages/index/index.vue b/pages/index/index.vue index e0fb43d..e05bcab 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -6,16 +6,18 @@ </view> <view> <u-form :model="form" ref="uForm" class="form" > - <u-form-item ><u-input color="#fff" v-model="form.name" placeholder="请输入用户名" /></u-form-item> - <u-form-item ><u-input color="#fff" v-model="form.pwd" type="password" placeholder="请输入密码" /></u-form-item> + <u-form-item style="width: 75%;"><u-input color="#fff" v-model="form.name" placeholder="请输入用户名" /></u-form-item> + <u-form-item style="margin-top: 10px;width: 75%;" ><u-input color="#fff" v-model="form.pwd" type="password" placeholder="请输入密码" /></u-form-item> <!-- <view class="loginPsw"> <u-checkbox-group > <u-checkbox disabled="true"></u-checkbox><text style="color: #fff;">自动登录</text> </u-checkbox-group> <text style="color: lightblue;">忘记密码</text> </view> --> - <u-form-item ><u-button type="primary" style="width: 100%;" @click="Login">登录</u-button></u-form-item> - <view style="color: white;margin-left:25%;margin-top: 70%;">技术支持:中国科学院</view> + <u-form-item style="margin-top: 10px;width: 75%;"> + <u-button :loading="isLogining" type="primary" style="width: 100%;" @click="Login">登录</u-button> + </u-form-item> + <view style="color: white;margin-top: 150px;">技术支持:中国科学院</view> </u-form> </view> </view> @@ -24,29 +26,47 @@ <script> import {login} from '../../api/index.js'; import store from '@/store/index.js' + const jpushModule = uni.requireNativePlugin('JG-JPush') export default { data() { return { form: { name: '', - pwd: '' + pwd: '', + registrationId: '' }, - type: '' + type: '', + //极光推送 + connectStatus: '未连接', + registrationID: '未获得', + isLogining: false } }, onShow() { uni.clearStorageSync(); uni.clearStorage(); }, + onLoad() { + this.connect() + }, methods: { Login(){ + this.isLogining = true; login(this.form).then(res => { console.log("res",res) if (res.code === 100) { + this.isLogining = false; + //登录成功后 + //设置别名 + jpushModule.setAlias({ + 'alias': this.phone, + 'sequence': 1 + }) uni.setStorageSync("tk", res.data.tk); uni.setStorageSync("uid",res.data.uid); uni.setStorageSync('user', res.data); uni.setStorageSync('roleName', res.data.role.roleName); + console.log("登录--------",res.data.tk) if(res.data.role.roleName == '工作人员'){ this.$store.commit('setRoleId', 'user_other'); uni.switchTab({ @@ -66,8 +86,36 @@ } } }).catch(err=>{ + this.form.name = ''; + this.form.pwd = ''; + this.isLogining = false; }) }, + connect() { + uni.$on('connectStatusChange', (connectStatus) => { + console.log('进入连接') + var connectStr = '' + if (connectStatus == true) { + connectStr = '已连接' + this.getRegistrationID() + } else { + connectStr = '未连接' + } + console.log('监听到了连接状态变化 --- ', connectStr) + this.connectStatus = connectStr + }) + }, + //获取推送ID + getRegistrationID() { + jpushModule.getRegistrationID(result => { + let registerID = result.registerID + console.log('registerID',registerID) + this.registrationID = registerID + this.form.registrationId = registerID; + uni.setStorageSync('registrationID', registerID); + console.log("iddd",uni.getStorageSync('registrationID')) + }) + } } } </script> @@ -76,7 +124,7 @@ .box{ width: 100%; height: 100vh; - background: url('../../static/bg.jpeg') no-repeat; + background: url('../../static/shu.jpg') no-repeat; background-size: 100% 100%; background-attachment: fixed;/* 不设置的话页面滑动时,背景会不铺满*/ display: flex; @@ -102,9 +150,11 @@ text-shadow:0 0 1px #000; } .form{ - width: 80%; - margin: 100px auto 0px; - + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + margin-top: 25%; } .loginPsw{ margin-bottom: 20px; diff --git a/pages/tabBar/examine/examine.vue b/pages/tabBar/examine/examine.vue index d583e48..bf4a83c 100644 --- a/pages/tabBar/examine/examine.vue +++ b/pages/tabBar/examine/examine.vue @@ -13,8 +13,14 @@ <view class="contentList"> <view class="buttonGroup"> <view style="display: flex;"> + <view class="buttonAll all" + :class="{ 'active': selectedSaleAnalysis === 'all'}" + @click="handleButtonClick({label: 'all',name: '全部'})"> + 全部 + </view> <view v-for="(button, index) in buttons" :key="index" class="buttonItem" :class="{ 'active': selectedSaleAnalysis === button.label, + 'all': button.label === 'all', 'red': button.label === 'red', 'orange':button.label === 'orange', 'yellow':button.label === 'yellow', @@ -24,7 +30,7 @@ </view> </view> <view class="switchBtn"> - <text style="margin-right: 7px;">是否紧临</text> + <text style="margin-right: 7px;">仅紧临</text> <u-switch v-model="checked" size="20" @change="clickSwitch"></u-switch> </view> </view> @@ -39,7 +45,7 @@ <view class="content" @click="toDetail(item)"> <text>[{{item.colorContent}}]</text> <text>{{item.title}},{{item.content}}</text> - <view style="float: right; width: 80px;margin-top: 3px;"> + <view style="float: right; width: 80px;margin-top: -5px;"> <u-button v-if="item.buttonContent == '已审核通过'" size="mini" class="buttonCo" style="background-color:rgb(17, 204, 33);color: white"> {{item.buttonContent}} </u-button> @@ -78,35 +84,36 @@ return { data: { pageIndex: 1, - pageSize: 1000, + pageSize: 10, searchParams: { - emergType: 1,//1-紧急;2-常规 - warningLevel: 1,//1-红色预警;2-橙色预警;3-黄色预警;4-蓝色预警 - reviewStatus: 0//1:未审核,2:已审核,3:审核已驳回 + emergType: null,//1-紧急;2-常规 + warningLevel: null,//1-红色预警;2-橙色预警;3-黄色预警;4-蓝色预警 + reviewStatus: null//1:未审核,2:已审核,3:审核已驳回 } }, page: 'pages/tabBar/examine/examine', - checked: true, + checked: false, isReadOnly: false, statusBarHeight: 0, - buttons: [{ - label: 'red', - name: '红' - }, - { - label: 'orange', - name: '橙' - }, - { - label: 'yellow', - name: '黄' - }, - { - label: 'blue', - name: '蓝' - }, + buttons: [ + { + label: 'red', + name: '红' + }, + { + label: 'orange', + name: '橙' + }, + { + label: 'yellow', + name: '黄' + }, + { + label: 'blue', + name: '蓝' + }, ], - selectedSaleAnalysis: 'red', + selectedSaleAnalysis: 'all', examineList: [], } }, @@ -121,8 +128,8 @@ methods: { getExanineList() { this.data.searchParams.reviewStatus = this.isReadOnly ? 1 : null; - this.data.searchParams.emergType = this.checked ? 1 : 2; - this.data.searchParams.warningLevel = this.selectedSaleAnalysis =='red' ? 1 : this.selectedSaleAnalysis =='orange' ? 2: this.selectedSaleAnalysis =='yellow'? 3 : 4; + this.data.searchParams.emergType = this.checked ? 1 : null; + this.data.searchParams.warningLevel = this.selectedSaleAnalysis == 'all' ? null : this.selectedSaleAnalysis =='red' ? 1 : this.selectedSaleAnalysis =='orange' ? 2: this.selectedSaleAnalysis =='yellow'? 3 : 4; getExamine(this.data).then(res => { if(res.code == 100) { this.examineList = res.data ? res.data : []; @@ -131,10 +138,10 @@ if(this.examineList.length > 0) { this.examineList.forEach((item, index) => { - this.examineList[index].colorContent = this.data.searchParams.warningLevel == 1 ? '红色预警': this.data.searchParams.warningLevel == 2 ? '橙色预警': this.data.searchParams.warningLevel == 3 ? '黄色预警':'蓝色预警'; + this.examineList[index].colorContent = item.warningLevel == 1 ? '红色预警': item.warningLevel == 2 ? '橙色预警': item.warningLevel == 3 ? '黄色预警':'蓝色预警'; this.examineList[index].buttonContent = item.reviewStatus == 1 ? '待审核': item.reviewStatus == 2 ? '已审核通过' : '已驳回'; this.examineList[index].role = 'leader'; - this.examineList[index].warningLevel = this.data.searchParams.warningLevel; + this.examineList[index].warningLevel = item.warningLevel; }); } } @@ -147,11 +154,6 @@ chooseRead(e) { this.isReadOnly = e; this.getExanineList(); - // if(e) { - // this.examineList = this.examineList.filter(item => item.reviewStatus == 1); - // }else { - // this.getExanineList(); - // } }, toDetail(item) { console.log("item",item) @@ -218,6 +220,19 @@ align-items: center; justify-content: space-between; } +.buttonAll{ + margin-left:5px; + color: white; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 35px; + height: 30px; + border-radius: 5px; + font-size: 12px; + font-weight: 700; +} .buttonItem{ margin-left:5px; color: white; @@ -230,7 +245,10 @@ border-radius: 5px; } .active { - border: 1px solid gray; + border: 1.5px solid #8d8d8d; +} +.all { + background-color: rgb(17,204,33); } .red { background-color: red; diff --git a/pages/tabBar/information/information.vue b/pages/tabBar/information/information.vue new file mode 100644 index 0000000..fd4674b --- /dev/null +++ b/pages/tabBar/information/information.vue @@ -0,0 +1,257 @@ +<template> + <view class="box"> + <!-- 自定义导航栏 --> + <view class="navBarBox fix"> + <!-- 状态栏占位 --> + <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> + <!-- 真正的导航栏内容 --> + <view class="navBar" > + <view class="barText">信息发布</view> + </view> + </view> + <!-- 页面内容 --> + <view class="contentList"> + <view class="examineList"> + <view class="listHead"> + <u-checkbox-group > + <u-checkbox v-model="isReadOnly" :checked="isReadOnly" @change="chooseRead"></u-checkbox>只显示审核通过 + </u-checkbox-group> + + </view> + <view class="listContent" v-if="informationList.length > 0"> + <view v-for="(item, index) in informationList" :key="index" class="itemContent"> + <view class="content" @click="toDetail(item)"> + <text>[{{item.colorContent}}]</text> + <text>{{item.title}},{{item.content}}</text> + <view class="buttonContent"> + <u-button v-if="item.buttonContent == '审核通过'" size="mini" class="buttonCo" style="background-color:rgb(17, 204, 33);color: white"> + {{item.buttonContent}} + </u-button> + <u-button v-else-if="item.buttonContent == '已驳回'" size="mini" class="buttonCo" style="background-color:rgb(153, 148, 143);color: white"> + {{item.buttonContent}} + </u-button> + <u-button v-else type="error" size="mini" class="buttonCo"> + {{item.buttonContent}} + </u-button> + </view> + </view> + + </view> + </view> + <view v-else> + <u-empty + mode="data" + icon="http://cdn.uviewui.com/uview/empty/data.png" + margin-top="50%"> + </u-empty> + </view> + </view> + </view> + <tabBar :currentPagePath="page"></tabBar> + </view> +</template> + +<script> + import tabBar from '../tabBarIndex.vue' + import { getInfo } from '../../../api/information.js' + export default { + components:{ + tabBar + }, + data() { + return { + data: { + pageIndex: 1, + pageSize: 10000000, + searchParams: { + reviewStatus: null//2:已审核,null:全部 + } + }, + checked: false, + isReadOnly: false, + statusBarHeight: 0, + informationList: [], + page:'pages/tabBar/information/information' + } + }, + onLoad() { + //获取手机状态栏高度 + this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; + uni.hideTabBar(); + }, + onShow() { + this.getInformationList(); + }, + methods: { + getInformationList() { + this.data.searchParams.reviewStatus = this.isReadOnly ? 2 : null; + getInfo(this.data).then(res => { + if (res.code == 100){ + this.informationList = res.data ? res.data : []; + if(this.informationList.length > 0) { + this.informationList.forEach((item, index) => { + this.informationList[index].colorContent = item.warningLevel == 1 ? '红色预警': item.warningLevel == 2 ? '橙色预警': item.warningLevel == 3 ? '黄色预警':'蓝色预警'; + this.informationList[index].buttonContent = item.reviewStatus == 1 ? '待审核': item.reviewStatus == 2 ? '审核通过' : '已驳回'; + this.informationList[index].role = 'infoPeople'; + this.informationList[index].warningLevel = item.warningLevel; + }) + } + } + }) + }, + chooseRead(e) { + this.isReadOnly = e; + this.getInformationList(); + }, + toDetail(item) { + console.log("item",item) + uni.navigateTo({ + url: `/pages/tabBar/notice/detail?data=` + encodeURIComponent(JSON.stringify(item)) + }) + }, + //下拉刷新 + onPullDownRefresh() { + console.log('refresh'); + setTimeout(() => { + uni.stopPullDownRefresh(); + this.getInformationList(); + }, 1000); + }, + clickSwitch(e) { + this.getInformationList(); + } + } + } + +</script> + +<style> +.box { + display: flex; + flex-direction: column; + width: 100%; + height: 100%; +} +.fix{ + position: sticky; + top: 0; + left: 0; + right: 0; + width: 100%; + z-index: 1; +} +.navBarBox .navBar { + background-color:lightgrey; + height: 40px; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} +.barText{ + text-align: center; + width: 85%; + font-size: 16px; + /* text-align: center; */ + font-weight: 600; +} +.statusBar{ + background-color:lightgrey; +} +.contentList{ + display: flex; + flex-direction: column; +} +.buttonGroup{ + margin: 18px 12px; + display: flex; + align-items: center; + justify-content: space-between; +} +.buttonItem{ + margin-left:5px; + color: white; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 47px; + height: 30px; + border-radius: 5px; +} +.buttonAll{ + margin-left:5px; + color: white; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 35px; + height: 30px; + border-radius: 5px; + font-size: 12px; + font-weight: 700; +} +.all { + background-color: rgb(17,204,33); +} +.active { + border: 1.5px solid #8d8d8d; +} +.red { + background-color: red; +} +.orange { + background-color: rgb(251, 158, 13); +} +.yellow { + background-color: rgb(255, 223, 37); +} +.blue { + background-color: rgb(2, 167, 240); +} +.switchBtn{ + display: flex; + align-items: center; +} +.listHead{ + display: flex; + align-items: center; + /* background-color:lightgrey; */ + height: 25px; + padding: 10px 10px; +} +.listContent{ + display: flex; + flex-direction: column; + padding: 0 10px; +} +.itemContent{ + font-size: 16px; + color: gray; + margin-top: 10px; + border-bottom: 1px solid lightgrey; + +} +.content{ + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} +.buttonCo{ + margin-top: 5px; + margin-bottom: 10px; +} +.buttonContent{ + float: right; + width: 80px; + margin-top: -5px; +} +/* .divider{ + height: 1px; + background-color: gray; + margin-left: 10px; + margin-right: 10px; + +} */ +</style> \ No newline at end of file diff --git a/pages/tabBar/notice/detail.vue b/pages/tabBar/notice/detail.vue index 08871d0..2cda4c5 100644 --- a/pages/tabBar/notice/detail.vue +++ b/pages/tabBar/notice/detail.vue @@ -31,23 +31,43 @@ <text class="textTop"><b>短信内容:</b><i style="background-color: rgb(240, 248, 255);">{{detailData.content}}发布单位:{{detailData.publishingUnit}}</i></text> <view style="display: flex;"> <text class="textTop" style="width: 76px;" ><b>附件内容:</b></text> - <view class="attache"> + <view class="attache" v-if="isAllImg == 'no'"> <view v-for="(item, index) in detailData.attachments" :key="index" > - - <view style="display: flex;margin-top: 10px;" @click="openFile(item)"> + <view style="display: flex;margin-top: 10px;" v-if="item.suffix == 'jpg'|| item.suffix =='jpeg' || item.suffix =='png'"> + <image @click="previewSqs(item)" :src="item.attachment" style="width: 100rpx; height: 100rpx;margin-left: 5rpx;border: 3px solid #ccc;margin-right: 3px;"></image> + </view> + <view style="display: flex;margin-top: 10px;" @click="openFile(item)" v-else> <u-icon name="attach" color="#2979ff" size="20"></u-icon> {{item.attachementName}} </view> - + </view> + </view> + <view class="attache_img" v-else> + <view v-for="(item, index) in detailData.attachments" :key="index" > + <view style="display: flex;margin-top: 10px;" v-if="item.suffix == 'jpg'|| item.suffix =='jpeg' || item.suffix =='png'"> + <image @click="previewSqs(item,index)" :src="item.attachment" style="width: 100rpx; height: 100rpx;margin-left: 5rpx;border: 3px solid #ccc;margin-right: 3px;"></image> + </view> + <view style="display: flex;margin-top: 10px;" @click="openFile(item)" v-else> + <u-icon name="attach" color="#2979ff" size="20"></u-icon> {{item.attachementName}} + </view> </view> </view> </view> - <text class="textTop" v-if="detailData.role == 'leader'"><b>信息提交人:</b>{{detailData.infoSubmitter}}</text> + <text class="textTop" v-if="detailData.role == 'leader'"><b>信息提交人:</b>{{detailData.infoSubmitterRealName}}</text> <view class="textTop" v-if="detailData.role == 'leader'"> <text ><b>审核状态:</b></text> <text v-if="detailData.reviewStatus == 1" class="responseStatus" style='color: red;'>待审核</text> <text v-else-if="detailData.reviewStatus == 2" class="responseStatus" - style='color: rgb(17, 204, 33);'>已审核通过</text> + style='color: rgb(17, 204, 33);'>审核通过</text> + <text v-else class="responseStatus" + style='color: rgb(153, 148, 143);'>已驳回</text> + </view> + <view class="textTop" v-else-if="detailData.role == 'infoPeople'"> + <text ><b>审核状态:</b></text> + <text v-if="detailData.reviewStatus == 1" class="responseStatus" + style='color: red;'>待审核</text> + <text v-else-if="detailData.reviewStatus == 2" class="responseStatus" + style='color: rgb(17, 204, 33);'>审核通过</text> <text v-else class="responseStatus" style='color: rgb(153, 148, 143);'>已驳回</text> </view> @@ -70,6 +90,12 @@ @click="reject" >审核驳回</u-button> </view> + <view v-if="detailData.role == 'infoPeople' && detailData.reviewStatus == 2" class="btn"> + <u-button + style="background-color:rgb(6, 202, 23);color: white;width: 180px;" + @click="infoSend" + >确认发布</u-button> + </view> </view> </view> </template> @@ -77,12 +103,14 @@ <script> import VUE_APP_BASE_URL from '../../../common/constant.js' import { submit } from '../../../api/examine.js' + import { publishInfo } from '../../../api/information.js' export default { data() { return { // 状态栏高度 statusBarHeight: 0, key: 1, + isAllImg: '', detailData: { id: null, warnInfoId: null, @@ -105,17 +133,32 @@ this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; let test = options.data && JSON.parse(decodeURIComponent(options.data)); this.detailData = test; - console.log("wwwwwwww",this.detailData) - if(this.detailData.role == 'leader') { + + if(this.detailData.role == 'leader' || this.detailData.role == 'infoPeople' ) { this.detailData.attachments = this.detailData.attachment; if (this.detailData.attachments){ this.detailData.attachments.forEach((item,index) => { item.attachementName = this.detailData.attachment[index].attachmentName; }) } - - } + if (this.detailData.attachments){ + this.detailData.attachments.forEach((item,index) => { + item.suffix = item.attachementName.substring(item.attachementName.lastIndexOf(".") + 1); + if(item.suffix == 'jpg'|| item.suffix =='jpeg' || item.suffix =='png' ){ + if(this.detailData.role == 'leader' || this.detailData.role == 'infoPeople' ){ + item.attachment = VUE_APP_BASE_URL + item.attachment; + }else { + item.attachment = VUE_APP_BASE_URL + item.attachement; + } + + }else { + this.isAllImg = 'no'; + } + }) + } + console.log("this.isAllImg",this.isAllImg) + console.log("detailData",this.detailData) this.detailData.disaster = test.disasterType == 1 ? '地震': test.disasterType == 2 ? '洪涝' : test.disasterType == 3 ? '气象' : test.disasterType == 4 ? '泥石流': test.disasterType == 5 ? '水旱': '森林草原火灾'; }, methods: { @@ -145,49 +188,70 @@ } }) }, - openFile(item) { - let fileUrl = ''; - console.log("iiii",item) - if(this.detailData.role == 'leader'){ - fileUrl = VUE_APP_BASE_URL + item.attachment; - }else { - fileUrl = VUE_APP_BASE_URL + item.attachement; - } - console.log("urlllllllllllll",fileUrl) - uni.downloadFile({ - url: fileUrl, - header: { - - // 'tk':uni.getStorageSync('tk'), - // 'uid': uni.getStorageSync('uid'), - }, - success:function(res){ - console.log("下载res",res); - var filePath = res.tempFilePath; - const sidx = filePath.lastIndexOf('('); - const eidx = filePath.lastIndexOf(')'); - // 用于处理文档打开问题(ps:第一次打开 第二次无法打开问题) - if (sidx > -1 && eidx > -1) { - const restr = filePath.substr(sidx, eidx - sidx + 1); - filePath = filePath.replace(restr, ''); - } - // plus.runtime.openFile(filePath) - uni.openDocument({ - filePath: filePath, - success:function(){ - console.log('成功') - }, - fail:function(){ - uni.showToast({ - icon: 'none', - title: '暂不支持此类型', - duration: 2000 - }) - } - }) - } - }) - } + //信息发布 + infoSend() { + publishInfo({id: this.detailData.id}).then(res => { + if(res.code==100) { + this.goBack(); + } + }) + console.log("信息发布") + }, + //预览图片 + previewSqs(item,index) { + + let imgs = []; + for (let i = 0; i < this.detailData.attachments.length; i++) { + imgs.push(this.detailData.attachments[i].attachment) + } + console.log("预览",imgs) + uni.previewImage({ + urls: imgs, + current: index, + indicator: 'number', + loop: true + }) + }, + //预览文件 + openFile(item) { + let fileUrl = ''; + console.log("iiii",item) + if(this.detailData.role == 'leader' || this.detailData.role == 'infoPeople' ){ + fileUrl = VUE_APP_BASE_URL + item.attachment; + }else { + fileUrl = VUE_APP_BASE_URL + item.attachement; + } + console.log("urlllllllll",fileUrl) + uni.downloadFile({ + url: fileUrl, + header: {}, + success:function(res){ + console.log("下载res",res); + var filePath = res.tempFilePath; + const sidx = filePath.lastIndexOf('('); + const eidx = filePath.lastIndexOf(')'); + // 用于处理文档打开问题(ps:第一次打开 第二次无法打开问题) + if (sidx > -1 && eidx > -1) { + const restr = filePath.substr(sidx, eidx - sidx + 1); + filePath = filePath.replace(restr, ''); + } + // plus.runtime.openFile(filePath) + uni.openDocument({ + filePath: filePath, + success:function(){ + console.log('成功') + }, + fail:function(){ + uni.showToast({ + icon: 'none', + title: '暂不支持此类型', + duration: 2000 + }) + } + }) + } + }) + } } } </script> @@ -228,6 +292,11 @@ display: flex; flex-direction: column; } +.attache_img { + flex: 1; + display: flex; + flex-wrap: wrap; +} .responseStatus{ padding:5px; color:#2a2a2a; @@ -246,4 +315,5 @@ justify-content: space-around; width: 100%; } + </style> diff --git a/pages/tabBar/notice/notice.vue b/pages/tabBar/notice/notice.vue index 8faed0d..4bcb792 100644 --- a/pages/tabBar/notice/notice.vue +++ b/pages/tabBar/notice/notice.vue @@ -7,6 +7,7 @@ <!-- 真正的导航栏内容 --> <view class="navBar" > <view class="barText">{{user.name}}收到的工作通知</view> + <!-- <view class="barText">{{registerID}}</view> --> <!-- <view style="flex: 1;" @click="loginOut">退出</view> --> </view> </view> @@ -14,6 +15,11 @@ <view style="display: flex;flex-direction: column;"> <view class="buttonGroup"> <view style="display: flex;"> + <view class="buttonAll all" + :class="{ 'active': selectedSaleAnalysis === 'all'}" + @click="handleButtonClick({label: 'all',name: '全部'})"> + 全部 + </view> <view v-for="(button, index) in buttons" :key="index" class="buttonItem" :class="{ 'active': selectedSaleAnalysis === button.label, 'red': button.label === 'red', @@ -25,7 +31,7 @@ </view> </view> <view class="switchBtn"> - <text style="margin-right: 7px;">是否紧临</text> + <text style="margin-right: 7px;">仅紧临</text> <u-switch v-model="checked" size="20" @change="clickSwitch"></u-switch> </view> </view> @@ -45,7 +51,7 @@ <u-button @click="toDetail(item)"v-if="item.buttonContent == '已叫应'" size="mini" style="margin-bottom: 10px;background-color:rgb(17, 204, 33);color: white;"> {{item.buttonContent}} </u-button> - <u-button v-else-if="item.buttonContent == '未叫应'" type="error" size="mini" style="margin-bottom: 10px;" @click="openDialog(item)"> + <u-button v-else-if="item.buttonContent == '待叫应'" type="error" size="mini" style="margin-bottom: 10px;" @click="openDialog(item)"> {{item.buttonContent}} </u-button> <u-button @click="toDetail(item)" v-else type="error" size="mini" style="margin-bottom: 10px;"> @@ -100,15 +106,15 @@ tabBarLists: [], // 状态栏高度 statusBarHeight: 0, - checked: true, + checked: false, isReadOnly: false, showDialog: false, data: { pageIndex: 1, - pageSize: 1000, + pageSize: 10000000, searchParams: { - emergType: 1,//1-紧急;2-常规 - warningLevel: 1,//1-红色预警;2-橙色预警;3-黄色预警;4-蓝色预警 + emergType: null,//1-紧急;2-常规 + warningLevel: null,//1-红色预警;2-橙色预警;3-黄色预警;4-蓝色预警 readStatus: null//0-未读,1-已读 } }, @@ -129,21 +135,22 @@ name: '蓝' }, ], - selectedSaleAnalysis: 'red', + selectedSaleAnalysis: 'all', noticeListCopy: [], noticeListCopyRead:[], noticeList: [], user: { name: '' }, - page: 'pages/tabBar/notice/notice' + page: 'pages/tabBar/notice/notice', + registerID: '' } }, onShow () { this.tabBarLists = uni.getStorageSync('tabBarList'); - this.user.name = uni.getStorageSync('user').realName + uni.getStorageSync('user').name; - // this.selectedSaleAnalysis = 'red', + this.user.name = uni.getStorageSync('user').realName; this.getNoticeList(); + // this.registerID = uni.getStorageSync('registrationID'); // this.page = this.$route.meta.pagePath; }, onLoad() { @@ -154,11 +161,11 @@ }, methods: { getNoticeList() { - this.data.searchParams.readStatus = this.isReadOnly ? 0 : null; - this.data.searchParams.emergType = this.checked ? 1 : 2; - this.data.searchParams.warningLevel = this.selectedSaleAnalysis =='red' ? 1 : this.selectedSaleAnalysis =='orange' ? 2: this.selectedSaleAnalysis =='yellow'? 3 : 4; + this.data.searchParams.readStatus = this.isReadOnly ? 0 : null; + this.data.searchParams.emergType = this.checked ? 1 : null ; + this.data.searchParams.warningLevel = this.selectedSaleAnalysis =='all' ? null : this.selectedSaleAnalysis =='red' ? 1 : this.selectedSaleAnalysis =='orange' ? 2: this.selectedSaleAnalysis =='yellow'? 3 : 4; getNotice(this.data).then(res => { - console.log("res",res); + console.log("dddddr",res); if (res.code == 100) { this.noticeList = res.data ? res.data : []; this.noticeListCopy = this.noticeList; @@ -285,8 +292,24 @@ height: 30px; border-radius: 5px; } +.buttonAll{ + margin-left:5px; + color: white; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 35px; + height: 30px; + border-radius: 5px; + font-size: 12px; + font-weight: 700; +} +.all { + background-color: rgb(17,204,33); +} .active { - border: 1px solid gray; + border: 1.5px solid #8d8d8d; } .red { background-color: red; diff --git a/pages/tabBar/response/response.vue b/pages/tabBar/response/response.vue index d7bc11e..8730a72 100644 --- a/pages/tabBar/response/response.vue +++ b/pages/tabBar/response/response.vue @@ -81,6 +81,7 @@ toDetail(item) { console.log("de",item) getDetail({id: item.id}).then(res => { + console.log("response",res) if(res.code == 100) { uni.navigateTo({ url: `/pages/tabBar/notice/detail?data=` + encodeURIComponent(JSON.stringify(res.data)) diff --git a/pages/tabBar/utils/tabBar.js b/pages/tabBar/utils/tabBar.js index 588293f..feb6513 100644 --- a/pages/tabBar/utils/tabBar.js +++ b/pages/tabBar/utils/tabBar.js @@ -25,6 +25,12 @@ "iconPath": "/static/mine1.png", "selectedIconPath": "/static/mine1-selected.png", "text": "我的叫应" + }, + { + "pagePath": "pages/tabBar/information/information", + "iconPath": "/static/send.png", + "selectedIconPath": "/static/send_selected.png", + "text": "信息发布" } ] diff --git a/static/send.png b/static/send.png new file mode 100644 index 0000000..a825cd9 --- /dev/null +++ b/static/send.png Binary files differ diff --git a/static/send_selected.png b/static/send_selected.png new file mode 100644 index 0000000..b46d9c3 --- /dev/null +++ b/static/send_selected.png Binary files differ diff --git a/static/shu.jpg b/static/shu.jpg new file mode 100644 index 0000000..ef8a790 --- /dev/null +++ b/static/shu.jpg Binary files differ diff --git a/store/index.js b/store/index.js index 11910cc..877f72d 100644 --- a/store/index.js +++ b/store/index.js @@ -1,18 +1,4 @@ -// import Vue from 'vue' -// import Vuex from 'vuex' -// import tabBar from './modules/tabBar.js' -// import getters from './getters.js' -// Vue.use(Vuex) - -// const store = new Vuex.Store({ -// modules: { -// tabBar -// }, -// getters -// }) - -// export default store import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) diff --git a/unpackage/cache/certdata b/unpackage/cache/certdata index c9620c5..49e77f8 100644 --- a/unpackage/cache/certdata +++ b/unpackage/cache/certdata @@ -1,3 +1,3 @@ -andrCertfile=D:/HBuilderX.3.8.4.20230531/HBuilderX/plugins/app-safe-pack/Test.keystore -andrCertAlias=android +andrCertfile=C:/Users/Administrator/Desktop/sznmyjs.keystore +andrCertAlias=sznmyjs andrCertPass=ep/Tdjka4Y7WYqDB6/S7dw== -- Gitblit v1.9.2