Commit 81723fcd by liwk

commit

1 parent 6aadce0b
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
VUE_APP_TITLE=广联运营平台 VUE_APP_TITLE=广联运营平台
# 网络请求公用地址 # 网络请求公用地址
#VUE_APP_API=https://wx.glsx.com.cn/rop-ddh-carlife/router #VUE_APP_API=https://wx.glsx.com.cn/rop-ddh-carlife/router
VUE_APP_API=https://qcwx.glsx.com.cn/rop-ddh-carlife/router #VUE_APP_API=https://qcwx.glsx.com.cn/rop-ddh-carlife/router
VUE_APP_API=http://192.168.1.102:8086/rop-ddh-carlife/router
# APPKEY # APPKEY
VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637 VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637
VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
\ No newline at end of file \ No newline at end of file
import request from './request' import request from './request'
export const scene = { export const equity = {
/**场景列表 */ /**365淘卷请求地址 */
getList() { getCouponList(data) {
return request({}, 'ddh.carlife.scene.getList') return request(data, 'ddh.carlife.equity.h5.365.coupon.url.get')
}, },
/**场景详情/ */ /** 获取会员权益卡 */
getSceneDetails(data) { getCardInfo() {
return request(data, 'ddh.carlife.scene.getById') return request({}, 'ddh.carlife.equity.h5.card.get')
},
/**场景开关 */
setSceneSwitch(data) {
return request(data, 'ddh.carlife.scene.updateStatus')
},
/**场景模版详情 */
getSceneTemplateDetails(data) {
return request(data, 'ddh.carlife.scene.template.getById ')
},
/**设备列表 */
getDevList(data = {}) {
return request(data, 'ddh.carlife.product.remote.getList')
},
/**获取设备ID */
getProductList(data) {
return request(data, 'ddh.carlife.product.getList')
},
/**获取设备指令 */
getConditionList() {
return request({}, 'ddh.carlife.product.type.getConditionList')
},
/** 获取设备任务列表 */
getContentList() {
return request({}, 'ddh.carlife.product.type.getContentList')
},
/**设置设备任务 */
setDevMission(data) {
return request(data, 'ddh.carlife.scene.orderValue.getList ')
},
/**新增场景 d*/
sceneSave(data) {
return request(data, 'ddh.carlife.scene.save ')
},
/** 埋点*/
getUseCount(data) {
return request(data, 'ddh.carlife.smadeviceinfo.getUseCount', 'GET')
},
/**红外设备 */
getRemotes(data) {
return request(data, 'ddh.carlife.smadeviceinfo.findRemotes', 'GET')
},
/**删除场景 */
deleteScene(data) {
return request(data, 'ddh.carlife.scene.delete')
},
/**家庭信息接口 */
getUserAddress() {
return request({}, 'ddh.carlife.intelligent.family.address.get')
},
/**手动执行 */
issueOrder(data) {
return request(data, ' ddh.carlife.scene.issueOrder', 'GET')
},
}
export const discover = {
/** 发现页banner */
getBannerList() {
return request({ functionType: 3 }, 'ddh.carlife.smadeviceinfo.getBannerList')
},
/**发现页 */
getDiscoverList() {
return request({}, 'ddh.carlife.scene.template.getList')
}, },
} }
\ No newline at end of file \ No newline at end of file
import { equity } from '@r/api.js'
export default { export default {
data() { data() {
return { return {
...@@ -6,22 +7,26 @@ export default { ...@@ -6,22 +7,26 @@ export default {
travelList: [{ travelList: [{
name: '全国加油', name: '全国加油',
icon: 'tuanyou', icon: 'tuanyou',
description: '8折起' description: '8折起',
id: 54
}, },
{ {
name: '青桔单车', name: '青桔单车',
icon: 'qingji', icon: 'qingji',
description: '6折起' description: '6折起',
typeId: 167
}, },
{ {
name: '滴滴出行', name: '滴滴出行',
icon: 'didi', icon: 'didi',
description: '9折起' description: '9折起',
typeId: 53
}, },
{ {
name: '哈喽单车', name: '哈喽单车',
icon: 'halou', icon: 'halou',
description: '7折起' description: '7折起',
typeId: 90
} }
], ],
hotelList: [{ hotelList: [{
...@@ -38,22 +43,26 @@ export default { ...@@ -38,22 +43,26 @@ export default {
cateringList: [{ cateringList: [{
name: '肯德基', name: '肯德基',
icon: 'kfc', icon: 'kfc',
description: '最高省81元' description: '最高省81元',
typeId: 23
}, },
{ {
name: '麦当劳', name: '麦当劳',
icon: 'm', icon: 'm',
description: '最高省44元' description: '最高省44元',
typeId: 64
}, },
{ {
name: '星巴克', name: '星巴克',
icon: 'xbk', icon: 'xbk',
description: '最高省17元' description: '最高省17元',
typeId: 21
}, },
{ {
name: '瑞幸咖啡', name: '瑞幸咖啡',
icon: 'ruixing', icon: 'ruixing',
description: '最高省10元' description: '最高省10元',
typeId: 148
} }
] ]
} }
...@@ -78,6 +87,21 @@ export default { ...@@ -78,6 +87,21 @@ export default {
}, },
updataNotice() { updataNotice() {
this.setNoticeInfo() this.setNoticeInfo()
},
jumpLink(e) {
let params = {
...e
}
delete params.name
delete params.icon
delete params.description
equity.getCouponList({
requestSource: 1,
...params
}).then(res => {
console.log(res)
// this.openWindows()
})
} }
}, },
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,15 +5,35 @@ import routes from './routes' ...@@ -5,15 +5,35 @@ import routes from './routes'
Vue.use(VueRouter) Vue.use(VueRouter)
const router = new VueRouter({ const router = new VueRouter({
routes routes
}) })
// import store from '@/store' import store from '@/store'
router.beforeEach(async(to, from, next) => { router.beforeEach(async(to, from, next) => {
const params = getParams(window.location.href)
if (params.sessionId) {
store.commit('setSessionId', params.sessionId)
store.commit('setUserId', params.userId)
}
let test = 'mini-3486f5a1-d407-4a38-90ee-5f1c9e122119-rop'
store.commit('setSessionId', test)
let { meta: { showTab, toTop, isDetail } } = to let { meta: { showTab, toTop, isDetail } } = to
Vue.prototype.TabShowHide = showTab || false Vue.prototype.TabShowHide = showTab || false
if (toTop) document.documentElement.scrollTop = 0 if (toTop) document.documentElement.scrollTop = 0
if (isDetail) Vue.prototype.goHome = !from.name if (isDetail) Vue.prototype.goHome = !from.name
next() next()
}) })
const getParams = str => {
let params = str.split('?')
if (params.length < 2) return {}
let param = params[1].split('&')
let obj = {}
for (let i = 0; i < param.length; i++) {
let paramsA = param[i].split('=')
let key = paramsA[0]
let value = paramsA[1]
obj[key] = value;
}
return obj
}
const originalPush = VueRouter.prototype.push const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) { VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err) return originalPush.call(this, location).catch(err => err)
......
export default {
state: {
sessionId: '',
activeIndex: 0,
userId: '',
clearFlag: false
},
mutations: {
setSessionId(state, newVal) {
state.sessionId = newVal
},
setUserId(state, newVal) {
state.userId = newVal
},
setActiveIndex(state, newVal) {
state.activeIndex = newVal
},
clearData(state, newVal) {
state.clearFlag = newVal
}
},
}
\ No newline at end of file \ No newline at end of file
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
Vue.use(Vuex) Vue.use(Vuex)
import commonStore from './commonStore'
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
...commonStore.state
}, },
mutations: { mutations: {
...commonStore.mutations,
}, },
}) })
\ No newline at end of file \ No newline at end of file
...@@ -111,6 +111,28 @@ const checkPhoneType = () => { ...@@ -111,6 +111,28 @@ const checkPhoneType = () => {
} }
return equipmentType return equipmentType
} }
const openWindows = (url, callBack) => {
if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateTo({
url: `/pages/commonWebView/commonWebView?path=${encodeURIComponent(url)}`
})
} else {
if (checkPhoneType() == 'ios') {
if (window.webkit && window.webkit.messageHandlers.jumpNativeApp) {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 4, url, needNavigator: 1 }))
} else {
callBack()
}
} else {
if (window.myjs) {
window.myjs.jumpNativeApp(JSON.stringify({ type: 4, url, needNavigator: 1 }))
} else {
callBack()
}
}
}
}
const utils = { const utils = {
removeLocalStorage, removeLocalStorage,
setLocalStorage, setLocalStorage,
...@@ -118,6 +140,7 @@ const utils = { ...@@ -118,6 +140,7 @@ const utils = {
checkPhoneType, checkPhoneType,
onPageScroll, onPageScroll,
showLoading, showLoading,
openWindows,
hideLoading, hideLoading,
touchstart, touchstart,
showToast, showToast,
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<div <div
class="item" class="item"
:key="index" :key="index"
@click="jumpLink(i)"
> >
<div :class="['sprite-icon',`icon-${i.icon}`]"></div> <div :class="['sprite-icon',`icon-${i.icon}`]"></div>
<div class="item-name">{{i.name}}</div> <div class="item-name">{{i.name}}</div>
...@@ -63,6 +64,7 @@ ...@@ -63,6 +64,7 @@
<div <div
class="item" class="item"
:key="index" :key="index"
@click="jumpLink(i)"
> >
<div :class="['sprite-icon',`icon-${i.icon}`]"></div> <div :class="['sprite-icon',`icon-${i.icon}`]"></div>
<div class="item-name">{{i.name}}</div> <div class="item-name">{{i.name}}</div>
...@@ -96,6 +98,7 @@ ...@@ -96,6 +98,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { indexMixin } from '@/mixins' import { indexMixin } from '@/mixins'
import { equity } from '@r/api.js'
export default { export default {
name: 'index', name: 'index',
data () { data () {
...@@ -107,6 +110,9 @@ export default { ...@@ -107,6 +110,9 @@ export default {
}, },
mixins: [indexMixin], mixins: [indexMixin],
mounted () { mounted () {
equity.getCardInfo().then(res => {
console.log(res)
})
}, },
methods: { methods: {
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!