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

新增mip-cz-comment组件 #862

Open
wants to merge 8 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
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"browser": true
},
"rules": {
"linebreak-style": ["off", "windows"],
"jsdoc/check-param-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Thumbs.db
.DS_Store
*.svn
.svn
.prettierrc
.svn/
*.git
.git
Expand Down
Binary file added sites/._m.chinaz.com
Binary file not shown.
14 changes: 14 additions & 0 deletions sites/m.chinaz.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.chinaz.com/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
40 changes: 40 additions & 0 deletions sites/m.chinaz.com/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"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,
"camelcase": 0
}
}
8 changes: 8 additions & 0 deletions sites/m.chinaz.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
4 changes: 4 additions & 0 deletions sites/m.chinaz.com/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"semi": false
}
Empty file.
57 changes: 57 additions & 0 deletions sites/m.chinaz.com/common/mip-common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* @file 公用
* @author fl
*/
const { util } = MIP
const { dom } = util
export default class MIPCommon {
/*
*设置cookies
*@param {String} [name] [cookie key]
*@param {String} [value] [cookie 值]
*/
static setCookie (name, value) {
const d = new Date()
d.setTime(d.getTime() + 60 * 2000)
document.cookie = name + '=' + encodeURIComponent(value) + ';expires=' + d.toGMTString()
}

/*
*读取cookies
*@param {String} [name] [cookie key]
*/
static getCookie (name) {
const reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)')
const arr = document.cookie.match(reg)
if (arr) {
return parseInt(decodeURIComponent(arr[2]), 10)
}
}

/*
*时间格式转换
*@param {Time} [d] [时间戳]
*/
static time (d) {
let result = ''
result += [d.getFullYear(), d.getMonth() + 1, d.getDate()].join('/')
return result.replace(/(-|:)(\d[^\d])/g, '$1' + '0$2')
}

/*
*提示
*@param {String} [msg] [提示语]
*/
static cAlert (msg) {
if (document.getElementById('alert_tips')) {
document.getElementById('alert_tips').parentNode.removeChild(document.getElementById('alert_tips'))
}
const cTips = dom.create(`<mip-fixed type="top" id="alert_tips" class="animated fadeIn">${msg}</mip-fixed>`)
document.body.appendChild(cTips)
setTimeout(() => {
if (document.getElementById('alert_tips')) {
document.getElementById('alert_tips').parentNode.removeChild(document.getElementById('alert_tips'))
}
}, 5000)
}
}
46 changes: 46 additions & 0 deletions sites/m.chinaz.com/common/mip-common.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.mip-cz-common{
#alert_tips {
background: #000;
opacity: .8;
color: #fff;
width: 200px;
line-height: 50px;
left: 50%;
top: 50%;
margin: -25px 0 0 -100px;
text-align: center;
border-radius: 5px;
z-index: 1000000;
padding:0 10px;
&.fadeIn {
-webkit-animation-name: fadeIn;
animation-name: fadeIn
}
&.animated {
-webkit-animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-duration: 1s;
animation-fill-mode: both
}
}

@-webkit-keyframes fadeIn {
0% {
opacity: 0
}

to {
opacity: 1
}
}

@keyframes fadeIn {
0% {
opacity: 0
}

to {
opacity: 1
}
}
}
41 changes: 41 additions & 0 deletions sites/m.chinaz.com/components/mip-cz-comment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# mip-cz-comment

移动端评价模块样式、逻辑

标题|内容
----|----
类型|通用
支持布局|responsive, fixed-height, fill, container, fixed
所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.chinaz.com/mip-cz-comment/mip-cz-comment.js](https://c.mipcdn.com/extensions/platform/v2/m.chinaz.com/mip-cz-comment/mip-cz-comment.js)

## 示例

### 基本使用

```html
<mip-cz-comment cid="{$id}" url="https://m.chinaz.com"></mip-cz-comment>
```

## 属性

### cid

说明:本页面分类ID

必选项:是

类型:字符串

默认值:无

### url

说明:本站点网址

必选项:是

类型:字符串

取值范围:URL

默认值:无
20 changes: 20 additions & 0 deletions sites/m.chinaz.com/components/mip-cz-comment/example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html mip>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<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 class="mip-cz-common">
<div>
<mip-cz-comment cid="180268" url="https://m.chinaz.com"></mip-cz-comment>
</div>
<script src="https://c.mipcdn.com/static/v2/mip.js"></script>
<script src="/mip-cz-comment/mip-cz-comment.js"></script>
</body>
</html>
Loading