Commit d928c052 authored by Morson's avatar Morson

修改登录逻辑代码

parent 83626db6
...@@ -81,16 +81,15 @@ export default { ...@@ -81,16 +81,15 @@ export default {
this.getSystemInfo() this.getSystemInfo()
// 版本更新 // 版本更新
this.updateApp(); this.updateApp();
// 系统自动登录
this.autoLogin();
}, },
onShow: async function () { onShow: async function () {
// 应用启动,或从后台进入前台显示 // 应用启动,或从后台进入前台显示
// 等待自动授权登录接口调用结束
await this.autoLogin();
}, },
onHide: function () { onHide: function () {
// 应用从前台进入后台 // 应用从前台进入后台
}, },
methods: { methods: {
getSystemInfo() { getSystemInfo() {
...@@ -137,7 +136,11 @@ export default { ...@@ -137,7 +136,11 @@ export default {
* 微信用户自动登录 * 微信用户自动登录
*/ */
async autoLogin() { async autoLogin() {
let that = this; let that = this;
// 如果token不为空,则跳过自动登录
if(that.vuex_token) {
return
}
await login.oauth().then(async res => { await login.oauth().then(async res => {
if (res.code) { if (res.code) {
let params = { let params = {
...@@ -164,7 +167,6 @@ export default { ...@@ -164,7 +167,6 @@ export default {
if (userInfo && userInfo.token) { if (userInfo && userInfo.token) {
// 如果已经登录则直接获取相关信息 // 如果已经登录则直接获取相关信息
this.$u.vuex('vuex_token',userInfo.token); this.$u.vuex('vuex_token',userInfo.token);
this.$u.vuex('vuex_token',"RTOKEN7493e6defc2f1a77782f105dc297a9366763fec5");
this.$u.vuex('vuex_user', userInfo); this.$u.vuex('vuex_user', userInfo);
this.$u.vuex('vuex_wx_uid', userInfo.wxopenid); this.$u.vuex('vuex_wx_uid', userInfo.wxopenid);
} else { } else {
......
...@@ -59,19 +59,22 @@ const install = (Vue, vm) => { ...@@ -59,19 +59,22 @@ const install = (Vue, vm) => {
return config; return config;
} }
function getCode(res){ function getCode(res){
// const result = res.data || res const result = res.data || res
// let code // let code
// if(result.hasOwnProperty('statusCode')){ // if(result.hasOwnProperty('statusCode')){
// code = res.statusCode // code = res.statusCode
// }else if(result.hasOwnProperty('code')){ // }else if(result.hasOwnProperty('code')){
// code = result.code // code = result.code
// } // }
return res.statusCode || res.code || res.data.statusCode || res.data.code return result.statusCode || result.code || res.statusCode || res.code
} }
function getMsg(res){ function getMsg(res){
res = res.data || res res = res.data || res
let msg = res.message || res.errMsg || '请求错误' let msg = res.message || res.errMsg
return msg if(res.code == 200 || res.status == true || msg) {
return msg
}
return msg || '请求错误'
} }
// 响应拦截,判断状态码是否通过 // 响应拦截,判断状态码是否通过
Vue.prototype.$u.http.interceptor.response = (res) => { Vue.prototype.$u.http.interceptor.response = (res) => {
......
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
height="72" height="72"
margin="0 30rpx" margin="0 30rpx"
:animation="true" :animation="true"
:show-action="true"
:action-style="{ :action-style="{
'font-size': '32rpx', 'font-size': '32rpx',
'font-weight': 500, 'font-weight': 500,
'color': '#2272FF' 'color': '#2272FF'
}" }"
@search="searchOrder" @search="searchOrder"
@custorm="searchOrder" @custom="searchOrder"
></u-search> ></u-search>
</view> </view>
<view class="content-item"> <view class="content-item">
...@@ -81,43 +82,12 @@ ...@@ -81,43 +82,12 @@
self.search.pageNumber += 1 self.search.pageNumber += 1
self.$u.api.listOrder(self.search).then((res) => { self.$u.api.listOrder(self.search).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log("getOrderList", res.data)
var res = {
data: {
total: 15,
orderType: this.currentIndex,
list: [{
orderServiceType: '安装', // 服务类型:安装、维修
categoryName: '充电桩', // 品类:充电桩
orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池
orderNumber: 'OR2021041809827', // 工单编号
contactName: '郭小清', // 客户信息
contactPhone: '13631612077', // 联系方式
contactAddress: '湾街道荔枝花园D座125号', // 详细地址
contactAddressLatitud: '116.3896', // 联系人地址经度
contactAddressLongitud: '39.91917', // 联系人地址纬度
orderStatus: 0, // 工单状态
appointmentDatetime: '', // 预约时间
currentWillOverTime: 10000, // 剩余时间
currentOverTime: 0, // 超过时间
auditDatetime: '2021.04.19 12:45:09', // 审核时间
submissionTime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果
orderBusinessType: 'R', // 业务类型 R 为抢单
}]
}
}
res.data.list = [...res.data.list, ...res.data.list, ...res.data.list, ...res.data.list,
...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list]
// 后台需要返回order_type,防止数据返回延迟期间点击了其他的tab
if (res.data) { if (res.data) {
self.orderList.push(...res.data.list) self.orderList = res.data.list || []
self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore' self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
} }
} else { } else {
console.log(res.message, "获取订单数量失败!"); self.$u.toast(res.message);
} }
}); });
...@@ -128,11 +98,9 @@ ...@@ -128,11 +98,9 @@
}) })
}, },
handleClick(item) { handleClick(item) {
console.log('click cell')
this.viewOderItem(item.orderId) this.viewOderItem(item.orderId)
}, },
handleAction(item) { handleAction(item) {
console.log('click button')
this.viewOderItem(item.orderId) this.viewOderItem(item.orderId)
}, },
}, },
......
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