style2.php 13 KB

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