index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="user_about" :style="viewColor">
  3. <view>
  4. <view class="text cancelTxt" :class="{cancelTxt: type == 'the_cancellation_msg'}">
  5. <jyf-parser :html="data.replace(/<br\/>/ig, '')" ref="article" :tag-style="tagStyle"></jyf-parser>
  6. </view>
  7. </view>
  8. <view class="cancel" v-if="type == 'the_cancellation_msg' && loaded">
  9. <view class="checkbox" @click="setCheck">
  10. <text v-if="!check" class="iconfont icon-weixuanzhong"></text>
  11. <text v-else class="iconfont icon-xuanzhong1"></text>
  12. <span>已阅读并同意<i class="font" @click.stop="toCancel">《重要提醒》</i></span>
  13. </view>
  14. <view class="btn" @click="cancelBtn">
  15. 申请注销
  16. </view>
  17. </view>
  18. <view class="outMoal" v-if="moal">
  19. <view class="box">
  20. <view class="title">该账号将永久注销</view>
  21. <view class="moalBtn">
  22. <view class="ok" @click="ok">确定</view>
  23. <view class="no" @click="cancelMoal">取消</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. cacheInfo,
  32. userOut,
  33. getLogout
  34. } from '@/api/user.js'
  35. import { mapGetters } from "vuex";
  36. export default {
  37. name: 'user_about',
  38. data() {
  39. return {
  40. type: '',
  41. data: '',
  42. check: false,
  43. moal: false,
  44. loaded: false,
  45. tagStyle: {
  46. img: 'width:100%;display:block;'
  47. },
  48. }
  49. },
  50. computed: mapGetters(['viewColor']),
  51. onLoad: function(options) {
  52. this.type = options.from;
  53. this.setTitle(this.type)
  54. },
  55. methods: {
  56. toCancel(){
  57. uni.redirectTo({
  58. url: '/pages/users/user_about/index?from=the_cancellation_prompt'
  59. })
  60. },
  61. setCheck() {
  62. this.check = !this.check
  63. },
  64. ok() {
  65. uni.showLoading({
  66. title: '注销中',
  67. mask: true
  68. });
  69. this.moal = false;
  70. (new Promise(call=>{
  71. userOut().then(res => {
  72. if(res.data.status === 200){
  73. uni.hideLoading()
  74. call()
  75. }else{
  76. uni.showModal({
  77. title: '提示',
  78. content: res.message,
  79. success: ({confirm}) => {
  80. if (confirm) {
  81. userOut({key: res.data.result.key}).then(res => {
  82. uni.hideLoading()
  83. if(res.data.status === 200){
  84. call()
  85. }else{
  86. this.$util.Tips({
  87. title: res.message
  88. });
  89. }
  90. })
  91. }else{
  92. uni.hideLoading()
  93. }
  94. }
  95. });
  96. }
  97. })
  98. })).then(v=>{
  99. this.$store.commit("LOGOUT");
  100. setTimeout(()=>{
  101. uni.reLaunch({
  102. url: '/pages/index/index'
  103. });
  104. }, 500);
  105. })
  106. },
  107. cancelBtn() {
  108. if (!this.check) {
  109. return uni.showToast({
  110. title: "请勾选已阅读",
  111. icon: 'none',
  112. duration: 2000,
  113. })
  114. } else {
  115. this.moal = true
  116. }
  117. },
  118. cancelMoal() {
  119. this.moal = false
  120. this.check = false
  121. },
  122. getCacheinfo() {
  123. this.loaded = false;
  124. cacheInfo(this.type).then(res => {
  125. this.data = res.data[this.type]
  126. if(res.data.title) {
  127. uni.setNavigationBarTitle({
  128. title: res.data.title
  129. })
  130. }
  131. this.loaded = true;
  132. })
  133. },
  134. setTitle(e) {
  135. switch (e) {
  136. case 'the_cancellation_msg':
  137. uni.setNavigationBarTitle({
  138. title: '注销账号'
  139. })
  140. this.getCacheinfo()
  141. break;
  142. case 'sys_about_us':
  143. uni.setNavigationBarTitle({
  144. title: '关于我们'
  145. })
  146. this.getCacheinfo()
  147. break;
  148. case 'sys_certificate':
  149. uni.setNavigationBarTitle({
  150. title: '资质证明'
  151. })
  152. this.getCacheinfo()
  153. break;
  154. default:
  155. uni.setNavigationBarTitle({
  156. title: '加载中...'
  157. })
  158. this.getCacheinfo()
  159. break;
  160. }
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. .user_about {
  167. .text {
  168. font-size: 30rpx;
  169. font-weight: 400;
  170. padding: 30rpx;
  171. color: #282828;
  172. }
  173. .cancelTxt {
  174. overflow: hidden;
  175. overflow-y: auto;
  176. image{
  177. max-width: 100%;
  178. }
  179. }
  180. .cancel {
  181. // position: fixed;
  182. // bottom: 60rpx;
  183. // left: 0;
  184. z-index: 1;
  185. width: 100%;
  186. .checkbox {
  187. width: 50%;
  188. text-align: center;
  189. margin: 0 auto;
  190. font-size: 24rpx;
  191. font-weight: 400;
  192. span {
  193. margin-left: 5rpx;
  194. }
  195. .font {
  196. color: var(--view-theme);
  197. font-style: normal;
  198. }
  199. .iconfont {
  200. font-size: 24rpx;
  201. }
  202. }
  203. .btn {
  204. width: 690rpx;
  205. height: 90rpx;
  206. background: var(--view-theme);
  207. border-radius: 45rpx;
  208. margin: 0 auto;
  209. margin-top: 30rpx;
  210. text-align: center;
  211. line-height: 90rpx;
  212. font-size: 32rpx;
  213. font-weight: 400;
  214. color: #FFFFFF;
  215. }
  216. }
  217. }
  218. .outMoal {
  219. width: 100%;
  220. height: 100%;
  221. background: rgba(0, 0, 0, 0.5);
  222. position: fixed;
  223. top: 0;
  224. left: 0;
  225. z-index: 2;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. .box {
  230. position: fixed;
  231. width: 590rpx;
  232. height: 258rpx;
  233. background: #FFFFFF;
  234. opacity: 1;
  235. border-radius: 20rpx;
  236. text-align: center;
  237. padding: 50rpx;
  238. .title {
  239. font-size: 30rpx;
  240. font-weight: 600;
  241. color: #282828;
  242. }
  243. .moalBtn {
  244. margin-top: 43rpx;
  245. display: flex;
  246. justify-content: space-between;
  247. .ok {
  248. width: 234rpx;
  249. height: 66rpx;
  250. border: 1rpx solid var(--view-theme);
  251. border-radius: 33rpx;
  252. font-size: 26rpx;
  253. line-height: 66rpx;
  254. color: var(--view-theme);
  255. }
  256. .no {
  257. width: 234rpx;
  258. height: 66rpx;
  259. background: linear-gradient(90deg, var(--view-bntColor21) 0%, var(--view-bntColor21) 100%);
  260. border-radius: 33rpx;
  261. font-size: 26rpx;
  262. color: #FFFFFF;
  263. line-height: 66rpx;
  264. }
  265. }
  266. }
  267. }
  268. </style>