123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- //app.js viptime
- // appid wx842cf17c56448e51
- // appid 装修宝 wxf33092e34e6ae8b1
- var d = new Date()
- App({
- globalData:{
- statusBarHeight:'',
- titleBarHeight:44,
- imgUrl:'https://o.nczyzs.com/',//imgzqxgtest
- wburl:'https://img.yunxiekeji.cn',
- simgUrl:'https://wzh-zqxg.oss-cn-hangzhou.aliyuncs.com/',
- webUrl:'https://zqxg.cc/',//测试环境 saastest https://saasdev.zhuangqixiaoguan.com/,正式环境https://wzh.nczyzs.com/
- token:'',
- userflag:false,//true是有个人信息,false没有个人信息
- phone:false,//true是有手机号,false是没有手机号
- shareuserid:'',//分享人的id
- currentUserId: '',
- agentEmployeEid: "",
- brokeruserId: '',
- vrString: '',
- companyobj:{},
- shareperson:{},
- sharempid:'',
- personMsg:{},//org_type 2是设计师,其他的是销售
- unreadNum:0,
- official_openid: null,
- screenHeight:'100%',
- sharename:'',//分享人的昵称
- timearr:[],
- addstate:'',//add是添加客户页面,list是客户列表页面
- clientype:'',
- companyname:'',
- agentName: "",
- platform: '',
- vraddress: '',
- sharepersonobj:{},
- timeline:'',//1是从“单页模式”打开小程序”,2是朋友圈内打开“单页模式”
- useversion:true,
- },
- onLaunch: function (opts) {
- var that = this;
- // wx.loadFontFace({
- // family: 'digifaw',
- // global:true,
- // source: 'url("https://wzh.nczyzs.com/static/fonts/digifaw.ttf")',
- // success: console.log
- // })
- this.globalData.timearr = [];
- const updateManager = wx.getUpdateManager()
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- console.log(res.hasUpdate)
- })
- updateManager.onUpdateReady(function () {
- wx.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success: function (res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- })
- })
- updateManager.onUpdateFailed(function () {
- // 新的版本下载失败
- wx.showModal({
- title: '更新提示',
- content: '新版本下载失败',
- showCancel: false
- })
- })
- wx.getSystemInfo({
- success: (res) => {
- that.globalData.screenHeight = res.safeArea.height;
- that.globalData.platform = res.platform;
- that.globalData.statusBarHeight = res.statusBarHeight;
- if (!!that.globalData.statusBarHeight && res.platform != 'devtools') {
- wx.setStorage({
- key: "statusBarHeight",
- data: res.statusBarHeight
- })
- }
- },
- fail: (res) => {
- }
- })
- var that = this;
- var obj = wx.getLaunchOptionsSync();
- if(obj.scene==1155){
- that.globalData.timeline=1;
- if(obj.path=='index/pages/namecard/namecard'){
- wx.reLaunch({
- url:'/share/pages/shareCard/shareCard?uid=' + obj.query.uid + '&empid=' + obj.query.empid + '&ctp=' + obj.query.ctp,
- })
- }
- }else if(obj.scene==1154&&(obj.path=='index/pages/namecard/namecard'||obj.path=='share/pages/shareCard/shareCard'||obj.path=='pages/index/index')){
- that.globalData.timeline=2;
- }else{
- that.globalData.timeline='';
- }
- },
- onShow: function (options) {
- var that = this;
- var obj = wx.getLaunchOptionsSync();
- if(obj.scene==1155){
- that.globalData.timeline=1;
- if(obj.path=='index/pages/namecard/namecard'){
- wx.reLaunch({
- url:'/share/pages/shareCard/shareCard?uid=' + obj.query.uid + '&empid=' + obj.query.empid + '&ctp=' + obj.query.ctp,
- })
- }
- }else if(obj.scene==1154&&(obj.path=='index/pages/namecard/namecard'||obj.path=='share/pages/shareCard/shareCard'||obj.path=='pages/index/index')){
- that.globalData.timeline=2;
- }else{
- that.globalData.timeline='';
- }
- wx.getStorage({
- key: 'lastpath',
- success(res) {
- let arr = obj.path.split('/');
- if (res.data == obj.path && obj.path == 'mycustomer/pages/invite/invite') {
- wx.reLaunch({
- url: '/pages/index/index',
- })
- }
- }
- })
- if (obj.path == 'mycustomer/pages/invite/invite') {
- wx.removeStorage({
- key: "lastpath",
- })
- } else {
- wx.setStorage({
- key: "lastpath",
- data: obj.path
- })
- }
- },
- })
|