my.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <view class="mainview">
  3. <view class="topimg">
  4. <view class="touxiang">
  5. <u-upload :fileList="fileList" @afterRead="afterRead" name="6" :multiple='false' :maxCount="1"
  6. imageMode="true" width="150" height="150">
  7. <image :src="src" mode="widthFix" shape="circle"
  8. style="width: 150rpx;height: 150rpx;"></image>
  9. </u-upload>
  10. </view>
  11. <view class="Username">
  12. <view class="Username1">{{getuserInfo.realName}} <span>您好</span> </view>
  13. <view class="Username2">
  14. <view class="">
  15. 您上次登录时间:
  16. </view>
  17. <view class="">
  18. 2023-3-23 13:32:48
  19. </view>
  20. </view>
  21. </view>
  22. <view class="changemm">
  23. <view class="message">
  24. <view class="wdmessage">已读信息:</view>
  25. <view class="messagenumber">
  26. <u-badge type="success" max="99" :value="information1"></u-badge>
  27. </view>
  28. </view>
  29. <view class="message">
  30. <view class="wdmessage">未读信息:</view>
  31. <view class="messagenumber">
  32. <u-badge type="warning" max="99" :value="information2"></u-badge>
  33. </view>
  34. </view>
  35. <!-- <view class="setdata"> -->
  36. <!-- <u-icon name="setting" color="#0C1935" size="40" @click="tuichu"></u-icon> -->
  37. <!-- <img src="../../static/my/tc.png" alt="" @click="tuichu"> -->
  38. <!-- </view> -->
  39. </view>
  40. </view>
  41. <!-- 头部结束 -->
  42. <view class="minndle">
  43. <!-- <u-grid :border="false" col="4" @click="navigations">
  44. <u-grid-item v-for="(listItem,listIndex) in list" :key="listIndex">
  45. <u-icon :customStyle="{paddingTop:20+'rpx'}" :name="listItem.name" :color="listItem.color"
  46. :size="55"></u-icon>
  47. <text class="grid-text" style="padding-top: 8px;">{{listItem.title}}</text>
  48. </u-grid-item>
  49. </u-grid> -->
  50. <view class="information" @click="navigations1" v-if="$has('app:PersonalInformation')">
  51. <view class="icon1">
  52. <u-icon name="account" size="55" color="#30D3A2" class=""></u-icon>
  53. </view>
  54. <view style="padding-top: 8px;">
  55. 个人信息
  56. </view>
  57. </view>
  58. <view class="distribute" @click="navigations2" v-if="$has('app:MyOrder')">
  59. <view class="icon2">
  60. <u-icon name="list" size="55" color="#09C700"></u-icon>
  61. </view>
  62. <view style="padding-top: 8px;">
  63. 我的订单
  64. </view>
  65. </view>
  66. <view class="task" @click="navigations3" v-if="$has('app:MyTask')">
  67. <view class="icon3">
  68. <u-icon name="order" size="55" color="#FF9C27"></u-icon>
  69. </view>
  70. <view style="padding-top: 8px;">我的任务</view>
  71. </view>
  72. <view class="opinions" @click="navigations4" v-if="$has('app:CommentsSuggestions')">
  73. <view class="icon4">
  74. <u-icon name="more-circle" size="55" color="#F7B717"></u-icon>
  75. </view>
  76. <view style="padding-top: 8px;">意见建议</view>
  77. </view>
  78. </view>
  79. <!-- 导航栏结束 -->
  80. <view class="middleimgs">
  81. <!-- <img src="@/static/my/xinxi.png" alt=""> -->
  82. <u--image mode="widthFix" :src="srcxinxi" width="750rpx" height="300rpx"></u--image>
  83. </view>
  84. <!-- 中间图片结束 -->
  85. <view class="appcell">
  86. <u-cell-group>
  87. <u-cell title="修改密码" :isLink="true" @click="changepass">
  88. <u-icon slot="icon" size="35" name="setting"></u-icon>
  89. </u-cell>
  90. <u-cell title="一键退出" :isLink="true" @click="tuichu">
  91. <u-icon slot="icon" size="35" name="close-circle"></u-icon>
  92. </u-cell>
  93. </u-cell-group>
  94. </view>
  95. <u-modal :show="showtc" content='请问您是否确定一键退出?' :showConfirmButton='true' :showCancelButton='true'
  96. @confirm="confirmtc" @cancel='canceltc'></u-modal>
  97. <u-tabbar
  98. :value="value1"
  99. :fixed="true"
  100. :placeholder="true"
  101. @change="name => value1 = name"
  102. activeColor="#2E69EB"
  103. :safeAreaInsetBottom="true"
  104. >
  105. <u-tabbar-item text="首页" icon="home" @click="click1" ></u-tabbar-item>
  106. <u-tabbar-item v-if="$has('app:worktable')" text="工作台" icon="list" @click="click2" ></u-tabbar-item>
  107. <u-tabbar-item text="我的" icon="account" @click="click3" ></u-tabbar-item>
  108. </u-tabbar>
  109. </view>
  110. </template>
  111. <script>
  112. import {
  113. Static
  114. } from "vue"
  115. export default {
  116. data() {
  117. return {
  118. value1: 2,
  119. fileList: [],
  120. showtc: false,
  121. src: require('@/static/my/tx.png'),
  122. srcxinxi: require('@/static/my/xinxi.png'),
  123. information1: 34,
  124. information2: 100,
  125. getuserInfo:{},
  126. }
  127. },
  128. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  129. onLoad() {
  130. this.getuserInfo = uni.getStorageSync('getuserInfo');
  131. //console.log('111111111111111111', this.getuserInfo)
  132. },
  133. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  134. onReady() {},
  135. //监听页面隐藏
  136. onHide() {},
  137. //监听窗口尺寸变化
  138. onResize() {},
  139. //监听页面卸载
  140. onUnload() {},
  141. //监听用户下拉动作,一般用于下拉刷新
  142. onPullDownRefresh() {},
  143. methods: {
  144. click1(){
  145. uni.navigateTo({
  146. url: '/pages/index/index'
  147. })
  148. },
  149. click2(){
  150. uni.navigateTo({
  151. url: '/pages/Workorder/Workorder'
  152. })
  153. },
  154. click3(){
  155. uni.navigateTo({
  156. url: '/pages/my/my'
  157. })
  158. },
  159. // 新增图片
  160. async afterRead(event) {
  161. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  162. let lists = [].concat(event.file)
  163. console.log('111111111111111111', lists)
  164. let fileListLen = this.fileList.length
  165. lists.map((item) => {
  166. this.fileList.push({
  167. ...item,
  168. status: 'uploading',
  169. message: '上传中'
  170. })
  171. })
  172. for (let i = 0; i < lists.length; i++) {
  173. const result = await this.uploadFilePromise(lists[i].url)
  174. let item = this.fileList[fileListLen]
  175. this.fileList.splice(fileListLen, 1, Object.assign(item, {
  176. status: 'success',
  177. message: '',
  178. url: result
  179. }))
  180. fileListLen++
  181. }
  182. },
  183. uploadFilePromise(url) {
  184. return new Promise((resolve, reject) => {
  185. let a = uni.uploadFile({
  186. url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  187. filePath: url,
  188. name: 'file',
  189. formData: {
  190. user: 'test'
  191. },
  192. success: (res) => {
  193. setTimeout(() => {
  194. resolve(res.data.data)
  195. }, 1000)
  196. }
  197. });
  198. })
  199. },
  200. navigations1(){
  201. uni.navigateTo({
  202. url: '/pages/my/Personalinformation/Personalinformation'
  203. })
  204. },
  205. navigations2(){
  206. // uni.navigateTo({
  207. // url: '/pages/my/Mydistribution/Mydistribution'
  208. // })
  209. uni.navigateTo({
  210. url: '/pages/my/Myorder/Myorder'
  211. })
  212. },
  213. navigations3(){
  214. uni.navigateTo({
  215. url: '/pages/my/Mytask/Mytask'
  216. })
  217. },
  218. navigations4(){
  219. uni.navigateTo({
  220. url: '/pages/my/Commentssuggestions/Commentssuggestions'
  221. })
  222. },
  223. changepass(){
  224. uni.navigateTo({
  225. url: '/pages/my/Changepassword/Changepassword'
  226. })
  227. },
  228. tuichu() {
  229. this.showtc = true;
  230. },
  231. confirmtc() {
  232. this.showtc = false;
  233. switch (uni.getSystemInfoSync().platform) {
  234. case 'android':
  235. plus.runtime.quit();
  236. break;
  237. case 'ios':
  238. plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
  239. break;
  240. }
  241. //清除缓存
  242. uni.clearStorageSync();
  243. },
  244. canceltc() {
  245. this.showtc = false;
  246. },
  247. }
  248. }
  249. </script>
  250. <style lang="scss">
  251. .minndle {
  252. width: 750rpx;
  253. height: 150rpx;
  254. margin: 25rpx 0;
  255. display: flex;
  256. align-items: center;
  257. justify-content: space-around;
  258. text-align: center;
  259. }
  260. .icon1{
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. }
  265. .icon2{
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. }
  270. .icon3{
  271. display: flex;
  272. align-items: center;
  273. justify-content: center;
  274. }
  275. .icon4{
  276. display: flex;
  277. align-items: center;
  278. justify-content: center;
  279. }
  280. .middleimgs {
  281. width: 750rpx;
  282. height: 300rpx;
  283. }
  284. .mainview {
  285. width: 750rpx;
  286. display: flex;
  287. flex-direction: column;
  288. }
  289. .topimg {
  290. width: 750rpx;
  291. height: 350rpx;
  292. display: flex;
  293. align-items: center;
  294. // background: linear-gradient(to right, #96C2FF, #5C8FFF);
  295. background: url("@/static/my/my.png");
  296. background-size: 100% 100%;
  297. }
  298. .touxiang {
  299. width: 180rpx;
  300. height: 180rpx;
  301. display: flex;
  302. align-items: center;
  303. justify-content: center;
  304. img {
  305. width: 120rpx;
  306. height: 120rpx;
  307. cursor: pointer;
  308. }
  309. }
  310. .Username {
  311. flex-grow: 1;
  312. height:350rpx;
  313. // line-height: 150rpx;
  314. // font-size: 40rpx;
  315. // color: #fff;
  316. // font-weight: bold;
  317. display: flex;
  318. justify-content:center;
  319. flex-direction: column;
  320. }
  321. .Username1{
  322. line-height: 100rpx;
  323. height: 100rpx;
  324. font-size: 40rpx;
  325. color: #fff;
  326. font-weight: bold;
  327. span{
  328. padding-left: 15rpx;
  329. font-size: 30rpx;
  330. color: #fff;
  331. }
  332. }
  333. .Username2{
  334. font-size: 20rpx;
  335. color: #333333;
  336. }
  337. .changemm {
  338. height: 250rpx;
  339. width: 250rpx;
  340. display: flex;
  341. justify-content: center;
  342. flex-direction: column;
  343. align-items: flex-end;
  344. }
  345. .message {
  346. display: flex;
  347. justify-content: flex-end;
  348. padding-right: 30rpx;
  349. }
  350. .wdmessage {
  351. font-size: 30rpx;
  352. color: #fff;
  353. padding-right: 10rpx;
  354. }
  355. .messagenumber {
  356. padding-top: 6rpx;
  357. width: 70rpx;
  358. }
  359. .setdata {
  360. padding-top: 15rpx;
  361. img {
  362. width: 50rpx;
  363. height: 50rpx;
  364. }
  365. }
  366. </style>