uni-agreements.vue 1.4 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2
<template>
	<view class="root">
3
		<checkbox-group @change="setAgree" class="checkbox-group">
4
			<checkbox  style="transform: scale(0.7);" />
5
			<text>{{$t('common.agree')}}</text>
6
		</checkbox-group>
7
		<view class="item" v-for="(agreement,index) in agreements" :key="index">
DCloud_JSON's avatar
DCloud_JSON 已提交
8
			<text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text>
9
			<text class="hint" v-if="hasAnd(agreements,index)">&</text>
10
		</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
11 12 13 14 15 16 17 18
	</view>
</template>

<script>
	export default {
		name:"uni-agreements",
		computed:{
			agreements(){
DCloud_JSON's avatar
DCloud_JSON 已提交
19
				return getApp().globalData.config.about.agreements||[]
DCloud_JSON's avatar
DCloud_JSON 已提交
20 21 22 23 24 25 26 27 28 29
			}
		},
		methods:{
			navigateTo({url,title}){
				uni.navigateTo({
					url: '/pages/common/webview/webview?url='+url+'&title='+title,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
DCloud_JSON's avatar
DCloud_JSON 已提交
30 31 32
			},
			hasAnd(agreements,index){
				return agreements.length-1>index
33 34 35 36
			},
			setAgree(e){
				this.isAgree = !this.isAgree
				this.$emit('setAgree',this.isAgree)
DCloud_JSON's avatar
DCloud_JSON 已提交
37 38 39 40
			}
		},
		data() {
			return {
41
				isAgree:false
DCloud_JSON's avatar
DCloud_JSON 已提交
42 43 44 45 46
			};
		}
	}
</script>

47 48 49 50 51 52 53 54
<style lang="scss" scoped>
/* #ifndef APP-NVUE */
view{
	display: flex;
	box-sizing: border-box;
	flex-direction: column;
}
/* #endif */
DCloud_JSON's avatar
DCloud_JSON 已提交
55 56
.root{
	flex-direction: row;
57
	align-items: center;
DCloud_JSON's avatar
DCloud_JSON 已提交
58 59 60
	font-size: 28rpx;
	color: #8a8f8b;
}
61
.checkbox-group{
62
	align-items: center;
63 64 65
	display: flex;
	flex-direction: row;
}
66 67 68
.item{
	flex-direction: row;
}
DCloud_JSON's avatar
DCloud_JSON 已提交
69 70 71 72
.agreement{
	color:#04498c;
}
</style>