Commit 1bfd8d22 by 张立顺

Merge branch 'develop' of 192.168.3.233:saas_plus/business-assistant into develop

2 parents 9b49f4ca 0df974e1
import api from '~/utils/request/request'
const { appId } = wx.getAccountInfoSync().miniProgram
const {
appId
} = wx.getAccountInfoSync().miniProgram
class UsersApi {
/**调用后台接口获取用户信息 */
async login() {
return this.getWxCode().then(({ code }) => {
return api.post(
{
method: 'scrm.api.sso.weapp.jscode.login',
appId,
code
},
true
)
})
/**调用后台接口获取用户信息js_code换取sessionId */
async wxCodeLogin() {
const {
code
} = await this.getWxCode()
return await api.post({
method: 'scrm.api.sso.wechat.applets.jscode.login',
appId,
code
},
true
)
}
/**退出登录 */
logout() {
return api.post({
method: 'scrm.api.sso.wechat.applets.logout'
},
true
)
}
/**调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。 */
getWxCode() {
......@@ -23,39 +33,75 @@ class UsersApi {
})
})
}
/**授权手机号 */
async authUserPhone(detail, sessionId) {
if (!sessionId) {
wx.$api.showToast('缺少sessionId')
/**授权手机号登录 */
async authUserPhone(detail, loginToken) {
if (!loginToken) {
wx.$api.showToast('缺少loginToken')
Promise.reject()
return
}
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
wx.$api.showLoading()
detail.sessionId = sessionId
return api.post(
{
method: 'scrm.api.sso.weapp.auth.phone',
...detail
detail.loginToken = loginToken
return api.post({
method: 'scrm.api.sso.wechat.applets.auth.phone',
...detail,
platformEntrance: 'BUSINESS_ASSISTANT', // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
},
true
)
} else Promise.reject()
}
/**更新客户手机号 */
updataCustomerPhone() {
let customerId = wx.$storage.get('srcm_shopmall_customer_id'),
merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
api
.post({
method: 'scrm.api.sso.weapp.mark.phone',
customerId,
merchantId
})
.then(() => {
wx.removeStorageSync('srcm_shopmall_customer_id')
})
/**账号密码登录 */
accountLogin(data = {}) {
return api.post({
method: 'scrm.api.sso.wechat.applets.password.login',
...data,
platformEntrance: 'BUSINESS_ASSISTANT',
},
true
)
}
/** 手机号获取短信验证码 */
getSmsCode(mobile) {
return api.post({
method: 'scrm.api.sso.wechat.applets.sms.get.code',
mobile
},
true
)
}
/** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) {
return api.post({
method: 'scrm.api.sso.wechat.applets.sms.login',
...data,
source: 'MINIAPP',
platformEntrance: 'BUSINESS_ASSISTANT'
},
true
)
}
/** 获取登录账号列表 */
getAccountList() {
return api.post({
method: 'scrm.api.sso.wechat.applets.listSelectAccount',
platformEntrance: 'BUSINESS_ASSISTANT'
},
true
)
}
/**
* 选择账号登录(手机绑定多个账号时) */
selectAccountLogin(data) {
return api.post({
method: 'scrm.api.sso.wechat.applets.selectAccountLogin',
platformEntrance: 'BUSINESS_ASSISTANT',
...data
},
true
)
}
}
export default UsersApi
export default UsersApi
\ No newline at end of file
{
"pages": ["login/loading/loading", "pages/tab/index/index", "pages/tab/output/output", "pages/tab/mine/mine", "pages/webView/webView", "login/index/index"],
"pages": ["login/loading/loading", "pages/tab/index/index", "pages/tab/output/output", "pages/tab/mine/mine", "pages/webView/webView", "login/index/index","login/accountItems/accountItems"],
"requiredPrivateInfos": ["getLocation"],
"lazyCodeLoading": "requiredComponents",
"window": {
......
// pages/accountItems/accountItems.js
import USERAPI from '~/api/usersApi/index'
Page({
/**
* 页面的初始数据
*/
data: {
/**accountLevel 1工厂。2省 ,3市。4门店 */
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getListSelectAccount()
},
getListSelectAccount() {
wx.$util.showLoading('加载中...')
api.getListSelectAccount().then(res => {
wx.hideLoading()
console.log(res)
let {
code,
data,
message
} = res
if (code == 0) {
let {
loginUserInfoList,
sessionId
} = data
wx.$util.setSessionId(sessionId)
this.setData({
loginUserInfoList
})
} else {
wx.$util.showToast(message)
}
this.setData({
flag: true
})
})
},
chooseAccount(e) {
let {
index
} = e.currentTarget.dataset
let {
loginUserInfoList
} = this.data
if (loginUserInfoList[index].active) return
loginUserInfoList.map(i => (i.active = false))
loginUserInfoList[index].active = true
this.setData({
loginUserInfoList
})
},
choiceAccountLogin() {
let {
loginUserInfoList
} = this.data
let id = null
loginUserInfoList.map(e => {
if (e.active) id = e.uuid
})
if (!id) {
wx.$util.showToast('请选择账号')
return
}
wx.$util.showLoading()
api.selectAccountLogin({
id
}).then(res => {
let {
data,
message
} = res
if (data) {
wx.$util.setUserInfo(data.loginUserInfoList[0])
const SCENE = wx.$SCENE
if (SCENE) {
let {
path,
query: {
scene
}
} = SCENE
let {
target,
name
} = wx.$util.getSceneId(path)
wx.$router.reLaunch(`${target}.${name}`, {
scene
})
wx.$SCENE = null
} else {
wx.$router.reLaunch('tabIndex.index')
}
} else {
wx.$util.showToast(message)
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
wx.hideHomeButton()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
})
\ No newline at end of file
{
"navigationBarTitleText": "选择账号"
}
\ No newline at end of file
/* login/accountItems/accountItems.wxss */
.layout {
margin: 40rpx 40rpx 0;
font-size: 28rpx;
color: #333;
letter-spacing: 0;
}
.title {
margin-bottom: 32rpx;
}
.items {
width: 100%;
min-height: 104rpx;
box-shadow: 0 0 8rpx 0 rgba(0, 0, 0, 0.15);
padding: 32rpx;
margin-bottom: 40rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
.items .name{
width: calc(100% - 70rpx);
}
.items:last-of-type {
margin-bottom: 0;
}
.radio {
width: 32rpx;
height: 32rpx;
border: 2rpx solid #cccccc;
border-radius: 100%;
transition: all .2s;
}
.icon {
width: 36rpx;
height: 36rpx;
transition: all .2s;
display: none;
}
.active .icon {
display: block;
}
.active .radio{
display: none;
}
.btn-box {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 140rpx;
display: flex;
justify-content: center;
align-items: center;
z-index: 20;
background-color: #fff;
border-radius: 40rpx;
font-size: 32rpx;
color: #fff;
letter-spacing: 13rpx;
}
.isFullSucreen-btn {
padding-bottom: 34px !important;
}
.btn {
width: calc(100% - 80rpx);
height: 80rpx;
line-height: 80rpx;
text-align: center;
background-color: #3582EE;
border-radius: 16rpx;
}
.list-not{
font-size: 40rpx;
}
\ No newline at end of file
<view class="layout" style="padding-bottom:{{isFullSucreen?'224rpx':'160rpx'}}">
<view class="title">请选择登录的账号</view>
<view class="list">
<block wx:if="{{flag}}">
<block wx:if="{{loginUserInfoList}}">
<block wx:for="{{loginUserInfoList}}" wx:key="index">
<view class="items {{item.active?'active':''}}" bindtap="chooseAccount" data-index="{{index}}">
<view class="name">
{{item.merchantName}}{{item.isSuper==true?'(超管)':item.userType==1?'(商户号)':'(员工号)'}}
</view>
<view class="icon">
<image src="/images/active-arc.png" />
</view>
<view class='radio' />
</view>
</block>
</block>
<block wx:else>
<view class="list-not" style="height: calc(100vh - {{isFullSucreen ? '159' :'125'}}px)" bindtap="getListSelectAccount">
点击刷新
</view>
</block>
</block>
</view>
<view class="btn-box {{isFullSucreen?'isFullSucreen-btn':''}}">
<view class='btn' bindtap="choiceAccountLogin">确定</view>
</view>
</view>
// login/index/components/LoginBox.js
import USERAPI from '~/api/usersApi/index'
import { setSessionId } from '~/utils/cache/storageApi'
let thisPage
const countDown = 60
Component({
options: {
styleIsolation: 'shared'
......@@ -19,10 +20,10 @@ Component({
*/
data: {
formData: {
phone: '',
code: '',
account: '',
password: ''
phone: '13714966184',
code: '8888',
account: 'admin',
password: '123456789'
},
phoneReady: false,
countDown: null
......@@ -32,6 +33,11 @@ Component({
* 组件的方法列表
*/
methods: {
hideError(name) {
if (name == 'code') this.setData({
smsError: false
})
},
input(e) {
const {
value
......@@ -44,6 +50,7 @@ Component({
if (name == 'phone') this.setData({
phoneReady: thisPage.validate.methods.tel(value)
})
this.hideError(name)
this.checkFormData()
},
clear(e) {
......@@ -53,20 +60,40 @@ Component({
this.setData({
[`formData.${name}`]: ''
})
this.hideError(name)
this.checkFormData()
},
getSms() {
getSmsCode() {
const {
phoneReady,
formData,
count
} = this.data
} = this.data,
countDown = 60
if (!phoneReady || count) return
this.setData({
count: countDown
smsLoading: true
})
USERAPI.getSmsCode(formData.phone).then(({
code,
message
}) => {
this.setData({
smsLoading: false
})
if (code == '0') this.countDown(countDown)
else wx.$api.showToast(message || '发送验证码失败')
}).catch(err => {
this.setData({
smsLoading: false
})
wx.$api.showToast(err || '发送验证码失败')
})
this.countDown()
},
countDown() {
countDown(countDown) {
if (countDown) this.setData({
count: countDown
})
setTimeout(() => {
let {
count
......@@ -101,17 +128,74 @@ Component({
})
},
login() {
const {
formData,
loginType
} = this.data,
target = {
1: 'phoneSmsLogin',
2: 'accountLogin'
} [loginType],
obj = loginType == 1 ? {
mobile: formData.phone,
code: formData.code
} : {
userName: formData.account,
password: formData.password
}
this.setBtnLoading()
setTimeout(() => {
USERAPI[target](obj).then(({
code,
data,
message
}) => {
this.setBtnLoading(false)
}, 5e3)
if (code == '0') {} else {
if (loginType == 1) this.setData({
smsError: true
})
wx.$api.showToast(message || '系统异常')
}
}).catch(err => {
wx.$api.showToast('系统异常')
this.setBtnLoading(false)
})
},
wxLogin({detail}) {
if(!detail.code) return
wxLogin({
detail
}) {
if (!detail.code) return
this.setBtnLoading()
setTimeout(() => {
USERAPI.authUserPhone(detail, this.loginToken).then(({
code,
data,
message
}) => {
if (code == '0') {
const {
loginUserInfoList,
sessionId
} = data
if (loginUserInfoList.length > 1) {
wx.$router.go('login.accountItems')
} else {
wx.$router.go('login.accountItems')
USERAPI.selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
}).then(res =>{
console.log(res)
setSessionId(sessionId)
})
}
} else wx.$api.showToast(message || '系统异常')
this.setBtnLoading(false)
}, 5e3)
}).catch(({
errMsg
}) => {
wx.$api.showToast(errMsg || '系统异常')
this.setBtnLoading(false)
})
},
setBtnLoading(loading = true) {
thisPage.setData({
......@@ -120,15 +204,45 @@ Component({
this.setData({
loading
})
},
async init() {
thisPage = wx.$router.getPageInstance()
wx.$api.showLoading()
try {
const {
data,
code,
message
} = await USERAPI.wxCodeLogin()
if (code == '0') {
thisPage.setData({
disabled: false
})
this.loginToken = data
} else this.reLogin(message)
wx.hideLoading()
} catch ({
errMsg
}) {
console.error(errMsg)
this.reLogin()
}
},
reLogin(message) {
wx.showModal({
content: message || '获取loginToken失败',
confirmText: '重试',
confirmColor: '#3666FE'
}).then(({
confirm
}) => {
if (confirm) this.init()
})
}
},
lifetimes: {
attached: function () {
// 在组件实例进入页面节点树时执行
USERAPI.login().then(res => {
console.log(res)
})
thisPage = wx.$router.getPageInstance()
this.init()
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
......
......@@ -47,16 +47,16 @@
}
.sms {
width: 130rpx;
width: 160rpx;
flex-shrink: 0;
color: #5092FF;
font-size: 24rpx;
padding: 0;
text-align: right;
&[disabled]:not([type]){
color: #CCCED1;
}
}
.sms-disabled {
color: #CCCED1;
}
.error {
position: absolute;
font-size: 24rpx;
......
......@@ -11,11 +11,11 @@
<input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" />
</view>
<view class="input">
<input type="number" placeholder="填写验证码" placeholder-class="placeholder" bindinput="input" data-name="code" value="{{formData.code}}" maxlength="6" />
<input type="number" placeholder="填写验证码" placeholder-class="placeholder" bindinput="input" data-name="code" value="{{formData.code}}" maxlength="4" />
<input-icon show="{{formData.code}}" bindtap="clear" data-name="code" />
<view class="sms text-center {{count?'sms-disabled':''}} {{phoneReady?'':'sms-disabled'}} " bindtap="getSms">{{
<button class="sms text-center " bindtap="getSmsCode" disabled="{{count || !phoneReady}}" loading="{{smsLoading}}">{{
count? count + 's':'获取验证码'
}}</view>
}}</button>
<block wx:if="{{smsError}}">
<view class="error">验证码错误</view>
</block>
......@@ -23,7 +23,7 @@
</block>
<block wx:else>
<view class="input">
<input type="text" placeholder="填写账号名" placeholder-class="placeholder" bindinput="input" data-name="account" value="{{formData.account}}" maxlength="20" />
<input type="text" placeholder="填写账号" placeholder-class="placeholder" bindinput="input" data-name="account" value="{{formData.account}}" maxlength="20" />
<input-icon show="{{formData.account}}" bindtap="clear" data-name="account" />
</view>
<view class="input">
......
......@@ -6,9 +6,11 @@ Page({
*/
data: {
loginType: 0,
agree: true
disabled: true
},
onRoute(options){
console.log(options)
},
/**
* 生命周期函数--监听页面加载
*/
......@@ -31,7 +33,6 @@ Page({
wx.hideLoading()
}
})
this.checkLoginBtn()
},
/**
......@@ -60,23 +61,23 @@ Page({
// onShareAppMessage() {
// },
checkLoginBtn(flag = false) {
checkLoginBtn(disabled = false) {
const {
agree,
loginType
} = this.data
if (loginType == 0) flag = true
else {
const {
} = this.data, {
data: {
formData,
phoneReady
} = this.selectComponent('#box').data
flag = loginType == 1 ?
phoneReady && formData.code :
formData.account && formData.password
}
},
loginToken
} = this.selectComponent('#box')
if (loginType == 0) {
disabled = loginToken
} else disabled = loginType == 1 ?
phoneReady && formData.code :
formData.account && formData.password
this.setData({
disabled: !agree || !flag
disabled: !disabled
})
},
})
\ No newline at end of file
......@@ -3,8 +3,7 @@
"navigation-bar": "/components/NavigationBar/NavigationBar",
"mask": "./components/Mask/Mask",
"box": "./components/Box/Box",
"type-list": "./components/TypeList/TypeList",
"protocol": "./components/Protocol/Protocol"
"type-list": "./components/TypeList/TypeList"
},
"navigationStyle": "custom"
}
\ No newline at end of file
......@@ -3,5 +3,5 @@
<navigation-bar navStyle="background-color: rgba(0,0,0,0)">生意助手</navigation-bar>
<box loginType="{{loginType}}" disabled="{{disabled}}" id="box" />
<type-list loginType="{{loginType}}" />
<protocol agree="{{agree}}" />
<!-- <protocol agree="{{agree}}" /> -->
</view>
\ No newline at end of file
......@@ -25,19 +25,24 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
wx.$api.showLoading()
const {
sessionId,
} = wx.$storage.get(), {
url,
path = decodeURIComponent(url)
targetPath = decodeURIComponent(url)
} = this.options
console.log(path)
if (sessionId) {
console.log(targetPath)
wx.nextTick(() => {
if (sessionId) {
// wx.$router.reLaunch('login.index')
} else {
wx.$router.reLaunch('login.index', {
targetPath
})
}
})
} else {
wx.$router.reLaunch('login.index')
}
},
/**
......
<view class="layout">
<image class="icon" src="https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/COVER_LIVE.gif"></image>
<!-- <image class="icon" src="https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/COVER_LIVE.gif"></image> -->
</view>
\ No newline at end of file
......@@ -13,6 +13,13 @@
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "携带目标页面",
"pathName": "login/loading/loading",
"query": "url=pages%2Ftab%2Findex%2Findex%3Fid%3D123",
"launchMode": "default",
"scene": null
}
]
}
......
......@@ -2,7 +2,6 @@ const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query')
const _routerList = Symbol('_routerList')
import {
wxOnAppRouteFn,
generateRoutList
} from './wxOnAppRoute.js'
import {
......@@ -17,15 +16,23 @@ class Router {
[_routerList] = []
constructor(router) {
this[_routerList] = generateRoutList(router)
let obj = {
query: this[_query],
routeHooks: this[_routeHooks],
routerList: this[_routerList],
getPageInstance: this.getPageInstance,
setNavigationBarTitleText: this.setNavigationBarTitleText,
getRouterList: this.getRouterList
}
wxOnAppRouteFn(obj)
wx.onAppRoute &&
wx.onAppRoute(e => {
let thisPage = this.getPageInstance()
if (thisPage) {
this.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
typeof onRoute === 'function' && onRoute(this[_query])
}
this[_routeHooks].forEach(fn => {
try {
typeof fn === 'function' && fn(e, this[_query], this[_routerList])
} catch (err) {
console.log(err)
}
})
this[_query] = {}
})
}
/**设置标题栏 */
setNavigationBarTitleText = thisPage => {
......@@ -72,10 +79,13 @@ class Router {
/**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */
if (!_name && !last_name) name = _parent
const routerMapItem = this[_routerList].find(item => {
if (last_name) {
return item.parent === parent && item.name === last_name && item.subPages === name
} else {
return item.parent === parent && item.name === name
if (route.includes('/')) return item.url === route
else {
if (last_name) {
return item.parent === parent && item.name === last_name && item.subPages === name
} else {
return item.parent === parent && item.name === name
}
}
})
if (!routerMapItem) {
......@@ -89,11 +99,8 @@ class Router {
}
/**跳转至H5 */
jumpH5(url) {
this.intercept().then(response => {
if (response) return
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
})
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
})
}
/**页面跳转
......@@ -117,20 +124,10 @@ class Router {
url: routerMapItem.url
})
} else {
if (events && events.notIntercept) {
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: res => events && res.eventChannel.emit('getData', events)
})
} else {
this.intercept().then(response => {
if (response) return
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: res => events && res.eventChannel.emit('getData', events)
})
})
}
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: res => events && res.eventChannel.emit('getData', events)
})
}
}
/**关闭所有页面,打开到应用内的某个页面 */
......@@ -139,11 +136,8 @@ class Router {
routerMapItem,
query
} = this.checkRouter(route, events)
this.intercept().then(response => {
if (response) return
wx.reLaunch({
url: `${routerMapItem.url}${query}`
})
wx.reLaunch({
url: `${routerMapItem.url}${query}`
})
}
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
......@@ -152,11 +146,8 @@ class Router {
routerMapItem,
query
} = this.checkRouter(route, events)
this.intercept().then(response => {
if (response) return
wx.redirectTo({
url: `${routerMapItem.url}${query}`
})
wx.redirectTo({
url: `${routerMapItem.url}${query}`
})
}
/**prevPageSize = 1
......@@ -173,7 +164,7 @@ class Router {
}
goHome() {
let [index] = this[_routerList]
wx.switchTab({
wx.reLaunch({
url: index.url
})
}
......@@ -189,18 +180,6 @@ class Router {
if (i > -1) list.splice(i, 1)
}
}
async intercept() {
const authStatus = wx.$authStatus
if (authStatus) {
const thisPage = this.getPageInstance()
thisPage.setData({
showLogin: true
})
return await true
} else {
return await false
}
}
}
export default Router
\ No newline at end of file
......@@ -5,7 +5,6 @@
/**处理前置钩子逻辑 */
const routerBefore = (next) => {
// console.log("处理前置钩子逻辑");
next();
};
/**处理后置钩子逻辑 */
......@@ -33,4 +32,4 @@ Page = function (options) {
OldPage(options);
};
export default routerBefore;
export default routerBefore;
\ No newline at end of file
import util from '../utils/util.js'
import { getUserInfo } from '~/utils/cache/userInfo'
import { IMG_URL } from '~/utils/constantData'
import {
getUserInfo
} from '~/utils/cache/userInfo'
import {
IMG_URL
} from '~/utils/constantData'
/**
* wx.onAppRoute钩子方法,
......@@ -13,26 +17,6 @@ import { IMG_URL } from '~/utils/constantData'
* @param {*} obj.setNavigationBarTitleText
* @param {*} obj.getRouterList
*/
export const wxOnAppRouteFn = obj => {
wx.onAppRoute &&
wx.onAppRoute(e => {
let thisPage = obj.getPageInstance()
if (thisPage) {
obj.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
typeof onRoute === 'function' && onRoute(obj.query)
}
obj.routeHooks.forEach(fn => {
try {
typeof fn === 'function' && fn(e, obj.query, obj.routerList)
} catch (err) {
console.log(err)
}
})
obj.query = {}
})
}
/**
* 生成特定格式路由
*
......@@ -50,7 +34,9 @@ export const generateRoutList = routerList => {
if (item.parent != '__plugin__') {
obj = {
...item,
isTab: __wxConfig.tabBar.list.some(({ pagePath }) => item.url.includes(pagePath.replace('.html', '')))
isTab: __wxConfig.tabBar.list.some(({
pagePath
}) => item.url.includes(pagePath.replace('.html', '')))
}
if (item.parent !== 'pages') {
let parentList = item.url.split(`/`)
......@@ -59,14 +45,9 @@ export const generateRoutList = routerList => {
obj.subPages = item.url.split(`/${item.parent}/pages/`)[1].split('/')[0]
}
}
if (obj.isTab) {
__wxConfig.tabBar.list.map(e => {
if (obj.url === `/${e.pagePath.replace('.html', '')}`) obj.rootName = e.rootName
})
}
}
return obj
}))
} catch (err) {}
return _routerList
}
}
\ No newline at end of file
......@@ -9,6 +9,12 @@ export function getSessionId() {
export function setSessionId(sessionId) {
$Storage.set('scrm_shopmall_sessionId', sessionId)
}
export function getUserInfo() {
return $Storage.get('scrm_shopmall_userInfo')
}
export function setUserInfo(data) {
$Storage.set('scrm_shopmall_userInfo', data)
}
export function removeSystemStorage() {
$Storage.rm('srcm_shopmall_user_info')
$Storage.rm('scrm_shopmall_sessionId')
......
......@@ -6,7 +6,7 @@ const target = ['ip', 'dev', 'uat', 'prod']
2测试
3生产
*/
const index = 3
const index = 0
const secretKey = {
ip: {},
dev: {
......@@ -32,7 +32,7 @@ const secretKey = {
const domain = {
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip: 'http://192.168.3.181:8394',
ip: 'http://192.168.1.170:8315',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: 'https://scrm.dev.glsx.com.cn',
......
......@@ -2,14 +2,12 @@ import {
secretKey,
pathEnum,
domain,
index,
sign
} from './http.js'
// import util from '../util'
import {
getSessionId
} from '~/utils/cache/storageApi'
let INTERRUPT = false
/**接口 */
class Request {
get(params, returnAll = false) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!