index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. // index.js
  2. // 获取应用实例
  3. import http from '../../base/httputil'
  4. const app = getApp()
  5. Page({
  6. data: {
  7. host: app.globalData.host,
  8. current: 0, //当前所在页面的 index
  9. indicatorDots: true, //是否显示面板指示点
  10. autoplay: true, //是否自动切换
  11. interval: 3000, //自动切换时间间隔
  12. duration: 800, //滑动动画时长
  13. circular: true, //是否采用衔接滑动
  14. imgUrls: [
  15. // '../images/banner.jpg',
  16. // '../images/banner3.jpg',
  17. // '../images/banner2.jpg'
  18. ],
  19. links: [
  20. // '/pages/second/register',
  21. // '/pages/second/register',
  22. // '/pages/second/register'
  23. ],
  24. //功能数据-孙一石
  25. //记录首页点击-登录后继续跳转
  26. dofun: null,
  27. xunjianImgCount: '000,000',
  28. NoticeTitle: "登录查看公告"
  29. },
  30. onLoad() {
  31. this.setData({
  32. imgUrls: [
  33. this.data.host + '/images/banner.jpg',
  34. this.data.host + '/images/banner3.jpg',
  35. this.data.host + '/images/banner2.jpg'
  36. ]
  37. })
  38. },
  39. onShow() {
  40. // if (app.globalToken == null) {
  41. // wx.showToast({
  42. // title: '尚未登录,登录后即可使用',
  43. // icon: 'none'
  44. // })
  45. // }
  46. this.initIndexPage();
  47. },
  48. // 待办跳转
  49. bindViewDaiBan() {
  50. // wx.navigateTo({
  51. // url: '../daiban/daiban'
  52. // })
  53. },
  54. // 企业跳转
  55. bindViewQiYe() {
  56. wx.navigateTo({
  57. url: '../qiye/qiye'
  58. })
  59. },
  60. // 巡查跳转
  61. bindViewXunCha() {
  62. wx.navigateTo({
  63. url: '../xuncha/xuncha'
  64. })
  65. },
  66. // 通知公告更多跳转
  67. bindViewGengDuo() {
  68. wx.navigateTo({
  69. url: '../notice/notice'
  70. })
  71. },
  72. //物资跳转
  73. bindViewWuZi() {
  74. wx.navigateTo({
  75. url: '../material/material',
  76. })
  77. },
  78. //队伍跳转
  79. bindViewDuiWu() {
  80. wx.navigateTo({
  81. url: '../teamlist/teamlist',
  82. })
  83. },
  84. //仓库跳转
  85. bindViewCangKu() {
  86. wx.navigateTo({
  87. url: '../warehouselist/warehouselist',
  88. })
  89. },
  90. // 新手指南跳转
  91. bindViewNewComer() {
  92. wx.navigateTo({
  93. url: '../newcomer/newcomer',
  94. })
  95. },
  96. //巡检跳转
  97. bindViewXunJian() {
  98. // wx.navigateTo({
  99. // url: '../xunjian/xunjian',
  100. // })
  101. },
  102. // 使用攻略跳转
  103. bindViewIntroduction() {
  104. wx.navigateTo({
  105. url: '../Introduction/Introduction'
  106. })
  107. },
  108. bindViewXunjianimg() {
  109. wx.navigateTo({
  110. url: '../xunjianimg/xunjianimg'
  111. })
  112. },
  113. // 图片轮播
  114. //轮播图的切换事件
  115. swiperChange: function (e) {
  116. this.setData({
  117. swiperCurrent: e.detail.current
  118. })
  119. },
  120. //点击指示点切换
  121. chuangEvent: function (e) {
  122. this.setData({
  123. swiperCurrent: e.currentTarget.id
  124. })
  125. },
  126. //点击图片触发事件
  127. swipclick: function (e) {
  128. // console.log(this.data.swiperCurrent);
  129. wx.switchTab({
  130. // url: this.data.links[this.data.swiperCurrent]
  131. })
  132. },
  133. //首页功能js-孙一石
  134. init_userInfo(e) {
  135. this.data.dofun = e.currentTarget.dataset.fun
  136. // let that = this
  137. // if (app.globalToken == null) {
  138. // http.showLoading()
  139. // wx.getUserProfile({
  140. // desc: 'desc',
  141. // success: (res) => {
  142. // this.getSysUserInfo(res.userInfo)
  143. // },
  144. // fail: res => {
  145. // console.log(res)
  146. // },
  147. // })
  148. // } else {
  149. this.callByName(this.data.dofun)
  150. // }
  151. },
  152. callByName(name) {
  153. if (name == "bindViewDaiBan") {
  154. //待办
  155. this.bindViewDaiBan()
  156. } else if (name == "bindViewQiYe") {
  157. //企业
  158. this.bindViewQiYe()
  159. } else if (name == "bindViewXunCha") {
  160. this.bindViewXunCha()
  161. } else if (name == "bindViewXunjianimg") {
  162. this.bindViewXunjianimg()
  163. } else if (name == "bindViewGengDuo") {
  164. this.bindViewGengDuo()
  165. } else if (name == "bindViewWuZi") {
  166. this.bindViewWuZi()
  167. } else if (name == "bindViewDuiWu") {
  168. this.bindViewDuiWu()
  169. } else if (name == "bindViewCangKu") {
  170. this.bindViewCangKu()
  171. }
  172. },
  173. initIndexPage() {
  174. if (app.globalToken == null || app.globalToken == '') {
  175. return
  176. }
  177. http.send_post("/system/AppIndexController/getIndexPageData", null, this.initIndexPageSuccess)
  178. },
  179. initIndexPageSuccess(res) {
  180. if (res.code == 200) {
  181. this.setData({
  182. xunjianImgCount: res.data.xunjianImgCount,
  183. })
  184. if (res.data.noticeList.length > 0) {
  185. this.setData({
  186. NoticeTitle: res.data.noticeList[0].noticeTitle
  187. })
  188. } else {
  189. this.setData({
  190. NoticeTitle: "暂无公告"
  191. })
  192. }
  193. }
  194. },
  195. // getSysUserInfo(info) {
  196. // let that = this
  197. // wx.login({
  198. // success(res) {
  199. // var code = res.code
  200. // var data = {
  201. // wxCode: code,
  202. // wxNickName: info.nickName,
  203. // wxAvatarUrl: info.avatarUrl
  204. // }
  205. // // http.send_post_login("/minapp/AppLoginController/appLogin",data)
  206. // http.send_post("/auth/applogin", data, that.loginSuccess)
  207. // },
  208. // fail(res) {
  209. // console.log("ffff", res)
  210. // }
  211. // })
  212. // },
  213. onTabItemTap(item) {
  214. console.log("$$$$$$$", item)
  215. }
  216. })