云链智安app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <view class="container">
  3. <view class="setup">
  4. <view style="width: 100%;height:30rpx"></view>
  5. <view class="user">
  6. <image @click="onuser" class="user_to" :src="user.user.avatar" mode=""/>
  7. <view class="user_name">
  8. <view class="user_name1">姓名: {{user.user.loginName}}</view>
  9. <view class="user_name2">电话: {{user.user.phonenumber}}</view>
  10. </view>
  11. </view>
  12. <!-- <view class="equipment">
  13. <view class="equipment_1" @click ="onstation">
  14. <view class="user_left">
  15. <view class="user_leftname">{{$t('My.myDevices')}}</view>
  16. <view class="user_lefteq">{{$t('My.viewDevices')}}</view>
  17. </view>
  18. <view class="equipment_rightdiv">
  19. <image class="equipment_right1" src="https://esos-iot.bjdexn.cn/wx_images/104.png" mode=""/>
  20. </view>
  21. </view>
  22. <view class="equipment_2" @click ="onpowerstation">
  23. <view class="user_left">
  24. <view class="user_leftname">{{$t('My.addDevice')}}</view>
  25. <view class="user_lefteq">{{$t('My.scanToAdd')}}</view>
  26. </view>
  27. <view class="equipment_rightdiv1">
  28. <image class="equipment_right" src="https://esos-iot.bjdexn.cn/wx_images/49.png" mode=""/></view>
  29. </view>
  30. </view> -->
  31. <!-- <view class="allocation_box">
  32. <view class="allocation" @click ="toconfigure">
  33. <view class="allocation_3">配置Wi-Fi</view>
  34. <view class="allocation_1">
  35. <view class="allocation_2"></view>
  36. </view>
  37. </view>
  38. <view class="allocation" @click ="device">
  39. <view class="allocation_3">连接设备</view>
  40. <view class="allocation_1">
  41. <view class="allocation_2"></view>
  42. </view>
  43. </view>
  44. </view> -->
  45. <view class="allocation_box">
  46. <view class="allocation">
  47. <view class="allocation_3">{{$t('My.appVersion')}}</view>
  48. <view class="allocation_1">
  49. <view class="allocation_2" v-if="accountInfo!=''">V {{accountInfo}}</view>
  50. <view class="allocation_2" v-else>V 1.0.0</view>
  51. <!-- <t-icon name="chevron-right-s" size="40rpx" data-name="chevron-right-s"/> -->
  52. </view>
  53. </view>
  54. <view class="allocation">
  55. <view class="allocation_31">
  56. <button class="contact-button" open-type="contact" plain >
  57. <view>{{$t('My.support')}}</view>
  58. </button>
  59. </view>
  60. <view class="allocation_1">
  61. <view class="allocation_2"></view>
  62. <!-- <t-icon name="chevron-right-s" size="40rpx" data-name="chevron-right-s"/> -->
  63. </view>
  64. </view>
  65. <view class="allocation" @click ="onsetup">
  66. <view class="allocation_3">{{$t('My.settings')}}</view>
  67. <view class="allocation_1">
  68. <view class="allocation_2"></view>
  69. <!-- <t-icon name="chevron-right-s" size="40rpx" data-name="chevron-right-s"/> -->
  70. </view>
  71. </view>
  72. <view class="allocation">
  73. <view class="allocation_3">中文/English</view>
  74. <view class="allocation_1">
  75. <view class="allocation_2"></view>
  76. <!-- <t-icon name="chevron-right-s" size="40rpx" data-name="chevron-right-s"/> -->
  77. <l-switch :value="defaultValue" :placeholder="['English', '中文']" dotSize="14px" height="22px" width="32px" @click="changeLanguage"></l-switch>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <!-- -->
  85. <script setup>
  86. import { onMounted, ref } from 'vue';
  87. import { useI18n } from 'vue-i18n';
  88. const { t } = useI18n()
  89. import { onShow } from '@dcloudio/uni-app';
  90. import request from '@/utils/request';
  91. const defaultValue=ref()
  92. onShow(() => {
  93. getuserinfo()
  94. try {
  95. const language = uni.getStorageSync('userLanguage');
  96. console.log('Language:', language);
  97. defaultValue.value = language === 'en';
  98. } catch (error) {
  99. console.error('读取 Storage 失败:', error);
  100. }
  101. });
  102. const accountInfo=ref('');
  103. const user=ref({})
  104. const stationName=ref('')
  105. const getuserinfo = async () => {
  106. try {
  107. const response = await request({
  108. url: '/platform/user/selectaccountNumber',
  109. method: 'post',
  110. header: {
  111. 'Content-Type': 'application/x-www-form-urlencoded'
  112. },
  113. });
  114. user.value = response.data
  115. console.log(user.value);
  116. } catch (error) {
  117. console.error('登录失败:', error);
  118. }
  119. };
  120. onMounted(() => {
  121. getuserinfo()
  122. });
  123. // 头像
  124. const onuser=()=>{
  125. uni.navigateTo({
  126. url:"/pages/personalInformation/index"
  127. })
  128. };
  129. // 我的设备
  130. const onstation=()=>{
  131. uni.navigateTo({
  132. url:"/pages/deviceslist/index"
  133. })
  134. };
  135. // 配置WI-Fi
  136. const toconfigure=()=>{
  137. };
  138. // 连接设备
  139. const device=()=>{
  140. };
  141. // 设置
  142. const onsetup=()=>{
  143. };
  144. const { locale } = useI18n(); // 使用 Composition API
  145. const changeLanguage=()=>{
  146. if(defaultValue.value){
  147. locale.value = 'zh-Hans'; // 使用响应式 locale
  148. uni.setStorageSync('userLanguage', 'zh-Hans');
  149. defaultValue.value = false
  150. }else{
  151. locale.value = 'en'; // 使用响应式 locale
  152. uni.setStorageSync('userLanguage', 'en');
  153. defaultValue.value = true
  154. }
  155. uni.setTabBarItem({
  156. index:0,
  157. text:t('tabBar.publicize')
  158. })
  159. uni.setTabBarItem({
  160. index:1,
  161. text:t('tabBar.products')
  162. })
  163. uni.setTabBarItem({
  164. index:2,
  165. text:t('tabBar.Devices')
  166. })
  167. uni.setTabBarItem({
  168. index:3,
  169. text:t('tabBar.My')
  170. })
  171. };
  172. // 暂未开放
  173. const onpowerstation = () =>{
  174. uni.showToast({
  175. title: '暂未开放',
  176. icon: 'none'
  177. });
  178. }
  179. </script>
  180. <!-- -->
  181. <style scoped>
  182. .uni-page{
  183. width: 100%;
  184. height: 100%;
  185. }
  186. .container {
  187. height: 92vh;
  188. background: linear-gradient(to bottom, #007545 -40%, #f0f5f5 40%, #f0f5f5 100%);
  189. box-sizing: border-box;
  190. }
  191. .account_number{
  192. width: 100%;
  193. padding: 20rpx;
  194. display: flex;
  195. justify-content: center;
  196. box-sizing: border-box;
  197. }
  198. .toptabbar {
  199. width: 100%;
  200. padding: 10rpx 20rpx;
  201. box-sizing: border-box;
  202. }
  203. .setup{
  204. width: 100%;
  205. height: 100vh;
  206. background: linear-gradient(to bottom, #007544 -40%, #F0F5F5 40%,#F0F5F5 100%);
  207. padding: 0rpx 30rpx;
  208. box-sizing: border-box;
  209. }
  210. .title{
  211. font-weight: 500;
  212. font-size: 36rpx;
  213. display: flex;
  214. align-items: center;
  215. margin-top: 20rpx;
  216. justify-content: center;
  217. }
  218. .user{
  219. display: flex;
  220. margin-top: 60rpx;
  221. }
  222. .user_to{
  223. width: 100rpx;
  224. height: 100rpx;
  225. border-radius: 100%;
  226. margin-right: 40rpx;
  227. }
  228. .user_name{
  229. display: flex;
  230. flex-direction: column;
  231. justify-content: space-around;
  232. }
  233. .user_name1{
  234. font-size: 28rpx;
  235. color: #ffffff;
  236. }
  237. .user_name2{
  238. font-size: 24rpx;
  239. color: #ffffff;
  240. }
  241. .equipment{
  242. width: 100%;
  243. display: flex;
  244. justify-content: space-between;
  245. box-sizing: border-box;
  246. margin-top: 40rpx;
  247. margin-bottom: 40rpx;
  248. }
  249. .equipment_1{
  250. width: 48%;
  251. background-color: #ffffff;
  252. border-radius: 16rpx;
  253. display: flex;
  254. align-items: center;
  255. justify-content: space-between;
  256. padding: 0rpx 20rpx;
  257. box-sizing: border-box;
  258. }
  259. .user_left{
  260. display: flex;
  261. flex-direction: column;
  262. justify-content:space-around;
  263. padding: 20rpx 0rpx;
  264. box-sizing: border-box;
  265. }
  266. .equipment_2{
  267. width: 48%;
  268. background-color: #ffffff;
  269. border-radius: 10rpx;
  270. box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
  271. }
  272. .equipment_rightdiv{
  273. width: 78rpx;
  274. height:78rpx;
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. background-color: #E3F6F8;
  279. border-radius: 100%;
  280. overflow: hidden;
  281. }
  282. .equipment_rightdiv1{
  283. width: 78rpx;
  284. height:78rpx;
  285. display: flex;
  286. align-items: center;
  287. justify-content: center;
  288. background-color: #E2ECFF;
  289. border-radius: 100%;
  290. overflow: hidden;
  291. }
  292. .equipment_right1{
  293. width: 50rpx;
  294. height: 50rpx;
  295. }
  296. .equipment_right{
  297. width: 50rpx;
  298. height: 41.31rpx;
  299. }
  300. .user_leftname{
  301. font-size: 28rpx;
  302. }
  303. .user_lefteq{
  304. width: 200rpx;
  305. font-size: 26rpx;
  306. margin-top: 12rpx;
  307. color: #999999;
  308. white-space: nowrap; /* 不换行 */
  309. overflow: hidden; /* 超出部分隐藏 */
  310. text-overflow: ellipsis; /* 显示省略号 */
  311. }
  312. .equipment_2{
  313. width: 48%;
  314. background-color: #ffffff;
  315. border-radius: 16rpx;
  316. display: flex;
  317. align-items: center;
  318. justify-content: space-between;
  319. padding: 0rpx 20rpx;
  320. box-sizing: border-box;
  321. }
  322. .allocation{
  323. width: 100%;
  324. height: 80rpx;
  325. display: flex;
  326. align-items: center;
  327. justify-content:space-between;
  328. padding: 0rpx 20rpx;
  329. overflow: hidden;
  330. box-sizing: border-box;
  331. }
  332. .allocation_1{
  333. display: flex;
  334. font-size:13px;
  335. align-items: center;
  336. }
  337. .allocation_box{
  338. border-radius: 16rpx;
  339. background-color: #ffffff;
  340. padding: 10rpx 0rpx;
  341. box-sizing: border-box;
  342. margin-top: 120rpx;
  343. box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
  344. }
  345. .allocation_2{
  346. color: #999999;
  347. }
  348. .allocation_3{
  349. font-size: 14px;
  350. }
  351. .content-container{
  352. margin-top: 40rpx;
  353. display: flex;
  354. flex-direction: column;
  355. justify-content: center;
  356. align-items: center;
  357. }
  358. .ticon{
  359. width: 100%;
  360. display: flex;
  361. align-items: center;
  362. justify-content: space-between;
  363. }
  364. .ticonright{
  365. margin-right: 10rpx;
  366. font-size: 28rpx;
  367. font-weight: 500;
  368. }
  369. .contentadd{
  370. width: 100%;
  371. height: 100%;
  372. margin-top: 40rpx;
  373. padding: 0rpx 1rpx;
  374. box-sizing: border-box;
  375. }
  376. .weui-input{
  377. width: 99%;
  378. height: 80rpx;
  379. border: 1rpx solid #cccccc;
  380. padding: 0rpx 10rpx;
  381. border-radius: 10rpx;
  382. box-sizing: border-box;
  383. }
  384. .input-example {
  385. width: 99%;
  386. --td-input-vertical-padding: 16rpx;
  387. background-color: var(--bg-color-demo);
  388. border: 1rpx solid #cccccc;
  389. border-radius: 12rpx;
  390. padding: 1rpx;
  391. margin-top: 40rpx;
  392. box-sizing: border-box;
  393. }
  394. .inputbox{
  395. width: 100%;
  396. margin-top: 20rpx;
  397. font-size: 26rpx;
  398. color: #cccccc;
  399. }
  400. .t-dialog__footer--full{
  401. padding: 44rpx 0 0;
  402. }
  403. button{
  404. padding: 0rpx;
  405. margin: 0rpx;
  406. font-size: 28rpx;
  407. background-color: #ffffff;
  408. border:0rpx solid #ffffff !important;
  409. border: none !important;
  410. }
  411. .allocation_31{
  412. width: 100%;
  413. font-size: 14px;
  414. }
  415. .contact-button {
  416. width: 100%;
  417. border: none !important;
  418. display: flex;
  419. }
  420. .avatar-edit-container {
  421. display: inline-block;
  422. position: relative;
  423. }
  424. .avatar-wrapper {
  425. position: relative;
  426. border-radius: 50%;
  427. overflow: hidden;
  428. cursor: pointer;
  429. transition: all 0.3s ease;
  430. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  431. }
  432. .avatar-img {
  433. width: 100%;
  434. height: 100%;
  435. object-fit: cover;
  436. display: block;
  437. transition: transform 0.3s ease;
  438. }
  439. .avatar-wrapper:hover .avatar-img {
  440. transform: scale(1.05);
  441. }
  442. .edit-overlay {
  443. position: absolute;
  444. top: 0;
  445. left: 0;
  446. width: 100%;
  447. height: 100%;
  448. background-color: rgba(0, 0, 0, 0.6);
  449. display: flex;
  450. align-items: center;
  451. justify-content: center;
  452. color: white;
  453. border-radius: 50%;
  454. }
  455. .edit-content {
  456. text-align: center;
  457. }
  458. .edit-icon {
  459. font-size: 24px;
  460. margin-bottom: 8px;
  461. display: block;
  462. }
  463. .edit-text {
  464. font-size: 14px;
  465. display: block;
  466. font-weight: 500;
  467. }
  468. .file-input {
  469. display: none;
  470. }
  471. /* 过渡动画 */
  472. .fade-enter-active, .fade-leave-active {
  473. transition: opacity 0.3s;
  474. }
  475. .fade-enter, .fade-leave-to {
  476. opacity: 0;
  477. }
  478. </style>