index.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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. let token = wx.getStorageSync('access_token')
  41. if (token == '' || token == null) {
  42. app.globalToken = null
  43. wx.showToast({
  44. title: '尚未登录,登录后即可使用',
  45. icon: 'none'
  46. })
  47. }
  48. this.initIndexPage();
  49. },
  50. // 待办跳转
  51. bindViewDaiBan() {
  52. // wx.navigateTo({
  53. // url: '../daiban/daiban'
  54. // })
  55. },
  56. // 企业跳转
  57. bindViewQiYe() {
  58. wx.navigateTo({
  59. url: '../qiye/qiye'
  60. })
  61. },
  62. // 巡查跳转
  63. bindViewXunCha() {
  64. wx.navigateTo({
  65. url: '../xuncha/xuncha'
  66. })
  67. },
  68. // 通知公告更多跳转
  69. bindViewGengDuo() {
  70. wx.navigateTo({
  71. url: '../notice/notice'
  72. })
  73. },
  74. //物资跳转
  75. bindViewWuZi() {
  76. wx.navigateTo({
  77. url: '../material/material',
  78. })
  79. },
  80. //队伍跳转
  81. bindViewDuiWu() {
  82. wx.navigateTo({
  83. url: '../teamlist/teamlist',
  84. })
  85. },
  86. //仓库跳转
  87. bindViewCangKu() {
  88. wx.navigateTo({
  89. url: '../warehouselist/warehouselist',
  90. })
  91. },
  92. // 新手指南跳转
  93. bindViewNewComer() {
  94. wx.navigateTo({
  95. url: '../newcomer/newcomer',
  96. })
  97. },
  98. //巡检跳转
  99. bindViewXunJian() {
  100. // wx.navigateTo({
  101. // url: '../xunjian/xunjian',
  102. // })
  103. },
  104. // 使用攻略跳转
  105. bindViewIntroduction() {
  106. wx.navigateTo({
  107. url: '../Introduction/Introduction'
  108. })
  109. },
  110. bindViewXunjianimg() {
  111. wx.navigateTo({
  112. url: '../xunjianimg/xunjianimg'
  113. })
  114. },
  115. // 图片轮播
  116. //轮播图的切换事件
  117. swiperChange: function (e) {
  118. this.setData({
  119. swiperCurrent: e.detail.current
  120. })
  121. },
  122. //点击指示点切换
  123. chuangEvent: function (e) {
  124. this.setData({
  125. swiperCurrent: e.currentTarget.id
  126. })
  127. },
  128. //点击图片触发事件
  129. swipclick: function (e) {
  130. // console.log(this.data.swiperCurrent);
  131. wx.switchTab({
  132. // url: this.data.links[this.data.swiperCurrent]
  133. })
  134. },
  135. //首页功能js-孙一石
  136. init_userInfo(e) {
  137. this.data.dofun = e.currentTarget.dataset.fun
  138. // let that = this
  139. // if (app.globalToken == null) {
  140. // http.showLoading()
  141. // wx.getUserProfile({
  142. // desc: 'desc',
  143. // success: (res) => {
  144. // this.getSysUserInfo(res.userInfo)
  145. // },
  146. // fail: res => {
  147. // console.log(res)
  148. // },
  149. // })
  150. // } else {
  151. this.callByName(this.data.dofun)
  152. // }
  153. },
  154. callByName(name) {
  155. if (name == "bindViewDaiBan") {
  156. //待办
  157. this.bindViewDaiBan()
  158. } else if (name == "bindViewQiYe") {
  159. //企业
  160. this.bindViewQiYe()
  161. } else if (name == "bindViewXunCha") {
  162. this.bindViewXunCha()
  163. } else if (name == "bindViewXunjianimg") {
  164. this.bindViewXunjianimg()
  165. } else if (name == "bindViewGengDuo") {
  166. this.bindViewGengDuo()
  167. } else if (name == "bindViewWuZi") {
  168. this.bindViewWuZi()
  169. }else if(name=="bindViewDuiWu"){
  170. this.bindViewDuiWu()
  171. }else if(name=="bindViewCangKu"){
  172. this.bindViewCangKu()
  173. }
  174. },
  175. initIndexPage() {
  176. if (app.globalToken == null || app.globalToken == '') {
  177. return
  178. }
  179. http.send_post("/system/AppIndexController/getIndexPageData", null, this.initIndexPageSuccess)
  180. },
  181. initIndexPageSuccess(res) {
  182. if (res.code == 200) {
  183. this.setData({
  184. xunjianImgCount: res.data.xunjianImgCount,
  185. })
  186. if (res.data.noticeList.length > 0) {
  187. this.setData({
  188. NoticeTitle: res.data.noticeList[0].noticeTitle
  189. })
  190. } else {
  191. this.setData({
  192. NoticeTitle: "暂无公告"
  193. })
  194. }
  195. }
  196. },
  197. // getSysUserInfo(info) {
  198. // let that = this
  199. // wx.login({
  200. // success(res) {
  201. // var code = res.code
  202. // var data = {
  203. // wxCode: code,
  204. // wxNickName: info.nickName,
  205. // wxAvatarUrl: info.avatarUrl
  206. // }
  207. // // http.send_post_login("/minapp/AppLoginController/appLogin",data)
  208. // http.send_post("/auth/applogin", data, that.loginSuccess)
  209. // },
  210. // fail(res) {
  211. // console.log("ffff", res)
  212. // }
  213. // })
  214. // },
  215. onTabItemTap(item) {
  216. console.log("$$$$$$$", item)
  217. }
  218. })