mytrain.vue 988 Bytes
<template>
	
	<uni-segmented-control :current="current"  styleType="text" :values="items"
	 activeColor="#AD181F"  @clickItem="onClickItem" ></uni-segmented-control>
	<view>
		<view class="nodata" v-if="list.length == 0">
			<image mode="aspectFit" src="/static/nodata.png"></image>
			<text>暂无数据</text>
		</view>
	</view>
</template>

<script setup>
	import * as my from '@/myCenter/center_api.js';
	import { ref } from 'vue';
	import { onLoad, onShow } from '@dcloudio/uni-app';
	const app = getApp();
	const items = ref([
		'培训', '订单'
	])
	const current = ref(0)
	const list = ref([])
	onShow(() => {
		if (app.globalData.isLogin) {
			init();
		} else {
			app.firstLoadCallback = () => {
				init();
			};
		}
	});
	function init(){
		my.getMyTrain().then(res=>{
			list.value = res.rows
		})
	}
	function onClickItem(e){
		console.log(e)
		if(e.currentIndex==1){
			
			uni.navigateTo({
				url: `/myCenter/mytrain/myBill`
			});
		}
	}
</script>

<style>

</style>