list.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. const app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. list: [],
  8. no_more: false,
  9. page: 1,
  10. mobile: '',
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad(options) {
  16. this.getMobile();
  17. },
  18. onShow() {
  19. this.resetParam();
  20. this.getList();
  21. },
  22. getMobile() {
  23. let self = this;
  24. //获取数据
  25. app.get('talent/appointment/getAdminMobile',function(res){
  26. self.setData({mobile:res.mobile});
  27. })
  28. },
  29. //获取数据
  30. getList() {
  31. let self = this;
  32. //没有下一页
  33. if (this.data.no_more) {
  34. return false;
  35. }
  36. //获取数据
  37. app.post('talent/appointment/lists',{
  38. page:self.data.page,
  39. keyword:self.data.keyword,
  40. },function(res){
  41. if (res.length < 10) {
  42. self.setData({no_more:true});
  43. }
  44. let list = self.data.list;
  45. list = list.concat(res);
  46. let page = self.data.page;
  47. page++;
  48. self.setData({list:list,page:page});
  49. })
  50. },
  51. //重置参数
  52. resetParam() {
  53. this.setData({list:[],no_more:false,page:1});
  54. },
  55. /**
  56. * 页面相关事件处理函数--监听用户下拉动作
  57. */
  58. onPullDownRefresh: function () {
  59. this.resetParam();
  60. this.getList();
  61. wx.stopPullDownRefresh();
  62. },
  63. /**
  64. * 页面上拉触底事件的处理函数
  65. */
  66. onReachBottom: function () {
  67. this.getList();
  68. },
  69. toIndex() {
  70. wx.redirectTo({
  71. url: '/pages/talent/appointment/index',
  72. })
  73. },
  74. ViewImage(e) {
  75. wx.previewImage({
  76. urls: [e.currentTarget.dataset.url],
  77. });
  78. },
  79. showQrcode:function(e){
  80. let code = e.target.dataset.code;
  81. wx.previewImage({
  82. current: 0, // 当前显示图片的http链接
  83. urls: [app.globalData.http_host + 'qrcode.php?code=' + code] // 需要预览的图片http链接列表
  84. })
  85. },
  86. //拔打电话
  87. callMobile(e){
  88. let mobile = this.data.mobile;
  89. if (mobile == '') {
  90. app.msg('暂无联系方式!');
  91. return false;
  92. }
  93. wx.makePhoneCall({
  94. phoneNumber: mobile
  95. })
  96. },
  97. toEva(e) {
  98. let id = e.currentTarget.dataset.id;
  99. wx.navigateTo({
  100. url: '/pages/talent/appointment/evaluate?id=' + id,
  101. })
  102. }
  103. })