mine.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <view>
  3. <!-- 个人信息 -->
  4. <view class="person-infos">
  5. <view class="main">
  6. <view class="photo">
  7. <img v-if="userInfo.headImg" :src="userInfo.headImg" alt="">
  8. <u-avatar v-else size="120" ></u-avatar>
  9. </view>
  10. <view class="infos">
  11. <view class="name">
  12. {{userInfo.name}}
  13. </view>
  14. <view class="department-position">
  15. <view class="department" v-if="userInfo.orgName">
  16. <view class="icon">
  17. <img src="../../assets/img/department.png" alt="">
  18. </view>
  19. <view class="text">
  20. {{userInfo.orgName}}
  21. </view>
  22. </view>
  23. <view class="position">
  24. <text class="icon">
  25. <img src="../../assets/img/position.png" alt="">
  26. </text>
  27. <text class="text">
  28. 员工
  29. </text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="to-homepage" v-if="false" >
  34. <text class="text">个人主页</text><text>
  35. <u-icon size="32" name="arrow-right" color="#80FFFFFF"></u-icon>
  36. </text>
  37. </view>
  38. </view>
  39. <view class="grid">
  40. <view class="item">
  41. <view class="amout">
  42. 0
  43. </view>
  44. <view class="text">
  45. 发布
  46. </view>
  47. </view>
  48. <view class="item" @click="gotoUrl('pages/mine/myLike')" >
  49. <view class="amout">
  50. 0
  51. </view>
  52. <view class="text">
  53. 点赞
  54. </view>
  55. </view>
  56. <view class="item" @click="gotoUrl('pages/mine/myComment')" >
  57. <view class="amout">
  58. 0
  59. </view>
  60. <view class="text">
  61. 评论
  62. </view>
  63. </view>
  64. <view class="item">
  65. <view class="amout">
  66. {{plusInfo.userPoints}}
  67. </view>
  68. <view class="text">
  69. 积分
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 功能 -->
  75. <view class="function-group group1" v-if="false">
  76. <view class="item">
  77. <view class="title">
  78. <view class="icon">
  79. <img src="../../assets/img/riLine-gift-2-line@2x.png" alt="">
  80. </view>
  81. <view class="text">
  82. 我的获奖记录
  83. </view>
  84. </view>
  85. <view class="right">
  86. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  87. </view>
  88. </view>
  89. <view class="item">
  90. <view class="title">
  91. <view class="icon">
  92. <img src="../../assets/img/riLine-coin-line@2x.png" alt="">
  93. </view>
  94. <view class="text">
  95. 积分兑换
  96. </view>
  97. </view>
  98. <view class="right">
  99. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="function-group ">
  104. <view class="item" @click="gotoUrl('pages/mine/data')">
  105. <view class="title">
  106. <view class="icon">
  107. <img src="../../assets/img/riLine-account-box-line@2x.png" alt="">
  108. </view>
  109. <view class="text">
  110. 个人资料
  111. </view>
  112. </view>
  113. <view class="right">
  114. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  115. </view>
  116. </view>
  117. <view class="item" @click="gotoUrl('pages/mine/phone')" >
  118. <view class="title">
  119. <view class="icon">
  120. <img src="../../assets/img/riLine-smartphone-line@2x.png" alt="">
  121. </view>
  122. <view class="text">
  123. 绑定手机
  124. </view>
  125. </view>
  126. <view class="right">
  127. <text class="value">{{userPhone}}</text>
  128. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  129. </view>
  130. </view>
  131. <view class="item" @click="gotoUrl('pages/mine/feedback')" >
  132. <view class="title">
  133. <view class="icon">
  134. <img src="../../assets/img/riLine-file-edit-line@2x.png" alt="">
  135. </view>
  136. <view class="text">
  137. 意见反馈
  138. </view>
  139. </view>
  140. <view class="right">
  141. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  142. </view>
  143. </view>
  144. <view class="item" v-if="false">
  145. <view class="title">
  146. <view class="icon">
  147. <img src="../../assets/img/riLine-customer-service-2-line@2x.png" alt="">
  148. </view>
  149. <view class="text">
  150. 联系我们
  151. </view>
  152. </view>
  153. <view class="right">
  154. <text class="value">0716-8888888</text>
  155. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  156. </view>
  157. </view>
  158. <view class="item" @click="logout" >
  159. <view class="title">
  160. <view class="icon">
  161. <img src="../../assets/img/riLine-logout-box-r-line@2x.png" alt="">
  162. </view>
  163. <view class="text">
  164. 退出账号
  165. </view>
  166. </view>
  167. <view class="right">
  168. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  169. </view>
  170. </view>
  171. </view>
  172. <tabbar current="2"></tabbar>
  173. </view>
  174. </template>
  175. <script>
  176. import * as API from '@/apis/pagejs/user.js'
  177. import tabbar from "../../components/Tabbar.vue"
  178. export default {
  179. components: {
  180. tabbar
  181. },
  182. data() {
  183. return {
  184. plusInfo:{},
  185. userInfo:{},
  186. userPhone:"",
  187. }
  188. },
  189. onLoad() {
  190. this.init()
  191. },
  192. onShow(){
  193. this.findByOpenId()
  194. },
  195. methods: {
  196. init(){
  197. this.plusInfo=this.carhelp.getPersonInfoPlus();
  198. this.userInfo=this.carhelp.getPersonInfo();
  199. if(this.userInfo&&this.userInfo.phone){
  200. var phone = this.userInfo.phone;
  201. var phone1 = phone.slice(0,3);
  202. var phone2 = phone.slice(-4);
  203. this.userPhone = phone1 + '****' + phone2;
  204. }
  205. },
  206. findByOpenId(){
  207. API.findByOpenId({
  208. noerror:true,
  209. openId: this.carhelp.getOpenId(),
  210. }).then((response) => {
  211. this.carhelp.setPersonInfo(response.data.regUser);
  212. this.carhelp.setPersonInfoPlus(response.data)
  213. this.init();
  214. }).catch(error => {
  215. uni.hideLoading();
  216. })
  217. },
  218. logoutApi(){
  219. uni.showLoading({
  220. title: "加载中",
  221. mask: true,
  222. })
  223. var data = {
  224. };
  225. API.logout(data).then((res) => {
  226. this.carhelp.logoff();
  227. uni.reLaunch({
  228. url:"/"
  229. })
  230. }).catch(error => {
  231. uni.showToast({
  232. title: error
  233. })
  234. })
  235. },
  236. phone(){
  237. uni.makePhoneCall({
  238. phoneNumber:this.tel //仅为示例
  239. });
  240. },
  241. logout(){
  242. uni.showModal({
  243. title: '提示',
  244. content: '确认是否退出?',
  245. success: res=> {
  246. if (res.confirm) {
  247. //付钱 改为组件
  248. this.logoutApi();
  249. } else if (res.cancel) {
  250. console.log('用户点击取消');
  251. }
  252. }
  253. });
  254. },
  255. }
  256. }
  257. </script>
  258. <style lang="scss" scoped>
  259. page{
  260. font-family: 'Regular';
  261. }
  262. // 个人信息
  263. .person-infos {
  264. background: linear-gradient(45.45deg, rgba(6, 50, 130, 1) -0.45%, rgba(0, 88, 209, 1) 23.41%, rgba(0, 53, 153, 1) 52.12%, rgba(0, 66, 178, 1) 77.4%, rgba(0, 20, 130, 1) 100.65%);
  265. color: rgba(255, 255, 255, 1);
  266. padding: 40rpx 32rpx 116rpx 32rpx;
  267. .main {
  268. display: flex;
  269. align-items: center;
  270. .photo {
  271. img {
  272. width: 120rpx;
  273. height: 120rpx;
  274. border-radius: 50px;
  275. }
  276. }
  277. .infos {
  278. margin-left: 24rpx;
  279. .name {
  280. line-height: 28px;
  281. font-size: 20px;
  282. font-family: 'Medium';
  283. }
  284. .department-position {
  285. display: flex;
  286. align-items: center;
  287. margin-top: 16rpx;
  288. .icon {
  289. margin-right: 8rpx;
  290. img {
  291. width: 28rpx;
  292. height: 28rpx;
  293. }
  294. }
  295. .department {
  296. display: flex;
  297. .text{
  298. line-height: 16px;
  299. }
  300. }
  301. .position {
  302. display: flex;
  303. margin-left: 24rpx;
  304. .text{
  305. line-height: 16px;
  306. }
  307. }
  308. }
  309. }
  310. .to-homepage {
  311. margin-left: auto;
  312. .text {
  313. font-size: 16px;
  314. margin-right: 8rpx;
  315. }
  316. }
  317. }
  318. .grid {
  319. width: 100%;
  320. display: flex;
  321. flex-direction: row;
  322. flex-wrap: wrap;
  323. align-items: center;
  324. margin-top: 24rpx;
  325. .item {
  326. width: 25%;
  327. text-align: center;
  328. .amout {
  329. font-size: 48rpx;
  330. line-height: 64rpx;
  331. }
  332. .text {
  333. font-size: 32rpx;
  334. line-height: 44rpx;
  335. }
  336. }
  337. }
  338. }
  339. // 功能
  340. .group1 {
  341. margin-top: -72rpx !important;
  342. }
  343. .function-group {
  344. border-radius: 8px 8px 0px 0px;
  345. background-color: rgba(255, 255, 255, 1);
  346. padding: 0 0 0 24rpx;
  347. margin: 0 32rpx;
  348. margin-top: 24rpx;
  349. .item {
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. height: 96rpx;
  354. border-bottom: 1px solid #E6E6E6;
  355. .title {
  356. display: flex;
  357. align-items: center;
  358. .icon {
  359. margin-right: 24rpx;
  360. img {
  361. width: 40rpx;
  362. height: 40rpx;
  363. vertical-align: middle;
  364. }
  365. }
  366. .text {
  367. color: rgba(51, 51, 51, 1);
  368. font-weight: bold;
  369. }
  370. }
  371. .right {
  372. margin-right: 16rpx;
  373. margin-left: 8rpx;
  374. display: flex;
  375. }
  376. }
  377. }
  378. </style>