user.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <view class="box">
  3. <scroll-view scroll-y="true" class="DrawerPage margin-bottom-xxxl">
  4. <!-- 顶部 -->
  5. <cu-custom bgColor="bg-blue" :isBack="false">
  6. <block slot="backText">我的</block>
  7. <block slot="content"></block>
  8. <block slot="right">
  9. <view class=" flex justify-center">
  10. <!-- <button class="margin-top-ssm cu-btn round bg-blue text-blue"><text class="cuIcon-add"></text></button> -->
  11. </view>
  12. </block>
  13. </cu-custom>
  14. <!-- 头像部分-->
  15. <view class="bg-blue" style="height: 360rpx;">
  16. <view style="text-align: center;">
  17. <image mode="aspectFill" class="cu-avatar round xl" v-if="userInfo.portrait!=null" :src="userInfo.portrait"></image>
  18. <image mode="aspectFill" v-else class="cu-avatar round xl" src="/static/information/defaultAvatar.png"></image>
  19. </view>
  20. <view class="flex justify-center">
  21. <view class="text-white text-xl">{{userInfo.account}} | {{roleName==undefined ? '自由用户':roleName }}</view>
  22. </view>
  23. <view class="flex justify-center" style="margin-top: 22rpx;">
  24. <view class="text-white text-sm" style="font-size: 26rpx;">{{userInfo.phone}}</view>
  25. </view>
  26. </view>
  27. <!-- 项目 、合同段 -->
  28. <view class="cu-list card-menu shadowType" style="background-color: #C6E6FF;min-height: 236rpx;padding: 0 22rpx;position: relative;">
  29. <swiper class=" square-dot" @change="change" :autoplay="false" interval="5000"
  30. duration="500">
  31. <swiper-item v-for="(item,index) in projectList" :key="index" v-if="index<5">
  32. <view v-if="index==0">
  33. <view class="flex justify-start" style="height: 88rpx;display: flex;align-items: center;">
  34. <image class="login-img margin-right-sm" src="/static/index/currentProject.png"></image>
  35. <text class="text-lg margin-top-ssm" style="font-size: 30rpx;color:#0A8CD5;font-weight: bold;">当前项目</text>
  36. </view>
  37. <view class="dashedLine"></view>
  38. <view class="content " style="padding: 22rpx 0;">
  39. <view style="font-size: 34rpx;color:#101010;font-weight: bold;padding-bottom: 12rpx;">
  40. {{item.project_name}}
  41. </view>
  42. <view style="font-size: 30rpx;color:#101010;">
  43. {{item.contractName}}
  44. </view>
  45. </view>
  46. </view>
  47. <view v-else>
  48. <view class="flex justify-start" style="height: 88rpx;display: flex;align-items: center;">
  49. <image class="login-img margin-right-sm" src="/static/index/currentProject.png"></image>
  50. <text class="text-lg margin-top-ssm" style="font-size: 30rpx;color:#0A8CD5;font-weight: bold;">近期项目</text>
  51. </view>
  52. <view class="dashedLine"></view>
  53. <view class="content " style="padding: 22rpx 0;">
  54. <view style="font-size: 34rpx;color:#101010;font-weight: bold;padding-bottom: 12rpx;">
  55. {{item.project_name}}
  56. </view>
  57. <view style="font-size: 30rpx;color:#101010;">
  58. {{item.contractName}}
  59. </view>
  60. </view>
  61. </view>
  62. </swiper-item>
  63. </swiper>
  64. <swiper-dot style="position: absolute;right: 22rpx;top: 40rpx;" :current="current" :list="projectList"></swiper-dot>
  65. </view>
  66. <!-- 菜单-->
  67. <view class="cu-list grid bg-black" :class="['col-' + gridCol,gridBorder?'':'no-border']">
  68. <view class="cu-item" v-for="(item,index) in menuList" :key="index" @click="navTo(item.url)">
  69. <view>
  70. <image class="menuImage" :src="item.imageurl"></image>
  71. <view v-if="item.red" class="cu-tag badge bg-red" style="top: 18rpx;">
  72. </view>
  73. </view>
  74. <text style="font-size: 26rpx;color: #101010;">{{item.name}}</text>
  75. </view>
  76. </view>
  77. <view class="cu-list grid padding flex justify-center" style="margin-top: 0;">
  78. <button @click="loginOut" style="width: 500rpx;height: 88rpx;font-size: 30rpx;" class="cu-btn bg-blue lg round">退出登陆</button>
  79. </view>
  80. </scroll-view>
  81. <!-- 引入底部导航栏 -->
  82. <tabBar :pagePath="'/pages/user/user'"></tabBar>
  83. </view>
  84. </template>
  85. <script>
  86. import swiperDot from "@/components/swiperDot.vue"
  87. export default {
  88. components: {swiperDot},
  89. data() {
  90. return {
  91. menuList: [{
  92. name: "项目管理",
  93. icon: "form",
  94. color: "text-orange",
  95. url: "./project/project",
  96. imageurl: "/static/user/project.png"
  97. },
  98. {
  99. name: "我的填报",
  100. icon: "form",
  101. color: "text-orange",
  102. url: "/pages/myReport/myReport",
  103. imageurl: "/static/user/myReport.png"
  104. },
  105. {
  106. name: "离线文件",
  107. icon: "copy",
  108. color: "text-red",
  109. url: "/pages/offLine/offLine",
  110. imageurl: "/static/user/offline-file.png"
  111. },
  112. // {
  113. // name: "电子签名",
  114. // icon: "edit",
  115. // color: "text-pink",
  116. // url: "./signature/signature",
  117. // imageurl: "/static/user/signature.png"
  118. // },
  119. {
  120. name: "基本资料",
  121. icon: "writefill",
  122. color: "text-orange",
  123. url: "./update/update",
  124. imageurl: "/static/user/basic-nformation.png"
  125. },
  126. {
  127. name: "账号安全",
  128. icon: "mobile",
  129. color: "text-blue",
  130. url: "./account/account",
  131. imageurl: "/static/user/accountSecurity.png"
  132. },
  133. {
  134. name: "系统设置",
  135. icon: "mobile",
  136. color: "text-blue",
  137. url: "./about/about",
  138. imageurl: "/static/user/setting.png",
  139. red:this.tabberData.newVersion
  140. },
  141. /* ,
  142. {
  143. name: "树形展示",
  144. icon: "list",
  145. color: "text-blue",
  146. url: "/pages/tree/tree",
  147. imageurl: "/static/user/accountSecurity.png"
  148. }, */
  149. ],
  150. userInfo: {
  151. portrait: "../../static/login/user.png",
  152. account: "张三",
  153. phone: "1312345678",
  154. },
  155. roleName: "",
  156. gridCol: 4,
  157. gridBorder: false,
  158. projectList: [],
  159. cardCur: 0,
  160. current:0,
  161. }
  162. },
  163. onLoad() {
  164. var userInfo = uni.getStorageSync("userInfo")
  165. if (userInfo != null) {
  166. this.userInfo = userInfo;
  167. this.roleName = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id).roleName;
  168. }
  169. //this.findProject();
  170. },
  171. onShow() {
  172. var userInfo = uni.getStorageSync("userInfo")
  173. if (userInfo != null) {
  174. this.userInfo = userInfo;
  175. this.roleName = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id).roleName;
  176. }
  177. this.findProject();
  178. },
  179. methods: {
  180. change(e) {
  181. this.current = e.detail.current;
  182. },
  183. navTo(url) {
  184. if (url) {
  185. uni.navigateTo({
  186. url: url
  187. })
  188. }else{
  189. this.$prompt.none("开发中");
  190. }
  191. },
  192. loginOut() {
  193. /* 清除缓存 */
  194. //uni.removeStorageSync('porject');
  195. uni.removeStorageSync('userInfo');
  196. uni.removeStorageSync('authorityList');
  197. uni.reLaunch({
  198. url: "/pages/user/login/login"
  199. })
  200. },
  201. cardSwiper(e) {
  202. this.cardCur = e.detail.current
  203. },
  204. findProject() {
  205. var that = this;
  206. that.projectList=[]
  207. var userInfo = uni.getStorageSync("userInfo")
  208. that.userInfo = userInfo;
  209. that.http.request('/app/findProject', { userId: userInfo.id}).then((result)=>{
  210. let lastData = [];
  211. let datas = result.datas;
  212. var project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
  213. if (project) {
  214. var id = project.id;
  215. datas.forEach((item, index, arry) => {
  216. if (item.id != id) {
  217. lastData.push(item); //存放没有选择的
  218. } else {
  219. that.projectList.push(item) //存放已选择的
  220. }
  221. })
  222. }
  223. lastData.forEach((item, index, arry) => {
  224. that.projectList.push(item);
  225. })
  226. })
  227. },
  228. }
  229. }
  230. </script>
  231. <style>
  232. page {
  233. background-color: white;
  234. }
  235. .menuImage {
  236. height: 90rpx;
  237. width: 90rpx;
  238. }
  239. .cu-list.grid>.cu-item uni-text {
  240. display: block;
  241. margin-top: 4px;
  242. color: black;
  243. font-size: 14px;
  244. line-height: 17px;
  245. }
  246. .shadowType {
  247. margin-top: -60rpx;
  248. -moz-box-shadow: 0px 1px 4px #D0D0D0;
  249. -webkit-box-shadow: 0px 1px 4px #D0D0D0;
  250. box-shadow: 0px 1px 4px #D0D0D0;
  251. }
  252. .card-swiper uni-swiper-item {
  253. width: 260px !important;
  254. left: 10px;
  255. box-sizing: border-box;
  256. padding: 17px 0px 29px;
  257. overflow: initial;
  258. }
  259. .login-img{
  260. width: 60rpx;
  261. height: 60rpx;
  262. }
  263. .dashedLine{
  264. box-sizing: border-box;
  265. width: 200%;
  266. height: 200%;
  267. border-bottom: 2rpx dashed #77caf9;
  268. border-radius: inherit;
  269. content: " ";
  270. transform: scale(.5);
  271. transform-origin: 0 0;
  272. pointer-events: none
  273. }
  274. </style>