| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <template>
- <view class="main-path uni-row" :style="style ? style : 'justify-content: space-evenly;'" v-for="num of pathListLen"
- :key="'row-' + num">
- <template v-for="(item, index) in pathList['row'+ num]" :key="'row-' + num + '-' + index">
- <view v-if="item.type == 1 || item.type == 2">
- <image mode="aspectFit" class="pathimg" :src="item.img" @click="onPathImgClick(item)">
- </image>
- </view>
- <view v-if="item.type == 3" class="path-nav uni-row uni-aie">
- <image mode="aspectFit" class="pathimg2" :src="item.pathImg" @click="onPathImgClick(item, 'path')">
- </image>
- <view class="uni-column">
- <image mode="aspectFit" class="navimg" :src="item.navImg" @click="onPathImgClick(item, 'nav')">
- </image>
- <text class="navtext">(导航)</text>
- </view>
- </view>
- <view v-if="item.type == 4" class="path-nav uni-column">
- <view class="uni-column">
- <image mode="aspectFit" class="pathimg3" :src="item.pathImg" @click="onPathImgClick(item, 'path')">
- </image>
- <text class="pathName" v-html="item.pathName"></text>
- </view>
- <view class="uni-column">
- <image mode="aspectFit" class="navimg2" :src="item.navImg" @click="onPathImgClick(item, 'nav')">
- </image>
- <text class="navtext">(导航)</text>
- </view>
- </view>
- </template>
- <view v-if="showLine && num < pathListLen" class="line"></view>
- </view>
-
- <uni-popup ref="alertDialog" type="dialog">
- <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="提示" :content="alertDialog.content"
- @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
- </uni-popup>
- </template>
- <script>
- import tools from '/common/tools';
- export default {
- name: "my-pathList",
- props: {
- pathList: {}, // type 1: 比赛路线 2: 导航到指定地点 3: 比赛路线 + 导航
- mcState: 0, // 赛事/活动状态 0: 未开始 1: 进行中 2: 已结束
- selectedPath: 0, // 用户已选择的路线(ocaId)
- showLine: false, // 是否显示线条
- style: ""
- },
- emits: ['onPathClick'],
- data() {
- return {
- navPoint: {},
- alertDialog: {
- content: "",
- data: null
- }
- };
- },
- computed: {
- pathListLen() {
- return Object.keys(this.pathList).length;
- }
- },
- mounted() {
- },
- methods: {
- onPathImgClick(item, type = '') {
- // console.log("onPathImgClick");
- //item.type 1: 比赛路线 2: 导航到指定地点
- if (item.type == 1) {
- this.dealPathClick(item);
- } else if (item.type == 2) {
- this.dealNavClick(item);
- } else if (item.type >= 3) {
- if (type == 'path') {
- this.dealPathClick(item);
- } else if (type == 'nav') {
- this.dealNavClick(item);
- }
- }
- },
- dealPathClick(item) {
- // 赛事/活动状态 0: 未开始 1: 进行中 2: 已结束
- if (this.mcState == 1) {
- if (this.selectedPath > 0 && this.selectedPath != item.path.ocaId) {
- this.alertDialog.content = "该路线与您之前选择的不一致,确定要更换路线吗?"
- this.alertDialog.data = item;
- this.$refs.alertDialog.open();
- } else {
- const url = `action://to_detail/?id=${item.path.ocaId}&matchType=${item.path.mcType}`;
- tools.appAction(url);
- this.$emit('onPathClick', item);
- }
- } else if (this.mcState == 0) {
- uni.showToast({
- title: '比赛尚未开始',
- icon: 'none',
- duration: 3000
- });
- } else if (this.mcState == 2) {
- uni.showToast({
- title: '比赛已结束',
- icon: 'none',
- duration: 3000
- });
- }
- },
- dealNavClick(item) {
- this.navPoint = item.point;
- // this.$refs.mypopupmap.popupOpen();
- const url =
- `action://to_map_app?title=${this.navPoint.name}&latitude=${this.navPoint.latitude}&longitude=${this.navPoint.longitude}`;
- tools.appAction(url);
- },
- dialogConfirm() {
- const item = this.alertDialog.data;
- const url = `action://to_detail/?id=${item.path.ocaId}&matchType=${item.path.mcType}`;
- tools.appAction(url);
- this.$emit('onPathClick', item);
- },
- dialogClose() {
- }
- }
- }
- </script>
- <style scoped>
- .pathimg {
- width: 127px;
- height: 115px;
- }
- .pathimg2 {
- width: 106px;
- height: 80px;
- }
- .pathimg3 {
- width: 141px;
- height: 141px;
- }
-
- .pathName {
- font-weight: 500;
- color: #383838;
- font-size: 16px;
- line-height: 36px;
- font-family: Source Han Sans CN;
- }
-
- .navimg {
- width: 25px;
- height: 25px;
- }
- .navimg2 {
- width: 44px;
- height: 65px;
- margin-top: 20px;
- }
-
- .navtext {
- font-weight: 500;
- color: #aaaaaa;
- font-size: 10px;
- font-family: Source Han Sans CN;
- }
- .main-path {
- width: 90%;
- margin-top: 10px;
- margin-bottom: 10px;
- flex-wrap: wrap;
- /* justify-content: flex-start; */
- /* justify-content: space-evenly; */
- }
- .path-nav {
- width: 50%;
- justify-content: center;
- }
- .line {
- width: 100%;
- height: 0px;
- margin: 20px 5% 0 5%;
- border: 1px dashed;
- border-color: #c6c6c6;
- }
- </style>
|