Commit 58e0c738 by 前端

去除掉无用的key定义

1 parent c5be6e69
......@@ -38,6 +38,7 @@ Page({
ifUpdate: false
}) */
if(wx.getStorageSync('initFindCar')){
let _url = `${WXRequest.domain}h5/dist/index.html?sessionid=${sessionid}&sns=${carInfo.sns}&standno=${carInfo.standno}&name=${carInfo.name}&vehicleid=${carInfo.vehicleid}`;
if(carInfo.loginUserId){
_url += `&loginUserId=${carInfo.loginUserId}`;
......@@ -45,6 +46,8 @@ Page({
loginUserId: carInfo.loginUserId
});
}
console.log(sessionid)
console.log(_url);
this.setData({
url: encodeURI(_url),
ifUpdate: true
......
const WXRequest = require('../../utils/wxrequest.js');
Page({
/**
* 页面的初始数据
*/
data: {
modalHidden: true,
userInfoAuth: true,
isSharePage: false,
sns: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.code) {
wx.setStorageSync('publicCode', options.code);
/*wx.showModal({
content: options.code,
showCancel: false
});*/
}
if(options.carShareInfo){
wx.setStorageSync('carShareInfo', JSON.parse(decodeURIComponent(options.carShareInfo)));
wx.setStorageSync('loginUserId', options.loginUserId);
}else{
wx.setStorageSync('carShareInfo', null)
}
if(options.sns){ // 新e盾找车
this.setData({
sns: decodeURIComponent(options.sns)
})
} else {
this.setData({
/**
* 页面的初始数据
*/
data: {
modalHidden: true,
userInfoAuth: true,
isSharePage: false,
sns: null
})
}
if (options.isSharePage) {
this.setData({
isSharePage: true
})
}
/* wx.showModal({
content: String(options.test),
showCancel: false
});*/
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function (options) {
var that = this;
WXRequest.login().then(()=>{
const userStatus = wx.getStorageSync("userStatus");
const scene = wx.getStorageSync('scene');
if(scene == '1007' || scene =='1008' || scene == '1044' ){//转发场景
if(userStatus === 2){//转发新用户
that.setData({
modalHidden: false,
userInfoAuth: false
});
return;
wx.getSetting({
success(res) {console.log(res)
if (!res.authSetting['scope.userInfo']) {
that.setData({
modalHidden: false,
userInfoAuth: false
});
}else{
wx.switchTab({
url: '../../pages/findCar/findCar'
});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.code) {
wx.setStorageSync('publicCode', options.code);
/*wx.showModal({
content: options.code,
showCancel: false
});*/
}
if (options.carShareInfo) {
wx.setStorageSync('carShareInfo', JSON.parse(decodeURIComponent(options.carShareInfo)));
wx.setStorageSync('loginUserId', options.loginUserId);
} else {
wx.setStorageSync('carShareInfo', null)
}
if (options.sns) { // 新e盾找车
this.setData({
sns: decodeURIComponent(options.sns)
})
} else {
this.setData({
sns: null
})
}
if (options.isSharePage) {
this.setData({
isSharePage: true
})
}
/* wx.showModal({
content: String(options.test),
showCancel: false
});*/
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function (options) {
var that = this;
WXRequest.login().then(() => {
const userStatus = wx.getStorageSync("userStatus");
const scene = wx.getStorageSync('scene');
if (scene == '1007' || scene == '1008' || scene == '1044') { //转发场景
if (userStatus === 2) { //转发新用户
that.setData({
modalHidden: false,
userInfoAuth: false
});
return;
wx.getSetting({
success(res) {
console.log(res)
if (!res.authSetting['scope.userInfo']) {
that.setData({
modalHidden: false,
userInfoAuth: false
});
} else {
wx.switchTab({
url: '../../pages/findCar/findCar'
});
}
}
});
} else if (userStatus === 1) {
wx.switchTab({
url: '../../pages/findCar/findCar'
});
} else if (userStatus === 0) {
wx.setStorageSync('carShareInfo', null);
wx.switchTab({
url: '../../pages/home/home'
});
}
} else {
if (userStatus === 2) {
wx.redirectTo({
url: '../../pages/login/login'
});
} else {
wx.switchTab({
url: '../../pages/home/home'
});
/*wx.redirectTo({
url: '../../pages/collectCarDetail/collectCarDetail'
});*/
}
}
});
}else if(userStatus === 1){
if (!this.data.isSharePage) { // 老e盾页面分享
wx.switchTab({
url: '../../pages/findCar/findCar'
});
} else {
wx.reLaunch({
url: `../../pages/newFindCar/findCar?sns=${encodeURIComponent(this.data.sns)}&isSharePage=true`
});
}
}else if(userStatus === 0){
wx.setStorageSync('carShareInfo', null);
})
/*setTimeout(()=>{
wx.switchTab({
url: '../../pages/home/home'
url: '../../pages/findCar/findCar'
});
}
}else{
},5000)*/
if(userStatus === 2){
wx.redirectTo({
url: '../../pages/login/login'
/*console.log(wx.getStorageSync('scene'))
if(wx.getStorageSync('scene') == '1044'){
wx.switchTab({
url: '../../pages/mine/mine'
});
}else{
wx.switchTab({
url: '../../pages/home/home'
url: '../../pages/findCar/findCar'
});
/*wx.redirectTo({
url: '../../pages/collectCarDetail/collectCarDetail'
});*/
}
}
})
/*setTimeout(()=>{
wx.switchTab({
url: '../../pages/findCar/findCar'
});
},5000)*/
/*console.log(wx.getStorageSync('scene'))
if(wx.getStorageSync('scene') == '1044'){
wx.switchTab({
url: '../../pages/mine/mine'
});
}else{
wx.switchTab({
url: '../../pages/findCar/findCar'
});
}*/
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
onGotUserInfo(e) {
if(e.detail.errMsg === 'getUserInfo:ok'){
this.setData({
modalHidden: true,
userInfoAuth: true
});
wx.login({
success: res => {
wx.request({
url: `${WXRequest.domain}loginWxUser`,
data: {
...e.detail.userInfo,
code: res.code
},
success: function(res) {
const data = res.data;
if(res.statusCode === 200){
const data = res.data;
if(data.returnCode === '0'){
wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
wx.setStorageSync("userStatus", 1);
wx.setStorageSync("userinfo", data.data);
if (!this.data.isSharePage) {
wx.switchTab({
url: '../../pages/findCar/findCar'
});
} else { // 新e盾分享页
wx.reLaunch({
url: `../../pages/newFindCar/findCar?sns=${encodeURIComponent(this.data.sns)}&isSharePage=true`
}*/
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
onGotUserInfo(e) {
if (e.detail.errMsg === 'getUserInfo:ok') {
this.setData({
modalHidden: true,
userInfoAuth: true
});
wx.login({
success: res => {
wx.request({
url: `${WXRequest.domain}loginWxUser`,
data: {
...e.detail.userInfo,
code: res.code
},
success: function (res) {
const data = res.data;
if (res.statusCode === 200) {
const data = res.data;
if (data.returnCode === '0') {
wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
wx.setStorageSync("userStatus", 1);
wx.setStorageSync("userinfo", data.data);
wx.switchTab({
url: '../../pages/findCar/findCar'
});
} else {
wx.showModal({
content: data.message,
showCancel: false
});
}
} else if (res.statusCode === 401) {
wx.redirectTo({
url: '../../pages/login/login'
});
}
},
fail() {
console.log('fail')
}
});
}
}else{
wx.showModal({
content: data.message,
showCancel: false
});
}
}else if(res.statusCode === 401){
wx.redirectTo({
url: '../../pages/login/login'
});
}
},
fail(){
console.log('fail')
}
});
});
}
});
wx.setStorageSync('wxUserInfo', e.detail.userInfo)
console.log(e.detail.userInfo)
console.log(e.detail.rawData)
}
wx.setStorageSync('wxUserInfo', e.detail.userInfo)
console.log(e.detail.userInfo)
console.log(e.detail.rawData)
}
})
\ No newline at end of file
......@@ -57,12 +57,6 @@ Page({
});
}
},
// 新E盾找车
NewEFindCar() {
wx.navigateTo({
url: '../../pages/newFindSearch/findSearch'
});
},
/**
* 生命周期函数--监听页面加载
*/
......
......@@ -33,10 +33,6 @@
<image src="../../images/cmd-freqlog.png"/>调频记录
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view>
<!-- <view class="weui-cell active" bindtap="NewEFindCar">
<image src="../../images/new-findCar.png"/>"新E盾"找车
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view> -->
</view>
<view class="cmd-list logout" bindtap="logout" hidden="{{false}}">
退出登录
......
......@@ -32,9 +32,9 @@
.cmd-list .weui-cell.active{
background-color: #fff;
}
.cmd-list .weui-cell .inn{
/* .cmd-list .weui-cell .inn{
}
} */
.cmd-list .weui-cell__ft_in-access{
position: absolute;
top: 50%;
......
......@@ -12,7 +12,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let domain = WXRequest.domain.split('//')[1]
let domain = WXRequest.wxDomain.split('//')[1]
//let _appid = 'wxcad686d44f4c8c4d'; // 旧公众号
let _appid = 'wxb75708fc3ebb3605'; //新公众号
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${_appid}&redirect_uri=https%3a%2f%2f${domain}%2fopenid.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
......
//const domain = 'https://e-shield.didihu.com.cn/otmini/'; //正式环境
const domain = 'https://e-shield.hhxtechnology.com/otmini/'; //正式环境
// const domain = 'https://devwx.glsx.com.cn/otmini/'; //开发环境
//const domain = 'https://e-shield.hhxtechnology.com/otmini/'; //正式环境
const domain = 'https://devwx.glsx.com.cn/otmini/'; //开发环境
/*
新e盾找车
*/
......@@ -9,6 +9,9 @@ const domain = 'https://e-shield.hhxtechnology.com/otmini/'; //正式环境
// 生产:https://eshield.didihu.com.cn/
const newDomain = 'https://eshield.didihu.com.cn/'
// 公众号授权页面
const wxDomain = 'https://e-shield.hhxtechnology.com/otmini/'
function redirectToLogin(){console.log('redirectToLogin')
wx.redirectTo({
url: '../../pages/login/login'
......@@ -16,7 +19,8 @@ function redirectToLogin(){console.log('redirectToLogin')
}
module.exports = {
domain,
domain,
wxDomain,
login(data){
return new Promise(function(resolve, reject){
wx.showLoading();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!