list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view>
  3. <scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
  4. <cu-custom bgColor="bg-luohu" :isBack="true">
  5. <block slot="backText">返回</block>
  6. <block slot="content">列表</block>
  7. </cu-custom>
  8. <view class="cu-bar bg-white solid-bottom margin-top">
  9. <view class="action">
  10. <text class="cuIcon-title text-orange "></text> 宫格列表
  11. </view>
  12. <view class="action">
  13. <button class="cu-btn bg-green shadow" @tap="showModal" data-target="gridModal">设置</button>
  14. </view>
  15. </view>
  16. <view class="cu-modal" :class="modalName=='gridModal'?'show':''" @tap="hideModal">
  17. <view class="cu-dialog" @tap.stop>
  18. <radio-group class="block" @change="Gridchange">
  19. <view class="cu-list menu text-left">
  20. <view class="cu-item" v-for="(item,index) in 3" :key="index">
  21. <label class="flex justify-between align-center flex-sub">
  22. <view class="flex-sub">{{index +3}} 列</view>
  23. <radio class="round" :value="(index + 3) + ''"
  24. :class="gridCol==index+3?'checked':''" :checked="gridCol==index+3"></radio>
  25. </label>
  26. </view>
  27. </view>
  28. </radio-group>
  29. <view class="cu-list menu text-left solid-top">
  30. <view class="cu-item">
  31. <view class="content">
  32. <text class="text-grey">边框</text>
  33. </view>
  34. <view class="action">
  35. <switch @change="Gridswitch" :class="gridBorder?'checked':''"
  36. :checked="gridBorder?true:false"></switch>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']">
  43. <view class="cu-item" v-for="(item,index) in cuIconList" :key="index" v-if="index<gridCol*2">
  44. <view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
  45. <view class="cu-tag badge" v-if="item.badge!=0">
  46. <block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
  47. </view>
  48. </view>
  49. <text>{{item.name}}</text>
  50. </view>
  51. </view>
  52. <view class="cu-bar bg-white solid-bottom margin-top">
  53. <view class="action">
  54. <text class="cuIcon-title text-orange"></text> 菜单列表
  55. </view>
  56. <view class="action">
  57. <button class="cu-btn bg-green shadow" @tap="showModal" data-target="menuModal">设置</button>
  58. </view>
  59. </view>
  60. <view class="cu-modal" :class="modalName=='menuModal'?'show':''" @tap="hideModal">
  61. <view class="cu-dialog" @tap.stop>
  62. <view class="cu-list menu text-left solid-top">
  63. <view class="cu-item">
  64. <view class="content">
  65. <text class="text-grey">短边框</text>
  66. </view>
  67. <view class="action">
  68. <switch @change="MenuBorder" :class="menuBorder?'checked':''"
  69. :checked="menuBorder?true:false"></switch>
  70. </view>
  71. </view>
  72. <view class="cu-item">
  73. <view class="content">
  74. <text class="text-grey">箭头</text>
  75. </view>
  76. <view class="action">
  77. <switch @change="MenuArrow" :class="menuArrow?'checked':''"
  78. :checked="menuArrow?true:false"></switch>
  79. </view>
  80. </view>
  81. <view class="cu-item">
  82. <view class="content">
  83. <text class="text-grey">卡片</text>
  84. </view>
  85. <view class="action">
  86. <switch @change="MenuCard" :class="menuCard?'checked':''"
  87. :checked="menuCard?true:false"></switch>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="cu-list menu" :class="[menuBorder?'sm-border':'',menuCard?'card-menu margin-top':'']">
  94. <view class="cu-item" :class="menuArrow?'arrow':''">
  95. <view class="content">
  96. <text class="cuIcon-circlefill text-grey"></text>
  97. <text class="text-grey">图标 + 标题</text>
  98. </view>
  99. </view>
  100. <view class="cu-item" :class="menuArrow?'arrow':''">
  101. <view class="content">
  102. <image src="/static/logo.png" class="png" mode="aspectFit"></image>
  103. <text class="text-grey">图片 + 标题</text>
  104. </view>
  105. </view>
  106. <view class="cu-item" :class="menuArrow?'arrow':''">
  107. <button class="cu-btn content" open-type="contact">
  108. <text class="cuIcon-btn text-olive"></text>
  109. <text class="text-grey">Open-type 按钮</text>
  110. </button>
  111. </view>
  112. <view class="cu-item" :class="menuArrow?'arrow':''">
  113. <navigator class="content" hover-class="none" url="../list/list" open-type="redirect">
  114. <text class="cuIcon-discoverfill text-orange"></text>
  115. <text class="text-grey">Navigator 跳转</text>
  116. </navigator>
  117. </view>
  118. <view class="cu-item" :class="menuArrow?'arrow':''">
  119. <view class="content">
  120. <text class="cuIcon-emojiflashfill text-pink"></text>
  121. <text class="text-grey">头像组</text>
  122. </view>
  123. <view class="action">
  124. <view class="cu-avatar-group">
  125. <view class="cu-avatar round sm"
  126. style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg);">
  127. </view>
  128. <view class="cu-avatar round sm"
  129. style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg);">
  130. </view>
  131. <view class="cu-avatar round sm"
  132. style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big25002.jpg);">
  133. </view>
  134. <view class="cu-avatar round sm"
  135. style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big91012.jpg);">
  136. </view>
  137. </view>
  138. <text class="text-grey text-sm">4 人</text>
  139. </view>
  140. </view>
  141. <view class="cu-item" :class="menuArrow?'arrow':''">
  142. <view class="content">
  143. <text class="cuIcon-btn text-green"></text>
  144. <text class="text-grey">按钮</text>
  145. </view>
  146. <view class="action">
  147. <button class="cu-btn round bg-green shadow">
  148. <text class="cuIcon-upload"></text> 上传</button>
  149. </view>
  150. </view>
  151. <view class="cu-item" :class="menuArrow?'arrow':''">
  152. <view class="content">
  153. <text class="cuIcon-tagfill text-red margin-right-xs"></text>
  154. <text class="text-grey">标签</text>
  155. </view>
  156. <view class="action">
  157. <view class="cu-tag round bg-orange light">音乐</view>
  158. <view class="cu-tag round bg-olive light">电影</view>
  159. <view class="cu-tag round bg-blue light">旅行</view>
  160. </view>
  161. </view>
  162. <view class="cu-item" :class="menuArrow?'arrow':''">
  163. <view class="content">
  164. <text class="cuIcon-warn text-green"></text>
  165. <text class="text-grey">文本</text>
  166. </view>
  167. <view class="action">
  168. <text class="text-grey text-sm">小目标还没有实现!</text>
  169. </view>
  170. </view>
  171. <view class="cu-item">
  172. <view class="content padding-tb-sm">
  173. <view>
  174. <text class="cuIcon-clothesfill text-blue margin-right-xs"></text> 多行Item
  175. </view>
  176. <view class="text-gray text-sm">
  177. <text class="cuIcon-infofill margin-right-xs"></text> 小目标还没有实现!
  178. </view>
  179. </view>
  180. <view class="action">
  181. <switch class="switch-sex" @change="SwitchSex" :class="skin?'checked':''"
  182. :checked="skin?true:false"></switch>
  183. </view>
  184. </view>
  185. </view>
  186. <view class="cu-bar bg-white solid-bottom margin-top">
  187. <view class="action">
  188. <text class="cuIcon-title text-orange "></text> 消息列表
  189. </view>
  190. </view>
  191. <view class="cu-list menu-avatar">
  192. <view class="cu-item">
  193. <view class="cu-avatar round lg"
  194. style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg);">
  195. </view>
  196. <view class="content">
  197. <view class="text-grey">凯尔</view>
  198. <view class="text-gray text-sm flex">
  199. <view class="text-cut">
  200. <text class="cuIcon-infofill text-red margin-right-xs"></text>
  201. 我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。我已天理为凭,踏入这片荒芜,不再受凡人的枷锁遏制。
  202. </view>
  203. </view>
  204. </view>
  205. <view class="action">
  206. <view class="text-grey text-xs">22:20</view>
  207. <view class="cu-tag round bg-grey sm">5</view>
  208. </view>
  209. </view>
  210. <view class="cu-item">
  211. <view class="cu-avatar round lg"
  212. style="background-image:url(https://ossweb-img.qq.com/images/lol/img/champion/Taric.png);">
  213. <view class="cu-tag badge">99+</view>
  214. </view>
  215. <view class="content">
  216. <view class="text-grey">
  217. <view class="text-cut">瓦洛兰之盾-塔里克</view>
  218. <view class="cu-tag round bg-orange sm">战士</view>
  219. </view>
  220. <view class="text-gray text-sm flex">
  221. <view class="text-cut">
  222. 塔里克是保护者星灵,用超乎寻常的力量守护着符文之地的生命、仁爱以及万物之美。塔里克由于渎职而被放逐,离开了祖国德玛西亚,前去攀登巨神峰寻找救赎,但他找到的却是来自星界的更高层的召唤。现在的塔里克与古代巨神族的神力相融合,以瓦洛兰之盾的身份,永不疲倦地警惕着阴险狡诈的虚空腐化之力。
  223. </view>
  224. </view>
  225. </view>
  226. <view class="action">
  227. <view class="text-grey text-xs">22:20</view>
  228. <view class="cuIcon-notice_forbid_fill text-gray"></view>
  229. </view>
  230. </view>
  231. <view class="cu-item ">
  232. <view class="cu-avatar radius lg"
  233. style="background-image:url(https://ossweb-img.qq.com/images/lol/img/champion/Morgana.png);">
  234. </view>
  235. <view class="content">
  236. <view class="text-pink">
  237. <view class="text-cut">莫甘娜</view>
  238. </view>
  239. <view class="text-gray text-sm flex">
  240. <view class="text-cut">凯尔,你被自己的光芒变的盲目!</view>
  241. </view>
  242. </view>
  243. <view class="action">
  244. <view class="text-grey text-xs">22:20</view>
  245. <view class="cu-tag round bg-red sm">5</view>
  246. </view>
  247. </view>
  248. <view class="cu-item grayscale">
  249. <view class="cu-avatar radius lg"
  250. style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big81007.jpg);">
  251. </view>
  252. <view class="content">
  253. <view>
  254. <view class="text-cut">伊泽瑞尔</view>
  255. <view class="cu-tag round bg-orange sm">断开连接...</view>
  256. </view>
  257. <view class="text-gray text-sm flex">
  258. <view class="text-cut"> 等我回来一个打十个</view>
  259. </view>
  260. </view>
  261. <view class="action">
  262. <view class="text-grey text-xs">22:20</view>
  263. <view class="cu-tag round bg-red sm">5</view>
  264. </view>
  265. </view>
  266. <view class="cu-item cur">
  267. <view class="cu-avatar radius lg"
  268. style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big81020.jpg);">
  269. <view class="cu-tag badge"></view>
  270. </view>
  271. <view class="content">
  272. <view>
  273. <view class="text-cut">瓦罗兰大陆-睡衣守护者-新手保护营</view>
  274. <view class="cu-tag round bg-orange sm">6人</view>
  275. </view>
  276. <view class="text-gray text-sm flex">
  277. <view class="text-cut"> 伊泽瑞尔:<text
  278. class="cuIcon-locationfill text-orange margin-right-xs"></text> 传送中...</view>
  279. </view>
  280. </view>
  281. <view class="action">
  282. <view class="text-grey text-xs">22:20</view>
  283. <view class="cuIcon-notice_forbid_fill text-gray"></view>
  284. </view>
  285. </view>
  286. </view>
  287. <view class="cu-bar bg-white solid-bottom margin-top">
  288. <view class="action">
  289. <text class="cuIcon-title text-orange "></text> 列表左滑
  290. </view>
  291. </view>
  292. <view class="cu-list menu-avatar">
  293. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in 4"
  294. :key="index" @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd"
  295. :data-target="'move-box-' + index">
  296. <view class="cu-avatar round lg"
  297. :style="[{backgroundImage:'url(https://ossweb-img.qq.com/images/lol/web201310/skin/big2100'+ (index+2) +'.jpg)'}]">
  298. </view>
  299. <view class="content">
  300. <view class="text-grey">文晓港</view>
  301. <view class="text-gray text-sm">
  302. <text class="cuIcon-infofill text-red margin-right-xs"></text> 消息未送达
  303. </view>
  304. </view>
  305. <view class="action">
  306. <view class="text-grey text-xs">22:20</view>
  307. <view class="cu-tag round bg-grey sm">5</view>
  308. </view>
  309. <view class="move">
  310. <view class="bg-grey">置顶</view>
  311. <view class="bg-red">删除</view>
  312. </view>
  313. </view>
  314. </view>
  315. </scroll-view>
  316. </view>
  317. </template>
  318. <script>
  319. export default {
  320. data() {
  321. return {
  322. cuIconList: [{
  323. cuIcon: 'cardboardfill',
  324. color: 'red',
  325. badge: 120,
  326. name: 'VR'
  327. }, {
  328. cuIcon: 'recordfill',
  329. color: 'orange',
  330. badge: 1,
  331. name: '录像'
  332. }, {
  333. cuIcon: 'picfill',
  334. color: 'yellow',
  335. badge: 0,
  336. name: '图像'
  337. }, {
  338. cuIcon: 'noticefill',
  339. color: 'olive',
  340. badge: 22,
  341. name: '通知'
  342. }, {
  343. cuIcon: 'upstagefill',
  344. color: 'cyan',
  345. badge: 0,
  346. name: '排行榜'
  347. }, {
  348. cuIcon: 'clothesfill',
  349. color: 'blue',
  350. badge: 0,
  351. name: '皮肤'
  352. }, {
  353. cuIcon: 'discoverfill',
  354. color: 'purple',
  355. badge: 0,
  356. name: '发现'
  357. }, {
  358. cuIcon: 'questionfill',
  359. color: 'mauve',
  360. badge: 0,
  361. name: '帮助'
  362. }, {
  363. cuIcon: 'commandfill',
  364. color: 'purple',
  365. badge: 0,
  366. name: '问答'
  367. }, {
  368. cuIcon: 'brandfill',
  369. color: 'mauve',
  370. badge: 0,
  371. name: '版权'
  372. }],
  373. modalName: null,
  374. gridCol: 3,
  375. gridBorder: false,
  376. menuBorder: false,
  377. menuArrow: false,
  378. menuCard: false,
  379. skin: false,
  380. listTouchStart: 0,
  381. listTouchDirection: null,
  382. };
  383. },
  384. methods: {
  385. showModal(e) {
  386. this.modalName = e.currentTarget.dataset.target
  387. },
  388. hideModal(e) {
  389. this.modalName = null
  390. },
  391. Gridchange(e) {
  392. this.gridCol = e.detail.value
  393. },
  394. Gridswitch(e) {
  395. this.gridBorder = e.detail.value
  396. },
  397. MenuBorder(e) {
  398. this.menuBorder = e.detail.value
  399. },
  400. MenuArrow(e) {
  401. this.menuArrow = e.detail.value
  402. },
  403. MenuCard(e) {
  404. this.menuCard = e.detail.value
  405. },
  406. SwitchSex(e) {
  407. this.skin = e.detail.value
  408. },
  409. // ListTouch触摸开始
  410. ListTouchStart(e) {
  411. this.listTouchStart = e.touches[0].pageX
  412. },
  413. // ListTouch计算方向
  414. ListTouchMove(e) {
  415. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left'
  416. },
  417. // ListTouch计算滚动
  418. ListTouchEnd(e) {
  419. if (this.listTouchDirection == 'left') {
  420. this.modalName = e.currentTarget.dataset.target
  421. } else {
  422. this.modalName = null
  423. }
  424. this.listTouchDirection = null
  425. }
  426. }
  427. }
  428. </script>
  429. <style>
  430. .page {
  431. height: 100Vh;
  432. width: 100vw;
  433. }
  434. .page.show {
  435. overflow: hidden;
  436. }
  437. .switch-sex::after {
  438. content: "\e716";
  439. }
  440. .switch-sex::before {
  441. content: "\e7a9";
  442. }
  443. .switch-music::after {
  444. content: "\e66a";
  445. }
  446. .switch-music::before {
  447. content: "\e6db";
  448. }
  449. </style>