my.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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">
  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">
  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">
  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">
  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. </view>
  98. </template>
  99. <script>
  100. import {
  101. Static
  102. } from "vue"
  103. export default {
  104. data() {
  105. return {
  106. fileList: [],
  107. showtc: false,
  108. src: require('@/static/my/tx.png'),
  109. srcxinxi: require('@/static/my/xinxi.png'),
  110. information1: 34,
  111. information2: 100,
  112. getuserInfo:{},
  113. }
  114. },
  115. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  116. onLoad() {
  117. this.getuserInfo = uni.getStorageSync('getuserInfo');
  118. //console.log('111111111111111111', this.getuserInfo)
  119. },
  120. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  121. onReady() {},
  122. //监听页面隐藏
  123. onHide() {},
  124. //监听窗口尺寸变化
  125. onResize() {},
  126. //监听页面卸载
  127. onUnload() {},
  128. //监听用户下拉动作,一般用于下拉刷新
  129. onPullDownRefresh() {},
  130. methods: {
  131. // 新增图片
  132. async afterRead(event) {
  133. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  134. let lists = [].concat(event.file)
  135. console.log('111111111111111111', lists)
  136. let fileListLen = this.fileList.length
  137. lists.map((item) => {
  138. this.fileList.push({
  139. ...item,
  140. status: 'uploading',
  141. message: '上传中'
  142. })
  143. })
  144. for (let i = 0; i < lists.length; i++) {
  145. const result = await this.uploadFilePromise(lists[i].url)
  146. let item = this.fileList[fileListLen]
  147. this.fileList.splice(fileListLen, 1, Object.assign(item, {
  148. status: 'success',
  149. message: '',
  150. url: result
  151. }))
  152. fileListLen++
  153. }
  154. },
  155. uploadFilePromise(url) {
  156. return new Promise((resolve, reject) => {
  157. let a = uni.uploadFile({
  158. url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
  159. filePath: url,
  160. name: 'file',
  161. formData: {
  162. user: 'test'
  163. },
  164. success: (res) => {
  165. setTimeout(() => {
  166. resolve(res.data.data)
  167. }, 1000)
  168. }
  169. });
  170. })
  171. },
  172. navigations1(){
  173. uni.navigateTo({
  174. url: '/pages/my/Personalinformation/Personalinformation'
  175. })
  176. },
  177. navigations2(){
  178. // uni.navigateTo({
  179. // url: '/pages/my/Mydistribution/Mydistribution'
  180. // })
  181. uni.navigateTo({
  182. url: '/pages/my/Myorder/Myorder'
  183. })
  184. },
  185. navigations3(){
  186. uni.navigateTo({
  187. url: '/pages/my/Mytask/Mytask'
  188. })
  189. },
  190. navigations4(){
  191. uni.navigateTo({
  192. url: '/pages/my/Commentssuggestions/Commentssuggestions'
  193. })
  194. },
  195. changepass(){
  196. uni.navigateTo({
  197. url: '/pages/my/Changepassword/Changepassword'
  198. })
  199. },
  200. tuichu() {
  201. this.showtc = true;
  202. },
  203. confirmtc() {
  204. this.showtc = false;
  205. switch (uni.getSystemInfoSync().platform) {
  206. case 'android':
  207. plus.runtime.quit();
  208. break;
  209. case 'ios':
  210. plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
  211. break;
  212. }
  213. },
  214. canceltc() {
  215. this.showtc = false;
  216. },
  217. }
  218. }
  219. </script>
  220. <style lang="scss">
  221. .minndle {
  222. width: 750rpx;
  223. height: 150rpx;
  224. margin: 25rpx 0;
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-around;
  228. text-align: center;
  229. }
  230. .icon1{
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. }
  235. .icon2{
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. }
  240. .icon3{
  241. display: flex;
  242. align-items: center;
  243. justify-content: center;
  244. }
  245. .icon4{
  246. display: flex;
  247. align-items: center;
  248. justify-content: center;
  249. }
  250. .middleimgs {
  251. width: 750rpx;
  252. height: 300rpx;
  253. }
  254. .mainview {
  255. width: 750rpx;
  256. display: flex;
  257. flex-direction: column;
  258. }
  259. .topimg {
  260. width: 750rpx;
  261. height: 350rpx;
  262. display: flex;
  263. align-items: center;
  264. // background: linear-gradient(to right, #96C2FF, #5C8FFF);
  265. background: url("@/static/my/my.png");
  266. background-size: 100% 100%;
  267. }
  268. .touxiang {
  269. width: 180rpx;
  270. height: 180rpx;
  271. display: flex;
  272. align-items: center;
  273. justify-content: center;
  274. img {
  275. width: 120rpx;
  276. height: 120rpx;
  277. cursor: pointer;
  278. }
  279. }
  280. .Username {
  281. flex-grow: 1;
  282. height:350rpx;
  283. // line-height: 150rpx;
  284. // font-size: 40rpx;
  285. // color: #fff;
  286. // font-weight: bold;
  287. display: flex;
  288. justify-content:center;
  289. flex-direction: column;
  290. }
  291. .Username1{
  292. line-height: 100rpx;
  293. height: 100rpx;
  294. font-size: 40rpx;
  295. color: #fff;
  296. font-weight: bold;
  297. span{
  298. padding-left: 15rpx;
  299. font-size: 30rpx;
  300. color: #fff;
  301. }
  302. }
  303. .Username2{
  304. font-size: 20rpx;
  305. color: #333333;
  306. }
  307. .changemm {
  308. height: 250rpx;
  309. width: 250rpx;
  310. display: flex;
  311. justify-content: center;
  312. flex-direction: column;
  313. align-items: flex-end;
  314. }
  315. .message {
  316. display: flex;
  317. justify-content: flex-end;
  318. padding-right: 30rpx;
  319. }
  320. .wdmessage {
  321. font-size: 30rpx;
  322. color: #fff;
  323. padding-right: 10rpx;
  324. }
  325. .messagenumber {
  326. padding-top: 6rpx;
  327. width: 70rpx;
  328. }
  329. .setdata {
  330. padding-top: 15rpx;
  331. img {
  332. width: 50rpx;
  333. height: 50rpx;
  334. }
  335. }
  336. </style>