<template>
    <view>
        <web-view :src="src" type="im"></web-view>
    </view>
</template>

<script>
// pages/im/im.js
export default {
    data() {
        return {
            src: 'https://im6a9eefe.7x24cc.com/phone_webChat.html?accountId=N000000023246&chatId=f0173462-64df-4e07-8862-6aa340addf5d',
            userId: '',
            nickName: '在线客服',
            openId: ''
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {
        let userInfo = uni.getStorageSync('userInfo');
        if (userInfo) {
            this.setData({
                nickName: userInfo.nickName,
                userId: userInfo.id,
                openId: userInfo.openId
            });
        }
        var businessParam = '&businessParam=openId:' + this.openId;
        this.setData({
            src: this.src + '&nickName=' + encodeURI(this.nickName) + businessParam
        });
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {}
};
</script>
<style>
/* pages/im/im.wxss */
</style>
