mine.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view>
  3. <view class="background">
  4. <!-- 个人信息 -->
  5. <!-- <view class="person-infos" @click="gotoUrl('/pages/mine/personInfos')"> -->
  6. <view class="person-infos">
  7. <view class="photo">
  8. <!-- <u-avatar class="avatar"
  9. src="@/assets/img/photo@x1.png" size="112">
  10. </u-avatar> -->
  11. <image class="img" src="@/assets/img/默认头像.png" mode=""></image>
  12. </view>
  13. <view class="else">
  14. <view class="name">
  15. {{personInfo.name}}
  16. </view>
  17. <view class="company">
  18. {{companyInfo.fullName}}
  19. </view>
  20. </view>
  21. <u-picker v-model="changeUserShow" mode="selector" :range="userList"
  22. :default-selector="[defaultIndex]"
  23. range-key="name"
  24. @confirm="selector1confirm" ></u-picker>
  25. <view class="change" @click="changeUserShowBtn" v-if="userList&&userList.length>1">
  26. 切换
  27. </view>
  28. </view>
  29. <!-- 地址 -->
  30. <view class="address-box">
  31. <view class="address">
  32. <view class="address-title">
  33. {{companyInfo.fullName}}
  34. </view>
  35. <view class="address-value">
  36. <u-icon name="map" v-if="companyInfo.address"></u-icon>{{companyInfo.address}}
  37. </view>
  38. </view>
  39. <view class="image">
  40. <image class="img" src="@/assets/img/mineBackground.svg" mode=""></image>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 功能 -->
  45. <view class="function-group">
  46. <view class="function-item" @click="gotoUrl('/pages/mine/filialeList')" v-if="false" >
  47. <view class="icon">
  48. <image class="img" src="@/assets/img/riLine-function-line.svg" mode=""></image>
  49. </view>
  50. <view class="name">
  51. 设备列表
  52. </view>
  53. <view class="arrow">
  54. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  55. </view>
  56. </view>
  57. <view class="function-item" @click="gotoUrl('/pages/mine/message')" v-if="false">
  58. <view class="icon">
  59. <image class="img" src="@/assets/img/riLine-message-2-line.svg" mode=""></image>
  60. </view>
  61. <view class="name">
  62. 我的消息
  63. </view>
  64. <view class="arrow">
  65. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  66. </view>
  67. </view>
  68. <view class="function-item" @click="gotoUrl('/pages/mine/feedbackRecord')" v-if= "false">
  69. <view class="icon">
  70. <image class="img" src="@/assets/img/riLine-feedback-line.svg" mode=""></image>
  71. </view>
  72. <view class="name">
  73. 意见反馈
  74. </view>
  75. <view class="arrow">
  76. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  77. </view>
  78. </view>
  79. <view class="function-item" @click="gotoUrl('/pages/mine/contactService')">
  80. <view class="icon">
  81. <image class="img" src="@/assets/img/riLine-customer-service-2-line.svg" mode=""></image>
  82. </view>
  83. <view class="name">
  84. 客服热线
  85. </view>
  86. <view class="arrow">
  87. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="function-group">
  92. <view class="function-item" @click="gotoUrl('/pages/mine/setting')">
  93. <view class="icon">
  94. <image class="img" src="@/assets/img/riLine-settings-2-line.svg" mode=""></image>
  95. </view>
  96. <view class="name">
  97. 设置
  98. </view>
  99. <view class="arrow">
  100. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  101. </view>
  102. </view>
  103. </view>
  104. <energyCenterTabbar :current="2"></energyCenterTabbar>
  105. </view>
  106. </template>
  107. <script>
  108. import energyCenterTabbar from '@/components/energyCenterTabbar.vue'
  109. import * as API from '@/apis/pagejs/index.js'
  110. export default {
  111. components: {
  112. energyCenterTabbar
  113. },
  114. data() {
  115. return {
  116. personInfo: {},
  117. companyInfo: {},
  118. changeUserShow:false,
  119. defaultIndex:0,
  120. userList:[],
  121. }
  122. },
  123. onLoad() {
  124. this.personInfo=this.carhelp.getPersonInfo()
  125. //this.userList=this.carhelp.getPersonInfoPlus().userList
  126. this.getfindByOpenId();
  127. //this.getChangeCompanyList();
  128. },
  129. onShow() {
  130. },
  131. methods: {
  132. getChangeCompanyList(){
  133. API.changeCompanyList().then((response) => {
  134. //this.query()
  135. this.userList=response.data.companyInfoList
  136. //this.companyInfo=response.data.companyInfo;
  137. }).catch(error => {
  138. uni.hideLoading();
  139. uni.showToast({
  140. icon: "none",
  141. title: error
  142. })
  143. })
  144. },
  145. changeUserShowBtn() {
  146. this.defaultIndex = this.userList.findIndex(item => {
  147. return item.id == this.companyInfo.id
  148. })
  149. this.changeUserShow = true
  150. },
  151. selector1confirm(e) {
  152. var obj = this.userList[e[0]]
  153. uni.showLoading({
  154. title: "加载中",
  155. mask: true,
  156. })
  157. API.changeCompany({
  158. companyId: obj.id,
  159. openId: this.carhelp.getOpenId()
  160. }).then((response) => {
  161. //this.query()
  162. this.getfindByOpenId();
  163. //this.companyInfo=response.data.companyInfo;
  164. }).catch(error => {
  165. uni.hideLoading();
  166. uni.showToast({
  167. icon: "none",
  168. title: error
  169. })
  170. })
  171. },
  172. getfindByOpenId() {
  173. uni.showLoading({
  174. title: "加载中",
  175. mask: true,
  176. })
  177. API.findByOpenId({
  178. openId: this.carhelp.getOpenId()
  179. }).then((response) => {
  180. uni.hideLoading();
  181. this.personInfo = response.data.regUser;
  182. this.companyInfo = response.data.companyInfo;
  183. var token = response ? response.data.token : '';
  184. this.carhelp.setPersonInfo(response.data.regUser );
  185. this.carhelp.setToken(token);
  186. this.carhelp.setPersonInfoPlus(response.data);
  187. this.getChangeCompanyList();
  188. this.$forceUpdate()
  189. }).catch(error => {
  190. uni.showToast({
  191. title: error,
  192. icon: "none"
  193. })
  194. })
  195. },
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .background {
  201. background: linear-gradient(180deg, rgba(194, 219, 255, 1) 53%, rgba(180, 211, 255, 0) 100%);
  202. padding: 72rpx 32rpx;
  203. // 个人信息
  204. .person-infos {
  205. display: flex;
  206. align-items: center;
  207. .photo {
  208. width: 112rpx;
  209. height: 112rpx;
  210. border-radius: 50px;
  211. .img {
  212. width: 100%;
  213. height: 100%;
  214. }
  215. }
  216. .else {
  217. margin-left: 24rpx;
  218. .name {
  219. color: rgb(16, 16, 16);
  220. font-size: 36rpx;
  221. font-weight: bold;
  222. }
  223. .company {
  224. color: rgba(16, 16, 16, 1);
  225. }
  226. }
  227. // 切换
  228. .change {
  229. border: 1px solid rgba(22, 119, 255, 1);
  230. min-width: 128rpx;
  231. height: 64rpx;
  232. line-height: 64rpx;
  233. border-radius: 50px;
  234. margin-left: auto;
  235. color: rgba(22, 119, 255, 1);
  236. text-align: center;
  237. }
  238. }
  239. // 地址
  240. .address-box {
  241. border-radius: 8px;
  242. background: linear-gradient(90deg, rgba(49, 110, 207, 1) 2%, rgba(20, 73, 159, 1) 100%);
  243. color: #fff;
  244. padding: 40rpx 32rpx;
  245. margin-top: 40rpx;
  246. display: flex;
  247. align-items: center;
  248. position: relative;
  249. .address {
  250. .address-title {
  251. font-size: 40rpx;
  252. }
  253. .address-value {
  254. font-size: 24rpx;
  255. margin-top: 8rpx;
  256. }
  257. }
  258. .image {
  259. width: 174rpx;
  260. height: 174rpx;
  261. position: absolute;
  262. right: 0;
  263. top: 20rpx;
  264. .img {
  265. width: 100%;
  266. height: 100%;
  267. }
  268. }
  269. }
  270. }
  271. // 功能
  272. .function-group {
  273. border-radius: 8px;
  274. background-color: #fff;
  275. margin: 0 32rpx 24rpx;
  276. .function-item {
  277. display: flex;
  278. align-items: center;
  279. padding: 26rpx 26rpx 26rpx 0;
  280. margin-left: 26rpx;
  281. border-bottom: 1px solid rgba(221, 221, 221, 1);
  282. .icon {
  283. width: 40rpx;
  284. height: 40rpx;
  285. .img {
  286. width: 100%;
  287. height: 100%;
  288. }
  289. }
  290. .name {
  291. color: rgba(51, 51, 51, 1);
  292. font-size: 30rpx;
  293. margin-left: 26rpx;
  294. }
  295. .arrow {
  296. margin-left: auto;
  297. }
  298. }
  299. }
  300. </style>