mine.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="myContent">
  3. <view class="header">
  4. <view class="myPhoto">
  5. <img src="https://img0.baidu.com/it/u=1250551608,2180019998&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
  6. alt="">
  7. </view>
  8. <text class="myInformation">{{userName}}</text>
  9. </view>
  10. <view class="middle-num">
  11. <u-cell-group>
  12. <!-- icon-style="color:red" -->
  13. <u-cell :border="false" icon="setting-fill" :value="value" title="项目选择" @click="projectChoose"
  14. :isLink="true"></u-cell>
  15. <!-- <u-cell icon="order" title="新增项目" @click="toAddProject" :isLink="true"></u-cell>
  16. <u-cell icon="list-dot" @click="toList" title="项目列表" :isLink="true"></u-cell> -->
  17. </u-cell-group>
  18. </view>
  19. <view class="exit">
  20. <u-cell-group>
  21. <u-cell @click="toUpload" icon="camera-fill" :isLink="true" title="上传人脸"></u-cell>
  22. <u-cell icon-style="color:#1296db" :border="false" @click="exit" icon="minus-people-fill" :isLink="true"
  23. title="退出登录"></u-cell>
  24. </u-cell-group>
  25. </view>
  26. <u-picker :show="show" :columns="columns" keyName='description' @confirm="confirm"
  27. @cancel="show=false"></u-picker>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. userName: uni.getStorageSync('userName'),
  35. pic: uni.getStorageSync('face'),
  36. msg: {
  37. userId: uni.getStorageSync('userId'),
  38. pageNo: 1,
  39. pageSize: 100
  40. },
  41. value: '',
  42. columns: [
  43. []
  44. ],
  45. show: false,
  46. arr: []
  47. }
  48. },
  49. methods: {
  50. projectChoose() {
  51. this.getProjectList()
  52. this.show = true
  53. console.log('弹出');
  54. },
  55. confirm(e) {
  56. console.log('confirm', e.value[0])
  57. console.log(this.arr);
  58. let getWay = this.arr.filter((item) => {
  59. return item.name == e.value[0]
  60. })
  61. console.log(getWay, '过滤');
  62. uni.setStorageSync('testProjectId', getWay[0].id)
  63. uni.setStorageSync('gatewayDeviceId', getWay[0].gatewayDeviceId)
  64. // uni.setStorageSync('testProjectId', e.value[0].id)
  65. this.value = getWay[0].description
  66. this.show = false
  67. },
  68. selectClick(index) {
  69. console.log(index)
  70. },
  71. choose() {
  72. this.show3 = true
  73. console.log('我弹出来了');
  74. },
  75. toUpload() {
  76. uni.navigateTo({
  77. url: "/pages/upload-face/upload-face"
  78. })
  79. },
  80. toList() {
  81. uni.navigateTo({
  82. url: "/pages/project-list/project-list"
  83. })
  84. },
  85. exit() {
  86. uni.showModal({
  87. title: '温馨提示',
  88. content: '确定要退出吗?',
  89. success: res => {
  90. if (res.confirm) {
  91. uni.removeStorageSync('Token')
  92. uni.removeStorageSync('userId')
  93. uni.removeStorageSync('testProjectId')
  94. uni.redirectTo({
  95. url: "/pages/login/login"
  96. })
  97. }
  98. }
  99. })
  100. },
  101. toAddProject() {
  102. uni.navigateTo({
  103. url: "/pages/add-project/add-project"
  104. })
  105. },
  106. async getProjectList() {
  107. uni.showLoading({
  108. title: "正在请求中"
  109. })
  110. const {
  111. data: res
  112. } = await uni.$http.post('/api/v1/test/testProject/queryByCondition', this.msg)
  113. console.log(res);
  114. uni.hideLoading()
  115. if (res.code == 200) {
  116. if (res.data.records.length == 0) {
  117. this.$u.toast(`未检测到测试项目`)
  118. } else {
  119. let filter = []
  120. res.data.records.forEach((item) => {
  121. filter.push(item.description)
  122. })
  123. this.columns[0] = filter
  124. this.arr = res.data.records
  125. }
  126. let filter = []
  127. res.data.records.forEach((item) => {
  128. filter.push(item.description)
  129. })
  130. this.columns[0] = filter
  131. this.arr = res.data.records
  132. } else {
  133. this.$u.toast(`请求失败`)
  134. }
  135. }
  136. },
  137. onLoad(options) {
  138. // const {
  139. // page
  140. // } = options
  141. // if (page == upload) {
  142. // uni.navigateTo({
  143. // url: '/pages/mine/mine',
  144. // success: () => {
  145. // uni.navigateBack()
  146. // }
  147. // })
  148. // }
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. page {
  154. background: #eaeaea;
  155. }
  156. .myContent {
  157. width: 100%;
  158. height: 100%;
  159. margin: 0 auto;
  160. }
  161. .header {
  162. flex-direction: row;
  163. display: flex;
  164. height: 200rpx;
  165. }
  166. .headbgImage {
  167. height: 25%;
  168. width: 100%;
  169. position: absolute;
  170. z-index: 1;
  171. }
  172. .myPhoto {
  173. height: 140rpx;
  174. width: 140rpx;
  175. position: absolute;
  176. z-index: 2;
  177. margin-left: 3%;
  178. margin-top: 3%;
  179. border-radius: 50%;
  180. img {
  181. border-radius: 50%;
  182. width: 100%;
  183. height: 100%;
  184. }
  185. }
  186. .myInformation {
  187. position: absolute;
  188. z-index: 2;
  189. margin-left: 25%;
  190. margin-top: 9%;
  191. }
  192. .exit {
  193. margin-top: 50px;
  194. background: white;
  195. width: 100%;
  196. // margin-left: 20rpx;
  197. height: 176rpx;
  198. // border-radius: 10px;
  199. }
  200. .middle-num {
  201. position: absolute;
  202. z-index: 2;
  203. display: flex;
  204. flex-wrap: nowrap;
  205. background: white;
  206. width: 100%;
  207. // margin-left: 20rpx;
  208. height: 93rpx;
  209. // border-radius: 10px;
  210. margin-top: -16rpx;
  211. }
  212. .popup {
  213. height: 700rpx;
  214. width: 100vw;
  215. // width: calc(100vw - 40rpx);
  216. // margin: 0 20rpx;
  217. .title {
  218. padding: 20rpx;
  219. text-align: center;
  220. }
  221. }
  222. </style>