style2.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template id="member-info-style2">
  2. <div class="member-info-style2" >
  3. <div class="user-info flex">
  4. <div class="user-avarat">
  5. <img class="default_picture" :src="static_img_prefix+'/default_picture.png'" />
  6. </div>
  7. <div class="member-box">
  8. <div class="flex-y-center">
  9. <div class="user-name" :style="{color:levelStyle.nameColor}">张三还是李四</div>
  10. </div>
  11. <div class="flex-y-center user-level-box">
  12. <div class="user-level" v-if="permission.level">
  13. <img class="level-icon" :src="static_img_prefix+'/diy/member-info/level.png'" alt="">
  14. 普通会员
  15. </div>
  16. <div class="user-auto" >
  17. <img class="auto-icon" :src="static_img_prefix+'/diy/member-info/auth.png'" />
  18. 已认证
  19. </div>
  20. </div>
  21. <div class="user-level-box flex">
  22. <div class="invite_code" :style="{color:levelStyle.nameColor}">
  23. 邀请码:HN678910
  24. </div>
  25. <el-divider direction="vertical" style="color:#FFF"></el-divider>
  26. <div class="user-id" :style="{color:levelStyle.nameColor}">
  27. ID:123456
  28. </div>
  29. </div>
  30. </div>
  31. <div class="nav-right" >
  32. <div class="btn-box" :style="iconStyle" v-if="permission.set">设置<i class="el-icon-arrow-right"></i></div>
  33. <div class="btn-box" :style="iconStyle" v-if="permission.centerPage">主页<i class="el-icon-arrow-right"></i></div>
  34. </div>
  35. </div>
  36. <div class="assets-info" :style="cardStyle">
  37. <div class="assets-info-bg-color" :class="isCardCradient ? 'bg-color-cradient-active':''">
  38. <div class="assets-info-bg" :class="isCardPattern ? 'bg-pattern-active':''" :style="cardPatternUrl" >
  39. <!-- 循环渲染 后台组件无法滚动,处理为只显示三个 -->
  40. <div :class="currencyClass" :style="[assetStyle]">
  41. <template v-for="(item,index) in assetList">
  42. <div :key="index" v-if="index < showNum">
  43. <div class="cate-num">100</div>
  44. <div>{{item.title}}</div>
  45. </div>
  46. </template>
  47. </div>
  48. <div :style="hyphenStyle" class="indicator">
  49. <div class="indeic-1"></div>
  50. <div class="indeic-2"></div>
  51. </div>
  52. <div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. Vue.component('member-info-style2', {
  59. name: "member-info-style2",
  60. props: {
  61. activeItem: {
  62. type: Object,
  63. default () {
  64. return {}
  65. }
  66. }
  67. },
  68. template: '#member-info-style2',
  69. data() {
  70. return {
  71. static_img_prefix: '<?= Yii::getAlias('@attachurl') ?>'+'/static',
  72. isCardPattern:true,
  73. isCardCradient:true,
  74. showNum:50
  75. }
  76. },
  77. computed: {
  78. hyphenStyle(){
  79. let currencyStyle = this.activeItem.data.currencyStyle || 1
  80. let style = {}
  81. if(currencyStyle == 1){
  82. style['text-align'] = 'center'
  83. }else{
  84. style['display'] = 'none'
  85. }
  86. return style
  87. },
  88. currencyClass(){
  89. let currencyStyle = this.activeItem.data.currencyStyle || 1
  90. this.showNum = currencyStyle == 1 ? 3 : 50;
  91. return currencyStyle == 1 ? 'flex' : 'assets-info-grid';
  92. },
  93. iconStyle() {
  94. let obj = {
  95. 'color': this.activeItem.computedStyle.iconColor || '#333',
  96. 'border-color':this.activeItem.computedStyle.iconColor || '#333',
  97. }
  98. return obj
  99. },
  100. cardStyle() {
  101. var bgColor = this.activeItem.computedStyle.tabSelectColor
  102. var shadowColor = this.activeItem.computedStyle.cardShadowColor
  103. var type = this.activeItem.computedStyle.cardBgType
  104. var brTop = this.activeItem.computedStyle.compRadiusTop,
  105. brBottom = this.activeItem.computedStyle.compRadiusBot;
  106. brTop = brTop == undefined ? 10 : brTop
  107. brBottom = brBottom == undefined ? 10 : brBottom
  108. var style = {
  109. borderRadius: `${brTop}px ${brTop}px ${brBottom}px ${brBottom}px`
  110. }
  111. if(bgColor != null){
  112. style['backgroundColor']= `${bgColor}`
  113. }
  114. var cardStyle = this.activeItem.computedStyle.cardStyle || []
  115. this.isCardPattern = cardStyle.includes('pattern')
  116. this.isCardCradient = cardStyle.includes('cradient')
  117. if (shadowColor) {
  118. style['box-shadow'] = `${shadowColor} 0px 0px 25px`
  119. }
  120. if (type == 2) {
  121. style.backgroundImage = `url(${this.activeItem.computedStyle.tabSelectImg})`
  122. style.backgroundSize = `cover`
  123. }
  124. return style
  125. },
  126. levelStyle() {
  127. let {
  128. nameColor,
  129. memColor,
  130. memBgColor
  131. } = this.activeItem.computedStyle
  132. var obj = {
  133. nameColor: nameColor || '#fff',
  134. levelColor: memColor || '#fff',
  135. levelBgColor: memBgColor || '#000',
  136. }
  137. return obj
  138. },
  139. assetStyle() {
  140. var {
  141. assetColor
  142. } = this.activeItem.computedStyle
  143. return {
  144. color: assetColor
  145. }
  146. },
  147. permission() {
  148. let obj = {
  149. memberCode: false,
  150. level: false,
  151. set: false,
  152. centerPage: false
  153. }
  154. let type = ['memberCode', 'level', 'set', 'centerPage']
  155. let data = this.activeItem.computedStyle.contentList1 || [0, 1, 2, 3]
  156. data.forEach((index) => {
  157. const key = type[index]
  158. obj[key] = true
  159. })
  160. console.log('会员组件',data,obj)
  161. return obj
  162. },
  163. assetList() {
  164. let data = this.activeItem.data.contentList2 || []
  165. if (data.length) {
  166. const list = this.$capitals.filter(item => {
  167. return data.indexOf(item.code) !== -1
  168. })
  169. return list
  170. }
  171. return []
  172. },
  173. cardPatternUrl(){
  174. if(this.isCardPattern){
  175. let url = this.static_img_prefix+'/diy/member-info/bg-pattern.png';
  176. return {'background-image':`url(${url})`}
  177. }
  178. return {}
  179. }
  180. },
  181. });
  182. </script>
  183. <style lang="scss" scoped>
  184. .member-info-style2 {
  185. background-color: transparent;
  186. margin-top:25px;
  187. .icon-info .icon {
  188. width: 24px;
  189. height: 24px;
  190. line-height:24px;
  191. margin-left: 6px;
  192. text-align: center;
  193. }
  194. .icon-info .icon>i {
  195. font-size: 15px;
  196. }
  197. .user-avarat {
  198. width: 60px;
  199. height: 60px;
  200. margin-right: 8px;
  201. border-radius: 50%;
  202. background-color: #eee;
  203. .default_picture {
  204. width: 60px;
  205. height: 60px;
  206. }
  207. }
  208. .nav-right {
  209. height: 60px;
  210. display: flex;
  211. flex-direction: column;
  212. justify-content: center;
  213. color: #333;
  214. font-size: 11px;
  215. align-items: center;
  216. .btn-box {
  217. display: flex;
  218. justify-content: center;
  219. align-items: center;
  220. width: 46px;
  221. height: 18px;
  222. border-radius: 9px;
  223. border: 0.5px solid #333;
  224. text-align: center;
  225. }
  226. .btn-box+.btn-box {
  227. margin-top:10px;
  228. }
  229. .el-icon-arrow-right {
  230. font-size: 8px;
  231. margin-left: 2px;
  232. }
  233. }
  234. .user-info {
  235. position: relative;
  236. }
  237. .member-box {
  238. display: flex;
  239. flex-direction: column;
  240. justify-content: center;
  241. flex: 1;
  242. }
  243. .user-name {
  244. font-size:14px;
  245. font-weight: bold;
  246. }
  247. .user-level-box {
  248. display: flex;
  249. align-items: center;
  250. flex-wrap: wrap;
  251. margin-top: 8px;
  252. }
  253. .user-level {
  254. display: flex;
  255. align-items: center;
  256. color: #E6800B;
  257. background: linear-gradient( 180deg, #FFEC8B 0%, #FFE030 100%);
  258. height: 16px;
  259. line-height: 16px;
  260. border-radius: 20px;
  261. text-align: right;
  262. padding-right: 8px;
  263. font-size: 11px;
  264. font-weight: bold;
  265. margin-right: 6px;
  266. }
  267. .user-level>.level-icon {
  268. width: 19px;
  269. height: 19px;
  270. border-radius: 50%;
  271. margin-right: 3px;
  272. }
  273. .user-auto {
  274. margin-left:4px;
  275. background: #FFE7D2;
  276. border: 1px solid #FF8720;
  277. display: flex;
  278. align-items: center;
  279. color: #FF8720;
  280. height: 16px;
  281. line-height: 16px;
  282. border-radius: 20px;
  283. text-align: right;
  284. padding-right: 8px;
  285. font-size: 10px;
  286. white-space:nowrap;
  287. .auto-icon {
  288. width: 16px;
  289. height: 16px;
  290. border-radius: 50%;
  291. margin-right: 3px;
  292. margin-left: -7px;
  293. }
  294. }
  295. .invite_code ,.user-id{
  296. display: flex;
  297. align-items: center;
  298. color: #333;
  299. background: transparent ;
  300. height: 16px;
  301. line-height: 16px;
  302. border-radius: 20px;
  303. padding: 0 6px;
  304. font-size: 11px;
  305. }
  306. .assets-info {
  307. font-size: 12px;
  308. color: #fff;
  309. margin-top:20px;
  310. border-radius: 10px;
  311. background-color:#F54B4A;
  312. overflow: hidden;
  313. }
  314. .bg-color-cradient-active {
  315. background: linear-gradient( 164deg, rgba(255,255,255,0.6) 0%, transparent 70%);
  316. }
  317. .assets-info-bg {
  318. padding: 20px;
  319. background-size: 100% 100%;
  320. background-repeat: no-repeat;
  321. }
  322. .assets-info .cate-num {
  323. margin-bottom: 4px;
  324. font-size: 16px;
  325. line-height: 1.5;
  326. font-weight: bold;
  327. }
  328. .assets-info-bg>.flex>div {
  329. flex: 1;
  330. text-align: center;
  331. }
  332. .assets-info-grid {
  333. display: grid;
  334. grid-template-columns: 1fr 1fr 1fr;
  335. grid-template-rows: 1fr;
  336. grid-row-gap: 20px;
  337. }
  338. .assets-info-grid > div {
  339. text-align: center;
  340. }
  341. .indicator{
  342. display: flex;
  343. justify-content: center;
  344. padding-top:7px;
  345. position: relative;
  346. bottom:-12px;
  347. }
  348. .indicator > div {
  349. width: 14px;
  350. height: 3px;
  351. background: #FFFFFF;
  352. border-radius: 2px 2px 2px 2px;
  353. }
  354. .indeic-2 {
  355. margin-left:4px;
  356. opacity: 0.4;
  357. }
  358. }
  359. </style>