index.vue 6.2 KB

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