user.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="container">
  3. <view class="user-info-box">
  4. <view class="detail flex" @click="navTo('/pages/set/userinfo')">
  5. <view class="portrait-box"><image class="portrait" :src="userInfo.avatar || '../../static/error/missing-face.png'"></image></view>
  6. <view class="info-box">
  7. <view class="username">{{ userInfo.nickname || $t('hea.yk') }}</view>
  8. <view class="font-size-sm">{{ userInfo.mobile || '' }}</view>
  9. </view>
  10. <view class="vip">
  11. <image v-if="isVip == 1" src="../../static/img/usernovip.png" mode=""></image>
  12. <image v-if="isVip == 2" src="../../static/img/uservip.png" mode=""></image>
  13. </view>
  14. </view>
  15. <view class="config iconfont"><text class="setting iconsetting" @click="navTo('/pages/set/userinfo')"></text></view>
  16. </view>
  17. <!-- <view class="vip-box" @click="navTo('/pages/user/upgrade')"><image src="../../static/img/vip.png" mode=""></image></view> -->
  18. <view class="tt">
  19. <view class="tt-box" @click="navTo('/pages/user/promotion')">
  20. <image src="../../static/img/tuiguang.png" class="tt-icon1" mode=""></image>
  21. <view class="tt-txt">{{ $t('hea.wdtg') }}</view>
  22. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  23. </view>
  24. <view class="tt-box" @click="navTo('/pages/user/team')">
  25. <image src="../../static/img/team.png" class="tt-icon1" mode=""></image>
  26. <view class="tt-txt">{{ $t('hea.wdtd') }}</view>
  27. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  28. </view>
  29. <view class="tt-box" @click="navTo('/pages/profit/profit')">
  30. <image src="../../static/img/money.png" class="tt-icon5" mode=""></image>
  31. <view class="tt-txt">{{ $t('hea.syzx') }}</view>
  32. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  33. </view>
  34. <view class="tt-box" @click="navTo('/pages/user/shareQrCode')">
  35. <image src="../../static/img/share.png" class="tt-icon1" mode=""></image>
  36. <view class="tt-txt">{{ $t('hea.fxhy') }}</view>
  37. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  38. </view>
  39. <view class="tt-box" @click="open()">
  40. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  41. <view class="tt-txt">{{ $t('hea.lxkf') }}</view>
  42. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  43. </view>
  44. </view>
  45. <uni-popup ref="popup" type="center">
  46. <view class="popup-box">
  47. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  48. <view class="mian">
  49. <view class="delivery">
  50. <view class="title">{{ $t('foo.yjwndzzskf') }}</view>
  51. <image src="../../static/img/img010.png" mode=""></image>
  52. </view>
  53. <view class="nocancel">{{ $t('foo.kfwx') }}1: {{ text }}</view>
  54. <view class="nocancel">{{ $t('foo.kfwx') }}2: {{ text1 }}</view>
  55. <view class="nocancel">{{ $t('foo.kfwx') }}3: {{ text2 }}</view>
  56. <view class="comfirm-box">
  57. <view class="cancel" @click="tocall('1')">{{ $t('foo.fzwx') }}1</view>
  58. <view class="comfirm" @click="tocall('2')">{{ $t('foo.fzwx') }}2</view>
  59. </view>
  60. <view class="comfirm-box">
  61. <view class="comfirm" @click="tocall('3')">{{ $t('foo.fzwx') }}3</view>
  62. <view class="cancel" @click="cancel">{{ $t('foo.qx') }}</view>
  63. </view>
  64. </view>
  65. </view>
  66. </uni-popup>
  67. <u-tabbar :list="tabbar" bg-color="#000" active-color="#FAD6B0" inactive-color="#71614f" change="change"></u-tabbar>
  68. </view>
  69. </template>
  70. <script>
  71. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  72. import uniCopy from '@/utils/uni-copy.js';
  73. import { tabbar } from '@/components/tabbar/tabbar.js';
  74. import { mapState, mapMutations } from 'vuex';
  75. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  76. import { getUserInfo } from '@/api/user.js';
  77. export default {
  78. data() {
  79. return {
  80. text: 'BYTCKF21',
  81. text1: 'BYTCKF33',
  82. text2: 'BYTCKF67',
  83. isVip: 1,
  84. tabbar: [
  85. {
  86. iconPath: '../../static/tabBar/home.png',
  87. selectedIconPath: '../../static/tabBar/home-action.png',
  88. text: this.$t('hea.sy'),
  89. pagePath: '/pages/index/index'
  90. },
  91. {
  92. iconPath: '../../static/tabBar/center.png',
  93. selectedIconPath: '../../static/tabBar/center-action.png',
  94. text: this.$t('hea.shlb'),
  95. pagePath: '/pages/user/applyList'
  96. },
  97. {
  98. iconPath: '../../static/tabBar/user.png',
  99. selectedIconPath: '../../static/tabBar/user-action.png',
  100. text: this.$t('hea.wd'),
  101. pagePath: '/pages/user/user'
  102. }
  103. ]
  104. };
  105. },
  106. components: {
  107. uniPopup
  108. },
  109. watch: {
  110. lang(val) {
  111. console.log(val);
  112. this.$set(this.tabbar[0], 'text', this.$t('hea.sy'));
  113. this.$set(this.tabbar[1], 'text', this.$t('hea.shlb'));
  114. this.$set(this.tabbar[2], 'text', this.$t('hea.wd'));
  115. }
  116. },
  117. computed: {
  118. ...mapState(['lang']),
  119. ...mapState('user', ['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
  120. },
  121. onShow() {
  122. uni.setNavigationBarTitle({
  123. title: this.$t('foo.wd')
  124. });
  125. //判断是否已经登录
  126. if (this.hasLogin) {
  127. this.loadBaseData();
  128. } else {
  129. let obj = this;
  130. uni.showModal({
  131. title: obj.$t('hea.login'),
  132. content: obj.$t('hea.logininfo'),
  133. success: e => {
  134. if (e.confirm) {
  135. saveUrl();
  136. interceptor();
  137. }
  138. },
  139. fail: e => {
  140. console.log(e);
  141. }
  142. });
  143. }
  144. },
  145. methods: {
  146. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  147. loadBaseData() {
  148. getUserInfo({})
  149. .then(({ data }) => {
  150. console.log(data, 'UserInfo+++++++++++++++++');
  151. if (data.activity[1].my_join) {
  152. if (data.activity[1].my_join.status == '2') {
  153. console.log(111)
  154. this.isVip = 2;
  155. }else {
  156. this.isVip = 1;
  157. }
  158. }
  159. this.setUserInfo(data);
  160. })
  161. .catch(e => {
  162. console.log(e);
  163. });
  164. },
  165. navTo(url) {
  166. console.log(url);
  167. if (!this.hasLogin) {
  168. // 保存地址
  169. saveUrl();
  170. // 登录拦截
  171. interceptor();
  172. } else {
  173. uni.navigateTo({
  174. url
  175. });
  176. }
  177. },
  178. open() {
  179. console.log('点击出现弹窗');
  180. this.$refs.popup.open();
  181. },
  182. // 客服弹窗 - 取消
  183. cancel() {
  184. this.$refs.popup.close();
  185. },
  186. tocall(type) {
  187. // #ifdef APP-PLUS
  188. console.log(type)
  189. let text ='';
  190. if(type == '1'){
  191. text = this.text
  192. }
  193. if(type == '2'){
  194. text = this.text1
  195. }
  196. if(type == '3'){
  197. text = this.text2
  198. }
  199. uni.setClipboardData({
  200. data: text,
  201. success: e => {
  202. uni.showToast({
  203. title: '复制成功!'
  204. });
  205. },
  206. fail(e) {
  207. uni.showToast({
  208. title: '复制失败',
  209. icon: false
  210. });
  211. console.log(e);
  212. }
  213. });
  214. // #endif
  215. }
  216. }
  217. };
  218. </script>
  219. <style lang="scss">
  220. page,
  221. .container {
  222. background: #000;
  223. height: 100%;
  224. }
  225. .user-info-box {
  226. padding: 40rpx 46rpx 0;
  227. height: 180rpx;
  228. color: white;
  229. display: flex;
  230. align-items: center;
  231. justify-content: space-between;
  232. position: relative;
  233. z-index: 1;
  234. .detail {
  235. height: 130rpx;
  236. .portrait-box {
  237. height: 100%;
  238. .portrait {
  239. width: 130rpx;
  240. height: 100%;
  241. border: 5rpx solid #fff;
  242. border-radius: 50%;
  243. }
  244. }
  245. .info-box {
  246. margin-left: 20rpx;
  247. line-height: 1.5;
  248. .username {
  249. font-size: $font-lg + 6rpx;
  250. height: 100%;
  251. }
  252. }
  253. .vip {
  254. margin-left: 20rpx;
  255. width: 122rpx;
  256. height: 36rpx;
  257. image {
  258. width: 100%;
  259. height: 100%;
  260. }
  261. }
  262. }
  263. .config {
  264. font-size: 48rpx;
  265. }
  266. }
  267. .vip-box {
  268. width: 690rpx;
  269. height: 200rpx;
  270. margin: 60rpx auto 0;
  271. image {
  272. width: 100%;
  273. height: 100%;
  274. }
  275. }
  276. .tt {
  277. margin: 0 auto;
  278. width: 750rpx;
  279. padding: 40rpx 70rpx;
  280. background-color: #000;
  281. .tt-box {
  282. padding: 20rpx;
  283. height: 100rpx;
  284. display: flex;
  285. align-items: center;
  286. border-bottom: 1px solid #838383;
  287. .tt-icon1 {
  288. width: 42rpx;
  289. height: 37rpx;
  290. }
  291. .tt-icon2 {
  292. width: 49rpx;
  293. height: 38rpx;
  294. }
  295. .tt-icon3 {
  296. width: 46rpx;
  297. height: 40rpx;
  298. }
  299. .tt-icon4 {
  300. width: 40rpx;
  301. height: 42rpx;
  302. }
  303. .tt-icon5 {
  304. width: 44rpx;
  305. height: 44rpx;
  306. }
  307. .tt-txt {
  308. font-size: 28rpx;
  309. font-family: PingFang SC;
  310. font-weight: 500;
  311. color: #ffffff;
  312. margin-left: 36rpx;
  313. color: #ffffff;
  314. flex: 1;
  315. }
  316. .next-icon {
  317. width: 16rpx;
  318. height: 25rpx;
  319. }
  320. }
  321. .border-b {
  322. border-bottom: 1px solid #f0f0f0;
  323. }
  324. }
  325. .popup-box {
  326. width: 522rpx;
  327. padding-bottom: 40rpx;
  328. background-color: #ffffff;
  329. border-radius: 20rpx;
  330. position: relative;
  331. .img {
  332. position: relative;
  333. top: -56rpx;
  334. left: 0;
  335. width: 522rpx;
  336. height: 132rpx;
  337. display: flex;
  338. justify-content: center;
  339. image {
  340. border-radius: 20rpx 20rpx 0 0;
  341. width: 450rpx;
  342. height: 132rpx;
  343. }
  344. }
  345. .mian {
  346. margin-top: -44rpx;
  347. display: flex;
  348. flex-direction: column;
  349. align-items: center;
  350. // padding: 32rpx 32rpx;
  351. background-color: #ffffff;
  352. border-radius: 0 0 20rpx 20rpx;
  353. text-align: center;
  354. .delivery {
  355. font-size: 40rpx;
  356. color: #333333;
  357. display: flex;
  358. align-items: center;
  359. flex-direction: column;
  360. .title {
  361. }
  362. image {
  363. margin-top: 48rpx;
  364. width: 172rpx;
  365. height: 160rpx;
  366. }
  367. }
  368. .nocancel {
  369. font-size: 32rpx;
  370. color: #333333;
  371. margin-top: 14rpx;
  372. }
  373. .comfirm-box {
  374. margin-top: 52rpx;
  375. display: flex;
  376. // margin-bottom: 32rpx;
  377. // justify-content: space-around;
  378. .cancel {
  379. margin-left: 32rpx;
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. width: 197rpx;
  384. height: 74rpx;
  385. border: 1px solid #dcc786;
  386. border-radius: 38rpx;
  387. font-size: 32rpx;
  388. color: #605128;
  389. }
  390. .comfirm {
  391. margin-left: 32rpx;
  392. display: flex;
  393. align-items: center;
  394. justify-content: center;
  395. width: 197rpx;
  396. height: 74rpx;
  397. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  398. border-radius: 38px;
  399. font-size: 32rpx;
  400. color: #605128;
  401. }
  402. }
  403. }
  404. }
  405. </style>