diff --git a/sites/m.sys321.com/.editorconfig b/sites/m.sys321.com/.editorconfig new file mode 100644 index 000000000..cb530eac4 --- /dev/null +++ b/sites/m.sys321.com/.editorconfig @@ -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 diff --git a/sites/m.sys321.com/.eslintignore b/sites/m.sys321.com/.eslintignore new file mode 100644 index 000000000..db4c6d9b6 --- /dev/null +++ b/sites/m.sys321.com/.eslintignore @@ -0,0 +1,2 @@ +dist +node_modules \ No newline at end of file diff --git a/sites/m.sys321.com/.eslintrc b/sites/m.sys321.com/.eslintrc new file mode 100644 index 000000000..84a3a2e9c --- /dev/null +++ b/sites/m.sys321.com/.eslintrc @@ -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 + } +} diff --git a/sites/m.sys321.com/.gitignore b/sites/m.sys321.com/.gitignore new file mode 100644 index 000000000..1207415d5 --- /dev/null +++ b/sites/m.sys321.com/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +dist/ +.idea/ +*.log +Thumbs.db +.DS_Store +*.swp +*.gz diff --git a/sites/m.sys321.com/common/.gitkeep b/sites/m.sys321.com/common/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/sites/m.sys321.com/common/config.api.js b/sites/m.sys321.com/common/config.api.js new file mode 100644 index 000000000..2ec172eb8 --- /dev/null +++ b/sites/m.sys321.com/common/config.api.js @@ -0,0 +1,8 @@ +/** + * 项目相关接口配置文件 + */ + +export default { + baseUrl: 'http://s.sys321.com', + basePJUrl: 'http://www.sys321.com' +} diff --git a/sites/m.sys321.com/components/mip-game/README.md b/sites/m.sys321.com/components/mip-game/README.md new file mode 100644 index 000000000..98ed6306c --- /dev/null +++ b/sites/m.sys321.com/components/mip-game/README.md @@ -0,0 +1,31 @@ +# mip-game + +搜一搜网站移动端游戏, 软件列表页面逻辑合集 + +标题|内容 +----|---- +类型| 游戏, 软件列表 +支持布局| fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-game/mip-game.js](https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-game/mip-game.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.sys321.com/components/mip-game/example/index.html b/sites/m.sys321.com/components/mip-game/example/index.html new file mode 100644 index 000000000..6307533db --- /dev/null +++ b/sites/m.sys321.com/components/mip-game/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.sys321.com/components/mip-game/index.less b/sites/m.sys321.com/components/mip-game/index.less new file mode 100644 index 000000000..e69de29bb diff --git a/sites/m.sys321.com/components/mip-game/mip-game.js b/sites/m.sys321.com/components/mip-game/mip-game.js new file mode 100644 index 000000000..904afdbb1 --- /dev/null +++ b/sites/m.sys321.com/components/mip-game/mip-game.js @@ -0,0 +1,87 @@ +/** + * @file 评论模块 + * @author fl + */ +import api from '../../common/config.api' +const { CustomElement, util } = MIP +const { css } = util +export default class MIPMsysComment extends CustomElement { + build () { + let open = this.element.querySelectorAll('#open')[0] + let close = this.element.querySelectorAll('#close')[0] + let menu = this.element.querySelectorAll('#menu')[0] + let shadow = this.element.querySelectorAll('#shadow')[0] + open.onclick = function () { + css(menu, {left: '0px'}) + css(shadow, {display: 'block'}) + } + close.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + shadow.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + // tab样式 + let a = this.element.querySelectorAll('#type a') + let rank = this.element.querySelectorAll('#rank')[0] + for (let i = 0; i < a.length; i++) { + a[i].onclick = function () { + css(rank, {display: 'block'}) + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'cur' + } + } + } + } + // 加载更多数据 + let softListMore = this.element.querySelectorAll('#softListMore')[0] + let pagedata = this.element.querySelectorAll('#pagedata')[0] + let softlistP = 24 + if (softListMore !== undefined) { + softListMore.onclick = function () { + let cut = softListMore.getAttribute('data-cut') + let typeid = softListMore.getAttribute('data-typeid') + let req = new Request(api.baseUrl + '/api/softListMore', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + cut: cut, + typeid: typeid, + p: softlistP + }) + }) + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + softListMore.innerText = '加载完毕啦,么么哒~' + return false + } else { + softListMore.innerText = '加载中...' + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] + khtml = document.createElement('li') + khtml.innerHTML = '
' + dt.title + '
' + dt.score + '
' + pagedata.appendChild(khtml) + } + if (len < 20) { + softListMore.innerText = '加载完毕啦,么么哒~' + } else { + softListMore.innerText = '点击有惊喜,萌萌哒~' + } + softlistP = softlistP + 24 + } + }) + } + } + } +} diff --git a/sites/m.sys321.com/components/mip-index/README.md b/sites/m.sys321.com/components/mip-index/README.md new file mode 100644 index 000000000..2fdd20a97 --- /dev/null +++ b/sites/m.sys321.com/components/mip-index/README.md @@ -0,0 +1,31 @@ +# mip-index + +搜一搜网站移动端首页逻辑合集 + +标题|内容 +----|---- +类型| 通用 +支持布局| responsive, fixed-height, fill, container, fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-index/mip-index.js](https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-index/mip-index.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.sys321.com/components/mip-index/example/index.html b/sites/m.sys321.com/components/mip-index/example/index.html new file mode 100644 index 000000000..6307533db --- /dev/null +++ b/sites/m.sys321.com/components/mip-index/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.sys321.com/components/mip-index/index.less b/sites/m.sys321.com/components/mip-index/index.less new file mode 100644 index 000000000..e69de29bb diff --git a/sites/m.sys321.com/components/mip-index/mip-index.js b/sites/m.sys321.com/components/mip-index/mip-index.js new file mode 100644 index 000000000..1bcb62c84 --- /dev/null +++ b/sites/m.sys321.com/components/mip-index/mip-index.js @@ -0,0 +1,226 @@ +/** + * @file 评论模块 + * @author fl + */ +import api from '../../common/config.api' +const { CustomElement, util } = MIP +const { css } = util +export default class MIPMsysComment extends CustomElement { + build () { + let open = this.element.querySelectorAll('#open')[0] + let close = this.element.querySelectorAll('#close')[0] + let menu = this.element.querySelectorAll('#menu')[0] + let shadow = this.element.querySelectorAll('#shadow')[0] + open.onclick = function () { + css(menu, {left: '0px'}) + css(shadow, {display: 'block'}) + } + close.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + shadow.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + // 分类 + let bannerPic = this.element.querySelectorAll('.bannerPic') + let a = this.element.querySelectorAll('#sNav a') + let main = this.element.querySelectorAll('.main dd') + for (let i = 0; i < bannerPic.length; i++) { + bannerPic[i].onclick = function () { + location.href = './down_xq.html' + } + } + if (!a) { + return + } else { + for (let i = 0; i < a.length; i++) { + a[i].onclick = function () { + a[i].index = i + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = '' + this.className = 'b_cur' + } + } + if (this.index === 0) { + main[0].className = 'ton' + } else { + main[0].className = '' + } + if (this.index === 1) { + main[1].className = 'ton' + } else { + main[1].className = '' + } + } + } + } + // 首页最新资讯tab切换 + let as = this.element.querySelectorAll('.a') + let ul = this.element.querySelectorAll('.Cont5 ul') + for (let i = 0; i < as.length; i++) { + as[i].onclick = function () { + as[i].index = i + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + siblings[i].className = 'a' + this.className = 'a on' + if (siblings[i].innerText === '') { + siblings[i].className = 'tbg' + } + } + } + if (this.index === 0) { + ul[0].className = 'open' + } else { + ul[0].className = '' + } + if (this.index === 1) { + ul[1].className = 'open' + } else { + ul[1].className = '' + } + if (this.index === 2) { + ul[2].className = 'open' + } else { + ul[2].className = '' + } + } + } + // 资讯详情评论 + let emojiBtn = this.element.querySelectorAll('.cmt-icon-emoji')[0] + let emojiCont = this.element.querySelectorAll('.cmt-emoji-cont')[0] + let bqLis = this.element.querySelectorAll('.cmt-emoji-list li mip-img') + // 显示隐藏表情 + if (!emojiBtn) { + return + } else { + emojiBtn.onclick = function () { + if (emojiCont.className.indexOf('none') > -1) { + emojiCont.classList.remove('none') + } else { + emojiCont.classList.add('none') + } + } + } + let that = this + let bjCont = this.element.querySelectorAll('#cmt-edit-reply')[0] + let submitBtn = this.element.querySelectorAll('.cmt-btn')[0] + // 点击添加表情 + for (let i = 0; i < bqLis.length; i++) { + bqLis[i].onclick = function () { + let src = this.childNodes[0].src + let alt = this.childNodes[0].alt + let str = '' + let content = bjCont.innerHTML.replace('‎', '') + content = content.replace(/]+>/g, '') + bjCont.innerHTML = content + str + '‎' + that.getStatus(bjCont, submitBtn) + } + } + bjCont.onkeyup = function () { + that.getStatus(bjCont, submitBtn) + } + // 页面初次渲染 + // let noData = this.element.querySelectorAll('#no-pl-data')[0] + // that.loadData(function (data) { + // if (data.length === 2) { + // css(noData, {display: 'block'}) + // return false + // } else { + // that.plFun(plMore, data) + // } + // }) + // 点击加载更多评论 + let plMore = this.element.querySelectorAll('#more-comment')[0] + that.commentP = 0 + if (!plMore) { + return false + } else { + plMore.onclick = function () { + that.loadData(function (data) { + if (data === '') { + plMore.innerText = '加载完毕啦,么么哒~' + css(plMore, {cursor: 'default'}) + return false + } else { + that.plFun(plMore, data) + } + }) + } + } + } + // 加载评论 + loadData (callback) { + let that = this + let sId = that.element.querySelectorAll('#SOHUCS')[0].getAttribute('sid') + let formData = new FormData() + formData.append('softid', sId) + formData.append('p', that.commentP) + formData.append('api', 'articleCommentData') + let req = new Request(api.basePJUrl + '/Api.php', { + method: 'POST', + body: formData + }) + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + callback(data) + }) + } + plFun (clickYS, data) { + let plUl = this.element.querySelectorAll('.pl-c .cmt-reply')[0] + let that = this + if (data === '') { + clickYS.innerText = '加载完毕啦,么么哒~' + css(clickYS, {cursor: 'default'}) + return false + } else { + clickYS.innerText = '加载中...' + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] + dt.content = that.emoji(dt.content) + khtml = document.createElement('li') + khtml.innerHTML = '

' + dt.content + '

' + dt.create_time + '
' + plUl.appendChild(khtml) + } + if (len < 20) { + clickYS.innerText = '加载完毕啦,么么哒~' + css(clickYS, {pointerEvents: 'none'}) + } else { + css(clickYS, {display: 'block'}) + css(clickYS, {pointerEvents: 'inherit'}) + } + } + } + // 判断是否有值 + getStatus (cont, btn) { + let content = cont.innerHTML.split(' ').join('').split(' ').join('') + if (content === '') { + btn.setAttribute('disabled', 'disabled') + btn.classList.add('cmt-disabled') + } else { + btn.removeAttribute('disabled') + btn.classList.remove('cmt-disabled') + } + } + emoji (content) { + content = content.replace(/:blush:/g, '') + content = content.replace(/:joy:/g, '') + content = content.replace(/:heart:/g, '') + content = content.replace(/:sob:/g, '') + content = content.replace(/:heart_eyes:/g, '') + content = content.replace(/:kissing_heart:/g, '') + content = content.replace(/:rolling_eyes:/g, '') + content = content.replace(/:skull:/g, '') + content = content.replace(/:tired_face:/g, '') + content = content.replace(/:thinking:/g, '') + return content + } +} diff --git a/sites/m.sys321.com/components/mip-search/README.md b/sites/m.sys321.com/components/mip-search/README.md new file mode 100644 index 000000000..52567ef32 --- /dev/null +++ b/sites/m.sys321.com/components/mip-search/README.md @@ -0,0 +1,31 @@ +# mip-search + +搜一搜网站移动端搜索页面逻辑合集 + +标题|内容 +----|---- +类型| 游戏, 软件搜索列表 +支持布局| fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-search/mip-search.js](https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-search/mip-search.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.sys321.com/components/mip-search/example/index.html b/sites/m.sys321.com/components/mip-search/example/index.html new file mode 100644 index 000000000..6307533db --- /dev/null +++ b/sites/m.sys321.com/components/mip-search/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.sys321.com/components/mip-search/index.less b/sites/m.sys321.com/components/mip-search/index.less new file mode 100644 index 000000000..e69de29bb diff --git a/sites/m.sys321.com/components/mip-search/mip-search.js b/sites/m.sys321.com/components/mip-search/mip-search.js new file mode 100644 index 000000000..e9ef007d5 --- /dev/null +++ b/sites/m.sys321.com/components/mip-search/mip-search.js @@ -0,0 +1,83 @@ +/** + * @file 评论模块 + * @author fl + */ +const { CustomElement, util } = MIP +const { css } = util +export default class MIPMsysComment extends CustomElement { + build () { + let open = this.element.querySelectorAll('#open')[0] + let close = this.element.querySelectorAll('#close')[0] + let menu = this.element.querySelectorAll('#menu')[0] + let shadow = this.element.querySelectorAll('#shadow')[0] + let searchBtn = this.element.querySelectorAll('.search-button')[0] + let searchInp = this.element.querySelectorAll('.so .query')[0] + let alert = this.element.querySelectorAll('.alert')[0] + open.onclick = function () { + css(menu, {left: '0px'}) + css(shadow, {display: 'block'}) + } + close.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + shadow.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + // 点击搜索判断内容是否为空 + let timer = null + if (!searchBtn) { + return + } else { + searchBtn.onclick = function () { + if (searchInp.value.length !== 0) { + css(alert, {display: 'none'}) + location.href = '../../searchResult.html?q=' + searchInp.value + } else { + if (timer != null) { + clearInterval(timer) + } + css(alert, {display: 'block'}) + timer = setInterval(function () { + css(alert, {display: 'none'}) + }, 4000) + } + } + } + // 如果没有查到搜索数据,显示空白样式 + let empty = this.element.querySelectorAll('.search-empty')[0] + let lis = this.element.querySelectorAll('.search-res li') + if (lis.length === 0) { + css(empty, {display: 'block'}) + } else { + css(empty, {display: 'none'}) + } + // tab切换 + let listUl = this.element.querySelectorAll('.search-res') + let listAs = this.element.querySelectorAll('.search-tabs li') + for (let i = 0; i < listAs.length; i++) { + listAs[i].onclick = function () { + listAs[i].index = i + let siblings = this.parentNode.childNodes + for (let i = 0; i < siblings.length; i++) { + if (siblings[i].nodeType === 1) { + console.log(this.children) + siblings[i].className = '' + this.className = 'on' + } + } + if (this.index === 0) { + listUl[0].className = 'open' + } else { + listUl[0].className = '' + } + if (this.index === 1) { + listUl[1].className = 'open' + } else { + listUl[1].className = '' + } + } + } + } +} diff --git a/sites/m.sys321.com/components/mip-xq/README.md b/sites/m.sys321.com/components/mip-xq/README.md new file mode 100644 index 000000000..6976805dc --- /dev/null +++ b/sites/m.sys321.com/components/mip-xq/README.md @@ -0,0 +1,31 @@ +# mip-xq + +搜一搜网站移动端游戏, 软件下载详情页面逻辑合集 + +标题|内容 +----|---- +类型| 游戏, 软件下载 +支持布局| fixed +所需脚本| [https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-xq/mip-xq.js](https://c.mipcdn.com/extensions/platform/v2/m.sys321.com/mip-xq/mip-xq.js) + +## 示例 + +### 基本使用 + +```html + +``` + +## 属性 + +### url + +说明:本站点网址 + +必选项:是 + +类型:字符串 + +取值范围:URL + +默认值:无 \ No newline at end of file diff --git a/sites/m.sys321.com/components/mip-xq/example/index.html b/sites/m.sys321.com/components/mip-xq/example/index.html new file mode 100644 index 000000000..6307533db --- /dev/null +++ b/sites/m.sys321.com/components/mip-xq/example/index.html @@ -0,0 +1,18 @@ + + + + + + MIP page + + + + + + + + + + diff --git a/sites/m.sys321.com/components/mip-xq/index.less b/sites/m.sys321.com/components/mip-xq/index.less new file mode 100644 index 000000000..e69de29bb diff --git a/sites/m.sys321.com/components/mip-xq/mip-xq.js b/sites/m.sys321.com/components/mip-xq/mip-xq.js new file mode 100644 index 000000000..b8e6fa18f --- /dev/null +++ b/sites/m.sys321.com/components/mip-xq/mip-xq.js @@ -0,0 +1,328 @@ +/** + * @file 评论模块 + * @author fl + */ +import api from '../../common/config.api' +const { CustomElement, util } = MIP +const { css } = util +export default class MIPMsysComment extends CustomElement { + build () { + let that = this + let open = this.element.querySelectorAll('#open')[0] + let close = this.element.querySelectorAll('#close')[0] + let menu = this.element.querySelectorAll('#menu')[0] + let shadow = this.element.querySelectorAll('#shadow')[0] + // 显示隐藏左边栏 + open.onclick = function () { + css(menu, {left: '0px'}) + css(shadow, {display: 'block'}) + } + close.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + shadow.onclick = function () { + menu.style.left = '-270px' + css(shadow, {display: 'none'}) + } + let moreBtn = this.element.querySelectorAll('#show-more')[0] + let describe = this.element.querySelectorAll('#describe')[0] + let showMore = this.element.querySelectorAll('.show-more')[0] + // 点击更多按钮 + moreBtn.onclick = function () { + css(describe, { + maxHeight: 'none', + height: 'auto' + }) + css(showMore, {display: 'none'}) + } + let liA = this.element.querySelectorAll('.cmt-tabs li a') + let pjC = this.element.querySelectorAll('.pj-c')[0] + let plC = this.element.querySelectorAll('.pl-c')[0] + // 评论评价切换显示 + for (let i = 0; i < liA.length; i++) { + liA[i].onclick = function () { + for (let j = 0; j < liA.length; j++) { + liA[j].className = '' + } + this.className = 'on' + if (this.innerHTML === '评论') { + css(pjC, {display: 'none'}) + css(plC, {display: 'block'}) + } else { + css(plC, {display: 'none'}) + css(pjC, {display: 'block'}) + } + } + } + // 显示隐藏表情 + let plemojiBtn = this.element.querySelectorAll('.pl-c .cmt-btn-emoji')[0] + let pjemojiBtn = this.element.querySelectorAll('.pj-c .cmt-btn-emoji')[0] + let plemojiCont = this.element.querySelectorAll('.pl-c .cmt-emoji-cont')[0] + let pjemojiCont = this.element.querySelectorAll('.pj-c .cmt-emoji-cont')[0] + that.pjTab(pjemojiBtn, pjemojiCont) + that.pjTab(plemojiBtn, plemojiCont) + // 点击添加表情 + let pjbqLis = this.element.querySelectorAll('.pj-c .cmt-emoji-list li mip-img') + let plbqLis = this.element.querySelectorAll('.pl-c .cmt-emoji-list li mip-img') + let pjbjCont = this.element.querySelectorAll('.pj-c .cmt-edit-reply')[0] + let plbjCont = this.element.querySelectorAll('.pl-c .cmt-edit-reply')[0] + that.addEmoji(pjbqLis, pjbjCont) + that.addEmoji(plbqLis, plbjCont) + // 判断输入框是否有值 + let pjsubmitBtn = this.element.querySelectorAll('.pj-c .cmt-btn')[0] + let plsubmitBtn = this.element.querySelectorAll('.pl-c .cmt-btn')[0] + pjbjCont.onkeyup = function () { + that.getStatus(pjbjCont, pjsubmitBtn) + } + plbjCont.onkeyup = function () { + that.getStatus(plbjCont, plsubmitBtn) + } + // 点亮星星 + let star = this.element.querySelectorAll('.cmt-icon-b-stars i') + for (let i = 0; i < star.length; i++) { + star[i].onclick = function () { + if (this.className !== 'cmt-icon-b-star') { + this.className = 'cmt-icon-b-star' + } else { + this.className = 'cmt-icon-b-star-empty' + } + } + } + // 点击提交评价评论 + let pjP = that.element.querySelectorAll('.pj-c .alert p')[0] + pjsubmitBtn.onclick = function () { + let pjStar = that.element.querySelectorAll('.pj-c .cmt-icon-b-star').length + let pjAlert = that.element.querySelectorAll('.pj-c .alert')[0] + let timer = null + if (timer != null) { + clearInterval(timer) + } + if (pjStar === 0) { + css(pjAlert, {display: 'block'}) + timer = setInterval(function () { + css(pjAlert, {display: 'none'}) + }, 4000) + } else { + that.request('pj', api.basePJUrl + '/Api.php', pjP) + } + } + let plP = that.element.querySelectorAll('.pl-c .alert p')[0] + plsubmitBtn.onclick = function () { + that.request('pl', api.basePJUrl + '/Api.php', plP) + } + // 初次加载评价内容 + let pjMore = this.element.querySelectorAll('#more-score')[0] + // let nopjData = this.element.querySelectorAll('#no-pj-data')[0] + // that.loadData(pjMore, nopjData, 'scoreData', 'pj') + // 加载更多评价 + this.scoreP = 0 + that.loadMore(pjMore, 'scoreData', 'pj') + // 初次加载评价内容 + let plMore = this.element.querySelectorAll('#more-comment')[0] + // let noplData = this.element.querySelectorAll('#no-pj-data')[0] + // that.loadData(plMore, noplData, 'commentData', 'pl') + // 加载更多评论 + this.commentP = 0 + that.loadMore(plMore, 'commentData', 'pl') + } + // 提交评价或评论内容 + request (type, url, p) { + let that = this + let pjCont = that.element.querySelectorAll('.pj-c .cmt-edit-reply')[0].innerText + let plCont = that.element.querySelectorAll('.pl-c .cmt-edit-reply')[0].innerText + let sId = that.element.querySelectorAll('#SOHUCS')[0].getAttribute('sid') + let pjStar = that.element.querySelectorAll('.pj-c .cmt-icon-b-star').length + let pjAlert = that.element.querySelectorAll('.pj-c .alert')[0] + let plAlert = that.element.querySelectorAll('.pl-c .alert')[0] + let formData = new FormData() + formData.append('softid', sId) + formData.append('type', 1) + if (type === 'pj') { + formData.append('comment', pjCont) + formData.append('star_class', pjStar) + formData.append('api', 'scoreSubmit') + } else { + formData.append('comment', plCont) + formData.append('api', 'commentSubmit') + } + let req = new Request(url, { + method: 'POST', + body: formData + }) + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (type === 'pj') { + p.innerText = '您的评价发表成功,需要审核才能显示~' + css(pjAlert, {display: 'block'}) + let timer = null + if (timer != null) { + clearInterval(timer) + } + timer = setInterval(function () { + css(pjAlert, {display: 'none'}) + that.element.querySelectorAll('.pj-c .cmt-edit-reply')[0].innerText = '' + }, 4000) + } else { + css(plAlert, {display: 'block'}) + let timer = null + if (timer != null) { + clearInterval(timer) + } + timer = setInterval(function () { + css(plAlert, {display: 'none'}) + that.element.querySelectorAll('.pl-c .cmt-edit-reply')[0].innerText = '' + }, 4000) + } + }) + } + // 显示隐藏表情 + pjTab (clickYS, contBox) { + clickYS.onclick = function () { + if (contBox.className.indexOf('none') > -1) { + contBox.classList.remove('none') + } else { + contBox.classList.add('none') + } + } + } + // 添加表情 + addEmoji (lis, cont) { + let that = this + let pjbjCont = this.element.querySelectorAll('.pj-c .cmt-edit-reply')[0] + let plbjCont = this.element.querySelectorAll('.pl-c .cmt-edit-reply')[0] + let pjsubmitBtn = this.element.querySelectorAll('.pj-c .cmt-btn')[0] + let plsubmitBtn = this.element.querySelectorAll('.pl-c .cmt-btn')[0] + for (let i = 0; i < lis.length; i++) { + lis[i].onclick = function () { + let src = this.childNodes[0].src + let alt = this.childNodes[0].alt + let str = '' + let content = cont.innerHTML.replace('‎', '') + content = content.replace(/]+>/g, '') + cont.innerHTML = content + str + '‎' + that.getStatus(pjbjCont, pjsubmitBtn) + that.getStatus(plbjCont, plsubmitBtn) + } + } + } + getStatus (bjCont, submitBtn) { + let content = bjCont.innerHTML.split(' ').join('').split(' ').join('') + if (content === '') { + submitBtn.setAttribute('disabled', 'disabled') + submitBtn.classList.add('cmt-disabled') + } else { + submitBtn.removeAttribute('disabled') + submitBtn.classList.remove('cmt-disabled') + } + } + // 页面初次加载评价、评论 + loadData (clickYS, noData, apiV, type) { + let that = this + let sohucs = that.element.querySelectorAll('#SOHUCS')[0] + let sId = sohucs.getAttribute('sid') + let formData = new FormData() + formData.append('softid', sId) + if (type === 'pj') { + formData.append('p', that.scoreP) + formData.append('api', 'scoreData') + } else { + formData.append('p', that.commentP) + formData.append('api', 'commentData') + } + let req = new Request(api.basePJUrl + '/Api.php', { + method: 'POST', + body: formData + }) + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data.length === 2) { + css(noData, {display: 'block'}) + return false + } else { + that.pjFun(clickYS, data, type) + } + }) + } + // 点击加载更多评价、评论 + loadMore (clickYS, apiV, type) { + let that = this + clickYS.onclick = function () { + let sohucs = that.element.querySelectorAll('#SOHUCS')[0] + let sId = sohucs.getAttribute('sid') + let formData = new FormData() + formData.append('softid', sId) + if (type === 'pj') { + formData.append('p', that.scoreP) + } else { + formData.append('p', that.commentP) + } + formData.append('api', apiV) + let req = new Request(api.basePJUrl + '/Api.php', { + method: 'POST', + body: formData + }) + fetch(req).then(function (response) { + return response.json() + }).then(function (data) { + if (data === '') { + clickYS.innerText = '加载完毕啦,么么哒~' + css(clickYS, {cursor: 'default'}) + } else { + that.pjFun(clickYS, data, type) + } + }) + } + } + pjFun (clickYS, data, type) { + let pjUl = this.element.querySelectorAll('.pj-c .cmt-reply')[0] + let plUl = this.element.querySelectorAll('.pl-c .cmt-reply')[0] + if (data === '') { + clickYS.innerText = '加载完毕啦,么么哒~' + css(clickYS, {cursor: 'default'}) + } else { + clickYS.innerText = '加载中...' + let khtml = '' + let len = data.length + for (let i = 0; i < len; i++) { + let dt = data[i] + dt.content = this.emoji(dt.content) + khtml = document.createElement('li') + if (type === 'pj') { + khtml.innerHTML = '

' + dt.content + '

' + dt.create_time + '
' + } else { + khtml.innerHTML = '

' + dt.content + '

' + dt.create_time + '
' + } + } + if (len < 20) { + clickYS.innerText = '加载完毕啦,么么哒~' + css(clickYS, {pointerEvents: 'none'}) + } else { + css(clickYS, {display: 'block'}) + css(clickYS, {pointerEvents: 'inherit'}) + } + if (type === 'pj') { + pjUl.appendChild(khtml) + this.scoreP = this.scoreP + 20 + } else { + plUl.appendChild(khtml) + this.commentP = this.commentP + 20 + } + } + } + emoji (content) { + content = content.replace(/:blush:/g, '') + content = content.replace(/:joy:/g, '') + content = content.replace(/:heart:/g, '') + content = content.replace(/:sob:/g, '') + content = content.replace(/:heart_eyes:/g, '') + content = content.replace(/:kissing_heart:/g, '') + content = content.replace(/:rolling_eyes:/g, '') + content = content.replace(/:skull:/g, '') + content = content.replace(/:tired_face:/g, '') + content = content.replace(/:thinking:/g, '') + return content + } +} diff --git a/sites/m.sys321.com/example/index.html b/sites/m.sys321.com/example/index.html new file mode 100644 index 000000000..a0ad2dec7 --- /dev/null +++ b/sites/m.sys321.com/example/index.html @@ -0,0 +1,26 @@ + + + + + + MIP page + + + + + +
+

First MIP page

+

Add MIP components here

+ +
+ + + + diff --git a/sites/m.sys321.com/mip.config.js b/sites/m.sys321.com/mip.config.js new file mode 100644 index 000000000..d5457bef4 --- /dev/null +++ b/sites/m.sys321.com/mip.config.js @@ -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 + } +} diff --git a/sites/m.sys321.com/package.json b/sites/m.sys321.com/package.json new file mode 100644 index 000000000..8a3423a43 --- /dev/null +++ b/sites/m.sys321.com/package.json @@ -0,0 +1,25 @@ +{ + "name": "m.sys321.com", + "version": "0.0.1", + "description": "A MIP project", + "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": "dyy (772161971@qq.com)", + "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" + } +} diff --git a/sites/m.sys321.com/static/.gitkeep b/sites/m.sys321.com/static/.gitkeep new file mode 100644 index 000000000..e69de29bb