quanyawei
2023-11-10 0a24ffeb3eff074c8f11e9f94fdf2c2cb4929799
fix:小程序详情修改
7 files modified
234 ■■■■ changed files
App.vue 105 ●●●● patch | view | raw | blame | history
pages/actionChange/agencyPage/index.vue 46 ●●●● patch | view | raw | blame | history
pages/actionChange/components/basicInfor.vue 35 ●●●● patch | view | raw | blame | history
pages/actionChange/components/rectificationInfor.vue 2 ●●● patch | view | raw | blame | history
pages/actionChange/newPage/index.vue 5 ●●●●● patch | view | raw | blame | history
pages/actionChange/workOrderDetails/index.vue 30 ●●●● patch | view | raw | blame | history
pages/index/index.vue 11 ●●●●● patch | view | raw | blame | history
App.vue
@@ -3,7 +3,6 @@
        getDic
    } from '@/utils/login.js' // 配置文件
    import store from '@/store/index.js'
    import routingIntercept from '@/utils/permission.js'
    import {
        httpPost,
        httpGet
@@ -13,22 +12,22 @@
            console.log('optionsonShow', options)
            if (options.scene === 1007 || options.scene === 1014 || options.scene === 1008) {
                // 通过单人聊天会话分享进入
                this.getWXCode()
                // this.getWXCode()
            }
        },
        onLaunch() {
            // 自动登录检测
            let token = uni.getStorageSync('token')
            console.log('apptoken', token)
            console.log('apptoken1', !token)
            if (!token) {
                uni.login({
                    provider: 'weixin',
                    success: loginRes => {
                        console.log('loginRes', loginRes)
                        console.log('loginRes1', loginRes)
                        httpGet('/AppUser/wx/login', {
                            'code': loginRes.code
                        }).then(result => {
                            routingIntercept()
                            console.log('AppUser1', result)
                            try {
                                if (result.data.code === 0) {
                                    uni.clearStorageSync()
@@ -79,59 +78,53 @@
             *
             */
            getWXCode() {
                let token = uni.getStorageSync('token')
                console.log('apptoken', token)
                if (!token) {
                    uni.login({
                        provider: 'weixin',
                        success: loginRes => {
                            console.log('loginRes', loginRes)
                            httpGet('/AppUser/wx/login', {
                                'code': loginRes.code
                            }).then(result => {
                                routingIntercept()
                                try {
                                    if (result.data.code === 0) {
                                        uni.clearStorageSync()
                                        uni.setStorageSync('userInfor', JSON.stringify(result.data))
                                        uni.setStorageSync('tonken', result.data.token)
                                        uni.setStorageSync('openId', result.data.openId)
                                        getDic()
                                        this.$isResolve()
                                    } else {
                                        uni.clearStorageSync()
                                        uni.setStorageSync('openId', result.data.openId)
                                        uni.showModal({
                                            title: '未登录',
                                            content: '您未登录,需要登录后才能继续',
                                            showCancel: false,
                                            confirmText: '确定',
                                            success: res => {
                                                if (res.confirm) {
                                                    uni.reLaunch({
                                                        url: '/pages/login/login',
                                                    })
                                                }
                                            },
                                        })
                                        this.$isResolve()
                                    }
                                } catch (e) {
                                    console.error(e)
                uni.login({
                    provider: 'weixin',
                    success: loginRes => {
                        console.log('loginRes2', loginRes)
                        httpGet('/AppUser/wx/login', {
                            'code': loginRes.code
                        }).then(result => {
                            console.log('AppUser2', result)
                            try {
                                if (result.data.code === 0) {
                                    uni.clearStorageSync()
                                    uni.setStorageSync('userInfor', JSON.stringify(result.data))
                                    uni.setStorageSync('tonken', result.data.token)
                                    uni.setStorageSync('openId', result.data.openId)
                                    getDic()
                                    this.$isResolve()
                                } else {
                                    uni.clearStorageSync()
                                    uni.setStorageSync('openId', result.data.openId)
                                    uni.showModal({
                                        title: '未登录',
                                        content: '您未登录,需要登录后才能继续',
                                        showCancel: false,
                                        confirmText: '确定',
                                        success: res => {
                                            if (res.confirm) {
                                                uni.reLaunch({
                                                    url: '/pages/login/login',
                                                })
                                            }
                                        },
                                    })
                                    this.$isResolve()
                                }
                            }).catch(errors => {
                                console.log('appdddd', errors)
                                uni.showToast({
                                    title: errors,
                                    icon: 'none',
                                })
                                this.$isResolve()
                            } catch (e) {
                                console.error(e)
                            }
                        }).catch(errors => {
                            console.log('appdddd2', errors)
                            uni.showToast({
                                title: errors,
                                icon: 'none',
                            })
                        }
                    })
                } else {
                    this.$isResolve()
                }
                            this.$isResolve()
                        })
                    }
                })
            },
            getLogin(data) {
                // 调用接口。将登录code传给后端进行判断
pages/actionChange/agencyPage/index.vue
@@ -24,7 +24,7 @@
                    <uni-datetime-picker v-model="range" type="daterange" rangeSeparator="至" />
                </view>
                <view>
                    <u-button type="primary" size="small" text="查询" @click="getWorkOrder"></u-button>
                    <u-button type="primary" size="small" text="查询" @click="getSearch" throttleTime='500'></u-button>
                </view>
            </view>
            <view :key="index" v-for="(item, index) in workOderList" class="workOrderDetail"
@@ -107,11 +107,7 @@
                            <view class="wholeLine">
                                <text class="rowTipContenetLabel">上报单位:</text>
                                <text class="rowTipContenetAll">
                                    {{ unitList.find(
                                            (a) =>
                                                item && parseInt(a.unitId) === item.escalationUnitId
                                        ).unitName
                                    }}
                                    {{ item.escalationUnitName}}
                                </text>
                            </view>
                        </view>
@@ -285,8 +281,17 @@
                    currentPage: 1,
                    pageSize: 10
                }
                this.workOderList = []
                this.startTime = ''
                this.endTime = ''
                uni.$u.throttle(this.getWorkOrder, 500)
            },
            getSearch() {
                this.workOderList = []
                this.page = {
                    currentPage: 1,
                    pageSize: 10
                }
                this.getWorkOrder()
            },
            // 获取责任单位list
@@ -332,29 +337,24 @@
                            this.isLoading = true
                            this.status = 'loadmore'
                        }
                        if (this.page.currentPage === res.data.page.currentPage) {
                            this.workOderList = res.data.list
                        } else {
                            res.data.list.forEach(el => {
                                this.workOderList.push(el)
                            })
                        }
                        res.data.list.forEach(el => {
                            this.workOderList.push(el)
                        })
                    } else {
                        this.status = 'nomore'
                    }
                })
            },
            handleClick(e, pageState) {
                this.$http.httpGet('/allocation/detail', {
                    id: e.allocationId
                }).then(res => {
                    let data = res.data
                    data.pageState = e.stateName === '待处理' ? pageState : 'view'
                    data.stateName = e.stateName
                    let myData = JSON.stringify(data)
                    uni.navigateTo({
                        url: '/pages/actionChange/workOrderDetails/index?infor=' + myData + '&type=jump',
                    })
                let data = {}
                data.pageState = e.stateName === '待处理' ? pageState : 'view'
                data.stateName = e.stateName
                data.allocationId = e.allocationId
                data.state = e.state
                data.allocationNum = e.allocationNum
                let myData = JSON.stringify(data)
                uni.navigateTo({
                    url: '/pages/actionChange/workOrderDetails/index?infor=' + myData + '&type=jump',
                })
            },
        },
pages/actionChange/components/basicInfor.vue
@@ -38,7 +38,7 @@
                            <view class="wholeLine">
                                <text class="rowTipContenetLabel">责任主体:</text>
                                <text class="rowTipContenetAll">
                                    {{ unitName }}
                                    {{ basicInfor.unitName }}
                                </text>
                            </view>
                        </view>
@@ -46,7 +46,7 @@
                            <view class="wholeLine">
                                <text class="rowTipContenetLabel">污染分类:</text>
                                <text class="rowTipContenetAll">
                                    {{ polluteType }}
                                    {{ basicInfor.polluteTypeName }}
                                </text>
                            </view>
                        </view>
@@ -76,7 +76,7 @@
                            <view class="wholeLine">
                                <text class="rowTipContenetLabel">上报单位:</text>
                                <text class="rowTipContenetAll">
                                    {{ escalationUnitName }}
                                    {{ basicInfor.escalationUnitName }}
                                </text>
                            </view>
                        </view>
@@ -119,34 +119,7 @@
                baseUrl: this.$storage.get('baseUrl'),
            }
        },
        computed: {
            unitName() {
                let data = ''
                if (this.basicInfor.unitId && this.unitList.length > 0) {
                    data = this.unitList && this.unitList.find(a => Number(a.unitId) === Number(this.basicInfor.unitId))
                        .unitName
                }
                return data
            },
            escalationUnitName() {
                let data = ''
                if (this.basicInfor.unitId && this.unitList.length > 0) {
                    data = this.unitList && this.unitList.find(a => Number(a.unitId) === Number(this.basicInfor
                        .escalationUnitId)).unitName
                }
                return data
            },
            polluteType() {
                let data = ''
                console.log('this.polluteList', this.polluteList)
                console.log('this.basicInfor.polluteType', this.basicInfor.polluteType)
                if (String(this.basicInfor.polluteType) && this.polluteList.length > 0) {
                    data = this.polluteList.find(a => Number(a.dataKey) === Number(this.basicInfor.polluteType)).dataValue
                }
                console.log('data', data)
                return data
            }
        },
        computed: {},
        watch: {
            basicInfor: {
                handler: function(newValue, oldValue) {
pages/actionChange/components/rectificationInfor.vue
@@ -33,7 +33,7 @@
                                <u-form-item label="是否整改:" :required="!pageState" :border-bottom="false">
                                    <u-radio-group v-model="form.isChange" @change="radioGroupChange">
                                        <u-radio :key="index" v-for="(item, index) in list"
                                            :custom-style="{marginRight: '8px'}" :label="item.name"
                                            :custom-style="{marginRight: '16px'}" :label="item.name"
                                            :name="item.value" />
                                    </u-radio-group>
                                </u-form-item>
pages/actionChange/newPage/index.vue
@@ -62,8 +62,9 @@
                </view>
            </u-form-item>
        </u-form>
        <u-picker :show="showCheckBox" keyName="label" :columns="actionOptionList" @cancel="showCheckBox = false"
            :immediateChange='true' @confirm="selectBack"></u-picker>
        <u-picker v-if="showCheckBox" :show="showCheckBox" keyName="label" :columns="actionOptionList"
            @cancel="showCheckBox = false" :default-selector="[0]" :immediateChange='true'
            @confirm="selectBack"></u-picker>
        <!--     <u-action-sheet v-if="actionOptionList.length > 0" :actions="actionOptionList" :show="showCheckBox" title="请选择"
            @close="showCheckBox = false" @select="selectBack" /> -->
        <view class="bunts">
pages/actionChange/workOrderDetails/index.vue
@@ -2,10 +2,10 @@
    <view class="mainContent">
        <basicInfor :basic-infor="basicInfor" v-if="isShow" />
        <rectificationInfor ref="rectificationInfor" :basic-infor="basicInfor"
            v-if="!(pageState === 'view' && basicInfor.state === 20)" />
        <approvalnfor ref="approvalnfor" v-if="basicInfor.state >= 30 && basicInfor.stateName!=='待完成'"
            v-if="!(pageState === 'view' && basicInfor.state === 20)&&isShow" />
        <approvalnfor ref="approvalnfor" v-if="basicInfor.state >= 30 && basicInfor.stateName!=='待完成' && isShow"
            :basic-infor="basicInfor" />
        <view class="bunts">
        <view class="bunts" v-if="isShow">
            <view class="but butRight">
                <u-button shape="square" @click="refuse" type="error"
                    v-if="pageState==='edit'&& basicInfor.state >= 30">拒绝</u-button>
@@ -34,7 +34,7 @@
                basicInfor: {},
                unitListL: [],
                userInfor: null,
                show: false,
                show: true,
                isShow: false,
                option: {}
            }
@@ -47,7 +47,7 @@
        created() {
            this.getUnitList()
        },
        onLoad: function(option) {
        onLoad(option) {
            //option为object类型,会序列化上个页面传递的参数
            this.basicInfor = JSON.parse(option.infor)
            // let type = JSON.parse(option.type)
@@ -55,8 +55,8 @@
            this.option = option
        },
        async mounted() {
            //等待登录成功
            await this.$onLaunched
            //等待登录成功
            this.userInfor = JSON.parse(uni.getStorageSync('userInfor') || 'null')
            console.log('详情页的用户信息', this.userInfor)
            if (this.option.type === 'share' && this.userInfor) {
@@ -83,12 +83,12 @@
                        // 可以编辑
                        this.basicInfor.pageState = 'edit'
                        this.basicInfor.stateName = res.data.name
                        this.isShow = true
                        this.getData()
                    } else if (res.data.code === 2) {
                        // 可以看
                        this.isShow = true
                        this.basicInfor.pageState = 'view'
                        this.basicInfor.stateName = res.data.name
                        this.getData()
                    }
                }).catch(errors => {
                    console.log('获取失败的信息', errors)
@@ -96,11 +96,23 @@
                })
            } else {
                this.isShow = true
                this.getData()
            }
            console.log('this.basicInfor123', this.basicInfor)
        },
        methods: {
            closePop() {},
            getData() {
                this.$http.httpGet('/allocation/detail', {
                    id: this.basicInfor.allocationId
                }).then(res => {
                    this.isShow = true
                    this.show = false
                    this.basicInfor = {
                        ...this.basicInfor,
                        ...res.data
                    }
                })
            },
            getUnitList() {
                this.$http.httpGet('/allocation/unit').then(res => {
                    this.unitList = res.data
pages/index/index.vue
@@ -27,18 +27,20 @@
            myInfor,
            tabBar
        },
        onLoad(option) {},
        async onLoad() {
            await this.$onLaunched
            this.getData()
        },
        onReady() {},
        onShow() {
            this.currIndex = '0'
            this.showTabBar = true
        },
        async mounted() {
        mounted() {
            //等待登录成功
            await this.$onLaunched
            this.token = uni.getStorageSync('tonken')
            console.log('已经进了index页面了', this.token)
            this.loading = false
            this.getData()
            uni.$on('currIndex', data => {
                console.log('currIndexOn', data)
                this.currIndex = data.data.index
@@ -49,6 +51,7 @@
        },
        methods: {
            getData() {
                console.log('获取数据')
                this.$refs.agencyPage.getContaminateList()
            },
            handleChangeTabe(index) {