// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {
    // 登录
    let LoginApp = (params = {}) => vm.$u.post('api/Token/LoginApp', params)
    // 注册
    let RegisterUser = (params = {}) => vm.$u.post('api/Token/RegisterUser', params);
    // 基础资料以及保存用户头像
    let saveUserInfo = (params = {}) => vm.$u.post('app/User/UploadingFormFileHead', params);
    // 更新用户定位信息
    let upPosition = (params = {}) => vm.$u.post('app/Position/InsertPosition', params);
    // 获取用户当前定位信息
    let getPosition = (params = {}) => vm.$u.get('app/Position/GetPositionByUser', {
        userId: vm.vuex_user.id
    });
    // 获取所有学校
    let GetAllSchool = (params = {}) => vm.$u.get('app/User/GetSchoolList', params);
    //获取首页地图信息
    let HomeMap = (params = {}) => vm.$u.get('/app/User/HomeMap', params);
    //修改密码
    let ChangePassword = (params = {}) => vm.$u.post('app/User/ChangePassword', params);
    //修改密码
    let myChangePassword = (params = {}) => vm.$u.post('app/My/ChangePassword', params);
    // 获取搜索页面相关信息
    let SearchInfo = (params = {}) => vm.$u.get('app/User/SearchRelevant', params);
    //获取搜索结果页面
    let getSearch = (params = {}) => vm.$u.get('app/User/GetSearchList', params);
    // 获取用户信息
    let getUserInfo = (params = {}) => vm.$u.get('app/User/HomePage', params);
    // 获取校友帮帮列表
    let GetHelpList = (params = {}) => vm.$u.get('app/HelpArticle/GetHelpArticleListByKey', params);
    // 获取学校资讯
    let GetSchoolList = (params = {}) => vm.$u.get('app/AlumnRange/AlumnRangeSchool', params);
    //获取最新的用户信息（更新用户数据）
    let getUser = (params = {}) => vm.$u.get('app/User/GetUser', {userId: vm.vuex_user.id}).then(res => {
        vm.$u.get('/app/User/GetUserSchool').then(ress => {
            // res.isAttestationGLY = ress.isAttestationGLY
            // res.isAttestationJZG = ress.isAttestationJZG
            // res.isAttestationQY = ress.isAttestationQY
            // res.isAttestationXY = res.isAttestationXY
            // res.isAttestationZXS = ress.isAttestationZXS
            res.schoolId = ress.items.schoolId
            vm.$u.vuex('vuex_user', {...res.user,...res.userExtension})
            vm.$u.vuex('vuex_user_hobby', res.lableList)
        })
    })
    //获取用户消息列表
    let getcharList = (params = {}) => vm.$u.get('app/Chat/GetUserMessageList', params);
    //获取用户获取关注列表
    let getFollowList = (params = {}) => vm.$u.get('app/Chat/GetFollowList', {id: vm.vuex_user.id});
    //	获取系统消息列表
    let getSysList = (params = {}) => vm.$u.get('app/Chat/GetSystemMessageList', {id: vm.vuex_user.id});
    //获取管理消息列表
    let getAdminList = (params = {}) => vm.$u.get('app/Chat/GetManageMessageList', {schoolId: vm.vuex_user.id});
    //获取互动信息列表
    let getinteractionList = (params) => vm.$u.get('app/Chat/GetInterMessageList', {id: vm.vuex_user.id, type: params});
    //校友找找推荐列表
    let getAlumnSearch = (params = {}) => vm.$u.get('app/AlumnRange/AlumnSearch', params);
    //获取聊天记录
    let getChatRecord = (params = {}) => vm.$u.get('app/Chat/GetChatRecord', params);
    //校友找找列表
    let AlumnSearchList = (params = {}) => vm.$u.get('app/AlumnRange/AlumnSearchList', params);
    // 初始化的数据调用微信接口返回参数
    let GetInfoMation = (params = {}) => vm.$u.get('api/Token/GetInfoMation', params);
    // 回复绑定
    let toBind = (params = {}) => vm.$u.get('app/Chat/ReplyBind', params);
    //我的资讯
    let MyAlumnRange = (params = {}) => vm.$u.get('app/My/MyAlumnRange', params);
    // 解除绑定
    let colseBind = (params = {}) => vm.$u.get('app/Chat/UnbindReply', params);
    // 删除评论
    let DelateComment = (params = {}) => vm.$u.get('app/AlumnRange/DelateComment', params);
    let userVerify = (params = {}) => vm.$u.post('api/Token/IsIdentityCard', params)

    // 获取人脸验证token
    let getAPIToken = (params = {}) => vm.$u.post('app/My/GetVerifyToken', params)
    // 查询人脸核验结果
    let getVerifyInfo = (params = {}) => vm.$u.post('app/My/GetDetailInfo?VerifyToken=' + params)
    // 根据身份证获取信息
    let getInfoByCard = (params = {}) => vm.$u.get('app/User/GetCardByPreConfiguredUser', params);
    // 更新身份信息
    let updateCard = (params = {}) => vm.$u.post('api/Token/UpdateCard', params)

    //【手机端】添加心愿
    let PushWishDan = (params = {}) => vm.$u.post("app/My/PushWishDan", params)

    //【手机端】获取个人心愿列表
    let GetWishListAsync_mobile = (params = {}) => vm.$u.get("app/My/GetWishListAsync_mobile", params)
    //【手机端】删除心愿 删除=失效
    let DeleteWish = (params = {}) => vm.$u.post("app/My/DeleteWish", params)
    //【管理端】获取当前是否开启匿名 开启true 关闭false
    let CheckNM = (params = {}) => vm.$u.get("/app/My/CheckNM", params)

    /** 首页ai对话 */
    // 发送消息
    let SendMessageApi = (params = {}) => vm.$u.post('api/ChatAI/CreateChat', params);

    /** 登录 */
    // 获取图形验证码
    let GetCaptcha = (params = {}) => vm.$u.get('api/Login/GetCaptcha', params);
    // 发送验证码
    let GetStuVerifyCode = (params = {}) => vm.$u.post('api/Login/GetSMSCodeAccountRegister', params);
    // 学生登录
    let StuLogin = (params = {}) => vm.$u.post('api/Login/PhoneLoginExpertUser', params);

    // 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
    vm.$u.api = {
        LoginApp,
        RegisterUser,
        saveUserInfo,
        upPosition,
        getPosition,
        GetAllSchool,
        HomeMap,
        ChangePassword,
        myChangePassword,
        SearchInfo,
        getSearch,
        getUserInfo,
        GetHelpList,
        GetSchoolList,
        getUser,
        getcharList,
        getFollowList,
        getSysList,
        getAdminList,
        getinteractionList,
        getAlumnSearch,
        getChatRecord,
        AlumnSearchList,
        GetInfoMation,
        toBind,
        colseBind,
        MyAlumnRange,
        DelateComment,
        userVerify,
        GetWishListAsync_mobile,
        DeleteWish,
        CheckNM,
        PushWishDan,
        getAPIToken,
        getVerifyInfo,
        getInfoByCard,
        updateCard,
        SendMessageApi,
        GetCaptcha,
        GetStuVerifyCode,
        StuLogin
    };
}

export default {
    install
}
