Commit 6a49815d by 张立顺

切换账号联调

2 parents 0f48add7 4b985613
Showing 68 changed files with 1938 additions and 729 deletions
import api from '~/utils/request/request'
const {
appId
} = wx.getAccountInfoSync().miniProgram
const { appId } = wx.getAccountInfoSync().miniProgram
const CODE = {
platformEntrance: 'BUSINESS_ASSISTANT',
productCode: 'PC00c3'
}
class UsersApi {
/**调用后台接口获取用户信息js_code换取sessionId */
async wxCodeLogin() {
const {
code
} = await this.getWxCode()
return await api.post({
const { code } = await this.getWxCode()
return await api.post(
{
method: 'scrm.api.sso.wechat.applets.jscode.login',
appId,
code
......@@ -18,7 +19,8 @@ class UsersApi {
}
/**退出登录 */
logout() {
return api.post({
return api.post(
{
method: 'scrm.api.sso.wechat.applets.logout'
},
true
......@@ -44,10 +46,11 @@ class UsersApi {
delete detail.errMsg
if (detail.iv && detail.encryptedData) {
detail.loginToken = loginToken
return api.post({
return api.post(
{
method: 'scrm.api.sso.wechat.applets.auth.phone',
...detail,
platformEntrance: 'BUSINESS_ASSISTANT', // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
platformEntrance: 'BUSINESS_ASSISTANT' // 平台标识:生意助手-BUSINESS_ASSISTANT,门店助手-STORE_ASSISTANT
},
true
)
......@@ -55,17 +58,19 @@ class UsersApi {
}
/**账号密码登录 */
async accountLogin(data = {}) {
return api.post({
return api.post(
{
method: 'scrm.api.sso.wechat.applets.password.login',
...data,
platformEntrance: 'BUSINESS_ASSISTANT',
...CODE
},
true
)
}
/** 手机号获取短信验证码 */
getSmsCode(mobile) {
return api.post({
return api.post(
{
method: 'scrm.api.sso.wechat.applets.sms.get.code',
mobile
},
......@@ -74,7 +79,8 @@ class UsersApi {
}
/** 手机号短信验证码登录 */
phoneSmsLogin(data = {}) {
return api.post({
return api.post(
{
method: 'scrm.api.sso.wechat.applets.sms.login',
...data,
source: 'MINIAPP',
......@@ -85,9 +91,10 @@ class UsersApi {
}
/** 获取登录账号列表 */
getAccountList(sessionId) {
return api.post({
return api.post(
{
method: 'scrm.api.sso.wechat.applets.listSelectAccount',
platformEntrance: 'BUSINESS_ASSISTANT',
...CODE,
sessionId
},
true
......@@ -96,9 +103,10 @@ class UsersApi {
/**
* 选择账号登录(手机绑定多个账号时) */
selectAccountLogin(data) {
return api.post({
return api.post(
{
method: 'scrm.api.sso.wechat.applets.selectAccountLogin',
platformEntrance: 'BUSINESS_ASSISTANT',
...CODE,
...data
},
true
......@@ -106,11 +114,31 @@ class UsersApi {
}
/**检查sessionId 是否过期 */
checkSession() {
return api.post({
return api.post(
{
method: 'scrm.api.sso.login.status.check'
},
true
)
}
/** 超级管理员切换账号 */
adminSelectLogin(data) {
return api.post(
{
method: 'scrm.api.sso.super.administrator.select.login',
...CODE,
...data
}
// true
)
}
/** 超管切换子账号 */
switchSubLoginInfo(data) {
return api.post({
method: 'scrm.api.sso.wechat.applets.switch.subLoginInfo',
...CODE,
...data
})
}
}
export default UsersApi
\ No newline at end of file
export default UsersApi
......@@ -26,7 +26,12 @@ promisifyAll()
import { Storage } from './utils/cache/storage'
const $Storage = new Storage()
//全局分享
import './utils/share'
//监听网络状态
import './utils/network'
App({
onLaunch(options) {
/**挂载到wx对象 */
......
{
"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", "pages/mineDetail/customerManagement/customerManagement", "pages/mineDetail/messageBox/messageBox"],
"pages": ["login/loading/loading", "pages/tab/index/index", "pages/tab/output/output", "pages/tab/mine/mine", "pages/webView/webView", "pages/apply/apply", "login/index/index", "login/accountItems/accountItems", "pages/mineDetail/customerManagement/customerManagement", "pages/mineDetail/messageBox/messageBox"],
"requiredPrivateInfos": ["getLocation"],
"lazyCodeLoading": "requiredComponents",
"window": {
......@@ -36,7 +36,8 @@
"subpackages": [],
"usingComponents": {
"tab": "/components/Tab/Tab",
"navigation-bar": "/components/NavigationBar/NavigationBar"
"navigation-bar": "/components/NavigationBar/NavigationBar",
"popup": "/components/Popup/Popup"
},
"style": "v2",
"resolveAlias": {
......
......@@ -19,7 +19,7 @@ Component({
}, 0.2 * 1000)
} else {
let hideTab = wx.$hideTab
console.log(hideTab)
// console.log(hideTab)
this.setData({
showPopup: true,
close: false,
......@@ -55,6 +55,7 @@ Component({
this.setData({
show: false
})
this.triggerEvent('hidePopup')
},
confirm() {
this.triggerEvent('confirm')
......
......@@ -25,8 +25,13 @@ Component({
itemWidth: String,
align: {
type: String,
default: ''
}
value: ''
},
// 是否有红点
redpoint: {
type: Array,
value: ['看线索']
},
},
/**
......
<wxs src="./Tab.wxs" module="filterUtils" />
<block wx:if="{{openScroll}}">
<scroll-view
class="tab-box {{align}} {{outClassName}}"
scroll-x
enable-flex
scroll-with-animation
scroll-into-view="{{to}}">
class="tab-box {{align}} {{outClassName}}"
scroll-x
enable-flex
scroll-with-animation
scroll-into-view="{{to}}"
>
<block wx:for="{{tab}}" wx:key="index">
<view
class="tab {{index==count?'active':''}}"
bindtap="click"
data-count="{{index}}"
id="to-{{index}}">
class="tab {{index==count?'active':''}}"
bindtap="click"
data-count="{{index}}"
id="to-{{index}}"
>
<view class="text">{{item}}</view>
<!-- <view class="text" style="width:{{38 * item.length + 20}}rpx;">{{item}}</view> -->
<view class="line" />
......@@ -22,12 +25,16 @@
<view class="tab-box flex">
<block wx:for="{{tab}}" wx:key="index">
<view
class="tab {{index==count?'active':''}}"
style="width:{{itemWidth}}"
bindtap="click"
data-count="{{index}}">
<view class="text text-center">{{item}}</view>
class="tab {{index==count?'active':''}}"
style="width:{{itemWidth}}"
bindtap="click"
data-count="{{index}}"
>
<view class="text text-center">
{{item}}
</view>
<view class="line" style="lineStyle" />
<view wx:if="{{filterUtils.hasRedpoint(redpoint,item)}}" class="redpoint" />
</view>
</block>
</view>
......
/**
*
* @param array 数组
* @param item 数组中的某一项
* @returns
*/
var hasRedpoint = function (array, item) {
// console.log('array: ', array);
return array.length > 0 && array.indexOf(item) != -1;
};
module.exports = {
hasRedpoint: hasRedpoint,
};
......@@ -71,6 +71,17 @@
height: 0;
color: transparent;
}
.redpoint {
position: absolute;
top: 0;
right: 0;
/* top: 8px;
right: 10px; */
width: 10px;
height: 10px;
background: #EB4E4E;
border-radius: 50%;
}
/* 外部出进来的自定义样式 */
.project-tab{
padding-left: 20px;
......@@ -86,3 +97,4 @@
.project-tab .tab .line{
width:auto;
}
......@@ -16,7 +16,7 @@ page {
content: '';
width: 100%;
height: 486rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.png') no-repeat;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.webp') no-repeat;
background-size: 100% 486rpx;
position: absolute;
left: 0;
......
......@@ -10,20 +10,20 @@
{{item.merchantName}}{{item.isSuper?'(超管)':item.userType==1?'(商户号)':'(员工号)'}}
</view>
<view class="icon">
<image src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/radio.png" />
<image src="{{IMGURL}}login/radio.png" />
</view>
<view class='radio' />
</view>
</block>
</block>
<block wx:else>
<view class="list-not" bindtap="getListSelectAccount">
<view class="list-not text-center" bindtap="getListSelectAccount">
点击刷新
</view>
</block>
</block>
</view>
<view class="btn-box isFullSucreen">
<button class="button" bindtap="choiceAccountLogin">确定</button>
<button class="button" disabled="{{!loginUserInfoList.length}}" bindtap="choiceAccountLogin">确定</button>
</view>
</view>
\ No newline at end of file
// login/index/components/Agree/Agree.js
import { imgUrlMixin } from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
options: {
styleIsolation: 'shared'
},
......
<block wx:if="{{show}}">
<view class="agree text-center">
<view class="icon {{agree}}" bindtap="agree">
<image src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/radio.png"></image>
<image webp src="{{IMGURL}}login/radio.png"></image>
</view>
<block wx:if="{{text}}">{{text}}</block>
<block wx:else>
......
// login/index/components/LoginBox.js
import USERAPI from '~/api/usersApi/index'
import {
selectAccountLogin,
setLoginInfo,
loginModal
} from '~/login/lib/index'
import { selectAccountLogin, setLoginInfo, loginModal } from '~/login/lib/index'
import md5 from '~/utils/lib/md5'
import network from '~/utils/network'
import { imgUrlMixin } from '~/mixins/index'
let thisPage
Component({
behaviors: [imgUrlMixin],
options: {
styleIsolation: 'shared'
},
......@@ -38,31 +38,28 @@ Component({
methods: {
/**隐藏验证码错误 */
hideError(name) {
if (name == 'code') this.setData({
smsError: false
})
if (name == 'code')
this.setData({
smsError: false
})
},
/**输入回调 */
input(e) {
const {
value
} = e.detail, {
name
} = e.currentTarget.dataset
const { value } = e.detail,
{ name } = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: value
})
if (name == 'phone') this.setData({
phoneReady: thisPage.validate.methods.tel(value)
})
if (name == 'phone')
this.setData({
phoneReady: thisPage.validate.methods.tel(value)
})
this.hideError(name)
this.checkFormData()
},
/**清除input value */
clear(e) {
const {
name
} = e.currentTarget.dataset
const { name } = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: ''
})
......@@ -71,63 +68,58 @@ Component({
},
/**获取验证码 */
getSmsCode() {
const {
phoneReady,
formData,
count
} = this.data,
const { phoneReady, formData, count } = this.data,
countDown = 60
if (!phoneReady || count) return
this.setData({
smsLoading: true
})
USERAPI.getSmsCode(formData.phone).then(({
code,
message
}) => {
this.setData({
smsLoading: false
USERAPI.getSmsCode(formData.phone)
.then(({ code, message }) => {
this.setData({
smsLoading: false
})
if (code == '0') this.countDown(countDown)
else wx.$api.showToast(message || '发送验证码失败')
})
if (code == '0') this.countDown(countDown)
else wx.$api.showToast(message || '发送验证码失败')
}).catch(err => {
this.setData({
smsLoading: false
.catch(err => {
this.setData({
smsLoading: false
})
wx.$api.showToast(err || '发送验证码失败')
})
wx.$api.showToast(err || '发送验证码失败')
})
},
/**验证码倒计时 */
countDown(countDown) {
if (countDown) this.setData({
count: countDown
})
if (countDown)
this.setData({
count: countDown
})
setTimeout(() => {
let {
count
} = this.data
let { count } = this.data
this.setData({
count: --count
})
if (count > 0) this.countDown()
else this.setData({
count: null
})
else
this.setData({
count: null
})
}, 1e3)
},
/**检查输入框内容 */
checkFormData() {
const {
loginType,
formData
} = this.data
const { loginType, formData } = this.data
if (loginType != 0) {
if (loginType == 1) {
this.setData({
phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone)
}, () => {
thisPage.checkLoginBtn()
})
this.setData(
{
phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone)
},
() => {
thisPage.checkLoginBtn()
}
)
} else thisPage.checkLoginBtn()
}
},
......@@ -139,94 +131,83 @@ Component({
},
/**手机号&帐号密码登录 */
login() {
const {
formData,
loginType
} = this.data,
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()
USERAPI[target](obj).then(({
code,
data,
message
}) => {
this.setBtnLoading(false)
if (code == '0') {
if (loginType == 1) this.checkLoginUserInfo(data)
else {
const {
autoLogin
} = thisPage.data, {
sessionId
} = data,
validTime = 3600 * 24 * 30 * 1e3,
autoLoginFailureTime = Date.now() + validTime
if (autoLogin) {
wx.$storage.set('auto_login_object', {
failureTime: autoLoginFailureTime,
}[loginType],
obj =
loginType == 1
? {
mobile: formData.phone,
code: formData.code
}
: {
userName: formData.account,
password: formData.password
password: md5(formData.password)
}
this.setBtnLoading()
USERAPI[target](obj)
.then(({ code, data, message }) => {
this.setBtnLoading(false)
if (code == '0') {
if (loginType == 1) this.checkLoginUserInfo(data)
else {
const { autoLogin } = thisPage.data,
{ sessionId } = data,
validTime = 3600 * 24 * 30 * 1e3,
autoLoginFailureTime = Date.now() + validTime
if (autoLogin) {
wx.$storage.set('auto_login_object', {
failureTime: autoLoginFailureTime,
userName: formData.account,
password: md5(formData.password)
})
} else wx.$storage.rm('auto_login_object')
console.log(data)
setLoginInfo(data, sessionId)
}
} else {
if (loginType == 1)
this.setData({
smsError: true
})
} else wx.$storage.rm('auto_login_object')
setLoginInfo(data, sessionId)
wx.$api.showToast(message || '系统异常')
}
} else {
if (loginType == 1) this.setData({
smsError: true
})
wx.$api.showToast(message || '系统异常')
}
}).catch(err => {
wx.$api.showToast('系统异常')
this.setBtnLoading(false)
})
})
.catch(err => {
wx.$api.showToast('系统异常')
this.setBtnLoading(false)
})
},
/**微信登录 */
wxLogin({
detail
}) {
wxLogin({ detail }) {
if (!detail.code) return
this.setBtnLoading()
USERAPI.authUserPhone(detail, this.loginToken).then(({
code,
data,
message
}) => {
if (code == '0') this.checkLoginUserInfo(data)
else wx.$api.showToast(message || '系统异常')
this.setBtnLoading(false)
}).catch(({
errMsg
}) => {
wx.$api.showToast(errMsg || '系统异常')
this.setBtnLoading(false)
})
USERAPI.authUserPhone(detail, this.loginToken)
.then(({ code, data, message }) => {
if (code == '0') this.checkLoginUserInfo(data)
else wx.$api.showToast(message || '系统异常')
this.setBtnLoading(false)
})
.catch(({ errMsg }) => {
wx.$api.showToast(errMsg || '系统异常')
this.setBtnLoading(false)
})
},
/**手机号&微信登录:是否跳转登录列表页 */
checkLoginUserInfo({
loginUserInfoList,
sessionId
}) {
checkLoginUserInfo({ loginUserInfoList, sessionId }) {
/**多个账号 */
if (loginUserInfoList.length > 1) wx.$router.go('login.accountItems', {
sessionId,
...thisPage.options
})
/**只有一个账号 */
else selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
})
if (loginUserInfoList.length > 1)
wx.$router.go('login.accountItems', {
sessionId,
...thisPage.options
})
/**只有一个账号 */ else
selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
})
},
/**设置登录按钮loading状态 */
setBtnLoading(loading = true) {
......@@ -239,13 +220,10 @@ Component({
},
/**页面初始化 */
async init() {
network.getNetworkType()
thisPage = wx.$router.getPageInstance()
try {
const {
data,
code,
message
} = await USERAPI.wxCodeLogin()
const { data, code, message } = await USERAPI.wxCodeLogin()
if (code == '0') {
thisPage.setData({
disabled: false
......@@ -253,9 +231,7 @@ Component({
this.loginToken = data
} else this.reLogin(message)
wx.hideLoading()
} catch ({
errMsg
}) {
} catch ({ errMsg }) {
console.error(errMsg)
this.reLogin()
}
......@@ -267,13 +243,5 @@ Component({
})
if (reload) this.init()
}
},
lifetimes: {
attached: function () {
this.init()
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
}
})
\ No newline at end of file
})
<view class="box">
<block wx:if="{{loginType == 0}}">
<image webp class="img opacity-view" src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/login.png" />
<image webp class="img opacity-view" src="{{IMGURL}}login/login.webp" />
</block>
<block wx:else>
<view class="input-box opacity-view">
......
// login/index/components/TypeList.js
import { imgUrlMixin } from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
/**
* 组件的属性列表
*/
......
......@@ -3,7 +3,7 @@
<block wx:for="{{loginList}}" wx:key="index">
<block wx:if="{{loginType != index}}">
<view class="item" bindtap="changLoginType" data-index="{{index}}">
<image class="icon" src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/icon-{{index}}.png"></image>
<image class="icon" webp src="{{IMGURL}}login/icon-{{index}}.png"></image>
{{item}}
</view>
</block>
......
......@@ -30,11 +30,18 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow() {
onShow(options, refresh) {
if (refresh) {
this.setData({
disabled: true
})
}
wx.hideHomeButton({
success: res => {
wx.hideLoading()
this.checkLoginBtn()
const login = this.selectComponent('#box')
if (login) login.init()
// this.checkLoginBtn()
}
})
},
......@@ -64,9 +71,9 @@ Page({
*/
// onShareAppMessage() {},
/**30天免登 */
changeAgree(e){
changeAgree(e) {
this.setData({
autoLogin:e.detail
autoLogin: e.detail
})
},
checkLoginBtn(disabled = false) {
......
......@@ -8,7 +8,7 @@
content: '';
width: 100%;
height: 486rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.png') no-repeat;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.webp') no-repeat;
background-size: 100% 486rpx;
position: absolute;
left: 0;
......
import {
setSessionId,
setUserInfo
} from '~/utils/cache/storageApi'
import { setSessionId, setUserInfo } from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
const setRouteData = targetPath => {
let [url, query] = targetPath.split('?'),
......@@ -18,25 +15,20 @@ const setRouteData = targetPath => {
}
}
/**选择账号登录 */
const selectAccountLogin = ({
id,
sessionId
}) => {
const selectAccountLogin = ({ id, sessionId }) => {
USERAPI.selectAccountLogin({
id,
sessionId
}).then(({
code,
data,
message
}) => {
}).then(({ code, data, message }) => {
if (code == '0') {
console.log(data)
setLoginInfo(data.loginUserInfoList[0], data.sessionId)
} else wx.$api.showToast(message || '系统异常')
})
}
/**设置登录信息 */
const setLoginInfo = (userInfo, sessionId) => {
console.log(userInfo)
setUserInfo(userInfo)
setSessionId(sessionId)
loginSuccess()
......@@ -44,26 +36,19 @@ const setLoginInfo = (userInfo, sessionId) => {
/**成功跳转 */
const loginSuccess = () => {
const {
options: {
targetPath
}
options: { targetPath }
} = wx.$router.getPageInstance()
if (targetPath) {
const {
url,
obj
} = setRouteData(targetPath)
const { url, obj } = setRouteData(targetPath)
wx.$router.reLaunch(url, obj)
} else wx.$router.go('pages.index')
}
const loginModal = async ({
message,
confirmText
}) => {
const loginModal = async ({ message, confirmText, cancelText }) => {
return new Promise((resolve, reject) => {
wx.showModal({
content: message || '网络异常',
confirmText: confirmText || '重试',
cancelText: cancelText || '取消',
confirmColor: '#3666FE',
success(res) {
if (res.confirm) resolve(res.confirm)
......@@ -78,4 +63,4 @@ module.exports = {
setRouteData,
setLoginInfo,
loginModal
}
\ No newline at end of file
}
......@@ -35,54 +35,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
const sessionId = getSessionId(),
{
url,
targetPath = url ? decodeURIComponent(url) : ''
} = this.options,
autoLoginObject = wx.$storage.get('auto_login_object')
wx.nextTick(() => {
let path = 'pages.index',
obj = {}
if (targetPath) obj.targetPath = targetPath
if (sessionId) {
USERAPI.checkSession().then(({
code
}) => {
if (code == '0') {
if (targetPath) {
path = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj
}
wx.$router.reLaunch(path, obj)
} else {
if (autoLoginObject) {
const {
failureTime,
userName,
password
} = autoLoginObject
if (Date.now() < failureTime) {
USERAPI.accountLogin({
userName,
password
}).then(async res => {
if (res.code == '0') {
const {data} = res
setLoginInfo(data, data.sessionId)
} else {
const reload = await loginModal({
message: '登录失败请重试'
})
if(reload) this.onShow()
}
})
} else wx.$router.reLaunch('login.index', obj)
} else wx.$router.reLaunch('login.index', obj)
}
})
} else wx.$router.reLaunch('login.index', obj)
})
this.init()
},
/**
......@@ -111,5 +64,64 @@ Page({
*/
onReachBottom() {
},
init() {
const sessionId = getSessionId(),
{
url,
targetPath = url ? decodeURIComponent(url) : ''
} = this.options
wx.nextTick(() => {
let path = 'pages.index',
obj = {}
if (targetPath) obj.targetPath = targetPath
if (sessionId) {
USERAPI.checkSession().then(({
code
}) => {
if (code == '0') {
if (targetPath) {
path = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj
}
wx.$router.reLaunch(path, obj)
} else this.autoLogin(obj)
})
} else this.autoLogin(obj)
})
},
autoLogin(obj) {
const autoLoginObject = wx.$storage.get('auto_login_object')
if (autoLoginObject) {
const {
failureTime,
userName,
password
} = autoLoginObject
if (Date.now() < failureTime) {
USERAPI.accountLogin({
userName,
password
}).then(async ({
data,
code,
message
}) => {
if (code == '0') {
setLoginInfo(data, data.sessionId)
} else {
try {
const reload = await loginModal({
message: message || '登录失败请重试',
cancelText: '返回'
})
if (reload) this.onShow()
} catch (error) {
wx.$router.reLaunch('login.index', obj)
}
}
})
} else wx.$router.reLaunch('login.index', obj)
} else wx.$router.reLaunch('login.index', obj)
}
})
\ No newline at end of file
.layout {
width: 100vw;
height: 100vh;
display: grid;
place-items: center;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: #fff;
.loading {
height: 48rpx;
......
<view class="layout">
<view class="loading">
<image webp src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/index-loading.webp" mode="widthFix" ></image>
<!-- <view class="loading">
<block wx:for="{{4}}" wx:key="index">
<view></view>
</block>
</view>
</view> -->
</view>
\ No newline at end of file
// pages/apply/apply.js
const navStyle = 'background-color: transparent;'
import {IMG_URL} from '~/utils/constantData.js'
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = '../../images/'
Page({
/**
* 页面的初始数据
*/
data: {
navStyle,
IMG_URL:IMG_URLLocal,
carObj:{
name:'kafdkf',
model:'dfdsf3443',
selNum:132,
contact:'',
phone:'',
}
},
// navbar高度设置
navbarReady(e) {
let { height, statusBarHeight } = e.detail
this.setData({
tabBarStyle: height / 2 + statusBarHeight,
// headerHeight: height / 2 + statusBarHeight + 88*2
})
// console.log(e)
// console.log(this.data.headerHeight)
},
// 提交信息
applyFn(){
console.log(123)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
onRoute(params){
console.log('params: ', params);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationStyle": "custom",
"onReachBottomDistance": 10,
"backgroundColor": "#FC5B32",
"enablePullDownRefresh": true
}
\ No newline at end of file
/* pages/apply/apply.wxss */
.apply {
.head {
width: 100%;
}
.introduce {
height: 180px;
}
.content {
padding: 16px 17px 0;
.item{
}
.top{
display: flex;
align-items: center;
.line{
width: 3px;
height: 14px;
background:var(--btnColor);
}
.title{
margin-left: 8px;
font-weight: 500;
font-size: 18px;
color: #323436;
}
}
.inp-wrap{
.title{
margin-top: 8px;
margin-bottom: 8px;
font-weight: 500;
font-size: 14px;
color: #323436;
.point{
color: #F35251;
}
}
.inp{
padding: 7px 12px;
border: 1px solid #E3E4E8;
border-radius: 2px;
}
}
}
.btn {
margin-top:40px;
width: 100%;
font-weight: 500;
font-size: 17px;
color: #ffffff;
text-align: center;
background: var(--btnColor);
}
}
<!-- pages/apply/apply.wxml -->
<navigation-bar showBack="{{true}}" bindnavbarReady="navbarReady" navStyle="{{navStyle}}">申请业务</navigation-bar>
<view class="apply">
<image class="head" src="{{IMG_URL}}index/apply-title.png" style="height:{{tabBarStyle}}px;" />
<image class="introduce" src="{{IMG_URL}}index/apply-title.png" />
<view class="content" hover-class="none" hover-stop-propagation>
<view class="top">
<view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="title" hover-class="none" hover-stop-propagation="false">开通门店账号</view>
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">
开店名称
<text class="point">*</text>
</view>
<input class="inp" value="{{carObj.name}}" placeholder="请输入30个字符以内" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">
店面车型
</view>
<input class="inp" value="{{carObj.model}}" placeholder="请输入30个字符以内" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">
店面新车销量/基盘客户
</view>
<input class="inp" value="{{carObj.selNum}}" placeholder="请输入30个字符以内" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">
门店联系人
</view>
<input class="inp" value="{{carObj.contact}}" placeholder="请输入联系人" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">
联系人手机号
</view>
<input class="inp" value="{{carObj.phone}}" placeholder="请输入手机号" />
</view>
</view>
<button class="btn" bindtap="applyFn">提交开店信息</button>
</view>
......@@ -10,7 +10,7 @@
content: '';
width: 100%;
height: 486rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.png') no-repeat;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.webp') no-repeat;
background-size: 100% 486rpx;
position: absolute;
left: 0;
......
// pages/tab/index/components/likeToast/likeToast.js
import { IMG_URL } from "~/utils/constantData.js";
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = "../../../../../images/";
Component({
data: {
IMG_URL,
IMG_URLLocal,
type: "fail",
title: "你还没有勾选呢!",
isShow: false,
animationData: "",
},
methods: {
showToast: function (data) {
const self = this;
if (this._showTimer) {
clearTimeout(this._showTimer);
}
if (this._animationTimer) {
clearTimeout(this._animationTimer);
}
// display需要先设置为block之后,才能执行动画
this.setData({
title: data.title,
type: data.type,
isShow: true,
});
this._animationTimer = setTimeout(() => {
const animation = wx.createAnimation({
duration: 500,
timingFunction: "ease",
delay: 0,
});
animation.opacity(1).step();
self.setData({
animationData: animation.export(),
});
}, 50);
this._showTimer = setTimeout(function () {
self.hideToast();
if (data.compelete && typeof data.compelete === "function") {
data.compelete();
}
}, 1200 || 50 + data.duration);
},
hideToast: function () {
if (this._hideTimer) {
clearTimeout(this._hideTimer);
}
let animation = wx.createAnimation({
duration: 200,
timingFunction: "ease",
delay: 0,
});
animation.opacity(0).step();
this.setData({
animationData: animation.export(),
});
this._hideTimer = setTimeout(() => {
this.setData({
isShow: false,
});
}, 250);
},
},
});
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* pages/tab/index/components/likeToast/likeToast.wxss */
.toast-box {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 11;
display: none;
opacity: 0;
}
.show {
display: block;
opacity: 1;
}
.toast-content {
display: flex;
flex-direction: column;
justify-content:center;
align-items:center;
position: absolute;
left: 50%;
top: 50%;
width: 136px;
height: 136px;
background: rgba(0,0,0,0.70);
border-radius: 8px;
box-sizing: bordre-box;
transform: translate(-50%, -50%);
}
.toast-img {
margin-bottom: 20px;
box-sizing: bordre-box;
text-align: center;
}
.toast-icon {
width: 23px;
height: 23px;
}
.toast-title {
margin-left: 28px;
margin-right: 28px;
font-size: 14px;
color: #ffffff;
text-align: center;
}
<!--pages/tab/index/components/likeToast/likeToast.wxml-->
<view class="toast-box {{isShow? 'show':''}}" animation="{{animationData}}">
<view class="toast-content" >
<view class="toast-img">
<block wx:if="{{type==='success'}}">
<image class="toast-icon" src="{{IMG_URL}}index/like.png"/>
</block>
<block wx:if="{{type==='fail'}}">
<image class="toast-icon" src="{{IMG_URL}}index/dislike.png" />
</block>
</view>
<view class="toast-title">{{title}}</view>
</view>
</view>
// pages/tab/discovery/components/product/product.js
// import {imgUrlMixin} from '~/mixins/index'
import { IMG_URL } from "~/utils/constantData.js";
Component({
// behaviors: [imgUrlMixin],
/**
* 组件的属性列表
*/
properties: {
stickyTop: Number,
actNum: Number,
},
/**
* 组件的初始数据
*/
data: {
navList:['360全景导航','AR实景导航','座椅通风','氛围灯','数字化美容'],
navList: ["360全景导航", "AR实景导航", "座椅通风", "氛围灯", "数字化美容"],
activeNavIdx: 0,
tab:['适用场景','营销链路','项目亮点','适用场景','转化漏斗','合作流程','适用场景','营销链路','项目亮点','适用场景','转化漏斗','合作流程'],
heightArr:[],
curTabIdx:0,
intoViewId: 'to-0',
IMGURL:'../../../../../images/index/'
tab: [
"场景说明",
"营销链路",
"项目亮点",
"转化漏斗",
"合作流程",
"合作案例",
],
heightArr: [],
allHeight: 0,
curTabIdx: 0,
intoViewId: "to-0",
IMGURL: `${IMG_URL}index/`,
},
lifetimes:{
ready: function (){
lifetimes: {
ready: function () {
// console.log(11111)
this.getImgHeight()
this.getImgHeight();
},
},
observers: {
actNum: function () {
console.log(1231)
let navList;
let num = this.data.actNum;
switch (num) {
case 0:
navList = ['数字无忧权益卡']
break;
case 1:
navList = ['汽车太阳膜']
break;
case 2:
navList = ['漆面保护膜','改色膜']
break;
case 3:
navList = ['数字化美容','座椅通风','AR导航','氛围灯','360全景导航']
break;
}
this.setData({
navList
});
},
},
......@@ -32,37 +68,43 @@ Component({
* 组件的方法列表
*/
methods: {
changeTab(e){
let idx = e.detail
changeTab(e) {
let idx = e.detail;
this.setData({
intoViewId: `to-${idx}`
})
intoViewId: `to-${idx}`,
});
},
changeNav(event){
console.log(event,event.target.dataset.index,111)
changeNav(event) {
console.log(event, event.target.dataset.index, 111);
this.setData({
activeNavIdx: event.target.dataset.index
})
activeNavIdx: event.target.dataset.index,
});
},
scrolltoupper(event){
const idx = this.data.heightArr.findIndex(item => item>event.detail.scrollTop)
scrolltoupper(event) {
const idx = this.data.heightArr.findIndex(
(item) => item > event.detail.scrollTop
);
this.setData({
curTabIdx: idx
})
curTabIdx: idx,
});
// console.log(this.data.curTabIdx1)
},
getImgHeight(){
let query = wx.createSelectorQuery().in(this)
let heightArr = []
let s = 0
query.selectAll('.img-item').boundingClientRect((react) => {
react.forEach(item => {
s += item.height
heightArr.push(s)
getImgHeight() {
let query = wx.createSelectorQuery().in(this);
let heightArr = [];
let s = 0;
query
.selectAll(".img-item")
.boundingClientRect((react) => {
react.forEach((item) => {
s += item.height;
heightArr.push(s);
});
this.data.heightArr = heightArr;
// console.log(heightArr[heightArr.length-1])
this.data.allHeight = heightArr[heightArr.length - 1];
})
this.data.heightArr = heightArr
// console.log( this.data.heightArr)
}).exec()
}
}
})
.exec();
},
},
});
// 特色产品
.prod-wrap .big-title{
.prod-wrap {
background-color: #f8fafb;
}
.prod-wrap .big-title {
margin-left: 40rpx;
font-family: PingFangSC-S0pxibold;
font-weight: 600;
font-size: 36rpx;
color: #1B233D;
color: #1b233d;
line-height: 56rpx;
}
.prod-wrap .nav-wrap{
.prod-wrap .nav-wrap {
white-space: nowrap;
box-sizing: border-box;
margin-top: 24rpx;
margin-bottom: 32rpx;
padding: 0 20rpx;
}
.prod-wrap .nav-wrap .nav{
.prod-wrap .nav-wrap .nav {
display: inline-block;
width: 188rpx;
height: 64rpx;
......@@ -25,97 +28,103 @@
text-align: center;
font-family: PingFangSC-Regular;
line-height: 64rpx;
margin-right: 12rpx;
background: #FFFFFF;
border: 2rpx solid #DDE3F0;
margin-right: 16rpx;
background: #ffffff;
border: 2rpx solid #dde3f0;
color: #323436;
}
.prod-wrap .nav-wrap .active-nav{
background-image: linear-gradient(0deg, #EBEFFF 8%, #FCFDFF 85%);
border: 2rpx solid rgba(68,97,240,0.50);
box-shadow: 0 8rpx 16rpx 0 rgba(175,187,219,0.35);
.prod-wrap .nav-wrap .active-nav {
color: #ffffff;
// background-image: linear-gradient(0deg, #EBEFFF 8%, #FCFDFF 85%);
background-color: var(--btnColor);
// border: 2rpx solid rgba(68,97,240,0.50);
// box-shadow: 0 8rpx 16rpx 0 rgba(175,187,219,0.35);
}
.prod-wrap .nav-wrap .nav:last-child{
.prod-wrap .nav-wrap .nav:last-child {
margin-right: 0;
}
.prod-item{
background-color: #F5F7FB;
.prod-item {
padding-bottom: 32rpx;
margin: 16rpx auto 0;
width: 343px;
background-color: #f5f7fb;
border-radius: 48rpx 48rpx 0 0;
padding: 40rpx 24rpx 32rpx;
}
.prod-card{
.prod-card {
display: flex;
height: 208rpx;
background-image: linear-gradient(1deg, #FFFFFF 10%, #FDFCFF 100%);
border: 2rpx solid #FFFFFF;
box-shadow: 0 8rpx 20rpx 0 rgba(197,205,235,0.35);
background-image: linear-gradient(1deg, #ffffff 10%, #fdfcff 100%);
border: 2rpx solid #ffffff;
box-shadow: 0 8rpx 20rpx 0 rgba(197, 205, 235, 0.35);
border-radius: 20rpx;
padding: 20rpx 24rpx;
box-sizing: border-box;
position: relative;
}
.prod-card .card-img{
.prod-card .card-img {
width: 160rpx;
height: 160rpx;
flex-shrink: 0;
border-radius: 4rpx;
}
.img-desc{
.img-desc {
position: absolute;
width: 104rpx;
height: 40rpx;
line-height: 40rpx;
background: #D7F5EB;
background: #d7f5eb;
border-radius: 4rpx;
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 24rpx;
color: #24B38C;
color: #24b38c;
letter-spacing: 0;
text-align: center;
}
.prod-info{
.prod-info {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 12rpx 0;
margin-left: 24rpx;
}
.prod-info>text{
.prod-info > text {
display: block;
white-space: nowrap;
height: 40rpx;
line-height: 40rpx;
}
.prod-info .title{
.prod-info .title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 28rpx;
color: #323436;
}
.prod-info .sale,.prod-info .earnings{
.prod-info .sale,
.prod-info .earnings {
font-size: 26rpx;
color: #7A8299;
color: #7a8299;
}
.prod-info .sale-num{
.prod-info .sale-num {
font-size: 26rpx;
color: #323436;
}
.prod-info .earnings-num{
.prod-info .earnings-num {
font-size: 28rpx;
font-family: DINAlternate-Bold;
font-weight: Bold;
color: #F35251;
color: #f35251;
}
.share-btn{
.share-btn {
height: 56rpx;
line-height: 56rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 24rpx;
background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%);
background-image: linear-gradient(-60deg, #556af5 0%, #7197ff 100%);
border-radius: 12rpx;
color: #fff;
padding: 0 20rpx;
......@@ -126,23 +135,28 @@
top: 50%;
transform: translateY(-50%);
}
.share-btn .icon{
.share-btn .icon {
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
}
.project-wrap{
background-color: #F5F7FB;
.project-wrap {
background-color: #f5f7fb;
}
.project-img{
height: 500rpx;
.project-img {
height: 1200rpx;
white-space: nowrap;
.img-item{
.img-item {
height: 300rpx;
}
}
.stickyTab {
position: sticky;
z-index: 1;
background-color: #f5f7fb;
}
// .out-tab{
// .out-text {
// // color: red !important;
......@@ -154,3 +168,28 @@
// }
// }
.img-item11 {
width: 100%;
height: 1110rpx;
}
.img-item12 {
width: 100%;
height: 1290rpx;
}
.img-item13 {
width: 100%;
height: 596rpx;
}
.img-item14 {
width: 100%;
height: 744rpx;
}
.img-item15 {
width: 100%;
height: 490rpx;
}
.img-item16 {
width: 100%;
height: 1532rpx;
}
<!--pages/tab/discovery/components/product/product.wxml-->
<view class="prod-wrap">
<text class="big-title">特色产品</text>
<scroll-view class="nav-wrap" scroll-x="{{true}}">
<block wx:for="{{navList}}" wx:key="index">
<text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text>
</block>
</scroll-view>
<view class="prod-item">
<view class="prod-card">
<view class="card-img">
<text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png"></image>
</view>
<view class="prod-info">
<text class="title">360全景导航</text>
<text class="sale">新车销量 <text class="sale-num">100</text></text>
<text class="earnings">预估收益 <text class="earnings-num">92.4 万</text></text>
</view>
<view class="share-btn">
<image class="icon" src="{{IMGURL}}share.png"></image>
<text>分享</text>
</view>
</view>
</view>
</view>
<view class="project-wrap">
<tab outClassName="project-tab" openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab>
<scroll-view class="project-img" scroll-into-view="{{intoViewId}}" bindscroll="scrolltoupper" scroll-y="{{true}}">
<block wx:for="{{tab}}" wx:key="index">
<view id="to-{{index}}" class="img-item">
{{item}}
</view>
</block>
</scroll-view>
</view>
<text class="big-title">特色产品</text>
<scroll-view class="nav-wrap" scroll-x="{{true}}">
<block wx:for="{{navList}}" wx:key="index">
<text class='nav {{activeNavIdx==index ? "active-nav": ""}}' bindtap="changeNav" data-index="{{index}}">{{item}}</text>
</block>
</scroll-view>
<view class="prod-item">
<view class="prod-card">
<view class="card-img">
<text class="img-desc">轻改类</text>
<image src="{{IMGURL}}discovery_prod1.png" />
</view>
<view class="prod-info">
<text class="title">360全景导航</text>
<text class="sale">新车销量 <text class="sale-num">100</text>
</text>
<text class="earnings">预估收益 <text class="earnings-num">92.4 万</text>
</text>
</view>
<view class="share-btn">
<image class="icon" src="{{IMGURL}}share.png" />
<text>分享</text>
</view>
</view>
</view>
</view>
<view class="project-wrap">
<!-- -->
<view class="stickyTab" style="top:{{stickyTop}}rpx">
<tab
outClassName="project-tab"
openScroll="{{true}}"
tab="{{tab}}"
index="{{curTabIdx}}"
bindclick="changeTab"
/>
</view>
<!-- style="{height:{{allHeight}}px}" -->
<scroll-view
class="project-img"
scroll-into-view="{{intoViewId}}"
bindscroll="scrolltoupper"
scroll-y="{{true}}"
>
<block wx:for="{{tab}}" wx:key="index">
<view id="to-{{index}}" class="img-item{{actNum+1}}{{index+1}}">
<!-- {{item}} -->
<image class="img-item{{actNum+1}}{{index+1}}" src="{{IMGURL}}scene{{actNum+1}}{{index+1}}.png" />
</view>
</block>
</scroll-view>
</view>
const navStyle = "background-color: transparent;";
import { IMG_URL } from "~/utils/constantData.js";
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = "../../../images/";
const navStyle = 'background-color: transparent;'
Page({
// behaviors: [kfMixin],
/**
......@@ -7,61 +11,289 @@ Page({
*/
data: {
navStyle,
actClass:'right',
// IMG_URL
dataArr:[
IMG_URL,
IMG_URLLocal,
actClass: "right",
guideSrcIndex: 1,
guideShow: false,
dataArr: [
{
src:'../../../images/index/car1.png',
name:'新车洽谈场景',
msg:'1.0 新车权益销售'
src: `${IMG_URL}index/car1.png`,
name: "新车洽谈场景",
msg: "1.0 新车权益销售",
},
{
src:'../../../images/index/car2.png',
name:'新车交付场景',
msg:'1.1 新车精品升级'
src: `${IMG_URL}index/car2.png`,
name: "新车交付场景",
msg: "1.1 新车精品升级",
},
{
src:'../../../images/index/car3.png',
name:'0-12个月',
msg:'1.2 新车线上转化'
src: `${IMG_URL}index/car3.png`,
name: "0-12个月",
msg: "1.2 新车线上转化",
},
{
src:'../../../images/index/car4.png',
name:'12个月以上',
msg:'1.3 存量用户众筹'
src: `${IMG_URL}index/car4.png`,
name: "12个月以上",
msg: "1.3 存量用户众筹",
},
]
],
actNum: 0,
tabIndx: 1,
tabList: ["看线索", "看产品"],
typeList: ["联系电话", "意向客户", "线索来源", "重置"],
clueList: [
{
source: "customer",
name: "张三1",
avatar: "",
like: true,
records: [
{
id: 0,
type: 0,
msg: "360全景导航",
time: "10-30 09:26:25",
},
{
id: 1,
type: 1,
msg: "360全景导航",
time: "10-30 09:26:25",
},
{
id: 3,
type: 0,
msg: "360全景导航",
time: "10-30 09:26:25",
},
{
id: 4,
type: 1,
msg: "360全景导航",
time: "10-30 09:26:25",
},
{
id: 5,
type: 0,
msg: "360全景导航",
time: "10-30 09:26:25",
},
{
id: 6,
type: 1,
msg: "360全景导航",
time: "10-30 09:26:25",
},
{
id: 7,
type: 1,
msg: "360全景导航",
time: "10-30 09:26:25",
},
],
phone: 15718122929,
isOpen: false,
getMoreFlag: true,
},
{
source: "customer",
name: "张三",
avatar: "",
like: false,
records: [
{
id: 0,
type: 0,
msg: "360全景导航",
time: "10-30 09:26:25",
},
{
id: 1,
type: 1,
msg: "360全景导航",
time: "10-30 09:26:25",
},
],
phone: 15718122925,
isOpen: true,
},
{
source: "shop",
name: "张三",
avatar: "",
like: false,
records: [
{
id: 0,
type: 0,
msg: "360全景导航",
time: "10-30 09:26:25",
shop: "嘀加鹏辉奥迪4S店",
},
{
id: 1,
type: 1,
msg: "360全景导航",
time: "10-30 09:26:25",
shop: "嘀加鹏辉奥迪4S店",
},
],
phone: 15718122925,
isOpen: true,
},
],
filterType: "", //看线索过滤类型
},
//引导图
guideFn() {
if (this.data.guideSrcIndex === 5) {
this.setData({
guideShow: false,
});
return;
}
this.setData({
guideSrcIndex: ++this.data.guideSrcIndex,
});
// console.log('guideSrcIndex',this.data.guideSrcIndex)
},
// navbar高度设置
navbarReady(e) {
let { height, statusBarHeight } = e.detail
let { height, statusBarHeight } = e.detail;
this.setData({
// tabBarStyle: height / 2 + statusBarHeight,
headerHeight: height / 2 + statusBarHeight + 88 * 2,
});
// console.log(e)
// console.log(this.data.headerHeight)
},
// headTabFn(e){
// // console.log("name",e.currentTarget.dataset.name)
// let name = e.currentTarget.dataset.name
// this.setData({
// actClass:name
// })
// },
// 选车场景切换
selectCar(e) {
let actNum = e.currentTarget.dataset.num;
this.setData({
tabBarStyle: height / 2 + statusBarHeight
})
console.log(e)
actNum,
});
},
headTabFn(e){
// console.log("name",e.currentTarget.dataset.name)
let name = e.currentTarget.dataset.name
// 头部看线索,产品切换
changeTabIndx(e) {
console.log("e.detail: ", e.detail);
this.setData({
actClass:name
})
tabIndx: e.detail,
});
},
gotoApply() {
// wx.$router.go('apply',1235)
wx.$router.go("apply");
},
getMore(e) {
console.log("显示更多数据");
let index = e.currentTarget.dataset.outidx;
console.log("index: ", index);
let completeStatus = `clueList[${index}].getMoreFlag`;
this.setData({
[completeStatus]: !this.data.clueList[index].getMoreFlag,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
onLoad: function (options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
onReady: function () {
this.prompt = this.selectComponent("#toast");
},
showToast: function (e) {
let type = e.currentTarget.dataset.type;
let tipObj = {};
if (type == "like") {
tipObj = {
type: "fail",
title: "取消标记为意向客户",
};
} else {
tipObj = {
type: "success",
title: "成功标记为意向客户",
};
}
this.prompt.showToast({
type: tipObj.type,
title: tipObj.title,
duration: 1000,
compelete: function () {
console.log("toast框隐藏之后,会调用该函数");
//例如:跳转页面wx.navigateTo({ url: 'xxx' });
},
});
//切换收藏标记
let index = e.currentTarget.dataset.outidx;
let completeStatus = `clueList[${index}].like`;
this.setData({
[completeStatus]: !this.data.clueList[index].like,
});
},
filterTypeFn(e) {
let index = e.currentTarget.dataset.index;
let itemList = [];
// console.log("index: ", typeof index);
switch (index) {
case 0:
itemList = ["有", "无"];
break;
case 1:
itemList = ["是", "否"];
break;
case 2:
itemList = ["访客", "门店"];
break;
case 3:
console.log("重置");
return;
}
this.setData({
filterType: "",
});
wx.pro.showActionSheet({
itemList,
success(res) {
console.log(res.tapIndex);
},
fail(res) {
console.log(res.errMsg);
},
complete(res) {
console.log("res: ", res);
},
});
},
phoneCallFn(e) {
let { phone } = e.currentTarget.dataset;
console.log("phone: ", phone);
wx.$api.phoneCall(phone);
},
setCopyDataFn(e) {
let { phone } = e.currentTarget.dataset;
wx.$api.setCopyData(phone);
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// setTimeout(()=>{
// console.log('this.data.tabBarStyle',this.data.tabBarStyle,this.data.headerHeight)
// })
},
/**
......@@ -77,8 +309,7 @@ Page({
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
......@@ -87,6 +318,5 @@ Page({
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
onShareAppMessage: function () {},
});
{
"usingComponents": {
"product": "./components/product/product"
"product": "./components/product/product",
"vas-toast": "./components/likeToast/likeToast"
},
"navigationStyle": "custom",
"onReachBottomDistance": 10,
......
......@@ -3,36 +3,41 @@ page {
width: 100vw;
background-color: #fff;
}
.reclaim{
.header-wrap{
position: relative;
.reclaim {
.header-wrap {
position: sticky;
top: 0;
width: 100%;
background-size: 100% 100%;
margin-bottom: 16px;
.header{
z-index: 1;
.header {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 88rpx;
display: flex;
justify-content:space-between;
align-items:center;
.left{
justify-content: space-between;
align-items: center;
.tabContainer {
width: 60%;
}
.left {
display: flex;
align-items: center;
.clue{
.clue {
position: relative;
margin-left: 24px;
margin-right: 24px;
font-weight: 400;
font-size: 14px;
color: #8A8C90;
color: #8a8c90;
}
.product{
.product {
position: relative;
}
.act{
.act {
font-weight: 600;
font-size: 22px;
color: #323436;
......@@ -50,14 +55,14 @@ page {
}
}
}
.right{
.right {
display: flex;
align-items:center;
.img{
width:20px;
height:20px;
align-items: center;
.img {
width: 20px;
height: 20px;
}
.apply{
.apply {
margin-left: 4px;
margin-right: 16px;
font-weight: 400;
......@@ -67,51 +72,237 @@ page {
}
}
}
.scene{
// .content{
// position: relative;
// }
.clue {
padding: 8px 10px 0;
background-color: #f2f3f7;
.types {
margin-bottom: 8px;
display: flex;
align-items: center;
.type {
margin-left: 8px;
display: flex;
justify-content: center;
align-items: center;
width: 80px;
height: 24px;
line-height: 24px;
background: #ffffff;
border-radius: 14px;
font-size: 12px;
color: #8a8c90;
.point {
margin-left: 2px;
width: 12px;
height: 12px;
}
}
}
.list {
.msg {
padding: 10px 16px 16px;
margin-bottom: 8px;
position: relative;
background-color: #fff;
border-radius: 4px;
}
.like {
position: absolute;
right: 12px;
top: 0;
width: 23px;
height: 23px;
}
.name {
display: flex;
align-items: center;
// font-weight: 400;
font-size: 14px;
color: #323436;
.avatar {
margin-left: 2px;
width: 20px;
height: 20px;
}
}
.line {
margin-top: 10px;
margin-bottom: 10px;
height: 0;
border-bottom: #eeeeee 1px dashed;
}
.want-more {
overflow: hidden;
}
.want-btn {
margin-top: 10px;
font-size: 12px;
color: var(--btnColor);
}
.record {
margin-top: 4px;
margin-bottom: 4px;
display: flex;
justify-content: space-between;
align-items: center;
.action-wrap {
display: flex;
align-items: center;
font-size: 12px;
color: #393b3e;
}
// .action{
// }
// .detail{
// }
.time {
font-size: 12px;
color: #8a8c90;
}
}
.info {
margin-top: 10px;
display: flex;
justify-content: space-between;
.phone-wrap {
display: flex;
align-items: center;
}
.phone {
font-size: 12px;
color: #3666fe;
}
.phone-img {
margin-left: 12px;
margin-right: 8px;
width: 20px;
height: 20px;
border-radius: 50%;
}
.copy {
width: 20px;
height: 20px;
border-radius: 50%;
}
.btn {
width: 85px;
height: 24px;
background: var(--btnColor);
border-radius: 12px;
font-size: 12px;
color: #ffffff;
text-align: center;
line-height: 24px;
}
}
.shop {
.name-wrap {
display: flex;
justify-content: space-between;
align-items: center;
}
.source {
font-size: 10px;
color: #8a8c90;
}
.btn {
border: 1px solid var(--btnColor);
border-radius: 12px;
background-color: #fff;
font-size: 12px;
color: var(--btnColor);
}
.shop-action-wrap {
display: flex;
justify-content: space-between;
align-items: center;
}
.shop-record {
width: 100%;
}
.shop-source {
margin-top: 4px;
width: 100%;
font-size: 12px;
color: #393b3e;
}
}
}
}
.scene {
margin: 0 10px 16px;
display: flex;
justify-content:space-between;
.item{
justify-content: space-between;
.item-wrap {
position: relative;
width: 106px;
height: 116px;
}
.item {
width: 86px;
height: 90px;
background: #F7F8FC;
background: #f7f8fc;
border-radius: 6px;
}
.act{
position: absolute;
top: 0;
left: 0;
.act {
background-image: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/act.png");
background-size: 100% 100%;
.item {
background: transparent;
}
}
.img{
display:block;
margin: 10px auto 2px;
.img {
display: block;
margin: 10px auto 2px;
width: 28px;
height: 28px;
}
.name{
.name {
margin-bottom: 2px;
font-weight: 500;
font-size: 12px;
color: #323436;
text-align: center;
}
.msg{
.msg {
font-weight: 400;
font-size: 9px;
color: #8A8C90;
color: #8a8c90;
text-align: center;
}
}
}
.guide{
.guide {
width: 100%;
height: 100%;
.guide-img{
.guide-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
\ No newline at end of file
}
.chat {
position: absolute;
right: 0;
top: 60%;
width: 50px;
height: 50px;
border-radius: 50%;
z-index: 1;
}
.output-value {
position: absolute;
right: 5px;
top: 70%;
width: 40px;
height: 50px;
border-radius: 50%;
z-index: 1;
}
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}">
拓客户
</navigation-bar>
<wxs src="./index.wxs" module="filterUtils" />
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}">拓客户</navigation-bar>
<view class="reclaim">
<view class="header-wrap" style="height:{{tabBarStyle*2 + 88}}rpx; background-image: url('../../../images/index/head.png')">
<view class="header">
<view class="left">
<view class="clue {{actClass == 'left'?'act':''}}" bindtap="headTabFn" data-name="left">
看线索
</view>
<view class="product {{actClass == 'right'?'act':''}}" bindtap="headTabFn" data-name="right">
看产品
</view>
</view>
<view class="right">
<image class="img" src="../../../images/index/apply.png"></image>
<view class="apply">
申请业务
</view>
</view>
</view>
</view>
<view class="scene">
<view class="item item{{index}}" wx:for="{{dataArr}}" wx:key="name">
<image class="img" src="{{item.src}}"></image>
<view class="name">
{{item.name}}
</view>
<view class="msg">
{{item.msg}}
</view>
</view>
</view>
<product></product>
<view class="header-wrap" style="height:{{headerHeight}}rpx; background-image: url('{{IMG_URL}}index/head.png')">
<view class="header">
<!-- <view class="left">
<view class="clue {{actClass == 'left'?'act':''}}" bindtap="headTabFn" data-name="left">
看线索
</view>
<view class="product {{actClass == 'right'?'act':''}}" bindtap="headTabFn" data-name="right">
看产品
</view>
</view> -->
<tab tab="{{tabList}}" itemWidth="{{'35%'}}" index="{{tabIndx}}" bindclick="changeTabIndx" class="tabContainer" />
<view class="right" bindtap="gotoApply">
<image class="img" src="{{IMG_URL}}index/apply.png" />
<view class="apply">申请业务</view>
</view>
</view>
</view>
<view class="content" wx:if="{{tabIndx == 1 }}" hover-class="none" hover-stop-propagation="false">
<view class="scene">
<view class="item-wrap {{actNum== index ? 'act':''}}" data-num="{{index}}" bindtap="selectCar" wx:for="{{dataArr}}" wx:key="name">
<view class="item">
<image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view>
<view class="msg">{{item.msg}}</view>
</view>
</view>
</view>
<product stickyTop="{{headerHeight}}" actNum="{{actNum}}" />
</view>
<view class="clue" wx:if="{{tabIndx == 0 }}" hover-class="none" hover-stop-propagation="false">
<view class="types">
<view class="type" wx:for="{{typeList}}" wx:key="*this" data-index="{{index}}" bindtap="filterTypeFn">
{{item}}
<image class="point" wx:if="{{index != 3}}" src="{{IMG_URL}}index/point.png" />
</view>
</view>
<view class="list" hover-class="none" hover-stop-propagation="false">
<view class="msg" wx:for="{{clueList}}" wx:key="phone">
<!-- 生意助手 -->
<view wx:if="{{item.source == 'customer'}}">
<image class="like" wx:if="{{item.like}}" src="{{IMG_URL}}index/like.png" data-type="like" data-outidx="{{index}}" bindtap="showToast" />
<image class="like" wx:else src="{{IMG_URL}}index/dislike.png" data-type="dislike" data-outidx="{{index}}" bindtap="showToast" />
<view class="name" hover-class="none" hover-stop-propagation="false">
{{item.name}}
<image class="avatar" src="{{IMG_URL}}index/avatar.png" />
</view>
<view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="want-more" style="height:{{item.getMoreFlag? 100: 'auto'}}px">
<view class="record" wx:for="{{item.records}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName">
<view class="action-wrap">
<view class="action" selectable="false" space="false" decode="false">
{{filterUtils.filterType(itemName.type)}}:
</view>
<view class="detail" selectable="false" space="false" decode="false">
{{itemName.msg}}
</view>
</view>
<view class="time" selectable="false" space="false" decode="false">
{{itemName.time}}
</view>
</view>
</view>
<view class="want-btn" wx:if="{{item.records.length > 5}}" hover-class="none" hover-stop-propagation="false" data-outidx="{{index}}" bindtap="getMore">
{{ item.getMoreFlag ? '更多数据' : '收起数据'}}
</view>
<view class="info" hover-class="none" hover-stop-propagation="false">
<view class="phone-wrap">
<view class="phone">{{item.phone}}</view>
<image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" />
<image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" />
</view>
<view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply">
+开店面
</view>
</view>
</view>
<!-- 门店助手 -->
<view class="shop" wx:else>
<view class="name-wrap">
<view class="name" hover-class="none" hover-stop-propagation="false">
{{item.name}}
<image class="avatar" src="{{IMG_URL}}index/avatar.png" />
</view>
<view class="source" hover-class="none" hover-stop-propagation="false">通过门店助手申请</view>
</view>
<view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="record" wx:for="{{item.records}}" wx:key="id" wx:for-index="idx" wx:for-item="itemName">
<view class="shop-record">
<view class="shop-action-wrap">
<view class="action-wrap">
<view class="action" selectable="false" space="false" decode="false">
{{filterUtils.filterType(itemName.type)}}:
</view>
<view class="detail" selectable="false" space="false" decode="false">
{{itemName.msg}}
</view>
</view>
<view class="time" selectable="false" space="false" decode="false">
{{itemName.time}}
</view>
</view>
<view class="shop-source" hover-class="none" hover-stop-propagation="false">
所属门店:{{itemName.shop}}
</view>
</view>
</view>
<view class="info" hover-class="none" hover-stop-propagation="false">
<view class="phone-wrap">
<view class="phone">{{item.phone}}</view>
<image class="phone-img" data-phone="{{item.phone}}" bindtap="phoneCallFn" src="{{IMG_URL}}index/phone.png" />
<image class="copy" data-phone="{{item.phone}}" bindtap="setCopyDataFn" src="{{IMG_URL}}index/copy.png" />
</view>
<view class="btn" hover-class="none" hover-stop-propagation="false" bindtap="gotoApply">
开通活动
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<vas-toast isShow="{{true}}" id='toast' />
<view class="guide" wx:if="{{guideShow}}">
<image bindtap="guideFn" class="guide-img" src="../../../images/entrustCustomers/guide{{guideSrcIndex}}.png"></image>
<image bindtap="guideFn" class="guide-img" src="{{IMG_URL}}index/guide{{guideSrcIndex}}.png" />
</view>
<image class="chat" src="{{IMG_URL}}index/contact.png"></image>
<image class="output-value" src="{{IMG_URL}}index/valuation.png"></image>
\ No newline at end of file
/**
*
* @param type 线索类型
* @returns
*/
var filterType = function(type){
var res;
type = +type;
switch (type) {
case 0:
res = '访问页面1'
break;
case 1:
res = '访问页面2'
break;
case 2:
res = '访问页面3'
break;
}
return res;
};
module.exports = {
filterType:filterType
}
......@@ -26,7 +26,6 @@ page {
content: '';
width: 100%;
height: 486rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.png') no-repeat;
background-size: 100% 486rpx;
position: absolute;
left: 0;
......
// pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.js
import { IMG_URL } from '~/utils/constantData.js'
import USERAPI from '~/api/usersApi/index'
import { setUserInfo } from '~/utils/cache/storageApi'
Component({
options: {
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
popShow: {
type: Boolean,
value: false
},
merchantRange: Object
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
merchantList: []
},
observers: {
merchantRange: function (e) {
// console.log(e)
this.setData({
merchantList: e
})
}
},
/**
* 组件的方法列表
*/
methods: {
hidePopup() {
console.log(222)
this.triggerEvent('hidePopup')
},
confirm() {
console.log(111)
let { merchantRange, subIndex } = this.data
let actObj = merchantRange.find((item, index) => {
if (item.act) {
subIndex = index
}
return item.act
})
// console.log(actObj)
// this.setData({
// subIndex
// })
if (!actObj) {
return wx.$api.showToast({
title: '请选择服务商',
icon: 'error'
})
} else {
this.changePicker(actObj)
}
},
changePicker(actObj) {
// 修改对应下标显示
console.log('changePicker')
// let { value } = e.detail
// app.globalData.yqdInfo.subIndex = value
// let { merchantId } = this.data.merchantRange[value]
// let obj = {}
// if (merchantId) obj.merchantId = actObj
let { merchantId } = actObj
wx.$api.showLoading('加载中...')
USERAPI.switchSubLoginInfo({ merchantId }).then(res => {
console.log(res)
this.setUserInfo(res)
this.hidePopup()
this.triggerEvent('changeAccount')
// }
wx.$api.hideLoading()
})
// this.tapPicker()
},
select(e) {
// console.log(e)
let { index } = e.currentTarget.dataset
console.log(index)
let { merchantRange } = this.data
merchantRange.forEach((item, ind) => {
if (index == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
merchantRange
})
})
},
input(e) {
console.log(e)
let { merchantRange } = this.data
let { value } = e.detail
merchantRange.forEach(item => {
item.act = false
item.show = item.merchantName.includes(value)
// = show
})
this.setData({
merchantRange
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.wxss */
.search-box {
width: 100%;
height: 104rpx;
padding-left: 32rpx;
// margin-top: 20rpx;
display: flex;
align-items: center;
background-color: #fff;
position: sticky;
top: 0;
left: 0;
z-index: 9;
box-sizing: border-box;
}
.search-box .search-input {
background: #F7F8FA;
border-radius: 38rpx;
width: 606rpx;
height: 72rpx;
display: flex;
align-items: center;
}
.search-box .search-input .search-icon {
width: 28rpx;
height: 28rpx;
margin: 0 10rpx 0 26rpx;
}
.search-box .search-input .search-clear {
width: 36rpx;
height: 36rpx;
margin: 0 26rpx 0 10rpx;
}
.search-box .search-input .input {
font-size: 28rpx;
width: calc(100% - 136rpx);
}
.input-placeholder {
color: rgba(200, 201, 204, .89);
}
.search-box .search {
width: 144rpx;
height: 100%;
color: #666;
box-sizing: border-box;
padding: 0 24rpx;
}
.search-box .search .text-center {
font-size: 24rpx;
/* background-color: #f7f7f7; */
border-radius: 12rpx;
width: 100%;
font-size: 32rpx;
color: #858A94;
}
.search-box .search .text-center .search-filter {
margin-left: 6rpx;
width: 24rpx;
height: 24rpx;
}
.itemCon {
box-sizing: border-box;
width: 100%;
// background-color: #fff;
height: 80rpx;
color: #323436;
line-height: 80rpx;
padding: 0 32rpx;
}
.active {
// color: aqua;
background: #F0F7FF;
font-size: 28rpx;
color: #3666FE;
}
\ No newline at end of file
<!-- pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.wxml -->
<popup
show="{{popShow}}"
bind:hidePopup="hidePopup"
bindconfirm="confirm"
height="60%">
<!-- <search-input placeholder="请搜索服务商账号名" ></search-input> -->
<view class="search-box">
<view class="search-input">
<image src="{{IMG_URL}}/output/searchIcon.png" class="search-icon" />
<input
type="text"
placeholder="请搜索服务商账号名"
class="input"
value="{{keyword}}"
placeholder-class="input-placeholder"
bindinput="input"
bindconfirm="search" />
<block wx:if="{{keyword}}">
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search text-center" bindtap="showConfirm">
<view class="text-center">搜索</view>
</view>
</view>
<scroll-view
scroll-y
enable-back-to-top
refresher-enabled="{{true}}"
bindrefresherrefresh="refreshList"
refresher-threshold="104"
scroll-top="{{scrollTop}}"
class="list"
style="height:100%;"
data-type="message"
refresher-triggered="{{triggered}}">
<block wx:for="{{merchantList}}" wx:key="index">
<view
class="itemCon text-hide {{item.act?'active':''}}"
hidden="{{!item.show}}"
data-index="{{index}}"
bindtap="select">
{{item.merchantName}}
</view>
</block>
</scroll-view>
</popup>
// pages/tab/output/output.js
import { getSessionId, setSessionId } from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
Page({
/**
* 页面的初始数据
......@@ -10,7 +11,8 @@ Page({
agree: true,
tabIndx: 1,
tabList: ['我的客户', '我的门店', '我的员工'],
popupShow: true,
popupShow: false,
subIndex: -1,
merchantList: [
{
merchantId: 0,
......@@ -24,36 +26,11 @@ Page({
}
]
},
confirm() {
let { merchantList } = this.data
},
select(e) {
console.log(e)
let { index } = e.currentTarget.dataset
console.log(index)
let { merchantList } = this.data
merchantList.forEach((item, ind) => {
if (index == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
merchantList
})
})
},
input(e) {
console.log(e)
let { merchantList } = this.data
let { value } = e.detail
merchantList.forEach(item => {
item.act = false
item.show = item.merchantName.includes(value)
// = show
})
// 切换园区
tapPicker() {
this.setData({
merchantList
moveArrow: !this.data.moveArrow,
popupShow: !this.data.popupShow
})
},
navbarReady(e) {
......@@ -61,47 +38,55 @@ Page({
this.setData({
tabBarStyle: height / 2 + statusBarHeight
})
console.log(e)
// console.log(e)
},
changeTabIndx(e) {
this.setData({
tabIndx: e.detail
})
},
// 切换园区
tapPicker() {
this.setData({
moveArrow: !this.data.moveArrow
})
},
changePicker(e) {
console.log('changePicker')
let { value } = e.detail
// 修改对应下标显示
app.globalData.yqdInfo.subIndex = value
let { merchantId } = this.data.merchantRange[value]
let obj = {}
if (merchantId) obj.merchantId = merchantId
wx.$util.showLoading('加载中...')
api.swtichSubLoginInfo(obj).then(res => {
// console.log(res)
let { code, data, message } = res
if (code == 0) {
// debugger
wx.$util.setUserInfo(data)
this.refresh(data)
} else {
this.showToast(message)
}
})
this.tapPicker()
getMerchantRange() {
let { userInfo } = wx.$storage.get()
// 有问题 先取反调试
userInfo = userInfo.loginUserInfoList[0]
console.log(userInfo.subLoginUser.merchantId)
console.log(userInfo)
// userInfo.isSuper &&
USERAPI.adminSelectLogin()
.then(result => {
console.log(result)
let { merchantList: merchantRange } = result
console.log(merchantRange)
let subIndex = -1
merchantRange.forEach((item, index) => {
item.show = true
if (item.merchantId == userInfo.subLoginUser.merchantId) {
subIndex = index
item.act = true
}
})
console.log(subIndex)
this.setData({
merchantRange,
subIndex
})
})
.catch(err => {})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
setSessionId('xxx')
console.log(getSessionId())
// setSessionId('xxx')
// console.log(getSessionId())
// 判断是不是管理员
// subLoginUser
// if (userInfo.duty == '管理员') {
this.getMerchantRange()
// }
// console.log(userInfo)
},
/**
......
......@@ -5,8 +5,8 @@
"client": "./components/client/client",
"merchant": "./components/merchant/mrechant",
"staff": "./components/staff/staff",
"popup": "../../../components/Popup/Popup",
"search-input": "../../../components/SearchInput/SearchInput"
"search-input": "../../../components/SearchInput/SearchInput",
"accountSwitchingPop": "./components/accountSwitchingPop/accountSwitchingPop"
},
"navigationStyle": "custom"
}
......@@ -20,7 +20,7 @@
content: '';
width: 100%;
height: 486rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.png') no-repeat;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/bg.webp') no-repeat;
background-size: 100% 486rpx;
position: absolute;
left: 0;
......@@ -56,90 +56,4 @@
.navigation-title .move {
transform: rotate(-180deg) translateY(0);
}
.search-box {
width: 100%;
height: 104rpx;
padding-left: 32rpx;
// margin-top: 20rpx;
display: flex;
align-items: center;
background-color: #fff;
position: sticky;
top: 0;
left: 0;
z-index: 9;
box-sizing: border-box;
}
.search-box .search-input {
background: #F7F8FA;
border-radius: 38rpx;
width: 606rpx;
height: 72rpx;
display: flex;
align-items: center;
}
.search-box .search-input .search-icon {
width: 28rpx;
height: 28rpx;
margin: 0 10rpx 0 26rpx;
}
.search-box .search-input .search-clear {
width: 36rpx;
height: 36rpx;
margin: 0 26rpx 0 10rpx;
}
.search-box .search-input .input {
font-size: 28rpx;
width: calc(100% - 136rpx);
}
.input-placeholder {
color: rgba(200, 201, 204, .89);
}
.search-box .search {
width: 144rpx;
height: 100%;
color: #666;
box-sizing: border-box;
padding: 0 24rpx;
}
.search-box .search .text-center {
font-size: 24rpx;
/* background-color: #f7f7f7; */
border-radius: 12rpx;
width: 100%;
font-size: 32rpx;
color: #858A94;
}
.search-box .search .text-center .search-filter {
margin-left: 6rpx;
width: 24rpx;
height: 24rpx;
}
.itemCon {
box-sizing: border-box;
width: 100%;
// background-color: #fff;
height: 80rpx;
color: #323436;
line-height: 80rpx;
padding: 0 32rpx;
}
.active {
// color: aqua;
background: #F0F7FF;
font-size: 28rpx;
color: #3666FE;
}
\ No newline at end of file
<!-- pages/tab/output/output.wxml -->
<!-- <navigation-bar navStyle="{{navStyle}}">服务商账号名称</navigation-bar>
<view class="layout">
</view> -->
<navigation-bar navStyle="{{navStyle}}" bindnavbarReady="navbarReady">
<!-- <picker
range="{{merchantRange}}"
......@@ -11,14 +7,14 @@
bindchange="changePicker"
bindtap="tapPicker"
bindcancel="tapPicker"
disabled="{{merchantRange.length < 2}}">
<view class="navigation-title">
<view class="navigation-title-text text-hide">{{merchantRange[subIndex].merchantName}}</view>
<view class="arrow {{moveArrow?'move':''}}" wx:if="{{merchantRange.length > 1}}">
<image src="{{${IMG_URL}/output/arrow.png}}" />
</view>
disabled="{{merchantRange.length < 2}}"> -->
<view class="navigation-title" bindtap="tapPicker">
<view class="navigation-title-text text-hide">{{merchantRange[subIndex].merchantName}}</view>
<view class="arrow {{moveArrow?'move':''}}" wx:if="{{merchantRange.length > 1}}">
<image src="{{IMG_URL}}/output/arrow.png" />
</view>
</picker> -->
</view>
<!-- </picker> -->
</navigation-bar>
<view class="layout" style="padding-top:{{tabBarStyle}}px;">
<tab
......@@ -41,52 +37,10 @@
<staff id="staff" />
</view>
</view>
<!-- title="选择车型" -->
<popup show="{{popupShow}}" bindconfirm="confirm" height="60%">
<!-- <search-input placeholder="请搜索服务商账号名" ></search-input> -->
<view class="search-box">
<view class="search-input">
<image src="{{IMG_URL}}/output/searchIcon.png" class="search-icon" />
<input
type="text"
placeholder="请搜索服务商账号名"
class="input"
value="{{keyword}}"
placeholder-class="input-placeholder"
bindinput="input"
bindconfirm="search" />
<block wx:if="{{keyword}}">
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search text-center" bindtap="showConfirm">
<view class="text-center">
搜索
<!-- <image class="search-filter" src="/images/filter.png" /> -->
</view>
</view>
</view>
<!-- style="height:0%;" -->
<scroll-view
scroll-y
enable-back-to-top
refresher-enabled="{{true}}"
bindrefresherrefresh="refreshList"
refresher-threshold="104"
scroll-top="{{scrollTop}}"
class="list"
style="height:100%;"
data-type="message"
refresher-triggered="{{triggered}}">
<block wx:for="{{merchantList}}" wx:key="index">
<view
class="itemCon {{item.act?'active':''}}"
hidden="{{!item.show}}"
data-index="{{index}}"
bindtap="select">
{{item.merchantName}}
</view>
</block>
</scroll-view>
</popup>
<accountSwitchingPop
wx:if="{{popupShow}}"
bind:hidePopup="tapPicker"
bind:changeAccount="getMerchantRange"
popShow="{{popupShow}}"
merchantRange="{{merchantRange}}" />
const ISCOMMECTED = Symbol('ISCOMMECTED')
class NetWork {
[ISCOMMECTED] = false;
constructor() {
this.onNetworkStatusChange()
}
/**监听网络变化 */
onNetworkStatusChange() {
wx.onNetworkStatusChange(({
isConnected,
networkType
}) => {
if (!isConnected && !this[ISCOMMECTED]) {
this[ISCOMMECTED] = true
wx.showToast({
icon: 'loading',
title: '网络尚未连接',
mask: true,
duration: 36e3 * 24
})
} else {
if (this[ISCOMMECTED]) {
this[ISCOMMECTED] = false
wx.showLoading()
this.refreshPage()
}
}
})
}
getNetworkType() {
const that = this
return new Promise((resolve, reject) => {
wx.getNetworkType({
success({
networkType
}) {
that[ISCOMMECTED] = networkType == 'none'
resolve(networkType)
},
fail: err => reject(err)
})
})
}
netWorkModal(confirmText = '返回') {
return new Promise((resolve, reject) => {
wx.showModal({
content: '网络尚未连接,请稍后再试',
confirmText,
showCancel: false,
confirmColor: '#3666FE',
success(res) {
if (res.confirm) resolve()
if (res.cancel) reject()
}
})
})
}
/**页面重载 */
refreshPage() {
wx.hideLoading()
wx.showNavigationBarLoading()
const thisPage = wx.$router.getPageInstance(),
{
onLoad,
onShow,
onRoute,
options
} = thisPage
if (onLoad) thisPage.onLoad(options, true)
if (onShow) thisPage.onShow(options, true)
if (onRoute) thisPage.onRoute(options, true)
}
}
export default new NetWork()
\ No newline at end of file
import {
secretKey,
pathEnum,
domain,
sign
} from './http.js'
// import util from '../util'
import {
getSessionId
} from '~/utils/cache/storageApi'
import { secretKey, pathEnum, domain, sign } from './http.js'
import { getSessionId } from '~/utils/cache/storageApi'
import network from '~/utils/network'
/**接口 */
class Request {
get(params, returnAll = false) {
......@@ -16,15 +9,17 @@ class Request {
post(params, returnAll = false) {
return this.request('POST', params, returnAll)
}
request(RequestMethods, params, returnAll) {
async request(RequestMethods, params, returnAll) {
const type = await network.getNetworkType()
if (type == 'none') return
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
let header =
RequestMethods === 'POST' ?
{
'content-type': 'application/x-www-form-urlencoded'
} :
{}
RequestMethods === 'POST'
? {
'content-type': 'application/x-www-form-urlencoded'
}
: {}
let projectName = this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName]
......@@ -39,18 +34,21 @@ class Request {
success(response) {
/**业务代码 */
let {
data: {
code,
message
},
data: { code, message },
data
} = response
if (code == 20 || code == 21) {
const thisPage = wx.$router.getPageInstance()
if(thisPage.route == 'login/loading/loading') {
wx.$storage.rm('sessionId')
wx.$storage.rm('userInfo')
const thisPage = wx.$router.getPageInstance(),
autoLoginObject = wx.$storage.get('auto_login_object')
if (thisPage.route == 'login/loading/loading') {
resolve(data)
return
} else wx.$router.reLaunch('login.index')
} else {
if (autoLoginObject) wx.$router.reLaunch('login.loading')
else wx.$router.reLaunch('login.index')
}
} else {
if (returnAll) {
resolve(data)
......@@ -112,4 +110,4 @@ class Request {
return projectName
}
}
export default new Request()
\ No newline at end of file
export default new Request()
......@@ -116,7 +116,6 @@ const clearObjNull = options => {
/**获取图片版本号 */
const getImgVersion = () => {
return commonApi.getImgVersion()
}
const Util = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!