E企盈营销工具技术服务商 热线:4006-838-530

微信小程序app.js启动配置文件

E企盈直播平台营销卖货系统

utils/getsign.jsvar utilmd5 = require(‘md5.js’)function getSign(time, datapar) {  var key = ‘*********=’;  var str = key + time + datapar;  var sign = ”;  sign = utilmd5.hexMD5(str);  return sign;}function getSignwx(datapar) {  var appid = ‘*********’;  var key = ‘**********’;  var str = ‘appId=’ + appid + datapar + ‘&key=’ + key;  var sign = ”;  sign = utilmd5.hexMD5(str);  return sign;}module.exports = {  getSign: getSign,  getSignwx: getSignwx}var utiltime = require(‘utils/time.js’)var utilsign = require(‘utils/getsign.js’)var imgUrl = ”App({globalData: {    canvas:{},    version:null,    loginsatus: false,    userInfo: null,    userid: null,    pageUrl:”,    // APIUrl: ”,    APIUrl: ”,  //测试接口地址    // APIUrl: ”,  //正式接口地址        imgUrl:”,  //图片地址       tabBar: {      “color”: “#666666”,      “selectedColor”: “#fa2422”,      “backgroundColor”: “#fff”,      “borderStyle”: “#efefef”,      “list”: [        {          “pagePath”: “/pages/homePage/productsIndex/index/index”,          “text”: “首页”,          “iconPath”: imgUrl +”indexDxyp.png”,          “selectedIconPath”: imgUrl +”indexDxyp.png”,          “clas”: “menu-item”,          “selectedColor”: “#fa2422”,          active: true        },        {          “pagePath”: “/pages/find/find”,          “text”: “发现”,          “iconPath”: imgUrl +”findDxyp.png”,          “selectedIconPath”: imgUrl +”findDxyp.png”,          “selectedColor”: “#fa2422”,          “clas”: “menu-item”,          active: false        },        {          “pagePath”: “/pages/classify/classify”,          “text”: “分类”,          “iconPath”: imgUrl +”classifyDxyp.png”,          “selectedIconPath”: imgUrl +”classifyDxyp.png”,          “selectedColor”: “#fa2422”,          “clas”: “menu-item”,          active: false        },        {          “pagePath”: “/pages/userPage/myInfo/my/my”,          “text”: “我的”,          “iconPath”: imgUrl +”mineDxyp.png”,          “selectedIconPath”: imgUrl +”mineDxyp.png”,          “selectedColor”: “#fa2422”,          “clas”: “menu-item”,          active: false        }      ],      “position”: “bottom”    },    tabBar2: {      “color”: “#666666”,      “selectedColor”: “#fa2422”,      “backgroundColor”: “#fff”,      “borderStyle”: “#efefef”,      “list”: [        {          “pagePath”: “/pages/homePage/productsIndex/index/index”,          “text”: “首页”,          “iconPath”: imgUrl +”indexDxyp.png”,          “selectedIconPath”: imgUrl +”indexDxyp.png”,          “clas”: “menu-item2”,          “selectedColor”: “#fa2422”,          active: true        },        {          “pagePath”: “/pages/find/find”,          “text”: “发现”,          “iconPath”: imgUrl +”findDxyp.png”,          “selectedIconPath”: imgUrl +”findDxyp.png”,          “selectedColor”: “#fa2422”,          “clas”: “menu-item2”,          active: false        },        {          “pagePath”: “/pages/classify/classify”,          “text”: “分类”,          “iconPath”: imgUrl +”classifyDxyp.png”,          “selectedIconPath”: imgUrl +”classifyDxyp.png”,          “selectedColor”: “#fa2422”,          “clas”: “menu-item2”,          active: false        },        {          “pagePath”: “/pages/orderPage/cartInfo/car/car”,          “text”: “购物车”,          “iconPath”: imgUrl +”cartDxyp.png”,          “selectedIconPath”: imgUrl +”cartDxyp.png”,          “selectedColor”: “#fa2422”,          “clas”: “menu-item2”,          active: false,          carNum:0        },        {          “pagePath”: “/pages/userPage/myInfo/my/my”,          “text”: “我的”,          “iconPath”: imgUrl +”mineDxyp.png”,          “selectedIconPath”: imgUrl +”mineDxyp.png”,          “selectedColor”: “#fa2422”,          “clas”: “menu-item2”,          active: false        }      ],      “position”: “bottom”    },    “networkTimeout”: {      “request”: 3000,    },  },  onLaunch: function () {    //检查是否存在新版本    wx.getUpdateManager().onCheckForUpdate(function (res) {      // 请求完新版本信息的回调      console.log(“是否有新版本:” + res.hasUpdate);      if (res.hasUpdate) {//如果有新版本        wx.clearStorageSync()         // 小程序有新版本,会主动触发下载操作(无需开发者触发)        wx.getUpdateManager().onUpdateReady(function () {//当新版本下载完成,会进行回调          wx.showModal({            title: ‘更新提示’,            content: ‘新版本已经准备好,单击确定重启应用’,            showCancel: false,            success: function (res) {              if (res.confirm) {                // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启                wx.getUpdateManager().applyUpdate();              }            }          })        })        // 小程序有新版本,会主动触发下载操作(无需开发者触发)        wx.getUpdateManager().onUpdateFailed(function () {//当新版本下载失败,会进行回调          wx.showModal({            title: ‘提示’,            content: ‘检查到有新版本,但下载失败,请检查网络设置’,            showCancel: false,          })        })      }    })    //用户静默登录    that.auth_login()  },auth_login:function(){    // 静默获取用户信息    var that = this;    if (wx.getStorageSync(‘wxuserid’)) {      wx.setStorageSync(‘oldUsers’, false)      return false    }    wx.login({      success: function (res) {        var arys = {          ‘code’: res.code        };        that.doRequestService(‘/svc/api/user/getUserByCode’, arys, function (res) {          console.log(res)          // return          if (res.status == ‘SUCCESS’) {            console.log(res.userBaseInfo)            if (res.userBaseInfo && res.userBaseInfo.phone && res.userId) {              wx.setStorageSync(‘wxuserid’, res.userId)              wx.setStorageSync(‘userinfo’, res.userBaseInfo)                          }                         wx.setStorageSync(‘oldUsers’, false)          }        }, null, null)      }    })  },  // 分享  onShare:function(obj){    if(!obj) var obj = {};    var shareObj={};    var userName = wx.getStorageSync(‘userinfo’).nickName;//用户名    shareObj.path = obj.path || ‘pages/homePage/productsIndex/index/index’;    shareObj.title = obj.title ||

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序app.js启动配置文件
分享到: 更多 (0)
E企盈小程序直播营销卖货系统
E企盈直播平台营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏