智慧保安互联网APP
shuishen
2021-08-13 6548740526019d0ae9a8b6282d27ff955c4019ab
配置文件修改
4 files modified
1 files added
151 ■■■■■ changed files
manifest.json 4 ●●● patch | view | raw | blame | history
pages.json 2 ●●● patch | view | raw | blame | history
pages/map/map.vue 4 ●●●● patch | view | raw | blame | history
store/actions.js 25 ●●●●● patch | view | raw | blame | history
store/actions1.js 116 ●●●●● patch | view | raw | blame | history
manifest.json
@@ -56,9 +56,7 @@
            "ios" : {},
            /* SDK配置 */
            "sdkConfigs" : {
                "ad" : {
                    "360" : {}
                }
                "ad" : {}
            },
            "icons" : {
                "android" : {
pages.json
@@ -58,7 +58,7 @@
        {
            "path": "pages/talking/talking",
            "style": {
                "navigationBarTitleText": "好友",
                "navigationBarTitleText": "聊天",
                "enablePullDownRefresh": false,
                "navigationStyle": "custom"
            }
pages/map/map.vue
@@ -16,8 +16,8 @@
        mounted() {},
        onLoad: function(options) {
            
            // this.urls = "http://web.byisf.com/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
            this.urls = "http://127.0.0.1:5500/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
            this.urls = "http://web.byisf.com/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
            // this.urls = "http://127.0.0.1:5500/mapWz/xcxmap.html?id="+ this.$store.state.UserData.jurisdiction + "&userid="+ this.$store.state.UserData.role_id;
            
        },
    }
store/actions.js
@@ -1,9 +1,11 @@
import md5 from 'js-md5'
import axios from 'axios'
const geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
const getLocationData = (userId) => {
    var geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
    var positionNum = 0;
    var options = {
        timeout: 8000
@@ -15,13 +17,18 @@
        var city = position.city; //城市
        var addr = position.addr; //详细地址
        axios.post("http://223.82.109.183:2080/api/liveLocation/saveLiveLocationAndLocus", {
            type: 1,
            workerId: userId,
            longitude: position.lng,
            latitude: position.lat,
            location: addr == '' ? position.province + position.city : position.province + position.city +
                addr
        wx.request({
            url: "http://223.82.109.183:2080/api/liveLocation/saveLiveLocationAndLocus",
            method: "post",
            data: {
                type: 1,
                workerId: userId,
                longitude: position.lng,
                latitude: position.lat,
                location: addr == '' ? position.province + position.city : position.province + position
                    .city +
                    addr
            }
        }).then((res) => {
        })
@@ -145,7 +152,7 @@
        // }, 2000)
    }
}
export default actions
store/actions1.js
New file
@@ -0,0 +1,116 @@
import md5 from 'js-md5'
import axios from 'axios'
const actions = {
    loging(store, data) {
        var user = [{
                    name: '1',
                    password: '111111'
                },
                {
                    name: '2',
                    password: '222222'
                },
                {
                    name: '3',
                    password: '333333'
                },
            ],
            pasw = md5(data.pass),
            // url = 'http://223.82.109.183:2080/api/blade-auth/oauth/token?tenantId=000000&username=' + data.name +
            url = store.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name +
            ' &password=' + pasw + '&grant_type=password&scope=all&type=account';
        // url ='http://192.168.0.109:82/blade-auth/oauth/token';
        // url ='http://192.168.0.109:82/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password';
        // url ='http://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password&scope=all';
        console.log(store.state.piAPI);
        wx.request({ //uniapp 自带axios
            url: url, //仅为示例,并非真实接口地址。
            // data: d,
            // data: {
            //     tenantId: '000000',
            //     username: data.name,
            //     password: pasw,
            //     grant_type: 'password',
            //     scope: 'all',
            //     type: "account"
            // },
            header: {
                // "Content-Type":"",
                "Authorization": "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
                "Tenant-Id": "963841"
                // "Cookie": "JSESSIONID=maOJY05vT2jj4nHwsQGSPgWWVFH1mY-TGWOLYCSh"
            },
            method: "post",
            //     // dataType: 'JSON',
            success: (res) => {
                if (res.statusCode == 200) {
                    console.log(res)
                    if (res.data.error_code == "400") {
                        uni.showToast({
                            title: '密码错误,请重试',
                            icon: 'none',
                            duration: 2000
                        });
                        return;
                    }
                    store.commit('getUserData', res.data)
                    // console.log(res.data,123542);
                    data.isit = true;
                    data.userName = res.data.nick_name; //警袁姓名
                    data.userID = res.data.user_id; //警袁id
                    data.avatar = res.data.avatar; //头像
                    data.accounts = data.name;
                    data.pass = data.pass;
                    // data.userPhon = res.user_id;
                    uni.getLocation({
                        type: 'wgs84',
                        geocode: true,
                        success: (res) => {
                            console.log(res, 3333)
                        }
                    })
                    uni.request({
                        url: "http://223.82.109.183:2080/api/blade-system/dept/detail?id=" + res
                            .data.dept_id,
                        method: "get",
                        data: {
                        },
                        success: (result) => {
                            data.deptName = result.data.data.deptName
                            res.data.deptName = result.data.data.deptName
                            store.commit('login', data);
                            uni.$u.func.login(res.data)
                        }
                    });
                }
            },
            fail: (res) => {
                console.log('失去连接 请稍等');
                // console.log(res);
            }
        });
        // var time = setTimeout(() => { //模拟请求时间
        //     var ud = user,
        //         isit = false;
        //     for (var key in ud) {
        //         if (ud[key].name == data.name && ud[key].password == data.pass) {
        //             isit = true;
        //             break;
        //         } else {
        //             isit = false;
        //         }
        //     }
        //     data.isit = isit;
        //     store.commit('login', data);
        // }, 2000)
    }
}
export default actions