setUp.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <view class="container">
  3. <view class="cu-list menu text-left solid-top indexlow">
  4. <view class='cu-item' style='margin-bottom:10px;' @click="switchPicture">
  5. <view>
  6. <text>头像</text>
  7. </view>
  8. <view style='align-items: center;' class="flex">
  9. <view class="pictures">
  10. <image :src="headUrl" class="picture"></image>
  11. </view>
  12. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  13. </view>
  14. </view>
  15. <view class='cu-item' style='margin-bottom:10px;' @click="nickname(username)">
  16. <view>
  17. <text>用户名</text>
  18. </view>
  19. <view style='align-items: center;' class="flex">
  20. <view class="username">
  21. {{username}}
  22. </view>
  23. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  24. </view>
  25. </view>
  26. <view class='cu-item' style='margin-bottom:10px;' @click="nickname1(wechatNo)">
  27. <view>
  28. <text>昵称</text>
  29. </view>
  30. <view style='align-items: center;' class="flex">
  31. <view class="username">
  32. {{wechatNo}}
  33. </view>
  34. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  35. </view>
  36. </view>
  37. <view class='cu-item' style='margin-bottom:10px;' @click='fankui'>
  38. <view>
  39. <text>意见反馈</text>
  40. </view>
  41. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  42. </view>
  43. <view class='cu-item' style='margin-bottom:10px;' @click='clearStorage'>
  44. <view>
  45. <text>清除缓存</text>
  46. </view>
  47. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  48. </view>
  49. <view class='cu-item' style='margin-bottom:10px;' @click='UpdataPassword'>
  50. <view>
  51. <text>修改密码</text>
  52. </view>
  53. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  54. </view>
  55. <!-- <view class='cu-item' style='margin-bottom:10px;' @click='updataEdition'>
  56. <view>
  57. <text>检查新版本</text>
  58. </view>
  59. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  60. </view> -->
  61. <view class='cu-item' style='margin-bottom:10px;' @click='unsubscribe'>
  62. <view>
  63. <text>注销账户</text>
  64. </view>
  65. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  66. </view>
  67. <view class='cu-item' style='margin-bottom:10px;'>
  68. <view>
  69. <text>检查更新</text>
  70. </view>
  71. <view class="version_css" @click="onAPPUpdate">
  72. {{version}}
  73. <image src="../../static/img/myimg/gengduo1@3x.png" class="arrow"></image>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="agreement">
  78. <view class="text">
  79. <navigator
  80. url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/userAgreement.html"
  81. class="path" hover-class="navigator-hover">《服务协议》</navigator>和<navigator
  82. url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/screctAgreement.html"
  83. class="path" hover-class="navigator-hover">《隐私政策》</navigator>
  84. </view>
  85. </view>
  86. <view class='exitloginwrap'>
  87. <button @click='logout()' class='exitlogin'>退出登录</button>
  88. </view>
  89. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  90. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='温馨提示'
  91. showCancelButton='false' :content="content" @confirm="goOpenService" @cancel="cancelClick"></u-modal>
  92. </view>
  93. </template>
  94. <script>
  95. import appUpdate from 'common/appUpdate.js'
  96. import {
  97. mapState
  98. } from 'vuex';
  99. // #ifdef APP-PLUS
  100. import APPUpdate, {
  101. getCurrentNo
  102. } from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
  103. import * as config from '@/config/index.js'
  104. // #endif
  105. export default {
  106. data() {
  107. return {
  108. isShowAlert: false,
  109. content: '您确定要退出吗?',
  110. headUrl: "../../static/img/myimg/YongHu@3x.png",
  111. username: "",
  112. wechatNo: '',
  113. gridList: [{
  114. num: 0,
  115. name: '退出登录',
  116. // icon:'cuIcon-exit',
  117. src: '../../static/img/sign/return@3x.png',
  118. tips: 0,
  119. url: '',
  120. show: true
  121. }, ],
  122. version: "1.1.0"
  123. }
  124. },
  125. computed: {
  126. // ...mapState(['hasLogin', 'userInfo'])
  127. },
  128. onShow() {
  129. this.getList()
  130. // #ifdef APP-PLUS
  131. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  132. //版本号
  133. this.version = info.version;
  134. console.log("当前版本为:", this.version)
  135. this.checkVersion()
  136. //appid
  137. // this.appID = info.appid;
  138. })
  139. // this.version = plus.runtime.version
  140. // console.log("当前版本为:", plus.runtime)
  141. // this.checkVersion()
  142. // #endif
  143. },
  144. onLoad() {},
  145. methods: {
  146. // 检查APP是否有新版本
  147. onAPPUpdate() {
  148. // true 没有新版本的时候有提示,默认:false
  149. if (this.version == "发现新版本,立即更新") {
  150. // #ifdef APP-PLUS
  151. APPUpdate(true);
  152. // #endif
  153. }
  154. },
  155. checkVersion() {
  156. const baseUrlNew = config.def().baseUrlNew
  157. uni.request({
  158. url: baseUrlNew + '/appVersion/selectInfo',
  159. data: {
  160. appid: plus.runtime.appid,
  161. version: this.version,
  162. imei: "1",
  163. },
  164. method: 'GET',
  165. success: (res) => {
  166. if (this.version == res.data.data.version) {
  167. this.version = "当前为最新版" + res.data.data.version
  168. } else {
  169. this.version = "发现新版本,立即更新"
  170. }
  171. }
  172. })
  173. },
  174. updataEdition() {
  175. // #ifdef APP-PLUS
  176. let type = uni.getSystemInfoSync().platform
  177. if (type == "android") {
  178. uni.request({
  179. url: 'https://api2.eliangeyun.com/appVersion/selectInfo',
  180. data: {
  181. appid: plus.runtime.appid,
  182. version: this.version,
  183. imei: "1"
  184. },
  185. method: 'GET',
  186. success: (res) => {
  187. if (res.statusCode === 200) {
  188. console.log("uni.request update success", res)
  189. plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
  190. let client_version = wgtinfo.version
  191. var flag_update = client_version.split(".").splice(0, 2).join(
  192. ".") != res.data.data.version.split(".").splice(0, 2)
  193. .join(".")
  194. var flag_hot = (Number(client_version.split(".")[2]) < Number(res
  195. .data.data.version.split(".")[2])) & !flag_update
  196. console.log("client_version", client_version)
  197. console.log("flag_update", flag_update)
  198. console.log("flag_hot", flag_hot)
  199. if (flag_update) {
  200. console.log("更新弹窗")
  201. // 提醒用户更新
  202. uni.showModal({
  203. title: '更新提示',
  204. content: res.data.data.note,
  205. success: (showResult) => {
  206. if (showResult.confirm) {
  207. plus.nativeUI.toast("正在准备环境,请稍后!");
  208. console.log(res.data.data.url, )
  209. var dtask = plus.downloader
  210. .createDownload(res.data.data
  211. .url, {
  212. method: 'GET',
  213. filename: '_doc/update/'
  214. },
  215. function(d, status) {
  216. if (status == 200) {
  217. var path = d
  218. .filename; //下载apk
  219. plus.runtime.install(
  220. path); // 自动安装apk文件
  221. } else {
  222. plus.nativeUI.alert(
  223. '版本更新失败:' +
  224. status);
  225. }
  226. });
  227. dtask.start();
  228. }
  229. }
  230. })
  231. } else if (flag_hot) {
  232. console.log("热更新")
  233. uni.showLoading({
  234. title: '正在热更新'
  235. })
  236. uni.downloadFile({
  237. url: res.data.data.wgtUrl,
  238. success: (downloadResult) => {
  239. console.log(downloadResult.tempFilePath)
  240. if (downloadResult.statusCode === 200) {
  241. plus.nativeUI.toast(
  242. `正在热更新!${res.data.data.versionCode}`
  243. );
  244. plus.runtime.install(downloadResult
  245. .tempFilePath, {
  246. force: false
  247. },
  248. function() {
  249. uni.hideLoading()
  250. plus.nativeUI.toast(
  251. "热更新成功");
  252. uni.clearStorageSync();
  253. plus.nativeUI.toast(
  254. "缓存清除成功");
  255. that.$api.doRequest('post',
  256. '/auth/api/logout')
  257. .then(res => {
  258. if (res.data
  259. .data) {
  260. that.$store
  261. .commit(
  262. 'logout'
  263. )
  264. that.$api
  265. .logout()
  266. plus.nativeUI
  267. .toast(
  268. "登出成功"
  269. );
  270. plus.runtime
  271. .restart();
  272. plus.nativeUI
  273. .toast(
  274. "重启成功"
  275. );
  276. }
  277. })
  278. plus.runtime.restart();
  279. },
  280. function(e) {
  281. uni.hideLoading()
  282. console.log(e)
  283. plus.nativeUI.toast(
  284. `热更新失败:${e.message}`
  285. );
  286. });
  287. }
  288. }
  289. });
  290. } else {
  291. this.content = '您当前版本为最新版本'
  292. this.isShowAlert = true
  293. }
  294. });
  295. }
  296. }
  297. })
  298. }
  299. // #endif
  300. },
  301. UpdataPassword() {
  302. uni.navigateTo({
  303. url: `/pages/public/reset?phone=${this.userInfo.phone}`
  304. })
  305. },
  306. clearStorage() {
  307. let that = this
  308. uni.clearStorage({
  309. success: function(res) {
  310. console.log('success');
  311. that.goOpenService()
  312. }
  313. })
  314. },
  315. cancelClick() {
  316. this.isShowAlert = false
  317. },
  318. goOpenService() {
  319. if (this.content == '您当前版本为最新版本') {
  320. this.isShowAlert = false
  321. return
  322. }
  323. uni.hideTabBarRedDot({
  324. index: 3
  325. })
  326. // uni.clearStorageSync();
  327. var that = this
  328. this.$api.doRequest('post', '/auth/api/logout').then(res => {
  329. if (res.data.data) {
  330. }
  331. })
  332. this.$store.commit('logout')
  333. this.$api.logout()
  334. uni.navigateTo({
  335. url: `/pages/public/login`
  336. })
  337. },
  338. getList() {
  339. this.userInfo = uni.getStorageSync('userInfo')
  340. this.headUrl = this.userInfo.avatarUrl
  341. if (this.headUrl == null || this.headUrl == "") {
  342. this.headUrl = "../../static/img/myimg/YongHu@3x.png"
  343. }
  344. this.username = this.userInfo.userName
  345. if (!uni.getStorageSync('userInfo').wechatNo) {
  346. this.wechatNo = this.userInfo.userName
  347. } else {
  348. this.wechatNo = this.userInfo.wechatNo
  349. }
  350. },
  351. switchPicture() {
  352. uni.navigateTo({
  353. url: `/pages/user/set_picture`
  354. })
  355. },
  356. nickname(username) {
  357. uni.navigateTo({
  358. url: `/pages/user/set_nickname?nickname=${username}`
  359. })
  360. },
  361. nickname1(username) {
  362. uni.navigateTo({
  363. url: `/pages/user/set_wechatNo?nickname=${username}`
  364. })
  365. },
  366. exitlogin() {
  367. },
  368. fankui() {
  369. uni.navigateTo({
  370. url: `/pages/user/fankui`
  371. })
  372. },
  373. unsubscribe() {
  374. var that = this
  375. uni.clearStorage({
  376. success: function(res) {
  377. console.log('success');
  378. uni.hideTabBarRedDot({
  379. index: 3
  380. })
  381. that.$api.doRequest('post', '/auth/api/logout').then(res => {
  382. if (res.data.data) {
  383. }
  384. })
  385. that.$store.commit('logout')
  386. that.$api.logout()
  387. // plus.nativeUI.toast(
  388. // "注销成功");
  389. uni.navigateTo({
  390. url: `/pages/public/login`
  391. })
  392. }
  393. })
  394. },
  395. logout() {
  396. // const that = this
  397. this.isShowAlert = true
  398. // uni.showModal({
  399. // title: '询问',
  400. // content: '您确定要退出吗?',
  401. // cancelText: '取消',
  402. // confirmText: '确定',
  403. // success: (e) => {
  404. // if (e.confirm) {
  405. // uni.hideTabBarRedDot({
  406. // index: 3
  407. // })
  408. // uni.clearStorageSync();
  409. // that.$store.commit('logout')
  410. // that.$api.logout()
  411. // uni.navigateTo({
  412. // url: `/pages/public/login`
  413. // })
  414. // }
  415. // }
  416. // })
  417. },
  418. }
  419. }
  420. </script>
  421. <style lang="scss" scoped>
  422. page {
  423. background-color: #F5F6FA;
  424. }
  425. .container {
  426. padding: 10px 0 0px;
  427. }
  428. .headPortrait {
  429. width: 100%;
  430. height: 52px;
  431. margin-top: 15px;
  432. background-color: #FFFFFF;
  433. border-radius: 6px;
  434. // justify-content: flex-end;
  435. }
  436. .title {
  437. font-size: 16px;
  438. line-height: 50px;
  439. font-weight: 600;
  440. margin-left: 10px;
  441. }
  442. .pictures {
  443. justify-content: flex-end;
  444. width: 35px;
  445. height: 35px;
  446. background-color: #E0FAF6;
  447. border-radius: 18px;
  448. }
  449. .picture {
  450. width: 35px;
  451. height: 35px;
  452. }
  453. .arrow {
  454. margin-left: 15px;
  455. width: 8px;
  456. height: 12px;
  457. // justify-content: flex-end
  458. }
  459. .username {
  460. line-height: 50px;
  461. color: #6D6D72;
  462. }
  463. .sign {
  464. width: 18px;
  465. height: 18px;
  466. top: 4px;
  467. margin-right: 6px;
  468. }
  469. .cu-list>.cu-item:after {
  470. border: none;
  471. }
  472. .exitloginwrap {
  473. position: fixed;
  474. bottom: 0;
  475. left: 0;
  476. width: 100%;
  477. padding-bottom: 20px;
  478. }
  479. .exitlogin {
  480. width: 90%;
  481. background: #fff;
  482. border-radius: 30px;
  483. color: #FB1E1E;
  484. font-size: 17px;
  485. }
  486. .exitlogin:after {
  487. border: none;
  488. }
  489. .version_css {
  490. // margin-right: 10rpx;
  491. color: #9D9D9D;
  492. font-size: 32rpx;
  493. text-align: center;
  494. }
  495. .agreement {
  496. display: flex;
  497. margin: 0 auto;
  498. text-align: center;
  499. .text {
  500. margin: 0 auto;
  501. text-align: center;
  502. display: flex;
  503. }
  504. .path {
  505. color: #22C572;
  506. text-align: center;
  507. }
  508. }
  509. </style>