From 807b4ab1519e1ec49fac5626fe98f4be8802ecea Mon Sep 17 00:00:00 2001 From: zhouwenxuan <1175765986@qq.com> Date: 星期三, 28 六月 2023 16:12:18 +0800 Subject: [PATCH] 文件预览 --- pages/tabBar/notice/detail.vue | 108 +++++--- pages/tabBar/notice/notice.vue | 49 +++- manifest.json | 177 ++++++++++++++ pages.json | 32 +- .hbuilderx/launch.json | 2 App.vue | 136 +++++++++- common/constant.js | 4 pages/index/index.vue | 70 +++++ pages/tabBar/examine/examine.vue | 86 ++++-- pages/tabBar/utils/tabBar.js | 6 store/index.js | 14 - 11 files changed, 538 insertions(+), 146 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..6922043 100644 --- a/App.vue +++ b/App.vue @@ -1,23 +1,125 @@ <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=>{ + console.log(result) + if (result.notificationEventType == "notificationOpened") { + //判断是否登录 + if (uni.getStorageSync('tk')) { + //工作通知——工作人员工作通知页 + if (result.title.includes('工作通知')){ + uni.navigateTo({ + url: '/pages/tabBar/notice/notice', + complete(res) { + console.log(res); + } + }) + //信息审核——领导审核页 + }else if(result.title == '您有新的信息需要审批'){ + uni.navigateTo({ + url: '/pages/tabBar/examine/examine', + complete(res) { + console.log(res); + } + }) + //审核结果——首页(后续加pc端信息发布页) + }else if(result.title.includes('信息审核')){ + uni.navigateTo({ + url: '/pages/tabBar/information/information', + complete(res) { + console.log(res); + } + }) + } + }else { + //未登录跳转首页 + 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/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/notice/detail.vue b/pages/tabBar/notice/detail.vue index 922e911..4b4ffe8 100644 --- a/pages/tabBar/notice/detail.vue +++ b/pages/tabBar/notice/detail.vue @@ -47,7 +47,16 @@ <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 +79,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,6 +92,7 @@ <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 { @@ -106,7 +122,7 @@ 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) => { @@ -143,45 +159,54 @@ } }) }, - 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("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 - }) - } - }) - } - }) - } + //信息发布 + infoSend() { + publishInfo({id: this.detailData.id}).then(res => { + if(res.code==100) { + this.goBack(); + } + }) + console.log("信息发布") + }, + 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> @@ -240,4 +265,5 @@ justify-content: space-around; width: 100%; } + </style> diff --git a/pages/tabBar/notice/notice.vue b/pages/tabBar/notice/notice.vue index 6686912..83c328a 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> @@ -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').name; this.getNoticeList(); + // this.registerID = uni.getStorageSync('registrationID'); // this.page = this.$route.meta.pagePath; }, onLoad() { @@ -155,10 +162,10 @@ 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.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/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/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) -- Gitblit v1.9.2