Commit 865db9cf by zhangquan

存session

1 parent f242494c
...@@ -80,13 +80,13 @@ Page({ ...@@ -80,13 +80,13 @@ Page({
}, },
choiceAccountLogin() { choiceAccountLogin() {
let { loginUserInfoList } = this.data, { sessionId } = this; let { loginUserInfoList } = this.data, { sessionId } = this;
let id = loginUserInfoList[this.data.checkedId] let id = loginUserInfoList[this.data.checkedId].uuid
if (!id) { if (!id) {
wx.$api.showToast('请选择账号') wx.$api.showToast('请选择账号')
return return
} }
console.log(sessionId,id,'sssss') console.log(sessionId,id,'sssss')
wx.$api.showLoading() // wx.$api.showLoading()
selectAccountLogin({ selectAccountLogin({
id, id,
sessionId sessionId
......
...@@ -31,12 +31,14 @@ const selectAccountLogin = ({ ...@@ -31,12 +31,14 @@ const selectAccountLogin = ({
message message
}) => { }) => {
if (code == '0') { if (code == '0') {
console.log('选择账号登录')
setLoginInfo(data.loginUserInfoList[0], data.sessionId) setLoginInfo(data.loginUserInfoList[0], data.sessionId)
} else wx.$api.showToast(message || '系统异常') } else wx.$api.showToast(message || '系统异常')
}) })
} }
/**设置登录信息 */ /**设置登录信息 */
const setLoginInfo = (userInfo, sessionId) => { const setLoginInfo = (userInfo, sessionId) => {
console.log(111222222233333)
setUserInfo(userInfo) setUserInfo(userInfo)
setSessionId(sessionId) setSessionId(sessionId)
loginSuccess() loginSuccess()
......
...@@ -13,7 +13,7 @@ Page({ ...@@ -13,7 +13,7 @@ Page({
padHeight:0, padHeight:0,
loginMethod: 0, loginMethod: 0,
formData:{ formData:{
phone:'18778545361', phone:'13097951885',
code:'8888' code:'8888'
}, },
authorized: false authorized: false
......
...@@ -6,7 +6,6 @@ Component({ ...@@ -6,7 +6,6 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
}, },
/** /**
...@@ -63,6 +62,23 @@ Component({ ...@@ -63,6 +62,23 @@ Component({
this.data.heightArr = heightArr this.data.heightArr = heightArr
console.log( this.data.heightArr) console.log( this.data.heightArr)
}).exec() }).exec()
},
// 显示测算弹窗
showCalculate() {
this.setData({
visible: !this.data.visible,
isReset: false
});
},
clickDialog(e) {
console.log(e.changedTouches[0].clientY);
if (e.changedTouches[0].clientY < 352) {
this.setData({
visible: false,
isReset: false,
formData: this.data.lastFormData
});
} }
},
} }
}) })
.header{
position: relative;
width: 100%;
margin-bottom: 80rpx;
box-shadow: 0 16rpx 16rpx 0 rgba(230, 236, 245, 0.6);
}
.scene-wrap{ .scene-wrap{
position: absolute;
bottom: 0;
transform: translateY(75rpx);
white-space: nowrap; white-space: nowrap;
}
.scene-item{
width: 672rpx;
height: 180rpx; height: 180rpx;
margin-bottom: 16rpx;
.scene-img{
width: 100%;
}
} }
// 特色产品 // 特色产品
.prod-wrap .big-title{ .prod-wrap .big-title{
...@@ -35,7 +27,7 @@ ...@@ -35,7 +27,7 @@
width: 188rpx; width: 188rpx;
height: 64rpx; height: 64rpx;
border-radius: 12rpx; border-radius: 12rpx;
font-weight: 600; font-weight: 500;
font-size: 24rpx; font-size: 24rpx;
letter-spacing: 0; letter-spacing: 0;
text-align: center; text-align: center;
...@@ -49,6 +41,7 @@ ...@@ -49,6 +41,7 @@
background-image: linear-gradient(0deg, #EBEFFF 8%, #FCFDFF 85%); background-image: linear-gradient(0deg, #EBEFFF 8%, #FCFDFF 85%);
border: 2rpx solid rgba(68,97,240,0.50); border: 2rpx solid rgba(68,97,240,0.50);
box-shadow: 0 8rpx 16rpx 0 rgba(175,187,219,0.35); box-shadow: 0 8rpx 16rpx 0 rgba(175,187,219,0.35);
color: #4466F0;
} }
.prod-wrap .nav-wrap .nav:last-child{ .prod-wrap .nav-wrap .nav:last-child{
margin-right: 0; margin-right: 0;
...@@ -86,7 +79,7 @@ ...@@ -86,7 +79,7 @@
background: #D7F5EB; background: #D7F5EB;
border-radius: 4rpx; border-radius: 4rpx;
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
font-weight: 600; font-weight: 500;
font-size: 24rpx; font-size: 24rpx;
color: #24B38C; color: #24B38C;
letter-spacing: 0; letter-spacing: 0;
...@@ -107,7 +100,7 @@ ...@@ -107,7 +100,7 @@
} }
.prod-info .title{ .prod-info .title{
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
font-weight: 600; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #323436; color: #323436;
} }
...@@ -159,3 +152,130 @@ ...@@ -159,3 +152,130 @@
height: 300rpx; height: 300rpx;
} }
} }
/* 测算 */
.calculate {
position: fixed;
right: 16rpx;
bottom: 160rpx;
}
.icon-calculate {
width: 216rpx;
height: 228rpx;
}
/* 测算弹窗 */
.dialog-wrapper {
position: fixed;
height: 100vh;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(45,45,51,0.50);
}
.dialog-box {
position: fixed;
bottom: 0;
width: 100%;
height: 744rpx;
background-color: #fff;
box-shadow: 0 -8rpx 20rpx 0 rgba(180,186,204,0.32);
border-radius: 32rpx 32rpx 0 0;
}
.dialog-header {
display: flex;
justify-content: space-between;
padding: 32rpx 48rpx;
border-bottom: 1rpx solid #eee;
}
.header-btn {
display: inline-block;
font-size: 32rpx;
line-height: 48rpx;
}
.btn-gray {
color: #6C737A;
}
.btn-primary {
background-color: #fff;
border: none;
margin: 0;
padding: 0;
font-weight: 500;
color: #5850FF;
}
.btn-primary::after {
border: none;
}
.dialog-content {
padding: 40rpx 24rpx 60rpx;
}
.dialog-title {
font-weight: 600;
font-size: 36rpx;
color: #333333;
letter-spacing: 0;
text-align: center;
line-height: 56rpx;
margin-bottom: 24rpx;
}
.dialog-form {
width: 100%;
height: 384rpx;
background-image: linear-gradient(179deg, rgba(123,112,255,0.02) 15%, rgba(99,92,255,0.10) 100%);
border-radius: 8rpx;
padding: 32rpx;
box-sizing: border-box;
}
.form-item {
display: flex;
align-items: center;
height: 80rpx;
margin-bottom: 24rpx;
justify-content: space-between;
}
.form-label {
width: 256rpx;
font-size: 28rpx;
color: #2D2D33;
}
.form-input {
width: 216rpx;
padding: 16rpx 20rpx;
border: 2rpx solid #E6E6E6;
border-radius: 4rpx;
margin-left: 64rpx;
margin-right: 16rpx;
}
.form-unit {
font-size: 28rpx;
color: #6E6E7A;
}
.dialog-btn {
width: 100%;
padding: 24rpx 0;
box-sizing: border-box;
background: #5850FF;
border-radius: 8rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
letter-spacing: 0.8rpx;
text-align: center;
line-height: 48rpx;
margin-top: 40rpx;
}
/* 了解更多 */
.understand-more {
position: absolute;
bottom: 0;
width: 100%;
height: 700rpx;
background-image: linear-gradient(180deg, rgba(255,255,255,0.00) 0%, #FFFFFF 68%);
border-radius: 0 0 12rpx 12rpx;
}
.understand-more .more-btn {
width: 100%;
position: absolute;
bottom: 104rpx;
}
\ No newline at end of file \ No newline at end of file
<view style="height: {{btnHeight}}" class="header"> <view class="header">
<image style="width: 100%;height: 100%" src="{{IMGURL}}discovery_center_bg.png"></image> <swiper class="scene-wrap" circular="{{true}}" previousMargin="40rpx" nextMargin="40rpx">
<scroll-view class="scene-wrap" scroll-x="{{true}}">
<block wx:for="{{sceneList}}" wx:key="index"> <block wx:for="{{sceneList}}" wx:key="index">
<image class="scene-item" src="{{IMGURL}}{{item}}"></image> <swiper-item>
<image class="scene-img" src="{{IMGURL}}{{item}}"></image>
</swiper-item>
</block> </block>
</scroll-view> </swiper>
</view> </view>
<view class="prod-wrap"> <view class="prod-wrap">
<text class="big-title">特色产品</text> <text class="big-title">特色产品</text>
...@@ -43,3 +44,35 @@ ...@@ -43,3 +44,35 @@
</block> </block>
</scroll-view> </scroll-view>
</view> </view>
<!-- 测算按钮 -->
<view class="calculate" bindtap="showCalculate">
<image class="icon-calculate" webp src="{{IMGURL}}customer_service.png"></image>
</view>
<!-- 测算弹窗 -->
<view class="dialog-wrapper" bindtap="clickDialog" hidden="{{!visible}}">
<view class="dialog-box">
<form bindsubmit="submit">
<view class="dialog-header">
<view hidden="{{isReset}}" class="header-btn btn-gray" bindtap="showCalculate">取消</view>
<view hidden="{{!isReset}}" class="header-btn btn-gray" bindtap="reset">重置</view>
<button class="header-btn btn-primary" form-type="submit">确定</button>
</view>
<view class="dialog-content">
<view class="dialog-title">输入您门店的基本情况</view>
<view class="dialog-form">
<view class="form-item">
<view class="form-label">门店月平均新车销量</view>
<input class="form-input" bindfocus="focus" maxlength="8" name="sales" value="{{formData.sales}}" type="number" />
<!-- <view class="form-unit">台</view> -->
</view>
<view class="form-item">
<view class="form-label">3年内售后存量用户</view>
<input class="form-input" bindfocus="focus" maxlength="8" name="flow" type="number" value="{{formData.flow}}" />
<!-- <view class="form-unit">人</view> -->
</view>
<button class="dialog-btn" form-type="submit">提交测算</button>
</view>
</view>
</form>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* pages/tab/output/output.wxss */ /* pages/tab/output/output.wxss */
.container{
position: relative;
.bg-img{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 304rpx;
box-shadow: 0 16rpx 16rpx 0 rgba(230, 236, 245, 0.6);
}
}
<view style="background: #fff;"> <view style="background:#fff;" class="container">
<image style="height: {{btnHeight+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image>
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现"> <navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text> <text>发现</text>
</navigation-bar> </navigation-bar>
<view> <view style="padding-top: {{btnHeight}}px;">
<product></product> <product></product>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
* 微信小程序标准版:统一封装的 storage 操作类 * 微信小程序标准版:统一封装的 storage 操作类
*/ */
import { DEFAULT_GET_STORAGEKEY, GET_STORAGE_OBJECTkEY } from '~/utils/constantData' import { DEFAULT_GET_STORAGEKEY, STORAGE_OBJECTkEY } from '~/utils/constantData'
class Storage { class Storage {
types = { types = {
1: 'get', // get 1: 'get', // get
...@@ -15,7 +14,7 @@ class Storage { ...@@ -15,7 +14,7 @@ class Storage {
trial: '体验版', trial: '体验版',
release: '正式版' release: '正式版'
} }
// defaultGetStorageKey = DEFAULT_GET_STORAGEKEY
/** 构造函数 */ /** 构造函数 */
constructor() { constructor() {
/** 获取当前小程序环境变量 */ /** 获取当前小程序环境变量 */
...@@ -40,6 +39,7 @@ class Storage { ...@@ -40,6 +39,7 @@ class Storage {
throw new Error(`Storage ${this.types[type]} func: key can not be empty`) throw new Error(`Storage ${this.types[type]} func: key can not be empty`)
return false return false
} }
// if STORAGE_OBJECTkEY[key]
return tmpKey return tmpKey
} }
return key return key
...@@ -51,31 +51,32 @@ class Storage { ...@@ -51,31 +51,32 @@ class Storage {
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步 * @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/ */
get = (key, syncFlag = true) => { get = (key, syncFlag = true) => {
// 有key值 // 有值默认取key值
if (key) { if (key) {
// 判断值是否是指定的对象值
let tmpKey = this.checkKeyType(key, 1) let tmpKey = this.checkKeyType(key, 1)
let isObjectKey = STORAGE_OBJECTkEY[tmpKey]
// 判断值是否是指定的对象值 是取定义的好的映射值 // console.log(key)
let isObjectKey = GET_STORAGE_OBJECTkEY[key] // console.log(isObjectKey)
if (isObjectKey) { if (isObjectKey) {
return this.getObjectKeyValue(isObjectKey) return this.getObjectKeyValue(isObjectKey)
} else { } else {
return this.getKeyValue(tmpKey, syncFlag) throw new Error(`Storage ${this.types[1]} ${key}: key must be register`)
} }
} else { } else {
// 为空取默认定义好的数组值
return this.getObjectKeyValue(DEFAULT_GET_STORAGEKEY) return this.getObjectKeyValue(DEFAULT_GET_STORAGEKEY)
} }
} }
/** /**
* *
* @param {*} key | 要操作的键值 * @param {*} 空key返回默认定义数组的值
* @param {*} syncFlag | 同步状态,默认 false (异步),true 为同步
*/ */
getKeyValue(tmpKey, syncFlag) { getObjectKeyValue(key) {
if (syncFlag) { // ObjectList
let res = wx.getStorageSync(tmpKey) if (typeof key == 'string') {
key = this.addEvnToKey(key)
let res = wx.getStorageSync(key)
if (res) { if (res) {
return JSON.parse(res) return JSON.parse(res)
} else { } else {
...@@ -83,35 +84,15 @@ class Storage { ...@@ -83,35 +84,15 @@ class Storage {
return '' return ''
} }
} else { } else {
return new Promise((resolve, reject) => {
wx.getStorage({
key: tmpKey,
success: res => {
resolve(JSON.parse(res.data))
},
fail: err => {
// console.log(err)
// reject(errMsg)
resolve('')
}
})
})
}
}
/**
*
* @param {*} 空key返回默认定义数组的值
*/
getObjectKeyValue(ObjectList) {
let Obj = {} let Obj = {}
ObjectList.forEach(key => { key.forEach(key => {
let defaultKey = this.addEvnToKey(key) let defaultKey = this.addEvnToKey(key)
let res = wx.getStorageSync(defaultKey) let res = wx.getStorageSync(defaultKey)
Obj[key] = res ? JSON.parse(res) : '' Obj[key] = res ? JSON.parse(res) : ''
}) })
return Obj return Obj
} }
}
/** /**
* *
* @param {*} key | 要操作的键值 * @param {*} key | 要操作的键值
......
...@@ -4,20 +4,26 @@ const $Storage = new Storage() ...@@ -4,20 +4,26 @@ const $Storage = new Storage()
// console.log($Storage) // console.log($Storage)
/** */ /** */
export function getSessionId() { export function getSessionId() {
return $Storage.get('scrm_shopmall_sessionId') return $Storage.get('sessionId')
} }
export function setSessionId(sessionId) { export function setSessionId(sessionId) {
$Storage.set('scrm_shopmall_sessionId', sessionId) $Storage.set('sessionId', sessionId)
}
export function getUserInfo() {
return $Storage.get('userInfo')
}
export function setUserInfo(data) {
$Storage.set('userInfo', data)
} }
export function removeSystemStorage() { export function removeSystemStorage() {
$Storage.rm('srcm_shopmall_user_info') // $Storage.rm('srcm_shopmall_user_info')
$Storage.rm('scrm_shopmall_sessionId') // $Storage.rm('scrm_shopmall_sessionId')
$Storage.rm('guest_no') // $Storage.rm('guest_no')
$Storage.rm('equity_info') // $Storage.rm('equity_info')
$Storage.rm('packageList') // $Storage.rm('packageList')
$Storage.rm('isVIP') // $Storage.rm('isVIP')
$Storage.rm('bizjiaUrl') // $Storage.rm('bizjiaUrl')
$Storage.rm('vip_card_info') // $Storage.rm('vip_card_info')
} }
export function setStorageSync(key, data) { export function setStorageSync(key, data) {
$Storage.set(key, JSON.stringify(data)) $Storage.set(key, JSON.stringify(data))
...@@ -29,22 +35,22 @@ export function getStorageSync(key) { ...@@ -29,22 +35,22 @@ export function getStorageSync(key) {
/**设置标题栏 */ /**设置标题栏 */
export function setNavigationBarTitleText(title) { export function setNavigationBarTitleText(title) {
$Storage.set('dj_shopmall_app_title', title) $Storage.set('app_title', title)
} }
/**获取app标题 */ /**获取app标题 */
export function getNavigationBarTitleText() { export function getNavigationBarTitleText() {
return $Storage.get('dj_shopmall_app_title') return $Storage.get('app_title')
} }
/** 存储设备信息 */ /** 存储设备信息 */
export function setSystem_info(that) { export function setSystem_info(that) {
let info = $Storage.get('srcm_shopmall_system_info') let info = $Storage.get('system_info')
!info && !info &&
wx.getSystemInfo({ wx.getSystemInfo({
success(res) { success(res) {
// console.log(res) // console.log(res)
$Storage.set('srcm_shopmall_system_info', res) $Storage.set('system_info', res)
} }
}) })
} }
/**获取用户信息 */ /**获取用户信息 */
export function getUserInfo() { export function getUserInfo() {
let user = wx.$storage.get('srcm_shopmall_user_info') || null let user = wx.$storage.get('userInfo') || null
return user return user
} }
/**设置用户信息 */ /**设置用户信息 */
export function setUserInfo(userInfo) { export function setUserInfo(userInfo) {
wx.$storage.set('srcm_shopmall_user_info', userInfo) wx.$storage.set('userInfo', userInfo)
} }
export function isMember(isNeedToHttp, callBack) { export function isMember(isNeedToHttp, callBack) {
......
...@@ -4,6 +4,10 @@ export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/sto ...@@ -4,6 +4,10 @@ export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/sto
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo'] export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
// 缓存get方法key的对应才映射值 // 缓存get方法key的对应才映射值
export const GET_STORAGE_OBJECTkEY = { export const STORAGE_OBJECTkEY = {
super: ['sessionId', 'merchantId', 'userInfo'] DEFAULT_GET_STORAGEKEY,
sessionId: 'sessionId',
userInfo: 'userInfo',
system_info: 'systemInfo',
app_title: 'appTitle'
} }
\ No newline at end of file \ No newline at end of file
...@@ -6,7 +6,7 @@ const target = ['ip', 'dev', 'uat', 'prod'] ...@@ -6,7 +6,7 @@ const target = ['ip', 'dev', 'uat', 'prod']
2测试 2测试
3生产 3生产
*/ */
const index = 1 const index = 0
const secretKey = { const secretKey = {
ip: {}, ip: {},
dev: { dev: {
...@@ -32,7 +32,7 @@ const secretKey = { ...@@ -32,7 +32,7 @@ const secretKey = {
const domain = { const domain = {
// ip: 'http://192.168.2.94:8558', // ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315', // 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:8315
商城: 192.168.2.3:8558 */ 商城: 192.168.2.3:8558 */
dev: 'https://scrm.dev.glsx.com.cn', dev: 'https://scrm.dev.glsx.com.cn',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!