share.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. var app = getApp();
  2. var network = require('./network.js')
  3. function share(newsname, Thepath,newsid, typevalue){
  4. if (!typevalue) {
  5. typevalue = 1
  6. }
  7. var _this = this;
  8. var params = new Object()
  9. params.uid = app.getUid()
  10. params.session = app.getSession()
  11. params.type = typevalue
  12. params.id = newsid
  13. params.status = 1
  14. params.content = newsname
  15. console.log(params)
  16. //发起请求
  17. network.GET(
  18. {
  19. turl: 'share.submit',
  20. params: params,
  21. success: function (res) {
  22. },
  23. fail: function () {
  24. //失败后的逻辑
  25. },
  26. })
  27. return {
  28. title: newsname,
  29. path: Thepath + newsid + '&share_uid=' + app.getUid() + '&share_id=' + newsid + '&share_table=' + typevalue,
  30. success: function (res) {
  31. var params = new Object()
  32. params.uid = app.getUid()
  33. params.session = app.getSession()
  34. params.type = typevalue
  35. params.id = newsid
  36. params.status = 2
  37. params.content = newsname
  38. console.log(params)
  39. //发起请求
  40. network.GET(
  41. {
  42. turl: 'share.submit',
  43. params: params,
  44. success: function (res) {
  45. },
  46. fail: function () {
  47. //失败后的逻辑
  48. },
  49. })
  50. },
  51. fail: function () {
  52. //失败后的逻辑
  53. var params = new Object()
  54. params.uid = app.getUid()
  55. params.session = app.getSession()
  56. params.type = 1
  57. params.id = newsid
  58. params.status = 3
  59. params.content = newsname
  60. //发起请求
  61. network.GET(
  62. {
  63. turl: 'share.submit',
  64. params: params,
  65. success: function (res) {
  66. },
  67. fail: function () {
  68. //失败后的逻辑
  69. },
  70. })
  71. },
  72. }
  73. }
  74. module.exports = {
  75. share: share,
  76. }