about.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. //本页面由uniapp切片工具生成,uni-app切片-可视化设计工具(一套代码编译到7个平台iOS、Android、H5、小程序),软件下载地址:http://www.ymznkf.com/new_view_669.htm
  2. import app from "../../App.vue"
  3. // 定义全局参数,控制数据加载
  4. var _self, page = 1,timer = null;
  5. export default {
  6. data() {
  7. return {
  8. loadingText: '',
  9. page:0,//当前分页页码
  10. apiUrl:'',//后端接口地址
  11. id:'',//传值使用,方便存在本地的locakStorage
  12. del_id:''//方便存在本地的locakStorage
  13. }
  14. },
  15. components:{
  16. },
  17. onLoad(options) {
  18. _self = this;
  19. //检查是否登录参考代码,需要用的时候,可以把注释取掉
  20. //if(this.checkLogin()==false){
  21. // return;
  22. //}
  23. //this.getLaction();//得到gps
  24. this.page=0;
  25. //检测有没有传入id参数
  26. if (options.id != null && options.id !=""){
  27. this.id=options.id;
  28. }
  29. //执行初始化,需要用的时候,可以把注释取掉
  30. //this.Refresh("init");
  31. },
  32. onShow() {
  33. console.log("on show");
  34. //if(this.checkLogin()==false){
  35. // return;
  36. //}
  37. //执行初始化,需要用的时候,可以把注释取掉
  38. //this.Refresh("init");
  39. },
  40. onPullDownRefresh: function() {
  41. //下拉刷新的时候请求一次数据
  42. this.Refresh();
  43. },
  44. methods: {
  45. /**
  46. * about_15_15处理函数
  47. * 数据绑定 data-index="{{index}}"
  48. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  49. */
  50. about_15_15_click:function(event){
  51. },
  52. /**
  53. * about_22_22处理函数
  54. * 数据绑定 data-index="{{index}}"
  55. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  56. */
  57. about_22_22_click:function(event){
  58. },
  59. /**
  60. * about_42_42处理函数
  61. * 数据绑定 data-index="{{index}}"
  62. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  63. */
  64. about_42_42_click:function(event){
  65. },
  66. /**
  67. * btCopy_46处理函数
  68. * 数据绑定 data-index="{{index}}"
  69. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  70. */
  71. btCopy_46_click:function(event){
  72. },
  73. /**
  74. * about_47_47处理函数
  75. * 数据绑定 data-index="{{index}}"
  76. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  77. */
  78. about_47_47_click:function(event){
  79. },
  80. /**
  81. * about_51_51处理函数
  82. * 数据绑定 data-index="{{index}}"
  83. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  84. */
  85. about_51_51_click:function(event){
  86. },
  87. /**
  88. * about_55_55处理函数
  89. * 数据绑定 data-index="{{index}}"
  90. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  91. */
  92. about_55_55_click:function(event){
  93. },
  94. /**
  95. * about_59_59处理函数
  96. * 数据绑定 data-index="{{index}}"
  97. * 数据取值 var index = e.currentTarget.dataset.index; var cata = this.list_cata_list[index];
  98. */
  99. about_59_59_click:function(event){
  100. },
  101. //刷新数据
  102. Refresh:function(_action) {
  103. uni.showLoading();
  104. //提交到服务器
  105. var that = this
  106. var url=that.apiUrl+'{server_code_file_path}';
  107. console.log(url);
  108. uni.request({
  109. url: url,//后端接口地址,需要改成自己的接口地址
  110. data: {
  111. action: _action,//上传动作,如按钮点击会产生click动作,分页也会产生,在后端根据具体的动作来判断事件
  112. uid: that.getUid(),//上传用户id,在登录中获得
  113. //上传页面中的变量
  114. //定义变量---start
  115. //定义变量---end
  116. id: that.id,//上传id值,后端可以根据此值来操作当前id
  117. del_id: that.del_id,//在列表中删除按钮选中时,上传到有后端,进行删除操作
  118. page:that.page
  119. },
  120. method: 'GET',
  121. success: function (res) {//后端返回数据
  122. // 隐藏导航栏加载框
  123. uni.hideNavigationBarLoading();
  124. // 停止下拉动作
  125. uni.stopPullDownRefresh();
  126. // 隐藏加载框
  127. uni.hideLoading();
  128. var tmp = res.data;
  129. //初始化,对页面上的控件进行赋值操作
  130. if(_action=="init"){
  131. }
  132. {deal_listpages}
  133. //如果后端有返回消息,则弹出消息提示
  134. if (tmp.message != null && tmp.message != "") {
  135. uni.showToast({
  136. title: tmp.message,
  137. icon: 'none',
  138. duration: 2000
  139. })
  140. }
  141. //如果后端有返回页码,则更改当前页码
  142. if(tmp.page!=null && tmp.page!=""){
  143. page=tmp.page;
  144. }
  145. },
  146. fail: function (res) {
  147. uni.showToast({
  148. title: "服务器访问失败",
  149. icon: 'none',
  150. duration: 2000
  151. })
  152. console.log(res.data);
  153. console.log('is failed')
  154. }
  155. })
  156. },
  157. }
  158. }