index.vue 5.99 KB
<template>
	<view class="page">
		<view>
			<view>您好!<br />欢迎使用中跆协会员管理系统</view>
			<view class="flexbox">
				<view>添加会员</view>
				<view>会员缴费</view>
				<view>缴费审核</view>
			</view>

		</view>
		<uni-section padding>
			<uni-grid :column="4" :show-border="false" :square="false" @change="change">
				<uni-grid-item v-for="(item ,index) in list" :index="index" :key="index">
					<view class="grid-item-box">
						<image class="image" :src="item.url" mode="aspectFill" />
						<text class="text">{{item.text}}</text>
						<view v-if="item.badge" class="grid-dot">
							<uni-badge :text="item.badge" :type="item.type" />
						</view>
					</view>
				</uni-grid-item>
			</uni-grid>
		</uni-section>
		<uni-section title="代办提醒" padding>
			<template v-slot:right>
				更多
			</template>
			<view class="msglist">
				<view class="msgitem" v-for="n in 4">
					<text class="dot"></text>
					<view class="tt esp">你有一条会员缴费等待审批,点击前去处理!</view>
					<view class="date">2023-09-23</view>
				</view>
			</view>
		</uni-section>
	</view>
</template>

<script setup>
	import * as api from '@/common/api.js';
	import * as loginServer from '@/common/login.js';
	import {
		getWxUser,
		getWxUserPhone
	} from '@/common/login.js';
	import {
		onLoad,
		onShow,
		onReady,
		onShareAppMessage,
		onShareTimeline,
		onPullDownRefresh
	} from '@dcloudio/uni-app';
	import {
		ref,
		getCurrentInstance
	} from 'vue';


	const {
		proxy
	} = getCurrentInstance()
	const app = getApp();


	let proId;
	let goPath;
	const svId = ref(null);
	const list = ref([{
			url: '/static/c1.png',
			text: '会员调动',
			badge: '0',
			type: "primary"
		},
		{
			url: '/static/c2.png',
			text: '调动审核',
			badge: '1',
			type: "success"
		},
		{
			url: '/static/c3.png',
			text: '级位考试申请',
			badge: '99',
			type: "warning"
		},
		{
			url: '/static/c4.png',
			text: '级位考试审核',
			badge: '2',
			type: "error"
		},
		{
			url: '/static/c5.png',
			text: '段位考试申请'
		},
		{
			url: '/static/c6.png',
			text: '段位考试审核'
		},
		{
			url: '/static/c7.png',
			text: '级位证书发送'
		},
		{
			url: '/static/c8.png',
			text: '段位证书发送'
		}
	]);

	onShow(() => {
		if (app.globalData.isLogin) {
			init();
		} else {
			app.firstLoadCallback = () => {
				init();
			};
		}
	})
	onLoad(option => {
		if (option.scene) {
			proId = decodeURIComponent(option.scene);
		} else {
			proId = option.proId;
		}

	});
	onReady(() => {
		proxy._mapContext = uni.createMapContext("map", this)
	})

	let currUser

	function checkUserPhone(path) {
		currUser = uni.getStorageSync('currUser')
		if (!currUser) {
			loginServer.pcLogin().then(() => {
				currUser = uni.getStorageSync('currUser')
				if (currUser.phonenumber) {
					debugger
					return true
				} else {
					popYanZheng.value.open()
					goPath = path
					return false;
				}
			});
		} else {
			if (currUser.phonenumber) {
				return true
			} else {
				popYanZheng.value.open()
				goPath = path
				return false;
			}
		}
	}

	function decryptPhoneNumber(res) {
		// console.log(res)
		loading.value = true
		if (res.detail.errMsg.indexOf('ok') > -1) {
			getWxUserPhone(res.detail).then((data) => {
				console.log(data)
				popYanZheng.value.close()
				uni.redirectTo({
					url: goPath
				})
			}).finally(() => {
				loading.value = false
			});
		} else {
			loading.value = false
		}
	}

	function clickImg() {
		uni.previewImage({
			urls: venue.value.venuePicArr,
			// current: 0,
			success: function(res) {
				console.log('success', res)
			},
			fail: function(res) {
				console.log('fail', res)
			},
			complete: function(res) {
				console.log('complete', res)
			}
		})
	}


	function goCenter() {
		let path = '/pages/usercenter/usercenter';
		if (checkUserPhone(path)) {
			uni.navigateTo({
				url: path
			});
		}
	}

	function popupClose() {
		popup.value.close();
	}

	function init() {
		venue.value = app.globalData.venue
		latitude.value = app.globalData.venue.latitude
		longitude.value = app.globalData.venue.longitude
		// 修改页头标题
		uni.setNavigationBarTitle({
			title: venue.value.venueName
		});
	}

	function open() {
		popup.value.open();
	}

	function makeCall() {
		uni.makePhoneCall({
			phoneNumber: venue.value.venueTelno
		});
	}

	function gogo() {
		//拉起导航软件
		proxy._mapContext.openMapApp({
			latitude: parseFloat(latitude.value),
			longitude: parseFloat(longitude.value),
			destination: venue.value.venueAddress, //目标地址详情
			success() {
				console.log('success');
			},
			fail() {
				console.log('fail');
				uni.showToast({
					title: '请安装导航软件',
					icon: 'none',
					duration: 2000
				});
			},
			complete() {
				console.log('complete');
			}
		});
	}

	function closeMaptypeList() {
		this.showH5maptype = false;
	}

	function goItem(item) {
		if (item.path) {
			let path = item.path
			// if (checkUserPhone(path)) {
			uni.navigateTo({
				url: item.path
			});
			// }
		} else {
			uni.showToast({
				title: `暂未开放`,
				icon: 'none'
			});
		}

	}
</script>
<style scope lang="scss">
	.flexbox {
		display: flex;
		justify-content: space-around;
	}

	.image {
		width: 25px;
		height: 25px;
	}

	.grid-item-box {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.grid-item-box-row {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.grid-dot {
		position: absolute;
		top: 5px;
		right: 15px;
	}
</style>