set.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="Body">
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="useBox" @click="goPersonalData()">
  5. <view class="useBox_l">
  6. <image v-if="user.headPhoto" :src="$getImgPath(user.headPhoto)" mode=""></image>
  7. <image v-else src="/static/default-avatar.png" mode=""></image>
  8. <view class="useBox_l_txt">
  9. <view class="useBox_l_txt_t">{{ $onDesensitization('name', user.realName || user.nickname || '')}}</view>
  10. <view class="useBox_l_txt_b">{{$onDesensitization('tel', user.mobile || '')}}</view>
  11. </view>
  12. </view>
  13. <view class="useBox_r">
  14. <text class="iconfont_yige">&#xe65f;</text>
  15. </view>
  16. </view>
  17. <view class="list">
  18. <view class="item" @click="goRealAttestation()">
  19. <view class="item_l">实名认证</view>
  20. <view class="item_r">
  21. <view class="item_r_text">{{user.certification?'已认证':'未认证'}}</view>
  22. <text class="iconfont_yige">&#xe65f;</text>
  23. </view>
  24. </view>
  25. <view class="item" @click="goAccountSecurity()">
  26. <view class="item_l">账号安全</view>
  27. <view class="item_r">
  28. <text class="iconfont_yige">&#xe65f;</text>
  29. </view>
  30. </view>
  31. <view class="item" @click="goPrivacyProtection()">
  32. <view class="item_l">隐私保护</view>
  33. <view class="item_r">
  34. <text class="iconfont_yige">&#xe65f;</text>
  35. </view>
  36. </view>
  37. <view class="item" @click="goPrivacyRecommend()">
  38. <view class="item_l">推荐设置</view>
  39. <view class="item_r">
  40. <text class="iconfont_yige">&#xe65f;</text>
  41. </view>
  42. </view>
  43. <view class="item" @click="clearStorage()">
  44. <view class="item_l">清除缓存</view>
  45. <view class="item_r">
  46. <text class="iconfont_yige">&#xe65f;</text>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="list">
  51. <view class="item" @click="goAgreement('about_us')">
  52. <view class="item_l">关于我们</view>
  53. <view class="item_r">
  54. <text class="iconfont_yige">&#xe65f;</text>
  55. </view>
  56. </view>
  57. <view class="item" @click="getVersionNewest(1)">
  58. <view class="item_l">版本更新</view>
  59. <view class="item_r">
  60. <view class="item_r_text " v-if="version_number<newest.version">新版本号 {{newest.version}}</view>
  61. <view class="item_r_text " v-else>版本号 {{version_number}}</view>
  62. <text class="iconfont_yige">&#xe65f;</text>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="btnBox">
  67. <u-button type="primary" hover-class="hoverClass" @click="logOut">退出登录</u-button>
  68. </view>
  69. <appUpdatePop ref="appUpdatePop" />
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. versionNewest,
  75. getUserInfo,
  76. userLogout
  77. } from "@/api/government.js"
  78. import appUpdatePop from "@/components/appUpdatePop.vue"
  79. export default {
  80. components: {
  81. appUpdatePop
  82. },
  83. data() {
  84. return {
  85. config: {
  86. back: true, //false是tolbar页面 是则不写
  87. title: '设置',
  88. color: '#000',
  89. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  90. // backgroundColor: "#F8F8F8",
  91. rightSlot: true,
  92. },
  93. user: {},
  94. newest: {},
  95. version_number: null,
  96. type: 0
  97. }
  98. },
  99. onShow() {
  100. const systemInfo = uni.getSystemInfoSync();
  101. this.version_number = systemInfo.appVersion;
  102. let platform = uni.getSystemInfoSync().platform;
  103. if (platform == 'ios') {
  104. this.type = 1
  105. } else if (platform == 'android') {
  106. this.type = 0
  107. }
  108. this.getVersionNewest();
  109. this.getUserData()
  110. },
  111. methods: {
  112. goPersonalData() {
  113. uni.navigateTo({
  114. url: "/pages/government/personalData"
  115. })
  116. },
  117. goPrivacyRecommend(){
  118. uni.navigateTo({
  119. url: "/pages/government/recommend"
  120. })
  121. },
  122. goPrivacyProtection() {
  123. uni.navigateTo({
  124. url: "/pages/government/privacyProtection"
  125. })
  126. },
  127. goAccountSecurity() {
  128. uni.navigateTo({
  129. url: "/pages/government/accountSecurity"
  130. })
  131. },
  132. // 清除缓存
  133. clearStorage() {
  134. uni.showLoading({
  135. title: '清除缓存中',
  136. mask: true
  137. });
  138. setTimeout(() => {
  139. uni.showToast({
  140. title: '清除成功!',
  141. icon: 'success',
  142. duration: 1000
  143. })
  144. }, 2000)
  145. },
  146. logOut() {
  147. uni.showModal({
  148. title: '提示',
  149. content: '确定退出?',
  150. success: (res) => {
  151. if (res.confirm) {
  152. userLogout().then(res => {
  153. uni.removeStorageSync('apiToken');
  154. uni.showToast({
  155. title: '退出成功!',
  156. duration: 1500
  157. });
  158. setTimeout(() => {
  159. uni.switchTab({
  160. url: '/pages/home'
  161. });
  162. }, 1500)
  163. })
  164. }
  165. }
  166. });
  167. },
  168. goRealAttestation() {
  169. uni.navigateTo({
  170. url: `/pages/government/realAttestation?type=${this.user.certification?'2':'1'}`
  171. })
  172. },
  173. getUserData() {
  174. getUserInfo().then(res => {
  175. this.user = res.data;
  176. })
  177. },
  178. goAgreement(val) {
  179. uni.navigateTo({
  180. url: "/pages/user/agreement?type=" + val
  181. })
  182. },
  183. // 获取更新包
  184. getVersionNewest(e) {
  185. versionNewest({
  186. type: this.type
  187. }).then(res => {
  188. this.newest = res.data || {};
  189. if (this.version_number < this.newest.version && e) {
  190. this.$refs.appUpdatePop.appInfo = this.newest
  191. this.$refs.appUpdatePop.show = true
  192. }else if(this.version_number >= this.newest.version && e){
  193. this.$u.toast('已经是最新版本!');
  194. }
  195. })
  196. }
  197. }
  198. }
  199. </script>
  200. <style>
  201. page {
  202. background-color: #F8F8F8;
  203. }
  204. </style>
  205. <style lang="scss">
  206. .useBox {
  207. margin: 20rpx 30rpx;
  208. display: flex;
  209. justify-content: space-between;
  210. align-items: center;
  211. padding: 40rpx 30rpx;
  212. background: #fff;
  213. border-radius: 20rpx;
  214. .useBox_l {
  215. display: flex;
  216. image {
  217. width: 90rpx;
  218. height: 90rpx;
  219. border-radius: 50%;
  220. margin-right: 20rpx;
  221. }
  222. .useBox_l_txt {
  223. .useBox_l_txt_t {
  224. font-size: 32rpx;
  225. font-weight: 700;
  226. }
  227. .useBox_l_txt_b {
  228. font-size: 28rpx;
  229. color: #999;
  230. margin-top: 8rpx;
  231. }
  232. }
  233. }
  234. .useBox_r {
  235. text {
  236. color: #333333;
  237. opacity: 0.5;
  238. font-weight: 700;
  239. }
  240. }
  241. }
  242. .list {
  243. padding: 20rpx 30rpx;
  244. background: #fff;
  245. border-radius: 20rpx;
  246. margin: 30rpx;
  247. .item {
  248. display: flex;
  249. justify-content: space-between;
  250. padding: 40rpx 30rpx;
  251. border-bottom: 1rpx solid rgba(239, 239, 239, .6);
  252. .item_l {
  253. font-size: 30rpx;
  254. color: #333333;
  255. font-weight: 700;
  256. }
  257. .item_r {
  258. display: flex;
  259. align-items: center;
  260. .item_r_text {
  261. margin-right: 30rpx;
  262. color: #3EBCD0;
  263. }
  264. .iconfont_yige {
  265. color: #333333;
  266. opacity: 0.5;
  267. font-weight: 700;
  268. }
  269. }
  270. &:last-child {
  271. border-bottom: none;
  272. }
  273. }
  274. }
  275. .btnBox {
  276. width: 100%;
  277. // display: flex;
  278. // justify-content: center;
  279. margin-top: 60rpx;
  280. }
  281. .u-btn {
  282. width: 534rpx;
  283. border-radius: 10rpx;
  284. background: rgb(64, 149, 229);
  285. font-size: 30rpx;
  286. font-weight: 700;
  287. margin: auto;
  288. font-family: Microsoft YaHei, Microsoft YaHei-Bold;
  289. background: linear-gradient(6deg, #56d9ee 0%, #3ebcd0 100%) #3c66d9;
  290. }
  291. .hoverClass {
  292. background: linear-gradient(6deg, #56d9ee 0%, #3ebcd0 100%) #3c66d9;
  293. }
  294. </style>