Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

找法网组件上传 #844

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions sites/m.findlaw.com/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
UTF-8
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{js,styl,html,json,vue}]
indent_size = 2
indent_style = space
[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions sites/m.findlaw.com/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
39 changes: 39 additions & 0 deletions sites/m.findlaw.com/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"allowImportExportEverywhere": false
},
"extends": [
"standard",
"plugin:vue/recommended"
],
"plugins": [
"jsdoc"
],
"globals": {
"MIP": true
},
"env": {
"browser": true
},
"rules": {
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/no-undefined-types": 1,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-example": 0,
"jsdoc/require-hyphen-before-param-description": 0,
"jsdoc/require-param": 1,
"jsdoc/require-param-description": 1,
"jsdoc/require-param-name": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-description": 1,
"jsdoc/require-returns-type": 1,
"jsdoc/valid-types": 1,
"no-var": 2
}
}
8 changes: 8 additions & 0 deletions sites/m.findlaw.com/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.idea/
*.log
Thumbs.db
.DS_Store
*.swp
*.gz
Empty file.
26 changes: 26 additions & 0 deletions sites/m.findlaw.com/example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html mip>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,user-scalable=no">
<title>MIP page</title>
<link rel="canonical" href="对应的原页面地址">
<link rel="stylesheet" href="https://c.mipcdn.com/static/v2/mip.css">
<style mip-custom>
/* 自定义样式 */
h2 {
margin: 50px auto;
text-align: center;
}
</style>
</head>
<body>
<div>
<h2>First MIP page</h2>
<h2>Add MIP components here</h2>
<mip-example></mip-example>
</div>
<script src="https://c.mipcdn.com/static/v2/mip.js"></script>
<script src="/mip-example/mip-example.js"></script>
</body>
</html>
31 changes: 31 additions & 0 deletions sites/m.findlaw.com/mip.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @file mip页面项目配置项
* @author
*/

module.exports = {
dev: {
/**
* 启动mip server调试的端口号
*
* @type {number}
*/
port: 8111,

/**
* 启用调试页面自动刷新
*
* @type {boolean}
*/
livereload: true,

/**
* server 启动自动打开页面,false 为关闭
* 如:
* autoopen: '/example/index.html'
*
* @type {string|boolean}
*/
autoopen: false
}
}
25 changes: 25 additions & 0 deletions sites/m.findlaw.com/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "m.findlaw.com",
"version": "0.0.1",
"description": "找法网自定义组件",
"scripts": {
"dev": "mip2 dev",
"build": "mip2 build",
"lint": "npm run lint:js",
"lint:js": "eslint --ext .vue,.js .",
"fix": "npm run fix:js",
"fix:js": "eslint --ext .vue,.js . --fix"
},
"author": "tangjunchao ([email protected])",
"dependencies": {},
"devDependencies": {
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsdoc": "^3.7.1",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.1.0",
"eslint-plugin-vue": "^4.5.0"
}
}
Empty file.
14 changes: 14 additions & 0 deletions sites/mip.findlaw.com/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
UTF-8
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{js,styl,html,json,vue}]
indent_size = 2
indent_style = space
[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions sites/mip.findlaw.com/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
39 changes: 39 additions & 0 deletions sites/mip.findlaw.com/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"allowImportExportEverywhere": false
},
"extends": [
"standard",
"plugin:vue/recommended"
],
"plugins": [
"jsdoc"
],
"globals": {
"MIP": true
},
"env": {
"browser": true
},
"rules": {
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
"jsdoc/no-undefined-types": 1,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-example": 0,
"jsdoc/require-hyphen-before-param-description": 0,
"jsdoc/require-param": 1,
"jsdoc/require-param-description": 1,
"jsdoc/require-param-name": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-description": 1,
"jsdoc/require-returns-type": 1,
"jsdoc/valid-types": 1,
"no-var": 2
}
}
8 changes: 8 additions & 0 deletions sites/mip.findlaw.com/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.idea/
*.log
Thumbs.db
.DS_Store
*.swp
*.gz
Empty file.
36 changes: 36 additions & 0 deletions sites/mip.findlaw.com/components/mip-asy-law/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# mip-asy-law

标题|内容
----|----
类型|
支持布局|
所需脚本| [https://c.mipcdn.com/extensions/platform/v2/mip.findlaw.com/mip-asy-law/mip-asy-law.js](https://c.mipcdn.com/extensions/platform/v2/mip.findlaw.com/mip-asy-law/mip-asy-law.js)

## 说明

因为接口返回数据格式不同于json,所以自定义请求数据,渲染页面

## 示例

示例说明

```
// 代码示例
<div class="swiper_con">
<div class="swiper-container">
<mip-asy-law url="https://mip.findlaw.cn/?c=Ajax&a=areaVipLawyerHeight&requestmode=async"></mip-asy-law>
</div>
</div>
```

## 属性

### 属性1

**说明**:

**必选项**:

**单位**:

**默认值**:
22 changes: 22 additions & 0 deletions sites/mip.findlaw.com/components/mip-asy-law/example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html mip>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,user-scalable=no">
<title>MIP page</title>
<link rel="canonical" href="对应的原页面地址">
<link rel="stylesheet" href="https://c.mipcdn.com/static/v2/mip.css">
<style mip-custom>
/* 自定义样式 */
</style>
</head>
<body>
<div class="swiper_con">
<div class="swiper-container">
<mip-asy-law url="https://mip.findlaw.cn/?c=Ajax&a=areaVipLawyerHeight&requestmode=async"></mip-asy-law>
</div>
</div>
<script src="https://c.mipcdn.com/static/v2/mip.js"></script>
<script src="/mip-asy-law/mip-asy-law.js"></script>
</body>
</html>
59 changes: 59 additions & 0 deletions sites/mip.findlaw.com/components/mip-asy-law/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
html{font-size:100px;font-size:calc(1000vw/32);font-size:-webkit-calc(1000vw/32);font-size:-moz-calc(1000vw/32);background-color:#fff;}
@media all and (max-width:320px){
html{font-size:100px;}
}
@media screen and (min-width: 362px) and (max-width:375px){
html{font-size:calc(1000vw/32*0.9);}
}
@media screen and (min-width:376px){
html{font-size:calc(1000vw/32*0.84);}
}
@media all and (min-width:640px){
html{font-size:126px;}
}
body{max-width:640px;margin: 0 auto;font-size:16px;}
.swiper_con {
padding-bottom: 0.1rem; }
.swiper_con .swiper-container {
overflow-x: auto; }
.swiper_con .swiper-wrapper {
display: flex; }
.swiper_con .link {
display: block; }
.swiper_con .img-box {
position: relative;
display: block;
width: 1.09rem;
height: 1.09rem;
background-color: #14c393;
border-radius: 0.08rem;
overflow: hidden;
margin-bottom: 0.065rem; }
.swiper_con .img-box img {
width: 100%; }
.swiper_con .font {
position: absolute;
left: 0;
bottom: 0;
display: block;
width: 0.51rem;
height: 0.21rem;
background-color: #609cff;
border-radius: 0 0.04rem 0.04rem 0;
line-height: 0.21rem;
text-align: center;
font-size: 0.12rem;
color: #fff;
font-style: normal; }
.swiper_con .tl {
display: block;
width: 1.09rem;
line-height: 0.185rem;
font-size: 0.13rem;
color: #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; }
.swiper_con .swiper-slide {
width: auto;
margin-left: 0.09rem; }
35 changes: 35 additions & 0 deletions sites/mip.findlaw.com/components/mip-asy-law/mip-asy-law.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import './index.less'

const { fetchJsonp } = window

export default class MIPAsyLaw extends MIP.CustomElement {
build () {
let ele = this.element
let url = ele.getAttribute('url')
fetchJsonp(url).then(res => {
console.log(res.json())
res.json().then(data => {
console.log(data)
loadData(data.proData)
})
})

function loadData (data) {
let wrapper = document.createElement('div')
wrapper.classList.add('swiper-wrapper')
let html = ''
for (let i in data) {
console.log(data[i])
let item = data[i]
html += `<div class="swiper-slide">
<div class="link">
<span class="img-box"><a href="http://m.findlaw.cn/lawyer/${item.u_uid}"><mip-img src="${item.u_file110135}" alt=""></mip-img></a><a href="https://m.findlaw.cn/lawyer/${item.u_uid}/consult/" class="font">咨询我</a></span>
<a href="http://m.findlaw.cn/lawyer/${item.u_uid}" class="tl">${item.u_username}·${item.u_honortype}</a>
</div>
</div>`
}
wrapper.innerHTML = html
ele.appendChild(wrapper)
}
}
}
Loading