diff --git a/gasStation-uni/pagesHome/Address/Address.vue b/gasStation-uni/pagesHome/Address/Address.vue index b45ae2987..cf538b1a7 100644 --- a/gasStation-uni/pagesHome/Address/Address.vue +++ b/gasStation-uni/pagesHome/Address/Address.vue @@ -7,21 +7,22 @@ - - + + - 默认 - 具体的详细地址 + 默认 + {{item.address}} - 用户姓名 - 186549451154 + {{item.name}} + {{item.mobile}} - + + 新增收货地址 @@ -31,24 +32,54 @@ diff --git a/gasStation-uni/pagesLogin/login/login.vue b/gasStation-uni/pagesLogin/login/login.vue index d5791f7da..cb4953865 100644 --- a/gasStation-uni/pagesLogin/login/login.vue +++ b/gasStation-uni/pagesLogin/login/login.vue @@ -2,7 +2,7 @@ - + @@ -10,7 +10,7 @@ - + { console.log('请求成功', rex) if (rex.data.code == 200) { - - uni.setStorageSync('App-Token', rex.data.data.token); - + + uni.setStorageSync('App-Token', rex.data.data + .token); + uni.navigateTo({ + url: '/pages/index/index' + }) } - console.log("swq",uni.getStorageSync('App-Token')); + console.log("swq", uni.getStorageSync( + 'App-Token')); }, fail: (res) => { console.log("fail", res); @@ -154,14 +156,16 @@ position: fixed; top: 0px; } - .dl{ + + .dl { height: 40px; background: #2F72F7; border-radius: 50px; } - .top-box{ + + .top-box { width: 100%; height: 60vh; background: url('http://47.95.206.185:83/lgoin.png')center no-repeat; @@ -169,14 +173,16 @@ background-attachment: fixed; } - .dl-box{ + + .dl-box { width: 80%; height: 45px; background: #2F72F7; color: white; border-radius: 50px; } - .kk-box{ + + .kk-box { width: 80%; height: 45px; background: #F0F3FA; @@ -185,6 +191,7 @@ border: 1px solid #F0F3FA; margin: 10px auto; } + .dbottom { width: 100%; text-align: center; @@ -263,4 +270,4 @@ border: 1px solid #0078FF; color: white; } - + \ No newline at end of file diff --git a/gasStation-uni/pagesMy/integral/integral.vue b/gasStation-uni/pagesMy/integral/integral.vue index 0e6145360..362b37cfc 100644 --- a/gasStation-uni/pagesMy/integral/integral.vue +++ b/gasStation-uni/pagesMy/integral/integral.vue @@ -12,10 +12,10 @@ 我的积分 - 0 + {{myPoints}} - - 积分上传 + + 积分签到 @@ -50,35 +50,42 @@ data() { return { title: '', - myPoints:0, // 我的积分 + myPoints: 0, // 我的积分 } }, components: { + }, + onShow() { + this.getUserInfoList(); }, methods: { // 查询我的积分 - getUserInfoList(){ + getUserInfoList() { request({ - url: '/business/userManager/user/name/'+1, + url: '/business/userManager/user/getByUniApp', method: 'get', // params:{} - }).then((res)=>{ - if(res.code == 200){ - - console.log("hello world",res) + }).then((res) => { + if (res.code == 200) { + this.myPoints = res.data.points } }) }, // 去加油 - comeOn () {}, + comeOn() {}, // 去充值 - recharge () {}, - + recharge() {}, + goback() { uni.navigateBack() + }, + + // 先查询今天是否签到过 + login() { + } } } diff --git a/gasStation-uni/utils/request.js b/gasStation-uni/utils/request.js index 9f49a62d3..70c25c2b6 100644 --- a/gasStation-uni/utils/request.js +++ b/gasStation-uni/utils/request.js @@ -1,71 +1,81 @@ import store from '@/store' import config from '@/config' -import { getToken } from '@/utils/auth' +import { + getToken +} from '@/utils/auth' import errorCode from '@/utils/errorCode' -import { toast, showConfirm, tansParams } from '@/utils/common' +import { + toast, + showConfirm, + tansParams +} from '@/utils/common' let timeout = 10000 const baseUrl = config.baseUrl const request = config => { - // 是否需要设置 token - const isToken = (config.headers || {}).isToken === false - config.header = config.header || {} - if (getToken() && !isToken) { - // config.header['Authorization'] = getToken() - config.header['Access-Token'] = getToken() - } - // get请求映射params参数 - if (config.params) { - let url = config.url + '?' + tansParams(config.params) - url = url.slice(0, -1) - config.url = url - } - return new Promise((resolve, reject) => { - uni.request({ - method: config.method || 'get', - timeout: config.timeout || timeout, - url: config.baseUrl || baseUrl + config.url, - data: config.data, - header: config.header, - dataType: 'json' - }).then(response => { - // debugger - let res = response - - const code = res.data.code || 200 - const msg = errorCode[code] || res.data.msg || errorCode['default'] - if (code === 401) { - showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { - if (res.confirm) { - store.dispatch('LogOut').then(res => { - uni.reLaunch({ url: '/pages/login/login' }) - }) - } - }) - reject('无效的会话,或者会话已过期,请重新登录。') - } else if (code === 500) { - toast(msg) - reject('500') - } else if (code !== 200) { - toast(msg) - reject(code) - } - resolve(res.data) - }) - .catch(error => { - let { message } = error - if (message === 'Network Error') { - message = '后端接口连接异常' - } else if (message.includes('timeout')) { - message = '系统接口请求超时' - } else if (message.includes('Request failed with status code')) { - message = '系统接口' + message.substr(message.length - 3) + '异常' - } - toast(message) - reject(error) - }) - }) + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + config.header = config.header || {} + if (getToken() && !isToken) { + // config.header['Authorization'] = getToken() + config.header['Access-Token'] = getToken() + } + // get请求映射params参数 + if (config.params) { + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.url = url + } + return new Promise((resolve, reject) => { + uni.request({ + method: config.method || 'get', + timeout: config.timeout || timeout, + url: config.baseUrl || baseUrl + config.url, + data: config.data, + header: config.header, + dataType: 'json' + }).then(response => { + // debugger + let res = response + + const code = res.data.code || 200 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + if (code === 401) { + showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { + if (res.confirm) { + store.dispatch('LogOut').then(res => { + uni.reLaunch({ + url: 'pagesLogin/login/login' + }) + }) + } + }) + reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + toast(msg) + reject('500') + } else if (code !== 200) { + toast(msg) + reject(code) + } + resolve(res.data) + }) + .catch(error => { + let { + message + } = error + if (message === 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + toast(message) + reject(error) + }) + }) } -export default request +export default request \ No newline at end of file