im.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view>
  3. <web-view :src="src" type="im"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. // pages/im/im.js
  8. export default {
  9. data() {
  10. return {
  11. src: 'https://im6a9eefe.7x24cc.com/phone_webChat.html?accountId=N000000023246&chatId=f0173462-64df-4e07-8862-6aa340addf5d',
  12. userId: '',
  13. nickName: '在线客服',
  14. openId: ''
  15. };
  16. }
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */,
  20. onLoad: function (options) {
  21. let userInfo = uni.getStorageSync('userInfo');
  22. if (userInfo) {
  23. this.setData({
  24. nickName: userInfo.nickName,
  25. userId: userInfo.id,
  26. openId: userInfo.openId
  27. });
  28. }
  29. var businessParam = '&businessParam=openId:' + this.openId;
  30. this.setData({
  31. src: this.src + '&nickName=' + encodeURI(this.nickName) + businessParam
  32. });
  33. },
  34. /**
  35. * 生命周期函数--监听页面初次渲染完成
  36. */
  37. onReady: function () {},
  38. /**
  39. * 生命周期函数--监听页面显示
  40. */
  41. onShow: function () {},
  42. /**
  43. * 生命周期函数--监听页面隐藏
  44. */
  45. onHide: function () {},
  46. /**
  47. * 生命周期函数--监听页面卸载
  48. */
  49. onUnload: function () {},
  50. /**
  51. * 页面相关事件处理函数--监听用户下拉动作
  52. */
  53. onPullDownRefresh: function () {},
  54. /**
  55. * 页面上拉触底事件的处理函数
  56. */
  57. onReachBottom: function () {},
  58. /**
  59. * 用户点击右上角分享
  60. */
  61. onShareAppMessage: function () {},
  62. methods: {}
  63. };
  64. </script>
  65. <style>
  66. /* pages/im/im.wxss */
  67. </style>