mine.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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.$forceUpdate()
  188. }).catch(error => {
  189. uni.showToast({
  190. title: error,
  191. icon: "none"
  192. })
  193. })
  194. },
  195. }
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. .background {
  200. background: linear-gradient(180deg, rgba(194, 219, 255, 1) 53%, rgba(180, 211, 255, 0) 100%);
  201. padding: 72rpx 32rpx;
  202. // 个人信息
  203. .person-infos {
  204. display: flex;
  205. align-items: center;
  206. .photo {
  207. width: 112rpx;
  208. height: 112rpx;
  209. border-radius: 50px;
  210. .img {
  211. width: 100%;
  212. height: 100%;
  213. }
  214. }
  215. .else {
  216. margin-left: 24rpx;
  217. .name {
  218. color: rgb(16, 16, 16);
  219. font-size: 36rpx;
  220. font-weight: bold;
  221. }
  222. .company {
  223. color: rgba(16, 16, 16, 1);
  224. }
  225. }
  226. // 切换
  227. .change {
  228. border: 1px solid rgba(22, 119, 255, 1);
  229. min-width: 128rpx;
  230. height: 64rpx;
  231. line-height: 64rpx;
  232. border-radius: 50px;
  233. margin-left: auto;
  234. color: rgba(22, 119, 255, 1);
  235. text-align: center;
  236. }
  237. }
  238. // 地址
  239. .address-box {
  240. border-radius: 8px;
  241. background: linear-gradient(90deg, rgba(49, 110, 207, 1) 2%, rgba(20, 73, 159, 1) 100%);
  242. color: #fff;
  243. padding: 40rpx 32rpx;
  244. margin-top: 40rpx;
  245. display: flex;
  246. align-items: center;
  247. position: relative;
  248. .address {
  249. .address-title {
  250. font-size: 40rpx;
  251. }
  252. .address-value {
  253. font-size: 24rpx;
  254. margin-top: 8rpx;
  255. }
  256. }
  257. .image {
  258. width: 174rpx;
  259. height: 174rpx;
  260. position: absolute;
  261. right: 0;
  262. top: 20rpx;
  263. .img {
  264. width: 100%;
  265. height: 100%;
  266. }
  267. }
  268. }
  269. }
  270. // 功能
  271. .function-group {
  272. border-radius: 8px;
  273. background-color: #fff;
  274. margin: 0 32rpx 24rpx;
  275. .function-item {
  276. display: flex;
  277. align-items: center;
  278. padding: 26rpx 26rpx 26rpx 0;
  279. margin-left: 26rpx;
  280. border-bottom: 1px solid rgba(221, 221, 221, 1);
  281. .icon {
  282. width: 40rpx;
  283. height: 40rpx;
  284. .img {
  285. width: 100%;
  286. height: 100%;
  287. }
  288. }
  289. .name {
  290. color: rgba(51, 51, 51, 1);
  291. font-size: 30rpx;
  292. margin-left: 26rpx;
  293. }
  294. .arrow {
  295. margin-left: auto;
  296. }
  297. }
  298. }
  299. </style>