quanyawei
2023-11-08 e49e0e98c6776900bc3578ed2fe880bfceeb1c2c
fix:查看详情权限修改
5 files modified
228 ■■■■■ changed files
App.vue 67 ●●●● patch | view | raw | blame | history
pages/actionChange/components/fileUpload.vue 1 ●●●● patch | view | raw | blame | history
pages/actionChange/workOrderDetails/index.vue 13 ●●●● patch | view | raw | blame | history
pages/index/index.vue 2 ●●●●● patch | view | raw | blame | history
utils/request.js 145 ●●●● patch | view | raw | blame | history
App.vue
@@ -9,6 +9,13 @@
        httpGet
    } from '@/utils/http.js'
    export default {
        onShow: function(options) {
            console.log('optionsonShow', options)
            if (options.scene === 1007 || options.scene === 1014 || options.scene === 1008) {
                // 通过单人聊天会话分享进入
                this.getWXCode()
            }
        },
        onLaunch() {
            // 自动登录检测
            let token = uni.getStorageSync('token')
@@ -72,13 +79,59 @@
             *
             */
            getWXCode() {
                let that = this
                uni.login({
                    provider: 'weixin',
                    success(res) {
                        that.getLogin(res.code)
                    }
                })
                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)
                                }
                            }).catch(errors => {
                                console.log('appdddd', errors)
                                uni.showToast({
                                    title: errors,
                                    icon: 'none',
                                })
                                this.$isResolve()
                            })
                        }
                    })
                } else {
                    this.$isResolve()
                }
            },
            getLogin(data) {
                // 调用接口。将登录code传给后端进行判断
pages/actionChange/components/fileUpload.vue
@@ -31,7 +31,6 @@
        },
        created() {
            this.token = uni.getStorageSync('tonken')
            console.log('tonken', this.token)
        },
        computed: {
            uploadTermExcelUrl() {
pages/actionChange/workOrderDetails/index.vue
@@ -58,13 +58,15 @@
            //等待登录成功 
            await this.$onLaunched
            this.userInfor = JSON.parse(uni.getStorageSync('userInfor') || 'null')
            console.log('详情页的用户信息', this.userInfor)
            if (this.option.type === 'share' && this.userInfor) {
                let params = {
                    allocationNum: this.basicInfor.allocationNum,
                    userId: this.userInfor.userId
                }
                this.$http.httpGet('/allocationApp/authority', params).then(res => {
                    if (res.data === 3) {
                    console.log('权限控制参数', res)
                    if (res.data.code === 3) {
                        uni.showModal({
                            content: '您暂无操作权限,请联系管理员!',
                            showCancel: false,
@@ -77,15 +79,20 @@
                                }
                            },
                        })
                    } else if (res.data === 1) {
                    } else if (res.data.code === 1) {
                        // 可以编辑
                        this.basicInfor.pageState = 'edit'
                        this.basicInfor.stateName = res.data.name
                        this.isShow = true
                    } else if (res.data === 2) {
                    } else if (res.data.code === 2) {
                        // 可以看
                        this.isShow = true
                        this.basicInfor.pageState = 'view'
                        this.basicInfor.stateName = res.data.name
                    }
                }).catch(errors => {
                    console.log('获取失败的信息', errors)
                    console.log('获取失败的信息params', params)
                })
            } else {
                this.isShow = true
pages/index/index.vue
@@ -37,7 +37,6 @@
            //等待登录成功
            await this.$onLaunched
            this.token = uni.getStorageSync('tonken')
            console.log('indextoken', this.token)
            this.loading = false
            this.getData()
            uni.$on('currIndex', data => {
@@ -50,7 +49,6 @@
        },
        methods: {
            getData() {
                console.log('indextokengetContaminateList')
                this.$refs.agencyPage.getContaminateList()
            },
            handleChangeTabe(index) {
utils/request.js
@@ -1,76 +1,77 @@
import storage from './storage' // 缓存封装
import store from '../store/index.js'
export default {
    console(options) {
        if (config.debug) {
            console.log('<<===============================================>>')
            // console.log("request start");
            // console.log("header" + JSON.stringify(options.header));
            // console.log("method: " + options.method + " URL: " + options.url);
            // console.log(options.data);
            // console.log("request end");
            // console.log("<<===============================================>>");
        }
    },
    domain() {
        return config.uni_app_web_api_url.replace('api', '')
    },
    send(options = {}, isLogin = true) {
        const baseUrl = process.uniEnv.baseUrl
        storage.set('baseUrl', baseUrl)
        // loading加载
        uni.showLoading({ title: '加载中', })
        // 拼接路劲,下面的配置文件会提到
        // uni.showLoading({ title: baseUrl, })
        options.url = baseUrl + '' + options.url
        // 请求方式
        options.method = options.method || 'GET'
        // 判断登录是否
        if (isLogin) {
            let token = uni.getStorageSync('tonken')
            console.log('token', token)
            if (token !== null) {
                // options.header["token"] = token;
                options.header = {
                    token: token,
                    Authorization: token,
                }
            }
        }
        // this.console(options); // 打印请求数据,调试用,上线可以注释
        // 发起Promise请求
        return new Promise((resolve, reject) => {
            uni.request(options).then(data => {
                var [error, res] = data
                if (error !== null) {
                    reject(error)
                } else {
                    // 相应拦截、根据后端的状态码来写,可以自行判断和封装
                    if (res.data.code === 0) {
                        uni.hideLoading()
                        // uni.navigateTo({
                        //   url: "/pages/Login/login/login",
                        // });
                        resolve(res.data)
                    } else {
                        uni.hideLoading()
                        reject(res.data.message)
                    }
                }
            })
        })
    },
    get(url = '', data = {}, isLogin = true) {
        return this.send({
            url: url,
            data: data,
        }, isLogin)
    },
    post(url = '', data = {}, isLogin = true) {
        return this.send({
            url: url,
            data: data,
            method: 'POST',
        }, isLogin)
    },
    console(options) {
        if (config.debug) {
            console.log('<<===============================================>>')
            // console.log("request start");
            // console.log("header" + JSON.stringify(options.header));
            // console.log("method: " + options.method + " URL: " + options.url);
            // console.log(options.data);
            // console.log("request end");
            // console.log("<<===============================================>>");
        }
    },
    domain() {
        return config.uni_app_web_api_url.replace('api', '')
    },
    send(options = {}, isLogin = true) {
        const baseUrl = process.uniEnv.baseUrl
        storage.set('baseUrl', baseUrl)
        // loading加载
        uni.showLoading({
            title: '加载中',
        })
        // 拼接路劲,下面的配置文件会提到
        // uni.showLoading({ title: baseUrl, })
        options.url = baseUrl + '' + options.url
        // 请求方式
        options.method = options.method || 'GET'
        // 判断登录是否
        if (isLogin) {
            let token = uni.getStorageSync('tonken')
            if (token !== null) {
                // options.header["token"] = token;
                options.header = {
                    token: token,
                    Authorization: token,
                }
            }
        }
        // this.console(options); // 打印请求数据,调试用,上线可以注释
        // 发起Promise请求
        return new Promise((resolve, reject) => {
            uni.request(options).then(data => {
                var [error, res] = data
                if (error !== null) {
                    reject(error)
                } else {
                    // 相应拦截、根据后端的状态码来写,可以自行判断和封装
                    if (res.data.code === 0) {
                        uni.hideLoading()
                        // uni.navigateTo({
                        //   url: "/pages/Login/login/login",
                        // });
                        resolve(res.data)
                    } else {
                        uni.hideLoading()
                        reject(res.data.message)
                    }
                }
            })
        })
    },
    get(url = '', data = {}, isLogin = true) {
        return this.send({
            url: url,
            data: data,
        }, isLogin)
    },
    post(url = '', data = {}, isLogin = true) {
        return this.send({
            url: url,
            data: data,
            method: 'POST',
        }, isLogin)
    },
}