Commit 000ed1e0 by 李伟康

commit 增加比亚迪配置

1 parent c5001d21
...@@ -5,9 +5,16 @@ const serverConfig = { ...@@ -5,9 +5,16 @@ const serverConfig = {
mockRequestCount: null, mockRequestCount: null,
mockTimer: {}, mockTimer: {},
mockCache: null, mockCache: null,
}; },
const configModule = 'app-tape' bydServerConfig = {
const configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`; 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数据 */ /**获取mock数据 */
const getMockData = async (immediate = false) => { const getMockData = async (immediate = false) => {
...@@ -71,15 +78,53 @@ const imgToBase64 = (list, urlKey) => { ...@@ -71,15 +78,53 @@ const imgToBase64 = (list, urlKey) => {
}) })
}) })
}; };
const updateMockData = (dataList, keyList) => { const updateMockData = (dataList, keyList, storageName) => {
const mockData = uni.$storage.get('mock_data') const mockData = uni.$storage.get(storageName)
keyList.map(key => { keyList.map(key => {
mockData[key] = dataList[key] mockData[key] = dataList[key]
}) })
setTimeout(() => { setTimeout(() => {
uni.$storage.set("mock_data", mockData) uni.$storage.set(storageName, mockData)
}, 1e3) }, 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 getImageVersion = async () => {
const accountInfo = await getMockData() const accountInfo = await getMockData()
...@@ -90,5 +135,6 @@ module.exports = { ...@@ -90,5 +135,6 @@ module.exports = {
getImageVersion, getImageVersion,
getMockData, getMockData,
imgToBase64, imgToBase64,
updateMockData updateMockData,
getBydMockData
} }
\ No newline at end of file \ No newline at end of file
...@@ -409,10 +409,6 @@ export default { ...@@ -409,10 +409,6 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <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 { .record-box {
box-sizing: border-box; box-sizing: border-box;
height: 100%; height: 100%;
...@@ -593,7 +589,7 @@ export default { ...@@ -593,7 +589,7 @@ export default {
} }
.num-box { .num-box {
.num { .num {
font-family: 'numberBold'; font-family: 'number-700';
font-size: 48rpx; font-size: 48rpx;
font-weight: 700; font-weight: 700;
margin: 0 4rpx; margin: 0 4rpx;
......
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
}) })
uni.hideLoading() uni.hideLoading()
userInfo.channelType = res.channelType || 1 // 默认1 1问界 2 比亚迪 3 其他 userInfo.channelType = res.channelType || 1 // 默认1 1问界 2 比亚迪 3 其他
// userInfo.channelType = 3 // userInfo.channelType = 2
uni.$storage.set('userInfo', userInfo) uni.$storage.set('userInfo', userInfo)
let url = { let url = {
1: '/pages/boutique/index', 1: '/pages/boutique/index',
......
...@@ -298,6 +298,7 @@ export default { ...@@ -298,6 +298,7 @@ export default {
.li-number { .li-number {
font-size: 32rpx; font-size: 32rpx;
margin-right: 12rpx; margin-right: 12rpx;
font-family: 'number-400'
} }
.li-content { .li-content {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</view> </view>
<template v-for="(item, index) in media"> <template v-for="(item, index) in media">
<view <view
:class="['view', { showView: id == item.id }]" :class="['view', { showView: id == item.id }, modeName]"
:key="index" :key="index"
@touchstart.stop="touchStart" @touchstart.stop="touchStart"
@touchend.stop="touchEnd" @touchend.stop="touchEnd"
...@@ -123,7 +123,8 @@ export default { ...@@ -123,7 +123,8 @@ export default {
screenWidth: null, screenWidth: null,
scaleValueObject: {}, scaleValueObject: {},
showPayPage: false, showPayPage: false,
productModelStatus: false productModelStatus: false,
modeName: ''
}; };
}, },
computed: { computed: {
...@@ -213,18 +214,30 @@ export default { ...@@ -213,18 +214,30 @@ export default {
if (Math.abs(this.startY - touch.pageY) > 100) return if (Math.abs(this.startY - touch.pageY) > 100) return
if (!scaleValueObject[id]) scaleValueObject[id] = 1 if (!scaleValueObject[id]) scaleValueObject[id] = 1
if (isDistanceSignificant && index != -1 && scaleValueObject[id] == 1 && !productModelStatus) { 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) this.$emit('update:id', nextId)
setTimeout(() => {
this.modeName = ''
}, 300)
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
}, },
getNextId (index, toolList, startX, halfScreenWidth) { getNextId (index, toolList, startX, halfScreenWidth) {
let nextId = '',
modeName = ''
if (startX > halfScreenWidth) { 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 { } 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) { scale (e) {
...@@ -264,31 +277,27 @@ export default { ...@@ -264,31 +277,27 @@ export default {
top: 0; top: 0;
left: 0; left: 0;
visibility: hidden; visibility: hidden;
// display: none;
} }
.showView { .showView {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
visibility: visible; visibility: visible;
// display: block;
animation: show-content-left 0.15s forwards;
} }
.pen-box { .to-left {
position: fixed; animation: to-left 0.25s forwards;
right: 40rpx; }
top: 5%; .to-right {
width: 120rpx; animation: to-right 0.25s forwards;
height: 120rpx; }
z-index: 10; @keyframes to-left {
box-shadow: 0 4px 12px 0 #00000033; 0% {
border-radius: 16rpx; left: -100%;
overflow: hidden; }
image { 100% {
width: 100%; left: 0;
height: 100%;
} }
} }
@keyframes show-content-left { @keyframes to-right {
0% { 0% {
left: 100%; left: 100%;
} }
......
...@@ -162,23 +162,33 @@ export default { ...@@ -162,23 +162,33 @@ export default {
}, },
// 查询素材 // 查询素材
async getSoure () { async getSoure () {
let { moduleList, toolList,
default_moduleList, default_toolList,
byd_moduleList, byd_toolList
} = await uni.$api.systemApi.getMockData(true)
/**比亚迪 */ /**比亚迪 */
if (this.channelType == 2) { 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) if (e.receptionSourceDetailList)
e.receptionSourceDetailList = await uni.$api.systemApi.imgToBase64( e.receptionSourceDetailList = await uni.$api.systemApi.imgToBase64(
e.receptionSourceDetailList, e.receptionSourceDetailList,
"detailUrl" "detailUrl"
); );
}) })
byd_toolList = await uni.$api.systemApi.imgToBase64(byd_toolList, "shortTitleUrl") toolList = await uni.$api.systemApi.imgToBase64(toolList, "shortTitleUrl")
} else if (this.channelType == 3) { 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"); default_toolList = await uni.$api.systemApi.imgToBase64(default_toolList, "shortTitleUrl");
_moduleList = default_moduleList
_toolList = default_toolList
} else { } else {
/**默认问界 */ /**默认问界 */
await moduleList.map(async (e) => { await moduleList.map(async (e) => {
...@@ -199,18 +209,19 @@ export default { ...@@ -199,18 +209,19 @@ export default {
) )
}); });
toolList = await uni.$api.systemApi.imgToBase64(toolList, "shortTitleUrl") toolList = await uni.$api.systemApi.imgToBase64(toolList, "shortTitleUrl")
_moduleList = moduleList
_toolList = toolList
} }
uni.$api.systemApi.updateMockData({ uni.$api.systemApi.updateMockData({
default_moduleList, default_moduleList,
default_toolList, default_toolList,
byd_moduleList,
byd_toolList,
moduleList, moduleList,
toolList toolList
}, ["moduleList", 'toolList', }, ["moduleList", 'toolList',
'default_moduleList', 'default_toolList', 'default_moduleList', 'default_toolList',
'byd_moduleList','byd_toolList' ], 'mock_data')
]); this.setViewInfo(_moduleList, _toolList)
}
}, },
errorImg (index) { errorImg (index) {
this.moduleList[index].showAlt = true; this.moduleList[index].showAlt = true;
...@@ -338,26 +349,36 @@ export default { ...@@ -338,26 +349,36 @@ export default {
} }
}, },
/**素材内容 */ /**素材内容 */
setViewInfo () { 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 { const {
default_moduleList, default_moduleList,
default_toolList, default_toolList,
byd_moduleList,
byd_toolList,
moduleList, moduleList,
toolList toolList
} = uni.$storage.get("mock_data") || {} } = uni.$storage.get("mock_data") || {}
this.moduleList = { this.moduleList = {
3: default_moduleList, 3: default_moduleList,
2: byd_moduleList,
1: moduleList 1: moduleList
}[this.channelType] }[this.channelType]
this.toolList = { this.toolList = {
3: default_toolList, 3: default_toolList,
2: byd_toolList,
1: toolList 1: toolList
}[this.channelType] }[this.channelType]
} }
}
}, },
}; };
</script> </script>
......
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
*/ */
@import './assets/css/sprite.scss'; @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 { @keyframes show-view {
0% { 0% {
opacity: 0; opacity: 0;
......
...@@ -21,9 +21,5 @@ export const STORAGE_OBJECTkEY = { ...@@ -21,9 +21,5 @@ export const STORAGE_OBJECTkEY = {
recordSuccessList: "recordSuccessList", recordSuccessList: "recordSuccessList",
historyList: "historyList", historyList: "historyList",
storageVersion: "storageVersion", 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!