Commit 80be028e by liimin

Merge branch 'v1.0.0' of http://192.168.3.233:8090/saas/mini-program/hmd into v1.0.0

2 parents 6b67d360 23f9594b
import ssoApi from './sso'
import wechatApi from './wechat'
import entmicroApi from './entmicro'
module.exports = {ssoApi,wechatApi,entmicroApi}
\ No newline at end of file
import userApi from './user'
module.exports = {wechatApi,entmicroApi,userApi}
\ No newline at end of file
import http from '../request/http'
const path = 'scrm.api.sso.weapp.'
module.exports = {
/**wx.login登录 */
jsCodeLogin(data) {
// return http.post({
// method: `${path}jscode.getOpenId`,
// ...data
// }, true)
return http.fetch(`${path}jscode.getOpenId`,data);
},
/**授权用户信息 */
authUserInfo(data) {
// return http.post({
// method: 'scrm.api.sso.weapp.auth.userinfo',
// ...data
// },true)
return http.fetch('scrm.api.sso.weapp.auth.userinfo',data);
},
/**授权手机号 */
authUserPhone(data) {
return http.fetch(`${path}auth.phone`,data);
// return http.post({
// method: `${path}auth.phone`,
// ...data
// }, true)
},
/**根据openId获取用户信息 */
getUserInfo(data) {
// return http.post({
// method: `${path}userProfile.getUserInfo`,
// ...data
// }, true)
return http.fetch(`${path}userProfile.getUserInfo`,data);
},
/**退出 */
logout() {
// return http.post({
// method: `scrm.api.sso.user.logout`
// }, true)
return http.fetch(`scrm.api.sso.user.logout`,data);
},
//保存用户授权信息
saveuserProfile(data) {
// return http.post({
// method: `scrm.api.wechat.auth.userProfile.save`,
// ...data
// }, true)
return http.fetch(`scrm.api.wechat.auth.userProfile.save`,data);
},
/**更新客户手机号 */
updataCustomerPhone(data) {
// return http.post({
// method: `scrm.api.sso.weapp.mark.phone`,
// ...data
// })
return http.fetch(`scrm.api.sso.weapp.mark.phone`,data,false);
},
}
import http from '../request/http'
// const { appId } = wx.getAccountInfoSync().miniProgram
import {
appId
} from '~/utils/constants'
let loginCount = null,
loginCache = null,
loginTimer = null
class UsersApi {
/**调用后台接口获取用户信息 */
async login() {
const appEnter = wx.getEnterOptionsSync()
try {
if (appEnter.scene === 1154 && appEnter.mode === 'singlePage') throw 'login:fail rejected due to no permission currently'
if (!loginCount) {
loginCache = null
loginCount = Date.now()
const {
code
} = await this.getWxCode(),
data = await http.fetch('scrm.api.sso.weapp.jscode.login', {
appId,
code,
delSessionId: true
})
loginCache = data
loginCount = null
return Promise.resolve(data)
} else {
return new Promise((resolve) => {
loginTimer = setInterval(() => {
if (loginCache) {
clearInterval(loginTimer)
loginCount = null
resolve(loginCache)
}
}, 1e3)
})
}
} catch (error) {
if (loginTimer) clearInterval(loginTimer)
loginCount = null
return Promise.reject(error)
}
}
/**调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。 */
getWxCode() {
return new Promise((resolve, reject) => {
wx.login({
success: res => resolve(res),
fail: err => reject(err)
})
})
}
/**授权手机号 */
async authUserPhone(detail, sessionId) {
if (!sessionId) {
wx.$api.showToast('缺少sessionId')
Promise.reject({
errMsg: '缺少sessionId'
})
}
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
wx.$storage.rm('userInfo')
wx.$storage.rm('sessionId')
return http.fetch('scrm.api.sso.weapp.auth.phone', detail)
} else Promise.reject(detail.errMsg)
}
/**退出登录 */
logout() {
return fetcht({
method: 'scrm.api.sso.wechat.applets.logout'
})
}
/** 手机号获取短信验证码 */
getSmsCode(mobile) {
return http.fetch('scrm.api.sso.wechat.applets.sms.get.code', {
mobile
})
}
/** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) {
return http.fetch('scrm.api.sso.wechat.applets.sms.login', {
...data,
source: 'MINIAPP',
platformEntrance: 'STORE_ASSISTANT'
})
}
/*
*C端手机号短信登录
*/
phoneLogin(data) {
return http.fetch('scrm.api.sso.weapp.auth.phone.mini', {
source: 'MINIAPP',
...data
})
}
}
export default new UsersApi()
\ No newline at end of file
......@@ -5,7 +5,6 @@ import {
index,
sign
} from './sign.js'
import util from '../../utils/util.js'
let INTERRUPT = false
/**接口 */
class Request {
......@@ -55,6 +54,10 @@ class Request {
},
data
} = response
if (returnAll) {
resolve(data)
return
}
if (code == 20 || code == 21) {
wx.hideLoading()
const thisPage = wx.p.router.getPageInstance()
......@@ -73,10 +76,6 @@ class Request {
})
}
} else {
if (returnAll) {
resolve(data)
return
}
if (code == '0') {
resolve(data.data)
} else {
......@@ -89,8 +88,9 @@ class Request {
},
fail(error) {
wx.hideLoading()
console.error(`接口异常:`, error)
wx.showToast({
title: '系统异常',
title: typeof error == 'string' ? error : JSON.stringify(error) || '系统异常',
icon: 'error'
})
reject(error)
......@@ -112,9 +112,15 @@ class Request {
appKey = secretKey[projectName].appKey
secret = secretKey[projectName].secret
}
const sessionId = util.getSessionId()
let {
sessionId
} = wx.p.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
......@@ -122,7 +128,7 @@ class Request {
params.v = '1.0.0'
params.format = 'json'
params.locale = 'zh_CN'
params.source = 'Aicard-wechat'
params.source = 'dj-wechat'
params.appKey = appKey
return sign(params, secret, noSignAttr)
}
......
......@@ -8,6 +8,10 @@ page {
--btnColor: #FC5B32;
--borderRadius: 8rpx;
--margin: 32rpx;
/* 兼容 IOS<11.2 先constant再env */
--constantSafeAreaInsetBottom: constant(safe-area-inset-bottom);
/* 兼容 IOS>11.2 */
--envSafeAreaInsetBottom: env(safe-area-inset-bottom);
}
image {
......@@ -15,9 +19,3 @@ image {
height: 100%;
vertical-align: top;
}
.icon-mine-arrow {
width: 16rpx !important;
height: 28rpx !important;
transform: translateY(7rpx);
}
\ No newline at end of file
......@@ -11,10 +11,26 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(__wxConfig)
async onLoad(options) {
this.tabList = __wxConfig.tabBar.list
wx.p.wxApi.showLoading()
try {
const {
code,
data,
message
} = await wx.p.api.userApi.login()
wx.$authStatus = code != 0
if (data) wx.setStorageSync('merchant_info', {
merchantId: data.merchantId,
merchantName: data.merchantName
})
if (code == '0') {
wx.p.storage.set('userInfo', data)
wx.p.storage.set('sessionId', data.sessionId)
if (!data) throw message
}
console.log(data, '=============')
//scenc获取页面参数并跳转
if (options.scene) {
return
......@@ -24,12 +40,21 @@ Page({
}
// 默认跳转到首页
wx.p.router.goHome()
} catch (error) {
console.log(error)
wx.p.wxApi.showToast(String(error))
}
},
jumpPage(val){
jumpPage(val) {
const targetPath = decodeURIComponent(val),
{url, events} = this.setRouteData(targetPath),
{
url,
events
} = this.setRouteData(targetPath),
routeName = this.tabList.findIndex(e => `/${e.pagePath}` == `${url}.html`) > -1 ? 'switchTab' : 'redirectTo'
wx.p.router[routeName](url,events)
events.notIntercept = true
wx.p.router[routeName](url, events)
},
setRouteData(targetPath) {
let [url, query] = targetPath.split('?'),
......
{
"usingComponents": {}
"usingComponents": {},
"navigationStyle": "custom"
}
\ No newline at end of file
/* pages/tab/mine/index.wxss */
\ No newline at end of file
/* pages/tab/mine/mine.wxss */
.layout {
padding-bottom: 60rpx;
position: relative;
}
.bg {
width: 100%;
height: 422rpx !important;
position: absolute;
z-index: -1;
top: 0;
left: 0;
}
.navigation-bar {
position: fixed;
top: 0;
left: 0;
z-index: 2;
}
.mine .box {
margin: 20rpx 20rpx 0 20rpx;
}
.user-box {
position: relative;
/* height: 283rpx; */
box-sizing: border-box;
padding-left: var(--margin);
/* background: linear-gradient(180deg, #EDF2FA 0%, #FFFFFF 100%); */
}
.user-box .coupon-info view {
font-size: 32rpx;
margin-top: 8rpx;
font-weight: normal;
}
.user-info {
display: flex;
align-items: center;
position: relative;
overflow: hidden;
}
.user-info .auth-button {
position: absolute;
width: calc(100% + 32rpx);
height: 100%;
opacity: 0;
left: -32rpx;
padding: 0;
}
.avatar {
width: 80rpx;
height: 80rpx;
overflow: hidden;
border-radius: 100%;
margin-right: 20rpx;
flex-shrink: 0;
}
.info.auth {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32rpx;
color: #0A0D14;
}
.user-info .nickName {
display: flex;
align-items: center;
font-size: 32rpx;
.text {
max-width: 50%;
}
}
.user-info .setUp {
width: 40rpx;
height: 40rpx;
position: absolute;
right: 40rpx;
}
.user-info .setUpZinx {
z-index: -1;
}
.user-info .vip {
margin-left: 8rpx;
width: 80rpx;
height: 32rpx;
}
.user-info .vip_card {
margin-left: 4rpx;
width: 80rpx;
height: 32rpx;
}
.user-info .phone {
margin-top: 4rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 22rpx;
color: #3F444D;
}
.car-box {
background-color: #fff;
/* box-shadow: 0 4rpx 16rpx 0 rgba(0, 0, 0, 0.1); */
border-radius: 16rpx;
min-height: 222rpx;
}
.car-box.GH {
height: 388rpx;
}
.my-car {
height: 270rpx;
background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(252, 91, 50, 0.06) 100%);
border-radius: 8rpx;
box-sizing: border-box;
padding: 20rpx 24rpx;
}
.car-info .bottm {
display: flex;
justify-content: center;
}
.car-info .btn {
width: 378rpx;
height: 100rpx;
background: #F5F8FF;
border-radius: 50px;
margin-top: 16rpx;
font-family: PingFangSC-Regular;
font-size: 28rpx;
color: #2A69FF;
display: flex;
align-items: center;
justify-content: center;
line-height: 40rpx;
}
.car-info .btn .btn-icon {
width: 40rpx;
height: 40rpx;
margin-right: 24rpx;
}
.car-info {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: var(--margin);
font-size: var(--margin);
color: #656566;
}
.car-info .icon-mine-arrow {
transform: translateY(8rpx);
margin-left: 6rpx;
}
.car-info .title {
font-weight: 500;
display: flex;
justify-content: space-between;
align-items: center;
font-family: PingFangSC-Medium;
font-size: 32rpx;
color: #0A0D14;
}
.car-info .title .edit {
font-size: 24rpx;
font-weight: normal;
color: #858A94;
display: flex;
align-items: center;
}
.car-info .title .edit .arrow {
width: 8rpx;
height: 14rpx;
margin-left: 10rpx;
}
.car-info .btnBox {
display: flex;
margin-top: 24rpx;
align-items: center;
.left-wrap{
.logo{
width: 84rpx;
height: 84rpx;
margin-bottom: 16rpx;
}
.row{
display: flex;
.name{
width: 98rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-weight: 600;
font-size: 24rpx;
color: #3F444D;
}
}
}
.right-wrap-panel{
width: 100%;
border-left: 2rpx solid #efefef;
box-sizing: border-box;
padding-left: 20rpx;
margin-left: 30rpx;
overflow: hidden;
.scroll_widget{
width: calc(100% - 20rpx);
height: 120rpx;
overflow: hidden;
vertical-align: top;
white-space: nowrap;
.device{
display: inline-block;
.wrapper2{
display: flex;
align-items: center;
}
.icon{
width: 120rpx;
height: 120rpx;
}
.text{
width: 184rpx;
height: 72rpx;
font-weight: 400;
font-size: 26rpx;
color: #0A0D14;
white-space: pre-wrap;
}
}
}
}
}
.car-info .btnBox .leftIcon {
width: 84rpx;
height: 84rpx;
}
.car-info .btnBox .rightBox {
margin-left: 20rpx;
}
.car-info .btnBox .plate-name {
width: 40rpx;
height: 40rpx;
background: #2A69FF;
border-radius: 4rpx;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
margin-right: 8rpx;
display: inline-block;
line-height: 40rpx;
text-align: center;
}
.car-info .btnBox .plate-number {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #0A0D14;
}
.car-info .btnBox .car-brand {
font-size: 24rpx;
max-width: 542rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 15rpx;
color: #3F444D;
}
.car-info .btnBox .car-brand .brand-name {
font-family: PingFangSC-S0pxibold;
font-weight: 600;
font-size: 24rpx;
color: #3F444D;
}
.coupon-box {
background: #FFFFFF;
box-sizing: border-box;
border-radius: 16rpx 16rpx 0 0;
padding: var(--margin);
}
.coupon-box .title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32rpx;
color: #0A0D14;
}
.coupon-box .item {
flex: 1;
justify-content: center;
flex-direction: column;
align-items: center;
margin-top: 24rpx;
}
.coupon-box .coupon-number {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #0A0D14;
}
.coupon-box .coupon-content {
font-size: 24rpx;
color: #0A0D14;
}
.user-items {
background-color: #fff;
margin-top: 20rpx;
border-radius: 8rpx;
}
.user-items .item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 28rpx;
height: 88rpx;
font-size: 28rpx;
}
.user-items .item .label {
display: flex;
align-items: center;
}
.user-items .item .icon {
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
}
.auth-phone-box {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 2;
}
.auth-phone-bg {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
}
.member-box {
height: 136rpx;
background-image: linear-gradient(165deg, #303030 2%, #070707 98%);
border-radius: 16rpx;
margin: 32rpx 20rpx 0;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.member-box .left-box {
position: absolute;
left: 24rpx;
display: flex;
align-items: center;
justify-content: center;
}
.member-box .left-box .member-icon {
width: 72rpx;
height: 60rpx;
}
.member-box .left-box .left-content {
margin-left: 24rpx;
}
.member-box .left-box .left-content .card {
font-weight: 600;
font-size: 28rpx;
color: #EECC9C;
letter-spacing: 0;
font-family: PingFangSC-S0pxibold;
margin-bottom: 8rpx;
}
.member-box .left-box .left-content .describe {
font-weight: 400;
font-size: 20rpx;
color: #EECC9C;
letter-spacing: 0;
}
.member-box .left-box .left-content .money {
color: #FF6038;
}
.member-box .member-button {
width: 156rpx;
height: 56rpx;
background-image: radial-gradient(circle at 12% 25%, #FDE8BF 0%, #DDA15F 98%);
border-radius: 28rpx;
line-height: 56rpx;
text-align: center;
font-size: 24rpx;
color: #070707;
font-family: PingFangSC-Regular;
position: absolute;
right: 32rpx;
}
.member-box .member-price {
font-family: PingFangSC-Regular;
font-size: 24rpx;
color: #FFFFFF;
letter-spacing: 0;
height: 30rpx;
line-height: 30rpx;
background: #FF6038;
border-radius: 15rpx 15rpx 15rpx 0;
padding: 0rpx 12rpx;
position: absolute;
top: 18rpx;
right: -6rpx;
}
.member-box .goUseBox {
display: flex;
align-items: center;
position: absolute;
right: 28rpx;
font-family: PingFangSC-Regular;
font-size: 24rpx;
color: #FFE5B8;
letter-spacing: 0;
}
.member-box .goUseBox .goUseBox-icon {
width: 28rpx;
height: 28rpx;
margin-left: 12rpx;
}
.tool-box {
background-color: #fff;
box-sizing: border-box;
padding: 28rpx var(--margin);
position: relative;
border-radius: 16rpx;
}
.tool-box .title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32rpx;
color: #0A0D14;
}
.tool-box .btnBox {
display: flex;
// justify-content: space-evenly;
}
.tool-box .btnBox .independentBox {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-right: 57rpx;
}
.tool-box .btnBox .independentBox:nth-child(5){
margin-right: 0;
}
.tool-box .btnBox .independentBox .tool-img {
width: 64rpx;
height: 64rpx;
margin: 40rpx 0 26rpx 0;
}
.tool-box .btnBox .independentBox .tool-content {
font-size: 24rpx;
color: #0A0D14;
letter-spacing: 0;
}
.dev-box {
background-color: #fff;
padding-top: 28rpx;
.title {
margin-bottom: 12rpx;
font-weight: 500;
font-size: 32rpx;
color: #0A0D14;
text-indent: 32rpx;
}
.scroll-box {
overflow-x: scroll;
padding-bottom: 24rpx;
&::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
.item {
font-size: 26rpx;
color: #0A0D14;
margin-left: 20rpx;
.dev-img {
width: 120rpx;
height: 120rpx;
margin-right: 12rpx;
flex-shrink: 0;
}
.dev-content {
max-width: 184rpx;
flex-shrink: 0;
}
&:first-of-type {
padding-left: 12rpx;
}
}
}
}
.dev-box {
.title .edit {
font-size: 24rpx;
font-weight: normal;
color: #858A94;
display: flex;
align-items: center;
margin-left: auto;
}
.icon-mine-arrow {
transform: translateY(8rpx);
margin-left: 6rpx;
}
}
.sprite-icon {
background-image: url(https://img02.glsx.com.cn/weapp/resource/dj-shopmall-test/sprite-1650770528010.png) !important;
background-size: 376rpx 364rpx !important;
}
.car-info .icon-mine-arrow {
transform: translateY(4rpx) !important;
margin-left: 6rpx;
}
\ No newline at end of file
<!--pages/tab/mine/index.wxml-->
<text>pages/tab/mine/index.wxml</text>
<view class="navigation-bar">
<navigation-bar navStyle="{{navStyle}}" bindnavbarReady="navbarReady" page-title="个人中心">个人中心</navigation-bar>
</view>
<view class="layout" wx:if="{{user_box_style}}">
<view class="user-box" style="{{user_box_style}}">
<view class="user-info">
<view class="avatar">
<block wx:if="{{userInfo && userInfo.headImgUrl}}">
<image webp src="{{userInfo.headImgUrl}}"></image>
</block>
<block wx:else>
<image webp src="{{IMGURL}}mine/default-avatar.jpg?v={{img_version}}"></image>
</block>
</view>
<view class="info {{userInfo?'':'auth'}}">
<block wx:if="{{userInfo}}">
<view class="nickName">
{{userInfo.nickName || '微信用户'}}
<view class="vip text-center">已认证</view>
</view>
<view class="phone">{{userInfo.phone}}</view>
</block>
<block wx:else>点击登录</block>
</view>
<block wx:if="{{!userInfo}}">
<view class="auth-button" bindtap="login"></view>
<!-- <button open-type="getPhoneNumber" bindtap="login" bindgetphonenumber="getPhoneNumber" class="auth-button"></button> -->
</block>
<block wx:if="{{userInfo && !userInfo.nickName}}">
<view class="auth-button" bindtap="showAuthModal"></view>
</block>
</view>
<view class="coupon-info flex">
<view class="item flex" bindtap="goto" data-url="coupon">
{{total || '0'}}
<view>我的优惠券/张</view>
</view>
<view class="item flex" bindtap="goto" data-url="boutique">
{{gitTotal || '0'}}
<view>精品礼券/张</view>
</view>
</view>
</view>
<!-- 广汇车辆 -->
<block wx:if="{{carFlag}}">
<view class="car-box box GH">
<block wx:if="{{!carList.length}}">
<view class="add-car text-center">
添加爱车专属优惠
<view class="btn flex" bindtap="goto" data-url="GHVehicleInfo">
<view class="sprite-icon icon-mine-add"></view>
添加
</view>
</view>
</block>
<block wx:else>
<view class="car-info">
<view class="title">
我的爱车
<view class="edit" bindtap="goto" data-url="GHVehicleInfo" data-name="list">
管理
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</view>
<view class="my-car">
<gh-car-card item="{{carList[0]}}" selectedCar="null"></gh-car-card>
</view>
</view>
</block>
</view>
</block>
<block wx:if="{{merchantDetail}}">
<view class="merchant-box box">
<view class="title">
<view class="name text-hide">{{merchantDetail.storeName}}</view>
</view>
<view class="address">{{merchantDetail.address}}</view>
<view class="serve-item">
<block wx:if="{{merchantDetail.appointmentPhone}}">
<view class="item flex" bindtap="phoneCall" data-phone="{{merchantDetail.appointmentPhone}}">
<view class="sprite-icon icon-mine-gh-phone"></view>
通话
</view>
</block>
<block wx:if="{{merchantDetail.merchantAddress}}">
<view class="item flex" bindtap="openLocation" data-item="{{merchantDetail}}">
<view class="sprite-icon icon-mine-gh-gps"></view>
导航
</view>
</block>
<block wx:if="{{consultant == null}}">
<view class="item-counselor flex" bindtap="openConsultant" data-item="{{merchantDetail}}">
<view class="icon">
<image webp src="{{IMGURL}}mine/serve.png?v={{img_version}}"></image>
</view>
选择服务顾问
</view>
</block>
</view>
<block wx:if="{{consultant != null}}">
<view class="counselor">
<view class="userInfo">
<view class="counselor-avatar">
<block wx:if="{{consultant.avatar}}">
<image webp src="{{consultant.avatar}}"></image>
</block>
<block wx:else>
<image webp src="{{IMGURL}}mine/default-avatar.png?v={{img_version}}"></image>
</block>
</view>
<view>{{consultant.consultantName}}</view>
</view>
<view class="userInfo">
<view class="user-phone" bindtap="phoneCall" data-phone="{{consultant.phone}}">
<view class="sprite-icon icon-mine-gh-phone"></view>
通话
</view>
<view class="more" bindtap="goCounselor">更多</view>
</view>
</view>
</block>
</view>
</block>
<view class="user-items box">
<block wx:for="{{utilList}}" wx:key="index">
<view class="item" bindtap="jump" data-item="{{item}}">
<view class="label">
<view class="sprite-icon icon-mine-{{item.icon || item.url}} icon"></view>
{{item.text}}
</view>
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</block>
</view>
</view>
\ No newline at end of file
// pages/tab/mine/mine.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
})
{
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
\ No newline at end of file
<view class="navigation-bar">
<navigation-bar navStyle="{{navStyle}}" bindnavbarReady="navbarReady" page-title="个人中心">个人中心</navigation-bar>
</view>
<view class="layout" wx:if="{{user_box_style}}">
<view class="user-box" style="{{user_box_style}}">
<view class="user-info">
<view class="avatar">
<block wx:if="{{userInfo && userInfo.headImgUrl}}">
<image webp src="{{userInfo.headImgUrl}}"></image>
</block>
<block wx:else>
<image webp src="{{IMGURL}}mine/default-avatar.jpg?v={{img_version}}"></image>
</block>
</view>
<view class="info {{userInfo?'':'auth'}}">
<block wx:if="{{userInfo}}">
<view class="nickName">
{{userInfo.nickName || '微信用户'}}
<view class="vip text-center">已认证</view>
</view>
<view class="phone">{{userInfo.phone}}</view>
</block>
<block wx:else>点击登录</block>
</view>
<block wx:if="{{!userInfo}}">
<view class="auth-button" bindtap="login"></view>
<!-- <button open-type="getPhoneNumber" bindtap="login" bindgetphonenumber="getPhoneNumber" class="auth-button"></button> -->
</block>
<block wx:if="{{userInfo && !userInfo.nickName}}">
<view class="auth-button" bindtap="showAuthModal"></view>
</block>
</view>
<view class="coupon-info flex">
<view class="item flex" bindtap="goto" data-url="coupon">
{{total || '0'}}
<view>我的优惠券/张</view>
</view>
<view class="item flex" bindtap="goto" data-url="boutique">
{{gitTotal || '0'}}
<view>精品礼券/张</view>
</view>
</view>
</view>
<!-- 广汇车辆 -->
<block wx:if="{{carFlag}}">
<view class="car-box box GH">
<block wx:if="{{!carList.length}}">
<view class="add-car text-center">
添加爱车专属优惠
<view class="btn flex" bindtap="goto" data-url="GHVehicleInfo">
<view class="sprite-icon icon-mine-add"></view>
添加
</view>
</view>
</block>
<block wx:else>
<view class="car-info">
<view class="title">
我的爱车
<view class="edit" bindtap="goto" data-url="GHVehicleInfo" data-name="list">
管理
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</view>
<view class="my-car">
<gh-car-card item="{{carList[0]}}" selectedCar="null"></gh-car-card>
</view>
</view>
</block>
</view>
</block>
<block wx:if="{{merchantDetail}}">
<view class="merchant-box box">
<view class="title">
<view class="name text-hide">{{merchantDetail.storeName}}</view>
</view>
<view class="address">{{merchantDetail.address}}</view>
<view class="serve-item">
<block wx:if="{{merchantDetail.appointmentPhone}}">
<view class="item flex" bindtap="phoneCall" data-phone="{{merchantDetail.appointmentPhone}}">
<view class="sprite-icon icon-mine-gh-phone"></view>
通话
</view>
</block>
<block wx:if="{{merchantDetail.merchantAddress}}">
<view class="item flex" bindtap="openLocation" data-item="{{merchantDetail}}">
<view class="sprite-icon icon-mine-gh-gps"></view>
导航
</view>
</block>
<block wx:if="{{consultant == null}}">
<view class="item-counselor flex" bindtap="openConsultant" data-item="{{merchantDetail}}">
<view class="icon">
<image webp src="{{IMGURL}}mine/serve.png?v={{img_version}}"></image>
</view>
选择服务顾问
</view>
</block>
</view>
<block wx:if="{{consultant != null}}">
<view class="counselor">
<view class="userInfo">
<view class="counselor-avatar">
<block wx:if="{{consultant.avatar}}">
<image webp src="{{consultant.avatar}}"></image>
</block>
<block wx:else>
<image webp src="{{IMGURL}}mine/default-avatar.png?v={{img_version}}"></image>
</block>
</view>
<view>{{consultant.consultantName}}</view>
</view>
<view class="userInfo">
<view class="user-phone" bindtap="phoneCall" data-phone="{{consultant.phone}}">
<view class="sprite-icon icon-mine-gh-phone"></view>
通话
</view>
<view class="more" bindtap="goCounselor">更多</view>
</view>
</view>
</block>
</view>
</block>
<view class="user-items box">
<block wx:for="{{utilList}}" wx:key="index">
<view class="item" bindtap="jump" data-item="{{item}}">
<view class="label">
<view class="sprite-icon icon-mine-{{item.icon || item.url}} icon"></view>
{{item.text}}
</view>
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</block>
</view>
</view>
<login show="{{showLogin}}"></login>
<authorize scopeType="userInfo" title="是否授权用户昵称&头像" confirmText="授权" cancelText="拒绝" show="{{showAuth}}" bindsuccess="authSuccess"></authorize>
\ No newline at end of file
/**app.wxss**/
.sticky {
position: sticky;
top: 0;
left: 0;
z-index: 2;
background-color: #fff;
}
.flex {
display: flex;
align-items: center;
}
.y-center {
top: 50%;
transform: translateY(-50%);
}
.x-center {
left: 50%;
transform: translateX(-50%);
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.isFullSucreen {
padding-bottom: var(--constantSafeAreaInsetBottom) !important;
padding-bottom: var(--envSafeAreaInsetBottom) !important;
}
.isFullSucreen-bottom {
bottom: var(--constantSafeAreaInsetBottom) !important;
bottom: var(--envSafeAreaInsetBottom) !important;
}
.isFullSucreen-padding-bottom {
padding-bottom: var(--constantSafeAreaInsetBottom) !important;
padding-bottom: var(--envSafeAreaInsetBottom) !important;
}
.default-btn {
width: 686rpx;
height: 88rpx;
background: var(--btnColor);
border-radius: var(--borderRadius);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: var(--margin);
}
/* .list-nothing {
width: 100%;
padding: 8rpx 0 30rpx;
text-align: center;
font-size: 28rpx;
color: #C1C2C3;
} */
.list-nothing {
width: 100%;
padding: 8rpx 0 30rpx;
text-align: center;
font-size: 24rpx;
color: #858A94;
}
.list-nothing.to-bottom::after {
content: '- 到 底 了 -'
}
.list-nothing .icon {
width: 320rpx;
height: 320rpx;
}
.list-not {
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-size: 24rpx;
height: 100%;
}
.flex_sc {
display: flex;
align-items: center;
}
.store-btn-disabled {
background-image: none;
background: #CCCED1 !important;
color: #fff !important;
}
.store-btn-disabled::after {
border: none;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
@keyframes show-box {
0% {
opacity: 0;
transform: scale(2.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes show-box-opacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
\ No newline at end of file
import getAppId from '~/utils/utils_wx'
// 图片cdn 加速使用地址
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram-test/cgacar/'
// 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
export const appId = getAppId.getAppId()
// 缓存get方法key的对应才映射值
export const STORAGE_OBJECTkEY = {
......@@ -11,8 +13,8 @@ export const STORAGE_OBJECTkEY = {
mock_data: 'mock_data',
merchant_info: 'merchant_info',
address_info: 'address_info',
srcm_shopmall_user_info: 'srcm_shopmall_user_info',
scrm_shopmall_sessionId: 'scrm_shopmall_sessionId',
userInfo: 'userInfo',
sessionId: 'sessionId',
}
// 图片版本号
......
......@@ -132,7 +132,10 @@ const getViewInfo = (name, callBack, componentThis) => {
})
.exec()
}
/** 获取小程序 appId */
const getAppId = () => {
return wx.getAccountInfoSync().miniProgram.appId
}
const wxApi = {
previewImage,
getSystemInfo,
......@@ -142,7 +145,8 @@ const wxApi = {
showToast,
phoneCall,
noScroll,
getViewInfo
getViewInfo,
getAppId
}
export default wxApi
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!