index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <view class="myPage">
  3. <!-- <view class="topTitle">
  4. <view class="topFont">
  5. 我的
  6. </view>
  7. <view class="top-right-cion">
  8. <image @click="toScan" src="/static/my/scan.png" mode=""></image>
  9. </view>
  10. </view> -->
  11. <view class="myTop">
  12. <view class="topBg">
  13. <view class="centerIcon">
  14. <view class="headerImg">
  15. <image :src="myPhoto" @tap="goPath('/pages/my/details')" :lazy-load="true" />
  16. </view>
  17. <view class="top-right-cion">
  18. <image @click="toScan" src="/static/my/scan1.png" mode=""></image>
  19. <image @click="toHelp" src="/static/my/wen1.png" mode=""></image>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="userName" @tap="goPath('/pages/my/details')">
  24. <view class="userLf">
  25. <text>{{my_data.nickname}}</text>
  26. <text>易趣号:{{my_data.username}}</text>
  27. <!-- <text>邀请码:{{my_data.code}}</text> -->
  28. </view>
  29. <view class="userRt">
  30. <text class="circle"></text>
  31. <image class="header_erw" src="/static/theme/default/my/qrcode.png"
  32. @tap.stop="goPath('/pages/my/qrcode')" :lazy-load="true" />
  33. </view>
  34. </view>
  35. </view>
  36. <view class="listOut">
  37. <uni-list class="list">
  38. <uni-list-item v-if="showBindPhone" title="绑定手机号" :show-arrow="true" :showArrow="true"
  39. thumb="../../static/my/bindPhone.png" @click="goPath('../set/bindPhone')" />
  40. <uni-list-item v-if="my_data && !my_data.openId" title="绑定微信" :show-arrow="true" :showArrow="true"
  41. thumb="../../static/my/bindWx.png" @click="goPath('../set/bindWx')" />
  42. <!-- <uni-list-item title="零钱" :showArrow="true" :show-arrow="true" badge-type="error"
  43. thumb="../../static/theme/default/user/1.png" @click="goPath('./wallet/index')" /> -->
  44. <uni-list-item title="收藏" :show-arrow="true" :showArrow="true" thumb="/static/theme/default/user/2.png"
  45. @click="goPath('store')" />
  46. <!-- <uni-list-item title="帮助" :showArrow="true" :show-arrow="true" badge-type="error"
  47. thumb="../../static/theme/default/user/4.png" @click="goPath('../article/article')"
  48. v-if="showKefu" /> -->
  49. <uni-list-item title="客服" :showArrow="true" :show-arrow="true" badge-type="error"
  50. thumb="../../static/theme/default/user/3.png" @click="goKefu" v-if="showKefu" />
  51. <uni-list-item title="设置" :show-arrow="true" :showArrow="true"
  52. thumb="../../static/theme/default/user/5.png" @click="goPath('../set/index')" />
  53. </uni-list>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import uniList from '../../components/uni-ui/uni-list/uni-list.vue';
  59. import uniListItem from '../../components/uni-ui/uni-list-item/uni-list-item.vue';
  60. import _get from '../../common/_get';
  61. import _hook from '../../common/_hook';
  62. import _data from '../../common/_data';
  63. import _page from '../../common/common';
  64. export default {
  65. components: {
  66. uniList,
  67. uniListItem
  68. },
  69. data() {
  70. return {
  71. showBindPhone: true,
  72. my_data: {
  73. id: 0
  74. },
  75. show_tips: '',
  76. show_pay_tips: '',
  77. status_height: ''
  78. }
  79. },
  80. onShow() {
  81. _hook.routeTabBarHook();
  82. let num = _data.data('no_reader_circle_chat_num'),
  83. _this = this;
  84. _this.my_data = _data.data('user_info');
  85. /** 监听新的个人数据 */
  86. uni.$on('data_user_info', function(data) {
  87. _this.my_data = data;
  88. console.log(_this.my_data)
  89. });
  90. this.getUser()
  91. /** 监听朋友圈动态提示 */
  92. // uni.$on('data_circle_tips', function (data) {
  93. // _this.show_tips = data;
  94. // });
  95. // uni.$on('data_pay_tips',function (data) {
  96. // _this.show_pay_tips = data;
  97. // })
  98. // if (num) {
  99. // this.show_tips = num;
  100. // } else if (_data.data('no_reader_circle')) {
  101. // this.show_tips = '好友动态';
  102. // } else {
  103. // this.show_tips = '';
  104. // }
  105. },
  106. onLoad() {
  107. let sys = uni.getSystemInfoSync();
  108. this.status_height = sys.statusBarHeight;
  109. },
  110. onHide() {
  111. //uni.$off('data_user_info');
  112. uni.$off('data_circle_tips');
  113. },
  114. computed: {
  115. myPhoto() {
  116. return _data.staticPhoto() + this.my_data.photo;
  117. },
  118. showKefu() {
  119. return this.my_data.id != 5880
  120. }
  121. },
  122. methods: {
  123. getUser() {
  124. let _this = this;
  125. _get.getUserInfo({}, function(data) {
  126. data.photo = data.photo + "?_=" + +Math.random();
  127. data.photo = data.photo.replace(/(\?_=)[\d\.]+$/, "$1" + Math.random());
  128. console.log("res个人资料", data);
  129. _this.my_data = data;
  130. _data.data("user_info", data);
  131. function isPhoneNumber(str) {
  132. const regex = /^1[23456789]\d{9}$/;
  133. return regex.test(str);
  134. }
  135. _this.showBindPhone = !isPhoneNumber(_this.my_data.username);
  136. });
  137. },
  138. toScan() {
  139. // #ifdef H5
  140. uni.showToast({
  141. icon: 'none',
  142. title: '请使用APP打开'
  143. })
  144. // #endif
  145. // #ifdef APP-PLUS
  146. let _this = this;
  147. // _this.action_menu = false;
  148. _page.scanCode();
  149. // #endif
  150. },
  151. toHelp() {
  152. uni.navigateTo({
  153. url: '/pages/article/article'
  154. })
  155. },
  156. goPath(path) {
  157. console.log(1111)
  158. if (path) {
  159. uni.navigateTo({
  160. url: path,
  161. });
  162. }
  163. },
  164. goKefu() {
  165. this.$httpSend({
  166. path: '/im/get/kefu',
  167. success(data) {
  168. console.log('客服数据', data)
  169. uni.navigateTo({
  170. 'url': '/pages/chat/message?list_id=' + data
  171. })
  172. }
  173. });
  174. },
  175. goScanCode() {
  176. // uni.navigateTo({
  177. // url: '../chat/videoCall'
  178. // });
  179. let _this = this;
  180. uni.scanCode({
  181. success: function(res) {
  182. /** 验证必须是一个地址 */
  183. if (/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$/.test(
  184. res.result)) {
  185. /** 本应用页面 */
  186. console.log(res.result);
  187. if (new RegExp(_data.data('http_url')).test(res.result)) {
  188. if (res.result.match(/\/([a-z]+_[a-z]+)\/(.+)$/) && RegExp.$1 && RegExp.$2) {
  189. switch (RegExp.$1) {
  190. case 'chat_add':
  191. uni.navigateTo({
  192. url: '/page/details/index?user_id=' + RegExp.$2 +
  193. '&is_type=3',
  194. });
  195. break;
  196. case 'group_add':
  197. let option = (RegExp.$2 + '').split('&');
  198. _this.$httpSend({
  199. path: '/im/message/addChat',
  200. data: {
  201. users: option[1],
  202. list_id: option[0],
  203. type: 1,
  204. },
  205. success_action: true,
  206. success(res) {
  207. let tips = res.err ? res.msg :
  208. '已经申请加入群聊,请耐心等待群管理审核';
  209. uni.showModal({
  210. content: tips,
  211. showCancel: false,
  212. });
  213. }
  214. });
  215. break;
  216. default:
  217. uni.showModal({
  218. content: '二维码内容:' + res.result,
  219. showCancel: false,
  220. });
  221. break;
  222. }
  223. } else {
  224. uni.showModal({
  225. content: '二维码内容:' + res.result,
  226. showCancel: false,
  227. });
  228. }
  229. } /** 打开新地址 */
  230. else {
  231. uni.navigateTo({
  232. url: '../push/web?url=' + encodeURIComponent(res.result),
  233. });
  234. }
  235. } else {
  236. uni.showModal({
  237. content: '二维码内容:' + res.result,
  238. showCancel: false,
  239. });
  240. }
  241. },
  242. fail(e) {
  243. console.log(e);
  244. return false;
  245. return;
  246. uni.showToast({
  247. title: '扫码错误:' + JSON.stringify(e),
  248. duration: 2000,
  249. });
  250. },
  251. });
  252. },
  253. },
  254. watch: {},
  255. }
  256. </script>
  257. <style>
  258. .uni-list-item .uni-list-item__container:after {
  259. position: absolute;
  260. z-index: 10;
  261. right: 0;
  262. bottom: 0;
  263. left: 16px;
  264. height: 1px;
  265. content: '';
  266. -webkit-transform: scaleY(.5);
  267. transform: scaleY(.5);
  268. background-color: rgb(215, 215, 215) !important;
  269. }
  270. </style>
  271. <style>
  272. body {
  273. height: 100%;
  274. }
  275. .topTitle {
  276. background-color: #fff;
  277. box-sizing: border-box;
  278. padding: 20rpx 30rpx;
  279. /* #ifdef APP-PLUS */
  280. padding-top: var(--status-bar-height);
  281. /* #endif */
  282. display: flex;
  283. justify-content: space-between;
  284. align-items: center;
  285. width: 100vw;
  286. position: fixed;
  287. top: 0;
  288. left: 0;
  289. background: #fff;
  290. z-index: 10;
  291. }
  292. .topFont {
  293. font-size: 40rpx;
  294. color: #080E18;
  295. font-weight: bold;
  296. margin-left: 10rpx;
  297. }
  298. .myPage {
  299. height: 100%;
  300. min-height: 100vh;
  301. background-color: #fff;
  302. }
  303. .iconfonts {
  304. position: absolute;
  305. right: 160rpx;
  306. bottom: 0px;
  307. font-size: 16px;
  308. }
  309. .header-msg {
  310. padding-left: 10px;
  311. }
  312. .phto {
  313. width: 106upx;
  314. height: 106upx;
  315. margin-left: 30 upx;
  316. margin-right: 30 upx;
  317. }
  318. .list {
  319. /* margin-top: 10upx; */
  320. }
  321. .qrcode {
  322. width: 50 upx;
  323. height: 50 upx;
  324. margin-right: -20 upx;
  325. }
  326. .my_padding {
  327. padding: 50px 15px 16px 15px;
  328. display: flex;
  329. background-color: #fff;
  330. }
  331. .uni-media-list-logo {
  332. padding: 2px;
  333. border-radius: 10px;
  334. height: 70px !important;
  335. width: 70px !important;
  336. margin-right: 0upx !important;
  337. margin-left: 0upx !important;
  338. }
  339. .my_padding:after {
  340. font-family: uniicons;
  341. content: '\e583';
  342. position: absolute;
  343. right: 15px;
  344. top: 15%;
  345. font-size: 24px;
  346. color: #bbb;
  347. -webkit-transform: translateY(-50%);
  348. transform: translateY(-50%);
  349. }
  350. .header-erw {
  351. position: absolute;
  352. right: 45px;
  353. top: 13%;
  354. font-size: 24px;
  355. width: 24px;
  356. height: 24px;
  357. z-index: 9999;
  358. }
  359. .uni-list {
  360. margin-bottom: 30 upx;
  361. }
  362. .uni-list-cell-navigate.uni-navigate-right:after {
  363. font-size: 20px !important;
  364. }
  365. .myTop {
  366. width: 100%;
  367. position: relative;
  368. background-color: #fff;
  369. padding-bottom: 10rpx;
  370. }
  371. .topBg {
  372. width: 100%;
  373. height: 320rpx;
  374. background: url('../../static/theme/default/my/user_icon_bg.png') no-repeat 0 0;
  375. background-size: 100% 100%;
  376. display: flex;
  377. align-items: center;
  378. align-self: center;
  379. align-content: center;
  380. box-sizing: border-box;
  381. padding: 0 30rpx;
  382. position: relative;
  383. }
  384. .top-right-cion {
  385. position: absolute;
  386. height: 80rpx;
  387. display: flex;
  388. width: 100vw;
  389. display: flex;
  390. justify-content: flex-end;
  391. align-items: center;
  392. top: 50%;
  393. right: 0;
  394. transform: translateY(-50%);
  395. }
  396. .top-right-cion image {
  397. width: 40rpx;
  398. height: 40rpx;
  399. margin-right: 30rpx;
  400. }
  401. .centerIcon {
  402. height: 40rpx;
  403. width: 100%;
  404. display: flex;
  405. justify-content: flex-end;
  406. }
  407. .centerIcon>.item {
  408. width: 40rpx;
  409. height: 40rpx;
  410. margin-left: 36rpx;
  411. }
  412. .headerImg {
  413. width: 166rpx;
  414. height: 166rpx;
  415. border-radius: 50%;
  416. box-shadow: 0 15upx 10upx #F2F2F2;
  417. position: absolute;
  418. left: 54rpx;
  419. top: 210rpx;
  420. overflow: hidden;
  421. border: 4rpx solid #fff;
  422. box-shadow: 0 0 20rpx 10rpx rgba(0, 0, 0, .1);
  423. }
  424. .headerImg>image {
  425. width: 100%;
  426. height: 100%;
  427. }
  428. .userName {
  429. display: flex;
  430. justify-content: space-between;
  431. flex-wrap: wrap;
  432. align-items: center;
  433. box-sizing: border-box;
  434. padding: 0 62rpx;
  435. margin-top: 126rpx;
  436. }
  437. .userLf>text:first-child {
  438. font-size: 40rpx;
  439. color: #0A0E1A;
  440. text-align: left;
  441. font-weight: bold;
  442. display: block;
  443. }
  444. .userLf>text:last-child {
  445. font-size: 32rpx;
  446. color: #B0B0B3;
  447. text-align: left;
  448. display: block;
  449. }
  450. .header_erw {
  451. width: 42rpx;
  452. height: 42rpx;
  453. margin-right: 30upx;
  454. }
  455. .userRt {
  456. display: flex;
  457. justify-content: flex-end;
  458. align-items: center;
  459. position: relative;
  460. }
  461. .userRt::after {
  462. font-family: uniicons;
  463. content: '\e583';
  464. position: absolute;
  465. right: -20rpx;
  466. top: -20rpx;
  467. font-size: 24px;
  468. color: rgb(187, 187, 187);
  469. }
  470. .circle {
  471. display: inline-block;
  472. height: 14upx;
  473. width: 14upx;
  474. padding: 0;
  475. border-radius: 50%;
  476. background-color: #F16858;
  477. margin-right: 10rpx;
  478. }
  479. .listOut {
  480. width: 100%;
  481. box-sizing: border-box;
  482. padding: 0 16rpx 0 24rpx;
  483. background-color: #fff;
  484. padding-bottom: 100rpx;
  485. }
  486. </style>