Procházet zdrojové kódy

页面优化

guessPrice
sui před 5 roky
rodič
revize
f3e5eeb85d
8 změnil soubory, kde provedl 81 přidání a 29 odebrání
  1. +22
    -6
      496_dongfengqichen/app.js
  2. +1
    -1
      496_dongfengqichen/pages/component/tabBar/index.wxss
  3. +1
    -1
      496_dongfengqichen/pages/coupon/coupon.js
  4. +18
    -7
      496_dongfengqichen/pages/index/index.js
  5. +1
    -1
      496_dongfengqichen/pages/luckyStar/luckyStar.js
  6. +34
    -9
      496_dongfengqichen/pages/myCenter/myCenter.js
  7. +3
    -3
      496_dongfengqichen/pages/poster/poster.js
  8. +1
    -1
      496_dongfengqichen/pages/prizes/prizes.js

+ 22
- 6
496_dongfengqichen/app.js Zobrazit soubor

} else { } else {
this.globalData.openid = openid; this.globalData.openid = openid;
} }
var userMobile = wx.getStorageSync('userMobile');
if (userMobile){
this.globalData.userMobile = userMobile;
}
var userInfoData = wx.getStorageSync("userInfoData");
if (userInfoData){
this.globalData.userInfoData = {};
this.globalData.userInfoData.avatarUrl = userInfoData.avatarUrl;
this.globalData.userInfoData.nickName = userInfoData.nickName;
}
}, },
wxLogin() { wxLogin() {
wx.login({ wx.login({
friendOpenid:"",//推荐人的openid friendOpenid:"",//推荐人的openid
session_key: "",//session_key session_key: "",//session_key
openidSuccessFuc: null,//方法回调 openidSuccessFuc: null,//方法回调
nowPage:'0',//当前tabBar
nowPage:'1',//当前tabBar
isRegister:false,//是否已注册 isRegister:false,//是否已注册
userMobile:null,//用户手机号 userMobile:null,//用户手机号
isFirstLogin:true,//是否为第一次登录 isFirstLogin:true,//是否为第一次登录
console.log("下面是formid"); console.log("下面是formid");
console.log(e); console.log(e);
this.wxRequest(this.globalData.urlRoot + "/msg/addFormId", { formid: e }, res => { this.wxRequest(this.globalData.urlRoot + "/msg/addFormId", { formid: e }, res => {
// if(res.code==200){
// console.log(res.msg);
// }else{
// console.log(res.msg);
// }
console.log(res.msg); console.log(res.msg);
}, this, "POST"); }, this, "POST");
},
getMobile: function (encryptedData, iv, callback, thisArg){//和后台置换手机号
this.wxRequest(this.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: encryptedData, iv: iv }, res => {
if(res.code == 200){
wx.setStorageSync('userMobile', res.data.decodeData.phoneNumber);
this.globalData.userMobile = res.data.decodeData.phoneNumber;
}
if (callback && thisArg) {
callback.call(thisArg, res);
}
}, this, "POST");
} }
}) })

+ 1
- 1
496_dongfengqichen/pages/component/tabBar/index.wxss Zobrazit soubor

width:750rpx; width:750rpx;
height:150rpx; height:150rpx;
box-sizing: border-box; box-sizing: border-box;
border-top: 4rpx solid #B8B6B9;
border-top: 2rpx solid #B8B6B9;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;

+ 1
- 1
496_dongfengqichen/pages/coupon/coupon.js Zobrazit soubor

* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
app.globalData.nowPage = 0;
if (options.friendOpenid){ if (options.friendOpenid){
app.globalData.friendOpenid = options.friendOpenid; app.globalData.friendOpenid = options.friendOpenid;
app.globalData.nowPage = 0;
} }
}, },



+ 18
- 7
496_dongfengqichen/pages/index/index.js Zobrazit soubor

videoList:[],//视频列表 videoList:[],//视频列表
videoVideoControls:false,//是否显示视频控件 videoVideoControls:false,//是否显示视频控件
mainShow:false, mainShow:false,
isOnce:false
}, },
onLoad: function () { onLoad: function () {
app.globalData.nowPage = 1;
if (app.globalData.isFirstLogin) { if (app.globalData.isFirstLogin) {
this.getStartAdvertising(); this.getStartAdvertising();
}else{ }else{
} }
this.setData({ this.setData({
mainShow: true, mainShow: true,
isStartAdvertisingShow: false,
isStartAdvertisingShow: this.data.isOnce ? true : app.globalData.isFirstLogin,
isRegister: app.globalData.isRegister isRegister: app.globalData.isRegister
}) })
}, },
this.getUserLocation();//获取用户当前位置 this.getUserLocation();//获取用户当前位置
} }
if (e.detail.errMsg=='getPhoneNumber:ok'){ if (e.detail.errMsg=='getPhoneNumber:ok'){
app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
app.getMobile(e.detail.encryptedData, e.detail.iv,res=>{
if (res.code == 200) { if (res.code == 200) {
this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
this.setData({ this.setData({
icon: "none" icon: "none"
}) })
} }
}, this,"POST");
},this);
} }
}, },
getUserLocation:function(e){ getUserLocation:function(e){
wx.getLocation({ wx.getLocation({
type: 'gcj02', //wgs84
type: 'wgs84', //
success:(res)=>{ success:(res)=>{
// console.log(res); // console.log(res);
this.getDistributorList(res.longitude, res.latitude); this.getDistributorList(res.longitude, res.latitude);
}, this, "POST") }, this, "POST")
}, },
getStartAdvertising: function () {//获取开屏广告 getStartAdvertising: function () {//获取开屏广告
app.wxRequest(app.globalData.urlRoot +"home/getStartAdvertising",{},res=>{
app.wxRequest(app.globalData.urlRoot + "home/getStartAdvertising", {}, res => {
this.data.isOnce = true;
if (app.globalData.openid) { if (app.globalData.openid) {
this.loadFun(); this.loadFun();
} else { } else {
app.globalData.openidSuccessFuc = this.loadFun; app.globalData.openidSuccessFuc = this.loadFun;
} }
if(res.code==200){ if(res.code==200){
this.setData({ this.setData({
startAdvertisingUrl: res.data.picurl, startAdvertisingUrl: res.data.picurl,
mainShow:true mainShow:true
}) })
setTimeout(()=>{ setTimeout(()=>{
this.setData({ this.setData({
isStartAdvertisingShow:false
isStartAdvertisingShow:false,
}) })
},1000); },1000);
}, 3000); }, 3000);
}) })
app.globalData.isRegister = true; app.globalData.isRegister = true;
app.globalData.userMobile = res.data.mobile; app.globalData.userMobile = res.data.mobile;
}else{
if (app.globalData.userMobile) {
this.data.subscribeData.mobile = app.globalData.userMobile;
this.setData({
phoneInputShow:true,
subscribeData: this.data.subscribeData
})
this.getUserLocation();
}
} }
} else { } else {
console.log(res.msg) console.log(res.msg)

+ 1
- 1
496_dongfengqichen/pages/luckyStar/luckyStar.js Zobrazit soubor

* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
app.globalData.nowPage = 3;
}, },


/** /**

+ 34
- 9
496_dongfengqichen/pages/myCenter/myCenter.js Zobrazit soubor

* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
app.globalData.nowPage = 4;
if (options.sourcePage){ if (options.sourcePage){
this.data.optionsData = options.sourcePage; this.data.optionsData = options.sourcePage;
} }
if (!app.globalData.isRegister) { if (!app.globalData.isRegister) {
this.getOrderInfo(); this.getOrderInfo();
} }
if (app.globalData.userInfoData) {
this.data.userData.avatarUrl = app.globalData.userInfoData.avatarUrl;
this.data.userData.nickName = app.globalData.userInfoData.nickName;
this.setData({
userData: this.data.userData
})
}
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
app.globalData.userInfoData = {}; app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl; app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
app.globalData.userInfoData.nickName = e.detail.userInfo.nickName; app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
wx.setStorageSync('userInfoData', {
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
})
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName); app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
} }
}, },
getUserInfo:function(e){//获取个人信息 getUserInfo:function(e){//获取个人信息
app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => { app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
if(res.code==200){ if(res.code==200){
// res.data.userLevel = 3;
if (res.data) { if (res.data) {
this.data.userData.avatarUrl = res.data.avatarUrl;
this.data.userData.nickName = res.data.nickName;
this.data.userData.userLevel = res.data.userLevel; this.data.userData.userLevel = res.data.userLevel;
if (!app.globalData.userInfoData) {
this.data.userData.avatarUrl = res.data.avatarUrl;
this.data.userData.nickName = res.data.nickName;
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
app.globalData.userInfoData.nickName = res.data.nickName;
wx.setStorageSync('userInfoData', {
avatarUrl: res.data.avatarUrl,
nickName: res.data.nickName
})
}
this.setData({ this.setData({
userData: this.data.userData, userData: this.data.userData,
isLogin: true isLogin: true
}) })
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
app.globalData.userInfoData.nickName = res.data.nickName;
} }
} }
},this) },this)
}) })
app.globalData.isRegister = true; app.globalData.isRegister = true;
app.globalData.userMobile = res.data.mobile; app.globalData.userMobile = res.data.mobile;
} else {
if (app.globalData.userMobile) {
this.data.subscribeData.mobile = app.globalData.userMobile;
this.setData({
phoneInputShow: true,
subscribeData: this.data.subscribeData
})
this.getUserLocation();
}
} }
} else { } else {
console.log(res.msg) console.log(res.msg)
}, },
getMyAwardList: function () {//获取获奖记录 getMyAwardList: function () {//获取获奖记录
app.wxRequest(app.globalData.urlRoot + "award/getMyAwardList", { awardType: this.data.recordNow},res=>{ app.wxRequest(app.globalData.urlRoot + "award/getMyAwardList", { awardType: this.data.recordNow},res=>{
console.log(res);
if(res.code == 200){ if(res.code == 200){
this.setData({ this.setData({
recordList:res.data recordList:res.data
this.getUserLocation();//获取用户当前位置 this.getUserLocation();//获取用户当前位置
} }
if (e.detail.errMsg == 'getPhoneNumber:ok') { if (e.detail.errMsg == 'getPhoneNumber:ok') {
app.wxRequest(app.globalData.urlRoot + "userInfo/getUserPhoneNumber", { encryptedData: e.detail.encryptedData, iv: e.detail.iv }, res => {
app.getMobile(e.detail.encryptedData, e.detail.iv, res => {
if (res.code == 200) { if (res.code == 200) {
this.data.subscribeData.mobile = res.data.decodeData.phoneNumber; this.data.subscribeData.mobile = res.data.decodeData.phoneNumber;
this.setData({ this.setData({
icon: "none" icon: "none"
}) })
} }
}, this, "POST");
}, this);
} }
} }
}) })

+ 3
- 3
496_dongfengqichen/pages/poster/poster.js Zobrazit soubor

* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
app.globalData.nowPage = 2;
}, },


/** /**
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
return { return {
title: '500元购车券',
imageUrl: "",
title: '您有一份启辰星专属礼品待领取',
imageUrl: this.data.imgUrl+"/images/posterShareImg.png",
path: "/pages/coupon/coupon?friendOpenid=" + app.globalData.openid path: "/pages/coupon/coupon?friendOpenid=" + app.globalData.openid
} }
}, },

+ 1
- 1
496_dongfengqichen/pages/prizes/prizes.js Zobrazit soubor

* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
app.globalData.nowPage = 3;
}, },


/** /**

Načítá se…
Zrušit
Uložit