@@ -4,7 +4,7 @@ const {request} = require("../request/index") | |||
*/ | |||
export const getOpenId = function (code) { | |||
return request({ | |||
url: `/wx/openid/${code}`, | |||
url: `/wx/openIdAndUnionId/${code}`, | |||
method: 'GET', | |||
}) | |||
} |
@@ -1,6 +1,6 @@ | |||
const __request_base_url__ = { | |||
develop: "http://192.168.11.11:9061/api", | |||
// develop: "https://qmhhapi-test.t-aaron.com/api", | |||
// develop: "http://192.168.11.11:9061/api", | |||
develop: "https://qmhhapi-test.t-aaron.com/api", | |||
trial: "https://qmhhapi-test.t-aaron.com/api", | |||
release: "https://qmhh.t-aaron.com/api" | |||
} |
@@ -39,7 +39,7 @@ Page({ | |||
{ | |||
title:'积分商城', | |||
iconPath: '../../assets/first/stores.png', | |||
path: '/pages/index/index', | |||
path: '/package_A/pages/stores/index', | |||
type: 'mini' | |||
}, | |||
{ | |||
@@ -85,7 +85,10 @@ Page({ | |||
}, | |||
onShow() { | |||
this.getOnliveNum() | |||
let tenant = wx.getStorageSync('tenant') | |||
if(Object.keys(tenant).length) { | |||
this.getOnliveNum() | |||
} | |||
}, | |||
@@ -134,13 +137,23 @@ Page({ | |||
url: path, | |||
}) | |||
} else if(type === 'mini'){ | |||
wx.navigateToMiniProgram({ | |||
appId: 'wx57d8902569fbf5e1', | |||
path, | |||
envVersion: 'develop', | |||
success(res) { | |||
} | |||
}) | |||
const { tenantCode, tenantId } = wx.getStorageSync('tenant') | |||
if(tenantId === 5){ | |||
wx.navigateToMiniProgram({ | |||
appId: 'wx57d8902569fbf5e1', | |||
path: `pages/index/index?tenantCode=${tenantCode}`, | |||
extraData: { | |||
tenantCode | |||
}, | |||
envVersion: env, | |||
success(res) { | |||
} | |||
}) | |||
}else{ | |||
wx.navigateTo({ | |||
url: path, | |||
}) | |||
} | |||
} else { | |||
wx.navigateTo({ | |||
url: path, |
@@ -22,6 +22,7 @@ Page({ | |||
fromType: 'tabbar', | |||
tenantId: '', | |||
tenantCurrent: -1, // 当前选择的租户数据index | |||
tenantCode: null, | |||
tenantOptions: [], // 租户列表 | |||
formRules: { | |||
tenantId: { | |||
@@ -103,11 +104,12 @@ Page({ | |||
this.setData({tenantCurrent, tenantId}) | |||
} | |||
const openid = wx.getStorageSync('openid') | |||
const unionid = wx.getStorageSync('unionid') | |||
if(openid) { | |||
this.setData({openid}) | |||
this.setData({openid,unionid}) | |||
} else { | |||
getOpenidData().then(res=> { | |||
this.setData({openid: res.openid}) | |||
this.setData({openid: res.openid, unionid: res.unionid}) | |||
}) | |||
} | |||
}, | |||
@@ -155,9 +157,11 @@ Page({ | |||
selectTenant(e) { | |||
const tenantCurrent = e.detail.value | |||
let tenantId = this.data.tenantOptions[tenantCurrent].id | |||
let tenantCode = this.data.tenantOptions[tenantCurrent].code | |||
this.setData({ | |||
tenantCurrent, | |||
tenantId | |||
tenantId, | |||
tenantCode | |||
}) | |||
this.validate('tenantId') | |||
}, | |||
@@ -287,11 +291,12 @@ Page({ | |||
goHome() { | |||
this.validateForm().then(res => { | |||
if(res) { | |||
enterMini({openid: this.data.openid, tenantId: this.data.tenantId}).then(item=> { | |||
enterMini({openid: this.data.openid, unionid: this.data.unionid, tenantId: this.data.tenantId}).then(item=> { | |||
if(item.code === 0) { | |||
const tenantObj = { | |||
tenantCurrent: this.data.tenantCurrent, | |||
tenantId: this.data.tenantId | |||
tenantId: this.data.tenantId, | |||
tenantCode: this.data.tenantCode, | |||
} | |||
wx.setStorage({ | |||
key: 'tenant', |
@@ -6,12 +6,16 @@ export function getOpenidData() { | |||
let code = result.code | |||
getOpenId(code).then(i=> { | |||
if(i.code === 0) { | |||
const openid = i.data | |||
const {openId,unionId} = i.data | |||
wx.setStorage({ | |||
key: 'openid', | |||
data: openid | |||
data: openId | |||
}) | |||
resolve({openid}) | |||
wx.setStorage({ | |||
key: 'unionid', | |||
data: unionId | |||
}) | |||
resolve({openid: openId,unionid: unionId}) | |||
} | |||
}) | |||
} |