Blame view

pages/my/settings/index.vue 1.26 KB
290144e9   易尊强   第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  <template>
  	<view class="settings-v">
  		<u-cell-group>
  			<!-- #ifdef APP-PLUS -->
  			<u-cell-item title="用户协议" @click='openPage(agreement)'></u-cell-item>
  			<u-cell-item title="隐私政策" @click='openPage(policy)'></u-cell-item>
  			<!-- #endif -->
  		</u-cell-group>
  		<view class="u-p-t-20">
  			<view class="logout-cell" hover-class="u-cell-hover" @click="logout">退出登录</view>
  		</view>
  	</view>
  </template>
  
  <script>
  	import resources from '@/libs/resources.js'
  	export default {
  		data() {
  			return {
  				// #ifdef APP-PLUS
  				agreement: resources.userAgreement,
  				policy: resources.privacyPolicy,
  				// #endif
  			};
  		},
  		methods: {
  			logout() {
  				uni.showModal({
  					title: '提示',
  					content: '确定退出当前账号吗?',
  					success: res => {
  						if (res.confirm) {
  							this.$store.dispatch('user/logout').then(() => {
  								uni.reLaunch({
  									url: '/pages/login/index'
  								})
  							})
  						}
  					}
  				})
  			},
  			// #ifdef APP-PLUS
  			openPage(url) {
  				plus.runtime.openURL(url);
  			}
  			// #endif
  		}
  	}
  </script>
  
  <style lang="scss">
  	page {
  		background-color: #f0f2f6;
  	}
  
  	.settings-v {
  		.logout-cell {
  			text-align: center;
  			font-size: 28rpx;
  			line-height: 100rpx;
  			background-color: #fff;
  		}
  	}
  </style>