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

	.box {
177
		margin-top: 60px;
178 179 180 181 182 183
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.logoImg {
184 185 186
		margin-bottom: 10rpx;
		width: 160rpx;
		height: 160rpx;
187 188 189
		border-radius: 15px;
	}

190
	.tip {
191
		text-align: center;
192
		font-size: 24rpx;
193
		margin-top: 10px;
194
		padding: 10rpx;
195 196 197 198 199 200 201 202
	}

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

study夏羽's avatar
study夏羽 已提交
203 204 205
	.qrcode ,.qrcode .uqrcode{
		margin: 10px 0;
		width: 100px;
206
		height: 100px;
study夏羽's avatar
study夏羽 已提交
207 208 209 210
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
	}
211 212 213 214 215 216 217

	.copyright {
		font-size: 32rpx;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		bottom: 20px;
study夏羽's avatar
update  
study夏羽 已提交
218
		// left: 0;
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
		position: fixed;
	}

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

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

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