cooperation.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. if (common.IsChinese(this.data.Contact)) {
  33. wx.showToast({
  34. title: '请输入有效信息',
  35. icon: 'success',
  36. duration: 2000
  37. })
  38. }
  39. else {
  40. var that = this;
  41. server.getData('AddChannel?Name='
  42. + this.data.Name + '&Contact='
  43. + this.data.Contact + '&ProgramID='
  44. + app.globalData.ProgramID + '&UserID='
  45. + app.globalData.userInfo.UserID, function (data) {
  46. if (data) {
  47. that.setData({
  48. IsInput: false,
  49. ChannelID: data.insertId,
  50. });
  51. }
  52. });
  53. }
  54. }
  55. else {
  56. wx.showToast({
  57. title: '请输入有效信息',
  58. icon: 'success',
  59. duration: 2000
  60. })
  61. }
  62. },
  63. setClipboardData: function () {
  64. wx.setClipboardData({
  65. data: '小程序AppID:' + app.globalData.AppID + ' 小程序启动Path:pages/index/index?SourceID=' + this.data.ChannelID,
  66. success: function (res) {
  67. wx.getClipboardData({
  68. success: function (res) {
  69. wx.showToast({
  70. title: '存入剪贴板',
  71. icon: 'success',
  72. duration: 2000
  73. })
  74. }
  75. })
  76. }
  77. })
  78. },
  79. onShareAppMessage: function () {
  80. return {
  81. title: app.globalData.ShareTitle,
  82. path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
  83. imageUrl: '../../images/07001.png',
  84. }
  85. },
  86. });