123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <view class="ref" style="background-color: #fff;height: 100%;">
- <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
- :background="background" title-width="300" :title="i18n('setUp')"></u-navbar>
- <!-- 订阅设置 -->
- <list-cell iconColor="#333" :title="$t('common.Subscription')"
- @eventClick="navTo('/pages/profile/profileSetUp/subscribe')"></list-cell>
- <!-- 账号安全 -->
- <list-cell iconColor="#333" :title="$t('common.AccountSecurity')"
- @eventClick="navTo('/pages/profile/profileSetUp/accountSecurity')"></list-cell>
- <!-- 注销服务 -->
- <list-cell iconColor="#333" :title="$t('common.Cancellation')"
- @eventClick="navTo('/pages/profile/profileSetUp/cancellationOfAccount')"></list-cell>
- <!-- 清除缓存 -->
- <!-- <list-cell iconColor="#333" :title="$t('common.ClearCache')"></list-cell> -->
- <!-- <view class="border"></view> -->
- <view class="backLogin">
- <!-- <button type="fff" style="">切换账户</button> -->
- <!-- <view class="border"></view> -->
- <u-button type='primary' @click="showModal">{{i18n('Logout')}}</u-button>
- </view>
- <u-modal v-model="show" :content="content" :cancel-text="$i18n.locale == 'zh'?'取消':'cancel'" :show-title="false"
- :confirm-text="$i18n.locale === 'zh'?'确认':'confirm'" @confirm="confirm" @cancel="cancel"
- :show-cancel-button="true"></u-modal>
- </view>
- </template>
- <script>
- import listCell from '@/components/JumpBox';
- export default {
- components: {
- listCell
- },
- data() {
- return {
- Storage_data: null,
- AuthToken: null,
- show: false,
- content: this.$i18n.locale === 'zh' ? '是否退出登录?' : 'Log out?',
- background: {
- backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
- },
- backStyle: {
- color: '#FFFFFF',
- },
- };
- },
- onShow() {
- },
- onLoad() {
- try {
- this.Storage_data = JSON.parse(uni.getStorageSync('user'));
- this.AuthToken = uni.getStorageSync('Auth-Token');
- } catch (e) {
- };
- },
- methods: {
- showModal() {
- this.show = true;
- },
- confirm() {
- // setTimeout(() => {
- // 3秒后自动关闭
- this.show = false;
- // 如果不想关闭,而单是清除loading状态,需要通过ref手动调用方法
- // this.$refs.uModal.clearLoading();
- this.backLogin();
- // }, 3000)
- },
- cancel() {
- this.show = false;
- },
- backLogin() {
- try {
- uni.removeStorageSync('Auth-Token');
- uni.removeStorageSync('user');
- // uni.redirectTo({
- // url: '/pages/profile/profile'
- // });
- this.Storage_data = null;
- this.AuthToken = null;
- console.log(this.AuthToken, '========', uni.getStorageSync('Auth-Token'))
- uni.reLaunch({
- // url: '/pages/public/login'
- url: '/pages/index/index'
- });
- } catch (e) {
- };
- },
- i18n(data) {
- return this.$t('common.' + data);
- },
- navTo(route) {
- this.$mRouter.push({
- route
- });
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background-color: #fff;
- // height: 100%;
- }
- .border {
- background-color: #f3f4f6;
- height: 20upx;
- width: 100%;
- }
- .ref {
- position: relative;
- }
- .backLogin {
- // position: absolute;
- width: 90%;
- // top: 240upx;
- margin: 600upx 10upx 0upx 40upx;
- }
- </style>
|