Commit 000ed1e0 by 李伟康

commit 增加比亚迪配置

1 parent c5001d21
......@@ -5,9 +5,16 @@ const serverConfig = {
mockRequestCount: null,
mockTimer: {},
mockCache: null,
};
const configModule = 'app-tape'
const configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`;
},
bydServerConfig = {
mockRequestCount: null,
mockTimer: {},
mockCache: null,
},
configModule = 'app-tape',
bydConfigModule = 'byd-pad-config',
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`,
bydConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${bydConfigModule}&env=${env}`
/**获取mock数据 */
const getMockData = async (immediate = false) => {
......@@ -71,15 +78,53 @@ const imgToBase64 = (list, urlKey) => {
})
})
};
const updateMockData = (dataList, keyList) => {
const mockData = uni.$storage.get('mock_data')
const updateMockData = (dataList, keyList, storageName) => {
const mockData = uni.$storage.get(storageName)
keyList.map(key => {
mockData[key] = dataList[key]
})
setTimeout(() => {
uni.$storage.set("mock_data", mockData)
uni.$storage.set(storageName, mockData)
}, 1e3)
}
/**
*获取比亚迪配置
*/
const getBydMockData = async (immediate = false) => {
const MOCKDATA = uni.$storage.get('byd_mock_data')
try {
if (!immediate && MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) {
return Promise.resolve(MOCKDATA);
} else {
if (!bydServerConfig.mockRequestCount || immediate) {
bydServerConfig.mockCache = null;
bydServerConfig.mockRequestCount = Date.now();
const data = await http.uni_request({ url: bydConfigUrl });
data.createTime = Date.now();
data.moduleList = await imgToBase64(data.moduleList, 'thumbnail')
bydServerConfig.mockCache = data;
uni.$storage.set("byd_mock_data", data);
return Promise.resolve(data);
} else {
const key = Date.now();
return new Promise((resolve) => {
bydServerConfig.mockTimer[key] = setInterval(() => {
if (bydServerConfig.mockCache) {
clearInterval(bydServerConfig.mockTimer[key]);
bydServerConfig.mockRequestCount = null;
resolve(bydServerConfig.mockCache);
}
}, 1e3);
});
}
}
} catch (error) {
console.log(error)
if (bydServerConfig.mockTimer[key]) clearInterval(bydServerConfig.mockTimer[key]);
bydServerConfig.mockRequestCount = null;
return Promise.reject(error);
}
};
// 图片版本号
const getImageVersion = async () => {
const accountInfo = await getMockData()
......@@ -90,5 +135,6 @@ module.exports = {
getImageVersion,
getMockData,
imgToBase64,
updateMockData
updateMockData,
getBydMockData
}
\ No newline at end of file
......@@ -409,10 +409,6 @@ export default {
}
</script>
<style scoped lang="scss">
@font-face {
font-family: 'numberBold';
src: url('https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.ttf');
}
.record-box {
box-sizing: border-box;
height: 100%;
......@@ -593,7 +589,7 @@ export default {
}
.num-box {
.num {
font-family: 'numberBold';
font-family: 'number-700';
font-size: 48rpx;
font-weight: 700;
margin: 0 4rpx;
......
......@@ -121,7 +121,7 @@ export default {
})
uni.hideLoading()
userInfo.channelType = res.channelType || 1 // 默认1 1问界 2 比亚迪 3 其他
// userInfo.channelType = 3
// userInfo.channelType = 2
uni.$storage.set('userInfo', userInfo)
let url = {
1: '/pages/boutique/index',
......
......@@ -298,6 +298,7 @@ export default {
.li-number {
font-size: 32rpx;
margin-right: 12rpx;
font-family: 'number-400'
}
.li-content {
......
......@@ -24,7 +24,7 @@
</view>
<template v-for="(item, index) in media">
<view
:class="['view', { showView: id == item.id }]"
:class="['view', { showView: id == item.id }, modeName]"
:key="index"
@touchstart.stop="touchStart"
@touchend.stop="touchEnd"
......@@ -123,7 +123,8 @@ export default {
screenWidth: null,
scaleValueObject: {},
showPayPage: false,
productModelStatus: false
productModelStatus: false,
modeName: ''
};
},
computed: {
......@@ -213,18 +214,30 @@ export default {
if (Math.abs(this.startY - touch.pageY) > 100) return
if (!scaleValueObject[id]) scaleValueObject[id] = 1
if (isDistanceSignificant && index != -1 && scaleValueObject[id] == 1 && !productModelStatus) {
const nextId = this.getNextId(index, toolList, startX, halfScreenWidth)
const { nextId, modeName } = this.getNextId(index, toolList, startX, halfScreenWidth)
this.modeName = modeName
this.$emit('update:id', nextId)
setTimeout(() => {
this.modeName = ''
}, 300)
}
} catch (error) {
console.log(error)
}
},
getNextId (index, toolList, startX, halfScreenWidth) {
let nextId = '',
modeName = ''
if (startX > halfScreenWidth) {
return index === toolList.length - 1 ? toolList[0].id : toolList[index + 1].id;
nextId = index === toolList.length - 1 ? toolList[0].id : toolList[index + 1].id;
modeName = 'to-right'
} else {
return index === 0 ? toolList[toolList.length - 1].id : toolList[index - 1].id;
nextId = index === 0 ? toolList[toolList.length - 1].id : toolList[index - 1].id;
modeName = 'to-left'
}
return {
nextId,
modeName
}
},
scale (e) {
......@@ -264,31 +277,27 @@ export default {
top: 0;
left: 0;
visibility: hidden;
// display: none;
}
.showView {
position: absolute;
z-index: 1;
visibility: visible;
// display: block;
animation: show-content-left 0.15s forwards;
}
.pen-box {
position: fixed;
right: 40rpx;
top: 5%;
width: 120rpx;
height: 120rpx;
z-index: 10;
box-shadow: 0 4px 12px 0 #00000033;
border-radius: 16rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
.to-left {
animation: to-left 0.25s forwards;
}
.to-right {
animation: to-right 0.25s forwards;
}
@keyframes to-left {
0% {
left: -100%;
}
100% {
left: 0;
}
}
@keyframes show-content-left {
@keyframes to-right {
0% {
left: 100%;
}
......
......@@ -162,55 +162,66 @@ export default {
},
// 查询素材
async getSoure () {
let { moduleList, toolList,
default_moduleList, default_toolList,
byd_moduleList, byd_toolList
} = await uni.$api.systemApi.getMockData(true)
/**比亚迪 */
if (this.channelType == 2) {
await byd_moduleList.map(async e => {
let { moduleList, toolList } = await uni.$api.systemApi.getBydMockData(true)
await moduleList.map(async e => {
if (e.receptionSourceDetailList)
e.receptionSourceDetailList = await uni.$api.systemApi.imgToBase64(
e.receptionSourceDetailList,
"detailUrl"
);
})
byd_toolList = await uni.$api.systemApi.imgToBase64(byd_toolList, "shortTitleUrl")
} else if (this.channelType == 3) {
/**其他品牌 */
default_toolList = await uni.$api.systemApi.imgToBase64(default_toolList, "shortTitleUrl");
} else {
/**默认问界 */
await moduleList.map(async (e) => {
if (e.receptionSourceDetailList)
e.receptionSourceDetailList = await uni.$api.systemApi.imgToBase64(
e.receptionSourceDetailList,
"detailUrl"
);
if (e.carTypeList)
e.carTypeList = await uni.$api.systemApi.imgToBase64(
e.carTypeList,
"url"
);
if (e.screenList)
e.screenList = await uni.$api.systemApi.imgToBase64(
e.screenList,
"url"
)
});
toolList = await uni.$api.systemApi.imgToBase64(toolList, "shortTitleUrl")
uni.$api.systemApi.updateMockData({
moduleList,
toolList,
}, ['moduleList', 'toolList'], 'byd_mock_data')
this.setViewInfo(moduleList, toolList)
} else {
let { moduleList, toolList,
default_moduleList, default_toolList,
} = await uni.$api.systemApi.getMockData(true),
_moduleList,
_toolList
if (this.channelType == 3) {
/**其他品牌 */
default_toolList = await uni.$api.systemApi.imgToBase64(default_toolList, "shortTitleUrl");
_moduleList = default_moduleList
_toolList = default_toolList
} else {
/**默认问界 */
await moduleList.map(async (e) => {
if (e.receptionSourceDetailList)
e.receptionSourceDetailList = await uni.$api.systemApi.imgToBase64(
e.receptionSourceDetailList,
"detailUrl"
);
if (e.carTypeList)
e.carTypeList = await uni.$api.systemApi.imgToBase64(
e.carTypeList,
"url"
);
if (e.screenList)
e.screenList = await uni.$api.systemApi.imgToBase64(
e.screenList,
"url"
)
});
toolList = await uni.$api.systemApi.imgToBase64(toolList, "shortTitleUrl")
_moduleList = moduleList
_toolList = toolList
}
uni.$api.systemApi.updateMockData({
default_moduleList,
default_toolList,
moduleList,
toolList
}, ["moduleList", 'toolList',
'default_moduleList', 'default_toolList',
], 'mock_data')
this.setViewInfo(_moduleList, _toolList)
}
uni.$api.systemApi.updateMockData({
default_moduleList,
default_toolList,
byd_moduleList,
byd_toolList,
moduleList,
toolList
}, ["moduleList", 'toolList',
'default_moduleList', 'default_toolList',
'byd_moduleList','byd_toolList'
]);
},
errorImg (index) {
this.moduleList[index].showAlt = true;
......@@ -338,25 +349,35 @@ export default {
}
},
/**素材内容 */
setViewInfo () {
const {
default_moduleList,
default_toolList,
byd_moduleList,
byd_toolList,
moduleList,
toolList
} = uni.$storage.get("mock_data") || {}
this.moduleList = {
3: default_moduleList,
2: byd_moduleList,
1: moduleList
}[this.channelType]
this.toolList = {
3: default_toolList,
2: byd_toolList,
1: toolList
}[this.channelType]
setViewInfo (_moduleList, _toolList) {
if (_moduleList && _toolList) {
this.moduleList = _moduleList
this.toolList = _toolList
return
}
if (this.channelType == 2) {
const {
moduleList,
toolList
} = uni.$storage.get("byd_mock_data")
this.moduleList = moduleList
this.toolList = toolList
} else {
const {
default_moduleList,
default_toolList,
moduleList,
toolList
} = uni.$storage.get("mock_data") || {}
this.moduleList = {
3: default_moduleList,
1: moduleList
}[this.channelType]
this.toolList = {
3: default_toolList,
1: toolList
}[this.channelType]
}
}
},
};
......
......@@ -4,6 +4,14 @@
*/
@import './assets/css/sprite.scss';
@font-face {
font-family: 'number-700';
src: url('https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.ttf');
}
@font-face {
font-family: 'number-400';
src: url('https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-400-Regular.ttf');
}
@keyframes show-view {
0% {
opacity: 0;
......
......@@ -21,9 +21,5 @@ export const STORAGE_OBJECTkEY = {
recordSuccessList: "recordSuccessList",
historyList: "historyList",
storageVersion: "storageVersion",
byd_mock_data:'byd_mock_data'
};
// export const IMG_VERSION = async () => {
// const accountInfo = await util.getMockData()
// return accountInfo?.version || Date.now()
// }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!