guoshilong
2023-11-03 1583d37aeb150564b54b2a8b6826eb76d1f05683
首页场所采集跳转,扫一扫跳转
1 files modified
66 ■■■■ changed files
pages/home/index.vue 66 ●●●● patch | view | raw | blame | history
pages/home/index.vue
@@ -1,6 +1,7 @@
<template>
    <view class="">
        <u-navbar height="48" :autoBack="false" safeAreaInsetTop placeholder  @leftClick="selectBoxShow = !selectBoxShow">
        <u-navbar height="48" :autoBack="false" safeAreaInsetTop placeholder
            @leftClick="selectBoxShow = !selectBoxShow">
            <view slot="left" class="flex">
                <text class="top">{{curSelectSite.name?curSelectSite.name:'暂无绑定' +roleTypeName+'信息'}}</text>
                <u-icon name="/static/icon/change-icon.png"></u-icon>
@@ -37,7 +38,7 @@
            </view>
            <view class="block flex a-i-c j-c-s-b" v-if="roleType == 1">
                <view class="block-item">
                <view @click="scan" class="block-item">
                    <image class="block-item-bg" src="/static/icon/nav-bg-04.png" mode="aspectFill" />
                    <view class="block-item-box flex a-i-c ">
                        <u-icon name="/static/icon/nav-05.png" width="90rpx" height="90rpx"></u-icon>
@@ -68,7 +69,8 @@
                    </view>
                </view>
                <view class="flex flex-wrap">
                    <view class="cell bgc-main flex a-i-c" v-for="(item, index) in houseDataList.slice(0, 6)"  @click.native="pushPage(item)">
                    <view class="cell bgc-main flex a-i-c" v-for="(item, index) in houseDataList.slice(0, 6)"
                        @click.native="pushPage(item)">
                        <u-icon name="/static/icon/floor.png" width="32rpx" height="32rpx"></u-icon>
                        <text class="cell-text f-26 c-ff">{{item.title}}</text>
                    </view>
@@ -83,8 +85,8 @@
                    </view>
                </view>
                <u-grid :border="false" col="4">
                    <u-grid-item v-for="(item, index) in jobList" :index="index" :key="index"
                        :customStyle="{paddingTop:20+'rpx'}">
                    <u-grid-item @click="navigatorPage(item)" v-for="(item, index) in jobList" :index="index"
                        :key="index" :customStyle="{paddingTop:20+'rpx'}">
                        <view class="grid-item flex f-d-c a-i-c"  :style="{background:item.style.background}">
                            <u-icon :name="item.icon" width="60rpx" height="60rpx"></u-icon>
                            <text class="grid-text f-24 mt-10">{{item.text}}</text>
@@ -491,7 +493,10 @@
            },
            
            // 页面跳转
            pushPage({id, title}) {
            pushPage({
                id,
                title
            }) {
                if (id !== void 0) {
                    let url = `/subPackage/house/list/index?id=${id}&title=${title}`
                    this.$u.func.globalNavigator(url, "navTo")
@@ -499,7 +504,11 @@
            },
            
            // 页面跳转
            toPage({id, title, path }) {
            toPage({
                id,
                title,
                path
            }) {
                let url = `${path}`
                this.$u.func.globalNavigator(url, "navTo")
                if (id !== void 0) {
@@ -510,6 +519,49 @@
            
            navTo(){
                this.$u.func.globalNavigator("/subPackage/bs/views/zhsb", "navTo")
            },
            navigatorPage() {
                let url = "/subPackage/workbench/views/cscj"
                this.$u.func.globalNavigator(url, "navTo")
            },
            scan() {
                const that = this
                uni.scanCode({
                    success: function(res) {
                        console.log(res)
                        console.log('条码类型:' + res.scanType);
                        console.log('条码内容:' + res.result);
                        let obj = that.getUrlParams(res.result)
                        console.log(obj)
                        let url = "/subPackage/workbench/views/cscj?stdId=" + obj.stdId
                        console.log(url)
                        that.$u.func.globalNavigator(url, "navTo")
                    }
                });
            },
            getUrlParams(url) {
                // 通过 ? 分割获取后面的参数字符串
                let urlStr = url.split('?')[1]
                // 创建空对象存储参数
                let obj = {};
                // 再通过 & 将每一个参数单独分割出来
                let paramsArr = urlStr.split('&')
                for (let i = 0, len = paramsArr.length; i < len; i++) {
                    // 再通过 = 将每一个参数分割为 key:value 的形式
                    let arr = paramsArr[i].split('=')
                    obj[arr[0]] = arr[1];
                }
                return obj
            }
            
        }