user.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="avater">
  5. <image :src="userInfo.avatar" class="avater-img" mode=""></image>
  6. </view>
  7. <view class="name-box">
  8. <view class="name-top">
  9. {{userInfo.nickname}}
  10. </view>
  11. </view>
  12. </view>
  13. <view class="tt">
  14. <view class="tt-box border-b" @click="tohelp">
  15. <image src="../../static/icon/icon-04.png" class="tt-icon1" mode=""></image>
  16. <view class="tt-txt">
  17. 求救记录
  18. </view>
  19. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  20. </view>
  21. <view class="tt-box border-b" @click="torreco">
  22. <image src="../../static/icon/icon-05.png" class="tt-icon1" mode=""></image>
  23. <view class="tt-txt">
  24. 救援记录
  25. </view>
  26. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  27. </view>
  28. <view class="tt-box border-b" @click="commonaddress">
  29. <image src="../../static/icon/icon-06.png" class="tt-icon1" mode=""></image>
  30. <view class="tt-txt">
  31. 常用地址
  32. </view>
  33. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  34. </view>
  35. <!-- pages/form/certificates -->
  36. <view class="tt-box border-b" @click="tocertificates">
  37. <image src="../../static/icon/joinSuc.png" class="tt-icon1" mode=""></image>
  38. <view class="tt-txt">
  39. 我的证书
  40. </view>
  41. <image src="../../static/icon/next.png" class="next-icon" mode=""></image>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapState,
  49. mapMutations
  50. } from 'vuex';
  51. import { detail_training} from '@/api/train.js';
  52. import {
  53. saveUrl,
  54. interceptor
  55. } from '@/utils/loginUtils.js';
  56. import {
  57. userinfo
  58. } from '@/api/user.js';
  59. // #ifdef H5
  60. import {
  61. weixindata
  62. } from '@/utils/wxAuthorized';
  63. // #endif
  64. export default {
  65. data() {
  66. return {
  67. common_address:'',
  68. name:'',
  69. signDate:'',
  70. is_over:'',
  71. }
  72. },
  73. onReady() {
  74. console.log(99999)
  75. // detail_training({
  76. // id:this.id,
  77. // }).then(({data}) => {
  78. // console.log(999,data)
  79. // this.name = data.name
  80. // this.signDate = data.add_time
  81. // this.is_over = data.is_over
  82. // })
  83. },
  84. onShow() {
  85. console.log(this);
  86. // 判断是否已经登录
  87. if (this.hasLogin) {
  88. this.loadBaseData();
  89. } else {
  90. saveUrl();
  91. uni.showModal({
  92. title: '登录',
  93. content: '您未登录,是否马上登陆?',
  94. success: e => {
  95. if (e.confirm) {
  96. interceptor();
  97. }
  98. },
  99. fail: e => {
  100. console.log(e);
  101. }
  102. });
  103. }
  104. this.type = this.userInfo.type;
  105. this.common_address = this.userInfo.common_address
  106. console.log('点前保存的地址',this.common_address)
  107. // 保存当前页面
  108. },
  109. computed: {
  110. ...mapState('user', ['hasLogin', 'userInfo'])
  111. },
  112. methods: {
  113. ...mapMutations('user', ['setUserInfo']),
  114. loadBaseData() {
  115. userinfo({}).then(({
  116. data
  117. }) => {
  118. this.setUserInfo(data);
  119. });
  120. // #ifdef H5
  121. weixindata();
  122. // #endif
  123. },
  124. torreco() {
  125. uni.navigateTo({
  126. url: '/pages/applic/rescuerecords'
  127. })
  128. },
  129. tohelp() {
  130. uni.navigateTo({
  131. url: '/pages/applic/helprecords'
  132. })
  133. },
  134. commonaddress() {
  135. uni.navigateTo({
  136. url: '/pages/applic/commonaddress?add=' + this.common_address
  137. })
  138. },
  139. tocertificates() {
  140. uni.navigateTo({
  141. url: '/pages/form/certificates'
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss">
  148. .content {
  149. line-height: 1;
  150. .top {
  151. width: 750rpx;
  152. height: 370rpx;
  153. // background-color: #CB131B;
  154. background: url(../../static/images/bgi2.png)no-repeat top left;
  155. background-size: 750rpx 370rpx;
  156. display: flex;
  157. align-items: center;
  158. padding-left: 55rpx;
  159. .avater {
  160. width: 150rpx;
  161. height: 150rpx;
  162. margin-right: 28rpx;
  163. .avater-img {
  164. width: 100%;
  165. height: 100%;
  166. border-radius: 50%;
  167. }
  168. }
  169. .name-box {
  170. // flex: 1;
  171. .name-top {
  172. font-size: 42rpx;
  173. font-weight: 400;
  174. color: #FFFFFF;
  175. margin-bottom: 15rpx;
  176. }
  177. .name-footbox {
  178. .name-foot {
  179. text-align: center;
  180. font-size: 22rpx;
  181. font-weight: 400;
  182. color: #FFFFFF;
  183. background: rgba(255, 255, 255, 0.2);
  184. border: 1px solid #FFFFFF;
  185. border-radius: 20rpx;
  186. padding: 3rpx 13rpx;
  187. }
  188. }
  189. }
  190. }
  191. .center-box {
  192. width: 687rpx;
  193. // height: 235px;
  194. background: #FFE8E8;
  195. border-radius: 16rpx;
  196. margin: -90rpx auto 0;
  197. .center-top {
  198. width: 687rpx;
  199. height: 80rpx;
  200. background: #FFFFFF;
  201. border-radius: 16rpx 16rpx 0 0;
  202. display: flex;
  203. align-items: center;
  204. padding-left: 30rpx;
  205. .top-left {
  206. width: 126rpx;
  207. line-height: 32rpx;
  208. text-align: center;
  209. background: linear-gradient(0deg, #C90F1B, #F14D33);
  210. font-size: 22rpx;
  211. font-weight: 400;
  212. color: #FFFFFF;
  213. border-radius: 20rpx;
  214. margin-right: 10rpx;
  215. }
  216. .top-right {
  217. font-size: 22rpx;
  218. font-weight: 400;
  219. color: #CB151D;
  220. }
  221. }
  222. .center-foot {
  223. height: 155rpx;
  224. display: flex;
  225. .foot-list {
  226. flex: 1;
  227. text-align: center;
  228. padding-top: 20rpx;
  229. .list-top {
  230. font-size: 39rpx;
  231. font-weight: 400;
  232. color: #CB141D;
  233. line-height: 58rpx;
  234. }
  235. .list-foot {
  236. font-size: 39rpx;
  237. font-weight: 400;
  238. color: #666666;
  239. line-height: 58rpx;
  240. }
  241. }
  242. }
  243. }
  244. .tt {
  245. margin: 20rpx auto 0;
  246. width: 700rpx;
  247. box-shadow: 0px 0px 20rpx 0px rgba(49, 49, 52, 0.06);
  248. border-radius: 10rpx;
  249. background-color: #ffffff;
  250. .tt-box {
  251. width: 700rpx;
  252. height: 100rpx;
  253. padding: 0 30rpx;
  254. // margin-top: 37rpx;
  255. display: flex;
  256. align-items: center;
  257. .tt-icon {
  258. width: 40rpx;
  259. height: 40rpx;
  260. }
  261. .tt-icon1 {
  262. width: 40rpx;
  263. height: 36rpx;
  264. }
  265. .tt-txt {
  266. margin-left: 20rpx;
  267. font-size: 28rpx;
  268. font-weight: 300;
  269. color: #000000;
  270. flex: 1;
  271. }
  272. .next-icon {
  273. width: 30rpx;
  274. height: 38rpx;
  275. }
  276. }
  277. .border-b {
  278. border-bottom: 1px solid #F1F1F1;
  279. }
  280. }
  281. }
  282. </style>