123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- <template>
- <view class="top-box" :style="{ 'height': swiperHeight + 'rpx'}">
- <view :style="{backgroundSize:'100% '+swiperHeight+'rpx',backgroundImage: 'url('+bannerList[0].image+')'}"
- :class="['nav-top', pattern === 1 ? 'zw-nav-top zw-show-bg' : 'sh-nav-top sh-show-bg' , showNavBg ? '' : 'hide-nav-bg']">
- <view class="status-bar" :style="{'height': statusBarHeight + 'px'}" />
- <view class="status-title">
- <view class="title-identity-box">
- <view class="title-identity" @click.stop="toQY()">
- <!-- <text class="iconfont_yige identity-icon"></text> -->
- <image class="identity-icon" src="@/static/ZW/icon.png" mode="aspectFit"></image>
- <text>企业</text>
- </view>
- </view>
- <view class="title-name">
- <text :class="{'active-title-name':pattern === 1}" @click.stop="home.init(1)">政务</text>
- <text :class="{'active-title-name':pattern === 2}" @click.stop="home.init(2)">生活</text>
- </view>
- <view class="title-btn">
- <image class="title-btn-item" src="@/static/ZW/service.png" mode="aspectFit"
- @click.stop="openCustomerCenter()"></image>
- <!-- <text class="iconfont_yige title-btn-item" @click.stop="openCustomerCenter()"></text> -->
- <text class="iconfont_yige title-btn-item" style="font-size: 48rpx;"
- @click.stop="home.init(3)"></text>
- </view>
- </view>
- <view class="status-search">
- <view class="weather-box" @click.stop="openWeather()">
- <template v-if="weatherInfo">
- <image class="weather-img iconfont_yige" :src="weatherInfo.icon" mode="aspectFit"></image>
- <!-- <text class="weather-icon iconfont_yige"></text> -->
- <text class="weather-num" v-if="weatherInfo.temperature">{{weatherInfo.temperature}}
- <text>°C</text> </text>
- </template>
- </view>
- <view class="search-box" @click.stop="onSearch()">
- <text class="search-icon iconfont_yige"></text>
- <text class="search-text iconfont_yige">请输入检索关键字</text>
- </view>
- </view>
- </view>
- <!-- <view :style=" {'width':'100%','height': statusBarHeight + 'px' }"></view> -->
- <view class="shortcut-box" :style="{ 'paddingTop': statusBarHeight + 'px'}">
- <view class="status-placeholder"></view>
- <view class="shortcut-content">
- <u-row gutter="20">
- <u-col span="3">
- <view class="shortcut-item" @click.stop="openScanCode()">
- <image class="icon_img" src="@/static/ZW/scanQR.png" mode="aspectFit"></image>
- <!-- <text class="iconfont_yige iconfont-icon"></text> -->
- <text class="zw-one-row iconfont-name">扫一扫</text>
- </view>
- </u-col>
- <block v-if="topKongLimList.length > 0">
- <u-col span="3" v-for="item in topKongLimList" :key="item.id">
- <view class="shortcut-item" @click.stop="$openPage(item)">
- <!-- <text class="iconfont_yige iconfont-icon"></text> -->
- <image class="icon_img" :src="$getImgPath(item.icon)" mode="aspectFit"></image>
- <text class="zw-one-row iconfont-name">{{item.name}}</text>
- </view>
- </u-col>
- </block>
- </u-row>
- </view>
- </view>
- <!-- <view class="swiper-boxs" :style="{ 'height': swiperHeight + 'rpx'}">
- <view class="swiper-box">
- <zw-swiper :height="swiperHeight" :keyword=" pattern === 1 ? $keys.ZW_BANNER : $keys.SH_BANNER" />
- </view>
- </view> -->
- <view class="swiper-content" :style="{ 'height': swiperHeight + 'rpx'}">
- <zw-swiper ref="swiperRef" :height="swiperHeight"
- :keyword="pattern === 1 ? $keys.ZW_BANNER : $keys.SH_BANNER"
- :StorageKey="pattern === 1 ? $keys.sy_zw_BANNER : $keys.sy_sh_BANNER" @getBanner="getBannerList" />
- </view>
- </view>
- </template>
- <script>
- import Mixin from "./Mixin.js";
- import {
- openSearch
- } from "../../government/conmon.js"
- import {
- getPhotograph
- } from "@/utils/tool.js"
- import permision from "@/utils/permission.js"
- export default {
- props: {
- pattern: {
- type: Number,
- default: 1
- },
- swiperHeight: {
- type: Number,
- default: 720
- },
- scrollTop: {
- type: Number,
- default: 0
- },
- topKongLimList: {
- type: Array,
- default: () => []
- },
- toQyKongLimList: {
- type: Array,
- default: () => []
- },
- // 天气
- weatherInfo: {
- type: Object,
- default: null
- },
- },
- mixins: [Mixin],
- inject: ["home"],
- data() {
- return {
- showNavBg: true,
- scrollStyle: false,
- navScrollStyle: {
- // 'background-image': url("@/static/home_bar_01.png")
- },
- keyword: '',
- bannerList: [{}]
- }
- },
- methods: {
- openWeather() {
- this.$skipWeb('https://html5.moji.com/tpd/days40_web/index.html#/home?cityid=584', '宜昌天气')
- // this.$skipWeb('https://m.weather.com.cn/mweather/101200901.shtml', '宜昌天气')
- },
- getBannerList(e) {
- if (e && e.length > 0) {
- this.bannerList = e
- } else {
- this.bannerList = [{}]
- }
- },
- init() {
- this.$refs.swiperRef.init()
- },
- async openScanCode() {
- // #ifdef APP-PLUS
- let flag = await permision.showAuthTipModal("android.permission.CAMERA")
- if (!flag) return
- // #endif
- // getPhotograph();
- // 允许从相机和相册扫码
- uni.scanCode({
- scanType: ['qrCode'],
- success: function(res) {
- switch (res.scanType) {
- case 'QR_CODE':
- // 二维码
- const result = res.result
- const val = result.split("?")[1]
- const v = val.split("&")
- const obj = {};
- v.forEach(el => {
- const _v = el.split("=");
- obj[_v[0]] = _v[1]
- });
- if (obj.URLType === 'BigTurnplate') {
- uni.navigateTo({
- url: `/pages/game/Lottery?activityId=${obj.activityId}`
- })
- }
- if (obj.URLType === 'Task') {
- uni.navigateTo({
- url: `/pages/task/task-details?taskId=${obj.taskId}`
- })
- }
- break;
- }
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- },
- fail(fail) {
- console.log(fail)
- // if ([0, 11, 12].includes(fail.code)) return;
- // permision.showManualAuth('android.permission.CAMERA');
- }
- });
- },
- onSearch() {
- openSearch()
- },
- openCustomerCenter() {
- uni.navigateTo({
- url: '/pages/government/customer-center'
- });
- },
- toQY() {
- // this.$yghttp.get('/yima/request/appUser/enterprise').then(res=>{
- // if(res.data.has){
- this.$openPage(this.toQyKongLimList[0])
- // }else{
- // this.$openPage({thirdApplicationId:res.data.thirdApplicationId,name:''})
- // // uni.navigateTo({
- // // url:"/pages/web-view/Apps?path="+res.data.url
- // // })
- // }
- // })
- }
- },
- watch: {
- scrollTop: {
- handler: function(newNum, oldNum) {
- const scrollNum = Number(newNum) || 0
- // this.scrollStyle = scrollNum > 140 ? true : false;
- const num = uni.upx2px(40)
- // if (scrollNum > num) {
- // this.showNavBg = true
- // } else {
- // this.showNavBg = false
- // }
- // if (scrollNum >= 15 && scrollNum < 70) {
- // const op = scrollNum / 70;
- // this.navScrollStyle = {
- // opacity: 1 - op,
- // }
- // }
- // if (scrollNum >= 70 && scrollNum < 140) {
- // const op = (scrollNum - 70) / 70;
- // this.navScrollStyle = {
- // backgroundColor: `rgba(255, 255, 255, ${op})`,
- // opacity: op,
- // }
- // }
- // if (scrollNum >= 140) {
- // this.navScrollStyle = {
- // backgroundColor: `rgba(255, 255, 255 ,1)`,
- // }
- // }
- },
- immediate: true
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .top-box {
- width: 100%;
- overflow: hidden;
- position: relative;
- .swiper-content {
- position: absolute;
- left: 0;
- top: 0;
- right: 0;
- }
- .swiper-boxs {
- overflow: hidden;
- width: 200%;
- position: absolute;
- left: -50%;
- /* (width - 100%)/ 2 */
- top: 0;
- border-radius: 0 0 50% 50%;
- .swiper-box {
- margin: 0 auto;
- width: 750rpx;
- height: 100%;
- overflow: hidden;
- }
- }
- // .zw-show-bg {
- // background: url("@/static/home_bar_01.png") no-repeat center center;
- // }
- // .sh-show-bg {
- // // background: url("@/static/home_bar_02.png") no-repeat center center;
- // background-image: url("http://sly2020.oss-cn-beijing.aliyuncs.com/2024/01/25/b737a2ca9cd1492abc290e2081cb3739.png");
- // }
- .hide-nav-bg {
- background: none !important;
- }
- .nav-top {
- position: fixed;
- z-index: 2;
- left: 0;
- top: 0;
- right: 0;
- padding: 0 $zw-padding;
- background-size: 100% 100%;
- .status-title {
- width: 100%;
- height: 113rpx;
- padding-top: 27rpx;
- display: flex;
- justify-content: space-between;
- align-items: stretch;
- .title-identity-box,
- .title-btn {
- width: 200rpx;
- display: flex;
- align-items: center;
- }
- // 86rpx
- .title-identity-box {
- .title-identity {
- width: 141rpx;
- height: 57rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 30rpx;
- .identity-icon {
- font-size: 34rpx;
- }
- .identity-icon {
- width: 37.47rpx;
- height: 29.64rpx;
- }
- text+text {
- font-size: 26rpx;
- font-weight: 400;
- padding-left: 14rpx;
- }
- }
- }
- .title-btn {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .title-btn-item {
- width: 55rpx;
- height: 45rpx;
- }
- .title-btn-item {
- font-size: 40rpx;
- &:first-child {
- margin-right: 20rpx;
- }
- }
- }
- .title-name {
- flex: 1;
- display: flex;
- align-items: stretch;
- justify-content: center;
- text {
- display: flex;
- align-items: center;
- &+text {
- margin-left: 60rpx;
- }
- font-size: 36rpx;
- font-family: PingFang SC,
- PingFang SC-Medium;
- font-weight: 500;
- }
- .active-title-name {
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- position: relative;
- &::before {
- content: '';
- position: absolute;
- left: 0;
- bottom: 0;
- width: 100%;
- height: 8rpx;
- border-radius: 4rpx;
- }
- }
- }
- }
- .status-search {
- width: 100%;
- height: 110rpx;
- padding: 20rpx 0;
- display: flex;
- justify-content: space-between;
- align-items: stretch;
- .weather-box {
- width: 70rpx;
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .weather-img {
- width: 70rpx;
- height: 70rpx;
- }
- .weather-icon {}
- .weather-num {
- // padding-top: 5rpx;
- font-size: 22rpx;
- line-height: 1;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- // text-align: left;
- text {
- font-weight: 400;
- transform: scale(0.8);
- }
- }
- }
- .search-box {
- flex: 1;
- height: 100%;
- border-radius: 35rpx;
- overflow: hidden;
- padding: 0 20rpx;
- display: flex;
- align-items: center;
- .search-icon {
- font-size: 30rpx;
- }
- .search-text {
- font-size: 27rpx;
- padding-left: 3px;
- }
- }
- }
- }
- .zw-nav-top,
- .sh-nav-top {
- .title-identity-box,
- .title-btn,
- .weather-icon,
- .weather-num {
- color: #fff;
- }
- .title-identity {
- background-color: rgba(255, 255, 255, 0.3);
- // box-shadow: 0px 4px 6px 0px rgba(3, 148, 180, 0.30);
- }
- .title-name {
- .active-title-name {
- color: #fff;
- &::before {
- background-color: #fff;
- }
- }
- }
- .search-box {
- background: rgba(255, 255, 255, 0.30);
- border: 1rpx solid rgba(255, 255, 255, 0.36);
- color: #fff;
- .search-text {
- color: rgba(255, 255, 255, 0.50);
- }
- }
- }
- .zw-nav-top {
- .title-name {
- text {
- color: #D5F1F6;
- }
- }
- }
- .sh-nav-top {
- .title-name {
- text {
- color: #FFE6D6;
- }
- }
- }
- .scroll-style {
- .weather-icon {
- color: #FABB00;
- }
- .title-identity-box,
- .title-btn,
- .weather-num,
- .title-name>text {
- color: #000 !important;
- }
- .active-title-name::before {
- background-color: #000 !important;
- }
- .title-identity {
- // background-color: rgba(255, 255, 255, 0.3);
- border: 1rpx solid #ccc;
- // box-shadow: 0px 4px 6px 0px rgba(3, 148, 180, 0.30);
- }
- .search-box {
- border: 1rpx solid #ccc;
- color: #c1c1c1;
- .search-text {
- color: #c1c1c1;
- }
- }
- }
- .status-placeholder {
- width: 100%;
- // height: calc(113rpx + 110rpx);
- height: 223rpx;
- // height: 120px;
- }
- .shortcut-box {
- position: relative;
- left: 0;
- right: 0;
- top: 0;
- z-index: 1;
- .shortcut-content {
- width: 100%;
- padding: 35rpx $zw-padding 0;
- .shortcut-item {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .iconfont-icon {
- font-size: 50rpx;
- font-weight: bold;
- color: #fff;
- }
- .icon_img {
- width: 50rpx;
- height: 50rpx;
- vertical-align: middle;
- }
- .iconfont-name {
- width: 100%;
- padding-top: 15rpx;
- font-size: 28rpx;
- font-weight: 400;
- text-align: center;
- color: #fafafa;
- }
- }
- }
- }
- }
- </style>
|