Commit bbe47c40 authored by 李俊赕's avatar 李俊赕

edit-combine

parent a3f57b0b
//免登录接口 //免登录接口
import util from '@/utils/util.js'
let noLoginUrl = [ let noLoginUrl = [
'/addons/cms/wxapp.user/getworkertype', '/addons/cms/wxapp.user/getworkertype',
'/api/cmstag/tagListByType', '/api/cmstag/tagListByType',
...@@ -59,6 +60,7 @@ const getSessionId = function(vm) { ...@@ -59,6 +60,7 @@ const getSessionId = function(vm) {
// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token // 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的 // 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的
import globalUrl from '@/common/base_url.js' import globalUrl from '@/common/base_url.js'
const app = getApp()
const install = (Vue, vm) => { const install = (Vue, vm) => {
// let url = 'https://fa.yunya.com' // let url = 'https://fa.yunya.com'
let apiBaseUrl = globalUrl.codeUrl.apiBaseUrl;// 故障码apiuri let apiBaseUrl = globalUrl.codeUrl.apiBaseUrl;// 故障码apiuri
...@@ -84,8 +86,20 @@ const install = (Vue, vm) => { ...@@ -84,8 +86,20 @@ const install = (Vue, vm) => {
// // vm.$u.route('/pages/login/wxlogin'); // // vm.$u.route('/pages/login/wxlogin');
// return false; // return false;
// } // }
config.header.token = vm.vuex_token || 'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b'; const reg = /\?\w+/;
config.header.Authorization = vm.vuex_token || 'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b'; console.log(util,'util')
let token = util.getToken()
if(!token){
vm.$u.route('/pages/login/wxlogin');
}
// const token = app && app.globalData && app.globalData.token || ''
if(reg.test(config.url)){
config.url += '&access-token=' + token
}else{
config.url += '?access-token=' + token
}
// config.header.token = vm.vuex_token || 'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b';
config.header.Authorization = token
// 临时测试 token -- 开发环境 // 临时测试 token -- 开发环境
// if (apiUrl == 'http://fa.yunya.com') { // if (apiUrl == 'http://fa.yunya.com') {
// config.header.token = '0edjXh5micAR3Lf1tkNtObcUtLMdiVGCVOxlkca_PyTi0CFdyo5kF3TMdSEO8wBDHJh8CwDOTCfzvpLeavzLNg'; // config.header.token = '0edjXh5micAR3Lf1tkNtObcUtLMdiVGCVOxlkca_PyTi0CFdyo5kF3TMdSEO8wBDHJh8CwDOTCfzvpLeavzLNg';
...@@ -98,10 +112,10 @@ const install = (Vue, vm) => { ...@@ -98,10 +112,10 @@ const install = (Vue, vm) => {
// if(config.method=='POST'){ // if(config.method=='POST'){
// config.data['__token__'] = vm.vuex__token__; // config.data['__token__'] = vm.vuex__token__;
// } // }
if(config.url.indexOf(apiBaseUrl)>=0){ // if(config.url.indexOf(apiBaseUrl)>=0){
// 快查相关页面临时参数 // // 快查相关页面临时参数
config.header['Authorize'] = vm.vuex_token; // config.header['Authorize'] = vm.vuex_token;
} // }
return config; return config;
} }
// 响应拦截,判断状态码是否通过 // 响应拦截,判断状态码是否通过
......
...@@ -7,6 +7,8 @@ Vue.use(uView); ...@@ -7,6 +7,8 @@ Vue.use(uView);
Vue.config.productionTip = false Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
// let vuexStore = require('@/store/$u.mixin.js')
// Vue.mixin(vuexStore)
const app = new Vue({ const app = new Vue({
...App ...App
...@@ -15,7 +17,8 @@ app.$mount() ...@@ -15,7 +17,8 @@ app.$mount()
// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用 // http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
import httpInterceptor from '@/common/http.interceptor.js' import httpInterceptor from '@/common/http.interceptor.js'
Vue.use(httpInterceptor, app) Vue.use(httpInterceptor, app)
// http接口API抽离,免于写url或者一些固定的参数 // http接口API抽离,免于写url或者一些固定的参数
import httpApi from '@/common/http.api.js' import httpApi from '@/common/http.api.js'
......
...@@ -228,7 +228,8 @@ ...@@ -228,7 +228,8 @@
return; return;
} }
this.info = res.data.record this.info = res.data.record
this.baseInfo.name = this.info.name // this.baseInfo.name = this.info.name
this.baseInfo.id = this.info.id
console.log(this.info,'res') console.log(this.info,'res')
return true return true
}, },
...@@ -238,6 +239,10 @@ ...@@ -238,6 +239,10 @@
const params = { const params = {
...baseInfo, ...baseInfo,
} }
console.log(params.pay_type,'params.pay_type')
if(params.pay_type==='alipay'){
params.bank_site = '支付宝'
}
const res = this.$u.api.checkSettleSignInfo(params) const res = this.$u.api.checkSettleSignInfo(params)
if (res.status != 200) { if (res.status != 200) {
uni.showToast({ uni.showToast({
......
...@@ -2,6 +2,14 @@ var t = function(t) { ...@@ -2,6 +2,14 @@ var t = function(t) {
return (t = t.toString())[1] ? t : "0" + t; return (t = t.toString())[1] ? t : "0" + t;
}; };
const getToken = function(){
const app = getApp()
let token = app && app.globalData && app.globalData.token || ''
if(!token){
token = uni.getStorageSync('token')
}
return token
}
module.exports = { module.exports = {
formatTime: function(n) { formatTime: function(n) {
var e = n.getFullYear(), r = n.getMonth() + 1, o = n.getDate(), i = n.getHours(), u = n.getMinutes(), a = n.getSeconds(); var e = n.getFullYear(), r = n.getMonth() + 1, o = n.getDate(), i = n.getHours(), u = n.getMinutes(), a = n.getSeconds();
...@@ -22,5 +30,6 @@ module.exports = { ...@@ -22,5 +30,6 @@ module.exports = {
return e > 0 && (o = 60 * (o = "0" + t.substring(e)) + "", 2 == n ? (e = o.indexOf(".")) > 0 && (i = "0" + o.substring(e), return e > 0 && (o = 60 * (o = "0" + t.substring(e)) + "", 2 == n ? (e = o.indexOf(".")) > 0 && (i = "0" + o.substring(e),
o = o.substring(0, e), e = (i = 60 * i + "").indexOf("."), i = i.substring(0, e + 4), o = o.substring(0, e), e = (i = 60 * i + "").indexOf("."), i = i.substring(0, e + 4),
i = parseFloat(i).toFixed(0)) : 1 == n && (o = parseFloat(o).toFixed(6))), 2 == n ? r + "°" + o + "′" + i + "″" : 1 == n ? r + "°" + o + "′" : void 0; i = parseFloat(i).toFixed(0)) : 1 == n && (o = parseFloat(o).toFixed(6))), 2 == n ? r + "°" + o + "′" + i + "″" : 1 == n ? r + "°" + o + "′" : void 0;
} },
getToken
}; };
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment