list.vue 14 KB

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