const config = require("../../utils/config.js");

Page({
  /**
   * 页面的初始数据
   */
  data: {
    webview: 1,
    onshare: "",
    btnshare: true
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var res_id = options.id; //量表id
    var onShare = options.share; //聊天过来为0
    var t_openid = options.t_openid; //咨询师ID
    var src = '';
    if (onShare != 0) {
      var otype = 1;
      src = config.HOST_xinli + '/word.php/Result/self_action?viewToWord=3&res_id=' + res_id + '&type=' + otype + '&t_openid=' + t_openid;
    } else {
      var otype = 0;
      src = config.HOST_xinli + '/word.php/Result/self_action?viewToWord=3&res_id=' + res_id + '&type=' + otype + '&t_openid=' + t_openid;
    }
    var lbname = options.lbname;
    this.setData({
      src: src,
      res_id: res_id,
      lbname: lbname,
      onShare: onShare
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    let that = this;
    return {
      title: that.data.lbname,
      imageUrl: config.HOST + 'Public/yanzheng/zf.png',
      path: '/packageB/webview/webview?id=' + that.data.res_id + '&otype=1&t_openid=0',
      success: function (res) {}
    }
  },
})