yingyongshezhi.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. uni.redirectTo({
  124. url: '/pages/my/headImg'
  125. })
  126. }
  127. function nichengClick() {
  128. nichengDialogRef.value.handleShow();
  129. }
  130. // 退出按钮
  131. const exitBtn = () => {
  132. if (loginFlag.value) {
  133. logout().then(res => {
  134. toast('退出登录成功')
  135. cacheManager.clearAll();
  136. uni.reLaunch({
  137. url: '/pages/login/index'
  138. });
  139. }).catch(err => {
  140. toast('退出登录失败,请稍后重试')
  141. })
  142. } else {
  143. uni.reLaunch({
  144. url: '/pages/login/index'
  145. });
  146. }
  147. }
  148. const zhuxiaoBtn = () => {
  149. let req = {
  150. }
  151. zhuxiao().then(res => {
  152. cacheManager.clearAll();
  153. toast('用户注销成功')
  154. uni.redirectTo({
  155. url: '/pages/login/index'
  156. });
  157. }).catch(err => {
  158. toast('失败,请稍后重试')
  159. })
  160. }
  161. function yonghuzhuxiao() {
  162. zhuxiaoDialogRef.value.handleShow();
  163. }
  164. function nichengBtn(data) {
  165. console.log('data', data);
  166. let req = {
  167. nickName: data
  168. }
  169. nichengUpdate(req).then(res => {
  170. if (res.code == 0) {
  171. toast('修改成功')
  172. myInfoData.nichengValue = data
  173. } else {
  174. toast('修改失败请重试或联系管理员')
  175. return false
  176. }
  177. }).catch(err => {
  178. })
  179. }
  180. function yinsizhengce() {
  181. agreeType.value = 'ystk'
  182. agreeContentDialogRef.value.handleShow();
  183. }
  184. function kefudianhua() {
  185. kefuDialogRef.value.handleShow();
  186. }
  187. function kefuBtn() {
  188. kefuDialogRef.value.handleClose();
  189. }
  190. // 手机号码
  191. function telClick() {
  192. if (loginFlag.value) {
  193. telDialogFlag.value = true;
  194. } else {
  195. youkeDialogRef.value.handleShow();
  196. }
  197. }
  198. // 手机号码绑定
  199. function bindBtn() {
  200. telDialogFlag.value = false;
  201. myGetAuth()
  202. }
  203. // 关闭手机号码弹窗
  204. function telClose() {
  205. telDialogFlag.value = false;
  206. }
  207. // 关于我们
  208. function aboutClick() {
  209. if (loginFlag.value) {
  210. uni.redirectTo({
  211. url: '/pages/my/aboutPage'
  212. });
  213. } else {
  214. uni.redirectTo({
  215. url: `/pages/my/aboutPage?levelId=${routerOpt.levelId}&typeId=${routerOpt.typeId}&subjectId=${routerOpt.subjectId}&tipFlag=${routerOpt.tipFlag}`
  216. });
  217. }
  218. }
  219. // 获取用户数据
  220. function getMyInfo() {
  221. myInfo({}).then(res => {
  222. myInfoData.userName = res.data.userName;
  223. myInfoData.credit = res.data.credit;
  224. })
  225. }
  226. function isIOSorAndroid() {
  227. const systemInfo = uni.getSystemInfoSync();
  228. console.log('systemInfo', systemInfo);
  229. if (systemInfo.platform == 'ios') {
  230. return currentPlatform.value = 'ios'
  231. } else {
  232. return currentPlatform.value = 'android'
  233. }
  234. }
  235. onLoad((options) => {
  236. isIOSorAndroid()
  237. loginFlag.value = true;
  238. getMyInfo();
  239. })
  240. </script>