index.js 6.2 KB

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