123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- // index.js
- //获取应用实例
- var app = getApp();
- Page({
- data: {
- urlHttp: '',
- contentList:[],
- command:'', //口令
- commandNeibu:'',
- commandPlaceholder: '请输入口令',
- showVip : false,
- showNeiBu:false,
- hiddenmodal : true //显示提示弹窗
- },
- onLoad: function () {
- var that = this;
- var host = getApp().globalData.servsers;
- that.setData({
- urlHttp: host
- });
- wx.request({
- url: host+"classifyapi/findAllforhome",
- data: {},
- method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
- header: {
- 'Accept': 'application/json'
- },
- success: function (res) {
- that.setData({
- contentList: res.data.rows
- });
- console.log(res.data.rows);
- if (res == null || res.data == null) {
- console.error('网络请求失败');
- return;
- }
- }
- })
- },
- //下拉刷新
- onPullDownRefresh: function (e) {
- this.onLoad();
- wx.stopPullDownRefresh();
- },
- //打开VIP弹窗
- openVipWind:function(e){
- var that = this;
- that.setData({
- showVip: true
- })
- },
- //关闭VIP弹窗
- closeVipWind:function(e){
- var that = this;
- that.setData({
- showVip: false
- })
- },
- //口令
- commandInput: function (e) {
- this.setData({
- command: e.detail.value
- })
- },
- commandInputFocus:function(e){
- var that = this;
- that.setData({
- commandPlaceholder : ''
- })
- },
- //vip - 立即进入
- comeInVip:function(e){
- var that = this;
- var command = that.data.command;
- if (command != 'VIPBYU'){
- that.setData({
- hiddenmodal: false,
- modalCont: '输入口令有误!请重新输入口令',
- })
- setTimeout(function () {
- that.setData({
- hiddenmodal: true,
- commandPlaceholder: '请输入口令'
- })
- }, 1000)
- return false;
- }else{
- that.setData({
- showVip: false,
- command : '',
- commandPlaceholder: '请输入口令'
- })
- setTimeout(function () {
- wx.navigateTo({
- url: '/pages/kindSecondList/kindSecondList?classify_name=VIP专区&classify_des=大良造VIP专区&id=2998',
- })
- }, 50)
- }
- },
- //打开内部员工弹窗
- openNeibuWind: function (e) {
- var that = this;
- that.setData({
- showNeibu: true
- })
- },
- //关闭内部员工弹窗
- closeNeibuWind: function (e) {
- var that = this;
- that.setData({
- showNeibu: false
- })
- },
- //内部员工口令
- commandNeibuInput: function (e) {
- this.setData({
- commandNeibu: e.detail.value
- })
- },
- commandNeibuInputFocus: function (e) {
- var that = this;
- that.setData({
- commandPlaceholder: ''
- })
- },
- //内部员工 - 立即进入
- comeInNeibu: function (e) {
- var that = this;
- var commandNeibu = that.data.commandNeibu;
- if (commandNeibu != 'maineibu') {
- that.setData({
- hiddenmodal: false,
- modalCont: '输入口令有误!请重新输入口令',
- })
- setTimeout(function () {
- that.setData({
- hiddenmodal: true,
- commandPlaceholder: '请输入口令'
- })
- }, 1000)
- return false;
- } else {
- that.setData({
- showNeibu: false,
- commandNeibu: '',
- commandPlaceholder: '请输入口令'
- })
- setTimeout(function () {
- wx.navigateTo({
- url: '/pages/kindSecondList/kindSecondList?classify_name=内部购买&classify_des=古德内部员工购买&id=3000&flag=0',
- })
- }, 50)
- }
- },
- })
- var that;
- var Util = require('../../utils/util.js');
|