index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. <!-- 我的 -->
  2. <template>
  3. <view class="page">
  4. <div class="usercenter" :style="{'padding-top':statusBarHeight}">
  5. <ul>
  6. <li>
  7. <image :src="image_cache(user.avatar)" class="avatar" @tap="$jump('mine.profile')" />
  8. </li>
  9. <li>
  10. <div><span style="font-size: 20px;font-weight: 700;"
  11. @tap="$jump('mine.profile')">{{user.nickname}}</span>
  12. <image src="/static/img/gender1.png" class="sexbtn" v-if="user.sex==1" />
  13. <image src="/static/img/gender2.png" class="sexbtn" v-if="user.sex==2" />
  14. <block v-if="system.signopen==1">
  15. <span class="sign_btn ok" v-if="user.is_signed==1">
  16. <uni-icons type="checkmarkempty" color="#2319dc"></uni-icons>已签</span>
  17. <span class="sign_btn click" v-else @tap="click_sign()"> <uni-icons class="icon1"
  18. type="plus"></uni-icons>签到</span>
  19. </block>
  20. </div>
  21. <div>账号:{{user.name}}
  22. <image src="/static/img/vip0.png" @tap='joinvip()' class="vipbtn" v-if="user.vip==0" />
  23. <image src="/static/img/vip1.png" @tap='joinvip()' class="vipbtn" style="height: 20px;"
  24. v-if="user.vip>0" />
  25. </div>
  26. </li>
  27. </ul>
  28. <view class="other" @tap="$jump('mine.qrcode')">
  29. <view class="emoji"
  30. style="display: inline-block;vertical-align: middle;margin-right: 2px;;font-size: 24px;color: #fff">
  31. &#xe613;</view>
  32. <uni-icons type="arrowright"
  33. style="font-size: 16px; color: #fff;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  34. </view>
  35. </div>
  36. <!-- <view class="showlines" @tap="$jump('mine.bag')">
  37. <view>
  38. <image src="/static/img/icon/pay.png" />
  39. </view>
  40. <view>
  41. 我的钱包
  42. </view>
  43. <view>
  44. <uni-icons type="arrowright"
  45. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  46. </view>
  47. </view>
  48. <view class="showlines" v-if="user.vip==0" @tap='joinvip()'>
  49. <view>
  50. <image src="/static/img/vip1.png" />
  51. </view>
  52. <view>
  53. 加入VIP
  54. </view>
  55. <view>
  56. <uni-icons type="arrowright"
  57. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  58. </view>
  59. </view> -->
  60. <view class="showlines" v-if="system.inviteopen==1 && user.isdaili==1" @tap="$jump('mine.menu',{act:'team'})">
  61. <view>
  62. <image src="/static/img/group.png" style="border-radius: 50%;" />
  63. </view>
  64. <view>
  65. 我的下级
  66. </view>
  67. <view>
  68. <uni-icons type="arrowright"
  69. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  70. </view>
  71. </view>
  72. <view class="showlines" @tap="$jump('mine.menu',{act:'setting'})">
  73. <view>
  74. <image src="/static/img/icon/setting.png" />
  75. </view>
  76. <view>
  77. 设置
  78. </view>
  79. <view>
  80. <uni-icons type="arrowright"
  81. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  82. </view>
  83. </view>
  84. <!-- <view class="showlines" @tap="$jump('circle.mycircle',{id:user.id})">
  85. <view>
  86. <image src="/static/img/icon-circle.png" />
  87. </view>
  88. <view>
  89. 我的朋友圈
  90. </view>
  91. <view>
  92. <uni-icons type="arrowright"
  93. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  94. </view>
  95. </view> -->
  96. <view class="showlines" @tap="$jump('circle.circle_chat_details')" style="margin-top: 0px;">
  97. <view>
  98. <image src="/static/img/icon/note.png" />
  99. </view>
  100. <view>
  101. 我的消息
  102. </view>
  103. <view>
  104. <uni-icons type="arrowright"
  105. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  106. </view>
  107. </view>
  108. <view class="showlines" @tap="goKf" style="margin-top: 0px;" v-if="kf.id">
  109. <view>
  110. <image src="/static/img/icon/kf.png" />
  111. </view>
  112. <view>
  113. 客服
  114. </view>
  115. <view>
  116. <uni-icons type="arrowright"
  117. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  118. </view>
  119. </view>
  120. <!-- #ifdef APP-PLUS -->
  121. <view class="showlines" @tap="check_upload">
  122. <view>
  123. <uni-icons class="icon2" type='upload'
  124. style="font-size: 22px !important;vertical-align: middle;"></uni-icons>
  125. </view>
  126. <view>检查更新</view>
  127. <view>
  128. <uni-icons type="arrowright"
  129. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  130. </view>
  131. </view>
  132. <!-- #endif -->
  133. <!-- #ifndef APP-PLUS -->
  134. <view class="showlines" @tap="downapp">
  135. <view>
  136. <uni-icons class="icon2" type='download'
  137. style="font-size: 22px !important;vertical-align: middle;"></uni-icons>
  138. </view>
  139. <view>下载APP</view>
  140. <view>
  141. <uni-icons type="arrowright"
  142. style="font-size: 16px; color: #666;display: inline-block;vertical-align: middle;font-weight: 600;"></uni-icons>
  143. </view>
  144. </view>
  145. <!-- #endif -->
  146. <div style="width: 80%;margin: 20px auto;">
  147. <div class="button1" style="text-align: center" @tap="logout()">
  148. 退出登录
  149. </div>
  150. </div>
  151. <div style="height: 50px;width: 100%"></div>
  152. </view>
  153. </template>
  154. <script>
  155. import cache from "../../library/cache.js"
  156. import http from "../../library/http.js"
  157. import api from "../../library/index.js"
  158. import helper from "../../library/helper.js"
  159. import config from "../../config.js"
  160. import uniIcons from '../../components/uni-icons/uni-icons.vue'
  161. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  162. var rewardtop = statusBarHeight + 34;
  163. export default {
  164. components: {
  165. uniIcons,
  166. },
  167. data() {
  168. return {
  169. statusBarHeight: statusBarHeight + 'px',
  170. rewardtop: rewardtop + 'px',
  171. user: uni.getStorageSync('userInfo'),
  172. system: uni.getStorageSync('system'),
  173. msgnum: 0,
  174. avatar: '',
  175. getmoeny: false,
  176. banklen: 0,
  177. showlayer: false,
  178. kf: {},
  179. }
  180. },
  181. methods: {
  182. downapp() {
  183. window.open(this.system.downurl)
  184. },
  185. uploadImage() {
  186. uni.chooseImage({
  187. success: (chooseImageRes) => {
  188. const tempFilePaths = chooseImageRes.tempFilePaths;
  189. helper.uploadFiles(tempFilePaths, 'image', {
  190. type: 'avatar'
  191. }).then(res => {
  192. this.user.avatar = res;
  193. this.avatar = res.replace(config.imgUri, '');
  194. var postdata = {
  195. id: this.user.id,
  196. avatar: this.avatar,
  197. };
  198. http.setWait(false).post('user.php?act=profile', postdata).then(res => {
  199. this.user = res.data;
  200. uni.setStorageSync('userInfo', this.user)
  201. })
  202. })
  203. }
  204. });
  205. },
  206. previewAvatar() {
  207. uni.previewImage({
  208. urls: [this.image_cache(this.user.avatar)],
  209. })
  210. },
  211. href(path, opts) {
  212. if (!opts || opts == undefined || opts == null) opts = {};
  213. this.$jump(path, opts);
  214. },
  215. joinvip() {
  216. if (this.user.vip == 2) return false;
  217. this.href('mine.joinvip', {});
  218. },
  219. fresh_money() {
  220. this.getmoeny = true;
  221. var that = this;
  222. setTimeout(function() {
  223. that.getmoeny = false;
  224. }, 800)
  225. this.getuserinfo();
  226. },
  227. click_sign() {
  228. var status = this.$action.check_userlock();
  229. if (status == true) {
  230. var postdata = {
  231. userid: uni.getStorageSync('access_token')
  232. };
  233. http.setWait(false).post('user.php?act=sign', postdata).then(res => {
  234. this.getuserinfo();
  235. uni.showToast({
  236. title: res.data,
  237. icon: 'none'
  238. })
  239. })
  240. }
  241. },
  242. getuserinfo() {
  243. var postdata = {
  244. id: uni.getStorageSync('access_token')
  245. };
  246. http.setWait(false).post('user.php?act=userinfo', postdata).then(res => {
  247. this.user = res.data;
  248. uni.setStorageSync('userInfo', this.user)
  249. this.getKf()
  250. })
  251. },
  252. getKf() {
  253. http.setWait(false).get('user.php?act=getMyFriend',{userid:uni.getStorageSync('access_token')}).then(res => {
  254. console.log(res);
  255. // console.log();
  256. this.kf = res.data.find(item => item.iskefu > 0)
  257. })
  258. },
  259. goKf() {
  260. console.log(this.kf);
  261. uni.navigateTo({
  262. url:'/pages/friend/chat?id='+ this.kf.id + '&nickname=' + this.kf.nickname
  263. })
  264. },
  265. check_upload() {
  266. let _this = this;
  267. plus.runtime.getProperty(plus.runtime.appid, function(info) {
  268. api.update({
  269. version: info.version,
  270. osname: plus.os.name
  271. }).then(res => {
  272. // console.log(res);
  273. if (res.data.status == 1) {
  274. uni.showModal({ //提醒用户更新
  275. title: "更新提示",
  276. content: res.data.content,
  277. cancelText: '下次再说',
  278. confirmText: '立即更新',
  279. success: (r) => {
  280. if (r.confirm) {
  281. plus.runtime.openURL(res.data.downurl);
  282. }
  283. }
  284. })
  285. } else {
  286. uni.showToast({
  287. icon: 'none',
  288. title: '当前已是最新版本',
  289. duration: 2000
  290. })
  291. }
  292. })
  293. });
  294. },
  295. logout() {
  296. uni.showModal({
  297. title: '提示',
  298. content: '确定要退出吗?',
  299. showCancel: true,
  300. cancelText: '取消',
  301. confirmText: '确定',
  302. success: res => {
  303. if (res.confirm) {
  304. this.$socket.send({
  305. type: 'logout',
  306. token: uni.getStorageSync('access_token'),
  307. });
  308. uni.removeStorageSync('access_token');
  309. uni.removeStorageSync('userInfo');
  310. this.$action.quitcid();
  311. //this.$store.commit('chat/clear')
  312. // this.$jump('game.index')
  313. uni.reLaunch({
  314. url: '/pages/login/index'
  315. })
  316. }
  317. }
  318. });
  319. },
  320. },
  321. onShow() {
  322. if (uni.getStorageSync('access_token') > 0) {
  323. this.getuserinfo();
  324. } else {
  325. this.$jump('login.index');
  326. }
  327. this.$action.setStatusTips();
  328. }
  329. }
  330. </script>
  331. <style lang="scss" scoped>
  332. .page {
  333. background-color: #fafafa;
  334. font-size: 14px;
  335. }
  336. .usercenter {
  337. display: inline-block;
  338. width: 100%;
  339. padding-bottom: 10px;
  340. position: relative;
  341. // background: -webkit-linear-gradient(left top, #01d9ff , #01a9fe);
  342. // background: -o-linear-gradient(bottom right, #01d9ff, #01a9fe);
  343. // background: -moz-linear-gradient(bottom right, #01d9ff, #01a9fe);
  344. // background: linear-gradient(to right, #01d9ff , #01a9fe);
  345. background: $uni-color-primary;
  346. height: 125px;
  347. color: #fff;
  348. padding-left: 0px;
  349. }
  350. .usercenter>ul {
  351. display: flex;
  352. flex-direction: row;
  353. width: calc(100% - 20px);
  354. padding: 10px 10px;
  355. margin-top: 30px;
  356. }
  357. .usercenter .setting {
  358. position: absolute;
  359. right: 20px;
  360. top: 13px;
  361. display: inline-block;
  362. border-radius: 50%;
  363. color: #fff;
  364. font-size: 22px;
  365. }
  366. .usercenter li {
  367. vertical-align: middle;
  368. line-height: 28px;
  369. }
  370. .usercenter li:first-child {
  371. width: 70px;
  372. text-align: left;
  373. padding-left: 15px;
  374. line-height: 30px;
  375. padding-top: 5px;
  376. }
  377. .usercenter li:last-child {
  378. padding-top: 5px;
  379. width: calc(100% - 90px);
  380. }
  381. .usercenter .avatar {
  382. height: 60px;
  383. width: 60px;
  384. border-radius: 5px;
  385. vertical-align: top;
  386. }
  387. .usercenter .other {
  388. color: #fff;
  389. position: absolute;
  390. right: 15px;
  391. bottom: 30px;
  392. line-height: 25px;
  393. text-align: right;
  394. display: inline-block;
  395. width: 60px;
  396. }
  397. .usercenter .menu {
  398. position: absolute;
  399. left: 0px;
  400. width: 100%;
  401. bottom: 0px;
  402. line-height: 40px;
  403. height: 40px;
  404. text-align: center;
  405. display: table;
  406. background-color: rgba(0, 0, 0, 0.3);
  407. }
  408. .usercenter .menu .row {
  409. display: table-cell;
  410. color: #fff;
  411. }
  412. .sexbtn {
  413. height: 16px;
  414. width: 16px;
  415. vertical-align: middle;
  416. border-radius: 5px;
  417. margin-left: 5px;
  418. margin-bottom: 5px
  419. }
  420. .vipbtn {
  421. height: 22px;
  422. width: 22px;
  423. vertical-align: middle;
  424. margin-left: 5px;
  425. margin-bottom: 5px;
  426. }
  427. .button1 {
  428. height: 40px;
  429. line-height: 40px;
  430. border: 0px;
  431. border-radius: 20px;
  432. color: #fff;
  433. // background: -webkit-linear-gradient(left top, #3388ff , #2319dc);
  434. // background: -o-linear-gradient(bottom right, #3388ff, #2319dc);
  435. // background: -moz-linear-gradient(bottom right, #3388ff, #2319dc);
  436. // background: linear-gradient(to bottom right, #3388ff , #2319dc);
  437. background: $uni-color-primary;
  438. width: 100%;
  439. font-size: 16px;
  440. font-weight: 600;
  441. text-align: center;
  442. }
  443. .icon1 {
  444. font-size: 16px !important;
  445. color: #fff !important;
  446. margin-right: 3px;
  447. }
  448. .icon2 {
  449. font-size: 28px !important;
  450. }
  451. .icon3 {
  452. font-size: 16px !important;
  453. color: #333 !important;
  454. margin-right: 1px;
  455. }
  456. .fresh {
  457. transform: rotate(0deg);
  458. -webkit-transform: rotate(0deg);
  459. -moz-transform: rotate(0deg);
  460. -o-transform: rotate(0deg);
  461. -ms-transform: rotate(0deg);
  462. }
  463. .fresh.active {
  464. transform: rotate(360deg);
  465. -webkit-transform: rotate(360deg);
  466. -moz-transform: rotate(360deg);
  467. -o-transform: rotate(360deg);
  468. -ms-transform: rotate(360deg);
  469. transition: all 0.5s ease-in-out;
  470. -webkit-transition: all 0.5s ease-in-out;
  471. -moz-transition: all 0.5s ease-in-out;
  472. -o-transition: all 0.5s ease-in-out;
  473. }
  474. .showlines {
  475. display: flex;
  476. height: 50px;
  477. line-height: 50px;
  478. margin-top: 15px;
  479. flex-direction: row;
  480. background-color: #fff;
  481. }
  482. .showlines>view {
  483. flex-direction: row;
  484. height: 50px;
  485. line-height: 50px;
  486. }
  487. .showlines>view:nth-child(1) {
  488. width: 60px;
  489. text-align: center;
  490. align-items: center;
  491. justify-content: center;
  492. }
  493. .showlines>view:nth-child(2) {
  494. width: calc(100% - 100px);
  495. text-align: left;
  496. font-size: 16px;
  497. color: #000;
  498. }
  499. .showlines>view:nth-child(3) {
  500. width: 40px;
  501. text-align: center;
  502. }
  503. .showlines image {
  504. width: 25px;
  505. height: 25px;
  506. vertical-align: middle;
  507. }
  508. .sign_btn {
  509. height: 25px;
  510. line-height: 25px;
  511. border: 0px;
  512. border-radius: 5px;
  513. cursor: pointer;
  514. padding: 0px 8px;
  515. text-align: center;
  516. font-size: 14px;
  517. font-weight: 600;
  518. display: inline-block;
  519. float: right;
  520. }
  521. .sign_btn.click {
  522. color: #fff;
  523. background: -webkit-linear-gradient(left top, #f05c36, #ff7e00);
  524. background: -o-linear-gradient(bottom right, #f05c36, #ff7e00);
  525. background: -moz-linear-gradient(bottom right, #f05c36, #ff7e00);
  526. background: linear-gradient(to bottom right, #f05c36, #ff7e00);
  527. }
  528. .sign_btn i:before {
  529. margin-left: 0px;
  530. }
  531. .sign_btn.ok {
  532. color: #2319dc;
  533. background-color: #ccc;
  534. border: 1px solid #ddd;
  535. height: 23px;
  536. line-height: 23px;
  537. }
  538. </style>