123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <template>
- <view class="ezy-my-page">
- <view class="icon-title-navBar-box">
- <view @click="handleBack" class="nav-bar-icon"></view>
- <text class="nav-bar-title">应用设置</text>
- </view>
- <view class="my-list-box">
- <view class="list-row" @click="headClick">
- <icon class="list-icon tel-icon"></icon>
- <text>头像</text>
- <icon style="width: 20px;height: 20px;" class="head-img-box" :style="{backgroundImage: 'url(' + myInfoData.icon + ')'}"></icon>
- </view>
- <view class="list-row" @click="nichengClick">
- <icon class="list-icon tel-icon"></icon>
- <text>昵称</text>
- <text>{{myInfoData.nickName}}</text>
- </view>
- <view class="list-row" @click="telClick">
- <icon class="list-icon tel-icon"></icon>
- <text>手机号码</text>
- </view>
- <view class="list-row" @click="aboutClick">
- <icon class="list-icon about-icon"></icon>
- <text>关于我们</text>
- </view>
- <view v-if="loginFlag" class="list-row" @click="yonghuzhuxiao">
- <icon class="list-icon zhuxiao-icon"></icon>
- <text>用户注销</text>
- </view>
- <view v-if="loginFlag" class="list-row" @click="yinsizhengce">
- <icon class="list-icon yszc-icon"></icon>
- <text>隐私政策</text>
- </view>
- <view class="list-row" @click="kefudianhua">
- <icon class="list-icon kfdh-icon"></icon>
- <text>客服与投诉</text>
- <text>4001750778</text>
- </view>
- <view class="list-row" @click="exitLogin">
- <icon class="list-icon login-out-icon"></icon>
- <text>退出登录</text>
- </view>
- </view>
- <CustomTabBar :levelId="levelId" :currentTabNumber="3" :typeId="typeId" :subjectId="subjectId"
- :tipFlag="tipFlag">
- </CustomTabBar>
- <tip-small-dialog ref="exitDialogRef" @confirm-btn="exitBtn" :content="tipContent"></tip-small-dialog>
- <tip-small-dialog ref="zhuxiaoDialogRef" @confirm-btn="zhuxiaoBtn" :content="zhuxiaoContent"></tip-small-dialog>
- <duihuanmaDialog ref="duihuanmaDialogRef" @confirm-btn="duihuanmaBtn" title="兑换"></duihuanmaDialog>
- <tel-dialog @telClose="telClose" @bindBtn="bindBtn" v-if="telDialogFlag"></tel-dialog>
- <agree-content-dialog ref="agreeContentDialogRef" :agreeType="agreeType"></agree-content-dialog>
- <tip-small-dialog ref="kefuDialogRef" :title="kefuTitle" @confirm-btn="kefuBtn" :content="kefuContent"
- class="kefu-dialog"></tip-small-dialog>
- <nichengDialog ref="nichengDialogRef" @confirm-btn="nichengBtn" title="修改昵称"></nichengDialog>
- </view>
- </template>
- <script setup>
- import agreeContentDialog from '@/pages/login/agreeContentDialog.vue';
- import {
- toast,
- getUserIdentity
- } from "@/utils/common";
- import cacheManager from '@/utils/cacheManager.js';
- import {
- logout
- } from '@/api/login.js'
- import {
- myInfo,
- zhuxiao,
- duihuanmaCode,
- nichengUpdate,
- myCardList,
- commonCardList
- } from '@/api/my.js'
- import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
- import {
- onLoad
- } from '@dcloudio/uni-app';
- import {
- reactive,
- ref
- } from "vue";
- import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue';
- import duihuanmaDialog from '@/components/dialog/duihuanmaDialog.vue';
- import nichengDialog from '@/components/dialog/nichengDialog.vue';
- import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
- import tipBigDialog from '@/components/dialog/tipBigDialog.vue';
- import telDialog from './telDialog.vue'
- import {
- onShow
- } from '@dcloudio/uni-app';
- const agreeType = ref(null);
- const agreeContentDialogRef = ref(null);
- const tipContent = '你确定要执行这个操作吗?';
- const zhuxiaoContent = '你确定要执行这个操作吗?';
- let loginFlag = ref(false);
- let telDialogFlag = ref(false);
- let myInfoData = reactive({
- userImg: '',
- userName: '',
- credit: '',
- vipFlag: '',
- nickName: '',
- icon: '',
- });
- let routerOpt = ref(false);
- let appleCode = ref(null);
- let currentPlatform = ref(null);
- const exitDialogRef = ref(null);
- const zhuxiaoDialogRef = ref(null);
- const nichengDialogRef = ref(null);
- const kefuDialogRef = ref(null);
- const kefuTitle = '提示';
- const kefuContent = '客服电话:17304117625';
- const exitLogin = () => {
- exitDialogRef.value.handleShow();
- }
- function handleBack() {
- uni.redirectTo({
- url: '/pages/my/index'
- })
- }
- function headClick() {
- uni.redirectTo({
- url: '/pages/my/headImg'
- })
- }
- function nichengClick() {
- nichengDialogRef.value.handleShow();
- }
- // 退出按钮
- const exitBtn = () => {
- if (loginFlag.value) {
- logout().then(res => {
- toast('退出登录成功')
- cacheManager.clearAll();
- uni.reLaunch({
- url: '/pages/login/index'
- });
- }).catch(err => {
- toast('退出登录失败,请稍后重试')
- })
- } else {
- uni.reLaunch({
- url: '/pages/login/index'
- });
- }
- }
- const zhuxiaoBtn = () => {
- let req = {
- }
- zhuxiao().then(res => {
- cacheManager.clearAll();
- toast('用户注销成功')
- uni.redirectTo({
- url: '/pages/login/index'
- });
- }).catch(err => {
- toast('失败,请稍后重试')
- })
- }
- function yonghuzhuxiao() {
- zhuxiaoDialogRef.value.handleShow();
- }
- function nichengBtn(data) {
- console.log('data', data);
- let req = {
- nickName: data
- }
- nichengUpdate(req).then(res => {
- if (res.code == 0) {
- toast('修改成功')
- myInfoData.nickName = data
- } else {
- toast('修改失败请重试或联系管理员')
- return false
- }
- }).catch(err => {
- })
- }
- function yinsizhengce() {
- agreeType.value = 'ystk'
- agreeContentDialogRef.value.handleShow();
- }
- function kefudianhua() {
- kefuDialogRef.value.handleShow();
- }
- function kefuBtn() {
- kefuDialogRef.value.handleClose();
- }
- // 手机号码
- function telClick() {
- if (loginFlag.value) {
- telDialogFlag.value = true;
- } else {
- youkeDialogRef.value.handleShow();
- }
- }
- // 手机号码绑定
- function bindBtn() {
- telDialogFlag.value = false;
- myGetAuth()
- }
- // 关闭手机号码弹窗
- function telClose() {
- telDialogFlag.value = false;
- }
- // 关于我们
- function aboutClick() {
- if (loginFlag.value) {
- uni.redirectTo({
- url: '/pages/my/aboutPage'
- });
- } else {
- uni.redirectTo({
- url: `/pages/my/aboutPage?levelId=${routerOpt.levelId}&typeId=${routerOpt.typeId}&subjectId=${routerOpt.subjectId}&tipFlag=${routerOpt.tipFlag}`
- });
- }
- }
- // 获取用户数据
- function getMyInfo() {
- myInfo({}).then(res => {
- myInfoData.userName = res.data.userName;
- myInfoData.credit = res.data.credit;
- myInfoData.nickName = res.data.nickName;
-
- if (res.data.nickName) {
- myInfoData.nickName = res.data.nickName;
- } else {
- myInfoData.nickName = '鹅状元';
- }
- if (res.data.icon) {
- myInfoData.icon = res.data.icon;
- } else {
- getUserImg(res.data.growthType)
- }
-
- })
- }
- function getUserImg(data) {
- switch (data) {
- case 0:
- myInfoData.icon = 'static/images/my/head-img0.png'
- break;
- case 1:
- myInfoData.icon = 'static/images/my/head-img1.png'
- break;
- case 2:
- myInfoData.icon = 'static/images/my/head-img2.png'
- break;
- case 3:
- myInfoData.icon = 'static/images/my/head-img3.png'
- break;
- default:
- myInfoData.icon = 'static/images/my/head-unlogin-img.png'
- break;
- }
- }
- function isIOSorAndroid() {
- const systemInfo = uni.getSystemInfoSync();
- console.log('systemInfo', systemInfo);
- if (systemInfo.platform == 'ios') {
- return currentPlatform.value = 'ios'
- } else {
- return currentPlatform.value = 'android'
- }
- }
- onLoad((options) => {
- isIOSorAndroid()
- loginFlag.value = true;
- getMyInfo();
- })
- </script>
|