Commit d4bbaf71 by 李伟康

```

feat(activity): 新增活动弹框功能

- 新增 getActivityMessagePopUpWindow 接口用于获取活动弹框
- 新增 updateActivityMessagePopUpWindow 接口用于更新活动弹框状态
- 创建 ActivityPopup.vue 组件实现活动弹框展示功能
- 支持两种活动类型(获奖名单和销售竞赛)的弹框展示
- 实现弹框状态更新和跳转活动中心功能

style(leftSide): 优化组件代码格式

- 调整模板语法格式,统一使用属性绑定格式
- 修正函数声明格式,统一使用箭头函数写法
- 优化代码可读性和规范性

feat(setting): 新增账号注销功能

- 在设置弹框中新增注销按钮
- 实现账号注销确认弹窗功能
- 更新隐私协议链接文案为《隐私协议》
- 保持原有退出和切换账号功能不变
```
1 parent 1c2f6af7
import http from '../request/http'
module.exports = {
/**活动列表 */
activityPage(data) {
return http.post({
method: 'risk.manage.api.activity.pad.page',
projectName: 'pad',
...data
})
},
/**荣誉墙 */
activityReward(data) {
return http.post({
method: 'risk.manage.api.activity.reward',
projectName: 'pad',
...data
})
}
}
import http from '../request/http'
module.exports = {
/**活动列表 */
activityPage(data) {
return http.post({
method: 'risk.manage.api.activity.pad.page',
projectName: 'pad',
...data
})
},
/**荣誉墙 */
activityReward(data) {
return http.post({
method: 'risk.manage.api.activity.reward',
projectName: 'pad',
...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
})
},
}
<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>
<view class="left-side">
<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-name">
<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 :class="['left-tabs', { three: tabs.length == 3 }]">
<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="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view>
</view>
{{ i.label }}
<view class="dot" v-if="i.icon == 'record' && perRecordNumber"></view>
<view class="tip-box" v-if="i.icon == 'study' && readCount">待办事项:{{ readCount }}</view>
<view
class="dot"
v-if="i.icon == 'record' && perRecordNumber"
></view>
<view
class="tip-box"
v-if="i.icon == 'study' && readCount"
>待办事项:{{ readCount }}</view>
</view>
</template>
</view>
......@@ -32,19 +49,40 @@
v-if="messageTotal > 0"
></view>
</view> -->
<view class="btn" @click="openScenePopup">
<view
class="btn"
@click="openScenePopup"
>
<view class="sprite-icon icon-scene-change"></view>
</view>
<view class="btn" @click="handleSetting">
<view
class="btn"
@click="handleSetting"
>
<view class="sprite-icon icon-setting"></view>
</view>
</view>
<!-- 客服弹框 -->
<!-- <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')" />
<center-popup :list="sceneTypeList" ref="sceneTypeRef" @choose="chooseSceneType" title="选择场景" tag="当前场景" :id="userInfo.sceneType" isLine />
<setting-box
ref="settingRef"
@stopAudio="$emit('stopAudio')"
/>
<center-popup
:list="sceneTypeList"
ref="sceneTypeRef"
@choose="chooseSceneType"
title="选择场景"
tag="当前场景"
:id="userInfo.sceneType"
isLine
/>
</view>
</template>
......@@ -61,7 +99,7 @@ export default {
userInfo: Object
},
name: '',
data() {
data () {
return {
messageData: {
classCountList: [],
......@@ -80,7 +118,7 @@ export default {
}
},
watch: {
userInfo(n) {
userInfo (n) {
console.log('userInfo', n)
if (n.shopMerchantId) this.haveCustomerAccess(n)
},
......@@ -92,10 +130,10 @@ export default {
// }
},
computed: {
perRecordNumber() {
perRecordNumber () {
return this.$store.state.audio.perRecordNumber
},
sceneTypeList() {
sceneTypeList () {
const sceneTypeObject = {
1: {
title: '轻改',
......@@ -132,7 +170,7 @@ export default {
return result
},
// 这个tabs进来的值更新触发顺序是 getStudyCenterPermission的方法变更 => 计算属性的变更 => userInfo的监听变更 => haveCustomerAccess的变更。 计算属性的变更后的更新值是不会重新触发渲染的
tabs() {
tabs () {
const tabs = [
{
label: "首页",
......@@ -200,7 +238,7 @@ export default {
},
inject: ['showPage'],
methods: {
getUnreadCount() {
getUnreadCount () {
let _this = this
uni.$api.commonApi.getUnreadCount({}).then(res => {
this.readCount = res.data
......@@ -236,15 +274,15 @@ export default {
// this.leaveTrack()
// }, 5000)
// },
clickHome() {
clickHome () {
if (this.tabs[this.tabIndex].isTrack)
this.changeIndex(0, this.tabs[0])
},
handleSetting() {
handleSetting () {
this.$refs.settingRef.open()
this.clickHome()
},
findBeiSenSSOToken() {
findBeiSenSSOToken () {
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'
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
......@@ -254,7 +292,7 @@ export default {
})
})
},
handleActivityCenter() {
handleActivityCenter () {
console.log('ActivityCenter triggered'); // 添加日志查看触发次数
let { tabs } = this;
let index = tabs.findIndex(e => e.name == 'ActivityCenter');
......@@ -262,7 +300,7 @@ export default {
this.changeIndex(index, this.tabs[index]);
}
},
async changeIndex(index, item) {
async changeIndex (index, item) {
if (item.eventCode) uni.$track.add({
eventCode: item.eventCode
})
......@@ -283,13 +321,13 @@ export default {
this.findBeiSenSSOToken()
}
},
async haveCustomerAccess(val) {
async haveCustomerAccess (val) {
const { shopMerchantId, sceneType: scene } = val
uni.$api.customerApi.saleOpen({
merchantId: shopMerchantId,
scene
}).then(result => {
console.log('有客户权限',result)
console.log('有客户权限', result)
if (result) {
this.hasPerson = true
// this.activityTabVisible = scene !== 7
......@@ -325,7 +363,7 @@ export default {
})
},
// 获取话术未读列表
async getMessage() {
async getMessage () {
const { sceneType, uuid } = uni.$storage.get("userInfo")
let businessTypeList = []
if (sceneType == 0) {
......@@ -341,8 +379,9 @@ export default {
if (res.total) {
this.messageData = res
this.messageType = 'attendance'
this.$refs.kfRef.open()
this.openStudyPopup()
}
return Promise.resolve(res.total)
},
// 消息中心未读总数
// async getMessageCount () {
......@@ -354,7 +393,8 @@ export default {
// this.messageTotal = res
// },
// 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop() {
async getMessagePop () {
this.$store.dispatch('setIndexMessagePopupStatus', true)
const res = await uni.$api.commonApi.getMessagePop({})
if (res.ids && res.ids.length > 0) {
if (Array.isArray(res.moduleTypeList) && (res.moduleTypeList.includes(3) || res.moduleTypeList.includes(4))
......@@ -362,7 +402,7 @@ export default {
// 3, 4学习任务弹窗
this.messageType = 'study'
this.messageData = res
this.$refs.kfRef.open()
this.openStudyPopup()
// 确认消息
if (res.ids.length) {
uni.$api.commonApi.getStudyTaskConfirm({
......@@ -372,21 +412,25 @@ export default {
} else {
this.messageType = 'system'
this.messageData = res
this.$refs.kfRef.open()
this.openStudyPopup()
}
} 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({
url: `/pages/common/messageList`
})
},
getMessageInfo() {
getMessageInfo () {
this.getMessagePop()
},
jumpPersonCenter() {
jumpPersonCenter () {
if (this.hasPerson) {
uni.$track.add({
eventCode: 'app_personal_center'
......@@ -395,7 +439,7 @@ export default {
this.$emit('update:tabIndex', 99)
}
},
chooseSceneType(index) {
chooseSceneType (index) {
let { userInfo, sceneTypeList } = this,
sceneType = sceneTypeList[index].id
if (sceneType == userInfo.sceneType) return
......@@ -414,7 +458,7 @@ export default {
url
})
},
openScenePopup() {
openScenePopup () {
this.$refs.sceneTypeRef.open()
uni.$track.add({
eventCode: 'app_scene_change'
......@@ -424,12 +468,12 @@ export default {
getStudyCenterPermission () {
const userInfo = uni.$storage.get('userInfo')
const res = uni.$storage.get('studyCenterPermission')
if(!res){
uni.$api.commonApi.getStudyCenterPermission({}).then(res => {
uni.$storage.set('studyCenterPermission', res)
console.log(res,'res')
})
}
if (!res) {
uni.$api.commonApi.getStudyCenterPermission({}).then(res => {
uni.$storage.set('studyCenterPermission', res)
console.log(res, 'res')
})
}
if (userInfo.sceneType == 7) {
this.tabs[2].hidden = true
}
......@@ -440,11 +484,11 @@ export default {
}
}
},
beforeCreate() {
beforeCreate () {
// clearInterval(this.trackInterval)
// this.trackInterval = null
},
beforeDestroy() {
beforeDestroy () {
// uni.$off('pageBack')
// uni.$off('studyCenter')
uni.$off('ActivityCenter', this.handleActivityCenter);
......
<template>
<uni-popup ref="popup" border-radius="20px">
<view class="setting-box">
<view class="close flex" @click="close">
<uni-icons type="closeempty" :size="18" color="#1A1A1A"></uni-icons>
</view>
<view class="app-info flex">
<view class="sprite-icon icon-logo"></view>
展业助手
<view class="version">版本号:V{{ version }}</view>
<view class="check-box" @click="handleCheck">检查更新</view>
</view>
<view class="btn-box">
<view class="btn flex" @click="changeAccount">切换账号</view>
<view class="btn flex logout" @click="logout">退出</view>
</view>
<view class="a" @click="jump('agreement')">《用户隐私协议》</view>
<view class="icp flex" @click="jump('icp')">
ICP备案号:苏ICP备18023686号-2A
<view class="sprite-icon icon-arrow-right"></view>
</view>
<view class="app-code flex">
APP编码:{{ deviceId }}
<view class="sprite-icon icon-clone" @click="copyText"></view>
</view>
</view>
</uni-popup>
</template>
<script type="text/ecmascript-6">
import checkUpdate from "@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js";
import utils from '@/utils/utils'
export default {
name: 'SettingBox',
data() {
return {
version: '',
deviceId: ''
}
},
mounted() {
this.version = plus?.runtime?.version || '1.0.0'
const {
deviceId
} = uni.getDeviceInfo()
this.deviceId = deviceId
},
methods: {
copyText() {
uni.setClipboardData({
data: this.deviceId,
success: function() {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
},
async handleCheck() {
const {
textList,
tempFileURL,
version
} = uni.$storage.get('mock_data')
const res = utils.compareVersions(this.version,version)
if(res > -1) {
uni.showToast({
title: '目前已是最新版本',
duration: 2000,
icon: 'none'
});
return
}
this.close()
const e = {
result: {
"is_silently": false,
"is_mandatory": true,
"name": "",
"title": "",
"contents": textList.join('\n'),
"version": version,
"url": tempFileURL,
"stable_publish": true,
},
}
checkUpdate(e)
},
open() {
this.$refs.popup.open("center");
},
close() {
this.$refs.popup.close()
},
changeAccount() {
uni.reLaunch({
url: '/pages/common/accountItems'
})
},
// 退出
logout() {
let _this = this
uni.showModal({
title: '温馨提示',
content: '是否退出当前账号?',
confirmColor: '#347BFF',
async success(res) {
if (res.confirm) {
// _this.$emit('stopAudio')
try {
uni.showLoading({
mask: true
})
const {
code,
message
} = await uni.$api.userApi.logout(),
userInfo = uni.$storage.get("userInfo")
if (code == 0) {
uni.$storage.rm("userInfo");
uni.$storage.rm("sessionId");
uni.$storage.rm("noSignInUuid");
uni.$storage.rm("beisenToken");
uni.$storage.rm("studyCenterPermission");
uni.$storage.rm("boutique_YQorderSetting")
setTimeout(() => {
uni.hideLoading()
uni.reLaunch({
url: `/pages/common/login?mobile=${userInfo.phone}`,
});
}, 500)
} else throw message
} catch (error) {
uni.hideLoading()
uni.showToast({
title: error,
icon: "none",
});
}
}
}
})
},
jump(type) {
let url = type == 'icp' ? 'https://beian.miit.gov.cn/' :
'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni.navigateTo({
url: `/pages/common/webview?url=${url}`
})
}
}
}
</script>
<style scoped lang="scss">
.setting-box {
position: relative;
width: toRpx(720);
height: toRpx(880);
background: #ffffff;
border-radius: toRpx(40);
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.close {
position: absolute;
width: toRpx(120);
height: toRpx(120);
top: 0;
right: 0;
justify-content: center;
}
.app-info {
flex-direction: column;
font-size: toRpx(32);
color: #333333;
.sprite-icon {
margin-bottom: toRpx(12);
box-shadow: 0 0 toRpx(24) 0 #3682ef33;
border-radius: toRpx(40);
}
.version {
margin-top: toRpx(8);
font-size: toRpx(24);
color: #999999;
}
.check-box {
width: toRpx(120);
padding: toRpx(10) 0 toRpx(4);
background: #f2f2f2;
border-radius: toRpx(6);
font-size: toRpx(22);
color: #999999;
text-align: center;
margin-top: toRpx(16);
box-sizing: border-box;
}
}
.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>
<template>
<uni-popup
ref="popup"
border-radius="20px"
>
<view class="setting-box">
<view
class="close flex"
@click="close"
>
<uni-icons
type="closeempty"
:size="18"
color="#1A1A1A"
></uni-icons>
</view>
<view class="app-info flex">
<view class="sprite-icon icon-logo"></view>
展业助手
<view class="version">版本号:V{{ version }}</view>
<view
class="check-box"
@click="handleCheck"
>检查更新</view>
</view>
<view class="btn-box">
<view
class="btn flex"
@click="changeAccount"
>切换账号</view>
<view
class="btn flex logout"
@click="delAccount"
>注销</view>
<view
class="btn flex logout"
@click="logout"
>退出</view>
</view>
<view
class="a"
@click="jump('agreement')"
>《隐私协议》</view>
<view
class="icp flex"
@click="jump('icp')"
>
ICP备案号:苏ICP备18023686号-2A
<view class="sprite-icon icon-arrow-right"></view>
</view>
<view class="app-code flex">
APP编码:{{ deviceId }}
<view
class="sprite-icon icon-clone"
@click="copyText"
></view>
</view>
</view>
</uni-popup>
</template>
<script type="text/ecmascript-6">
import checkUpdate from "@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js";
import utils from '@/utils/utils'
export default {
name: 'SettingBox',
data () {
return {
version: '',
deviceId: ''
}
},
mounted () {
this.version = plus?.runtime?.version || '1.0.0'
const {
deviceId
} = uni.getDeviceInfo()
this.deviceId = deviceId
},
methods: {
copyText () {
uni.setClipboardData({
data: this.deviceId,
success: function () {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
},
async handleCheck () {
const {
textList,
tempFileURL,
version
} = uni.$storage.get('mock_data')
const res = utils.compareVersions(this.version, version)
if (res > -1) {
uni.showToast({
title: '目前已是最新版本',
duration: 2000,
icon: 'none'
});
return
}
this.close()
const e = {
result: {
"is_silently": false,
"is_mandatory": true,
"name": "",
"title": "",
"contents": textList.join('\n'),
"version": version,
"url": tempFileURL,
"stable_publish": true,
},
}
checkUpdate(e)
},
open () {
this.$refs.popup.open("center");
},
close () {
this.$refs.popup.close()
},
changeAccount () {
uni.reLaunch({
url: '/pages/common/accountItems'
})
},
// 退出
logout () {
let _this = this
uni.showModal({
title: '温馨提示',
content: '是否退出当前账号?',
confirmColor: '#347BFF',
async success (res) {
if (res.confirm) {
// _this.$emit('stopAudio')
try {
uni.showLoading({
mask: true
})
const {
code,
message
} = await uni.$api.userApi.logout(),
userInfo = uni.$storage.get("userInfo")
if (code == 0) {
uni.$storage.rm("userInfo");
uni.$storage.rm("sessionId");
uni.$storage.rm("noSignInUuid");
uni.$storage.rm("beisenToken");
uni.$storage.rm("studyCenterPermission");
uni.$storage.rm("boutique_YQorderSetting")
setTimeout(() => {
uni.hideLoading()
uni.reLaunch({
url: `/pages/common/login?mobile=${userInfo.phone}`,
});
}, 500)
} else throw message
} catch (error) {
uni.hideLoading()
uni.showToast({
title: error,
icon: "none",
});
}
}
}
})
},
jump (type) {
let url = type == 'icp' ? 'https://beian.miit.gov.cn/' :
'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni.navigateTo({
url: `/pages/common/webview?url=${url}`
})
},
delAccount () {
uni.showModal({
title: '账号注销',
content: '注销申请将提交给企业管理员审核,审核通过后账号将无法登录。确认提交吗?',
confirmColor: '#347BFF'
})
}
}
}
</script>
<style scoped lang="scss">
.setting-box {
position: relative;
width: toRpx(720);
height: toRpx(880);
background: #ffffff;
border-radius: toRpx(40);
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.close {
position: absolute;
width: toRpx(120);
height: toRpx(120);
top: 0;
right: 0;
justify-content: center;
}
.app-info {
flex-direction: column;
font-size: toRpx(32);
color: #333333;
.sprite-icon {
margin-bottom: toRpx(12);
box-shadow: 0 0 toRpx(24) 0 #3682ef33;
border-radius: toRpx(40);
}
.version {
margin-top: toRpx(8);
font-size: toRpx(24);
color: #999999;
}
.check-box {
width: toRpx(120);
padding: toRpx(10) 0 toRpx(4);
background: #f2f2f2;
border-radius: toRpx(6);
font-size: toRpx(22);
color: #999999;
text-align: center;
margin-top: toRpx(16);
box-sizing: border-box;
}
}
.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>
<template>
<view class="container" @click="handleTouchStart">
<view
class="container"
@click="handleTouchStart"
>
<view :class="['home', { show: !id && showHome }]">
<left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="changeTab" @stopAudio="stopAudio" @showReadCountTips="showReadCountTips" @closeTips="closeTips" />
<view class="tips-box" :style="tipsObject.style" @click.stop="closeTips">{{ tipsObject.text }}</view>
<left-side
:userInfo="userInfo"
:tabIndex.sync="tabIndex"
ref="leftBox"
@changeTab="changeTab"
@stopAudio="stopAudio"
@showReadCountTips="showReadCountTips"
@closeTips="closeTips"
/>
<view
class="tips-box"
:style="tipsObject.style"
@click.stop="closeTips"
>{{ tipsObject.text }}</view>
<view class="right-side">
<view :class="['app-content-box right-content', { 'show-content-box': tabIndex == 0 }]">
<view class="start" @click="start">
<view
class="start"
@click="start"
>
<template v-if="sceneType != 7">
<view class="sprite-icon icon-start-text"></view>
</template>
......@@ -19,7 +37,14 @@
<slot name="swiperCustom" />
</template>
<template v-else>
<swiper-component :moduleList="moduleList" @click="swiperClick" :stopAutoPlay="previewOff" :imgKey="bannerKey" :loadComplete="loadComplete" :noDataObject="swiperNoDataObject"></swiper-component>
<swiper-component
:moduleList="moduleList"
@click="swiperClick"
:stopAutoPlay="previewOff"
:imgKey="bannerKey"
:loadComplete="loadComplete"
:noDataObject="swiperNoDataObject"
></swiper-component>
</template>
</view>
</view>
......@@ -33,19 +58,36 @@
<view class="content-right box-class">
<view class="common-title">服务中心</view>
<view class="content-box">
<MessageIndex class="message-box" ref="messageRef" />
<MessageIndex
class="message-box"
ref="messageRef"
/>
</view>
</view>
</view>
</view>
<view :class="['app-content-box right-content', { 'show-content-box': tabIndex == 99 }]">
<component :is="'Point'" ref="pointRef" :userInfo="userInfo" @showPage="handleShowPage" />
<component
:is="'Point'"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
/>
</view>
<template v-if="tabIndex != 0 && tabIndex != 99">
<component :is="componentName" ref="pointRef" :userInfo="userInfo" @showPage="handleShowPage" :isPermissionFunction="isPermission" />
<component
:is="componentName"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
:isPermissionFunction="isPermission"
/>
</template>
</view>
<view class="store-addr" v-if="footerBox">
<view
class="store-addr"
v-if="footerBox"
>
<view class="icon-addr sprite-icon icon-addr"></view>
<view class="addr-text">{{ userInfo.shopMerchantName }}</view>
</view>
......@@ -53,17 +95,41 @@
<view :class="['detail', { show: id }]">
<slot name="detail" />
</view>
<view class="point-page" v-if="!showHome">
<component :is="pointComponentName" @backHome="backHome" @jump="jump" :transfer="transfer" />
<view
class="point-page"
v-if="!showHome"
>
<component
:is="pointComponentName"
@backHome="backHome"
@jump="jump"
:transfer="transfer"
/>
</view>
<!-- 未点击开始接待,弹窗 -->
<MessageBox ref="previewRef" @confirm="previewHandler('preview', true)" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="previewHandler('previewCancel')" @close="previewHandler('previewClose')"></MessageBox>
<MessageBox
ref="previewRef"
@confirm="previewHandler('preview', true)"
:popupW="704"
content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」"
confirmBtnText="预览素材"
@cancel="previewHandler('previewCancel')"
@close="previewHandler('previewClose')"
></MessageBox>
<!-- 停留弹框 -->
<!-- <MessageBox ref="tipBox" @cancel="tipCancel" @confirm="tipConfirm" content="系统检测到您在当前页面停留较久,是否仍在客户接待中?" cancelBtnText="否" confirmBtnText="是"></MessageBox> -->
<!-- 退出弹框 -->
<MessageBox :popupW="704" ref="finish" :content="finishContene" :isFooter="false">
<MessageBox
:popupW="704"
ref="finish"
:content="finishContene"
:isFooter="false"
>
<view class="footer">
<view class="footer-btn confirm flex" @click="$emit('openStep')">
<view
class="footer-btn confirm flex"
@click="$emit('openStep')"
>
<template v-if="finishDoneText">
{{ finishDoneText }}
</template>
......@@ -72,7 +138,10 @@
<text>(推荐)</text>
</template>
</view>
<view class="footer-btn cancel flex" @click="$emit('backHome')">
<view
class="footer-btn cancel flex"
@click="$emit('backHome')"
>
仍要退出
<text>(不推荐)</text>
</view>
......@@ -81,7 +150,11 @@
<!-- 升级弹框 -->
<update-box />
<slot name="content" />
<web-view @message="handlerMessage" ref="webview" src="/hybrid/html/index.html"></web-view>
<web-view
@message="handlerMessage"
ref="webview"
src="/hybrid/html/index.html"
></web-view>
<!-- <web-view
ref="studyWebview"
:src="jumpUrl"
......@@ -89,19 +162,61 @@
></web-view> -->
<!-- 学习中心 等级考试弹窗 -->
<StudyPopup :show.sync="showStudyPopup" title="开始您的学习之旅" :topImage="require('@/assets/images/common/study-center-bg.png')" :topImageWidth="848" :topImageHeight="248">
<StudyPopupContent cardTitle="个性化学习路径" description="根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。" :listItems="['基于当前能力水平评估', '结合岗位发展目标制定', '定期跟踪学习进度和效果']" tipText="true" :courseName="courseInfo.title" buttonText="开始测评" @cancel="handleStudyPopupCancel" @button-click="handleStartAssessment" />
<StudyPopup
:show.sync="showStudyPopup"
title="开始您的学习之旅"
:topImage="require('@/assets/images/common/study-center-bg.png')"
:topImageWidth="848"
:topImageHeight="248"
>
<StudyPopupContent
cardTitle="个性化学习路径"
description="根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。"
:listItems="['基于当前能力水平评估', '结合岗位发展目标制定', '定期跟踪学习进度和效果']"
tipText="true"
:courseName="courseInfo.title"
buttonText="开始测评"
@cancel="handleStudyPopupCancel"
@button-click="handleStartAssessment"
/>
</StudyPopup>
<!-- 考试提交确认弹窗 -->
<StudyPopup :show.sync="showExamPopup" title="" :width="848" :height="examPopInfo.isExamLoading ? 740 : 656" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248">
<ExamSubmitPopup :isLoading="examPopInfo.isExamLoading" :showError="examPopInfo.showError" :confirmText="examPopInfo.confirmText" @cancel="handleExamCancel" @confirm="handleExamConfirm" />
<StudyPopup
:show.sync="showExamPopup"
title=""
:width="848"
:height="examPopInfo.isExamLoading ? 740 : 656"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
>
<ExamSubmitPopup
:isLoading="examPopInfo.isExamLoading"
:showError="examPopInfo.showError"
:confirmText="examPopInfo.confirmText"
@cancel="handleExamCancel"
@confirm="handleExamConfirm"
/>
</StudyPopup>
<!-- 学习中心权限弹窗 -->
<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" />
<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"
/>
</StudyPopup>
<activity-popup ref="activityPopup"></activity-popup>
</view>
</template>
<script>
......@@ -137,9 +252,16 @@ import StudyPopup from '@/components/StudyPopup.vue'
import StudyPopupContent from '@/components/StudyPopupContent.vue'
import ExamSubmitPopup from '@/components/ExamSubmitPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import ActivityPopup from './components/ActivityPopup.vue'
export default {
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: {
id: [String, Number],
finishDoneText: String,
......@@ -160,7 +282,7 @@ export default {
},
swiperCustom: Boolean
},
data() {
data () {
return {
studyUrl: '',
jumpUrl: '',
......@@ -185,50 +307,63 @@ export default {
courseInfo: {
title: ''
},
lockReason: 0
lockReason: 0,
onShowCount: 0
}
},
beforeDestroy() {
beforeDestroy () {
// 组件销毁前移除监听
uni.$logger.local.info('levelStudyPopup 移除监听')
uni.$off('levelStudyPopup')
// uni.$off('showStudyPopup')
},
mounted() {
mounted () {
uni.$logger.local.info('levelStudyPopup 开始监听mounted')
uni.$on('levelStudyPopup', obj => {
uni.$logger.local.info('接收到学习弹窗事件', obj)
uni.$logger.local.info('接收到学习弹窗事件', obj)
this.showExamPopup = true
})
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限
},
provide() {
provide () {
return {
showPage: this.handleShowPage,
hideFooter: this.handleFooter
}
},
computed: {
previewRef() {
previewRef () {
return this.$refs.previewRef
},
finishRef() {
finishRef () {
return this.$refs.finish
},
componentName() {
componentName () {
let tabs = this.$refs.leftBox?.tabs
return tabs ? tabs[this.tabIndex].name : ''
},
sceneType() {
sceneType () {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
},
activityStatus () {
return this.$store.getters.indexMessagePopupStatus
}
},
watch: {
activityStatus: {
handler (val) {
if (!val && this.onShowCount) this.getActivityMessage(0)
},
immediate: true,
deep: true
}
},
methods: {
// 处理开始测评(参考 detail.vue 的实现)
async handleStartAssessment() {
async handleStartAssessment () {
this.showStudyPopup = false
try {
// 获取北森 token
......@@ -274,7 +409,7 @@ export default {
}
},
// 获取北森 SSO Token(参考 detail.vue 的方法)
findBeiSenSSOToken() {
findBeiSenSSOToken () {
return new Promise((resolve, reject) => {
uni.$api.commonApi
.findBeiSenSSOToken({})
......@@ -288,7 +423,7 @@ export default {
})
},
// 处理考试取消(用户选择未提交)
handleExamCancel() {
handleExamCancel () {
this.showExamPopup = false
this.examPopInfo = {
isExamLoading: false,
......@@ -297,7 +432,7 @@ export default {
}
this.getLevelExamInfo()
},
handleStudyPermissionConfirm() {
handleStudyPermissionConfirm () {
this.showStudyPermissionPopup = false
// 切换到学习中心 tab
const tabs = this.$refs.leftBox?.tabs
......@@ -310,7 +445,7 @@ export default {
}
},
// 处理学习弹窗取消
handleStudyPopupCancel() {
handleStudyPopupCancel () {
this.showStudyPopup = false
// 切换到学习中心 tab
const tabs = this.$refs.leftBox?.tabs
......@@ -323,7 +458,7 @@ export default {
}
},
// 检查学习中心权限
async checkStudyCenterPermission() {
async checkStudyCenterPermission () {
try {
const userInfo = uni.$storage.get('userInfo')
......@@ -357,7 +492,7 @@ export default {
}
},
// 处理考试确认(用户选择已提交)
async handleExamConfirm() {
async handleExamConfirm () {
this.examPopInfo.isExamLoading = true
this.examPopInfo.showError = false
const { examId, levelExamId } = this.courseInfo
......@@ -400,7 +535,7 @@ export default {
})
}
},
async changeTab({ item, index }) {
async changeTab ({ item, index }) {
if (index == 0) this.$refs.messageRef.getMessageSummary()
this.previewOff = index != 0
this.$emit('changeTab', index)
......@@ -411,23 +546,23 @@ export default {
}
},
// 查询等级弹窗信息
async getLevelExamInfo() {
async getLevelExamInfo () {
const res = await uni.$api.commonApi.startExam()
if (res) {
this.showStudyPopup = true
this.courseInfo = res
}
},
handleFooter(val) {
handleFooter (val) {
this.footerBox = val
},
backHome() {
backHome () {
this.showHome = true
Promise.resolve().then(() => {
this.$refs.pointRef?.$refs?.centerRef?.init && this.$refs.pointRef.$refs.centerRef.init()
})
},
jump(val) {
jump (val) {
this.showHome = true
if (val == 'CustomerFile') {
this.tabIndex = 2
......@@ -435,12 +570,12 @@ export default {
}
this.start()
},
handleShowPage(name, transfer) {
handleShowPage (name, transfer) {
this.transfer = transfer
this.showHome = false
this.pointComponentName = name
},
handleOperation(val, data) {
handleOperation (val, data) {
const { type } = val
// 提取公共的webview设置逻辑
......@@ -510,21 +645,21 @@ export default {
}
},
// 学习中心修改阅读状态,打开后才修改
async getStudyCenterRead(id) {
async getStudyCenterRead (id) {
const res = await uni.$api.commonApi.getStudyCenterRead({ id })
},
showReadCountTips(res) {
showReadCountTips (res) {
this.tipsObject = res
},
closeTips() {
closeTips () {
this.$refs.leftBox.readCount = 0
this.tipsObject = {
style: '',
text: ''
}
},
swiperClick(e) {
swiperClick (e) {
if (this.sceneType == 0)
uni.$track.add({
eventCode: 'app_product_Introduction'
......@@ -532,11 +667,11 @@ export default {
this.previewOff = true
this.$emit('swiperClick', e)
},
previewHandler(name, off = false) {
previewHandler (name, off = false) {
this.previewOff = off
this.$emit(name)
},
start() {
start () {
const { sceneType } = this
if (sceneType == 7) return //二手车无接待功能
uni.$track.add({
......@@ -544,11 +679,11 @@ export default {
})
this.$emit('start')
},
async updateApp(requested = false) {
async updateApp (requested = false) {
if (!requested) await uni.$api.systemApi.getMockData(true)
this.checkVersion()
},
async entranceClick(item) {
async entranceClick (item) {
// 清除评估单的图片视频资源缓存
const noInterceptPage = ['DailyReport', 'DeliveryManagement'],
......@@ -585,6 +720,16 @@ export default {
uni.navigateTo({
url: `/pages/${pageName}/tool/index?componentName=${item.name}`
})
},
async getActivityMessage (count = 1) {
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)
}
}
}
......
......@@ -195,6 +195,7 @@ export default {
this.$refs.home.updateApp(true)
},
async onShow () {
this.getActivityMessage()
const userInfo = uni.$storage.get("userInfo")
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm("userInfo");
......@@ -210,6 +211,10 @@ export default {
computed: {
},
methods: {
getActivityMessage () {
if (this.$refs.home) this.$refs.home.getActivityMessage()
else setTimeout(this.getActivityMessage, 200)
},
...mapMutations("audio", ["setReceptionStatus"]),
init () {
const userInfo = uni.$storage.get("userInfo"),
......
<template>
<view class="layout">
<view class="bg"></view>
<view class="login">
<view class="title">登录</view>
<view class="sub-title">手机号码登录</view>
<view class="input">
<input
type="tel"
:value="mobile"
placeholder="请输入手机号"
maxlength="11"
@blur="input($event, 'mobile')"
:key="dateKey.mobile"
auto-blur
/>
<template v-if="mobile">
<view
class="icon"
@click="mobile = ''"
>
<icon
type="clear"
size="16"
color="#000"
></icon>
</view>
</template>
</view>
<view class="input">
<input
type="number"
:value="code"
placeholder="请输入验证码"
maxlength="4"
@blur="input($event, 'code')"
:key="dateKey.code"
auto-blur
/>
<template v-if="code">
<view
class="icon"
@click="code = ''"
>
<icon
type="clear"
size="16"
color="#000"
></icon>
</view>
</template>
<view
:class="['code-btn', `${count ? 'code-disabled' : ''}`]"
@click="getSmsCode"
>{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view>
</view>
<button
class="btn"
@click="login"
>登录</button>
<view class="form-footer">
<view
class="autoLogin"
@click="readingStatus = !readingStatus"
>
<uni-icons
:type="`${readingStatus ? 'checkbox-filled' : 'circle'}`"
:size="18"
:color="`${readingStatus ? '#2C66F7' : '#858A94'}`"
></uni-icons>
我已阅读并同意
<text @click.stop="jumpUrl()">《用户隐私协议》</text>
</view>
<view
class="autoLogin"
@click="noSignIn = !noSignIn"
>
<uni-icons
:type="`${noSignIn ? 'checkbox-filled' : 'circle'}`"
:size="18"
:color="`${noSignIn ? '#2C66F7' : '#858A94'}`"
></uni-icons>
30天内免登录
</view>
</view>
</view>
<view class="app-code flex">
APP编码:{{ deviceId }}
<view
class="sprite-icon icon-clone"
@click="copyText"
></view>
</view>
<update-box />
</view>
</template>
<script type="text/ecmascript-6">
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
import { Request } from 'glsk-toolkit'
export default {
data () {
return {
mobile: '',
code: '',
count: '',
noSignIn: true,
readingStatus: true,
dateKey: {
mobile: 0,
code: 0
}
};
},
watch: {
code: {
handler (val) {
this.autoLoginByMobile()
},
immediate: true,
deep: true
},
mobile: {
handler (val) {
this.autoLoginByMobile()
},
immediate: true,
deep: true
}
},
onLoad (options) {
uni.$signHttp = new Request(uni.signHttpConfig) //重新登录重置请求参数
if (options.mobile) this.mobile = options.mobile
const noSignInUuid = uni.$storage.get('noSignInUuid')
if (noSignInUuid) this.autoLogin(noSignInUuid)
const {
deviceId
} = uni.getDeviceInfo()
this.deviceId = deviceId
},
methods: {
autoLoginByMobile () {
let { mobile, code } = this
if (code && mobile && code.length == 4 && phoneRex.test(mobile)) this.login()
},
copyText () {
uni.setClipboardData({
data: this.deviceId,
success: function () {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
},
async autoLogin (noSignInUuid) {
uni.showLoading({
mask: true
});
const { data } = await uni.$api.userApi.autoLogin({ noSignInUuid })
uni.hideLoading();
if (data) this.jump(data, true)
},
/**获取验证码 */
async getSmsCode () {
const { mobile, count } = this;
try {
if (!mobile) throw '请输入手机号';
if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (count) throw '验证码发送过于频繁,请稍后再试';
uni.showLoading({
mask: true
});
const { code, message } = await uni.$api.userApi.getSmsCode({ mobile });
uni.hideLoading();
if (code == '0') {
uni.$logger.local.info(`${mobile}发送验证码成功`)
uni.showToast({
title: '验证码已发送',
icon: 'none',
});
this.countDown(60);
} else throw message || '发送验证码失败';
} catch (error) {
uni.$logger.local.info(`${mobile}发送验证码失败,失败原因:${error}`)
uni.hideLoading();
uni.showToast({
title: error,
icon: 'none',
});
}
},
/**验证码倒计时 */
countDown (countDown) {
if (countDown) this.count = countDown;
setTimeout(() => {
let { count } = this;
this.count = --count;
if (count > 0) this.countDown();
else this.count = null;
}, 1e3);
},
login: uni.$throttle(async function () {
const { mobile, code: smsCode, noSignIn, readingStatus } = this;
try {
if (!mobile) throw '请输入手机号'
if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (!smsCode) throw '请输入验证码'
if (!readingStatus) throw '请阅读用户隐私协议'
let params = {
mobile,
code: smsCode
}
if (noSignIn) params.noSignIn = noSignIn
uni.showLoading({
mask: true
});
const { code, data, message } = await uni.$api.userApi.smsLogin(params);
console.log(code, data, message);
uni.hideLoading();
if (code == 0) {
this.jump(data, noSignIn);
uni.$logger.local.info(`${mobile}登录`)
}
else {
uni.showModal({
title: '温馨提示',
content: message,
showCancel: false,
confirmText: '知道了',
confirmColor: '#347BFF',
});
uni.$logger.local.info(`${mobile}登录失败,失败原因:${message}`)
}
} catch (error) {
uni.$logger.local.info(`${mobile}登录失败,失败原因:${error}`)
uni.hideLoading();
uni.showToast({
title: error,
icon: 'none',
});
}
}, 200),
// 获取登录账号下园区店列表
getAccountLoginList (loginUserInfoList) {
let stepIndex = loginUserInfoList?.length == 1 ? 1 : 0
uni.navigateTo({
url: `/pages/common/accountItems?stepIndex=${stepIndex}`
})
},
jumpUrl () {
let url = 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni.navigateTo({
url: `/pages/common/webview?url=${url}`
})
},
jump (data, noSignIn) {
let {
loginUserInfoList,
noSignInUuid,
sessionId,
} = data;
if (loginUserInfoList.length) {
uni.$storage.set('sessionId', sessionId);
if (noSignInUuid && noSignIn) uni.$storage.set('noSignInUuid', noSignInUuid)
this.getAccountLoginList(loginUserInfoList)
} else uni.reLaunch({
url: '/pages/common/nothing'
});
},
input (e, key) {
setTimeout(() => {
let { value } = e.detail,
numbers = value.match(/\d+/g)
console.log(numbers)
this[key] = numbers ? numbers.join('') : ''
this.dateKey[key] = Date.now()
}, 0)
},
},
};
</script>
<style lang="scss" scoped>
.bg {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-image: url('../../assets/images/login/bg.webp');
background-size: 100% 100%;
}
.login {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.title {
font-weight: 600;
font-size: toRpx(96);
color: #333333;
text-align: center;
}
.sub-title {
font-weight: 500;
font-size: toRpx(32);
color: #1a1a1a;
margin: toRpx(46) 0;
}
.input {
width: toRpx(800);
height: toRpx(112);
background: #f7f8fa;
border-radius: toRpx(56);
margin-bottom: toRpx(40);
box-sizing: border-box;
padding-left: toRpx(40);
display: flex;
align-items: center;
input {
height: 100%;
flex: 1;
font-size: toRpx(32) !important;
}
.icon {
margin-left: auto;
flex-shrink: 0;
display: flex;
align-items: center;
padding: 0 toRpx(40);
height: 100%;
}
.code-btn {
font-weight: 500;
font-size: toRpx(32);
color: #2c66f7;
flex-shrink: 0;
border: none;
margin-right: toRpx(40);
}
.code-disabled {
color: #9b9b9e;
}
}
.btn {
width: toRpx(800);
height: toRpx(112);
background-image: linear-gradient(90deg, #48a6ff 0%, #2c66f7 100%);
border-radius: toRpx(56);
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: toRpx(40);
color: #ffffff;
}
.btn[disabled]:not([type]),
.btn[disabled][type='default'] {
background: #c9c9c9 !important;
}
.form-footer {
display: flex;
justify-content: center;
margin-top: toRpx(40);
flex-direction: column;
gap: toRpx(38) 0;
padding-left: toRpx(142);
.autoLogin {
display: flex;
align-items: center;
margin-right: toRpx(20);
.uni-icons {
margin-right: toRpx(8);
// margin-left: toRpx(142);
}
text {
color: #2c66f7;
}
}
}
}
.app-code {
position: fixed;
bottom: toRpx(20);
left: 50%;
transform: translate(-50%);
font-size: toRpx(24);
color: #999999;
line-height: toRpx(40);
.icon-clone {
width: toRpx(24);
height: toRpx(24);
margin-left: toRpx(20);
}
}
</style>
<template>
<view class="layout">
<view class="bg"></view>
<view class="login">
<view class="title">登录</view>
<view class="sub-title">手机号码登录</view>
<view class="input">
<input
type="tel"
:value="mobile"
placeholder="请输入手机号"
maxlength="11"
@blur="input($event, 'mobile')"
:key="dateKey.mobile"
auto-blur
/>
<template v-if="mobile">
<view
class="icon"
@click="mobile = ''"
>
<icon
type="clear"
size="16"
color="#000"
></icon>
</view>
</template>
</view>
<view class="input">
<input
type="number"
:value="code"
placeholder="请输入验证码"
maxlength="4"
@blur="input($event, 'code')"
:key="dateKey.code"
auto-blur
/>
<template v-if="code">
<view
class="icon"
@click="code = ''"
>
<icon
type="clear"
size="16"
color="#000"
></icon>
</view>
</template>
<view
:class="['code-btn', `${count ? 'code-disabled' : ''}`]"
@click="getSmsCode"
>{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view>
</view>
<button
class="btn"
@click="login"
>登录</button>
<view class="form-footer">
<view
class="autoLogin"
@click="readingStatus = !readingStatus"
>
<uni-icons
:type="`${readingStatus ? 'checkbox-filled' : 'circle'}`"
:size="18"
:color="`${readingStatus ? '#2C66F7' : '#858A94'}`"
></uni-icons>
我已阅读并同意
<text @click.stop="jumpUrl()">《隐私协议》</text>
</view>
<view
class="autoLogin"
@click="noSignIn = !noSignIn"
>
<uni-icons
:type="`${noSignIn ? 'checkbox-filled' : 'circle'}`"
:size="18"
:color="`${noSignIn ? '#2C66F7' : '#858A94'}`"
></uni-icons>
30天内免登录
</view>
</view>
</view>
<view class="app-code flex">
APP编码:{{ deviceId }}
<view
class="sprite-icon icon-clone"
@click="copyText"
></view>
</view>
<update-box />
</view>
</template>
<script type="text/ecmascript-6">
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
import { Request } from 'glsk-toolkit'
export default {
data () {
return {
mobile: '',
code: '',
count: '',
noSignIn: true,
readingStatus: false,
dateKey: {
mobile: 0,
code: 0
}
};
},
watch: {
code: {
handler (val) {
this.autoLoginByMobile()
},
immediate: true,
deep: true
},
mobile: {
handler (val) {
this.autoLoginByMobile()
},
immediate: true,
deep: true
}
},
onLoad (options) {
uni.$signHttp = new Request(uni.signHttpConfig) //重新登录重置请求参数
if (options.mobile) this.mobile = options.mobile
const noSignInUuid = uni.$storage.get('noSignInUuid')
if (noSignInUuid) this.autoLogin(noSignInUuid)
const {
deviceId
} = uni.getDeviceInfo()
this.deviceId = deviceId
},
methods: {
autoLoginByMobile () {
let { mobile, code } = this
if (code && mobile && code.length == 4 && phoneRex.test(mobile)) this.login()
},
copyText () {
uni.setClipboardData({
data: this.deviceId,
success: function () {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
},
async autoLogin (noSignInUuid) {
uni.showLoading({
mask: true
});
const { data } = await uni.$api.userApi.autoLogin({ noSignInUuid })
uni.hideLoading();
if (data) this.jump(data, true)
},
/**获取验证码 */
async getSmsCode () {
const { mobile, count } = this;
try {
if (!mobile) throw '请输入手机号';
if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (count) throw '验证码发送过于频繁,请稍后再试';
uni.showLoading({
mask: true
});
const { code, message } = await uni.$api.userApi.getSmsCode({ mobile });
uni.hideLoading();
if (code == '0') {
uni.$logger.local.info(`${mobile}发送验证码成功`)
uni.showToast({
title: '验证码已发送',
icon: 'none',
});
this.countDown(60);
} else throw message || '发送验证码失败';
} catch (error) {
uni.$logger.local.info(`${mobile}发送验证码失败,失败原因:${error}`)
uni.hideLoading();
uni.showToast({
title: error,
icon: 'none',
});
}
},
/**验证码倒计时 */
countDown (countDown) {
if (countDown) this.count = countDown;
setTimeout(() => {
let { count } = this;
this.count = --count;
if (count > 0) this.countDown();
else this.count = null;
}, 1e3);
},
login: uni.$throttle(async function () {
const { mobile, code: smsCode, noSignIn, readingStatus } = this;
try {
if (!mobile) throw '请输入手机号'
if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (!smsCode) throw '请输入验证码'
if (!readingStatus) throw '请您阅读并同意《隐私协议》'
let params = {
mobile,
code: smsCode
}
if (noSignIn) params.noSignIn = noSignIn
uni.showLoading({
mask: true
});
const { code, data, message } = await uni.$api.userApi.smsLogin(params);
console.log(code, data, message);
uni.hideLoading();
if (code == 0) {
this.jump(data, noSignIn);
uni.$logger.local.info(`${mobile}登录`)
}
else {
uni.showModal({
title: '温馨提示',
content: message,
showCancel: false,
confirmText: '知道了',
confirmColor: '#347BFF',
});
uni.$logger.local.info(`${mobile}登录失败,失败原因:${message}`)
}
} catch (error) {
uni.$logger.local.info(`${mobile}登录失败,失败原因:${error}`)
uni.hideLoading();
uni.showToast({
title: error,
icon: 'none',
});
}
}, 200),
// 获取登录账号下园区店列表
getAccountLoginList (loginUserInfoList) {
let stepIndex = loginUserInfoList?.length == 1 ? 1 : 0
uni.navigateTo({
url: `/pages/common/accountItems?stepIndex=${stepIndex}`
})
},
jumpUrl () {
let url = 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni.navigateTo({
url: `/pages/common/webview?url=${url}`
})
},
jump (data, noSignIn) {
let {
loginUserInfoList,
noSignInUuid,
sessionId,
} = data;
if (loginUserInfoList.length) {
uni.$storage.set('sessionId', sessionId);
if (noSignInUuid && noSignIn) uni.$storage.set('noSignInUuid', noSignInUuid)
this.getAccountLoginList(loginUserInfoList)
} else uni.reLaunch({
url: '/pages/common/nothing'
});
},
input (e, key) {
setTimeout(() => {
let { value } = e.detail,
numbers = value.match(/\d+/g)
console.log(numbers)
this[key] = numbers ? numbers.join('') : ''
this.dateKey[key] = Date.now()
}, 0)
},
},
};
</script>
<style lang="scss" scoped>
.bg {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-image: url('../../assets/images/login/bg.webp');
background-size: 100% 100%;
}
.login {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.title {
font-weight: 600;
font-size: toRpx(96);
color: #333333;
text-align: center;
}
.sub-title {
font-weight: 500;
font-size: toRpx(32);
color: #1a1a1a;
margin: toRpx(46) 0;
}
.input {
width: toRpx(800);
height: toRpx(112);
background: #f7f8fa;
border-radius: toRpx(56);
margin-bottom: toRpx(40);
box-sizing: border-box;
padding-left: toRpx(40);
display: flex;
align-items: center;
input {
height: 100%;
flex: 1;
font-size: toRpx(32) !important;
}
.icon {
margin-left: auto;
flex-shrink: 0;
display: flex;
align-items: center;
padding: 0 toRpx(40);
height: 100%;
}
.code-btn {
font-weight: 500;
font-size: toRpx(32);
color: #2c66f7;
flex-shrink: 0;
border: none;
margin-right: toRpx(40);
}
.code-disabled {
color: #9b9b9e;
}
}
.btn {
width: toRpx(800);
height: toRpx(112);
background-image: linear-gradient(90deg, #48a6ff 0%, #2c66f7 100%);
border-radius: toRpx(56);
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: toRpx(40);
color: #ffffff;
}
.btn[disabled]:not([type]),
.btn[disabled][type='default'] {
background: #c9c9c9 !important;
}
.form-footer {
display: flex;
justify-content: center;
margin-top: toRpx(40);
flex-direction: column;
gap: toRpx(38) 0;
padding-left: toRpx(142);
.autoLogin {
display: flex;
align-items: center;
margin-right: toRpx(20);
.uni-icons {
margin-right: toRpx(8);
// margin-left: toRpx(142);
}
text {
color: #2c66f7;
}
}
}
}
.app-code {
position: fixed;
bottom: toRpx(20);
left: 50%;
transform: translate(-50%);
font-size: toRpx(24);
color: #999999;
line-height: toRpx(40);
.icon-clone {
width: toRpx(24);
height: toRpx(24);
margin-left: toRpx(20);
}
}
</style>
<template>
<view>
<home-frame
@preview="preview"
@start="start"
ref="home"
:id="id"
@openStep="openStep"
@backHome="backHome"
@changeTab="changeTab"
:moduleList="moduleList"
@swiperClick="toDetail"
:loadComplete="loadComplete"
>
<template slot="detail">
<detail
:id.sync="id"
:media="moduleList"
:type.sync="type"
:toolList="toolList"
:aitoCarModelIds="aitoCarModelIds"
@back="back"
@done="done"
ref="detail"
:mediaId="mediaId"
/>
</template>
<template slot="content">
<!-- <novice-guide
@nextStep="nextStep"
@back="back"
/> -->
</template>
</home-frame>
</view>
</template>
<script>
import detail from './detail/detail'
import { mapMutations } from 'vuex'
import NoviceGuide from '@/components/NoviceGuide.vue'
import HomeFrame from '@/components/HomeFrame/index.vue'
// import storge from "@/mixin/storge";
export default {
// mixins: [storge],
components: { HomeFrame, detail, NoviceGuide },
data () {
return {
moduleList: [],
toolList: [],
id: '',
type: '',
chooseItem: {},
recording: false,
aitoCarModelIds: [],
mediaId: '',
loadComplete: false,
requested: false
}
},
computed: {
channelType () {
const { channelType } = uni.$storage.get('userInfo')
return channelType || 1 //默认问界
},
shopMerchantId () {
const { shopMerchantId } = uni.$storage.get('userInfo')
return shopMerchantId
},
sceneType () {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
}
},
onBackPress (options) {
if (options.from === 'backbutton') {
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
this.back()
return true
}
// 其他情况允许正常返回
return false
},
async onLoad () {
uni.hideLoading()
const mockdata = await uni.$api.systemApi.getMockData(true) //获取APP配置信息
if (this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) {
this.$store.state.user.boutiqueDefaultCarBrandId = mockdata.boutiqueDefaultCarBrandId //默认车辆品牌
if (mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系
}
this.get_Vehicle_Sales_Data()
this.requested = true
this.$refs.home.updateApp(true)
},
async onShow () {
const userInfo = uni.$storage.get('userInfo')
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm('userInfo')
uni.$storage.rm('sessionId')
uni.reLaunch({
url: '/pages/common/login'
})
return
}
this.init()
},
methods: {
...mapMutations('audio', ['setReceptionStatus']),
init () {
this.findPayInfo()
if (this.requested && !this.id) this.$refs.home.updateApp()
},
/**获取车型&销售数据 */
get_Vehicle_Sales_Data () {
const userInfo = uni.$storage.get('userInfo'),
storageCarBrandList = uni.$storage.get('carBrandList'),
storageEmployeeList = uni.$storage.get('employeeList'),
{ shopMerchantId } = userInfo
if (storageCarBrandList) this.$store.dispatch('setCarBrandsList', storageCarBrandList)
if (storageEmployeeList) this.$store.dispatch('setEmployeeList', storageEmployeeList)
/**获取品牌车型 */
uni.$api.commonApi.getMerchantCarBrandList([shopMerchantId]).then(({ data }) => {
let list = data[0].carBrandList,
carBrandList = [],
brandIdList = [],
subBrandIdList = []
list?.map(e => {
e.childs.map(i => {
i.brandName = e.name
i.brandId = e.id
carBrandList.push(i)
subBrandIdList.push(i.id)
})
brandIdList.push(e.id)
})
this.getSoure(brandIdList, subBrandIdList)
this.$store.dispatch('setCarBrandsList', carBrandList)
uni.$storage.set('carBrandList', carBrandList)
if (carBrandList.length) {
let index = 0
this.getCarBrandsList(carBrandList, index)
}
})
/**获取销售人员 */
uni.$api.commonApi.getEmployeeList({
merchantId: shopMerchantId
}).then(res => {
this.$store.dispatch('setEmployeeList', res || [])
uni.$storage.set('employeeList', res || [])
})
},
// 查询素材
async getSoure (brandIdList, subBrandIdList) {
const { shopMerchantId, sceneType } = this
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (data) this.setViewInfo(data)
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, {
brandIdList,
subBrandIdList
})
if (requestData) this.setViewInfo(requestData)
else this.loadComplete = true
},
errorImg (index) {
this.moduleList[index].showAlt = true
},
async start () {
if (!this.moduleList.length) return uni.showToast({
title: '该场景尚未配置素材,请联系总部人员',
icon: 'none'
})
const isPermision = await this.$refs.home.isPermission()
if (this.recording || !isPermision) return
uni.showLoading({
mask: true
})
this.$refs.home.startAudio()
this.clearHistory()
this.id = this.moduleList[0].id
this.type = 'edit'
this.recording = true
setTimeout(() => {
uni.hideLoading()
}, 1e3)
},
toDetail (index) {
let item = this.moduleList[index]
this.chooseItem = item
this.$refs.home.previewRef.open()
},
cancel () {
this.$refs.home.previewRef.close()
},
preview () {
let { id, title } = this.chooseItem
this.type = 'preview'
this.id = id
uni.$logger.local.info(`预览${title}`)
this.cancel()
},
// 完成接待
done (e) {
this.$refs.home.finishRef.close()
if (this.recording) this.$refs.home.stopAudio()
this.recording = false
setTimeout(() => {
this.id = ''
this.type = ''
this.setReceptionStatus(e)
this.$store.dispatch('clearHistory')
this.$store.dispatch('clearReceptionTrack')
}, 1500)
},
back () {
const detailRef = this.$refs.detail
if (detailRef.showPayPage) return (detailRef.showPayPage = false)
if (!this.id) return uni.navigateBack()
if (this.type != 'preview') return this.$refs.home.finishRef.open()
this.backHome()
},
backHome () {
if (this.recording) this.$refs.home.stopAudio(true)
this.$refs.home.finishRef.close()
this.id = ''
this.type = ''
this.clearHistory()
this.init()
this.recording = false
this.$refs.home.$refs.leftBox.getMessageInfo()
},
nextStep () {
let { id } = this.moduleList[0]
this.type = 'preview'
this.id = id
},
clearHistory () {
this.$store.dispatch('clearCustomerInfo')
this.$store.dispatch('clearHistory')
this.$refs.home.setBooks([])
this.$store.dispatch('clearReceptionTrack')
},
openStep () {
this.$refs.home.finishRef.close()
this.$refs.detail.open()
},
// 查询门店支付配置
async findPayInfo () {
const { shopMerchantId } = uni.$storage.get('userInfo')
const data = await uni.$api.commonApi.findPayInfo({
merchantId: shopMerchantId
})
let paymentType = []
data.find(item => {
if (item.paymentType == 1)
paymentType.push({
name: '扫码支付',
type: 1,
title: '付款二维码',
...item
})
if (item.paymentType == 2)
paymentType.push({
name: '对公账户',
type: 2,
title: '付款方式',
...item
})
})
this.$store.dispatch('setPaymentType', paymentType)
},
changeTab (index) {
if (index == 0) this.init()
},
/**按序加载车型 */
async getCarBrandsList (carBrandList, index) {
const item = carBrandList[index]
if (!item) return
const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
if (index < carBrandList.length - 1) {
index += 1
if (!carList) {
const list = await uni.$api.commonApi.getCarBrandsList({
brandId: item.brandId,
childBrandId: item.id
})
if (list) uni.setStorageSync(`${item.id}_${item.brandId}_carlist`, list)
this.getCarBrandsList(carBrandList, ++index)
} else this.getCarBrandsList(carBrandList, ++index)
}
},
/**素材内容 */
setViewInfo (data) {
let { moduleList, toolList, id } = data
this.moduleList = moduleList
this.toolList = toolList
this.mediaId = id
this.loadComplete = true
this.$store.state.user = {
...this.$store.state.user,
...data
}
}
}
}
</script>
<style scoped lang="scss">
.webview-container {
width: toRpx(100);
height: toRpx(100);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
transform: translateY(300%);
}
</style>
<template>
<view>
<home-frame
@preview="preview"
@start="start"
ref="home"
:id="id"
@openStep="openStep"
@backHome="backHome"
@changeTab="changeTab"
:moduleList="moduleList"
@swiperClick="toDetail"
:loadComplete="loadComplete"
>
<template slot="detail">
<detail
:id.sync="id"
:media="moduleList"
:type.sync="type"
:toolList="toolList"
:aitoCarModelIds="aitoCarModelIds"
@back="back"
@done="done"
ref="detail"
:mediaId="mediaId"
/>
</template>
<template slot="content">
<!-- <novice-guide
@nextStep="nextStep"
@back="back"
/> -->
</template>
</home-frame>
</view>
</template>
<script>
import detail from './detail/detail'
import { mapMutations } from 'vuex'
import NoviceGuide from '@/components/NoviceGuide.vue'
import HomeFrame from '@/components/HomeFrame/index.vue'
// import storge from "@/mixin/storge";
export default {
// mixins: [storge],
components: { HomeFrame, detail, NoviceGuide },
data () {
return {
moduleList: [],
toolList: [],
id: '',
type: '',
chooseItem: {},
recording: false,
aitoCarModelIds: [],
mediaId: '',
loadComplete: false,
requested: false
}
},
computed: {
channelType () {
const { channelType } = uni.$storage.get('userInfo')
return channelType || 1 //默认问界
},
shopMerchantId () {
const { shopMerchantId } = uni.$storage.get('userInfo')
return shopMerchantId
},
sceneType () {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
}
},
onBackPress (options) {
if (options.from === 'backbutton') {
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
this.back()
return true
}
// 其他情况允许正常返回
return false
},
async onLoad () {
uni.hideLoading()
const mockdata = await uni.$api.systemApi.getMockData(true) //获取APP配置信息
if (this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) {
this.$store.state.user.boutiqueDefaultCarBrandId = mockdata.boutiqueDefaultCarBrandId //默认车辆品牌
if (mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系
}
this.get_Vehicle_Sales_Data()
this.requested = true
this.$refs.home.updateApp(true)
},
async onShow () {
this.getActivityMessage()
const userInfo = uni.$storage.get('userInfo')
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm('userInfo')
uni.$storage.rm('sessionId')
uni.reLaunch({
url: '/pages/common/login'
})
return
}
this.init()
},
methods: {
getActivityMessage () {
if (this.$refs.home) this.$refs.home.getActivityMessage()
else setTimeout(this.getActivityMessage, 200)
},
...mapMutations('audio', ['setReceptionStatus']),
init () {
this.findPayInfo()
if (this.requested && !this.id) this.$refs.home.updateApp()
},
/**获取车型&销售数据 */
get_Vehicle_Sales_Data () {
const userInfo = uni.$storage.get('userInfo'),
storageCarBrandList = uni.$storage.get('carBrandList'),
storageEmployeeList = uni.$storage.get('employeeList'),
{ shopMerchantId } = userInfo
if (storageCarBrandList) this.$store.dispatch('setCarBrandsList', storageCarBrandList)
if (storageEmployeeList) this.$store.dispatch('setEmployeeList', storageEmployeeList)
/**获取品牌车型 */
uni.$api.commonApi.getMerchantCarBrandList([shopMerchantId]).then(({ data }) => {
let list = data[0].carBrandList,
carBrandList = [],
brandIdList = [],
subBrandIdList = []
list?.map(e => {
e.childs.map(i => {
i.brandName = e.name
i.brandId = e.id
carBrandList.push(i)
subBrandIdList.push(i.id)
})
brandIdList.push(e.id)
})
this.getSoure(brandIdList, subBrandIdList)
this.$store.dispatch('setCarBrandsList', carBrandList)
uni.$storage.set('carBrandList', carBrandList)
if (carBrandList.length) {
let index = 0
this.getCarBrandsList(carBrandList, index)
}
})
/**获取销售人员 */
uni.$api.commonApi.getEmployeeList({
merchantId: shopMerchantId
}).then(res => {
this.$store.dispatch('setEmployeeList', res || [])
uni.$storage.set('employeeList', res || [])
})
},
// 查询素材
async getSoure (brandIdList, subBrandIdList) {
const { shopMerchantId, sceneType } = this
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (data) this.setViewInfo(data)
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, {
brandIdList,
subBrandIdList
})
if (requestData) this.setViewInfo(requestData)
else this.loadComplete = true
},
errorImg (index) {
this.moduleList[index].showAlt = true
},
async start () {
if (!this.moduleList.length) return uni.showToast({
title: '该场景尚未配置素材,请联系总部人员',
icon: 'none'
})
const isPermision = await this.$refs.home.isPermission()
if (this.recording || !isPermision) return
uni.showLoading({
mask: true
})
this.$refs.home.startAudio()
this.clearHistory()
this.id = this.moduleList[0].id
this.type = 'edit'
this.recording = true
setTimeout(() => {
uni.hideLoading()
}, 1e3)
},
toDetail (index) {
let item = this.moduleList[index]
this.chooseItem = item
this.$refs.home.previewRef.open()
},
cancel () {
this.$refs.home.previewRef.close()
},
preview () {
let { id, title } = this.chooseItem
this.type = 'preview'
this.id = id
uni.$logger.local.info(`预览${title}`)
this.cancel()
},
// 完成接待
done (e) {
this.$refs.home.finishRef.close()
if (this.recording) this.$refs.home.stopAudio()
this.recording = false
setTimeout(() => {
this.id = ''
this.type = ''
this.setReceptionStatus(e)
this.$store.dispatch('clearHistory')
this.$store.dispatch('clearReceptionTrack')
}, 1500)
},
back () {
const detailRef = this.$refs.detail
if (detailRef.showPayPage) return (detailRef.showPayPage = false)
if (!this.id) return uni.navigateBack()
if (this.type != 'preview') return this.$refs.home.finishRef.open()
this.backHome()
},
backHome () {
if (this.recording) this.$refs.home.stopAudio(true)
this.$refs.home.finishRef.close()
this.id = ''
this.type = ''
this.clearHistory()
this.init()
this.recording = false
this.$refs.home.$refs.leftBox.getMessageInfo()
},
nextStep () {
let { id } = this.moduleList[0]
this.type = 'preview'
this.id = id
},
clearHistory () {
this.$store.dispatch('clearCustomerInfo')
this.$store.dispatch('clearHistory')
this.$refs.home.setBooks([])
this.$store.dispatch('clearReceptionTrack')
},
openStep () {
this.$refs.home.finishRef.close()
this.$refs.detail.open()
},
// 查询门店支付配置
async findPayInfo () {
const { shopMerchantId } = uni.$storage.get('userInfo')
const data = await uni.$api.commonApi.findPayInfo({
merchantId: shopMerchantId
})
let paymentType = []
data.find(item => {
if (item.paymentType == 1)
paymentType.push({
name: '扫码支付',
type: 1,
title: '付款二维码',
...item
})
if (item.paymentType == 2)
paymentType.push({
name: '对公账户',
type: 2,
title: '付款方式',
...item
})
})
this.$store.dispatch('setPaymentType', paymentType)
},
changeTab (index) {
if (index == 0) this.init()
},
/**按序加载车型 */
async getCarBrandsList (carBrandList, index) {
const item = carBrandList[index]
if (!item) return
const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
if (index < carBrandList.length - 1) {
index += 1
if (!carList) {
const list = await uni.$api.commonApi.getCarBrandsList({
brandId: item.brandId,
childBrandId: item.id
})
if (list) uni.setStorageSync(`${item.id}_${item.brandId}_carlist`, list)
this.getCarBrandsList(carBrandList, ++index)
} else this.getCarBrandsList(carBrandList, ++index)
}
},
/**素材内容 */
setViewInfo (data) {
let { moduleList, toolList, id } = data
this.moduleList = moduleList
this.toolList = toolList
this.mediaId = id
this.loadComplete = true
this.$store.state.user = {
...this.$store.state.user,
...data
}
}
}
}
</script>
<style scoped lang="scss">
.webview-container {
width: toRpx(100);
height: toRpx(100);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
transform: translateY(300%);
}
</style>
export default {
token: (state) => state.user.token,
siteData: (state) => state.site.siteData,
userData: (state) => state.user.userData,
userId: (state) => state.user.userData.id,
isInBackgound: (state) => state.sys.isInBackgound,
customerInfo: (state) => state.user.customerInfo,
receptionTrack: (state) => state.user.receptionTrack,
receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList,
receptionKey: (state) => state.user.receptionKey,
customerKey: (state) => state.user.customerKey
};
export default {
token: (state) => state.user.token,
siteData: (state) => state.site.siteData,
userData: (state) => state.user.userData,
userId: (state) => state.user.userData.id,
isInBackgound: (state) => state.sys.isInBackgound,
customerInfo: (state) => state.user.customerInfo,
receptionTrack: (state) => state.user.receptionTrack,
receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList,
receptionKey: (state) => state.user.receptionKey,
customerKey: (state) => state.user.customerKey,
indexMessagePopupStatus: (state) => state.sys.indexMessagePopupStatus,
};
export default {
state() {
return {
isInBackgound: false
}
},
mutations: {
SET_BACKGROUND_STATE(state, value) {
state.isInBackgound = value
}
},
actions: {
setBackgroundState({ commit }, value) {
uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`)
commit('SET_BACKGROUND_STATE', value)
}
}
}
export default {
state() {
return {
isInBackgound: false,
indexMessagePopupStatus: true, // 首页弹窗状态
}
},
mutations: {
SET_BACKGROUND_STATE(state, value) {
state.isInBackgound = value
},
SET_INDEX_MESSAGE_POPUP_STATUS(state, value){
state.indexMessagePopupStatus = 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!