Commit 35acc9d2 authored by mzx's avatar mzx

Merge remote-tracking branch 'origin/master'

parents 911dc1f9 d302c242
......@@ -5,7 +5,7 @@ VUE_APP_TITLE = 新区交通综合信息服务系统
ENV = 'production'
# 若依管理系统/生产环境
VUE_APP_BASE_API = 'http://49.232.167.247:22000'
VUE_APP_BASE_API = 'http://10.10.10.105:8082/trip-prod-api'
# 百度地图api
# https://api.map.baidu.com/
......
......@@ -31,3 +31,11 @@ export function addQuestionDetail(data) {
data: data
})
}
// 在登录的前提下,获取当前用户对于某一问卷的答题次数
export function getQuestionAnswerCountByUserId(id) {
return request({
url: '/answer/count/' + id,
method: 'get'
})
}
......@@ -36,7 +36,7 @@ border: 1px solid #CCCCCC;border-radius:0.3rem;padding: 0.25rem 1rem 0.25rem 1re
</bm-info-window>
<bm-control class="map__control" @wheel.native.stop>
<el-tabs class="tab-pane-style" type="border-card" v-model="operationTypeName"
@tab-click="clearAllRouteResult">
@tab-click="wrapTabChange">
<!--路径规划-->
<el-tab-pane active-background-color="#f0f0f0" label="路径规划" name="pathPlanning">
<div slot="label" style="text-align: center;">路径规划</div>
......@@ -918,17 +918,19 @@ export default {
},
/*地图加载完成*/
mapReady({BMap, map}) {
/*输入框赋值*/
this.navigator.form.start = this.$route.params.start
/*输入框赋值*/
this.navigator.form.end = this.$route.params.end
/*起始经纬度赋值*/
this.navigator.formControl.start.location = [this.$route.params.stratLocation.lat, this.$route.params.stratLocation.lng]
/*目的地经纬度赋值*/
this.navigator.formControl.end.location = [this.$route.params.endLocation.lat, this.$route.params.endLocation.lng]
console.log("起始点传进来的经纬度", this.navigator.formControl.start.location)
console.log("目的地传进来的经纬度", this.navigator.formControl.end.location)
this.direction()
if (this.$route.params.start && this.$route.params.end) {
/*输入框赋值*/
this.navigator.form.start = this.$route.params.start
/*输入框赋值*/
this.navigator.form.end = this.$route.params.end
/*起始经纬度赋值*/
this.navigator.formControl.start.location = [this.$route.params.stratLocation.lat, this.$route.params.stratLocation.lng]
/*目的地经纬度赋值*/
this.navigator.formControl.end.location = [this.$route.params.endLocation.lat, this.$route.params.endLocation.lng]
console.log("起始点传进来的经纬度", this.navigator.formControl.start.location)
console.log("目的地传进来的经纬度", this.navigator.formControl.end.location)
this.direction()
}
this.BMap = BMap
this.map = map
// 加载事故点
......@@ -1059,12 +1061,16 @@ export default {
})
})
},
/**
* 最外层tab切换
*/
wrapTabChange() {
this.handleSearch(2)
this.clearAllRouteResult()
},
/*清除所有的线路规划结果*/
clearAllRouteResult() {
this.handleSearch(2)
this.map.clearOverlays()
},
/*公交导航 originObj 起点对象 {lat, lng} destinationObj 终点对象 {lat, lng}
* origin 起点[纬度,经度] destination 终点[纬度,经度] origin_uid 起点uid? destination_uid 终点uid? */
......
......@@ -64,12 +64,12 @@ border: 1px solid #CCCCCC;border-radius:0.3rem;padding: 0.25rem 1rem 0.25rem 1re
<script>
import { parseTime } from '@/utils'
import { listQuestion } from '@/api/question/question'
import { getQuestionAnswerCountByUserId, listQuestion } from '@/api/question/question'
import NavList from '@/views/Home/components/NavList/index.vue'
import store from "@/store";
import {MessageBox} from "element-ui";
import {removeToken} from "@/utils/auth";
import router from "@/router";
import store from '@/store'
import { MessageBox } from 'element-ui'
import { removeToken } from '@/utils/auth'
import router from '@/router'
export default {
name: 'Questionnaire',
......@@ -112,6 +112,10 @@ export default {
},
// 跳转详情页方法
changeInfo(row) {
// 跳转前需要有几个判断
// 1. 先判断当前用户所在IP是否可以答题
// 2. 判断当前问卷是否可以免登录答题
// 3. 判断当前用户答题数是否超过此问卷最大答题数
console.log('row111', row)
// 获取当前IP
let num = 0
......@@ -133,7 +137,7 @@ export default {
// 判断此问卷是否需要登录权限
if (row.loginFlag === '1') {
// 当前token为空,不许登录
if (store.state.user.token === undefined) {
if (store.state.user.token === undefined || store.state.user.token === null) {
MessageBox.confirm('您的身份认证已失效,请重新登录', '认证失效', {
confirmButtonText: '前往登录',
cancelButtonText: '暂不登录',
......@@ -157,19 +161,44 @@ export default {
console.log('numnnnn', num)
if (num === 0) {
// 如果答题次数已经超过规定答题数,则不能点击进入详情页
if (row.answerNum > row.submitNum) {
// 登录状态
if (store.state.user.token !== undefined && store.state.user.token !== null) {
getQuestionAnswerCountByUserId(row.Id).then(response => {
if (row.answerNum > response.data) {
this.$router.push({
path: '/questionnaire/questionnaire-detail',
query: {
id: row.Id
}
})
} else {
this.$message({
message: '此问卷已达到最大提交次数',
type: 'warning'
})
}
})
} else {
this.$router.push({
path: '/questionnaire/questionnaire-detail',
query: {
id: row.Id
}
})
} else {
this.$message({
message: '此问卷已达到最大提交次数',
type: 'warning'
})
}
// if (row.answerNum > row.submitNum) {
// this.$router.push({
// path: '/questionnaire/questionnaire-detail',
// query: {
// id: row.Id
// }
// })
// } else {
// this.$message({
// message: '此问卷已达到最大提交次数',
// type: 'warning'
// })
// }
}
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment