Commit 84aed90c by 李伟康

commit 提交登陆

1 parent 3a370151
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0", "version": "0.0",
"configurations": [{ "configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" : "default" :
{ {
"launchtype" : "local" "launchtype" : "local"
......
<script> <script>
import common from './utils/wxApplet/common.js'
export default { export default {
onLaunch: function() { onLaunch: function() {
console.log('>>>>>>>>>>>>>>>会话开始<<<<<<<<<<<<<<')
common.wxLogin();
}, },
onShow: function() {}, onShow: function() {},
onHide: function() {} onHide: function() {}
......
import apiModules from './module/index'
module.exports = apiModules
\ No newline at end of file \ No newline at end of file
import http from '../request/http'
module.exports = {
search(data) {
return http.post({
method: 'scrm.api.carlife.weapp.homeSearch.search',
pageSize: 10,
...data,
})
},
}
\ No newline at end of file \ No newline at end of file
import commonApi from './common'
import systemApi from './systemApi'
module.exports = {
commonApi,
systemApi
}
\ No newline at end of file \ No newline at end of file
import http from '../request/http'
import { env } from '../../env'
const serverConfig = {
mockRequestCount: null,
mockTimer: {},
mockCache: null,
};
const configModule = 'mini-wuye'
const configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`;
/**获取mock数据 */
const getMockData = async () => {
const MOCKDATA = uni.$storage.get('mock_data')
try {
if (MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) {
return Promise.resolve(MOCKDATA);
} else {
if (!serverConfig.mockRequestCount) {
serverConfig.mockCache = null;
serverConfig.mockRequestCount = Date.now();
const data = await http.uni_request({ url:configUrl });;
data.createTime = Date.now();
serverConfig.mockCache = data;
uni.$storage.set("mock_data", data);
return Promise.resolve(data);
} else {
const key = Date.now();
return new Promise((resolve) => {
serverConfig.mockTimer[key] = setInterval(() => {
if (serverConfig.mockCache) {
clearInterval(serverConfig.mockTimer[key]);
serverConfig.mockRequestCount = null;
resolve(serverConfig.mockCache);
}
}, 1e3);
});
}
}
} catch (error) {
if (serverConfig.mockTimer[key]) clearInterval(serverConfig.mockTimer[key]);
serverConfig.mockRequestCount = null;
return Promise.reject(error);
}
};
// 图片版本号
const getImageVersion = async () => {
const accountInfo = await getMockData()
return accountInfo?.version || Date.now()
}
module.exports={
getImageVersion,
getMockData
}
\ No newline at end of file \ No newline at end of file
import sign from './sign.js'
import {
secretKey,
pathEnum,
domain,
} from '../../env'
class Request {
get (params, returnAll = false) {
return this.request('GET', params, returnAll)
}
post (params, returnAll = false) {
return this.request('POST', params, returnAll)
}
fetch (method, data, returnAll = true) {
return this.post({
method,
...data,
},
returnAll
)
}
request (RequestMethods, params, returnAll) {
return new Promise((resolve, reject) => {
let header = RequestMethods === 'POST' ? {
'content-type': 'application/x-www-form-urlencoded'
} : {
'Cache-Control': 'no-cache'
}
let projectName = params.projectName
if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName]
params = this.getData(params)
uni.request({
url: `${domain}${path}router?method=${params.method}`,
data: params,
method: RequestMethods,
header,
dataType: 'json',
responseType: 'text',
success (response) {
/**业务代码 */
let {
data: {
code,
message
},
data
} = response
if (returnAll) {
resolve(data)
return
}
if (code == 20 || code == 21) {
uni.hideLoading()
// const thisPage = wx.p.router.getPageInstance(),
// options = Object.keys(thisPage.options)
// let currentRoute = thisPage.route,
// query = []
// if (options.length) {
// options.map(key => {
// query.push(`${key}=${thisPage.options[key]}`)
// })
// }
// if (query.length) currentRoute += `?${query.join('&')}`
// return wx.p.router.redirectTo('/pages/loading/loading', {
// url: `/${currentRoute}`
// })
} else {
if (code == '0') {
resolve(data.data)
} else {
uni.showToast({
title: message || '系统异常',
icon: 'none'
})
}
}
},
fail (error) {
uni.hideLoading()
console.error(`接口异常:`, error)
uni.showToast({
title: typeof error == 'string' ? error : JSON.stringify(error) || '系统异常',
icon: 'error'
})
reject(error)
},
complete () {
uni.stopPullDownRefresh()
}
})
})
}
getData (params) {
let projectName = params.projectName
if (!projectName) projectName = this.getRopProject(params.method)
else delete params.projectName
let appKey = '48e5e13229b82c1b4e6e8c96151f0637'
let secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
if (secretKey[projectName]) {
appKey = secretKey[projectName].appKey
secret = secretKey[projectName].secret
}
let {
sessionId
} = uni.$storage.get()
let noSignAttr = []
if (!params.sessionId && sessionId) params.sessionId = sessionId
if (params.delSessionId) {
delete params.sessionId
delete params.delSessionId
}
if (params.noSignAttr) {
noSignAttr = params.noSignAttr
delete params.noSignAttr
}
params.v = '1.0.0'
params.format = 'json'
params.locale = 'zh_CN'
params.source = 'app'
params.appKey = appKey
return sign(params, secret, noSignAttr)
}
getRopProject (method) {
const projectName = method.split('.')[2]
return projectName
}
uni_request({
url,
method = 'GET',
data = {},
header = {},
dataType = 'json',
responseType = "text"
}) {
return new Promise((resolve) => {
uni.request({
url,
data,
method,
header,
dataType,
responseType,
success(response) {
resolve(response.data)
}
})
})
}
}
export default new Request()
\ No newline at end of file \ No newline at end of file
import {sha1,qs} from '../../lib/index'
const sign = (params, secret, noSignAttr = []) => {
delete params.sign
var objStr = qs.stringify(params, {
arrayFormat: 'indices',
allowDots: true,
encodeValuesOnly: true
})
var objVal = objStr.split('&')
var realObj = {}
objVal.forEach(item => {
const idx = item.indexOf('=')
realObj[item.split('=')[0]] = decodeURIComponent(item.slice(idx + 1))
})
const keys = Object.keys(realObj).sort()
var str = []
var obj = null
for (const key in realObj) {
obj = realObj[key]
if (obj === null) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
realObj[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + realObj[e])
})
realObj.sign = sha1(secret + str.join('') + secret).toUpperCase()
return realObj
}
export default sign
\ No newline at end of file \ No newline at end of file
<template>
<image
:src="imagePath"
:mode="mode"
:webp="webp||isWebp"
lazy-load
/>
</template>
<script>
import {
systemApi
} from '../api/index'
import { IMG_URL } from '../utils/cache/constantData'
export default {
props: {
mode: {
type: String,
default: 'scaleToFill'
},
src: {
type: null,
default: ''
},
webp: Boolean
},
name: 'GlsxImage',
data () {
return {
isWebp: false,
imagePath: ''
}
},
watch: {
src (n) {
if (n) this.init(n)
}
},
async mounted () {
if (this.src) this.init(this.src)
},
methods: {
async init (url) {
this.isWebp = url.includes('webp')
let checkList = ['https://', 'http://'],
isFullAdd = checkList.map(item => url.includes(item)).some(item => item),
isBASE64 = url.includes('data:image'),
v = await systemApi.getImageVersion()
this.imagePath = `${isFullAdd || isBASE64 ? '' : IMG_URL}${url}` + (isBASE64 ? '' : `?v=${v}`)
}
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file \ No newline at end of file
import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
Vue.component(component.name, component)
})
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
const index = 2
/**
*
0本地
1开发
2测试
3生产
4预发布
*/
const secretKey = {
ip: {},
dev: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
uat: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
prod: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
preRelease: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
}
}[target[index]]
const domain = {
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip: 'http://192.168.1.170:8315',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: 'https://scrm.dev.glsx.com.cn',
uat: 'https://scrm.test.glsx.com.cn',
preRelease: 'https://scrm.beta.glsx.com.cn',
prod: 'https://scrm.glsx.com.cn'
}[target[index]]
const pathEnum = {
sso: '/rop-scrm-sso/',
shopmall: '/rop-scrm-shopmall/',
coupon: '/rop-scrm-coupon/',
carlife: '/rop-scrm-carlife/',
live: '/rop-scrm-live/',
equity: '/rop-scrm-equity/',
entmicro: '/rop-scrm-entmicro/',
wechat: '/rop-scrm-wechat/',
boutiquecoupon: '/rop-scrm-boutiquecoupon/',
material: '/rop-scrm-marketing/', //素材
sop: '/rop-scrm-sop/',
customercollect: '/rop-scrm-bigdatautil/',
drac: '/rop-scrm-entmicro/',
busassistant: '/rop-scrm-busassistant/'
}
const CONFIG_ENV_MAP = {
1: 'develop',
2: 'test',
3: 'production',
4: 'beta'
}
module.exports = {
index,
domain,
pathEnum,
secretKey,
env: CONFIG_ENV_MAP[index]
}
import sha1 from './sha1.js'
import qs from './qs'
module.exports ={ sha1,qs }
\ No newline at end of file \ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
function encodeUTF8(s) {
var i, r = [], c, x;
for (i = 0; i < s.length; i++)
if ((c = s.charCodeAt(i)) < 0x80) r.push(c);
else if (c < 0x800) r.push(0xC0 + (c >> 6 & 0x1F), 0x80 + (c & 0x3F));
else {
if ((x = c ^ 0xD800) >> 10 == 0) //对四字节UTF-16转换为Unicode
c = (x << 10) + (s.charCodeAt(++i) ^ 0xDC00) + 0x10000,
r.push(0xF0 + (c >> 18 & 0x7), 0x80 + (c >> 12 & 0x3F));
else r.push(0xE0 + (c >> 12 & 0xF));
r.push(0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F));
};
return r;
}
// 字符串加密成 hex 字符串
function sha1(s) {
var data = new Uint8Array(encodeUTF8(s))
var i, j, t;
var l = ((data.length + 8) >>> 6 << 4) + 16, s = new Uint8Array(l << 2);
s.set(new Uint8Array(data.buffer)), s = new Uint32Array(s.buffer);
for (t = new DataView(s.buffer), i = 0; i < l; i++)s[i] = t.getUint32(i << 2);
s[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8);
s[l - 1] = data.length << 3;
var w = [], f = [
function () { return m[1] & m[2] | ~m[1] & m[3]; },
function () { return m[1] ^ m[2] ^ m[3]; },
function () { return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; },
function () { return m[1] ^ m[2] ^ m[3]; }
], rol = function (n, c) { return n << c | n >>> (32 - c); },
k = [1518500249, 1859775393, -1894007588, -899497514],
m = [1732584193, -271733879, null, null, -1009589776];
m[2] = ~m[0], m[3] = ~m[1];
for (i = 0; i < s.length; i += 16) {
var o = m.slice(0);
for (j = 0; j < 80; j++)
w[j] = j < 16 ? s[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1),
t = rol(m[0], 5) + f[j / 20 | 0]() + m[4] + w[j] + k[j / 20 | 0] | 0,
m[1] = rol(m[1], 30), m.pop(), m.unshift(t);
for (j = 0; j < 5; j++)m[j] = m[j] + o[j] | 0;
};
t = new DataView(new Uint32Array(m).buffer);
for (var i = 0; i < 5; i++)m[i] = t.getUint32(i << 2);
var hex = Array.prototype.map.call(new Uint8Array(new Uint32Array(m).buffer), function (e) {
return (e < 16 ? "0" : "") + e.toString(16);
}).join("");
return hex;
}
module.exports = sha1
...@@ -2,6 +2,11 @@ import Vue from 'vue' ...@@ -2,6 +2,11 @@ import Vue from 'vue'
import App from './App' import App from './App'
import config from '@/config.js' import config from '@/config.js'
import store from '@/store'; import store from '@/store';
import api from './api/index'
import { Storage } from './utils/cache/index'
import 'components'
uni.$api = api
uni.$storage = new Storage()
Vue.config.productionTip = false Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
Vue.prototype.$ossDomain = config.OSS_DOMAIN; Vue.prototype.$ossDomain = config.OSS_DOMAIN;
......
...@@ -4,17 +4,11 @@ ...@@ -4,17 +4,11 @@
}, },
"pages": [ "pages": [
{ {
"path": "pages/index/index", "path": "pages/common/login",
"style": { "style": {
"navigationBarTitleText": "uView-index" "navigationStyle": "custom"
} }
}, }
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
}
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
......
<template>
<view class="layout">
<view class="bg"></view>
<view class="login">
<view class="title">登录</view>
<view class="sub-title">手机号码登录</view>
<view class="input">
<input
type="tel"
v-model="phone"
placeholder="请输入手机号"
maxlength="11"
>
<template v-if="phone">
<text
class="icon"
@click="phone = ''"
>X</text>
</template>
</view>
<view class="input">
<input
type="number"
v-model="code"
placeholder="请输入验证码"
maxlength="4"
>
<template v-if="code">
<text
class="icon"
@click="code = ''"
>X</text>
</template>
</view>
<button
class="btn"
:disabled="!phone || !code"
>登录</button>
</view>
</view>
</template>
<script>
export default {
data () {
return {
phone: '1',
code: ''
}
},
onLoad (options) {
uni.$api.commonApi.search().then(res => {
console.log(res)
})
},
methods: {
// input (e) {
// this.phone = e.detail.value
// }
},
}
</script>
<style lang="scss" scoped>
.bg {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-image: url("https://img02.glsx.com.cn/weapp/resource/app-tape/login/bg.png");
background-size: 100% 100%;
}
.login {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.title {
font-weight: 600;
font-size: 96rpx;
color: #333333;
text-align: center;
}
.sub-title {
font-weight: 500;
font-size: 32rpx;
color: #1a1a1a;
margin: 46rpx 0;
}
.input {
width: 800rpx;
height: 112rpx;
background: #f7f8fa;
border-radius: 56rpx;
margin-bottom: 40rpx;
box-sizing: border-box;
padding: 0 40rpx;
display: flex;
align-items: center;
input {
height: 100%;
flex: 1;
font-size: 32rpx !important;
}
.icon {
margin-left: auto;
}
}
.btn {
width: 800rpx;
height: 112rpx;
background-image: linear-gradient(90deg, #48a6ff 0%, #2c66f7 100%);
border-radius: 56rpx;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 40rpx;
color: #ffffff;
}
.btn[disabled]:not([type]),
.btn[disabled][type="default"] {
background: #c9c9c9 !important;
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,7 @@ const router = new Router({ ...@@ -9,7 +9,7 @@ const router = new Router({
routes: [...modules]//路由表 routes: [...modules]//路由表
}); });
const whiteList = ['/pages/login/login'] const whiteList = ['/pages/common/login']
//全局路由前置守卫 //全局路由前置守卫
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
next() next()
......
const routes = [ const routes = [
{ {
path: "/pages/login/login", path: "/pages/common/login",
name: 'login', name: 'login',
meta: { meta: {
title: '登录', title: '登录',
}, },
}, },
{
//注意:path必须跟pages.json中的地址对应,最前面别忘了加'/'哦
path: '/pages/index/index',
name: 'index',
meta: {
title: '主页',
},
},
] ]
export default routes export default routes
\ No newline at end of file \ No newline at end of file
// export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/store-assistant/'
// import util from '~/utils/util'
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/app-tape/'
// 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
// 缓存get方法key的对应才映射值
export const STORAGE_OBJECTkEY = {
DEFAULT_GET_STORAGEKEY,
mock_data: 'mock_data'
}
// export const IMG_VERSION = async () => {
// const accountInfo = await util.getMockData()
// return accountInfo?.version || Date.now()
// }
\ No newline at end of file \ No newline at end of file
import Storage from './storage'
import storageApi from './storageApi'
module.exports = { Storage, storageApi }
\ No newline at end of file \ No newline at end of file
/**
* 微信小程序标准版:统一封装的 storage 操作类
*/
import { DEFAULT_GET_STORAGEKEY, STORAGE_OBJECTkEY } from './constantData'
class Storage {
types = {
1: 'get', // get
2: 'set', // set
3: 'rm' // rm
}
envVersion = {
develop: '开发版',
trial: '体验版',
release: '正式版'
}
// defaultGetStorageKey = DEFAULT_GET_STORAGEKEY
/** 构造函数 */
constructor() {
}
/**
*
* @param {*} key | 要操作的键值
* @param {*} type | 类型,是 get set rm
* @param {*} emptyFlag | 是否判断为空情况,默认判断 true,false 为不判断
*/
checkKeyType(key, type, emptyFlag = true) {
if (typeof key != 'string') {
throw new Error(`Storage ${this.types[type]} func: key must be string`)
return false
}
if (emptyFlag) {
let tmpKey = key.TrimStr()
if (tmpKey == '') {
throw new Error(`Storage ${this.types[type]} func: key can not be empty`)
return false
}
// if STORAGE_OBJECTkEY[key]
return tmpKey
}
return key
}
/**
*
* @param {*} key | 要操作的键值
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/
get = (key, syncFlag = true) => {
// 有值默认取key值
if (key) {
// 判断值是否是指定的对象值
let tmpKey = this.checkKeyType(key, 1)
let isObjectKey = STORAGE_OBJECTkEY[tmpKey]
// console.log(key)
// console.log(isObjectKey)
if (isObjectKey) {
return this.getObjectKeyValue(isObjectKey)
} else {
throw new Error(`Storage ${this.types[1]} ${key}: key must be register`)
}
} else {
return this.getObjectKeyValue(DEFAULT_GET_STORAGEKEY)
}
}
/**
*
* @param {*} 空key返回默认定义数组的值
*/
getObjectKeyValue(key) {
// ObjectList
if (typeof key == 'string') {
key = this.addEvnToKey(key)
let res = uni.getStorageSync(key)
if (res) {
return JSON.parse(res)
} else {
// reject(errMsg)
return ''
}
} else {
let Obj = {}
key.forEach(key => {
let defaultKey = this.addEvnToKey(key)
let res = uni.getStorageSync(defaultKey)
Obj[key] = res ? JSON.parse(res) : ''
})
return Obj
}
}
/**
*
* @param {*} key | 要操作的键值
* @param {*} data | 要存储的值,会转换为 JSON 串进行存储
* @param {*} syncFlag | 同步状态,默认为同步 false (异步),true 为同步
*/
set = (key, data, syncFlag = true) => {
let tmpKey = this.checkKeyType(key, 2)
if (tmpKey) {
tmpKey = this.addEvnToKey(tmpKey)
const sucMsg = 'Storage set: set data successfully'
const errMsg = 'Storage set: failed to set data'
return new Promise((resolve, reject) => {
let tmpData = JSON.stringify(data)
if (syncFlag) {
try {
uni.setStorageSync(tmpKey, tmpData)
resolve(sucMsg)
} catch (err) {
console.log(err)
reject(errMsg)
}
} else {
uni.setStorage({
data: tmpData,
key: tmpKey,
success: () => {
resolve(sucMsg)
},
fail: err => {
console.log(err)
reject(errMsg)
}
})
}
})
}
}
/**
*
* @param {*} key | 要操作的键值,为空则清空所有,有值则清空指定的值
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/
rm = (key = '', syncFlag = false) => {
let tmpKey = this.checkKeyType(key, 3, false)
tmpKey = tmpKey.TrimStr()
const sucMsg = 'Storage rm: rm data successfully'
const errMsg = 'Storage rm: failed to rm data'
return new Promise((resolve, reject) => {
if (tmpKey == '') {
if (syncFlag) {
try {
uni.clearStorageSync()
resolve(sucMsg)
} catch (err) {
console.log(err)
reject(errMsg)
}
} else {
uni.clearStorage({
success: res => {
resolve(sucMsg)
},
fail: err => {
console.log(err)
reject(errMsg)
}
})
}
} else {
tmpKey = this.addEvnToKey(tmpKey)
if (syncFlag) {
try {
uni.removeStorageSync(tmpKey)
resolve(sucMsg)
} catch (err) {
console.log(err)
reject(errMsg)
}
} else {
uni.removeStorage({
key: tmpKey,
success: () => {
resolve(sucMsg)
},
fail: err => {
console.log(err)
reject(errMsg)
}
})
}
}
})
}
/**
* @description: key 拼接小程序环境变量
* @param {*} key | 要操作的键值,
* @returns {String} 拼接后的值
*/
addEvnToKey = key => {
return `release_${key}`
}
}
/** 去除前导空格和后导空格 */
String.prototype.TrimStr = function () {
return this.replace(/(^\s*)|(\s*$)/g, '')
}
export default Storage
// 实例化对象存储
import Storage from './storage'
const storage = new Storage()
// console.log(storage)
/** */
export function getSessionId() {
return storage.get('sessionId')
}
export function setSessionId(sessionId) {
storage.set('sessionId', sessionId)
}
export function getUserInfo() {
return storage.get('userInfo')
}
export function setUserInfo(data) {
console.log(data)
storage.set('userInfo', data)
}
export function removeSystemStorage() {
// storage.rm('srcm_shopmall_user_info')
// storage.rm('scrm_shopmall_sessionId')
// storage.rm('guest_no')
// storage.rm('equity_info')
// storage.rm('packageList')
// storage.rm('isVIP')
// storage.rm('bizjiaUrl')
// storage.rm('vip_card_info')
}
export function setStorageSync(key, data) {
storage.set(key, JSON.stringify(data))
}
export function getStorageSync(key) {
return storage.get(key) || null
// JSON.parse(data)
}
/**设置标题栏 */
export function setNavigationBarTitleText(title) {
storage.set('app_title', title)
}
/**获取app标题 */
export function getNavigationBarTitleText() {
return storage.get('app_title')
}
/** 存储设备信息 */
export function setSystem_info(that) {
let info = storage.get('system_info')
!info &&
wx.getSystemInfo({
success(res) {
// console.log(res)
storage.set('system_info', res)
}
})
}
export default{
getSessionId,
setSessionId,
getUserInfo,
setUserInfo,
removeSystemStorage,
setStorageSync,
getStorageSync,
setNavigationBarTitleText,
getNavigationBarTitleText,
setSystem_info
}
...@@ -37,7 +37,7 @@ const install = (Vue, vm) => { ...@@ -37,7 +37,7 @@ const install = (Vue, vm) => {
// Token已过期|加入黑名单|Token校验失败,则需重新进入登录页登录 // Token已过期|加入黑名单|Token校验失败,则需重新进入登录页登录
common.logout(); common.logout();
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/common/login'
}); });
return false; return false;
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!