my.vue 10 KB

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