cooperation.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. IsInput: true,
  7. Name: "",
  8. Contact: "",
  9. ChannelID: 0,
  10. },
  11. onLoad: function (options) {
  12. this.setData({
  13. IsInput: true,
  14. Name: "",
  15. Contact: "",
  16. AppID: app.globalData.AppID,
  17. Height: common.getSystemHeight(),
  18. });
  19. },
  20. bindKeyInput1: function (e) {
  21. this.setData({
  22. Name: e.detail.value
  23. })
  24. },
  25. bindKeyInput2: function (e) {
  26. this.setData({
  27. Contact: e.detail.value
  28. })
  29. },
  30. save: function () {
  31. if (this.data.Name.length > 0 && this.data.Contact.length > 0) {
  32. var that = this;
  33. server.getData('AddChannel?Name='
  34. + this.data.Name + '&Contact='
  35. + this.data.Contact + '&ProgramID='
  36. + app.globalData.ProgramID + '&UserID='
  37. + app.globalData.userInfo.UserID, function (data) {
  38. if (data) {
  39. that.setData({
  40. IsInput: false,
  41. ChannelID: data.insertId,
  42. });
  43. }
  44. });
  45. }
  46. else {
  47. wx.showToast({
  48. title: '请输入有效信息',
  49. icon: 'success',
  50. duration: 2000
  51. })
  52. }
  53. },
  54. setClipboardData: function () {
  55. wx.setClipboardData({
  56. data: '小程序AppID:' + app.globalData.AppID+' 小程序启动Path:pages/index/index?SourceID=' + this.data.ChannelID,
  57. success: function (res) {
  58. wx.getClipboardData({
  59. success: function (res) {
  60. wx.showToast({
  61. title: '存入剪贴板',
  62. icon: 'success',
  63. duration: 2000
  64. })
  65. }
  66. })
  67. }
  68. })
  69. },
  70. onShareAppMessage: function () {
  71. return {
  72. title: app.globalData.ShareTitle,
  73. path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
  74. imageUrl: '../../images/07001.png',
  75. }
  76. },
  77. });