Commit b26f6231 by 匡雅琴

Merge branch 'master' into kuangyq_v2.10.0

2 parents 987c7e3a 5128e50c
...@@ -24,6 +24,8 @@ class Request { ...@@ -24,6 +24,8 @@ class Request {
let header = RequestMethods === 'POST' ? { let header = RequestMethods === 'POST' ? {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
} : {} } : {}
const merchantId = wx.$util.getStorageSync('srcm_shopmall_merchant_id')
if (merchantId) header.merchantId = merchantId
let projectName = this.getRopProject(params.method) let projectName = this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method) if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName] const path = pathEnum[projectName]
...@@ -37,6 +39,45 @@ class Request { ...@@ -37,6 +39,45 @@ class Request {
responseType: 'text', responseType: 'text',
success(response) { success(response) {
/**业务代码 */ /**业务代码 */
let {
data: {
code,
message
},
data
} = response
if (code == 20 || code == 21) {
wx.hideLoading()
const thisPage = wx.$router.getPageInstance()
if (thisPage && thisPage.pageRefresh) thisPage.pageRefresh()
if (!wx.$authStatus) {
if (INTERRUPT) return
INTERRUPT = true
wx.showLoading()
getApp().login().then(() => {
if (thisPage.init && thisPage.data.userInfo) thisPage.init()
if (thisPage.loginCallBack && thisPage.data.userInfo) thisPage.loginCallBack(thisPage.data.userInfo)
if (thisPage.onRoute) thisPage.onRoute()
thisPage.onLoad()
thisPage.onShow()
INTERRUPT = false
})
}
} else {
if (returnAll) {
resolve(data)
return
}
if (code == '0') {
resolve(data.data)
} else {
console.log(data)
wx.showToast({
title: message || '系统异常',
icon: 'none'
})
}
}
}, },
fail(error) { fail(error) {
wx.hideLoading() wx.hideLoading()
...@@ -82,5 +123,22 @@ class Request { ...@@ -82,5 +123,22 @@ class Request {
const projectName = method.split('.')[2] const projectName = method.split('.')[2]
return projectName return projectName
} }
getMock() {
let url = 'https://oss-config.dev.glsx.com.cn/mock/6264ff4760f415276f6dfe62/config'
if (index == 3) url = 'https://oss-config.test.glsx.com.cn/mock/6274e3050da5034a58680aa6/config'
return new Promise((resolve) => {
wx.request({
url,
data: {},
method: 'GET',
header: {},
dataType: 'json',
responseType: 'text',
success(response) {
resolve(response.data)
}
})
})
}
} }
export default new Request() export default new Request()
\ No newline at end of file \ No newline at end of file
...@@ -10,6 +10,7 @@ App({ ...@@ -10,6 +10,7 @@ App({
/**挂载到wx对象 */ /**挂载到wx对象 */
wx.$util = util wx.$util = util
wx.$router = router wx.$router = router
wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
const systemInfo = wx.getStorageSync('srcm_shopmall_system_info') const systemInfo = wx.getStorageSync('srcm_shopmall_system_info')
if (!systemInfo) wx.getSystemInfo({ if (!systemInfo) wx.getSystemInfo({
success(res) { success(res) {
......
// pages/experience/experience.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!--pages/experience/experience.wxml-->
<text>pages/experience/experience.wxml</text>
/* pages/experience/experience.wxss */
\ No newline at end of file \ No newline at end of file
...@@ -20,7 +20,7 @@ Page({ ...@@ -20,7 +20,7 @@ Page({
} }
}, },
jump() { jump() {
wx.$router.go("experience"); wx.$router.go("applicationAccount");
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
......
<template name="demo"> <template name="demo">
<view class="bg">这是一个demo模板</view> <view class="bg">这是一个demo模板</view>
<button bindtap="jump">跳转</button>
</template> </template>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!