about.vue 5.1 KB
Newer Older
1 2 3 4 5 6 7 8
<template>
	<view class="about">
		<view class="box">
			<image class="logoImg" :src="about.logo"></image>
			<text class="tip appName">{{about.appName}}</text>
			<text class="tip">Version {{version}}</text>
			<!--Sansnn-uQRCode组件来源,插件市场:https://ext.dcloud.net.cn/plugin?id=1287 微调后-->
			<Sansnn-uQRCode :text="about.download" :makeOnLoad="true" class="qrcode"></Sansnn-uQRCode>
9
			<text class="tip">{{$t('about.sacnQR')}} {{about.appName}} {{$t('about.client')}}</text>
10 11
		</view>
		<view class="copyright">
12
			<view class="agreement-box" v-for="(agreement,index) in agreements" :key="index">
13
				<text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text>
14
				<text class="hint" v-if="agreements.length-1>index">{{$t('about.and')}}</text>
15 16 17 18 19 20 21
			</view>
			<text class="hint">Copyright © {{year}}</text>
			<text class="hint">{{about.company}}</text>
		</view>
	</view>
</template>
<script>
22
// #ifdef APP
23
	import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
24
	const uniShare = new UniShare()
study夏羽's avatar
study夏羽 已提交
25
// #endif
26 27 28 29 30 31 32 33 34 35 36
	import uniIdPagesConfig from '@/uni_modules/uni-id-pages/config.js';
	export default {
		// #ifdef APP
		onBackPress({from}) {
			if(from=='backbutton'){
				this.$nextTick(function(){
					uniShare.hide()
				})
				return uniShare.isShow;
			}
		},
study夏羽's avatar
study夏羽 已提交
37
		// #endif
38 39 40 41 42 43 44
		onLoad() {
			// #ifdef APP-PLUS
			this.version = plus.runtime.version
			// #endif
		},
		computed: {
			uniStarterConfig() {
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
				console.log(getApp());
				return getApp().globalData.config
			},
			agreements() {
				if(!uniIdPagesConfig.agreements){
					return []
				}
				let {serviceUrl,privacyUrl} = uniIdPagesConfig.agreements
				return [
					{
						url:serviceUrl,
						title:"用户服务协议"
					},
					{
						url:privacyUrl,
						title:"隐私政策条款"
					}
				]
63
			}
64 65 66 67 68 69 70 71 72 73
		},
		data() {
			return {
				version: "V1.0.0",
				year: "2020",
				about: {}
			};
		},
		created() {
			this.about = this.uniStarterConfig.about
study夏羽's avatar
study夏羽 已提交
74
			console.log("this.about: ",this.about);
75
			uni.setNavigationBarTitle({
76
				title: this.$t('about.about')+ " " + this.about.appName
77 78 79 80 81 82 83 84 85 86
			})
			this.year = (new Date).getFullYear()
		},
		onNavigationBarButtonTap() {
			let {
				download,
				appName,
				slogan,
				logo
			} = this.about
87
			uniShare.show({
88 89 90 91 92 93 94 95 96
				content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
					type: 0,
					href: download,
					title: appName,
					summary: slogan,
					imageUrl: logo + '?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决,在ios端分享图过大导致的图片失效问题
				},
				menus: [{
						"img": "/static/app-plus/sharemenu/wechatfriend.png",
study夏羽's avatar
update  
study夏羽 已提交
97
						"text": this.$t('common.wechatFriends'),
98 99 100 101 102 103 104
						"share": {
							"provider": "weixin",
							"scene": "WXSceneSession"
						}
					},
					{
						"img": "/static/app-plus/sharemenu/wechatmoments.png",
study夏羽's avatar
update  
study夏羽 已提交
105
						"text":  this.$t('common.wechatBbs'),
106 107
						"share": {
							"provider": "weixin",
study夏羽's avatar
study夏羽 已提交
108
							"scene": "WXSceneTimeline"
109 110 111 112
						}
					},
					{
						"img": "/static/app-plus/sharemenu/weibo.png",
study夏羽's avatar
update  
study夏羽 已提交
113
						"text":  this.$t('common.weibo'),
114 115 116 117 118 119 120 121 122 123 124 125 126
						"share": {
							"provider": "sinaweibo"
						}
					},
					{
						"img": "/static/app-plus/sharemenu/qq.png",
						"text": "QQ",
						"share": {
							"provider": "qq"
						}
					},
					{
						"img": "/static/app-plus/sharemenu/copyurl.png",
study夏羽's avatar
update  
study夏羽 已提交
127
						"text": this.$t('common.copy'),
128 129 130 131
						"share": "copyurl"
					},
					{
						"img": "/static/app-plus/sharemenu/more.png",
study夏羽's avatar
update  
study夏羽 已提交
132
						"text": this.$t('common.more'),
133 134 135
						"share": "shareSystem"
					}
				],
study夏羽's avatar
update  
study夏羽 已提交
136
				cancelText: this.$t('common.cancelShare'),
137 138 139 140 141 142 143 144 145 146
			}, e => { //callback
				console.log(e);
			})
		},
		methods: {
			navigateTo({
				url,
				title
			}) {
				uni.navigateTo({
147
					url: '/pages/common/webview/webview?url=' + url + '&title=' + title,
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>
<style lang="scss" scoped>
	/* #ifndef APP-NVUE */
	view {
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
	}
	/* #endif */
	.about {
165 166
		flex-direction: column;
		justify-content: center;
study夏羽's avatar
update  
study夏羽 已提交
167
		align-items: center;
168 169 170
	}

	.box {
171
		margin-top: 60px;
172 173 174 175 176 177
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.logoImg {
178 179 180
		margin-bottom: 10rpx;
		width: 160rpx;
		height: 160rpx;
181 182 183
		border-radius: 15px;
	}

184
	.tip {
185
		text-align: center;
186
		font-size: 24rpx;
187
		margin-top: 10px;
188
		padding: 10rpx;
189 190 191 192 193 194 195 196 197
	}

	.appName {
		margin-top: 20px;
		font-size: 42rpx;
		font-weight: 500;
	}

	.qrcode {
198
		margin-top: 60rpx;
199 200 201 202 203 204 205 206
	}

	.copyright {
		font-size: 32rpx;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		bottom: 20px;
study夏羽's avatar
update  
study夏羽 已提交
207
		// left: 0;
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
		position: fixed;
	}

	.agreement-box {
		justify-content: center;
	}

	.agreement {
		color: #2285ff;
		font-size: 26rpx;
	}

	.hint {
		text-align: center;
		color: #999999;
		font-size: 26rpx;
	}
225
</style>