mine.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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">
  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.setToken("",);
  227. this.carhelp.set("token_tdate","")
  228. this.carhelp.setPersonInfo("");
  229. this.carhelp.setPersonInfoPlus("" )
  230. uni.reLaunch({
  231. url:"/"
  232. })
  233. }).catch(error => {
  234. uni.showToast({
  235. title: error
  236. })
  237. })
  238. },
  239. phone(){
  240. uni.makePhoneCall({
  241. phoneNumber:this.tel //仅为示例
  242. });
  243. },
  244. logout(){
  245. uni.showModal({
  246. title: '提示',
  247. content: '确认是否退出?',
  248. success: res=> {
  249. if (res.confirm) {
  250. //付钱 改为组件
  251. this.logoutApi();
  252. } else if (res.cancel) {
  253. console.log('用户点击取消');
  254. }
  255. }
  256. });
  257. },
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  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. }
  283. .department-position {
  284. display: flex;
  285. align-items: center;
  286. margin-top: 16rpx;
  287. .icon {
  288. margin-right: 8rpx;
  289. img {
  290. width: 28rpx;
  291. height: 28rpx;
  292. }
  293. }
  294. .department {
  295. display: flex;
  296. .text{
  297. line-height: 16px;
  298. }
  299. }
  300. .position {
  301. display: flex;
  302. margin-left: 24rpx;
  303. .text{
  304. line-height: 16px;
  305. }
  306. }
  307. }
  308. }
  309. .to-homepage {
  310. margin-left: auto;
  311. .text {
  312. font-size: 16px;
  313. margin-right: 8rpx;
  314. }
  315. }
  316. }
  317. .grid {
  318. width: 100%;
  319. display: flex;
  320. flex-direction: row;
  321. flex-wrap: wrap;
  322. align-items: center;
  323. margin-top: 24rpx;
  324. .item {
  325. width: 25%;
  326. text-align: center;
  327. .amout {
  328. font-size: 48rpx;
  329. line-height: 64rpx;
  330. }
  331. .text {
  332. font-size: 32rpx;
  333. line-height: 44rpx;
  334. }
  335. }
  336. }
  337. }
  338. // 功能
  339. .group1 {
  340. margin-top: -72rpx !important;
  341. }
  342. .function-group {
  343. border-radius: 8px 8px 0px 0px;
  344. background-color: rgba(255, 255, 255, 1);
  345. padding: 0 0 0 24rpx;
  346. margin: 0 32rpx;
  347. margin-top: 24rpx;
  348. .item {
  349. display: flex;
  350. justify-content: space-between;
  351. align-items: center;
  352. height: 96rpx;
  353. border-bottom: 1px solid #E6E6E6;
  354. .title {
  355. display: flex;
  356. align-items: center;
  357. .icon {
  358. margin-right: 24rpx;
  359. img {
  360. width: 40rpx;
  361. height: 40rpx;
  362. vertical-align: middle;
  363. }
  364. }
  365. .text {
  366. color: rgba(51, 51, 51, 1);
  367. font-weight: bold;
  368. }
  369. }
  370. .right {
  371. margin-right: 16rpx;
  372. margin-left: 8rpx;
  373. display: flex;
  374. }
  375. }
  376. }
  377. </style>