123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- // index.js
- // 获取应用实例
- import http from '../../base/httputil'
- const app = getApp()
- Page({
- data: {
- host: app.globalData.host,
- current: 0, //当前所在页面的 index
- indicatorDots: true, //是否显示面板指示点
- autoplay: true, //是否自动切换
- interval: 3000, //自动切换时间间隔
- duration: 800, //滑动动画时长
- circular: true, //是否采用衔接滑动
- imgUrls: [
- // '../images/banner.jpg',
- // '../images/banner3.jpg',
- // '../images/banner2.jpg'
- ],
- links: [
- // '/pages/second/register',
- // '/pages/second/register',
- // '/pages/second/register'
- ],
- //功能数据-孙一石
- //记录首页点击-登录后继续跳转
- dofun: null,
- xunjianImgCount: '000,000',
- NoticeTitle: "登录查看公告"
- },
- onLoad() {
- this.setData({
- imgUrls: [
- this.data.host + '/images/banner.jpg',
- this.data.host + '/images/banner3.jpg',
- this.data.host + '/images/banner2.jpg'
- ]
-
- })
- },
- onShow() {
- // if (app.globalToken == null) {
- // wx.showToast({
- // title: '尚未登录,登录后即可使用',
- // icon: 'none'
- // })
- // }
- this.initIndexPage();
- },
- // 待办跳转
- bindViewDaiBan() {
- // wx.navigateTo({
- // url: '../daiban/daiban'
- // })
- },
- // 企业跳转
- bindViewQiYe() {
- if (app.globalToken == null) {
- wx.showToast({
- title: '尚未登录,登录后即可使用',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../qiye/qiye'
- })
- },
- // 巡查跳转
- bindViewXunCha() {
- if (app.globalToken == null) {
- wx.showToast({
- title: '尚未登录,登录后即可使用',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../xuncha/xuncha'
- })
- },
- // 通知公告更多跳转
- bindViewGengDuo() {
- if (app.globalToken == null) {
- wx.showToast({
- title: '尚未登录,登录后即可使用',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../notice/notice'
- })
- },
- //物资跳转
- bindViewWuZi() {
- if (app.globalToken == null) {
- wx.showToast({
- title: '尚未登录,登录后即可使用',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../material/material',
- })
- },
- //队伍跳转
- bindViewDuiWu() {
- if (app.globalToken == null) {
- wx.showToast({
- title: '尚未登录,登录后即可使用',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../teamlist/teamlist',
- })
- },
- //仓库跳转
- bindViewCangKu() {
- if (app.globalToken == null) {
- wx.showToast({
- title: '尚未登录,登录后即可使用',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../warehouselist/warehouselist',
- })
- },
- // 新手指南跳转
- bindViewNewComer() {
- wx.navigateTo({
- url: '../newcomer/newcomer',
- })
- },
- //巡检跳转
- bindViewXunJian() {
- // wx.navigateTo({
- // url: '../xunjian/xunjian',
- // })
- },
- // 使用攻略跳转
- bindViewIntroduction() {
- wx.navigateTo({
- url: '../Introduction/Introduction'
- })
- },
- bindViewXunjianimg() {
- if (app.globalToken == null) {
- wx.showToast({
- title: '尚未登录,登录后即可使用',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../xunjianimg/xunjianimg'
- })
- },
- // 图片轮播
- //轮播图的切换事件
- swiperChange: function (e) {
- this.setData({
- swiperCurrent: e.detail.current
- })
- },
- //点击指示点切换
- chuangEvent: function (e) {
- this.setData({
- swiperCurrent: e.currentTarget.id
- })
- },
- //点击图片触发事件
- swipclick: function (e) {
- // console.log(this.data.swiperCurrent);
- wx.switchTab({
- // url: this.data.links[this.data.swiperCurrent]
- })
- },
- //首页功能js-孙一石
- init_userInfo(e) {
- this.data.dofun = e.currentTarget.dataset.fun
- // let that = this
- // if (app.globalToken == null) {
- // http.showLoading()
- // wx.getUserProfile({
- // desc: 'desc',
- // success: (res) => {
- // this.getSysUserInfo(res.userInfo)
- // },
- // fail: res => {
- // console.log(res)
- // },
- // })
- // } else {
- this.callByName(this.data.dofun)
- // }
- },
- callByName(name) {
- if (name == "bindViewDaiBan") {
- //待办
- this.bindViewDaiBan()
- } else if (name == "bindViewQiYe") {
- //企业
- this.bindViewQiYe()
- } else if (name == "bindViewXunCha") {
- this.bindViewXunCha()
- } else if (name == "bindViewXunjianimg") {
- this.bindViewXunjianimg()
- } else if (name == "bindViewGengDuo") {
- this.bindViewGengDuo()
- } else if (name == "bindViewWuZi") {
- this.bindViewWuZi()
- } else if (name == "bindViewDuiWu") {
- this.bindViewDuiWu()
- } else if (name == "bindViewCangKu") {
- this.bindViewCangKu()
- }
- },
- initIndexPage() {
- if (app.globalToken == null || app.globalToken == '') {
- return
- }
- http.send_post("/system/AppIndexController/getIndexPageData", null, this.initIndexPageSuccess)
- },
- initIndexPageSuccess(res) {
- if (res.code == 200) {
- this.setData({
- xunjianImgCount: res.data.xunjianImgCount,
- })
- if (res.data.noticeList.length > 0) {
- this.setData({
- NoticeTitle: res.data.noticeList[0].noticeTitle
- })
- } else {
- this.setData({
- NoticeTitle: "暂无公告"
- })
- }
- }
- },
- // getSysUserInfo(info) {
- // let that = this
- // wx.login({
- // success(res) {
- // var code = res.code
- // var data = {
- // wxCode: code,
- // wxNickName: info.nickName,
- // wxAvatarUrl: info.avatarUrl
- // }
- // // http.send_post_login("/minapp/AppLoginController/appLogin",data)
- // http.send_post("/auth/applogin", data, that.loginSuccess)
- // },
- // fail(res) {
- // console.log("ffff", res)
- // }
- // })
- // },
- onTabItemTap(item) {
- console.log("$$$$$$$", item)
- }
- })
|