蟑螂恶霸 3 years ago
parent
commit
3fa459dd71
  1. 9
      subpkg/list/list.vue
  2. 25
      subpkg/role/role.vue

9
subpkg/list/list.vue

@ -41,6 +41,7 @@
pageSize:10 pageSize:10
}, },
total:0, total:0,
search: false,
isloading:false, isloading:false,
//轮播图数据列表 //轮播图数据列表
swiperList: [], swiperList: [],
@ -77,7 +78,12 @@
res.rows.forEach(item=>{ res.rows.forEach(item=>{
item.uploadPath = uni.$http.baseUrl +item.uploadPath item.uploadPath = uni.$http.baseUrl +item.uploadPath
}) })
if (this.search) {
this.sceneList = res.rows
this.search = false
} else {
this.sceneList =[...this.sceneList,...res.rows] this.sceneList =[...this.sceneList,...res.rows]
}
this.total = res.total this.total = res.total
// uni.$showMsg('数据请求成功!') // uni.$showMsg('数据请求成功!')
}, },
@ -92,7 +98,8 @@
clearTimeout(this.timer) clearTimeout(this.timer)
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
this.name = e this.queryObj.name = e
this.search = true
this.getSceneList() this.getSceneList()
}, 500) }, 500)
}, },

25
subpkg/role/role.vue

@ -8,7 +8,8 @@
<view class="<strong>contit</strong>">请选择您在“<font style="color:#fd6d1f;">{{sceneName}}</font>”演练中的角色:</view> <view class="<strong>contit</strong>">请选择您在“<font style="color:#fd6d1f;">{{sceneName}}</font>”演练中的角色:</view>
<view class="role_box"> <view class="role_box">
<block class="role-item" v-for="(item,i) in roleList" :key="i"> <block class="role-item" v-for="(item,i) in roleList" :key="i">
<span @click="startPractice(item)">{{item.name}}</span> <span :class="item.choose === 'true' ? 'change_color':''" @click="chooseRole(item)">{{item.name}}</span>
<!-- <span class="spanitem" @click="chooseRole(item)">{{item.name}}</span> -->
</block> </block>
</view> </view>
<view class="more_role" @click="showMoreRole()"><a>更多角色</a></view> <view class="more_role" @click="showMoreRole()"><a>更多角色</a></view>
@ -86,12 +87,28 @@
} = await uni.$http.post('/small/project/role/listAll',{sceneId: this.sceneId}) } = await uni.$http.post('/small/project/role/listAll',{sceneId: this.sceneId})
if (!res.success) return uni.$showMsg() if (!res.success) return uni.$showMsg()
res.data.forEach(item=>{
this.$set(item, 'choose', 'false')
})
this.roleList = res.data this.roleList = res.data
//uni.$showMsg('数据请求成功!') //uni.$showMsg('数据请求成功!')
}, },
chooseRole(item){
if (item.choose === "true") {
this.$set(item, 'choose', 'false')
this.roleId = ''
} else if(item.choose === "false"){
this.roleList.forEach(item=>{this.$set(item, 'choose', 'false')})
this.$set(item, 'choose', 'true')
this.roleId = item.guid
}
},
startPractice(item) { startPractice(item) {
if (this.roleId === "") {
return uni.$showMsg('请先选择一个角色')
}
uni.navigateTo({ uni.navigateTo({
url: '/subpkg/practice/practice?roleId='+item.guid url: '/subpkg/practice/practice?roleId='+this.roleId
}) })
}, },
back(){ back(){
@ -288,5 +305,9 @@
line-height: 3.0; line-height: 3.0;
letter-spacing: 2px; letter-spacing: 2px;
} }
.change_color{
background:rgba(138, 162, 254, 1.0);
}
</style> </style>
Loading…
Cancel
Save