Browse Source

调整

master
robin 7 years ago
parent
commit
2dcaba1c57
9 changed files with 161 additions and 60 deletions
  1. +1
    -0
      app.json
  2. +5
    -20
      pages/index/index.js
  3. +135
    -0
      pages/navigation/navigation.js
  4. +1
    -0
      pages/navigation/navigation.json
  5. +2
    -0
      pages/navigation/navigation.wxml
  6. +1
    -0
      pages/navigation/navigation.wxss
  7. +1
    -1
      pages/saleForecastList/newBill/newBill.js
  8. +3
    -31
      pages/selectCustomer/selctCustomer.js
  9. +12
    -8
      utils/net.js

+ 1
- 0
app.json View File

@ -1,5 +1,6 @@
{
"pages": [
"pages/navigation/navigation",
"pages/selectCustomer/selctCustomer",
"pages/index/index",
"pages/logs/logs",


+ 5
- 20
pages/index/index.js View File

@ -19,18 +19,7 @@ function WeixinLogin() {
app.globalData.DecryptCookie = res.result;
})
}
function IsBinded() {
let method = isBindedPath
let params = [app.globalData.OpenId];
network.transfer_request(method, params, function(res) {
if (res.result != "") {
app.globalData.PhoneNum = res.result;
IsBindWeixinMP(app.globalData.PhoneNum)
}
})
}
function IsBindWeixinMP(phone) {
let method = isBindWeixinPath
@ -38,6 +27,9 @@ function IsBindWeixinMP(phone) {
network.requestLoading(method, params, function(res) {
res.result = true;
if (res.result == true) {
WeixinLogin()
wx.switchTab({
url: '/pages/main/main',
})
@ -91,14 +83,7 @@ Page({
},
onShow: function() {
//未进行中转服务器绑定
if (app.globalData.PhoneNum == '') {
} else {
WeixinLogin()
IsBinded()
}
},
/**


+ 135
- 0
pages/navigation/navigation.js View File

@ -0,0 +1,135 @@
// pages/navigation/navigation.js
var network = require("../../utils/net.js")
var app = getApp()
var getBindCustomer = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetBindCustomer';
var getMiniOpenId = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetMiniOpenIdByCode';
var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/IsBinded';
function GetBindCustomer(that) {
let method = getBindCustomer;
let params = [app.globalData.AppId, app.globalData.OpenId];
network.requestLoading(method, params, function(res) {
if (res.result != null) {
app.globalData.CustomerId = res.result.ID;
app.globalData.PhoneNum = res.result.WeixinUser_Phone;
IsBinded();
}
}, function(res) {
wx.redirectTo({
url: '/pages/selectCustomer/selctCustomer',
})
})
}
function WeixinLogin() {
let method = app.globalData.LoginPath;
let params = [app.globalData.AppId, app.globalData.OpenId];
network.transfer_request(method, params, function(res) {
app.globalData.DecryptCookie = res.result;
})
}
function IsBinded() {
let method = isBindedPath
let params = [app.globalData.OpenId];
network.transfer_request(method, params, function(res) {
if (res.result != "") {
app.globalData.PhoneNum = res.result;
WeixinLogin();
wx.switchTab({
url: '/pages/main/main',
})
} else {
wx.redirectTo({
url: '/pages/index/index',
})
}
})
}
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var that = this;
wx.login({
success: function(res) {
let code = res.code;
let method = getMiniOpenId;
let params = [app.globalData.AppId, code];
network.requestLoading(method, params, function(res) {
app.globalData.OpenId = res.result;
GetBindCustomer(that)
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})

+ 1
- 0
pages/navigation/navigation.json View File

@ -0,0 +1 @@
{}

+ 2
- 0
pages/navigation/navigation.wxml View File

@ -0,0 +1,2 @@
<!--pages/navigation/navigation.wxml-->

+ 1
- 0
pages/navigation/navigation.wxss View File

@ -0,0 +1 @@
/* pages/navigation/navigation.wxss */

+ 1
- 1
pages/saleForecastList/newBill/newBill.js View File

@ -516,7 +516,7 @@ Page({
if (res.result != null) {
wx.showModal({
title: '新建订单No.' + res.result,
content: '新建成功,是否返回首页',
content: '新建成功,是否返回上级列表',
success: function(res) {
if (res.cancel) {} else {
wx.navigateBack({


+ 3
- 31
pages/selectCustomer/selctCustomer.js View File

@ -1,21 +1,6 @@
var network = require("../../utils/net.js")
var app = getApp()
function GetBindCustomer(that) {
let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetBindCustomer';
let params = [app.globalData.AppId, app.globalData.OpenId];
network.requestLoading(method, params, function(res) {
if (res.result != null) {
app.globalData.CustomerId = res.result.ID;
app.globalData.PhoneNum = res.result.WeixinUser_Phone;
wx.redirectTo({
url: '/pages/index/index',
})
}
})
}
Page({
@ -31,21 +16,8 @@ Page({
*/
onLoad: function(options) {
var that = this;
wx.login({
success: function(res) {
let code = res.code;
let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetMiniOpenIdByCode';
let params = [app.globalData.AppId, code];
network.requestLoading(method, params, function(res) {
app.globalData.OpenId = res.result;
GetBindCustomer(that)
})
}
})
let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CustomerRpc/GetList';
let params = [];


+ 12
- 8
utils/net.js View File

@ -12,7 +12,7 @@ function request(url, params, success, fail) {
// message:进度条的提示信息
// success:成功的回调函数
// fail:失败的回调
function requestLoading(method, params, successaction) {
function requestLoading(method, params, successaction, erroraction) {
wx.showLoading({
title: "加载中",
@ -36,12 +36,16 @@ function requestLoading(method, params, successaction) {
method: 'POST',
success: function(res) {
// console.log(res)
if (res.data.error != null) {
wx.showModal({
showCancel: false,
title: '执行出错',
content: res.data.error.message,
})
if (res.data.error != null) {
if (erroraction != null) {
erroraction(res.data.error)
} else {
wx.showModal({
showCancel: false,
title: '执行出错:',
content: res.data.error.message,
})
}
} else {
successaction(res.data)
}
@ -81,7 +85,7 @@ function transfer_request(method, params, successaction) {
url: baseUrl,
data: data,
header: {
'content-type': 'application/json'
'content-type': 'application/json'
},
method: 'POST',
success: function(res) {


Loading…
Cancel
Save