Commit 86aec38a by cen

Merge branch 'SAAS+V5.5.3' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V5.5.3

2 parents 8db3a080 43becd6a
import http from '../request/http' import http from '../request/http'
module.exports = { module.exports = {
/**活动列表 */ /**活动列表 */
activityPage(data) { activityPage(data) {
return http.post({ return http.post({
method: 'risk.manage.api.activity.pad.page', method: 'risk.manage.api.activity.pad.page',
projectName: 'pad', projectName: 'pad',
...data ...data
}) })
}, },
/**荣誉墙 */ /**荣誉墙 */
activityReward(data) { activityReward(data) {
return http.post({ return http.post({
method: 'risk.manage.api.activity.reward', method: 'risk.manage.api.activity.reward',
projectName: 'pad', projectName: 'pad',
...data ...data
}) })
} },
} /**
* 获取活动弹框
*/
getActivityMessagePopUpWindow(data) {
return http.post({
method: 'dj.pad.api.activity.message.pop.up.window',
projectName: 'pad',
...data
})
},
/**
* 更新活动弹框状态
*/
updateActivityMessagePopUpWindow(data) {
return http.post({
method: 'dj.pad.api.activity.pop.up.window.update',
projectName: 'pad',
...data
})
},
}
import http from '../request/http' import http from '../request/http'
import { env } from '../../env' import { env } from '../../env'
const serverConfig = { const ENV = env == 'ip' ? 'develop' : env,
mockRequestCount: null, serverConfig = {
mockTimer: {}, mockRequestCount: null,
mockCache: null mockTimer: {},
}, mockCache: null
boutiqueServerConfig = { },
mockRequestCount: null, boutiqueServerConfig = {
mockTimer: {}, mockRequestCount: null,
mockCache: null mockTimer: {},
}, mockCache: null
configModule = 'app-tape', },
boutiqueConfigModule = 'boutique-pad-config', configModule = 'app-tape',
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`, boutiqueConfigModule = 'boutique-pad-config',
boutiqueConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${boutiqueConfigModule}&env=${env}` configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${ENV}`,
/**获取APP配置 */ boutiqueConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${boutiqueConfigModule}&env=${ENV}`
const getMockData = async (immediate = false) => { /**获取APP配置 */
const MOCKDATA = uni.$storage.get('mock_data') const getMockData = async (immediate = false) => {
try { const MOCKDATA = uni.$storage.get('mock_data')
if (!immediate && MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) { try {
return Promise.resolve(MOCKDATA) if (!immediate && MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) {
} else { return Promise.resolve(MOCKDATA)
if (!serverConfig.mockRequestCount || immediate) { } else {
serverConfig.mockCache = null if (!serverConfig.mockRequestCount || immediate) {
serverConfig.mockRequestCount = Date.now() serverConfig.mockCache = null
const data = await http.uni_request({ url: configUrl }) serverConfig.mockRequestCount = Date.now()
data.createTime = Date.now() const data = await http.uni_request({ url: configUrl })
serverConfig.mockCache = data data.createTime = Date.now()
uni.$storage.set('mock_data', data) serverConfig.mockCache = data
return Promise.resolve(data) uni.$storage.set('mock_data', data)
} else { return Promise.resolve(data)
const key = Date.now() } else {
return new Promise(resolve => { const key = Date.now()
serverConfig.mockTimer[key] = setInterval(() => { return new Promise(resolve => {
if (serverConfig.mockCache) { serverConfig.mockTimer[key] = setInterval(() => {
clearInterval(serverConfig.mockTimer[key]) if (serverConfig.mockCache) {
serverConfig.mockRequestCount = null clearInterval(serverConfig.mockTimer[key])
resolve(serverConfig.mockCache) serverConfig.mockRequestCount = null
} resolve(serverConfig.mockCache)
}, 1e3) }
}) }, 1e3)
} })
} }
} catch (error) { }
if (serverConfig.mockTimer[key]) clearInterval(serverConfig.mockTimer[key]) } catch (error) {
serverConfig.mockRequestCount = null if (serverConfig.mockTimer[key]) clearInterval(serverConfig.mockTimer[key])
return Promise.reject(error) serverConfig.mockRequestCount = null
} return Promise.reject(error)
} }
/** }
*权益配置 /**
*/ *权益配置
const findReceptionpriproConfigList = data => { */
return http.post({ const findReceptionpriproConfigList = data => {
method: 'dj.api.smartcarlife.recepiton.customer.findReceptionpriproConfigList', return http.post({
projectName: 'boutique', method: 'dj.api.smartcarlife.recepiton.customer.findReceptionpriproConfigList',
...data projectName: 'boutique',
}) ...data
} })
/** }
*获取后台延保素材ID /**
*/ *获取后台延保素材ID
const getEquityMaterialId = data => { */
return http.post({ const getEquityMaterialId = data => {
method: 'dj.api.smartcarlife.reception.home.page.material.view', return http.post({
projectName: 'boutique', method: 'dj.api.smartcarlife.reception.home.page.material.view',
...data projectName: 'boutique',
}) ...data
} })
/** }
*获取后台延保素材配置 /**
*/ *获取后台延保素材配置
const getEquityMaterialConfig = data => { */
return http.post({ const getEquityMaterialConfig = data => {
method: 'dj.api.car.boutique.reception.home.page.entrance.material.detail', return http.post({
projectName: 'boutique', method: 'dj.api.car.boutique.reception.home.page.entrance.material.detail',
...data projectName: 'boutique',
}) ...data
} })
/** }
*获取轻改配置 /**
*/ *获取轻改配置
const getBoutiqueMockData = async (immediate = false) => { */
const MOCKDATA = uni.$storage.get('boutique_mock_data') const getBoutiqueMockData = async (immediate = false) => {
try { const MOCKDATA = uni.$storage.get('boutique_mock_data')
if (!immediate && MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) { try {
return Promise.resolve(MOCKDATA) if (!immediate && MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) {
} else { return Promise.resolve(MOCKDATA)
if (!boutiqueServerConfig.mockRequestCount || immediate) { } else {
boutiqueServerConfig.mockCache = null if (!boutiqueServerConfig.mockRequestCount || immediate) {
boutiqueServerConfig.mockRequestCount = Date.now() boutiqueServerConfig.mockCache = null
const data = await http.uni_request({ url: boutiqueConfigUrl }) boutiqueServerConfig.mockRequestCount = Date.now()
data.createTime = Date.now() const data = await http.uni_request({ url: boutiqueConfigUrl })
boutiqueServerConfig.mockCache = data data.createTime = Date.now()
uni.$storage.set('boutique_mock_data', data) boutiqueServerConfig.mockCache = data
return Promise.resolve(data) uni.$storage.set('boutique_mock_data', data)
} else { return Promise.resolve(data)
const key = Date.now() } else {
return new Promise(resolve => { const key = Date.now()
boutiqueServerConfig.mockTimer[key] = setInterval(() => { return new Promise(resolve => {
if (boutiqueServerConfig.mockCache) { boutiqueServerConfig.mockTimer[key] = setInterval(() => {
clearInterval(boutiqueServerConfig.mockTimer[key]) if (boutiqueServerConfig.mockCache) {
boutiqueServerConfig.mockRequestCount = null clearInterval(boutiqueServerConfig.mockTimer[key])
resolve(boutiqueServerConfig.mockCache) boutiqueServerConfig.mockRequestCount = null
} resolve(boutiqueServerConfig.mockCache)
}, 1e3) }
}) }, 1e3)
} })
} }
} catch (error) { }
if (boutiqueServerConfig.mockTimer[key]) clearInterval(boutiqueServerConfig.mockTimer[key]) } catch (error) {
boutiqueServerConfig.mockRequestCount = null if (boutiqueServerConfig.mockTimer[key]) clearInterval(boutiqueServerConfig.mockTimer[key])
return Promise.reject(error) boutiqueServerConfig.mockRequestCount = null
} return Promise.reject(error)
} }
// 图片版本号 }
const getImageVersion = async () => { // 图片版本号
const accountInfo = await getMockData() const getImageVersion = async () => {
return accountInfo?.version || Date.now() const accountInfo = await getMockData()
} return accountInfo?.version || Date.now()
/**获取素材配置 */ }
const getSoureData = async (shopMerchantId, sceneType, params = {}) => { /**获取素材配置 */
try { const getSoureData = async (shopMerchantId, sceneType, params = {}) => {
const res = await getEquityMaterialId({ try {
merchantId: shopMerchantId, const res = await getEquityMaterialId({
...params merchantId: shopMerchantId,
}) ...params
if (res && res.id) { })
console.log(res.id, 'res.idres.idres.idres.id') if (res && res.id) {
let data = await getEquityMaterialConfig({ console.log(res.id, 'res.idres.idres.idres.id')
id: res.id let data = await getEquityMaterialConfig({
}) id: res.id
if (data) { })
let { toolList, materialInfoList } = data, if (data) {
storageName = `source_${sceneType}_${shopMerchantId}` let { toolList, materialInfoList } = data,
if (params.brandId && params.subBrandId) storageName += `_${params.brandId}_${params.subBrandId}` storageName = `source_${sceneType}_${shopMerchantId}`
let insurance = materialInfoList.find(e => e.componentName == 'insurance'), if (params.brandId && params.subBrandId) storageName += `_${params.brandId}_${params.subBrandId}`
hasEquity = toolList.find(e => e.id == insurance.id) let insurance = materialInfoList.find(e => e.componentName == 'insurance'),
if (insurance && hasEquity) { hasEquity = toolList.find(e => e.id == insurance.id)
let configList if (insurance && hasEquity) {
try { let configList
configList = await findReceptionpriproConfigList({}) try {
uni.$storage.set('findReceptionpriproConfigList', configList) configList = await findReceptionpriproConfigList({})
} catch (error) { uni.$storage.set('findReceptionpriproConfigList', configList)
configList = uni.$storage.get('findReceptionpriproConfigList') } catch (error) {
} configList = uni.$storage.get('findReceptionpriproConfigList')
const toolOtherList = configList.map(i => { }
return { const toolOtherList = configList.map(i => {
id: hasEquity.id + 100 + i.id, return {
shortTitle: i.productName, id: hasEquity.id + 100 + i.id,
shortTitleUrl: i.procuctLog shortTitle: i.productName,
} shortTitleUrl: i.procuctLog
}) }
toolList = toolList.concat(toolOtherList) })
const moduleOtherList = configList.map(i => { toolList = toolList.concat(toolOtherList)
return { const moduleOtherList = configList.map(i => {
id: hasEquity.id + 100 + i.id, return {
title: i.productName, id: hasEquity.id + 100 + i.id,
shortTitleUrl: i.procuctLog, title: i.productName,
productPoster: i.productPoster, shortTitleUrl: i.procuctLog,
showAlt: false, productPoster: i.productPoster,
componentName: 'CaseCenter', showAlt: false,
receptionpriproCusCaseList: i.receptionpriproCusCaseList, componentName: 'CaseCenter',
hide: true, receptionpriproCusCaseList: i.receptionpriproCusCaseList,
detailTitle: i.productName, hide: true,
thumbnail: 'https://img02.glsx.com.cn/weapp/resource/app-tape/common/qsyw.webp' detailTitle: i.productName,
} thumbnail: 'https://img02.glsx.com.cn/weapp/resource/app-tape/common/qsyw.webp'
}) }
materialInfoList = materialInfoList.concat(moduleOtherList) })
} materialInfoList = materialInfoList.concat(moduleOtherList)
data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl']) }
data.moduleList = await imgTransformBase64(materialInfoList, ['thumbnail', 'receptionSourceDetailList', 'screenList']) data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl'])
uni.setStorageSync(storageName, { data.moduleList = await imgTransformBase64(materialInfoList, ['thumbnail', 'receptionSourceDetailList', 'screenList'])
moduleList: data.moduleList, uni.setStorageSync(storageName, {
toolList: data.toolList, moduleList: data.moduleList,
id: res.id toolList: data.toolList,
}) id: res.id
return Promise.resolve(data) })
} else throw false return Promise.resolve(data)
} else throw false } else throw false
} catch (error) { } else throw false
uni.hideLoading() } catch (error) {
if (error) uni.hideLoading()
uni.showToast({ if (error)
title: error, uni.showToast({
icon: 'none', title: error,
duration: 2000 icon: 'none',
}) duration: 2000
} })
} }
/**批量图片转base64 */ }
const imgTransformBase64 = async (imgList = [], keyList = []) => { /**批量图片转base64 */
return await Promise.all( const imgTransformBase64 = async (imgList = [], keyList = []) => {
imgList?.map(async e => { return await Promise.all(
await Promise.all( imgList?.map(async e => {
Object.keys(e).map(async key => { await Promise.all(
if (keyList.includes(key)) { Object.keys(e).map(async key => {
let isArray = Array.isArray(e[key]) if (keyList.includes(key)) {
if (isArray) { let isArray = Array.isArray(e[key])
await Promise.all( if (isArray) {
e[key].map(async i => { await Promise.all(
await Promise.all( e[key].map(async i => {
Object.keys(i).map(async k => { await Promise.all(
// i[`original_${k}`] = JSON.parse(JSON.stringify(i[k])) Object.keys(i).map(async k => {
if (k == 'detailUrl' && i[k]) i[k] = await getBase64(i[k]) // i[`original_${k}`] = JSON.parse(JSON.stringify(i[k]))
}) if (k == 'detailUrl' && i[k]) i[k] = await getBase64(i[k])
) })
}) )
) })
} else { )
if (typeof e[key] === 'string' && e[key]) { } else {
// e[`original_${key}`] = JSON.parse(JSON.stringify(e[key])) if (typeof e[key] === 'string' && e[key]) {
e[key] = await getBase64(e[key]) // e[`original_${key}`] = JSON.parse(JSON.stringify(e[key]))
} e[key] = await getBase64(e[key])
if (e[key] && typeof e[key] === 'object') { }
await Promise.all( if (e[key] && typeof e[key] === 'object') {
Object.keys(e[key]).map(async k => { await Promise.all(
// e[key][`original_${k}`] = JSON.parse(JSON.stringify(e[key][k])) Object.keys(e[key]).map(async k => {
if (e[key][k]) e[key][k] = await getBase64(e[key][k]) // e[key][`original_${k}`] = JSON.parse(JSON.stringify(e[key][k]))
}) if (e[key][k]) e[key][k] = await getBase64(e[key][k])
) })
} )
} }
} }
}) }
) })
return e )
}) return e
) })
} )
/**转base64 */ }
const getBase64 = async url => { /**转base64 */
return new Promise((resolve, reject) => { const getBase64 = async url => {
uni.request({ return new Promise((resolve, reject) => {
url, uni.request({
method: 'GET', url,
responseType: 'arraybuffer', method: 'GET',
success: res => { responseType: 'arraybuffer',
const base64 = `data:image/png;base64,${uni.arrayBufferToBase64(res.data)}` success: res => {
resolve(base64) const base64 = `data:image/png;base64,${uni.arrayBufferToBase64(res.data)}`
}, resolve(base64)
fail: err => { },
resolve(url) fail: err => {
// reject(err) resolve(url)
} // reject(err)
}) }
}) })
} })
module.exports = { }
getImageVersion, module.exports = {
getMockData, getImageVersion,
getBoutiqueMockData, getMockData,
findReceptionpriproConfigList, getBoutiqueMockData,
getSoureData, findReceptionpriproConfigList,
getEquityMaterialId, getSoureData,
getEquityMaterialConfig getEquityMaterialId,
} getEquityMaterialConfig
}
<template>
<uni-popup
ref="popup"
border-radius="20px"
@maskClick="updateActivity"
>
<view class="activity-box">
<view
class="close flex"
@click="close"
>
<uni-icons
type="closeempty"
:size="18"
color="#1A1A1A"
></uni-icons>
</view>
<image
:src="bgUrl"
class="bg"
/>
<view class="content">
<view class="title">{{ title }}</view>
<view class="description">{{ description }}</view>
</view>
<view
class="btn"
@click="jump"
></view>
</view>
</uni-popup>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ActivityPopup',
data () {
return {
data: {}
}
},
computed: {
bgUrl () {
let { type } = this.data
return `https://img02.glsx.com.cn/weapp/resource/app-tape/common/activity-${type}.webp`
},
title () {
return this.data.activityName || ''
},
description () {
return {
0: '获奖名单已出炉!快来看看是谁斩获大奖,围观本期“销售之星”。',
1: '新的销售竞赛活动已发布!请尽快查阅评选规则与奖励方案,力争上游!'
}[this.data.type]
},
},
mounted () {
},
methods: {
open (data) {
this.data = data
this.$refs.popup.open("center");
},
close () {
this.$refs.popup.close()
this.updateActivity()
},
jump () {
this.close()
uni.$emit('ActivityCenter')
},
async updateActivity () {
const { msgId } = this.data
await uni.$api.activityApi.updateActivityMessagePopUpWindow({
msgId
})
}
}
}
</script>
<style scoped lang="scss">
.activity-box {
position: relative;
width: toRpx(1400);
height: toRpx(928);
// background: #ffffff;
border-radius: toRpx(64);
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.close {
position: absolute;
width: toRpx(160);
height: toRpx(160);
top: 0;
right: 0;
justify-content: center;
}
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
}
.content {
position: absolute;
top: toRpx(284);
right: toRpx(100);
width: toRpx(650);
.title {
color: #333333;
font-size: toRpx(56);
font-weight: 700;
margin-bottom: toRpx(24);
line-height: toRpx(80);
display: -webkit-box;
word-break: break-all;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.description {
color: #999999;
font-size: toRpx(34);
line-height: toRpx(52);
}
}
.btn {
position: absolute;
width: toRpx(516);
height: toRpx(120);
right: toRpx(266);
bottom: toRpx(116);
}
}
</style>
<template> <template>
<view class="left-side"> <view class="left-side">
<view class="user-box"> <view class="user-box">
<view class="user-info flex" @click="jumpPersonCenter"> <view
class="user-info flex"
@click="jumpPersonCenter"
>
<view :class="['user-avatar', 'sprite-icon', 'icon-avatar', tabIndex == 99 ? 'user-active' : '']"></view> <view :class="['user-avatar', 'sprite-icon', 'icon-avatar', tabIndex == 99 ? 'user-active' : '']"></view>
<view class="user-name"> <view class="user-name">
<view class="user-name-text">{{ userInfo.name }}</view> <view class="user-name-text">{{ userInfo.name }}</view>
<view v-if="hasPerson" class="sprite-icon icon-arrow-next"></view> <view
v-if="hasPerson"
class="sprite-icon icon-arrow-next"
></view>
</view> </view>
</view> </view>
</view> </view>
<view :class="['left-tabs', { three: tabs.length == 3 }]"> <view :class="['left-tabs', { three: tabs.length == 3 }]">
<template v-for="(i, index) in tabs"> <template v-for="(i, index) in tabs">
<view :class="['tab-item', { tabActive: tabIndex == index }]" :key="index" @click="changeIndex(index, i)" v-if="!i.hidden && (i.name !== 'ActivityCenter' || activityTabVisible)"> <view
:class="['tab-item', { tabActive: tabIndex == index }]"
:key="index"
@click="changeIndex(index, i)"
v-if="!i.hidden && (i.name !== 'ActivityCenter' || activityTabVisible)"
>
<view class="icon-box"> <view class="icon-box">
<view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view> <view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view>
</view> </view>
{{ i.label }} {{ i.label }}
<view class="dot" v-if="i.icon == 'record' && perRecordNumber"></view> <view
<view class="tip-box" v-if="i.icon == 'study' && readCount">待办事项:{{ readCount }}</view> class="dot"
v-if="i.icon == 'record' && perRecordNumber"
></view>
<view
class="tip-box"
v-if="i.icon == 'study' && readCount"
>待办事项:{{ readCount }}</view>
</view> </view>
</template> </template>
</view> </view>
...@@ -32,19 +49,40 @@ ...@@ -32,19 +49,40 @@
v-if="messageTotal > 0" v-if="messageTotal > 0"
></view> ></view>
</view> --> </view> -->
<view class="btn" @click="openScenePopup"> <view
class="btn"
@click="openScenePopup"
>
<view class="sprite-icon icon-scene-change"></view> <view class="sprite-icon icon-scene-change"></view>
</view> </view>
<view class="btn" @click="handleSetting"> <view
class="btn"
@click="handleSetting"
>
<view class="sprite-icon icon-setting"></view> <view class="sprite-icon icon-setting"></view>
</view> </view>
</view> </view>
<!-- 客服弹框 --> <!-- 客服弹框 -->
<!-- <kf-box ref="kfRef" /> --> <!-- <kf-box ref="kfRef" /> -->
<message-pop ref="kfRef" :type="messageType" :messageData="messageData"></message-pop> <message-pop
ref="kfRef"
:type="messageType"
:messageData="messageData"
></message-pop>
<!-- 设置弹框 --> <!-- 设置弹框 -->
<setting-box ref="settingRef" @stopAudio="$emit('stopAudio')" /> <setting-box
<center-popup :list="sceneTypeList" ref="sceneTypeRef" @choose="chooseSceneType" title="选择场景" tag="当前场景" :id="userInfo.sceneType" isLine /> ref="settingRef"
@stopAudio="$emit('stopAudio')"
/>
<center-popup
:list="sceneTypeList"
ref="sceneTypeRef"
@choose="chooseSceneType"
title="选择场景"
tag="当前场景"
:id="userInfo.sceneType"
isLine
/>
</view> </view>
</template> </template>
...@@ -61,7 +99,7 @@ export default { ...@@ -61,7 +99,7 @@ export default {
userInfo: Object userInfo: Object
}, },
name: '', name: '',
data() { data () {
return { return {
messageData: { messageData: {
classCountList: [], classCountList: [],
...@@ -80,7 +118,7 @@ export default { ...@@ -80,7 +118,7 @@ export default {
} }
}, },
watch: { watch: {
userInfo(n) { userInfo (n) {
console.log('userInfo', n) console.log('userInfo', n)
if (n.shopMerchantId) this.haveCustomerAccess(n) if (n.shopMerchantId) this.haveCustomerAccess(n)
}, },
...@@ -92,10 +130,10 @@ export default { ...@@ -92,10 +130,10 @@ export default {
// } // }
}, },
computed: { computed: {
perRecordNumber() { perRecordNumber () {
return this.$store.state.audio.perRecordNumber return this.$store.state.audio.perRecordNumber
}, },
sceneTypeList() { sceneTypeList () {
const sceneTypeObject = { const sceneTypeObject = {
1: { 1: {
title: '轻改', title: '轻改',
...@@ -132,7 +170,7 @@ export default { ...@@ -132,7 +170,7 @@ export default {
return result return result
}, },
// 这个tabs进来的值更新触发顺序是 getStudyCenterPermission的方法变更 => 计算属性的变更 => userInfo的监听变更 => haveCustomerAccess的变更。 计算属性的变更后的更新值是不会重新触发渲染的 // 这个tabs进来的值更新触发顺序是 getStudyCenterPermission的方法变更 => 计算属性的变更 => userInfo的监听变更 => haveCustomerAccess的变更。 计算属性的变更后的更新值是不会重新触发渲染的
tabs() { tabs () {
const tabs = [ const tabs = [
{ {
label: "首页", label: "首页",
...@@ -200,7 +238,7 @@ export default { ...@@ -200,7 +238,7 @@ export default {
}, },
inject: ['showPage'], inject: ['showPage'],
methods: { methods: {
getUnreadCount() { getUnreadCount () {
let _this = this let _this = this
uni.$api.commonApi.getUnreadCount({}).then(res => { uni.$api.commonApi.getUnreadCount({}).then(res => {
this.readCount = res.data this.readCount = res.data
...@@ -236,15 +274,15 @@ export default { ...@@ -236,15 +274,15 @@ export default {
// this.leaveTrack() // this.leaveTrack()
// }, 5000) // }, 5000)
// }, // },
clickHome() { clickHome () {
if (this.tabs[this.tabIndex].isTrack) if (this.tabs[this.tabIndex].isTrack)
this.changeIndex(0, this.tabs[0]) this.changeIndex(0, this.tabs[0])
}, },
handleSetting() { handleSetting () {
this.$refs.settingRef.open() this.$refs.settingRef.open()
this.clickHome() this.clickHome()
}, },
findBeiSenSSOToken() { findBeiSenSSOToken () {
return new Promise(resolve => { return new Promise(resolve => {
const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2' const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2'
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => { uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
...@@ -254,7 +292,7 @@ export default { ...@@ -254,7 +292,7 @@ export default {
}) })
}) })
}, },
handleActivityCenter() { handleActivityCenter () {
console.log('ActivityCenter triggered'); // 添加日志查看触发次数 console.log('ActivityCenter triggered'); // 添加日志查看触发次数
let { tabs } = this; let { tabs } = this;
let index = tabs.findIndex(e => e.name == 'ActivityCenter'); let index = tabs.findIndex(e => e.name == 'ActivityCenter');
...@@ -262,7 +300,7 @@ export default { ...@@ -262,7 +300,7 @@ export default {
this.changeIndex(index, this.tabs[index]); this.changeIndex(index, this.tabs[index]);
} }
}, },
async changeIndex(index, item) { async changeIndex (index, item) {
if (item.eventCode) uni.$track.add({ if (item.eventCode) uni.$track.add({
eventCode: item.eventCode eventCode: item.eventCode
}) })
...@@ -283,13 +321,13 @@ export default { ...@@ -283,13 +321,13 @@ export default {
this.findBeiSenSSOToken() this.findBeiSenSSOToken()
} }
}, },
async haveCustomerAccess(val) { async haveCustomerAccess (val) {
const { shopMerchantId, sceneType: scene } = val const { shopMerchantId, sceneType: scene } = val
uni.$api.customerApi.saleOpen({ uni.$api.customerApi.saleOpen({
merchantId: shopMerchantId, merchantId: shopMerchantId,
scene scene
}).then(result => { }).then(result => {
console.log('有客户权限',result) console.log('有客户权限', result)
if (result) { if (result) {
this.hasPerson = true this.hasPerson = true
// this.activityTabVisible = scene !== 7 // this.activityTabVisible = scene !== 7
...@@ -325,7 +363,7 @@ export default { ...@@ -325,7 +363,7 @@ export default {
}) })
}, },
// 获取话术未读列表 // 获取话术未读列表
async getMessage() { async getMessage () {
const { sceneType, uuid } = uni.$storage.get("userInfo") const { sceneType, uuid } = uni.$storage.get("userInfo")
let businessTypeList = [] let businessTypeList = []
if (sceneType == 0) { if (sceneType == 0) {
...@@ -341,8 +379,9 @@ export default { ...@@ -341,8 +379,9 @@ export default {
if (res.total) { if (res.total) {
this.messageData = res this.messageData = res
this.messageType = 'attendance' this.messageType = 'attendance'
this.$refs.kfRef.open() this.openStudyPopup()
} }
return Promise.resolve(res.total)
}, },
// 消息中心未读总数 // 消息中心未读总数
// async getMessageCount () { // async getMessageCount () {
...@@ -354,7 +393,8 @@ export default { ...@@ -354,7 +393,8 @@ export default {
// this.messageTotal = res // this.messageTotal = res
// }, // },
// 学习中心消息弹窗,优先级高于有修改话术弹窗 // 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop() { async getMessagePop () {
this.$store.dispatch('setIndexMessagePopupStatus', true)
const res = await uni.$api.commonApi.getMessagePop({}) const res = await uni.$api.commonApi.getMessagePop({})
if (res.ids && res.ids.length > 0) { if (res.ids && res.ids.length > 0) {
if (Array.isArray(res.moduleTypeList) && (res.moduleTypeList.includes(3) || res.moduleTypeList.includes(4)) if (Array.isArray(res.moduleTypeList) && (res.moduleTypeList.includes(3) || res.moduleTypeList.includes(4))
...@@ -362,7 +402,7 @@ export default { ...@@ -362,7 +402,7 @@ export default {
// 3, 4学习任务弹窗 // 3, 4学习任务弹窗
this.messageType = 'study' this.messageType = 'study'
this.messageData = res this.messageData = res
this.$refs.kfRef.open() this.openStudyPopup()
// 确认消息 // 确认消息
if (res.ids.length) { if (res.ids.length) {
uni.$api.commonApi.getStudyTaskConfirm({ uni.$api.commonApi.getStudyTaskConfirm({
...@@ -372,21 +412,25 @@ export default { ...@@ -372,21 +412,25 @@ export default {
} else { } else {
this.messageType = 'system' this.messageType = 'system'
this.messageData = res this.messageData = res
this.$refs.kfRef.open() this.openStudyPopup()
} }
} else { } else {
await this.getMessage() const data = await this.getMessage()
if(!data) this.$store.dispatch('setIndexMessagePopupStatus', false)
} }
}, },
openPop() { openStudyPopup () {
this.$refs.kfRef.open()
},
openPop () {
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/messageList` url: `/pages/common/messageList`
}) })
}, },
getMessageInfo() { getMessageInfo () {
this.getMessagePop() this.getMessagePop()
}, },
jumpPersonCenter() { jumpPersonCenter () {
if (this.hasPerson) { if (this.hasPerson) {
uni.$track.add({ uni.$track.add({
eventCode: 'app_personal_center' eventCode: 'app_personal_center'
...@@ -395,7 +439,7 @@ export default { ...@@ -395,7 +439,7 @@ export default {
this.$emit('update:tabIndex', 99) this.$emit('update:tabIndex', 99)
} }
}, },
chooseSceneType(index) { chooseSceneType (index) {
let { userInfo, sceneTypeList } = this, let { userInfo, sceneTypeList } = this,
sceneType = sceneTypeList[index].id sceneType = sceneTypeList[index].id
if (sceneType == userInfo.sceneType) return if (sceneType == userInfo.sceneType) return
...@@ -414,7 +458,7 @@ export default { ...@@ -414,7 +458,7 @@ export default {
url url
}) })
}, },
openScenePopup() { openScenePopup () {
this.$refs.sceneTypeRef.open() this.$refs.sceneTypeRef.open()
uni.$track.add({ uni.$track.add({
eventCode: 'app_scene_change' eventCode: 'app_scene_change'
...@@ -424,12 +468,12 @@ export default { ...@@ -424,12 +468,12 @@ export default {
getStudyCenterPermission () { getStudyCenterPermission () {
const userInfo = uni.$storage.get('userInfo') const userInfo = uni.$storage.get('userInfo')
const res = uni.$storage.get('studyCenterPermission') const res = uni.$storage.get('studyCenterPermission')
if(!res){ if (!res) {
uni.$api.commonApi.getStudyCenterPermission({}).then(res => { uni.$api.commonApi.getStudyCenterPermission({}).then(res => {
uni.$storage.set('studyCenterPermission', res) uni.$storage.set('studyCenterPermission', res)
console.log(res,'res') console.log(res, 'res')
}) })
} }
if (userInfo.sceneType == 7) { if (userInfo.sceneType == 7) {
this.tabs[2].hidden = true this.tabs[2].hidden = true
} }
...@@ -440,11 +484,11 @@ export default { ...@@ -440,11 +484,11 @@ export default {
} }
} }
}, },
beforeCreate() { beforeCreate () {
// clearInterval(this.trackInterval) // clearInterval(this.trackInterval)
// this.trackInterval = null // this.trackInterval = null
}, },
beforeDestroy() { beforeDestroy () {
// uni.$off('pageBack') // uni.$off('pageBack')
// uni.$off('studyCenter') // uni.$off('studyCenter')
uni.$off('ActivityCenter', this.handleActivityCenter); uni.$off('ActivityCenter', this.handleActivityCenter);
......
<template> <template>
<uni-popup ref="popup" border-radius="20px"> <uni-popup
<view class="setting-box"> ref="popup"
<view class="close flex" @click="close"> border-radius="20px"
<uni-icons type="closeempty" :size="18" color="#1A1A1A"></uni-icons> >
</view> <view class="setting-box">
<view class="app-info flex"> <view
<view class="sprite-icon icon-logo"></view> class="close flex"
展业助手 @click="close"
<view class="version">版本号:V{{ version }}</view> >
<view class="check-box" @click="handleCheck">检查更新</view> <uni-icons
</view> type="closeempty"
<view class="btn-box"> :size="18"
<view class="btn flex" @click="changeAccount">切换账号</view> color="#1A1A1A"
<view class="btn flex logout" @click="logout">退出</view> ></uni-icons>
</view> </view>
<view class="a" @click="jump('agreement')">《用户隐私协议》</view> <view class="app-info flex">
<view class="icp flex" @click="jump('icp')"> <view class="sprite-icon icon-logo"></view>
ICP备案号:苏ICP备18023686号-2A 展业助手
<view class="sprite-icon icon-arrow-right"></view> <view class="version">版本号:V{{ version }}</view>
</view> <view
<view class="app-code flex"> class="check-box"
APP编码:{{ deviceId }} @click="handleCheck"
<view class="sprite-icon icon-clone" @click="copyText"></view> >检查更新</view>
</view> </view>
</view> <view class="btn-box">
</uni-popup> <view
</template> class="btn flex"
@click="changeAccount"
<script type="text/ecmascript-6"> >切换账号</view>
import checkUpdate from "@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js"; <view
import utils from '@/utils/utils' class="btn flex logout"
export default { @click="delAccount"
name: 'SettingBox', >注销</view>
data() { <view
return { class="btn flex logout"
version: '', @click="logout"
deviceId: '' >退出</view>
} </view>
}, <view
mounted() { class="a"
this.version = plus?.runtime?.version || '1.0.0' @click="jump('agreement')"
const { >《隐私协议》</view>
deviceId <view
} = uni.getDeviceInfo() class="icp flex"
this.deviceId = deviceId @click="jump('icp')"
}, >
methods: { ICP备案号:苏ICP备18023686号-2A
copyText() { <view class="sprite-icon icon-arrow-right"></view>
uni.setClipboardData({ </view>
data: this.deviceId, <view class="app-code flex">
success: function() { APP编码:{{ deviceId }}
uni.showToast({ <view
title: '复制成功', class="sprite-icon icon-clone"
icon: 'success' @click="copyText"
}); ></view>
} </view>
}); </view>
}, </uni-popup>
</template>
async handleCheck() {
const { <script type="text/ecmascript-6">
textList, import checkUpdate from "@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js";
tempFileURL, import utils from '@/utils/utils'
version export default {
} = uni.$storage.get('mock_data') name: 'SettingBox',
const res = utils.compareVersions(this.version,version) data () {
if(res > -1) { return {
uni.showToast({ version: '',
title: '目前已是最新版本', deviceId: ''
duration: 2000, }
icon: 'none' },
}); mounted () {
return this.version = plus?.runtime?.version || '1.0.0'
} const {
this.close() deviceId
const e = { } = uni.getDeviceInfo()
result: { this.deviceId = deviceId
"is_silently": false, },
"is_mandatory": true, methods: {
"name": "", copyText () {
"title": "", uni.setClipboardData({
"contents": textList.join('\n'), data: this.deviceId,
"version": version, success: function () {
"url": tempFileURL, uni.showToast({
"stable_publish": true, title: '复制成功',
}, icon: 'success'
} });
checkUpdate(e) }
}, });
open() { },
this.$refs.popup.open("center");
}, async handleCheck () {
close() { const {
this.$refs.popup.close() textList,
}, tempFileURL,
changeAccount() { version
uni.reLaunch({ } = uni.$storage.get('mock_data')
url: '/pages/common/accountItems' const res = utils.compareVersions(this.version, version)
}) if (res > -1) {
}, uni.showToast({
// 退出 title: '目前已是最新版本',
logout() { duration: 2000,
let _this = this icon: 'none'
uni.showModal({ });
title: '温馨提示', return
content: '是否退出当前账号?', }
confirmColor: '#347BFF', this.close()
async success(res) { const e = {
if (res.confirm) { result: {
// _this.$emit('stopAudio') "is_silently": false,
try { "is_mandatory": true,
uni.showLoading({ "name": "",
mask: true "title": "",
}) "contents": textList.join('\n'),
const { "version": version,
code, "url": tempFileURL,
message "stable_publish": true,
} = await uni.$api.userApi.logout(), },
userInfo = uni.$storage.get("userInfo") }
if (code == 0) { checkUpdate(e)
uni.$storage.rm("userInfo"); },
uni.$storage.rm("sessionId"); open () {
uni.$storage.rm("noSignInUuid"); this.$refs.popup.open("center");
uni.$storage.rm("beisenToken"); },
uni.$storage.rm("studyCenterPermission"); close () {
uni.$storage.rm("boutique_YQorderSetting") this.$refs.popup.close()
setTimeout(() => { },
uni.hideLoading() changeAccount () {
uni.reLaunch({ uni.reLaunch({
url: `/pages/common/login?mobile=${userInfo.phone}`, url: '/pages/common/accountItems'
}); })
}, 500) },
} else throw message // 退出
} catch (error) { logout () {
uni.hideLoading() let _this = this
uni.showToast({ uni.showModal({
title: error, title: '温馨提示',
icon: "none", content: '是否退出当前账号?',
}); confirmColor: '#347BFF',
} async success (res) {
} if (res.confirm) {
} // _this.$emit('stopAudio')
}) try {
}, uni.showLoading({
jump(type) { mask: true
let url = type == 'icp' ? 'https://beian.miit.gov.cn/' : })
'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html' const {
uni.navigateTo({ code,
url: `/pages/common/webview?url=${url}` message
}) } = await uni.$api.userApi.logout(),
} userInfo = uni.$storage.get("userInfo")
} if (code == 0) {
} uni.$storage.rm("userInfo");
</script> uni.$storage.rm("sessionId");
uni.$storage.rm("noSignInUuid");
<style scoped lang="scss"> uni.$storage.rm("beisenToken");
.setting-box { uni.$storage.rm("studyCenterPermission");
position: relative; uni.$storage.rm("boutique_YQorderSetting")
width: toRpx(720); setTimeout(() => {
height: toRpx(880); uni.hideLoading()
background: #ffffff; uni.reLaunch({
border-radius: toRpx(40); url: `/pages/common/login?mobile=${userInfo.phone}`,
box-sizing: border-box; });
display: flex; }, 500)
align-items: center; } else throw message
justify-content: center; } catch (error) {
flex-direction: column; uni.hideLoading()
uni.showToast({
.close { title: error,
position: absolute; icon: "none",
width: toRpx(120); });
height: toRpx(120); }
top: 0; }
right: 0; }
justify-content: center; })
} },
jump (type) {
.app-info { let url = type == 'icp' ? 'https://beian.miit.gov.cn/' :
flex-direction: column; 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
font-size: toRpx(32); uni.navigateTo({
color: #333333; url: `/pages/common/webview?url=${url}`
})
.sprite-icon { },
margin-bottom: toRpx(12); delAccount () {
box-shadow: 0 0 toRpx(24) 0 #3682ef33; uni.showModal({
border-radius: toRpx(40); title: '账号注销',
} content: '注销申请将提交给企业管理员审核,审核通过后账号将无法登录。确认提交吗?',
confirmColor: '#347BFF',
.version { success (res) {
margin-top: toRpx(8); if (res.confirm) uni.showToast({
font-size: toRpx(24); title: '申请已提交',
color: #999999; icon: "none",
} });
}
.check-box { })
width: toRpx(120); }
padding: toRpx(10) 0 toRpx(4); }
background: #f2f2f2; }
border-radius: toRpx(6); </script>
font-size: toRpx(22);
color: #999999; <style scoped lang="scss">
text-align: center; .setting-box {
margin-top: toRpx(16); position: relative;
box-sizing: border-box; width: toRpx(720);
} height: toRpx(880);
} background: #ffffff;
border-radius: toRpx(40);
.btn-box { box-sizing: border-box;
margin-top: toRpx(120); display: flex;
align-items: center;
.btn { justify-content: center;
width: toRpx(384); flex-direction: column;
height: toRpx(64);
background: #3b73ff1a; .close {
border: toRpx(2) solid transparent; position: absolute;
border-radius: toRpx(32); width: toRpx(120);
justify-content: center; height: toRpx(120);
font-size: toRpx(28); top: 0;
color: #3b73ff; right: 0;
margin-bottom: toRpx(16); justify-content: center;
} }
.logout { .app-info {
background: #ffffff; flex-direction: column;
color: #333333; font-size: toRpx(32);
border: toRpx(2) solid #e8e8e8; color: #333333;
}
} .sprite-icon {
margin-bottom: toRpx(12);
.a { box-shadow: 0 0 toRpx(24) 0 #3682ef33;
font-size: toRpx(24); border-radius: toRpx(40);
color: #2c66f7; }
margin: toRpx(48) 0 toRpx(16);
} .version {
margin-top: toRpx(8);
.icp { font-size: toRpx(24);
font-size: toRpx(24); color: #999999;
color: #999999; }
}
.check-box {
.app-code { width: toRpx(120);
font-size: toRpx(24); padding: toRpx(10) 0 toRpx(4);
color: #999999; background: #f2f2f2;
line-height: toRpx(40); border-radius: toRpx(6);
font-size: toRpx(22);
.icon-clone { color: #999999;
width: toRpx(24); text-align: center;
height: toRpx(24); margin-top: toRpx(16);
} box-sizing: border-box;
} }
} }
</style>
.btn-box {
margin-top: toRpx(120);
.btn {
width: toRpx(384);
height: toRpx(64);
background: #3b73ff1a;
border: toRpx(2) solid transparent;
border-radius: toRpx(32);
justify-content: center;
font-size: toRpx(28);
color: #3b73ff;
margin-bottom: toRpx(16);
}
.logout {
background: #ffffff;
color: #333333;
border: toRpx(2) solid #e8e8e8;
}
}
.a {
font-size: toRpx(24);
color: #2c66f7;
margin: toRpx(48) 0 toRpx(16);
}
.icp {
font-size: toRpx(24);
color: #999999;
}
.app-code {
font-size: toRpx(24);
color: #999999;
line-height: toRpx(40);
.icon-clone {
width: toRpx(24);
height: toRpx(24);
}
}
}
</style>
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
<StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden"> <StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" /> <StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup> </StudyPopup>
<activity-popup ref="activityPopup"></activity-popup>
</view> </view>
</template> </template>
<script> <script>
...@@ -137,9 +138,35 @@ import StudyPopup from '@/components/StudyPopup.vue' ...@@ -137,9 +138,35 @@ import StudyPopup from '@/components/StudyPopup.vue'
import StudyPopupContent from '@/components/StudyPopupContent.vue' import StudyPopupContent from '@/components/StudyPopupContent.vue'
import ExamSubmitPopup from '@/components/ExamSubmitPopup.vue' import ExamSubmitPopup from '@/components/ExamSubmitPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue' import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import ActivityPopup from './components/ActivityPopup.vue'
export default { export default {
mixins: [recorder, uploader, timeout, versionCheck, merge, interceptionMixin], mixins: [recorder, uploader, timeout, versionCheck, merge, interceptionMixin],
components: { ReceptionCenter, StudyCenter, SceneMarket, LeftSide, Point, dayPoint, rulePoint, Course, Ranking, LevelPoint, Calendar, Promotion, History, LevelMedal, MessageDetail, SwiperComponent, MessageIndex, Entrance, StudyPopup, StudyPopupContent, ExamSubmitPopup, StudyCenterPermissionPopup, ActivityCenter }, components: {
ReceptionCenter,
StudyCenter,
SceneMarket,
LeftSide,
Point,
dayPoint,
rulePoint,
Course,
Ranking,
LevelPoint,
Calendar,
Promotion,
History,
LevelMedal,
MessageDetail,
SwiperComponent,
MessageIndex,
Entrance,
StudyPopup,
StudyPopupContent,
ExamSubmitPopup,
StudyCenterPermissionPopup,
ActivityCenter,
ActivityPopup
},
props: { props: {
id: [String, Number], id: [String, Number],
finishDoneText: String, finishDoneText: String,
...@@ -185,7 +212,8 @@ export default { ...@@ -185,7 +212,8 @@ export default {
courseInfo: { courseInfo: {
title: '' title: ''
}, },
lockReason: 0 lockReason: 0,
onShowCount: 0
} }
}, },
beforeDestroy() { beforeDestroy() {
...@@ -224,6 +252,18 @@ export default { ...@@ -224,6 +252,18 @@ export default {
sceneType() { sceneType() {
const { sceneType } = uni.$storage.get('userInfo') const { sceneType } = uni.$storage.get('userInfo')
return sceneType return sceneType
},
activityStatus() {
return this.$store.getters.indexMessagePopupStatus
}
},
watch: {
activityStatus: {
handler(val) {
if (!val && this.onShowCount) this.getActivityMessage(0)
},
immediate: true,
deep: true
} }
}, },
methods: { methods: {
...@@ -597,6 +637,20 @@ export default { ...@@ -597,6 +637,20 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: `/pages/${pageName}/tool/index?componentName=${item.name}` url: `/pages/${pageName}/tool/index?componentName=${item.name}`
}) })
},
async getActivityMessage(count = 1) {
try {
this.onShowCount = count
if (this.activityStatus) return
const { sceneType } = this,
data = await uni.$api.activityApi.getActivityMessagePopUpWindow({
businessType: sceneType
})
this.onShowCount = 0
if (data) this.$refs.activityPopup.open(data)
} catch (error) {
this.onShowCount = 0
}
} }
} }
} }
......
...@@ -8,7 +8,7 @@ isIos = (plus.os.name == "iOS") ...@@ -8,7 +8,7 @@ isIos = (plus.os.name == "iOS")
// #endif // #endif
// 判断推送权限是否开启 // 判断推送权限是否开启
function judgeIosPermissionPush() { function judgeIosPermissionPush () {
var result = false; var result = false;
var UIApplication = plus.ios.import("UIApplication"); var UIApplication = plus.ios.import("UIApplication");
var app = UIApplication.sharedApplication(); var app = UIApplication.sharedApplication();
...@@ -40,7 +40,7 @@ function judgeIosPermissionPush() { ...@@ -40,7 +40,7 @@ function judgeIosPermissionPush() {
} }
// 判断定位权限是否开启 // 判断定位权限是否开启
function judgeIosPermissionLocation() { function judgeIosPermissionLocation () {
var result = false; var result = false;
var cllocationManger = plus.ios.import("CLLocationManager"); var cllocationManger = plus.ios.import("CLLocationManager");
var status = cllocationManger.authorizationStatus(); var status = cllocationManger.authorizationStatus();
...@@ -62,7 +62,7 @@ function judgeIosPermissionLocation() { ...@@ -62,7 +62,7 @@ function judgeIosPermissionLocation() {
} }
// 判断麦克风权限是否开启 // 判断麦克风权限是否开启
function judgeIosPermissionRecord() { function judgeIosPermissionRecord () {
var result = false; var result = false;
var avaudiosession = plus.ios.import("AVAudioSession"); var avaudiosession = plus.ios.import("AVAudioSession");
var avaudio = avaudiosession.sharedInstance(); var avaudio = avaudiosession.sharedInstance();
...@@ -79,7 +79,7 @@ function judgeIosPermissionRecord() { ...@@ -79,7 +79,7 @@ function judgeIosPermissionRecord() {
} }
// 判断相机权限是否开启 // 判断相机权限是否开启
function judgeIosPermissionCamera() { function judgeIosPermissionCamera () {
var result = false; var result = false;
var AVCaptureDevice = plus.ios.import("AVCaptureDevice"); var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide'); var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
...@@ -95,7 +95,7 @@ function judgeIosPermissionCamera() { ...@@ -95,7 +95,7 @@ function judgeIosPermissionCamera() {
} }
// 判断相册权限是否开启 // 判断相册权限是否开启
function judgeIosPermissionPhotoLibrary() { function judgeIosPermissionPhotoLibrary () {
var result = false; var result = false;
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary"); var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
var authStatus = PHPhotoLibrary.authorizationStatus(); var authStatus = PHPhotoLibrary.authorizationStatus();
...@@ -111,7 +111,7 @@ function judgeIosPermissionPhotoLibrary() { ...@@ -111,7 +111,7 @@ function judgeIosPermissionPhotoLibrary() {
} }
// 判断通讯录权限是否开启 // 判断通讯录权限是否开启
function judgeIosPermissionContact() { function judgeIosPermissionContact () {
var result = false; var result = false;
var CNContactStore = plus.ios.import("CNContactStore"); var CNContactStore = plus.ios.import("CNContactStore");
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0); var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
...@@ -126,7 +126,7 @@ function judgeIosPermissionContact() { ...@@ -126,7 +126,7 @@ function judgeIosPermissionContact() {
} }
// 判断日历权限是否开启 // 判断日历权限是否开启
function judgeIosPermissionCalendar() { function judgeIosPermissionCalendar () {
var result = false; var result = false;
var EKEventStore = plus.ios.import("EKEventStore"); var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0); var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
...@@ -141,7 +141,7 @@ function judgeIosPermissionCalendar() { ...@@ -141,7 +141,7 @@ function judgeIosPermissionCalendar() {
} }
// 判断备忘录权限是否开启 // 判断备忘录权限是否开启
function judgeIosPermissionMemo() { function judgeIosPermissionMemo () {
var result = false; var result = false;
var EKEventStore = plus.ios.import("EKEventStore"); var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1); var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
...@@ -156,46 +156,75 @@ function judgeIosPermissionMemo() { ...@@ -156,46 +156,75 @@ function judgeIosPermissionMemo() {
} }
// Android权限查询 // Android权限查询
function requestAndroidPermission(permissionID) { function requestAndroidPermission (permissionID) {
const PermissionTips = {
['android.permission.RECORD_AUDIO']: {
title: '麦克风(录音)',
content: '为了记录接待过程以保障服务质量及订单纠纷处理,展业助手需要申请您的麦克风(录音)权限。'
},
['android.permission.CAMERA']: {
title: '相机',
content: '为了拍摄活动现场照片及客户购车凭证,展业助手需要申请您的相机权限。'
},
['android.permission.READ_EXTERNAL_STORAGE']: {
title: '相册',
content: '为了上传活动现场照片及客户购车凭证,展业助手需要申请您的相册权限。'
}
}[permissionID] || {
title: permissionID,
content: '请在permission。js中配置此权限。'
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
plus.android.requestPermissions( plus.android.checkPermission(permissionID, ({ checkResult }) => {
[permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装 if(checkResult == -1) uni.showModal({
function(resultObj) { ...PermissionTips,
var result = 0; showCancel: true,
for (var i = 0; i < resultObj.granted.length; i++) { success: res => {
var grantedPermission = resultObj.granted[i]; if (res.confirm) {
console.log('已获取的权限:' + grantedPermission); plus.android.requestPermissions(
result = 1 [permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
function (resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission);
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
resolve(result);
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
// if (result != 1) {
// gotoAppPermissionSetting()
// }
},
function (error) {
console.log('申请权限错误:' + error.code + " = " + error.message);
resolve({
code: error.code,
message: error.message
});
}
);
}
} }
for (var i = 0; i < resultObj.deniedPresent.length; i++) { })
var deniedPresentPermission = resultObj.deniedPresent[i]; else resolve(1)
console.log('拒绝本次申请的权限:' + deniedPresentPermission); })
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
resolve(result);
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
// if (result != 1) {
// gotoAppPermissionSetting()
// }
},
function(error) {
console.log('申请权限错误:' + error.code + " = " + error.message);
resolve({
code: error.code,
message: error.message
});
}
);
}); });
} }
// 使用一个方法,根据参数判断权限 // 使用一个方法,根据参数判断权限
function judgeIosPermission(permissionID) { function judgeIosPermission (permissionID) {
if (permissionID == "location") { if (permissionID == "location") {
return judgeIosPermissionLocation() return judgeIosPermissionLocation()
} else if (permissionID == "camera") { } else if (permissionID == "camera") {
...@@ -217,7 +246,7 @@ function judgeIosPermission(permissionID) { ...@@ -217,7 +246,7 @@ function judgeIosPermission(permissionID) {
} }
// 跳转到**应用**的权限页面 // 跳转到**应用**的权限页面
function gotoAppPermissionSetting() { function gotoAppPermissionSetting () {
if (isIos) { if (isIos) {
var UIApplication = plus.ios.import("UIApplication"); var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication(); var application2 = UIApplication.sharedApplication();
...@@ -245,7 +274,7 @@ function gotoAppPermissionSetting() { ...@@ -245,7 +274,7 @@ function gotoAppPermissionSetting() {
// 检查系统的设备服务是否开启 // 检查系统的设备服务是否开启
// var checkSystemEnableLocation = async function () { // var checkSystemEnableLocation = async function () {
function checkSystemEnableLocation() { function checkSystemEnableLocation () {
if (isIos) { if (isIos) {
var result = false; var result = false;
var cllocationManger = plus.ios.import("CLLocationManager"); var cllocationManger = plus.ios.import("CLLocationManager");
...@@ -269,4 +298,4 @@ module.exports = { ...@@ -269,4 +298,4 @@ module.exports = {
requestAndroidPermission: requestAndroidPermission, requestAndroidPermission: requestAndroidPermission,
checkSystemEnableLocation: checkSystemEnableLocation, checkSystemEnableLocation: checkSystemEnableLocation,
gotoAppPermissionSetting: gotoAppPermissionSetting gotoAppPermissionSetting: gotoAppPermissionSetting
} }
...@@ -56,7 +56,10 @@ ...@@ -56,7 +56,10 @@
], ],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"targetSdkVersion" : 30, "targetSdkVersion" : 30,
"minSdkVersion" : 21 "minSdkVersion" : 21,
"excludePermissions" : [
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>"
]
}, },
/* ios打包配置 */ /* ios打包配置 */
"ios" : { "ios" : {
...@@ -73,7 +76,8 @@ ...@@ -73,7 +76,8 @@
"appkey_ios" : "", "appkey_ios" : "",
"appkey_android" : "rfN7u5gCi0KyCGIWWBYGXlmKrVQsKH8z" "appkey_android" : "rfN7u5gCi0KyCGIWWBYGXlmKrVQsKH8z"
} }
} },
"maps" : {}
}, },
"icons" : { "icons" : {
"android" : { "android" : {
......
...@@ -195,6 +195,7 @@ export default { ...@@ -195,6 +195,7 @@ export default {
this.$refs.home.updateApp(true) this.$refs.home.updateApp(true)
}, },
async onShow () { async onShow () {
this.getActivityMessage()
const userInfo = uni.$storage.get("userInfo") const userInfo = uni.$storage.get("userInfo")
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) { if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm("userInfo"); uni.$storage.rm("userInfo");
...@@ -210,6 +211,10 @@ export default { ...@@ -210,6 +211,10 @@ export default {
computed: { computed: {
}, },
methods: { methods: {
getActivityMessage () {
if (this.$refs.home) this.$refs.home.getActivityMessage()
else setTimeout(this.getActivityMessage, 200)
},
...mapMutations("audio", ["setReceptionStatus"]), ...mapMutations("audio", ["setReceptionStatus"]),
init () { init () {
const userInfo = uni.$storage.get("userInfo"), const userInfo = uni.$storage.get("userInfo"),
......
<template> <template>
<view class="layout"> <view class="layout">
<view class="bg"></view> <view class="bg"></view>
<view class="login"> <view class="login">
<view class="title">登录</view> <view class="title">登录</view>
<view class="sub-title">手机号码登录</view> <view class="sub-title">手机号码登录</view>
<view class="input"> <view class="input">
<input <input
type="tel" type="tel"
:value="mobile" :value="mobile"
placeholder="请输入手机号" placeholder="请输入手机号"
maxlength="11" maxlength="11"
@blur="input($event, 'mobile')" @blur="input($event, 'mobile')"
:key="dateKey.mobile" :key="dateKey.mobile"
auto-blur auto-blur
/> />
<template v-if="mobile"> <template v-if="mobile">
<view <view
class="icon" class="icon"
@click="mobile = ''" @click="mobile = ''"
> >
<icon <icon
type="clear" type="clear"
size="16" size="16"
color="#000" color="#000"
></icon> ></icon>
</view> </view>
</template> </template>
</view> </view>
<view class="input"> <view class="input">
<input <input
type="number" type="number"
:value="code" :value="code"
placeholder="请输入验证码" placeholder="请输入验证码"
maxlength="4" maxlength="4"
@blur="input($event, 'code')" @blur="input($event, 'code')"
:key="dateKey.code" :key="dateKey.code"
auto-blur auto-blur
/> />
<template v-if="code"> <template v-if="code">
<view <view
class="icon" class="icon"
@click="code = ''" @click="code = ''"
> >
<icon <icon
type="clear" type="clear"
size="16" size="16"
color="#000" color="#000"
></icon> ></icon>
</view> </view>
</template> </template>
<view <view
:class="['code-btn', `${count ? 'code-disabled' : ''}`]" :class="['code-btn', `${count ? 'code-disabled' : ''}`]"
@click="getSmsCode" @click="getSmsCode"
>{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view> >{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view>
</view> </view>
<button <button
class="btn" class="btn"
@click="login" @click="login"
>登录</button> >登录</button>
<view class="form-footer"> <view class="form-footer">
<view <view
class="autoLogin" class="autoLogin"
@click="readingStatus = !readingStatus" @click="readingStatus = !readingStatus"
> >
<uni-icons <uni-icons
:type="`${readingStatus ? 'checkbox-filled' : 'circle'}`" :type="`${readingStatus ? 'checkbox-filled' : 'circle'}`"
:size="18" :size="18"
:color="`${readingStatus ? '#2C66F7' : '#858A94'}`" :color="`${readingStatus ? '#2C66F7' : '#858A94'}`"
></uni-icons> ></uni-icons>
我已阅读并同意 我已阅读并同意
<text @click.stop="jumpUrl()">《用户隐私协议》</text> <text @click.stop="jumpUrl()">《隐私协议》</text>
</view> </view>
<view <view
class="autoLogin" class="autoLogin"
@click="noSignIn = !noSignIn" @click="noSignIn = !noSignIn"
> >
<uni-icons <uni-icons
:type="`${noSignIn ? 'checkbox-filled' : 'circle'}`" :type="`${noSignIn ? 'checkbox-filled' : 'circle'}`"
:size="18" :size="18"
:color="`${noSignIn ? '#2C66F7' : '#858A94'}`" :color="`${noSignIn ? '#2C66F7' : '#858A94'}`"
></uni-icons> ></uni-icons>
30天内免登录 30天内免登录
</view> </view>
</view> </view>
</view> </view>
<view class="app-code flex"> <view class="app-code flex">
APP编码:{{ deviceId }} APP编码:{{ deviceId }}
<view <view
class="sprite-icon icon-clone" class="sprite-icon icon-clone"
@click="copyText" @click="copyText"
></view> ></view>
</view> </view>
<update-box /> <update-box />
</view> </view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/;
import { Request } from 'glsk-toolkit' import { Request } from 'glsk-toolkit'
export default { export default {
data () { data () {
return { return {
mobile: '', mobile: '',
code: '', code: '',
count: '', count: '',
noSignIn: true, noSignIn: true,
readingStatus: true, readingStatus: false,
dateKey: { dateKey: {
mobile: 0, mobile: 0,
code: 0 code: 0
} }
}; };
}, },
watch: { watch: {
code: { code: {
handler (val) { handler (val) {
this.autoLoginByMobile() this.autoLoginByMobile()
}, },
immediate: true, immediate: true,
deep: true deep: true
}, },
mobile: { mobile: {
handler (val) { handler (val) {
this.autoLoginByMobile() this.autoLoginByMobile()
}, },
immediate: true, immediate: true,
deep: true deep: true
} }
}, },
onLoad (options) { onLoad (options) {
uni.$signHttp = new Request(uni.signHttpConfig) //重新登录重置请求参数 uni.$signHttp = new Request(uni.signHttpConfig) //重新登录重置请求参数
if (options.mobile) this.mobile = options.mobile if (options.mobile) this.mobile = options.mobile
const noSignInUuid = uni.$storage.get('noSignInUuid') const noSignInUuid = uni.$storage.get('noSignInUuid')
if (noSignInUuid) this.autoLogin(noSignInUuid) if (noSignInUuid) this.autoLogin(noSignInUuid)
const { const {
deviceId deviceId
} = uni.getDeviceInfo() } = uni.getDeviceInfo()
this.deviceId = deviceId this.deviceId = deviceId
}, },
methods: { methods: {
autoLoginByMobile () { autoLoginByMobile () {
let { mobile, code } = this let { mobile, code } = this
if (code && mobile && code.length == 4 && phoneRex.test(mobile)) this.login() if (code && mobile && code.length == 4 && phoneRex.test(mobile)) this.login()
}, },
copyText () { copyText () {
uni.setClipboardData({ uni.setClipboardData({
data: this.deviceId, data: this.deviceId,
success: function () { success: function () {
uni.showToast({ uni.showToast({
title: '复制成功', title: '复制成功',
icon: 'success' icon: 'success'
}); });
} }
}); });
}, },
async autoLogin (noSignInUuid) { async autoLogin (noSignInUuid) {
uni.showLoading({ uni.showLoading({
mask: true mask: true
}); });
const { data } = await uni.$api.userApi.autoLogin({ noSignInUuid }) const { data } = await uni.$api.userApi.autoLogin({ noSignInUuid })
uni.hideLoading(); uni.hideLoading();
if (data) this.jump(data, true) if (data) this.jump(data, true)
}, },
/**获取验证码 */ /**获取验证码 */
async getSmsCode () { async getSmsCode () {
const { mobile, count } = this; const { mobile, count } = this;
try { try {
if (!mobile) throw '请输入手机号'; if (!mobile) throw '请输入手机号';
if (!phoneRex.test(mobile)) throw '请输入正确的手机号'; if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (count) throw '验证码发送过于频繁,请稍后再试'; if (count) throw '验证码发送过于频繁,请稍后再试';
uni.showLoading({ uni.showLoading({
mask: true mask: true
}); });
const { code, message } = await uni.$api.userApi.getSmsCode({ mobile }); const { code, message } = await uni.$api.userApi.getSmsCode({ mobile });
uni.hideLoading(); uni.hideLoading();
if (code == '0') { if (code == '0') {
uni.$logger.local.info(`${mobile}发送验证码成功`) uni.$logger.local.info(`${mobile}发送验证码成功`)
uni.showToast({ uni.showToast({
title: '验证码已发送', title: '验证码已发送',
icon: 'none', icon: 'none',
}); });
this.countDown(60); this.countDown(60);
} else throw message || '发送验证码失败'; } else throw message || '发送验证码失败';
} catch (error) { } catch (error) {
uni.$logger.local.info(`${mobile}发送验证码失败,失败原因:${error}`) uni.$logger.local.info(`${mobile}发送验证码失败,失败原因:${error}`)
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: error, title: error,
icon: 'none', icon: 'none',
}); });
} }
}, },
/**验证码倒计时 */ /**验证码倒计时 */
countDown (countDown) { countDown (countDown) {
if (countDown) this.count = countDown; if (countDown) this.count = countDown;
setTimeout(() => { setTimeout(() => {
let { count } = this; let { count } = this;
this.count = --count; this.count = --count;
if (count > 0) this.countDown(); if (count > 0) this.countDown();
else this.count = null; else this.count = null;
}, 1e3); }, 1e3);
}, },
login: uni.$throttle(async function () { login: uni.$throttle(async function () {
const { mobile, code: smsCode, noSignIn, readingStatus } = this; const { mobile, code: smsCode, noSignIn, readingStatus } = this;
try { try {
if (!mobile) throw '请输入手机号' if (!mobile) throw '请输入手机号'
if (!phoneRex.test(mobile)) throw '请输入正确的手机号'; if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (!smsCode) throw '请输入验证码' if (!smsCode) throw '请输入验证码'
if (!readingStatus) throw '请阅读用户隐私协议' if (!readingStatus) throw '请您阅读并同意《隐私协议》'
let params = { let params = {
mobile, mobile,
code: smsCode code: smsCode
} }
if (noSignIn) params.noSignIn = noSignIn if (noSignIn) params.noSignIn = noSignIn
uni.showLoading({ uni.showLoading({
mask: true mask: true
}); });
const { code, data, message } = await uni.$api.userApi.smsLogin(params); const { code, data, message } = await uni.$api.userApi.smsLogin(params);
console.log(code, data, message); console.log(code, data, message);
uni.hideLoading(); uni.hideLoading();
if (code == 0) { if (code == 0) {
this.jump(data, noSignIn); this.jump(data, noSignIn);
uni.$logger.local.info(`${mobile}登录`) uni.$logger.local.info(`${mobile}登录`)
} }
else { else {
uni.showModal({ uni.showModal({
title: '温馨提示', title: '温馨提示',
content: message, content: message,
showCancel: false, showCancel: false,
confirmText: '知道了', confirmText: '知道了',
confirmColor: '#347BFF', confirmColor: '#347BFF',
}); });
uni.$logger.local.info(`${mobile}登录失败,失败原因:${message}`) uni.$logger.local.info(`${mobile}登录失败,失败原因:${message}`)
} }
} catch (error) { } catch (error) {
uni.$logger.local.info(`${mobile}登录失败,失败原因:${error}`) uni.$logger.local.info(`${mobile}登录失败,失败原因:${error}`)
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: error, title: error,
icon: 'none', icon: 'none',
}); });
} }
}, 200), }, 200),
// 获取登录账号下园区店列表 // 获取登录账号下园区店列表
getAccountLoginList (loginUserInfoList) { getAccountLoginList (loginUserInfoList) {
let stepIndex = loginUserInfoList?.length == 1 ? 1 : 0 let stepIndex = loginUserInfoList?.length == 1 ? 1 : 0
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/accountItems?stepIndex=${stepIndex}` url: `/pages/common/accountItems?stepIndex=${stepIndex}`
}) })
}, },
jumpUrl () { jumpUrl () {
let url = 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html' let url = 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/webview?url=${url}` url: `/pages/common/webview?url=${url}`
}) })
}, },
jump (data, noSignIn) { jump (data, noSignIn) {
let { let {
loginUserInfoList, loginUserInfoList,
noSignInUuid, noSignInUuid,
sessionId, sessionId,
} = data; } = data;
if (loginUserInfoList.length) { if (loginUserInfoList.length) {
uni.$storage.set('sessionId', sessionId); uni.$storage.set('sessionId', sessionId);
if (noSignInUuid && noSignIn) uni.$storage.set('noSignInUuid', noSignInUuid) if (noSignInUuid && noSignIn) uni.$storage.set('noSignInUuid', noSignInUuid)
this.getAccountLoginList(loginUserInfoList) this.getAccountLoginList(loginUserInfoList)
} else uni.reLaunch({ } else uni.reLaunch({
url: '/pages/common/nothing' url: '/pages/common/nothing'
}); });
}, },
input (e, key) { input (e, key) {
setTimeout(() => { setTimeout(() => {
let { value } = e.detail, let { value } = e.detail,
numbers = value.match(/\d+/g) numbers = value.match(/\d+/g)
console.log(numbers) console.log(numbers)
this[key] = numbers ? numbers.join('') : '' this[key] = numbers ? numbers.join('') : ''
this.dateKey[key] = Date.now() this.dateKey[key] = Date.now()
}, 0) }, 0)
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg { .bg {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100%;
left: 0; left: 0;
top: 0; top: 0;
background-image: url('../../assets/images/login/bg.webp'); background-image: url('../../assets/images/login/bg.webp');
background-size: 100% 100%; background-size: 100% 100%;
} }
.login { .login {
position: fixed; position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
.title { .title {
font-weight: 600; font-weight: 600;
font-size: toRpx(96); font-size: toRpx(96);
color: #333333; color: #333333;
text-align: center; text-align: center;
} }
.sub-title { .sub-title {
font-weight: 500; font-weight: 500;
font-size: toRpx(32); font-size: toRpx(32);
color: #1a1a1a; color: #1a1a1a;
margin: toRpx(46) 0; margin: toRpx(46) 0;
} }
.input { .input {
width: toRpx(800); width: toRpx(800);
height: toRpx(112); height: toRpx(112);
background: #f7f8fa; background: #f7f8fa;
border-radius: toRpx(56); border-radius: toRpx(56);
margin-bottom: toRpx(40); margin-bottom: toRpx(40);
box-sizing: border-box; box-sizing: border-box;
padding-left: toRpx(40); padding-left: toRpx(40);
display: flex; display: flex;
align-items: center; align-items: center;
input { input {
height: 100%; height: 100%;
flex: 1; flex: 1;
font-size: toRpx(32) !important; font-size: toRpx(32) !important;
} }
.icon { .icon {
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 toRpx(40); padding: 0 toRpx(40);
height: 100%; height: 100%;
} }
.code-btn { .code-btn {
font-weight: 500; font-weight: 500;
font-size: toRpx(32); font-size: toRpx(32);
color: #2c66f7; color: #2c66f7;
flex-shrink: 0; flex-shrink: 0;
border: none; border: none;
margin-right: toRpx(40); margin-right: toRpx(40);
} }
.code-disabled { .code-disabled {
color: #9b9b9e; color: #9b9b9e;
} }
} }
.btn { .btn {
width: toRpx(800); width: toRpx(800);
height: toRpx(112); height: toRpx(112);
background-image: linear-gradient(90deg, #48a6ff 0%, #2c66f7 100%); background-image: linear-gradient(90deg, #48a6ff 0%, #2c66f7 100%);
border-radius: toRpx(56); border-radius: toRpx(56);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-weight: 600; font-weight: 600;
font-size: toRpx(40); font-size: toRpx(40);
color: #ffffff; color: #ffffff;
} }
.btn[disabled]:not([type]), .btn[disabled]:not([type]),
.btn[disabled][type='default'] { .btn[disabled][type='default'] {
background: #c9c9c9 !important; background: #c9c9c9 !important;
} }
.form-footer { .form-footer {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: toRpx(40); margin-top: toRpx(40);
flex-direction: column; flex-direction: column;
gap: toRpx(38) 0; gap: toRpx(38) 0;
padding-left: toRpx(142); padding-left: toRpx(142);
.autoLogin { .autoLogin {
display: flex; display: flex;
align-items: center; align-items: center;
margin-right: toRpx(20); margin-right: toRpx(20);
.uni-icons { .uni-icons {
margin-right: toRpx(8); margin-right: toRpx(8);
// margin-left: toRpx(142); // margin-left: toRpx(142);
} }
text { text {
color: #2c66f7; color: #2c66f7;
} }
} }
} }
} }
.app-code { .app-code {
position: fixed; position: fixed;
bottom: toRpx(20); bottom: toRpx(20);
left: 50%; left: 50%;
transform: translate(-50%); transform: translate(-50%);
font-size: toRpx(24); font-size: toRpx(24);
color: #999999; color: #999999;
line-height: toRpx(40); line-height: toRpx(40);
.icon-clone { .icon-clone {
width: toRpx(24); width: toRpx(24);
height: toRpx(24); height: toRpx(24);
margin-left: toRpx(20); margin-left: toRpx(20);
} }
} }
</style> </style>
<template> <template>
<view> <view>
<home-frame <home-frame
@preview="preview" @preview="preview"
@start="start" @start="start"
ref="home" ref="home"
:id="id" :id="id"
@openStep="openStep" @openStep="openStep"
@backHome="backHome" @backHome="backHome"
@changeTab="changeTab" @changeTab="changeTab"
:moduleList="moduleList" :moduleList="moduleList"
@swiperClick="toDetail" @swiperClick="toDetail"
:loadComplete="loadComplete" :loadComplete="loadComplete"
> >
<template slot="detail"> <template slot="detail">
<detail <detail
:id.sync="id" :id.sync="id"
:media="moduleList" :media="moduleList"
:type.sync="type" :type.sync="type"
:toolList="toolList" :toolList="toolList"
:aitoCarModelIds="aitoCarModelIds" :aitoCarModelIds="aitoCarModelIds"
@back="back" @back="back"
@done="done" @done="done"
ref="detail" ref="detail"
:mediaId="mediaId" :mediaId="mediaId"
/> />
</template> </template>
<template slot="content"> <template slot="content">
<!-- <novice-guide <!-- <novice-guide
@nextStep="nextStep" @nextStep="nextStep"
@back="back" @back="back"
/> --> /> -->
</template> </template>
</home-frame> </home-frame>
</view> </view>
</template> </template>
<script> <script>
import detail from './detail/detail' import detail from './detail/detail'
import { mapMutations } from 'vuex' import { mapMutations } from 'vuex'
import NoviceGuide from '@/components/NoviceGuide.vue' import NoviceGuide from '@/components/NoviceGuide.vue'
import HomeFrame from '@/components/HomeFrame/index.vue' import HomeFrame from '@/components/HomeFrame/index.vue'
// import storge from "@/mixin/storge"; // import storge from "@/mixin/storge";
export default { export default {
// mixins: [storge], // mixins: [storge],
components: { HomeFrame, detail, NoviceGuide }, components: { HomeFrame, detail, NoviceGuide },
data () { data () {
return { return {
moduleList: [], moduleList: [],
toolList: [], toolList: [],
id: '', id: '',
type: '', type: '',
chooseItem: {}, chooseItem: {},
recording: false, recording: false,
aitoCarModelIds: [], aitoCarModelIds: [],
mediaId: '', mediaId: '',
loadComplete: false, loadComplete: false,
requested: false requested: false
} }
}, },
computed: { computed: {
channelType () { channelType () {
const { channelType } = uni.$storage.get('userInfo') const { channelType } = uni.$storage.get('userInfo')
return channelType || 1 //默认问界 return channelType || 1 //默认问界
}, },
shopMerchantId () { shopMerchantId () {
const { shopMerchantId } = uni.$storage.get('userInfo') const { shopMerchantId } = uni.$storage.get('userInfo')
return shopMerchantId return shopMerchantId
}, },
sceneType () { sceneType () {
const { sceneType } = uni.$storage.get('userInfo') const { sceneType } = uni.$storage.get('userInfo')
return sceneType return sceneType
} }
}, },
onBackPress (options) { onBackPress (options) {
if (options.from === 'backbutton') { if (options.from === 'backbutton') {
// 物理返回按钮触发 // 物理返回按钮触发
// 阻止默认行为,即不执行页面返回 // 阻止默认行为,即不执行页面返回
this.back() this.back()
return true return true
} }
// 其他情况允许正常返回 // 其他情况允许正常返回
return false return false
}, },
async onLoad () { async onLoad () {
uni.hideLoading() uni.hideLoading()
const mockdata = await uni.$api.systemApi.getMockData(true) //获取APP配置信息 const mockdata = await uni.$api.systemApi.getMockData(true) //获取APP配置信息
if (this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) { if (this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) {
this.$store.state.user.boutiqueDefaultCarBrandId = mockdata.boutiqueDefaultCarBrandId //默认车辆品牌 this.$store.state.user.boutiqueDefaultCarBrandId = mockdata.boutiqueDefaultCarBrandId //默认车辆品牌
if (mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系 if (mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系
} }
this.get_Vehicle_Sales_Data() this.get_Vehicle_Sales_Data()
this.requested = true this.requested = true
this.$refs.home.updateApp(true) this.$refs.home.updateApp(true)
}, },
async onShow () { async onShow () {
const userInfo = uni.$storage.get('userInfo') this.getActivityMessage()
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) { const userInfo = uni.$storage.get('userInfo')
uni.$storage.rm('userInfo') if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm('sessionId') uni.$storage.rm('userInfo')
uni.reLaunch({ uni.$storage.rm('sessionId')
url: '/pages/common/login' uni.reLaunch({
}) url: '/pages/common/login'
return })
} return
this.init() }
}, this.init()
methods: { },
...mapMutations('audio', ['setReceptionStatus']), methods: {
init () { getActivityMessage () {
this.findPayInfo() if (this.$refs.home) this.$refs.home.getActivityMessage()
if (this.requested && !this.id) this.$refs.home.updateApp() else setTimeout(this.getActivityMessage, 200)
}, },
/**获取车型&销售数据 */ ...mapMutations('audio', ['setReceptionStatus']),
get_Vehicle_Sales_Data () { init () {
const userInfo = uni.$storage.get('userInfo'), this.findPayInfo()
storageCarBrandList = uni.$storage.get('carBrandList'), if (this.requested && !this.id) this.$refs.home.updateApp()
storageEmployeeList = uni.$storage.get('employeeList'), },
{ shopMerchantId } = userInfo /**获取车型&销售数据 */
if (storageCarBrandList) this.$store.dispatch('setCarBrandsList', storageCarBrandList) get_Vehicle_Sales_Data () {
if (storageEmployeeList) this.$store.dispatch('setEmployeeList', storageEmployeeList) const userInfo = uni.$storage.get('userInfo'),
/**获取品牌车型 */ storageCarBrandList = uni.$storage.get('carBrandList'),
uni.$api.commonApi.getMerchantCarBrandList([shopMerchantId]).then(({ data }) => { storageEmployeeList = uni.$storage.get('employeeList'),
let list = data[0].carBrandList, { shopMerchantId } = userInfo
carBrandList = [], if (storageCarBrandList) this.$store.dispatch('setCarBrandsList', storageCarBrandList)
brandIdList = [], if (storageEmployeeList) this.$store.dispatch('setEmployeeList', storageEmployeeList)
subBrandIdList = [] /**获取品牌车型 */
list?.map(e => { uni.$api.commonApi.getMerchantCarBrandList([shopMerchantId]).then(({ data }) => {
e.childs.map(i => { let list = data[0].carBrandList,
i.brandName = e.name carBrandList = [],
i.brandId = e.id brandIdList = [],
carBrandList.push(i) subBrandIdList = []
subBrandIdList.push(i.id) list?.map(e => {
}) e.childs.map(i => {
brandIdList.push(e.id) i.brandName = e.name
}) i.brandId = e.id
this.getSoure(brandIdList, subBrandIdList) carBrandList.push(i)
this.$store.dispatch('setCarBrandsList', carBrandList) subBrandIdList.push(i.id)
uni.$storage.set('carBrandList', carBrandList) })
if (carBrandList.length) { brandIdList.push(e.id)
let index = 0 })
this.getCarBrandsList(carBrandList, index) this.getSoure(brandIdList, subBrandIdList)
this.$store.dispatch('setCarBrandsList', carBrandList)
} uni.$storage.set('carBrandList', carBrandList)
}) if (carBrandList.length) {
/**获取销售人员 */ let index = 0
uni.$api.commonApi.getEmployeeList({ this.getCarBrandsList(carBrandList, index)
merchantId: shopMerchantId
}).then(res => { }
this.$store.dispatch('setEmployeeList', res || []) })
uni.$storage.set('employeeList', res || []) /**获取销售人员 */
}) uni.$api.commonApi.getEmployeeList({
}, merchantId: shopMerchantId
// 查询素材 }).then(res => {
async getSoure (brandIdList, subBrandIdList) { this.$store.dispatch('setEmployeeList', res || [])
const { shopMerchantId, sceneType } = this uni.$storage.set('employeeList', res || [])
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`) })
if (data) this.setViewInfo(data) },
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, { // 查询素材
brandIdList, async getSoure (brandIdList, subBrandIdList) {
subBrandIdList const { shopMerchantId, sceneType } = this
}) let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (requestData) this.setViewInfo(requestData) if (data) this.setViewInfo(data)
else this.loadComplete = true let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, {
}, brandIdList,
errorImg (index) { subBrandIdList
this.moduleList[index].showAlt = true })
}, if (requestData) this.setViewInfo(requestData)
else this.loadComplete = true
async start () { },
if (!this.moduleList.length) return uni.showToast({ errorImg (index) {
title: '该场景尚未配置素材,请联系总部人员', this.moduleList[index].showAlt = true
icon: 'none' },
})
const isPermision = await this.$refs.home.isPermission() async start () {
if (this.recording || !isPermision) return if (!this.moduleList.length) return uni.showToast({
uni.showLoading({ title: '该场景尚未配置素材,请联系总部人员',
mask: true icon: 'none'
}) })
this.$refs.home.startAudio() const isPermision = await this.$refs.home.isPermission()
this.clearHistory() if (this.recording || !isPermision) return
this.id = this.moduleList[0].id uni.showLoading({
this.type = 'edit' mask: true
this.recording = true })
setTimeout(() => { this.$refs.home.startAudio()
uni.hideLoading() this.clearHistory()
}, 1e3) this.id = this.moduleList[0].id
}, this.type = 'edit'
toDetail (index) { this.recording = true
let item = this.moduleList[index] setTimeout(() => {
this.chooseItem = item uni.hideLoading()
this.$refs.home.previewRef.open() }, 1e3)
}, },
cancel () { toDetail (index) {
this.$refs.home.previewRef.close() let item = this.moduleList[index]
}, this.chooseItem = item
preview () { this.$refs.home.previewRef.open()
let { id, title } = this.chooseItem },
this.type = 'preview' cancel () {
this.id = id this.$refs.home.previewRef.close()
uni.$logger.local.info(`预览${title}`) },
this.cancel() preview () {
}, let { id, title } = this.chooseItem
// 完成接待 this.type = 'preview'
done (e) { this.id = id
this.$refs.home.finishRef.close() uni.$logger.local.info(`预览${title}`)
if (this.recording) this.$refs.home.stopAudio() this.cancel()
this.recording = false },
setTimeout(() => { // 完成接待
this.id = '' done (e) {
this.type = '' this.$refs.home.finishRef.close()
this.setReceptionStatus(e) if (this.recording) this.$refs.home.stopAudio()
this.$store.dispatch('clearHistory') this.recording = false
this.$store.dispatch('clearReceptionTrack') setTimeout(() => {
}, 1500) this.id = ''
}, this.type = ''
back () { this.setReceptionStatus(e)
const detailRef = this.$refs.detail this.$store.dispatch('clearHistory')
if (detailRef.showPayPage) return (detailRef.showPayPage = false) this.$store.dispatch('clearReceptionTrack')
if (!this.id) return uni.navigateBack() }, 1500)
if (this.type != 'preview') return this.$refs.home.finishRef.open() },
this.backHome() back () {
}, const detailRef = this.$refs.detail
backHome () { if (detailRef.showPayPage) return (detailRef.showPayPage = false)
if (this.recording) this.$refs.home.stopAudio(true) if (!this.id) return uni.navigateBack()
this.$refs.home.finishRef.close() if (this.type != 'preview') return this.$refs.home.finishRef.open()
this.id = '' this.backHome()
this.type = '' },
this.clearHistory() backHome () {
this.init() if (this.recording) this.$refs.home.stopAudio(true)
this.recording = false this.$refs.home.finishRef.close()
this.$refs.home.$refs.leftBox.getMessageInfo() this.id = ''
}, this.type = ''
nextStep () { this.clearHistory()
let { id } = this.moduleList[0] this.init()
this.type = 'preview' this.recording = false
this.id = id this.$refs.home.$refs.leftBox.getMessageInfo()
}, },
clearHistory () { nextStep () {
this.$store.dispatch('clearCustomerInfo') let { id } = this.moduleList[0]
this.$store.dispatch('clearHistory') this.type = 'preview'
this.$refs.home.setBooks([]) this.id = id
this.$store.dispatch('clearReceptionTrack') },
}, clearHistory () {
openStep () { this.$store.dispatch('clearCustomerInfo')
this.$refs.home.finishRef.close() this.$store.dispatch('clearHistory')
this.$refs.detail.open() this.$refs.home.setBooks([])
}, this.$store.dispatch('clearReceptionTrack')
// 查询门店支付配置 },
async findPayInfo () { openStep () {
const { shopMerchantId } = uni.$storage.get('userInfo') this.$refs.home.finishRef.close()
const data = await uni.$api.commonApi.findPayInfo({ this.$refs.detail.open()
merchantId: shopMerchantId },
}) // 查询门店支付配置
let paymentType = [] async findPayInfo () {
data.find(item => { const { shopMerchantId } = uni.$storage.get('userInfo')
if (item.paymentType == 1) const data = await uni.$api.commonApi.findPayInfo({
paymentType.push({ merchantId: shopMerchantId
name: '扫码支付', })
type: 1, let paymentType = []
title: '付款二维码', data.find(item => {
...item if (item.paymentType == 1)
}) paymentType.push({
if (item.paymentType == 2) name: '扫码支付',
paymentType.push({ type: 1,
name: '对公账户', title: '付款二维码',
type: 2, ...item
title: '付款方式', })
...item if (item.paymentType == 2)
}) paymentType.push({
}) name: '对公账户',
this.$store.dispatch('setPaymentType', paymentType) type: 2,
}, title: '付款方式',
changeTab (index) { ...item
if (index == 0) this.init() })
}, })
this.$store.dispatch('setPaymentType', paymentType)
/**按序加载车型 */ },
async getCarBrandsList (carBrandList, index) { changeTab (index) {
const item = carBrandList[index] if (index == 0) this.init()
if (!item) return },
const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
if (index < carBrandList.length - 1) { /**按序加载车型 */
index += 1 async getCarBrandsList (carBrandList, index) {
if (!carList) { const item = carBrandList[index]
const list = await uni.$api.commonApi.getCarBrandsList({ if (!item) return
brandId: item.brandId, const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
childBrandId: item.id if (index < carBrandList.length - 1) {
}) index += 1
if (list) uni.setStorageSync(`${item.id}_${item.brandId}_carlist`, list) if (!carList) {
this.getCarBrandsList(carBrandList, ++index) const list = await uni.$api.commonApi.getCarBrandsList({
} else this.getCarBrandsList(carBrandList, ++index) brandId: item.brandId,
} childBrandId: item.id
}, })
/**素材内容 */ if (list) uni.setStorageSync(`${item.id}_${item.brandId}_carlist`, list)
setViewInfo (data) { this.getCarBrandsList(carBrandList, ++index)
let { moduleList, toolList, id } = data } else this.getCarBrandsList(carBrandList, ++index)
this.moduleList = moduleList }
this.toolList = toolList },
this.mediaId = id /**素材内容 */
this.loadComplete = true setViewInfo (data) {
this.$store.state.user = { let { moduleList, toolList, id } = data
...this.$store.state.user, this.moduleList = moduleList
...data this.toolList = toolList
} this.mediaId = id
} this.loadComplete = true
} this.$store.state.user = {
} ...this.$store.state.user,
</script> ...data
<style scoped lang="scss"> }
.webview-container { }
width: toRpx(100); }
height: toRpx(100); }
position: absolute; </script>
width: 100%; <style scoped lang="scss">
height: 100%; .webview-container {
top: 0; width: toRpx(100);
left: 0; height: toRpx(100);
transform: translateY(300%); position: absolute;
} width: 100%;
</style> height: 100%;
top: 0;
left: 0;
transform: translateY(300%);
}
</style>
export default { export default {
token: (state) => state.user.token, token: (state) => state.user.token,
siteData: (state) => state.site.siteData, siteData: (state) => state.site.siteData,
userData: (state) => state.user.userData, userData: (state) => state.user.userData,
userId: (state) => state.user.userData.id, userId: (state) => state.user.userData.id,
isInBackgound: (state) => state.sys.isInBackgound, isInBackgound: (state) => state.sys.isInBackgound,
customerInfo: (state) => state.user.customerInfo, customerInfo: (state) => state.user.customerInfo,
receptionTrack: (state) => state.user.receptionTrack, receptionTrack: (state) => state.user.receptionTrack,
receptionStatus: (state) => state.audio.receptionStatus, receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList, booksList: (state) => state.audio.booksList,
receptionKey: (state) => state.user.receptionKey, receptionKey: (state) => state.user.receptionKey,
customerKey: (state) => state.user.customerKey customerKey: (state) => state.user.customerKey,
}; indexMessagePopupStatus: (state) => state.sys.indexMessagePopupStatus,
};
export default { export default {
state() { state() {
return { return {
isInBackgound: false isInBackgound: false,
} indexMessagePopupStatus: true, // 首页弹窗状态
}, }
mutations: { },
SET_BACKGROUND_STATE(state, value) { mutations: {
state.isInBackgound = value SET_BACKGROUND_STATE(state, value) {
} state.isInBackgound = value
}, },
actions: { SET_INDEX_MESSAGE_POPUP_STATUS(state, value){
setBackgroundState({ commit }, value) { state.indexMessagePopupStatus = value
uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`) }
commit('SET_BACKGROUND_STATE', value) },
} actions: {
} setBackgroundState({ commit }, value) {
} uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`)
commit('SET_BACKGROUND_STATE', value)
},
setIndexMessagePopupStatus({ commit }, value){
commit('SET_INDEX_MESSAGE_POPUP_STATUS', value)
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!