yingyongshezhi.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view class="ezy-my-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="handleBack" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">应用设置</text>
  6. </view>
  7. <view class="my-list-box">
  8. <view class="list-row" @click="headClick">
  9. <icon class="list-icon tel-icon"></icon>
  10. <text>头像</text>
  11. <icon class="head-img-box" :style="{backgroundImage: 'url(' + myInfoData.userImg + ')'}"></icon>
  12. </view>
  13. <view class="list-row" @click="nichengClick">
  14. <icon class="list-icon tel-icon"></icon>
  15. <text>昵称</text>
  16. <text>{{myInfoData.nichengValue}}</text>
  17. </view>
  18. <view class="list-row" @click="telClick">
  19. <icon class="list-icon tel-icon"></icon>
  20. <text>手机号码</text>
  21. </view>
  22. <view class="list-row" @click="aboutClick">
  23. <icon class="list-icon about-icon"></icon>
  24. <text>关于我们</text>
  25. </view>
  26. <view v-if="loginFlag" class="list-row" @click="yonghuzhuxiao">
  27. <icon class="list-icon zhuxiao-icon"></icon>
  28. <text>用户注销</text>
  29. </view>
  30. <view v-if="loginFlag" class="list-row" @click="yinsizhengce">
  31. <icon class="list-icon yszc-icon"></icon>
  32. <text>隐私政策</text>
  33. </view>
  34. <view class="list-row" @click="kefudianhua">
  35. <icon class="list-icon kfdh-icon"></icon>
  36. <text>客服与投诉</text>
  37. <text>4001750778</text>
  38. </view>
  39. <view class="list-row" @click="exitLogin">
  40. <icon class="list-icon login-out-icon"></icon>
  41. <text>退出登录</text>
  42. </view>
  43. </view>
  44. <CustomTabBar :levelId="levelId" :currentTabNumber="3" :typeId="typeId" :subjectId="subjectId"
  45. :tipFlag="tipFlag">
  46. </CustomTabBar>
  47. <tip-small-dialog ref="exitDialogRef" @confirm-btn="exitBtn" :content="tipContent"></tip-small-dialog>
  48. <tip-small-dialog ref="zhuxiaoDialogRef" @confirm-btn="zhuxiaoBtn" :content="zhuxiaoContent"></tip-small-dialog>
  49. <duihuanmaDialog ref="duihuanmaDialogRef" @confirm-btn="duihuanmaBtn" title="兑换"></duihuanmaDialog>
  50. <tel-dialog @telClose="telClose" @bindBtn="bindBtn" v-if="telDialogFlag"></tel-dialog>
  51. <agree-content-dialog ref="agreeContentDialogRef" :agreeType="agreeType"></agree-content-dialog>
  52. <tip-small-dialog ref="kefuDialogRef" :title="kefuTitle" @confirm-btn="kefuBtn" :content="kefuContent"
  53. class="kefu-dialog"></tip-small-dialog>
  54. <nichengDialog ref="nichengDialogRef" @confirm-btn="nichengBtn" title="修改昵称"></nichengDialog>
  55. </view>
  56. </template>
  57. <script setup>
  58. import agreeContentDialog from '@/pages/login/agreeContentDialog.vue';
  59. import {
  60. toast,
  61. getUserIdentity
  62. } from "@/utils/common";
  63. import cacheManager from '@/utils/cacheManager.js';
  64. import {
  65. logout
  66. } from '@/api/login.js'
  67. import {
  68. myInfo,
  69. zhuxiao,
  70. duihuanmaCode,
  71. nichengUpdate,
  72. myCardList,
  73. commonCardList
  74. } from '@/api/my.js'
  75. import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
  76. import {
  77. onLoad
  78. } from '@dcloudio/uni-app';
  79. import {
  80. reactive,
  81. ref
  82. } from "vue";
  83. import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue';
  84. import duihuanmaDialog from '@/components/dialog/duihuanmaDialog.vue';
  85. import nichengDialog from '@/components/dialog/nichengDialog.vue';
  86. import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
  87. import tipBigDialog from '@/components/dialog/tipBigDialog.vue';
  88. import telDialog from './telDialog.vue'
  89. import {
  90. onShow
  91. } from '@dcloudio/uni-app';
  92. const agreeType = ref(null);
  93. const agreeContentDialogRef = ref(null);
  94. const tipContent = '你确定要执行这个操作吗?';
  95. const zhuxiaoContent = '你确定要执行这个操作吗?';
  96. let loginFlag = ref(false);
  97. let telDialogFlag = ref(false);
  98. let myInfoData = reactive({
  99. userImg: '',
  100. userName: '',
  101. credit: '',
  102. vipFlag: '',
  103. nichengValue: '',
  104. });
  105. let routerOpt = ref(false);
  106. let appleCode = ref(null);
  107. let currentPlatform = ref(null);
  108. const exitDialogRef = ref(null);
  109. const zhuxiaoDialogRef = ref(null);
  110. const nichengDialogRef = ref(null);
  111. const kefuDialogRef = ref(null);
  112. const kefuTitle = '提示';
  113. const kefuContent = '客服电话:17304117625';
  114. const exitLogin = () => {
  115. exitDialogRef.value.handleShow();
  116. }
  117. function handleBack() {
  118. uni.redirectTo({
  119. url: '/pages/my/index'
  120. })
  121. }
  122. function headClick() {
  123. }
  124. function nichengClick() {
  125. nichengDialogRef.value.handleShow();
  126. }
  127. // 退出按钮
  128. const exitBtn = () => {
  129. if (loginFlag.value) {
  130. logout().then(res => {
  131. toast('退出登录成功')
  132. cacheManager.clearAll();
  133. uni.reLaunch({
  134. url: '/pages/login/index'
  135. });
  136. }).catch(err => {
  137. toast('退出登录失败,请稍后重试')
  138. })
  139. } else {
  140. uni.reLaunch({
  141. url: '/pages/login/index'
  142. });
  143. }
  144. }
  145. const zhuxiaoBtn = () => {
  146. let req = {
  147. }
  148. zhuxiao().then(res => {
  149. cacheManager.clearAll();
  150. toast('用户注销成功')
  151. uni.redirectTo({
  152. url: '/pages/login/index'
  153. });
  154. }).catch(err => {
  155. toast('失败,请稍后重试')
  156. })
  157. }
  158. function yonghuzhuxiao() {
  159. zhuxiaoDialogRef.value.handleShow();
  160. }
  161. function nichengBtn(data) {
  162. console.log('data', data);
  163. let req = {
  164. nickName: data
  165. }
  166. nichengUpdate(req).then(res => {
  167. if (res.code == 0) {
  168. toast('修改成功')
  169. myInfoData.nichengValue = data
  170. } else {
  171. toast('修改失败请重试或联系管理员')
  172. return false
  173. }
  174. }).catch(err => {
  175. })
  176. }
  177. function yinsizhengce() {
  178. agreeType.value = 'ystk'
  179. agreeContentDialogRef.value.handleShow();
  180. }
  181. function kefudianhua() {
  182. kefuDialogRef.value.handleShow();
  183. }
  184. function kefuBtn() {
  185. kefuDialogRef.value.handleClose();
  186. }
  187. // 手机号码
  188. function telClick() {
  189. if (loginFlag.value) {
  190. telDialogFlag.value = true;
  191. } else {
  192. youkeDialogRef.value.handleShow();
  193. }
  194. }
  195. // 手机号码绑定
  196. function bindBtn() {
  197. telDialogFlag.value = false;
  198. myGetAuth()
  199. }
  200. // 关闭手机号码弹窗
  201. function telClose() {
  202. telDialogFlag.value = false;
  203. }
  204. // 关于我们
  205. function aboutClick() {
  206. if (loginFlag.value) {
  207. uni.redirectTo({
  208. url: '/pages/my/aboutPage'
  209. });
  210. } else {
  211. uni.redirectTo({
  212. url: `/pages/my/aboutPage?levelId=${routerOpt.levelId}&typeId=${routerOpt.typeId}&subjectId=${routerOpt.subjectId}&tipFlag=${routerOpt.tipFlag}`
  213. });
  214. }
  215. }
  216. // 获取用户数据
  217. function getMyInfo() {
  218. myInfo({}).then(res => {
  219. myInfoData.userName = res.data.userName;
  220. myInfoData.credit = res.data.credit;
  221. })
  222. }
  223. function isIOSorAndroid() {
  224. const systemInfo = uni.getSystemInfoSync();
  225. console.log('systemInfo', systemInfo);
  226. if (systemInfo.platform == 'ios') {
  227. return currentPlatform.value = 'ios'
  228. } else {
  229. return currentPlatform.value = 'android'
  230. }
  231. }
  232. onLoad((options) => {
  233. isIOSorAndroid()
  234. loginFlag.value = true;
  235. getMyInfo();
  236. })
  237. </script>