@@ -0,0 +1,21 @@ | |||||
# Logs | |||||
logs | |||||
*.log | |||||
npm-debug.log* | |||||
yarn-debug.log* | |||||
yarn-error.log* | |||||
pnpm-debug.log* | |||||
lerna-debug.log* | |||||
node_modules | |||||
.DS_Store | |||||
dist | |||||
*.local | |||||
# Editor directories and files | |||||
.idea | |||||
*.suo | |||||
*.ntvs* | |||||
*.njsproj | |||||
*.sln | |||||
*.sw? |
@@ -0,0 +1,16 @@ | |||||
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ | |||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 | |||||
"version": "0.0", | |||||
"configurations": [{ | |||||
"app-plus" : | |||||
{ | |||||
"launchtype" : "local" | |||||
}, | |||||
"default" : | |||||
{ | |||||
"launchtype" : "local" | |||||
}, | |||||
"type" : "uniCloud" | |||||
} | |||||
] | |||||
} |
@@ -0,0 +1,20 @@ | |||||
<!DOCTYPE html> | |||||
<html> | |||||
<head> | |||||
<meta charset="UTF-8" /> | |||||
<script> | |||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || | |||||
CSS.supports('top: constant(a)')) | |||||
document.write( | |||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + | |||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') | |||||
</script> | |||||
<title></title> | |||||
<!--preload-links--> | |||||
<!--app-context--> | |||||
</head> | |||||
<body> | |||||
<div id="app"><!--app-html--></div> | |||||
<script type="module" src="/src/main.ts"></script> | |||||
</body> | |||||
</html> |
@@ -0,0 +1,75 @@ | |||||
{ | |||||
"name": "uni-preset-vue", | |||||
"version": "0.0.0", | |||||
"scripts": { | |||||
"dev:app": "uni -p app", | |||||
"dev:app-android": "uni -p app-android", | |||||
"dev:app-ios": "uni -p app-ios", | |||||
"dev:custom": "uni -p", | |||||
"dev:h5": "uni", | |||||
"dev:h5:ssr": "uni --ssr", | |||||
"dev:mp-alipay": "uni -p mp-alipay", | |||||
"dev:mp-baidu": "uni -p mp-baidu", | |||||
"dev:mp-jd": "uni -p mp-jd", | |||||
"dev:mp-kuaishou": "uni -p mp-kuaishou", | |||||
"dev:mp-lark": "uni -p mp-lark", | |||||
"dev:mp-qq": "uni -p mp-qq", | |||||
"dev:mp-toutiao": "uni -p mp-toutiao", | |||||
"dev:mp-weixin": "uni -p mp-weixin", | |||||
"dev:quickapp-webview": "uni -p quickapp-webview", | |||||
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei", | |||||
"dev:quickapp-webview-union": "uni -p quickapp-webview-union", | |||||
"build:app": "uni build -p app", | |||||
"build:app-android": "uni build -p app-android", | |||||
"build:app-ios": "uni build -p app-ios", | |||||
"build:custom": "uni build -p", | |||||
"build:h5": "uni build", | |||||
"build:h5:ssr": "uni build --ssr", | |||||
"build:mp-alipay": "uni build -p mp-alipay", | |||||
"build:mp-baidu": "uni build -p mp-baidu", | |||||
"build:mp-jd": "uni build -p mp-jd", | |||||
"build:mp-kuaishou": "uni build -p mp-kuaishou", | |||||
"build:mp-lark": "uni build -p mp-lark", | |||||
"build:mp-qq": "uni build -p mp-qq", | |||||
"build:mp-toutiao": "uni build -p mp-toutiao", | |||||
"build:mp-weixin": "uni build -p mp-weixin", | |||||
"build:quickapp-webview": "uni build -p quickapp-webview", | |||||
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei", | |||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union", | |||||
"type-check": "vue-tsc --noEmit" | |||||
}, | |||||
"dependencies": { | |||||
"@dcloudio/uni-app": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-app-plus": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-components": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-h5": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-alipay": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-baidu": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-jd": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-lark": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-qq": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-toutiao": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-mp-weixin": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-quickapp-webview": "3.0.0-3081220230817001", | |||||
"dayjs": "^1.10.4", | |||||
"less": "^4.2.0", | |||||
"less-loader": "^11.1.3", | |||||
"mp-html": "^2.4.1", | |||||
"vant": "^4.7.3", | |||||
"vue": "^3.2.45", | |||||
"vue-i18n": "^9.1.9" | |||||
}, | |||||
"devDependencies": { | |||||
"@dcloudio/types": "^3.3.2", | |||||
"@dcloudio/uni-automator": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-cli-shared": "3.0.0-3081220230817001", | |||||
"@dcloudio/uni-stacktracey": "3.0.0-3081220230817001", | |||||
"@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001", | |||||
"@vue/runtime-core": "^3.2.45", | |||||
"@vue/tsconfig": "^0.1.3", | |||||
"typescript": "^4.9.4", | |||||
"vite": "4.1.4", | |||||
"vue-tsc": "^1.0.24" | |||||
} | |||||
} |
@@ -0,0 +1,10 @@ | |||||
/// <reference types='@dcloudio/types' /> | |||||
import 'vue' | |||||
declare module '@vue/runtime-core' { | |||||
type Hooks = App.AppInstance & Page.PageInstance; | |||||
interface ComponentCustomOptions extends Hooks { | |||||
} | |||||
} |
@@ -0,0 +1,17 @@ | |||||
.DS_Store | |||||
node_modules/ | |||||
platforms/ | |||||
dist/ | |||||
npm-debug.log* | |||||
yarn-debug.log* | |||||
yarn-error.log* | |||||
package-lock.json | |||||
unpackage/ | |||||
# Editor directories and files | |||||
.idea | |||||
.vscode | |||||
*.suo | |||||
*.ntvs* | |||||
*.njsproj | |||||
*.sln |
@@ -0,0 +1,42 @@ | |||||
<script> | |||||
import promisifyAll from './lib/wx-promise-pro/index'; | |||||
import config from './config/index'; | |||||
import server from './utils/server'; | |||||
import api from './api/index'; | |||||
import util from './utils/util'; | |||||
import upload from './utils/upload'; | |||||
import './utils/share'; | |||||
// 日志调试模式 | |||||
if (config.debug) { | |||||
// eslint-disable-next-line no-console | |||||
console.log('小程序配置:', config); | |||||
// eslint-disable-next-line no-console | |||||
// console.log('微信全局配置:', __wxConfig); | |||||
} | |||||
// 微信API支持Promise风格 | |||||
promisifyAll(); | |||||
export default { | |||||
globalData:{ | |||||
config, | |||||
env: config.env, | |||||
api, | |||||
util, | |||||
userId: uni.getStorageSync('userInfoData').userId, | |||||
login: server.login, | |||||
register: server.register, | |||||
upload | |||||
}, | |||||
data() { | |||||
return { | |||||
}; | |||||
}, | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
@import 'style/theme.less'; | |||||
@import 'style/normalize.less'; | |||||
@import 'style/public.less'; | |||||
</style> |
@@ -0,0 +1,21 @@ | |||||
/** | |||||
* @name 新闻咨询API | |||||
* @description 请求示例 | |||||
* @param {Object} data 请求参数 | |||||
* @param {String} url 请求地址 | |||||
* @param {String} method 请求类型 可以不设置,默认GET | |||||
*/ | |||||
import request from '../utils/request'; | |||||
/** | |||||
* 获取工作公告列表 | |||||
* @param {*} data | |||||
*/ | |||||
const getNewAPI = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/news/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
export { getNewAPI }; |
@@ -0,0 +1,103 @@ | |||||
/** | |||||
* @name 企业API | |||||
* @description 请求示例 | |||||
* @param {Object} data 请求参数 | |||||
* @param {String} url 请求地址 | |||||
* @param {String} method 请求类型 可以不设置,默认GET | |||||
*/ | |||||
import request from '../utils/request'; | |||||
/** | |||||
* 获得企业分页 | |||||
* @param {*} data | |||||
*/ | |||||
const getEnterpriseListApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/enterprise/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 删除企业 | |||||
* @param {*} data | |||||
*/ | |||||
const DeleteEnterpriseIdApi = function (id) { | |||||
return request({ | |||||
url: `/admin-api/people/enterprise/delete?id=${id}`, | |||||
method: 'delete' | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建企业 | |||||
* @param {*} data | |||||
*/ | |||||
const createAffiliatedEnterprise = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/enterprise/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建诉求 | |||||
* @param {*} data | |||||
*/ | |||||
const createAppealApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/appeal/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得诉求分页 | |||||
* @param {*} data | |||||
*/ | |||||
const getAppealListApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/appeal/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得诉求详情 | |||||
* @param {*} data | |||||
*/ | |||||
const getAppealIdApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/appeal/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得优质回复 | |||||
* @param {*} data | |||||
*/ | |||||
const getPerfectReplyApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/appeal/perfect/reply/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 更新企业 | |||||
* @param {*} data | |||||
*/ | |||||
const getEnterpriseApi = function (id) { | |||||
return request({ | |||||
url: `/admin-api/people/enterprise/get?id=${id}`, | |||||
method: 'get' | |||||
}); | |||||
}; | |||||
export { getEnterpriseListApi, DeleteEnterpriseIdApi, createAffiliatedEnterprise, createAppealApi, getAppealListApi, getAppealIdApi, getPerfectReplyApi, getEnterpriseApi }; |
@@ -0,0 +1,23 @@ | |||||
/** | |||||
* @name API管理 | |||||
* @description 导出所有的API模块 | |||||
**/ | |||||
import * as publicApi from './publicApi.js'; // 公共 API | |||||
import * as consult from './consult'; // 咨询 | |||||
import * as enterprise from './enterprise'; // 企业 | |||||
import * as lifeApi from './lifeApi'; // 生活 | |||||
import * as peopleApi from './peopleApi'; // 民生 | |||||
import * as myApi from './myApi'; // 我的 | |||||
export default { | |||||
data() { | |||||
return {}; | |||||
}, | |||||
consult, | |||||
enterprise, | |||||
publicApi, | |||||
lifeApi, | |||||
peopleApi, | |||||
myApi | |||||
}; |
@@ -0,0 +1,45 @@ | |||||
/** | |||||
* @name 生活API | |||||
* @description 请求示例 | |||||
* @param {Object} data 请求参数 | |||||
* @param {String} url 请求地址 | |||||
* @param {String} method 请求类型 可以不设置,默认GET | |||||
*/ | |||||
import request from '../utils/request'; | |||||
/** | |||||
* 生活对应栏目的分页查询 | |||||
* @param {*} data | |||||
*/ | |||||
const lifeListApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/life/list', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得商户分页 | |||||
* @param {*} data | |||||
*/ | |||||
const merchantPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/merchant/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得商户详情 | |||||
* @param {*} data | |||||
*/ | |||||
const merchantGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/merchant/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
export { lifeListApi, merchantPageApi, merchantGetApi }; |
@@ -0,0 +1,171 @@ | |||||
/** | |||||
* @name 我的 | |||||
* @description 请求示例 | |||||
* @param {Object} data 请求参数 | |||||
* @param {String} url 请求地址 | |||||
* @param {String} method 请求类型 可以不设置,默认GET | |||||
*/ | |||||
import request from '../utils/request'; | |||||
/** | |||||
* 获取工作公告列表 | |||||
* @param {*} data | |||||
*/ | |||||
const nameAuthApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/auth/real/name/auth', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获取我的信息 | |||||
* @param {*} data | |||||
*/ | |||||
const getUserInfoApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/user/profile/get/my/info', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得用户积分规则分页 | |||||
* @param {*} data | |||||
*/ | |||||
const userIntegralRruleApi = function (data) { | |||||
return request( | |||||
{ | |||||
url: '/admin-api/system/user-integral-rule/page', | |||||
method: 'get', | |||||
data: data | |||||
}, | |||||
false | |||||
); | |||||
}; | |||||
/** | |||||
* 获得用户积分明细分页 | |||||
* @param {*} data | |||||
*/ | |||||
const userIntegralDetailApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/user-integral-detail/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得用户我的收藏分页 | |||||
* @param {*} data | |||||
*/ | |||||
const myInfoPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/collection/myInfo/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 统计党员-群众点单数据 | |||||
* @param {*} data | |||||
*/ | |||||
const myMasserCountApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help/count', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 党员认证 | |||||
* @param {*} data | |||||
*/ | |||||
const myMemberAuthApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/auth/party/member/auth', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建群众点单回复 | |||||
* @param {*} data | |||||
*/ | |||||
const replyCreateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help-reply/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得群众点单回复 | |||||
* @param {*} data | |||||
*/ | |||||
const replyCreateGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help-reply/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 更新群众点单回复 | |||||
* @param {*} data | |||||
*/ | |||||
const replyCreatUpdateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help-reply/update', | |||||
method: 'PUT', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 查询优质回复 | |||||
* @param {*} data | |||||
*/ | |||||
const replyGoodPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help-reply/good-page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
// 发送验证码 | |||||
const sendSmSCodeApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/auth/send-sms-code', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
const systemAuthSmsLogin = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/auth/sms-login', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
export { | |||||
nameAuthApi, | |||||
getUserInfoApi, | |||||
userIntegralRruleApi, | |||||
userIntegralDetailApi, | |||||
myInfoPageApi, | |||||
myMasserCountApi, | |||||
myMemberAuthApi, | |||||
replyCreateApi, | |||||
replyCreateGetApi, | |||||
replyCreatUpdateApi, | |||||
replyGoodPageApi, | |||||
sendSmSCodeApi, | |||||
systemAuthSmsLogin | |||||
}; |
@@ -0,0 +1,526 @@ | |||||
/** | |||||
* @name 民生API | |||||
* @description 请求示例 | |||||
* @param {Object} data 请求参数 | |||||
* @param {String} url 请求地址 | |||||
* @param {String} method 请求类型 可以不设置,默认GET | |||||
*/ | |||||
import request from '../utils/request'; | |||||
/** | |||||
* 获得议事厅分页 | |||||
* @param {*} data | |||||
*/ | |||||
const assemblyHallPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/assembly-hall/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得人民调解员分页 | |||||
* @param {*} data | |||||
*/ | |||||
const mediatorPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/mediator/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得人民调解员详情 | |||||
* @param {*} data | |||||
*/ | |||||
const mediatorGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/mediator/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得群众点单分页 | |||||
* @param {*} data | |||||
*/ | |||||
const seekHelpPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建群众点单 | |||||
* @param {*} data | |||||
*/ | |||||
const seekHelpCreateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得群众点单详情 | |||||
* @param {*} data | |||||
*/ | |||||
const seekHelpGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
const massesDetailUpdate = function (data) { | |||||
// 点单状态变化如:接单 | |||||
return request({ | |||||
url: '/admin-api/people/seek-help/update', | |||||
method: 'put', | |||||
data: data | |||||
}); | |||||
}; | |||||
const seekHelpApi = function (data) { | |||||
// 点单 进行帮助 | |||||
return request({ | |||||
url: `/admin-api/people/seek-help/help/${data.id}`, | |||||
method: 'put', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得法律法规分页 | |||||
* @param {*} data | |||||
*/ | |||||
const lawsRegulationPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/laws-regulation/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得法律法规详情 | |||||
* @param {*} data | |||||
*/ | |||||
const lawsRegulationGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/laws-regulation/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得调解案件分页分页 | |||||
* @param {*} data | |||||
*/ | |||||
const casesListApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/cases/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得调解案件 | |||||
* @param {*} data | |||||
*/ | |||||
const getCasesIdApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/cases/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建调解案件 | |||||
* @param {*} data | |||||
*/ | |||||
const createCasesApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/cases/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得党建引领详情 | |||||
* @param {*} data | |||||
*/ | |||||
const newsGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/news/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得医院分页 | |||||
* @param {*} data | |||||
*/ | |||||
const hospitalPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/hospital/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得医院详情 | |||||
* @param {*} data | |||||
*/ | |||||
const hospitalGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/hospital/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得医生分页 | |||||
* @param {*} data | |||||
*/ | |||||
const doctorPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/doctor/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得议事厅分页 | |||||
* @param {*} data | |||||
*/ | |||||
const assemblyIdApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/assemblymen/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得议事厅分页 | |||||
* @param {*} data | |||||
*/ | |||||
const assemblyhallIdApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/assembly-hall/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得评论分页 | |||||
* @param {*} data | |||||
*/ | |||||
const commentPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/comment/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建评论 | |||||
* @param {*} data | |||||
*/ | |||||
const commentCreateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/comment/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得议事厅详情 | |||||
* @param {*} data | |||||
*/ | |||||
const assemblyHallGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/assembly-hall/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 星级党支部 | |||||
* @param {*} data | |||||
*/ | |||||
const partyBranchApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/party-branch/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得党建引领 - 获得新闻资讯及活动分页 | |||||
* @param {*} data | |||||
* @param {*} data.categoryId // 取字典新闻类型的键值 | |||||
*/ | |||||
const newsPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/news/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 星级党支部详情 | |||||
* @param {*} data | |||||
*/ | |||||
const partyBranchGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/party-branch/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得优秀党员分页 - 五星党员 | |||||
* @param {*} data | |||||
*/ | |||||
const excellentPartMemberPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/excellent-party-member/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获取部门列表 | |||||
* @param {*} data | |||||
*/ | |||||
const deptListApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/dept/list', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得优秀党员详情 | |||||
* @param {*} data | |||||
*/ | |||||
const excellentPartMemberGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/excellent-party-member/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得办事处分页 - 最美乡村 | |||||
* @param {*} data | |||||
*/ | |||||
const agencyPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/agency/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得村务公开分页 | |||||
* @param {*} data | |||||
*/ | |||||
const villageAffairsPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/village-affairs/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得办事处分页 | |||||
* @param {*} data | |||||
*/ | |||||
const agencyContentPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/agency-content/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得群众点单评论 | |||||
* @param {*} data | |||||
*/ | |||||
const CrateAppraiseApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/seek-help/appraise', | |||||
method: 'put', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得办事处内容详情 | |||||
* @param {*} data | |||||
*/ | |||||
const agencyContentGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/agency-content/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得办事处分页详情 | |||||
* @param {*} data | |||||
*/ | |||||
const agencyGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/agency/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得办事处内容 + 根据部门id | |||||
* @param {*} data | |||||
*/ | |||||
const agencyContentGetOrgIdApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/agency-content/getOrgId', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得办事处内容 + 根据部门id | |||||
* @param {*} data | |||||
*/ | |||||
const villageAffairsGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/village-affairs/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得党活动事件分页 | |||||
* @param {*} data | |||||
*/ | |||||
const partyEventPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/party-event/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得党活动事件分页详情 | |||||
* @param {*} data | |||||
*/ | |||||
const partyEventGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/party-event/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建患者 - 申请签约家庭医生 | |||||
* @param {*} data | |||||
*/ | |||||
const patientCreateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/patient/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获取网格列表 | |||||
* @param {*} data | |||||
*/ | |||||
const getGridListApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/grid/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获取网格成员列表 | |||||
* @param {*} data | |||||
*/ | |||||
const getGridMemberListApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/grid-member/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
export { | |||||
assemblyHallPageApi, | |||||
mediatorPageApi, | |||||
mediatorGetApi, | |||||
seekHelpPageApi, | |||||
seekHelpCreateApi, | |||||
seekHelpGetApi, | |||||
lawsRegulationPageApi, | |||||
lawsRegulationGetApi, | |||||
massesDetailUpdate, | |||||
seekHelpApi, | |||||
casesListApi, | |||||
getCasesIdApi, | |||||
createCasesApi, | |||||
newsGetApi, | |||||
hospitalPageApi, | |||||
hospitalGetApi, | |||||
doctorPageApi, | |||||
commentPageApi, | |||||
commentCreateApi, | |||||
assemblyHallGetApi, | |||||
newsPageApi, | |||||
assemblyIdApi, | |||||
assemblyhallIdApi, | |||||
partyBranchApi, | |||||
partyBranchGetApi, | |||||
excellentPartMemberPageApi, | |||||
deptListApi, | |||||
excellentPartMemberGetApi, | |||||
agencyPageApi, | |||||
villageAffairsPageApi, | |||||
agencyContentPageApi, | |||||
CrateAppraiseApi, | |||||
agencyContentGetApi, | |||||
agencyGetApi, | |||||
agencyContentGetOrgIdApi, | |||||
villageAffairsGetApi, | |||||
partyEventPageApi, | |||||
partyEventGetApi, | |||||
patientCreateApi, | |||||
getGridListApi, | |||||
getGridMemberListApi | |||||
}; |
@@ -0,0 +1,209 @@ | |||||
/** | |||||
* @name 公共接口API | |||||
* @description 请求示例 | |||||
* @param {Object} data 请求参数 | |||||
* @param {String} url 请求地址 | |||||
* @param {String} method 请求类型 可以不设置,默认GET | |||||
*/ | |||||
import request from '../utils/request'; | |||||
/** | |||||
* 获得banner图分页 | |||||
* @param {*} data | |||||
*/ | |||||
const getBannerApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/banner/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得字典类型的分页列表 | |||||
* @param {*} data | |||||
*/ | |||||
const getDictDataApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/dict-data/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 上传文件 | |||||
* @param {*} data | |||||
*/ | |||||
const uploadApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/infra/file/upload', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 分类树--查询下级分类 | |||||
* @param {*} data | |||||
* @param {*} data.bannerType // 字典TabBar模块 1民生、2生活... | |||||
* @param {*} data.parentId // 根据上级列表id查询下级列表 | |||||
*/ | |||||
const recursionApi = function (data) { | |||||
return request( | |||||
{ | |||||
url: '/admin-api/people/category/recursion', | |||||
method: 'get', | |||||
data: data | |||||
}, | |||||
false | |||||
); | |||||
}; | |||||
/** | |||||
* 创建点赞 | |||||
* @param {*} data | |||||
*/ | |||||
const praiseCreateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/praise/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 取消点赞 | |||||
* @param {*} data | |||||
*/ | |||||
const praiseCancelApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/praise/cancel', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建分享 | |||||
* @param {*} data | |||||
*/ | |||||
const shareCreateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/share/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 创建用户收藏 | |||||
* @param {*} data | |||||
*/ | |||||
const collectionCreateApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/collection/create', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 取消用户收藏 | |||||
* @param {*} data | |||||
*/ | |||||
const collectionCancelApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/collection/cancel', | |||||
method: 'post', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得案件处理过程分页 | |||||
* @param {*} data | |||||
*/ | |||||
const casesProcessPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/cases-process/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获取部门树 | |||||
* @param {*} data | |||||
*/ | |||||
const deptTreeApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/system/dept/tree', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得服务记录详情 | |||||
* @param {*} data | |||||
*/ | |||||
const serveRecordGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/serve-record/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得服务记录分页 | |||||
* @param {*} data | |||||
*/ | |||||
const serveRecordPageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/serve-record/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得线上问诊分页 | |||||
* @param {*} data | |||||
*/ | |||||
const inquiriesOnlinePageApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/inquiries-online/page', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
/** | |||||
* 获得线上问诊详情 | |||||
* @param {*} data | |||||
*/ | |||||
const inquiriesOnlineGetApi = function (data) { | |||||
return request({ | |||||
url: '/admin-api/people/inquiries-online/get', | |||||
method: 'get', | |||||
data: data | |||||
}); | |||||
}; | |||||
export { | |||||
getBannerApi, | |||||
getDictDataApi, | |||||
uploadApi, | |||||
recursionApi, | |||||
praiseCreateApi, | |||||
praiseCancelApi, | |||||
shareCreateApi, | |||||
collectionCreateApi, | |||||
collectionCancelApi, | |||||
casesProcessPageApi, | |||||
deptTreeApi, | |||||
serveRecordGetApi, | |||||
serveRecordPageApi, | |||||
inquiriesOnlineGetApi, | |||||
inquiriesOnlinePageApi | |||||
}; |
@@ -0,0 +1,160 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<view v-if="position === 'fixed'" :style="'height: calc(46px + 17rpx);'" /> | |||||
<view | |||||
:class="'custom-nav-bar ' + (position === 'fixed' ? 'custom-nav-bar__fixed' : '') + ' ' + (position === 'absolute' ? 'custom-nav-bar__absolute' : '')" | |||||
:style=" | |||||
'padding-top:0px;line-height:20px;z-index: ' + | |||||
zIndex + | |||||
';background-color: ' + | |||||
(color === 'white' ? 'transparent' : '#ffffff') + | |||||
';height:calc(46px + 17rpx);' | |||||
"> | |||||
<view :class="'custom-nav-bar-content__content ' + (border ? 'custom-nav-bar__border-bottom' : '')"> | |||||
<view class="custom-nav-bar-content__left" @click="onClickLeft"> | |||||
<block v-if="leftArrow || leftText"> | |||||
<image v-if="leftArrow" class="custom-nav-bar-content__img" | |||||
:src="color === 'white' ? '/static/images/ic-arrow-white.png' : '/static/images/ic-arrow-black.png'"> | |||||
</image> | |||||
<view v-if="leftText" | |||||
:style="'color: ' + (color === 'white' ? '#FFFFFF' : color === 'black' ? '#333333' : color) + ';'" | |||||
class="custom-nav-bar-content__text"> | |||||
{{ leftText }} | |||||
</view> | |||||
</block> | |||||
<slot v-else name="left" /> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
// import vanIcon from '@vant/weapp/icon/index'; | |||||
// const app = getApp(); | |||||
export default { | |||||
components: { | |||||
// vanIcon | |||||
}, | |||||
data() { | |||||
return { | |||||
// sysConfig: app.globalData.config, | |||||
height: 46, | |||||
top: 0 | |||||
}; | |||||
}, | |||||
props: { | |||||
leftText: { | |||||
type: String, | |||||
default: '' | |||||
}, | |||||
position: { | |||||
type: String, | |||||
default: 'absolute' | |||||
}, | |||||
leftArrow: { | |||||
type: Boolean, | |||||
default: false | |||||
}, | |||||
zIndex: { | |||||
type: Number, | |||||
default: 99 | |||||
}, | |||||
color: { | |||||
type: String, | |||||
default: 'white' | |||||
}, | |||||
border: { | |||||
type: Boolean, | |||||
default: false | |||||
}, | |||||
back: { | |||||
type: Boolean, | |||||
default: false | |||||
} | |||||
}, | |||||
options: { | |||||
virtualHost: true | |||||
}, | |||||
methods: { | |||||
onClickLeft: function() { | |||||
if (this.leftArrow && !this.back) { | |||||
uni.navigateBack({ | |||||
delta: 1 | |||||
}); | |||||
return; | |||||
} | |||||
this.$emit('customClickLeft'); | |||||
} | |||||
}, | |||||
created: function() {} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
.custom-nav-bar { | |||||
width: 100%; | |||||
height: var(--custom-nav-bar-height, 68rpx); | |||||
height: 46px; | |||||
background-color: var(--custom-nav-bar-background-color, #fff); | |||||
box-sizing: initial; | |||||
position: relative; | |||||
text-align: center; | |||||
-webkit-user-select: none; | |||||
user-select: none; | |||||
} | |||||
.custom-nav-bar__fixed { | |||||
position: fixed; | |||||
top: 0; | |||||
left: 0; | |||||
} | |||||
.custom-nav-bar__absolute { | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
} | |||||
.custom-nav-bar-content__content { | |||||
position: relative; | |||||
height: 100%; | |||||
padding: 0 40rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
} | |||||
.custom-nav-bar__border-bottom::before { | |||||
content: ''; | |||||
position: absolute; | |||||
bottom: 0; | |||||
left: 50%; | |||||
width: var(--custom-nav-bar-bor-bottom-w, 670rpx); | |||||
height: 1px; | |||||
transform: translateX(-50%); | |||||
background-color: #efefef; | |||||
} | |||||
.custom-nav-bar-content__left { | |||||
height: 100%; | |||||
display: flex; | |||||
align-items: center; | |||||
// position: absolute; | |||||
// top: 0; | |||||
// left: 44rpx; | |||||
} | |||||
.custom-nav-bar-content__img { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
margin-bottom: 1px; | |||||
margin-right: 18rpx; | |||||
} | |||||
.custom-nav-bar-content__text { | |||||
font-size: 34rpx; | |||||
font-weight: 500; | |||||
color: #333333; | |||||
line-height: 34rpx; | |||||
} | |||||
</style> |
@@ -0,0 +1,50 @@ | |||||
/** | |||||
* @name 常量 | |||||
* @description 多环境配置 | |||||
* @param {Boolean} debug 是否开启debug模式 | |||||
* @param {Object} env 当前的项目环境配置 | |||||
* @param {Object} systemInfo 当前的系统信息 | |||||
* @param {Boolean} isIPhone 判断机型是否是iPhone | |||||
* @param {Boolean} isIPhoneX 判断机型是否是iPhoneX系列 | |||||
* @param {Boolean} menu 小程序顶部胶囊按钮的信息 | |||||
* @param {Object} locationInfo 用户的当前位置信息 | |||||
*/ | |||||
import env from './env'; | |||||
import amap from "@/lib/wx-map-sdk/amap-wx.130.js"; | |||||
function getLocationInfo() { | |||||
const info = {}; | |||||
uni.getLocation(function(res) { | |||||
console.log('纬度:' + res.latitude); | |||||
console.log('经度:' + res.longitude); | |||||
}); | |||||
const myAmapFun = new amap.AMapWX({ | |||||
key: env.aMapKey | |||||
}); | |||||
myAmapFun.getRegeo({ | |||||
success: function (res) { | |||||
if (!res.length) { | |||||
return; | |||||
} | |||||
Object.assign(info, res[0]); | |||||
}, | |||||
fail: function (info) { | |||||
uni.showModal({ | |||||
title: info.errMsg | |||||
}); | |||||
} | |||||
}); | |||||
return info; | |||||
} | |||||
export default { | |||||
data() { | |||||
return {}; | |||||
}, | |||||
debug: true, | |||||
env, | |||||
systemInfo: uni.getSystemInfoSync(), | |||||
menu: uni.getSystemInfoSync(), | |||||
isIPhone: uni.getSystemInfoSync().model.indexOf('iPhone') >= 0, | |||||
isIPhoneX: uni.getSystemInfoSync().model.lastIndexOf('X') >= 0, | |||||
locationInfo: getLocationInfo() | |||||
}; |
@@ -0,0 +1,35 @@ | |||||
/** | |||||
* @name 小程序环境 | |||||
* @description 多环境配置 | |||||
*/ | |||||
const envName = 'development'; | |||||
const envs = [{ | |||||
envName: 'production', | |||||
appID: 'wx736395182f05a1b7', | |||||
appName: '介休网格通', | |||||
version: '1.0.0', | |||||
baseUrl: 'https://jxwgtjm.xuqidata.com:8088', | |||||
fileUrl: 'https://jiexiu.xuqidata.com:8083/jiexiujumin', | |||||
loginPath: '/admin-api/system/auth/wechat/app/login', | |||||
aMapKey: '29103dae675e5788eb011fb77ade8e3f', | |||||
pubkey: 'Si9veMEER0LGTcLL6xwRWxUB7UCF7jjb00548e0ddc1501de0f' | |||||
}, | |||||
{ | |||||
envName: 'development', | |||||
appID: 'wxcee598c3eb71e48d', | |||||
appName: '智慧旭奇', | |||||
version: '1.0.0', | |||||
baseUrl: 'http://47.92.245.35:5002', | |||||
// 接口前缀 | |||||
fileUrl: 'http://47.92.245.35:5009/xq-ssg', | |||||
// 图片服务器 | |||||
loginPath: '/admin-api/system/auth/wechat/app/login', | |||||
// 登陆接口 | |||||
aMapKey: '6e488a3ed079adbb01de2ecb88ca5905', | |||||
// 高德地图key | |||||
pubkey: 'O9eM4Cv5bpi30mgUw9GEkf19KVE8KE8D00a46a6e50bb9465b2' // 吾来对话机器人平台key | |||||
} | |||||
]; | |||||
const isFind = envs.find((item) => item.envName === envName); | |||||
export default isFind; |
@@ -0,0 +1,13 @@ | |||||
/** | |||||
* @name Config | |||||
* @description 项目配置 | |||||
*/ | |||||
import env from './env'; | |||||
import constant from './constant'; | |||||
export default { | |||||
data() { | |||||
return {}; | |||||
}, | |||||
env, | |||||
...constant | |||||
}; |
@@ -0,0 +1,8 @@ | |||||
/// <reference types="vite/client" /> | |||||
declare module '*.vue' { | |||||
import { DefineComponent } from 'vue' | |||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types | |||||
const component: DefineComponent<{}, {}, any> | |||||
export default component | |||||
} |
@@ -0,0 +1,573 @@ | |||||
<template> | |||||
<view | |||||
:class="'wux-class ' + wrapCls + ' ' + animateCss" | |||||
@tap="onTap" | |||||
@touchmove.stop.prevent="parseEventDynamicCode($event, disableScroll ? 'noop' : '')" | |||||
@transitionend="onTransitionEnd" | |||||
@animationend="onAnimationEnd" | |||||
v-if="animateStatus !== 'unmounted'" | |||||
:style="extStyle" | |||||
> | |||||
<slot></slot> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
'use strict'; | |||||
var _baseComponent = _interopRequireDefault(require('../helpers/baseComponent')); | |||||
var _styleToCssString = _interopRequireDefault(require('../helpers/styleToCssString')); | |||||
function _interopRequireDefault(t) { | |||||
return t && t.__esModule | |||||
? t | |||||
: { | |||||
default: t | |||||
}; | |||||
} | |||||
function _typeof(t) { | |||||
return (_typeof = | |||||
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator | |||||
? function (t) { | |||||
return typeof t; | |||||
} | |||||
: function (t) { | |||||
return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? 'symbol' : typeof t; | |||||
})(t); | |||||
} | |||||
var ENTER = 'enter'; | |||||
var ENTERING = 'entering'; | |||||
var ENTERED = 'entered'; | |||||
var EXIT = 'exit'; | |||||
var EXITING = 'exiting'; | |||||
var EXITED = 'exited'; | |||||
var UNMOUNTED = 'unmounted'; | |||||
var TRANSITION = 'transition'; | |||||
var ANIMATION = 'animation'; | |||||
var TIMEOUT = 16.666666666666668; | |||||
var defaultClassNames = { | |||||
enter: '', | |||||
enterActive: '', | |||||
enterDone: '', | |||||
exit: '', | |||||
exitActive: '', | |||||
exitDone: '' | |||||
}; | |||||
(0, _baseComponent.default)({ | |||||
properties: { | |||||
in: { | |||||
type: Boolean, | |||||
value: false, | |||||
observer: function (t) { | |||||
if (this.isMounting) { | |||||
this.updated(t); | |||||
} | |||||
} | |||||
}, | |||||
classNames: { | |||||
type: null, | |||||
value: defaultClassNames | |||||
}, | |||||
duration: { | |||||
type: null, | |||||
value: null | |||||
}, | |||||
type: { | |||||
type: String, | |||||
value: TRANSITION | |||||
}, | |||||
appear: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
enter: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
exit: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
mountOnEnter: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
unmountOnExit: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
wrapCls: { | |||||
type: String, | |||||
value: '' | |||||
}, | |||||
wrapStyle: { | |||||
type: [String, Object], | |||||
value: '', | |||||
observer: function (t) { | |||||
this.setData({ | |||||
extStyle: (0, _styleToCssString.default)(t) | |||||
}); | |||||
} | |||||
}, | |||||
disableScroll: { | |||||
type: Boolean, | |||||
value: false | |||||
} | |||||
}, | |||||
data: { | |||||
animateCss: '', | |||||
animateStatus: EXITED, | |||||
isMounting: false, | |||||
extStyle: '' | |||||
}, | |||||
methods: { | |||||
addEventListener: function () { | |||||
var t = this.animateStatus; | |||||
var e = this.getTimeouts(); | |||||
var a = e.enter; | |||||
var n = e.exit; | |||||
if (t === ENTERING && !a && this.enter) { | |||||
this.performEntered(); | |||||
} | |||||
if (t === EXITING && !n && this.exit) { | |||||
this.performExited(); | |||||
} | |||||
}, | |||||
onTransitionEnd: function () { | |||||
if (this.type === TRANSITION) { | |||||
this.addEventListener(); | |||||
} | |||||
}, | |||||
onAnimationEnd: function () { | |||||
if (this.type === ANIMATION) { | |||||
this.addEventListener(); | |||||
} | |||||
}, | |||||
updateStatus: function (t, e) { | |||||
var a = 1 < arguments.length && void 0 !== e && e; | |||||
if (null !== t) { | |||||
this.cancelNextCallback(); | |||||
this.isAppearing = a; | |||||
t === ENTERING ? this.performEnter() : this.performExit(); | |||||
} | |||||
}, | |||||
performEnter: function () { | |||||
var that = this; | |||||
var e = this.getClassNames(ENTER); | |||||
var a = e.className; | |||||
var n = e.activeClassName; | |||||
var i = this.getTimeouts().enter; | |||||
var s = { | |||||
animateStatus: ENTER, | |||||
animateCss: a | |||||
}; | |||||
var r = { | |||||
animateStatus: ENTERING, | |||||
animateCss: ''.concat(a, ' ').concat(n) | |||||
}; | |||||
if (!this.isAppearing && !this.enter) { | |||||
return this.performEntered(); | |||||
} | |||||
this.safeSetData(s, function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: ENTER | |||||
} | |||||
}); | |||||
that.$emit(ENTER, { | |||||
detail: { | |||||
isAppearing: that.isAppearing | |||||
} | |||||
}); | |||||
that.delayHandler(TIMEOUT, function () { | |||||
that.safeSetData(r, function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: ENTERING | |||||
} | |||||
}); | |||||
that.$emit(ENTERING, { | |||||
detail: { | |||||
isAppearing: that.isAppearing | |||||
} | |||||
}); | |||||
if (i) { | |||||
that.delayHandler(i, that.performEntered); | |||||
} | |||||
}); | |||||
}); | |||||
}); | |||||
}, | |||||
performEntered: function () { | |||||
var that = this; | |||||
var e = this.getClassNames(ENTER).doneClassName; | |||||
var a = { | |||||
animateStatus: ENTERED, | |||||
animateCss: e | |||||
}; | |||||
this.safeSetData(a, function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: ENTERED | |||||
} | |||||
}); | |||||
that.$emit(ENTERED, { | |||||
detail: { | |||||
isAppearing: that.isAppearing | |||||
} | |||||
}); | |||||
}); | |||||
}, | |||||
performExit: function () { | |||||
var that = this; | |||||
var e = this.getClassNames(EXIT); | |||||
var a = e.className; | |||||
var n = e.activeClassName; | |||||
var i = this.getTimeouts().exit; | |||||
var s = { | |||||
animateStatus: EXIT, | |||||
animateCss: a | |||||
}; | |||||
var r = { | |||||
animateStatus: EXITING, | |||||
animateCss: ''.concat(a, ' ').concat(n) | |||||
}; | |||||
if (!this.exit) { | |||||
return this.performExited(); | |||||
} | |||||
this.safeSetData(s, function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: EXIT | |||||
} | |||||
}); | |||||
that.$emit(EXIT); | |||||
that.delayHandler(TIMEOUT, function () { | |||||
that.safeSetData(r, function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: EXITING | |||||
} | |||||
}); | |||||
that.$emit(EXITING); | |||||
if (i) { | |||||
that.delayHandler(i, that.performExited); | |||||
} | |||||
}); | |||||
}); | |||||
}); | |||||
}, | |||||
performExited: function () { | |||||
var that = this; | |||||
var e = this.getClassNames(EXIT).doneClassName; | |||||
var a = { | |||||
animateStatus: EXITED, | |||||
animateCss: e | |||||
}; | |||||
this.safeSetData(a, function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: EXITED | |||||
} | |||||
}); | |||||
that.$emit(EXITED); | |||||
if (that.unmountOnExit) { | |||||
that.setData( | |||||
{ | |||||
animateStatus: UNMOUNTED | |||||
}, | |||||
function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: UNMOUNTED | |||||
} | |||||
}); | |||||
} | |||||
); | |||||
} | |||||
}); | |||||
}, | |||||
getClassNames: function (t) { | |||||
var e = this.classNames; | |||||
return { | |||||
className: 'string' != typeof e ? e[t] : ''.concat(e, '-').concat(t), | |||||
activeClassName: 'string' != typeof e ? e[''.concat(t, 'Active')] : ''.concat(e, '-').concat(t, '-active'), | |||||
doneClassName: 'string' != typeof e ? e[''.concat(t, 'Done')] : ''.concat(e, '-').concat(t, '-done') | |||||
}; | |||||
}, | |||||
getTimeouts: function () { | |||||
var t = this.duration; | |||||
return null !== t && 'object' === _typeof(t) | |||||
? { | |||||
enter: t.enter, | |||||
exit: t.exit | |||||
} | |||||
: 'number' == typeof t | |||||
? { | |||||
enter: t, | |||||
exit: t | |||||
} | |||||
: {}; | |||||
}, | |||||
updated: function (t) { | |||||
var that = this; | |||||
var a = (this.pendingData || this).animateStatus; | |||||
var n = null; | |||||
t | |||||
? (a === UNMOUNTED && | |||||
((a = EXITED), | |||||
this.setData( | |||||
{ | |||||
animateStatus: EXITED | |||||
}, | |||||
function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: EXITED | |||||
} | |||||
}); | |||||
} | |||||
)), | |||||
a !== ENTER && a !== ENTERING && a !== ENTERED && (n = ENTERING)) | |||||
: (a !== ENTER && a !== ENTERING && a !== ENTERED) || (n = EXITING); | |||||
this.updateStatus(n); | |||||
}, | |||||
delayHandler: function (t, e) { | |||||
if (t) { | |||||
this.setNextCallback(e); | |||||
setTimeout(this.nextCallback, t); | |||||
} | |||||
}, | |||||
onTap: function () { | |||||
this.$emit('click'); | |||||
}, | |||||
noop: function () {} | |||||
}, | |||||
attached: function () { | |||||
var that = this; | |||||
var e = null; | |||||
var a = null; | |||||
this.in ? (this.appear ? ((e = EXITED), (a = ENTERING)) : (e = ENTERED)) : (e = this.unmountOnExit || this.mountOnEnter ? UNMOUNTED : EXITED); | |||||
this.safeSetData( | |||||
{ | |||||
animateStatus: e, | |||||
isMounting: true | |||||
}, | |||||
function () { | |||||
that.$emit('change', { | |||||
detail: { | |||||
animateStatus: e | |||||
} | |||||
}); | |||||
that.updateStatus(a, true); | |||||
} | |||||
); | |||||
} | |||||
}); | |||||
</script> | |||||
<style> | |||||
.wux-animate--fadeIn-enter { | |||||
transition: opacity 0.3s; | |||||
opacity: 0; | |||||
} | |||||
.wux-animate--fadeIn-enter-active, | |||||
.wux-animate--fadeIn-enter-done { | |||||
opacity: 1; | |||||
} | |||||
.wux-animate--fadeIn-exit { | |||||
transition: opacity 0.3s; | |||||
opacity: 1; | |||||
} | |||||
.wux-animate--fadeIn-exit-active, | |||||
.wux-animate--fadeIn-exit-done { | |||||
opacity: 0; | |||||
} | |||||
.wux-animate--fadeInDown-enter { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 0; | |||||
transform: translate3d(0, -100%, 0); | |||||
} | |||||
.wux-animate--fadeInDown-enter-active, | |||||
.wux-animate--fadeInDown-enter-done { | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInDown-exit { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInDown-exit-active, | |||||
.wux-animate--fadeInDown-exit-done { | |||||
opacity: 0; | |||||
transform: translate3d(0, -100%, 0); | |||||
} | |||||
.wux-animate--fadeInLeft-enter { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 0; | |||||
transform: translate3d(-100%, 0, 0); | |||||
} | |||||
.wux-animate--fadeInLeft-enter-active, | |||||
.wux-animate--fadeInLeft-enter-done { | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInLeft-exit { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInLeft-exit-active, | |||||
.wux-animate--fadeInLeft-exit-done { | |||||
opacity: 0; | |||||
transform: translate3d(-100%, 0, 0); | |||||
} | |||||
.wux-animate--fadeInRight-enter { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 0; | |||||
transform: translate3d(100%, 0, 0); | |||||
} | |||||
.wux-animate--fadeInRight-enter-active, | |||||
.wux-animate--fadeInRight-enter-done { | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInRight-exit { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInRight-exit-active, | |||||
.wux-animate--fadeInRight-exit-done { | |||||
opacity: 0; | |||||
transform: translate3d(100%, 0, 0); | |||||
} | |||||
.wux-animate--fadeInUp-enter { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 0; | |||||
transform: translate3d(0, 100%, 0); | |||||
} | |||||
.wux-animate--fadeInUp-enter-active, | |||||
.wux-animate--fadeInUp-enter-done { | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInUp-exit { | |||||
transition: opacity 0.3s, transform 0.3s; | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--fadeInUp-exit-active, | |||||
.wux-animate--fadeInUp-exit-done { | |||||
opacity: 0; | |||||
transform: translate3d(0, 100%, 0); | |||||
} | |||||
.wux-animate--slideInUp-enter { | |||||
transition: transform 0.3s; | |||||
transform: translate3d(0, 100%, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--slideInUp-enter-active, | |||||
.wux-animate--slideInUp-enter-done { | |||||
transform: translateZ(0); | |||||
} | |||||
.wux-animate--slideInUp-exit { | |||||
transition: transform 0.3s; | |||||
transform: translateZ(0); | |||||
} | |||||
.wux-animate--slideInUp-exit-active, | |||||
.wux-animate--slideInUp-exit-done { | |||||
transform: translate3d(0, 100%, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--slideInDown-enter { | |||||
transition: transform 0.3s; | |||||
transform: translate3d(0, -100%, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--slideInDown-enter-active, | |||||
.wux-animate--slideInDown-enter-done { | |||||
transform: translateZ(0); | |||||
} | |||||
.wux-animate--slideInDown-exit { | |||||
transition: transform 0.3s; | |||||
transform: translateZ(0); | |||||
} | |||||
.wux-animate--slideInDown-exit-active, | |||||
.wux-animate--slideInDown-exit-done { | |||||
transform: translate3d(0, -100%, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--slideInLeft-enter { | |||||
transition: transform 0.3s; | |||||
transform: translate3d(-100%, 0, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--slideInLeft-enter-active, | |||||
.wux-animate--slideInLeft-enter-done { | |||||
transform: translateZ(0); | |||||
} | |||||
.wux-animate--slideInLeft-exit { | |||||
transition: transform 0.3s; | |||||
transform: translateZ(0); | |||||
} | |||||
.wux-animate--slideInLeft-exit-active, | |||||
.wux-animate--slideInLeft-exit-done { | |||||
transform: translate3d(-100%, 0, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--slideInRight-enter { | |||||
transition: transform 0.3s; | |||||
transform: translate3d(100%, 0, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--slideInRight-enter-active, | |||||
.wux-animate--slideInRight-enter-done { | |||||
transform: none; | |||||
} | |||||
.wux-animate--slideInRight-exit { | |||||
transition: transform 0.3s; | |||||
transform: none; | |||||
} | |||||
.wux-animate--slideInRight-exit-active, | |||||
.wux-animate--slideInRight-exit-done { | |||||
transform: translate3d(100%, 0, 0); | |||||
visibility: visible; | |||||
} | |||||
.wux-animate--zoom-enter { | |||||
transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1); | |||||
opacity: 0.01; | |||||
transform: scale(0.75); | |||||
} | |||||
.wux-animate--zoom-enter-active, | |||||
.wux-animate--zoom-enter-done { | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--zoom-exit { | |||||
transition: all 0.25s linear; | |||||
transform: none; | |||||
} | |||||
.wux-animate--zoom-exit-active, | |||||
.wux-animate--zoom-exit-done { | |||||
opacity: 0.01; | |||||
transform: scale(0.75); | |||||
} | |||||
.wux-animate--punch-enter { | |||||
transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1); | |||||
opacity: 0.01; | |||||
transform: scale(1.35); | |||||
} | |||||
.wux-animate--punch-enter-active, | |||||
.wux-animate--punch-enter-done { | |||||
opacity: 1; | |||||
transform: none; | |||||
} | |||||
.wux-animate--punch-exit { | |||||
transition: all 0.25s linear; | |||||
transform: none; | |||||
} | |||||
.wux-animate--punch-exit-active, | |||||
.wux-animate--punch-exit-done { | |||||
opacity: 0.01; | |||||
transform: scale(1.35); | |||||
} | |||||
</style> |
@@ -0,0 +1,87 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<wux-animation-group :wux-class="classes.wrap" :in="in" :classNames="classNames" @click="onClick" :wrapStyle="" disableScroll /> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
'use strict'; | |||||
import wuxAnimationGroup from '../animation-group/index'; | |||||
var _baseComponent = _interopRequireDefault(require('../helpers/baseComponent')); | |||||
function _interopRequireDefault(e) { | |||||
return e && e.__esModule | |||||
? e | |||||
: { | |||||
default: e | |||||
}; | |||||
} | |||||
(0, _baseComponent.default)({ | |||||
properties: { | |||||
prefixCls: { | |||||
type: String, | |||||
value: 'wux-backdrop' | |||||
}, | |||||
transparent: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
zIndex: { | |||||
type: Number, | |||||
value: 1000 | |||||
}, | |||||
classNames: { | |||||
type: null, | |||||
value: 'wux-animate--fadeIn' | |||||
} | |||||
}, | |||||
computed: { | |||||
classes: [ | |||||
'prefixCls, transparent', | |||||
function (e, t) { | |||||
return { | |||||
wrap: t ? ''.concat(e, '--transparent') : e | |||||
}; | |||||
} | |||||
] | |||||
}, | |||||
methods: { | |||||
retain: function () { | |||||
('number' == typeof this.backdropHolds && this.backdropHolds) || (this.backdropHolds = 0); | |||||
this.backdropHolds = this.backdropHolds + 1; | |||||
if (1 === this.backdropHolds) { | |||||
this.setData({ | |||||
in: true | |||||
}); | |||||
} | |||||
}, | |||||
release: function () { | |||||
if (1 === this.backdropHolds) { | |||||
this.setData({ | |||||
in: false | |||||
}); | |||||
} | |||||
this.backdropHolds = Math.max(0, this.backdropHolds - 1); | |||||
}, | |||||
onClick: function () { | |||||
this.$emit('click'); | |||||
} | |||||
} | |||||
}); | |||||
</script> | |||||
<style> | |||||
.wux-backdrop { | |||||
background: rgba(0, 0, 0, 0.4); | |||||
} | |||||
.wux-backdrop, | |||||
.wux-backdrop--transparent { | |||||
position: fixed; | |||||
z-index: 1000; | |||||
top: 0; | |||||
right: 0; | |||||
left: 0; | |||||
bottom: 0; | |||||
} | |||||
.wux-backdrop--transparent { | |||||
background: 0 0; | |||||
} | |||||
</style> |
@@ -0,0 +1,489 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<wux-popup position="bottom" :visible="visible" safeArea="bottom" @close="onPopupClose"> | |||||
<view :class="'wux-class ' + classes.wrap"> | |||||
<view :class="classes.hd"> | |||||
<view :class="classes.title" v-if="title">{{ title }}</view> | |||||
<view :class="classes.menus" v-if="activeOptions.length"> | |||||
<block v-for="(item, index) in activeOptions" :key="index"> | |||||
<view :class="classes.menu + ' ' + (activeIndex === index ? prefixCls + '__menu--active' : '')" :data-menu-index="index" @tap="onMenuClick"> | |||||
{{ item[fieldNames['label']] }} | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</view> | |||||
<view :class="classes.bd" :style="bodyStyle"> | |||||
<block v-for="(option, optionIndex) in showOptions" :key="optionIndex"> | |||||
<view :class="classes.inner"> | |||||
<scroll-view scroll-y :class="'wux-scroll-view-class ' + classes.scrollView"> | |||||
<view :class="classes.option"> | |||||
<block v-for="(item, index) in option" :key="index"> | |||||
<view | |||||
:class=" | |||||
classes.item + | |||||
' ' + | |||||
(activeValue[optionIndex] === item[fieldNames['value']] ? prefixCls + '__item--active' : '') + | |||||
' ' + | |||||
(item.disabled ? prefixCls + '__item--disabled' : '') | |||||
" | |||||
:data-option-index="optionIndex" | |||||
:data-item="item" | |||||
@tap="onItemSelect" | |||||
> | |||||
<text>{{ item[fieldNames['label']] }}</text> | |||||
<icon | |||||
:class="classes.icon" | |||||
type="success_no_circle" | |||||
size="16" | |||||
color="#ef473a" | |||||
v-if="activeValue[optionIndex] === item[fieldNames['value']]" | |||||
/> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</scroll-view> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</view> | |||||
</wux-popup> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
'use strict'; | |||||
import wuxPopup from '../popup/index'; | |||||
var _baseComponent = _interopRequireDefault(require('../helpers/baseComponent')); | |||||
var _classNames = _interopRequireDefault(require('../helpers/classNames')); | |||||
var _arrayTreeFilter = _interopRequireDefault(require('../helpers/arrayTreeFilter')); | |||||
function _interopRequireDefault(e) { | |||||
return e && e.__esModule | |||||
? e | |||||
: { | |||||
default: e | |||||
}; | |||||
} | |||||
function _defineProperty(e, t, a) { | |||||
t in e | |||||
? Object.defineProperty(e, t, { | |||||
value: a, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}) | |||||
: (e[t] = a); | |||||
return e; | |||||
} | |||||
function _toConsumableArray(e) { | |||||
return _arrayWithoutHoles(e) || _iterableToArray(e) || _nonIterableSpread(); | |||||
} | |||||
function _nonIterableSpread() { | |||||
throw new TypeError('Invalid attempt to spread non-iterable instance'); | |||||
} | |||||
function _iterableToArray(e) { | |||||
if (Symbol.iterator in Object(e) || '[object Arguments]' === Object.prototype.toString.call(e)) { | |||||
return Array.from(e); | |||||
} | |||||
} | |||||
function _arrayWithoutHoles(e) { | |||||
if (Array.isArray(e)) { | |||||
for (t = 0, a = new Array(e.length), void 0; t < e.length; t++) { | |||||
var t; | |||||
var a; | |||||
a[t] = e[t]; | |||||
} | |||||
return a; | |||||
} | |||||
} | |||||
var WUX_CASCADER = 'wux-cascader'; | |||||
var defaultFieldNames = { | |||||
label: 'label', | |||||
value: 'value', | |||||
children: 'children' | |||||
}; | |||||
(0, _baseComponent.default)({ | |||||
externalClasses: ['wux-scroll-view-class'], | |||||
properties: { | |||||
prefixCls: { | |||||
type: String, | |||||
value: 'wux-cascader' | |||||
}, | |||||
defaultValue: { | |||||
type: Array, | |||||
value: [] | |||||
}, | |||||
value: { | |||||
type: Array, | |||||
value: [] | |||||
}, | |||||
controlled: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
title: { | |||||
type: String, | |||||
value: '' | |||||
}, | |||||
options: { | |||||
type: Array, | |||||
value: [] | |||||
}, | |||||
chooseTitle: { | |||||
type: String, | |||||
value: '请选择' | |||||
}, | |||||
visible: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
defaultFieldNames: { | |||||
type: Object, | |||||
value: defaultFieldNames | |||||
} | |||||
}, | |||||
data: { | |||||
activeOptions: [], | |||||
activeIndex: 0, | |||||
bodyStyle: '', | |||||
activeValue: [], | |||||
showOptions: [], | |||||
fieldNames: {} | |||||
}, | |||||
computed: { | |||||
classes: [ | |||||
'prefixCls', | |||||
function (e) { | |||||
return { | |||||
wrap: (0, _classNames.default)(e), | |||||
hd: ''.concat(e, '__hd'), | |||||
title: ''.concat(e, '__title'), | |||||
menus: ''.concat(e, '__menus'), | |||||
menu: ''.concat(e, '__menu'), | |||||
bd: ''.concat(e, '__bd'), | |||||
inner: ''.concat(e, '__inner'), | |||||
scrollView: ''.concat(e, '__scroll-view'), | |||||
option: ''.concat(e, '__option'), | |||||
item: ''.concat(e, '__item'), | |||||
icon: ''.concat(e, '__icon'), | |||||
ft: ''.concat(e, '__ft') | |||||
}; | |||||
} | |||||
] | |||||
}, | |||||
observers: { | |||||
value: function (e) { | |||||
if (this.controlled) { | |||||
this.setData({ | |||||
activeValue: e | |||||
}); | |||||
this.getCurrentOptions(e); | |||||
} | |||||
}, | |||||
options: function () { | |||||
this.getCurrentOptions(this.activeValue); | |||||
} | |||||
}, | |||||
methods: { | |||||
getActiveOptions: function (a) { | |||||
var e = this.options; | |||||
var i = this.getFieldName('value'); | |||||
var t = this.getFieldName('children'); | |||||
return (0, _arrayTreeFilter.default)( | |||||
e, | |||||
function (e, t) { | |||||
return e[i] === a[t]; | |||||
}, | |||||
{ | |||||
childrenKeyName: t | |||||
} | |||||
); | |||||
}, | |||||
getShowOptions: function (e) { | |||||
var t = this.options; | |||||
var a = this.getFieldName('children'); | |||||
var i = this.getActiveOptions(e) | |||||
.map(function (e) { | |||||
return e[a]; | |||||
}) | |||||
.filter(function (e) { | |||||
return !!e; | |||||
}); | |||||
return [t].concat(_toConsumableArray(i)); | |||||
}, | |||||
getMenus: function (e, t) { | |||||
if (0 < arguments.length && void 0 !== e) { | |||||
var a = e; | |||||
} else { | |||||
var a = []; | |||||
} | |||||
if (1 < arguments.length) { | |||||
var i = t; | |||||
} else { | |||||
var i = void 0; | |||||
} | |||||
var n = this; | |||||
var r = (n.options, n.chooseTitle); | |||||
var o = this.getActiveOptions(a); | |||||
if (i) { | |||||
var l; | |||||
var s = this.getFieldName('value'); | |||||
var u = this.getFieldName('label'); | |||||
o.push((_defineProperty((l = {}), s, WUX_CASCADER), _defineProperty(l, u, r), l)); | |||||
} | |||||
return o; | |||||
}, | |||||
getNextActiveValue: function (e, t) { | |||||
var a = this.activeValue; | |||||
(a = a.slice(0, t + 1))[t] = e; | |||||
return a; | |||||
}, | |||||
updated: function (e, t, a, i) { | |||||
var n = this.getFieldName('value'); | |||||
var r = this.getFieldName('children'); | |||||
var o = e[r] && 0 < e[r].length; | |||||
var l = this.getNextActiveValue(e[n], t); | |||||
var s = this.getMenus(l, o); | |||||
var u = s.length - 1; | |||||
var c = this.getShowOptions(l); | |||||
var d = { | |||||
activeValue: l, | |||||
activeOptions: s, | |||||
activeIndex: u, | |||||
showOptions: c | |||||
}; | |||||
if (o || (l.length === c.length && (t = Math.max(0, t - 1)))) { | |||||
d.bodyStyle = 'transform: translate('.concat(-50 * t, '%)'); | |||||
d.showOptions = c; | |||||
} | |||||
if (a) { | |||||
this.setData(d); | |||||
} | |||||
if ('function' == typeof i) { | |||||
i.call(this, e, s, !o); | |||||
} | |||||
}, | |||||
getCurrentOptions: function (e) { | |||||
var t = 0 < arguments.length && void 0 !== e ? e : this.activeValue; | |||||
var a = Math.max(0, t.length - 1); | |||||
var i = this.getActiveOptions(t); | |||||
var n = i[a]; | |||||
if (n) { | |||||
this.updated(n, a, true); | |||||
} else { | |||||
var r; | |||||
var o = this.getFieldName('value'); | |||||
var l = this.getFieldName('label'); | |||||
i.push((_defineProperty((r = {}), o, WUX_CASCADER), _defineProperty(r, l, this.chooseTitle), r)); | |||||
var s = { | |||||
showOptions: this.getShowOptions(t), | |||||
activeOptions: i, | |||||
activeIndex: i.length - 1, | |||||
bodyStyle: '' | |||||
}; | |||||
this.setData(s); | |||||
} | |||||
}, | |||||
onMenuClick: function (e) { | |||||
var t = e.currentTarget.dataset.menuIndex; | |||||
var a = 'transform: translate('.concat(-50 * (1 < t ? t - 1 : 0), '%)'); | |||||
this.setData({ | |||||
bodyStyle: a, | |||||
activeIndex: t | |||||
}); | |||||
}, | |||||
onItemSelect: function (e) { | |||||
var t = e.currentTarget.dataset; | |||||
var a = t.item; | |||||
var i = t.optionIndex; | |||||
if (a && !a.disabled) { | |||||
this.updated(a, i, !this.controlled, this.onChange); | |||||
} | |||||
}, | |||||
onPopupClose: function () { | |||||
this.$emit('close'); | |||||
}, | |||||
onChange: function (e, t, a) { | |||||
var that = this; | |||||
var n = 0 < arguments.length && void 0 !== e ? e : {}; | |||||
var r = 2 < arguments.length && void 0 !== a && a; | |||||
var o = (1 < arguments.length && void 0 !== t ? t : []).filter(function (e) { | |||||
return e[that.getFieldName('value')] !== WUX_CASCADER; | |||||
}); | |||||
var l = o.map(function (e) { | |||||
return e[that.getFieldName('value')]; | |||||
}); | |||||
if (false === n.isLeaf && !n.children) { | |||||
this.emitEvent({ | |||||
value: l, | |||||
options: o, | |||||
done: false | |||||
}); | |||||
return void this.$emit('load', { | |||||
detail: { | |||||
value: l, | |||||
options: o | |||||
} | |||||
}); | |||||
} | |||||
this.emitEvent({ | |||||
value: l, | |||||
options: o, | |||||
done: r | |||||
}); | |||||
}, | |||||
emitEvent: function (e) { | |||||
var t = 0 < arguments.length && void 0 !== e ? e : {}; | |||||
this.$emit('change', { | |||||
detail: t | |||||
}); | |||||
if (t.done) { | |||||
this.onPopupClose(); | |||||
} | |||||
}, | |||||
getFieldName: function (e) { | |||||
return this.fieldNames[e]; | |||||
} | |||||
}, | |||||
attached: function () { | |||||
var e = this; | |||||
var t = e.defaultValue; | |||||
var a = e.value; | |||||
var i = e.controlled ? a : t; | |||||
var n = Object.assign({}, defaultFieldNames, this.defaultFieldNames); | |||||
this.setData({ | |||||
activeValue: i, | |||||
fieldNames: n | |||||
}); | |||||
this.getCurrentOptions(i); | |||||
} | |||||
}); | |||||
</script> | |||||
<style> | |||||
.wux-cascader__hd { | |||||
position: relative; | |||||
width: 100%; | |||||
font-size: 34rpx; | |||||
line-height: 1.5; | |||||
color: #444; | |||||
} | |||||
.wux-cascader__hd::after { | |||||
content: ' '; | |||||
position: absolute; | |||||
left: 0; | |||||
bottom: 0; | |||||
right: 0; | |||||
height: 1px; | |||||
border-bottom: 1px solid #d9d9d9; | |||||
color: #d9d9d9; | |||||
transform-origin: 0 100%; | |||||
transform: scaleY(0.5); | |||||
} | |||||
.wux-cascader__title { | |||||
position: relative; | |||||
height: 88rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
text-align: center; | |||||
box-sizing: border-box; | |||||
} | |||||
.wux-cascader__title::after { | |||||
content: ' '; | |||||
position: absolute; | |||||
left: 0; | |||||
bottom: 0; | |||||
right: 0; | |||||
height: 1px; | |||||
border-bottom: 1px solid #d9d9d9; | |||||
color: #d9d9d9; | |||||
transform-origin: 0 100%; | |||||
transform: scaleY(0.5); | |||||
} | |||||
.wux-cascader__menus { | |||||
display: flex; | |||||
height: 88rpx; | |||||
padding: 0 20rpx; | |||||
align-items: center; | |||||
box-sizing: border-box; | |||||
} | |||||
.wux-cascader__menu { | |||||
font-size: 26rpx; | |||||
padding: 0 20rpx; | |||||
max-width: 40%; | |||||
width: auto; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
white-space: nowrap; | |||||
word-wrap: normal; | |||||
} | |||||
.wux-cascader__menu--active { | |||||
color: #ef473a; | |||||
} | |||||
.wux-cascader__bd { | |||||
width: 100%; | |||||
display: flex; | |||||
transition: transform 0.3s; | |||||
background-color: #f5f5f5; | |||||
min-height: 540rpx; | |||||
} | |||||
.wux-cascader__inner { | |||||
display: block; | |||||
height: inherit; | |||||
width: 50%; | |||||
flex: 0 0 50%; | |||||
background-color: #fff; | |||||
} | |||||
.wux-cascader__inner:nth-child(2n) { | |||||
background-color: #f5f5f5; | |||||
} | |||||
.wux-cascader__scroll-view { | |||||
max-height: 540rpx; | |||||
} | |||||
.wux-cascader__option { | |||||
width: 100%; | |||||
height: inherit; | |||||
display: block; | |||||
padding: 0 40rpx; | |||||
box-sizing: border-box; | |||||
} | |||||
.wux-cascader__item { | |||||
position: relative; | |||||
z-index: 10; | |||||
display: block; | |||||
color: rgba(0, 0, 0, 0.85); | |||||
font-size: 26rpx; | |||||
/* height: 80rpx; */ | |||||
padding: 25rpx 0; | |||||
text-align: left; | |||||
width: auto; | |||||
/* overflow: hidden; */ | |||||
/* white-space: nowrap; */ | |||||
} | |||||
.wux-cascader__item::after { | |||||
content: ' '; | |||||
position: absolute; | |||||
left: 0; | |||||
bottom: 0; | |||||
right: 0; | |||||
height: 1px; | |||||
border-bottom: 1px solid #d9d9d9; | |||||
color: #d9d9d9; | |||||
transform-origin: 0 100%; | |||||
transform: scaleY(0.5); | |||||
} | |||||
.wux-cascader__item--active { | |||||
color: #ef473a; | |||||
padding-right: 36rpx; | |||||
} | |||||
.wux-cascader__item--disabled { | |||||
opacity: 0.3; | |||||
} | |||||
.wux-cascader__icon { | |||||
position: absolute; | |||||
top: 24rpx; | |||||
right: 0; | |||||
z-index: 20; | |||||
font-size: 0; | |||||
line-height: 1; | |||||
} | |||||
</style> |
@@ -0,0 +1,25 @@ | |||||
'use strict'; | |||||
function arrayTreeFilter(e, r, t) { | |||||
(t = t || {}).childrenKeyName = t.childrenKeyName || 'children'; | |||||
var a = e || []; | |||||
var l = []; | |||||
var i = 0; | |||||
do { | |||||
var d = a.filter(function (e) { | |||||
return r(e, i); | |||||
})[0]; | |||||
if (!d) { | |||||
break; | |||||
} | |||||
l.push(d); | |||||
a = d[t.childrenKeyName] || []; | |||||
i += 1; | |||||
} while (0 < a.length); | |||||
return l; | |||||
} | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _default = arrayTreeFilter; | |||||
exports.default = _default; |
@@ -0,0 +1,141 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _computedBehavior = _interopRequireDefault(require('./computedBehavior')); | |||||
var _relationsBehavior = _interopRequireDefault(require('./relationsBehavior')); | |||||
var _safeAreaBehavior = _interopRequireDefault(require('./safeAreaBehavior')); | |||||
var _safeSetDataBehavior = _interopRequireDefault(require('./safeSetDataBehavior')); | |||||
var _funcBehavior = _interopRequireDefault(require('./funcBehavior')); | |||||
var _compareVersion = _interopRequireDefault(require('./compareVersion')); | |||||
function _interopRequireDefault(e) { | |||||
return e && e.__esModule | |||||
? e | |||||
: { | |||||
default: e | |||||
}; | |||||
} | |||||
function ownKeys(r, e) { | |||||
var t = Object.keys(r); | |||||
if (Object.getOwnPropertySymbols) { | |||||
var o = Object.getOwnPropertySymbols(r); | |||||
if (e) { | |||||
o = o.filter(function (e) { | |||||
return Object.getOwnPropertyDescriptor(r, e).enumerable; | |||||
}); | |||||
} | |||||
t.push.apply(t, o); | |||||
} | |||||
return t; | |||||
} | |||||
function _objectSpread(r) { | |||||
for (var e = 1; e < arguments.length; e++) { | |||||
if (null != arguments[e]) { | |||||
var t = arguments[e]; | |||||
} else { | |||||
} | |||||
e % 2 | |||||
? ownKeys(t, true).forEach(function (e) { | |||||
_defineProperty(r, e, t[e]); | |||||
}) | |||||
: Object.getOwnPropertyDescriptors | |||||
? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) | |||||
: ownKeys(t).forEach(function (e) { | |||||
Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(t, e)); | |||||
}); | |||||
} | |||||
return r; | |||||
} | |||||
function _defineProperty(e, r, t) { | |||||
r in e | |||||
? Object.defineProperty(e, r, { | |||||
value: t, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}) | |||||
: (e[r] = t); | |||||
return e; | |||||
} | |||||
function _toConsumableArray(e) { | |||||
return _arrayWithoutHoles(e) || _iterableToArray(e) || _nonIterableSpread(); | |||||
} | |||||
function _nonIterableSpread() { | |||||
throw new TypeError('Invalid attempt to spread non-iterable instance'); | |||||
} | |||||
function _iterableToArray(e) { | |||||
if (Symbol.iterator in Object(e) || '[object Arguments]' === Object.prototype.toString.call(e)) { | |||||
return Array.from(e); | |||||
} | |||||
} | |||||
function _arrayWithoutHoles(e) { | |||||
if (Array.isArray(e)) { | |||||
for (r = 0, t = new Array(e.length), void 0; r < e.length; r++) { | |||||
var r; | |||||
var t; | |||||
t[r] = e[r]; | |||||
} | |||||
return t; | |||||
} | |||||
} | |||||
var _wx$getSystemInfoSync = uni.getSystemInfoSync(); | |||||
var platform = _wx$getSystemInfoSync.platform; | |||||
var SDKVersion = _wx$getSystemInfoSync.SDKVersion; | |||||
var libVersion = '2.6.6'; | |||||
if ('devtools' === platform && (0, _compareVersion.default)(SDKVersion, libVersion) < 0 && wx && uni.showModal) { | |||||
uni.showModal({ | |||||
title: '提示', | |||||
content: '当前基础库版本('.concat(SDKVersion, ')过低,无法使用 Wux Weapp 组件库,请更新基础库版本 >=').concat(libVersion, ' 后重试。') | |||||
}); | |||||
} | |||||
var baseComponent = function (e) { | |||||
if (0 < arguments.length && void 0 !== e) { | |||||
var t = e; | |||||
} else { | |||||
} | |||||
t.externalClasses = ['wux-class', 'wux-hover-class'].concat(_toConsumableArray((t.externalClasses = t.externalClasses || []))); | |||||
t.behaviors = [_relationsBehavior.default, _safeSetDataBehavior.default].concat(_toConsumableArray((t.behaviors = t.behaviors || [])), [_computedBehavior.default]); | |||||
if (t.useSafeArea) { | |||||
t.behaviors = [].concat(_toConsumableArray(t.behaviors), [_safeAreaBehavior.default]); | |||||
delete t.useSafeArea; | |||||
} | |||||
if (t.useFunc) { | |||||
t.behaviors = [].concat(_toConsumableArray(t.behaviors), [_funcBehavior.default]); | |||||
delete t.useFunc; | |||||
} | |||||
if (t.useField) { | |||||
t.behaviors = [].concat(_toConsumableArray(t.behaviors), ['wx://form-field']); | |||||
delete t.useField; | |||||
} | |||||
if (t.useExport) { | |||||
t.behaviors = [].concat(_toConsumableArray(t.behaviors), ['wx://component-export']); | |||||
t.methods = _objectSpread( | |||||
{ | |||||
export: function () { | |||||
return this; | |||||
} | |||||
}, | |||||
t.methods | |||||
); | |||||
delete t.useExport; | |||||
} | |||||
t.options = _objectSpread( | |||||
{ | |||||
multipleSlots: true, | |||||
addGlobalClass: true | |||||
}, | |||||
t.options | |||||
); | |||||
if (t.properties) { | |||||
Object.keys(t.properties).forEach(function (e) { | |||||
var r = t.properties[e]; | |||||
if (Array.isArray(r.type)) { | |||||
r.optionalTypes = r.type; | |||||
} | |||||
}); | |||||
} | |||||
return Component(t); | |||||
}; | |||||
var _default = baseComponent; | |||||
exports.default = _default; |
@@ -0,0 +1,42 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.checkIPhoneX = exports.getSystemInfo = exports.safeAreaInset = void 0; | |||||
var systemInfo = null; | |||||
var safeAreaInset = { | |||||
top: 88, | |||||
left: 0, | |||||
right: 0, | |||||
bottom: 34 | |||||
}; | |||||
exports.safeAreaInset = safeAreaInset; | |||||
var getSystemInfo = function (e) { | |||||
if (!systemInfo || e) { | |||||
try { | |||||
systemInfo = uni.getSystemInfoSync(); | |||||
} catch (e) { | |||||
console.log('CatchClause', e); | |||||
console.log('CatchClause', e); | |||||
} | |||||
try { | |||||
safeAreaInset.top = systemInfo.statusBarHeight + systemInfo.safeArea.top; | |||||
safeAreaInset.bottom = systemInfo.screenHeight - systemInfo.safeArea.bottom; | |||||
} catch (e) { | |||||
console.log('CatchClause', e); | |||||
console.log('CatchClause', e); | |||||
} | |||||
} | |||||
return systemInfo; | |||||
}; | |||||
exports.getSystemInfo = getSystemInfo; | |||||
var isIPhoneX = function (e) { | |||||
var t = e.model; | |||||
var s = e.windowHeight; | |||||
var o = e.windowWidth; | |||||
return /iphone (x|12|13)/.test(t.toLowerCase()) || (812 <= s && 2 < s / o); | |||||
}; | |||||
var checkIPhoneX = function (e) { | |||||
return isIPhoneX(getSystemInfo(e)); | |||||
}; | |||||
(exports.checkIPhoneX = checkIPhoneX)(); |
@@ -0,0 +1,42 @@ | |||||
'use strict'; | |||||
function _typeof(e) { | |||||
return (_typeof = | |||||
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator | |||||
? function (e) { | |||||
return typeof e; | |||||
} | |||||
: function (e) { | |||||
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; | |||||
})(e); | |||||
} | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var hasOwn = {}.hasOwnProperty; | |||||
function classNames() { | |||||
for (e = [], t = 0, void 0; t < arguments.length; t++) { | |||||
var e; | |||||
var t; | |||||
var o = arguments[t]; | |||||
if (o) { | |||||
var r = _typeof(o); | |||||
if ('string' === r || 'number' === r) e.push(o); | |||||
else if (Array.isArray(o) && o.length) { | |||||
var n = classNames.apply(null, o); | |||||
if (n) { | |||||
e.push(n); | |||||
} | |||||
} else if ('object' === r) { | |||||
for (var s in o) { | |||||
if (hasOwn.call(o, s) && o[s]) { | |||||
e.push(s); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
return e.join(' '); | |||||
} | |||||
var _default = classNames; | |||||
exports.default = _default; |
@@ -0,0 +1,21 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.isPresetColor = exports.colors = void 0; | |||||
var colors = { | |||||
light: '#ddd', | |||||
stable: '#b2b2b2', | |||||
positive: '#387ef5', | |||||
calm: '#11c1f3', | |||||
balanced: '#33cd5f', | |||||
energized: '#ffc900', | |||||
assertive: '#ef473a', | |||||
royal: '#886aea', | |||||
dark: '#444' | |||||
}; | |||||
exports.colors = colors; | |||||
var isPresetColor = function (e) { | |||||
return !!e && (colors[e] ? colors[e] : e); | |||||
}; | |||||
exports.isPresetColor = isPresetColor; |
@@ -0,0 +1,29 @@ | |||||
'use strict'; | |||||
function compareVersion(e, r) { | |||||
for (t = e.split('.'), a = r.split('.'), n = Math.max(t.length, a.length), void 0; t.length < n; ) { | |||||
var t; | |||||
var a; | |||||
var n; | |||||
t.push('0'); | |||||
} | |||||
for (; a.length < n; ) { | |||||
a.push('0'); | |||||
} | |||||
for (var o = 0; o < n; o++) { | |||||
var s = parseInt(t[o]); | |||||
var u = parseInt(a[o]); | |||||
if (u < s) { | |||||
return 1; | |||||
} | |||||
if (s < u) { | |||||
return -1; | |||||
} | |||||
} | |||||
return 0; | |||||
} | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _default = compareVersion; | |||||
exports.default = _default; |
@@ -0,0 +1,178 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _isEmpty = _interopRequireDefault(require('./isEmpty')); | |||||
var _shallowEqual = _interopRequireDefault(require('./shallowEqual')); | |||||
function _interopRequireDefault(e) { | |||||
return e && e.__esModule | |||||
? e | |||||
: { | |||||
default: e | |||||
}; | |||||
} | |||||
function _toConsumableArray(e) { | |||||
return _arrayWithoutHoles(e) || _iterableToArray(e) || _nonIterableSpread(); | |||||
} | |||||
function _nonIterableSpread() { | |||||
throw new TypeError('Invalid attempt to spread non-iterable instance'); | |||||
} | |||||
function _iterableToArray(e) { | |||||
if (Symbol.iterator in Object(e) || '[object Arguments]' === Object.prototype.toString.call(e)) { | |||||
return Array.from(e); | |||||
} | |||||
} | |||||
function _arrayWithoutHoles(e) { | |||||
if (Array.isArray(e)) { | |||||
for (r = 0, t = new Array(e.length), void 0; r < e.length; r++) { | |||||
var r; | |||||
var t; | |||||
t[r] = e[r]; | |||||
} | |||||
return t; | |||||
} | |||||
} | |||||
function ownKeys(r, e) { | |||||
var t = Object.keys(r); | |||||
if (Object.getOwnPropertySymbols) { | |||||
var n = Object.getOwnPropertySymbols(r); | |||||
if (e) { | |||||
n = n.filter(function (e) { | |||||
return Object.getOwnPropertyDescriptor(r, e).enumerable; | |||||
}); | |||||
} | |||||
t.push.apply(t, n); | |||||
} | |||||
return t; | |||||
} | |||||
function _objectSpread(r) { | |||||
for (var e = 1; e < arguments.length; e++) { | |||||
if (null != arguments[e]) { | |||||
var t = arguments[e]; | |||||
} else { | |||||
var t = {}; | |||||
} | |||||
e % 2 | |||||
? ownKeys(t, true).forEach(function (e) { | |||||
_defineProperty(r, e, t[e]); | |||||
}) | |||||
: Object.getOwnPropertyDescriptors | |||||
? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) | |||||
: ownKeys(t).forEach(function (e) { | |||||
Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(t, e)); | |||||
}); | |||||
} | |||||
return r; | |||||
} | |||||
function _defineProperty(e, r, t) { | |||||
r in e | |||||
? Object.defineProperty(e, r, { | |||||
value: t, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}) | |||||
: (e[r] = t); | |||||
return e; | |||||
} | |||||
function _slicedToArray(e, r) { | |||||
return _arrayWithHoles(e) || _iterableToArrayLimit(e, r) || _nonIterableRest(); | |||||
} | |||||
function _nonIterableRest() { | |||||
throw new TypeError('Invalid attempt to destructure non-iterable instance'); | |||||
} | |||||
function _iterableToArrayLimit(e, r) { | |||||
var t = []; | |||||
var n = true; | |||||
var o = false; | |||||
var i = void 0; | |||||
try { | |||||
for (u = e[Symbol.iterator](), void 0; !(n = (a = u.next()).done) && (t.push(a.value), !r || t.length !== r); n = true) { | |||||
var a; | |||||
var u; | |||||
} | |||||
} catch (e) { | |||||
console.log('CatchClause', e); | |||||
console.log('CatchClause', e); | |||||
o = true; | |||||
i = e; | |||||
} finally { | |||||
try { | |||||
n || null == u.return || u.return(); | |||||
} finally { | |||||
if (o) { | |||||
throw i; | |||||
} | |||||
} | |||||
} | |||||
return t; | |||||
} | |||||
function _arrayWithHoles(e) { | |||||
if (Array.isArray(e)) { | |||||
return e; | |||||
} | |||||
} | |||||
var ALL_DATA_KEY = '**'; | |||||
var trim = function (e) { | |||||
return (0 < arguments.length && void 0 !== e ? e : '').replace(/\s/g, ''); | |||||
}; | |||||
var _default = { | |||||
lifetimes: { | |||||
attached: function () { | |||||
this.initComputed(); | |||||
} | |||||
}, | |||||
definitionFilter: function (e) { | |||||
var r = e.computed; | |||||
if (void 0 === r) { | |||||
var n = {}; | |||||
} else { | |||||
var n = r; | |||||
} | |||||
var a = Object.keys(n).reduce(function (e, i) { | |||||
var r = _slicedToArray(Array.isArray(n[i]) ? n[i] : [ALL_DATA_KEY, n[i]], 2); | |||||
var t = r[0]; | |||||
var a = r[1]; | |||||
return _objectSpread( | |||||
{}, | |||||
e, | |||||
_defineProperty({}, t, function () { | |||||
if ('function' == typeof a) { | |||||
for (e = arguments.length, r = new Array(e), t = 0, void 0; t < e; t++) { | |||||
var e; | |||||
var r; | |||||
var t; | |||||
r[t] = arguments[t]; | |||||
} | |||||
var n = a.apply(this, r); | |||||
var o = this[i]; | |||||
(0, _isEmpty.default)(n) || (0, _shallowEqual.default)(n, o) || this.setData(_defineProperty({}, i, n)); | |||||
} | |||||
}) | |||||
); | |||||
}, {}); | |||||
Object.assign((e.observers = e.observers || {}), a); | |||||
Object.assign((e.methods = e.methods || {}), { | |||||
initComputed: function (e, r) { | |||||
var t = 0 < arguments.length && void 0 !== e ? e : {}; | |||||
var n = 1 < arguments.length && void 0 !== r && r; | |||||
if (!this.runInitComputed || n) { | |||||
this.runInitComputed = false; | |||||
var that = this; | |||||
var i = _objectSpread({}, this, {}, t); | |||||
Object.keys(a).forEach(function (e) { | |||||
var r = trim(e) | |||||
.split(',') | |||||
.reduce(function (e, r) { | |||||
return [].concat(_toConsumableArray(e), [i[r]]); | |||||
}, []); | |||||
a[e].apply(that, r); | |||||
}); | |||||
this.runInitComputed = true; | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
}; | |||||
exports.default = _default; |
@@ -0,0 +1,170 @@ | |||||
'use strict'; | |||||
function ownKeys(t, e) { | |||||
var r = Object.keys(t); | |||||
if (Object.getOwnPropertySymbols) { | |||||
var n = Object.getOwnPropertySymbols(t); | |||||
if (e) { | |||||
n = n.filter(function (e) { | |||||
return Object.getOwnPropertyDescriptor(t, e).enumerable; | |||||
}); | |||||
} | |||||
r.push.apply(r, n); | |||||
} | |||||
return r; | |||||
} | |||||
function _objectSpread(t) { | |||||
for (var e = 1; e < arguments.length; e++) { | |||||
if (null != arguments[e]) { | |||||
var r = arguments[e]; | |||||
} else { | |||||
var r = {}; | |||||
} | |||||
if (e % 2) { | |||||
ownKeys(r, true).forEach(function (e) { | |||||
_defineProperty(t, e, r[e]); | |||||
}); | |||||
} else { | |||||
Object.getOwnPropertyDescriptors | |||||
? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) | |||||
: ownKeys(r).forEach(function (e) { | |||||
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e)); | |||||
}); | |||||
} | |||||
} | |||||
return t; | |||||
} | |||||
function _defineProperty(e, t, r) { | |||||
t in e | |||||
? Object.defineProperty(e, t, { | |||||
value: r, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}) | |||||
: (e[t] = r); | |||||
return e; | |||||
} | |||||
function _classCallCheck(e, t) { | |||||
if (!(e instanceof t)) { | |||||
throw new TypeError('Cannot call a class as a function'); | |||||
} | |||||
} | |||||
function _defineProperties(e, t) { | |||||
for (var r = 0; r < t.length; r++) { | |||||
var n = t[r]; | |||||
n.enumerable = n.enumerable || false; | |||||
n.configurable = true; | |||||
if ('value' in n) { | |||||
n.writable = true; | |||||
} | |||||
Object.defineProperty(e, n.key, n); | |||||
} | |||||
} | |||||
function _createClass(e, t, r) { | |||||
if (t) { | |||||
_defineProperties(e.prototype, t); | |||||
} | |||||
if (r) { | |||||
_defineProperties(e, r); | |||||
} | |||||
return e; | |||||
} | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = createFieldsStore; | |||||
var FieldsStore = (function () { | |||||
function t() { | |||||
if (0 < arguments.length && void 0 !== arguments[0]) { | |||||
var e = arguments[0]; | |||||
} else { | |||||
var e = {}; | |||||
} | |||||
_classCallCheck(this, t); | |||||
this.fields = e; | |||||
} | |||||
_createClass(t, [ | |||||
{ | |||||
key: 'setFields', | |||||
value: function (e) { | |||||
Object.assign(this.fields, e); | |||||
} | |||||
}, | |||||
{ | |||||
key: 'updateFields', | |||||
value: function (e) { | |||||
this.fields = e; | |||||
} | |||||
}, | |||||
{ | |||||
key: 'clearField', | |||||
value: function (e) { | |||||
delete this.fields[e]; | |||||
} | |||||
}, | |||||
{ | |||||
key: 'getValueFromFields', | |||||
value: function (e, t) { | |||||
var r = t[e]; | |||||
return r && 'value' in r ? r.value : r.initialValue; | |||||
} | |||||
}, | |||||
{ | |||||
key: 'getAllFieldsName', | |||||
value: function () { | |||||
var e = this.fields; | |||||
return e ? Object.keys(e) : []; | |||||
} | |||||
}, | |||||
{ | |||||
key: 'getField', | |||||
value: function (e) { | |||||
return _objectSpread({}, this.fields[e], { | |||||
name: e | |||||
}); | |||||
} | |||||
}, | |||||
{ | |||||
key: 'getFieldValuePropValue', | |||||
value: function (e) { | |||||
var t = e.name; | |||||
var r = e.valuePropName; | |||||
var n = this.getField(t); | |||||
return _defineProperty({}, r, 'value' in n ? n.value : n.initialValue); | |||||
} | |||||
}, | |||||
{ | |||||
key: 'getFieldValue', | |||||
value: function (e) { | |||||
return this.getValueFromFields(e, this.fields); | |||||
} | |||||
}, | |||||
{ | |||||
key: 'getFieldsValue', | |||||
value: function (e) { | |||||
var that = this; | |||||
return (e || this.getAllFieldsName()).reduce(function (e, t) { | |||||
e[t] = that.getFieldValue(t); | |||||
return e; | |||||
}, {}); | |||||
} | |||||
}, | |||||
{ | |||||
key: 'resetFields', | |||||
value: function (e) { | |||||
var n = this.fields; | |||||
return (e || this.getAllFieldsName()).reduce(function (e, t) { | |||||
var r = n[t]; | |||||
if (r) { | |||||
e[t] = r.initialValue; | |||||
} | |||||
return e; | |||||
}, {}); | |||||
} | |||||
} | |||||
]); | |||||
return t; | |||||
})(); | |||||
function createFieldsStore(e) { | |||||
return new FieldsStore(e); | |||||
} |
@@ -0,0 +1,41 @@ | |||||
'use strict'; | |||||
function debounce(t, o, i) { | |||||
var n; | |||||
var u; | |||||
var r; | |||||
var a; | |||||
var c; | |||||
function d() { | |||||
var e = +new Date() - a; | |||||
if (e < o && 0 <= e) { | |||||
n = setTimeout(d, o - e); | |||||
} else { | |||||
n = void 0; | |||||
i || ((c = t.apply(r, u)), n || (u = r = void 0)); | |||||
} | |||||
} | |||||
function e() { | |||||
r = this; | |||||
u = arguments; | |||||
a = +new Date(); | |||||
var e = i && !n; | |||||
n = n || setTimeout(d, o); | |||||
if (e) { | |||||
c = t.apply(r, u); | |||||
u = r = void 0; | |||||
} | |||||
return c; | |||||
} | |||||
e.cancel = function () { | |||||
if (void 0 !== n) { | |||||
clearTimeout(n); | |||||
n = void 0; | |||||
} | |||||
u = r = void 0; | |||||
}; | |||||
return e; | |||||
} | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = debounce; |
@@ -0,0 +1,56 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = eventsMixin; | |||||
var defaultEvents = { | |||||
onChange: function () {} | |||||
}; | |||||
function eventsMixin() { | |||||
return { | |||||
data() { | |||||
return { | |||||
inputEvents: defaultEvents | |||||
}; | |||||
}, | |||||
lifetimes: { | |||||
created: function () { | |||||
this._oriTriggerEvent = this.triggerEvent; | |||||
this.triggerEvent = this._triggerEvent; | |||||
} | |||||
}, | |||||
props: { | |||||
events: { | |||||
type: Object, | |||||
value: defaultEvents | |||||
} | |||||
}, | |||||
definitionFilter: function (t) { | |||||
Object.assign((t.data = t.data || {}), { | |||||
inputEvents: Object.assign({}, defaultEvents, t.inputEvents) | |||||
}); | |||||
Object.assign((t.methods = t.methods || {}), { | |||||
_triggerEvent: function (t, e, n, i) { | |||||
var s = !(2 < arguments.length && void 0 !== n) || n; | |||||
if (3 < arguments.length) { | |||||
var a = i; | |||||
} else { | |||||
var a = void 0; | |||||
} | |||||
var r = this.inputEvents['on'.concat(t[0].toUpperCase()).concat(t.slice(1))]; | |||||
if (s && 'function' == typeof r) { | |||||
r.call(this, e); | |||||
} | |||||
this._oriTriggerEvent(t, e, a); | |||||
} | |||||
}); | |||||
Object.assign((t.observers = t.observers || {}), { | |||||
events: function (t) { | |||||
this.setData({ | |||||
inputEvents: Object.assign({}, defaultEvents, this.inputEvents, t) | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
}; | |||||
} |
@@ -0,0 +1,92 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var mergeOptionsToData = function (t) { | |||||
if (0 < arguments.length && void 0 !== t) { | |||||
var e = t; | |||||
} else { | |||||
var e = {}; | |||||
} | |||||
var n = Object.assign({}, e); | |||||
for (var r in n) { | |||||
if (n.hasOwnProperty(r) && 'function' == typeof n[r]) { | |||||
delete n[r]; | |||||
} | |||||
} | |||||
return n; | |||||
}; | |||||
var bind = function (r, i) { | |||||
return function () { | |||||
for (t = arguments.length, e = new Array(t), n = 0, void 0; n < t; n++) { | |||||
var t; | |||||
var e; | |||||
var n; | |||||
e[n] = arguments[n]; | |||||
} | |||||
return e.length ? r.apply(i, e) : r.call(i); | |||||
}; | |||||
}; | |||||
var assign = function () { | |||||
for (t = arguments.length, e = new Array(t), n = 0, void 0; n < t; n++) { | |||||
var t; | |||||
var e; | |||||
var n; | |||||
e[n] = arguments[n]; | |||||
} | |||||
return Object.assign.apply(Object, [{}].concat(e)); | |||||
}; | |||||
var _default = { | |||||
definitionFilter: function (t) { | |||||
t.data = mergeOptionsToData(t.data); | |||||
t.data.in = false; | |||||
t.data.visible = false; | |||||
}, | |||||
methods: { | |||||
$mergeOptionsToData: mergeOptionsToData, | |||||
$mergeOptionsAndBindMethods: function (t, e) { | |||||
if (0 < arguments.length && void 0 !== t) { | |||||
var n = t; | |||||
} else { | |||||
var n = {}; | |||||
} | |||||
var r = 1 < arguments.length && void 0 !== e ? e : this.fns; | |||||
var i = Object.assign({}, n); | |||||
for (var a in i) { | |||||
if (i.hasOwnProperty(a) && 'function' == typeof i[a]) { | |||||
r[a] = bind(i[a], this); | |||||
delete i[a]; | |||||
} | |||||
} | |||||
return i; | |||||
}, | |||||
$setData: function () { | |||||
for (e = this, t = arguments.length, n = new Array(t), r = 0, void 0; r < t; r++) { | |||||
var e; | |||||
var t; | |||||
var n; | |||||
var r; | |||||
n[r] = arguments[r]; | |||||
} | |||||
var i = assign.apply(void 0, [{}].concat(n)); | |||||
return new Promise(function (t) { | |||||
e.setData(i, t); | |||||
}); | |||||
}, | |||||
$requestAnimationFrame: function (t, e) { | |||||
var n = 0 < arguments.length && void 0 !== t ? t : function () {}; | |||||
var r = 1 < arguments.length && void 0 !== e ? e : 16.666666666666668; | |||||
return new Promise(function (t) { | |||||
return setTimeout(t, r); | |||||
}).then(n); | |||||
} | |||||
}, | |||||
created: function () { | |||||
this.fns = {}; | |||||
}, | |||||
destroyed: function () { | |||||
this.fns = {}; | |||||
} | |||||
}; | |||||
exports.default = _default; |
@@ -0,0 +1,49 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.getSwipeDirection = exports.getPointsDistance = exports.isNearbyPoints = exports.isEqualPoints = exports.getPointsNumber = exports.getTouchPoints = void 0; | |||||
var getTouchPoints = function (t, e) { | |||||
if (1 < arguments.length && void 0 !== e) { | |||||
var s = e; | |||||
} else { | |||||
var s = 0; | |||||
} | |||||
var o = t.touches; | |||||
var n = t.changedTouches; | |||||
var i = o && 0 < o.length; | |||||
var r = n && 0 < n.length; | |||||
if (!i && r) { | |||||
var a = n[s]; | |||||
} else { | |||||
var a = i ? o[s] : t; | |||||
} | |||||
return { | |||||
x: a.pageX, | |||||
y: a.pageY | |||||
}; | |||||
}; | |||||
exports.getTouchPoints = getTouchPoints; | |||||
var getPointsNumber = function (t) { | |||||
return (t.touches && t.touches.length) || (t.changedTouches && t.changedTouches.length); | |||||
}; | |||||
exports.getPointsNumber = getPointsNumber; | |||||
var isEqualPoints = function (t, e) { | |||||
return t.x === e.x && t.y === e.y; | |||||
}; | |||||
exports.isEqualPoints = isEqualPoints; | |||||
var isNearbyPoints = function (t, e, s) { | |||||
var o = 2 < arguments.length && void 0 !== s ? s : 25; | |||||
return (Math.abs(t.x - e.x) < o) & (Math.abs(t.y - e.y) < o); | |||||
}; | |||||
exports.isNearbyPoints = isNearbyPoints; | |||||
var getPointsDistance = function (t, e) { | |||||
var s = Math.abs(t.x - e.x); | |||||
var o = Math.abs(t.y - e.y); | |||||
return Math.sqrt(s * s + o * o); | |||||
}; | |||||
exports.getPointsDistance = getPointsDistance; | |||||
var getSwipeDirection = function (t, e, s, o) { | |||||
return Math.abs(t - e) >= Math.abs(s - o) ? (0 < t - e ? 'Left' : 'Right') : 0 < s - o ? 'Up' : 'Down'; | |||||
}; | |||||
exports.getSwipeDirection = getSwipeDirection; |
@@ -0,0 +1,31 @@ | |||||
'use strict'; | |||||
function _typeof(t) { | |||||
return (_typeof = | |||||
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator | |||||
? function (t) { | |||||
return typeof t; | |||||
} | |||||
: function (t) { | |||||
return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? 'symbol' : typeof t; | |||||
})(t); | |||||
} | |||||
function isEmpty(t) { | |||||
if (Array.isArray(t)) { | |||||
return 0 === t.length; | |||||
} | |||||
if ('object' !== _typeof(t)) { | |||||
return !t; | |||||
} | |||||
if (t) { | |||||
for (var e in t) { | |||||
return false; | |||||
} | |||||
} | |||||
return true; | |||||
} | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _default = isEmpty; | |||||
exports.default = _default; |
@@ -0,0 +1,21 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var mergeOptionsToData = function (e) { | |||||
if (0 < arguments.length && void 0 !== e) { | |||||
var t = e; | |||||
} else { | |||||
var t = {}; | |||||
} | |||||
var o = Object.assign({}, t); | |||||
for (var r in o) { | |||||
if (o.hasOwnProperty(r) && 'function' == typeof o[r]) { | |||||
delete o[r]; | |||||
} | |||||
} | |||||
return o; | |||||
}; | |||||
var _default = mergeOptionsToData; | |||||
exports.default = _default; |
@@ -0,0 +1,338 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = popupMixin; | |||||
var _classNames3 = _interopRequireDefault(require('./classNames')); | |||||
var _eventsMixin = _interopRequireDefault(require('./eventsMixin')); | |||||
function _interopRequireDefault(e) { | |||||
return e && e.__esModule | |||||
? e | |||||
: { | |||||
default: e | |||||
}; | |||||
} | |||||
function ownKeys(t, e) { | |||||
var i = Object.keys(t); | |||||
if (Object.getOwnPropertySymbols) { | |||||
var n = Object.getOwnPropertySymbols(t); | |||||
if (e) { | |||||
n = n.filter(function (e) { | |||||
return Object.getOwnPropertyDescriptor(t, e).enumerable; | |||||
}); | |||||
} | |||||
i.push.apply(i, n); | |||||
} | |||||
return i; | |||||
} | |||||
function _objectSpread(t) { | |||||
for (var e = 1; e < arguments.length; e++) { | |||||
if (null != arguments[e]) { | |||||
var i = arguments[e]; | |||||
} else { | |||||
var i = {}; | |||||
} | |||||
e % 2 | |||||
? ownKeys(i, true).forEach(function (e) { | |||||
_defineProperty(t, e, i[e]); | |||||
}) | |||||
: Object.getOwnPropertyDescriptors | |||||
? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) | |||||
: ownKeys(i).forEach(function (e) { | |||||
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(i, e)); | |||||
}); | |||||
} | |||||
return t; | |||||
} | |||||
function _defineProperty(e, t, i) { | |||||
t in e | |||||
? Object.defineProperty(e, t, { | |||||
value: i, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}) | |||||
: (e[t] = i); | |||||
return e; | |||||
} | |||||
var DEFAULT_TRIGGER = 'onClick'; | |||||
var CELL_NAME = '../cell/index'; | |||||
var FIELD_NAME = '../field/index'; | |||||
var defaultToolbar = { | |||||
title: '请选择', | |||||
cancelText: '取消', | |||||
confirmText: '确定' | |||||
}; | |||||
var defaultEvents = { | |||||
onChange: function () {}, | |||||
onConfirm: function () {}, | |||||
onCancel: function () {}, | |||||
onVisibleChange: function () {}, | |||||
onValueChange: function () {} | |||||
}; | |||||
var defaultPlatformProps = { | |||||
labelPropName: 'label', | |||||
format: function (e, t) { | |||||
return Array.isArray(e.displayValue) ? e.displayValue.join(',') : e.displayValue; | |||||
} | |||||
}; | |||||
var defaultFieldNames = { | |||||
label: 'label', | |||||
value: 'value', | |||||
children: 'children' | |||||
}; | |||||
function popupMixin() { | |||||
if (0 < arguments.length && void 0 !== arguments[0]) { | |||||
var i = arguments[0]; | |||||
} else { | |||||
var i = '#wux-picker'; | |||||
} | |||||
var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : defaultPlatformProps; | |||||
return { | |||||
data() { | |||||
return { | |||||
mounted: false, | |||||
popupVisible: false, | |||||
inputValue: [] | |||||
}; | |||||
}, | |||||
mixins: [ | |||||
(0, _eventsMixin.default)({ | |||||
defaultEvents: defaultEvents | |||||
}) | |||||
], | |||||
props: { | |||||
toolbar: { | |||||
type: Object, | |||||
value: defaultToolbar | |||||
}, | |||||
trigger: { | |||||
type: String, | |||||
value: DEFAULT_TRIGGER | |||||
}, | |||||
defaultVisible: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
visible: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
controlled: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
disabled: { | |||||
type: Boolean, | |||||
value: false | |||||
} | |||||
}, | |||||
methods: { | |||||
setVisibleState: function (t, e) { | |||||
var that = this; | |||||
var n = 1 < arguments.length && void 0 !== e ? e : function () {}; | |||||
if (this.popupVisible !== t) { | |||||
var a = { | |||||
mounted: true, | |||||
inputValue: this.value, | |||||
popupVisible: t | |||||
}; | |||||
this.setData( | |||||
t | |||||
? a | |||||
: { | |||||
popupVisible: t | |||||
}, | |||||
function () { | |||||
if (t && that.hasFieldDecorator) { | |||||
var e = that.getFieldElem(); | |||||
if (e) { | |||||
e.changeValue(e.data.value); | |||||
} | |||||
} | |||||
n(); | |||||
} | |||||
); | |||||
} | |||||
}, | |||||
fireVisibleChange: function (e) { | |||||
if (this.popupVisible !== e) { | |||||
this.controlled || this.setVisibleState(e); | |||||
this.setScrollValue(void 0); | |||||
this.$emit('visibleChange', { | |||||
detail: { | |||||
visible: e | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
open: function () { | |||||
this.fireVisibleChange(true); | |||||
}, | |||||
close: function (e) { | |||||
if ('function' == typeof e) { | |||||
var t = this.getPickerValue(this.scrollValue || this.inputValue); | |||||
e.call(this, this.formatPickerValue(t)); | |||||
} | |||||
this.fireVisibleChange(false); | |||||
}, | |||||
onClosed: function () { | |||||
this.picker = null; | |||||
this.setData({ | |||||
mounted: false, | |||||
inputValue: null | |||||
}); | |||||
}, | |||||
onConfirm: function () { | |||||
var that = this; | |||||
this.close(function (e) { | |||||
that.$emit('change', { | |||||
detail: e | |||||
}); | |||||
that.$emit('confirm', { | |||||
detail: e | |||||
}); | |||||
}); | |||||
}, | |||||
onCancel: function () { | |||||
var that = this; | |||||
this.close(function (e) { | |||||
return that.$emit('cancel', { | |||||
detail: e | |||||
}); | |||||
}); | |||||
}, | |||||
onValueChange: function (e) { | |||||
if (this.mounted) { | |||||
var t = e.detail.value; | |||||
this.cascade ? this.setCasecadeScrollValue(t) : this.setScrollValue(t); | |||||
this.updated(t, true); | |||||
this.$emit('valueChange', { | |||||
detail: this.formatPickerValue(e.detail) | |||||
}); | |||||
} | |||||
}, | |||||
getPickerValue: function (e) { | |||||
var t = 0 < arguments.length && void 0 !== e ? e : this.inputValue; | |||||
this.picker = this.picker || this.zpSelectComponent(i); | |||||
return this.picker && this.picker.getValue(t); | |||||
}, | |||||
formatPickerValue: function (e) { | |||||
return _objectSpread({}, e, _defineProperty({}, t.labelPropName, t.format(e, this))); | |||||
}, | |||||
getFieldElem: function () { | |||||
return (this.field = this.field || this.getRelationNodes(FIELD_NAME)[0]); | |||||
}, | |||||
setChildProps: function () { | |||||
var that = this; | |||||
if (!this.disabled) { | |||||
var e = this.getRelationNodes(CELL_NAME); | |||||
var t = this.trigger; | |||||
var a = void 0 === t ? DEFAULT_TRIGGER : t; | |||||
if (0 < e.length) { | |||||
e.forEach(function (e) { | |||||
var t = e.data.inputEvents; | |||||
var i = e.data.oriInputEvents || _objectSpread({}, t); | |||||
t[a] = function () { | |||||
if (i && i[a]) { | |||||
i[a].apply(i, arguments); | |||||
} | |||||
that.onTriggerClick(); | |||||
}; | |||||
e.setData({ | |||||
oriInputEvents: i, | |||||
inputEvents: t | |||||
}); | |||||
}); | |||||
} | |||||
} | |||||
}, | |||||
onTriggerClick: function () { | |||||
this.fireVisibleChange(!this.popupVisible); | |||||
}, | |||||
noop: function () {}, | |||||
updated: function (e, t) { | |||||
(this.hasFieldDecorator && !t) || | |||||
(this.inputValue !== e && | |||||
this.setData({ | |||||
inputValue: e | |||||
})); | |||||
}, | |||||
setScrollValue: function (e) { | |||||
this.scrollValue = e; | |||||
}, | |||||
setCasecadeScrollValue: function (e) { | |||||
if (e && this.scrollValue) { | |||||
var t = this.scrollValue.length; | |||||
if (t === e.length && this.scrollValue[t - 1] === e[t - 1]) { | |||||
return; | |||||
} | |||||
} | |||||
this.setScrollValue(e); | |||||
} | |||||
}, | |||||
lifetimes: { | |||||
ready: function () { | |||||
var e = this; | |||||
var t = e.defaultVisible; | |||||
var i = e.visible; | |||||
var n = e.controlled; | |||||
var a = (e.value, n ? i : t); | |||||
if ('defaultFieldNames' in this) { | |||||
this.setData({ | |||||
fieldNames: Object.assign({}, defaultFieldNames, this.defaultFieldNames) | |||||
}); | |||||
} | |||||
this.mounted = true; | |||||
this.scrollValue = void 0; | |||||
this.setVisibleState(a); | |||||
this.setChildProps(); | |||||
}, | |||||
detached: function () { | |||||
this.mounted = false; | |||||
} | |||||
}, | |||||
definitionFilter: function (e) { | |||||
var t; | |||||
Object.assign( | |||||
(e.relations = e.relations || {}), | |||||
(_defineProperty((t = {}), CELL_NAME, { | |||||
type: 'child', | |||||
observer: function () { | |||||
this.setChildProps(); | |||||
} | |||||
}), | |||||
_defineProperty(t, FIELD_NAME, { | |||||
type: 'ancestor' | |||||
}), | |||||
t) | |||||
); | |||||
Object.assign((e.computed = e.computed || {}), { | |||||
classes: [ | |||||
'prefixCls', | |||||
function (e) { | |||||
return { | |||||
wrap: (0, _classNames3.default)(e), | |||||
toolbar: ''.concat(e, '__toolbar'), | |||||
inner: ''.concat(e, '__inner'), | |||||
cancel: (0, _classNames3.default)(''.concat(e, '__button'), _defineProperty({}, ''.concat(e, '__button--cancel'), true)), | |||||
confirm: (0, _classNames3.default)(''.concat(e, '__button'), _defineProperty({}, ''.concat(e, '__button--confirm'), true)), | |||||
hover: ''.concat(e, '__button--hover'), | |||||
title: ''.concat(e, '__title') | |||||
}; | |||||
} | |||||
] | |||||
}); | |||||
Object.assign((e.observers = e.observers || {}), { | |||||
visible: function (e) { | |||||
if (this.controlled) { | |||||
this.setVisibleState(e); | |||||
} | |||||
}, | |||||
value: function (e) { | |||||
this.updated(e); | |||||
} | |||||
}); | |||||
} | |||||
}; | |||||
} |
@@ -0,0 +1,93 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _isEmpty = _interopRequireDefault(require('./isEmpty')); | |||||
var _debounce2 = _interopRequireDefault(require('./debounce')); | |||||
function _interopRequireDefault(e) { | |||||
return e && e.__esModule | |||||
? e | |||||
: { | |||||
default: e | |||||
}; | |||||
} | |||||
function _defineProperty(e, t, n) { | |||||
t in e | |||||
? Object.defineProperty(e, t, { | |||||
value: n, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}) | |||||
: (e[t] = n); | |||||
return e; | |||||
} | |||||
function bindFunc(e, t, n) { | |||||
var i = e[t]; | |||||
e[t] = function (e) { | |||||
if (n) { | |||||
n.call(this, e, _defineProperty({}, t, true)); | |||||
} | |||||
if (i) { | |||||
i.call(this, e); | |||||
} | |||||
}; | |||||
} | |||||
var methods = ['linked', 'linkChanged', 'unlinked']; | |||||
var extProps = ['observer']; | |||||
var _default = { | |||||
lifetimes: { | |||||
created: function () { | |||||
this._debounce = null; | |||||
}, | |||||
detached: function () { | |||||
if (this._debounce && this._debounce.cancel) { | |||||
this._debounce.cancel(); | |||||
} | |||||
} | |||||
}, | |||||
definitionFilter: function (e) { | |||||
var n = e.relations; | |||||
if (!(0, _isEmpty.default)(n)) { | |||||
var t = function (e) { | |||||
var t = n[e]; | |||||
methods.forEach(function (e) { | |||||
return bindFunc(t, e, t.observer); | |||||
}); | |||||
extProps.forEach(function (e) { | |||||
return delete t[e]; | |||||
}); | |||||
}; | |||||
for (var i in n) { | |||||
t(i); | |||||
} | |||||
} | |||||
Object.assign((e.methods = e.methods || {}), { | |||||
getRelationsName: function (e) { | |||||
if (0 < arguments.length && void 0 !== e) { | |||||
var t = e; | |||||
} else { | |||||
var t = ['parent', 'child', 'ancestor', 'descendant']; | |||||
} | |||||
return Object.keys(n || {}) | |||||
.map(function (e) { | |||||
return n[e] && t.includes(n[e].type) ? e : null; | |||||
}) | |||||
.filter(function (e) { | |||||
return !!e; | |||||
}); | |||||
}, | |||||
debounce: function (e, t, n) { | |||||
if (1 < arguments.length && void 0 !== t) { | |||||
var i = t; | |||||
} else { | |||||
var i = 0; | |||||
} | |||||
var r = 2 < arguments.length && void 0 !== n && n; | |||||
return (this._debounce = this._debounce || (0, _debounce2.default)(e.bind(this), i, r)).call(this); | |||||
} | |||||
}); | |||||
} | |||||
}; | |||||
exports.default = _default; |
@@ -0,0 +1,71 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _checkIPhoneX = require('./checkIPhoneX'); | |||||
function _defineProperty(e, t, o) { | |||||
if (t in e) { | |||||
Object.defineProperty(e, t, { | |||||
value: o, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}); | |||||
} else { | |||||
e[t] = o; | |||||
} | |||||
return e; | |||||
} | |||||
function _typeof(e) { | |||||
return (_typeof = | |||||
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator | |||||
? function (e) { | |||||
return typeof e; | |||||
} | |||||
: function (e) { | |||||
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; | |||||
})(e); | |||||
} | |||||
var defaultSafeArea = { | |||||
top: false, | |||||
bottom: false | |||||
}; | |||||
var setSafeArea = function (e) { | |||||
return 'boolean' == typeof e | |||||
? Object.assign({}, defaultSafeArea, { | |||||
top: e, | |||||
bottom: e | |||||
}) | |||||
: null !== e && 'object' === _typeof(e) | |||||
? Object.assign({}, defaultSafeArea) | |||||
: 'string' == typeof e | |||||
? Object.assign({}, defaultSafeArea, _defineProperty({}, e, true)) | |||||
: defaultSafeArea; | |||||
}; | |||||
var _default = { | |||||
props: { | |||||
safeArea: { | |||||
type: [Boolean, String, Object], | |||||
optionalTypes: [Boolean, String, Object], | |||||
value: false | |||||
} | |||||
}, | |||||
watch: { | |||||
safeArea: function (e) { | |||||
this.setData({ | |||||
safeAreaConfig: setSafeArea(e) | |||||
}); | |||||
} | |||||
}, | |||||
definitionFilter: function (e) { | |||||
var t = ((0, _checkIPhoneX.getSystemInfo)() || {}).statusBarHeight; | |||||
var o = (0, _checkIPhoneX.checkIPhoneX)(); | |||||
Object.assign((e.data = e.data || {}), { | |||||
safeAreaConfig: defaultSafeArea, | |||||
statusBarHeight: t, | |||||
isIPhoneX: o | |||||
}); | |||||
} | |||||
}; | |||||
exports.default = _default; |
@@ -0,0 +1,48 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var _default = { | |||||
lifetimes: { | |||||
created: function () { | |||||
this.nextCallback = null; | |||||
}, | |||||
detached: function () { | |||||
this.cancelNextCallback(); | |||||
} | |||||
}, | |||||
methods: { | |||||
safeSetData: function (t, a) { | |||||
var that = this; | |||||
this.pendingData = Object.assign({}, this, t); | |||||
a = this.setNextCallback(a); | |||||
this.setData(t, function () { | |||||
that.pendingData = null; | |||||
a(); | |||||
}); | |||||
}, | |||||
setNextCallback: function (a) { | |||||
var that = this; | |||||
var l = true; | |||||
this.nextCallback = function (t) { | |||||
if (l) { | |||||
l = false; | |||||
that.nextCallback = null; | |||||
a.call(that, t); | |||||
} | |||||
}; | |||||
this.nextCallback.cancel = function () { | |||||
l = false; | |||||
}; | |||||
return this.nextCallback; | |||||
}, | |||||
cancelNextCallback: function () { | |||||
if (null !== this.nextCallback) { | |||||
this.nextCallback.cancel(); | |||||
this.nextCallback = null; | |||||
} | |||||
} | |||||
} | |||||
}; | |||||
exports.default = _default; |
@@ -0,0 +1,40 @@ | |||||
'use strict'; | |||||
function _typeof(t) { | |||||
return (_typeof = | |||||
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator | |||||
? function (t) { | |||||
return typeof t; | |||||
} | |||||
: function (t) { | |||||
return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? 'symbol' : typeof t; | |||||
})(t); | |||||
} | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.default = void 0; | |||||
var hasOwnProperty = Object.prototype.hasOwnProperty; | |||||
function is(t, e) { | |||||
return t === e ? 0 !== t || 0 !== e || 1 / t == 1 / e : t != t && e != e; | |||||
} | |||||
function shallowEqual(t, e) { | |||||
if (is(t, e)) { | |||||
return true; | |||||
} | |||||
if ('object' !== _typeof(t) || null === t || 'object' !== _typeof(e) || null === e) { | |||||
return false; | |||||
} | |||||
var o = Object.keys(t); | |||||
var r = Object.keys(e); | |||||
if (o.length !== r.length) { | |||||
return false; | |||||
} | |||||
for (var n = 0; n < o.length; n++) { | |||||
if (!hasOwnProperty.call(e, o[n]) || !is(t[o[n]], e[o[n]])) { | |||||
return false; | |||||
} | |||||
} | |||||
return true; | |||||
} | |||||
var _default = shallowEqual; | |||||
exports.default = _default; |
@@ -0,0 +1,83 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
var isUnitlessNumber = { | |||||
boxFlex: !(exports.default = void 0), | |||||
boxFlexGroup: true, | |||||
columnCount: true, | |||||
flex: true, | |||||
flexGrow: true, | |||||
flexPositive: true, | |||||
flexShrink: true, | |||||
flexNegative: true, | |||||
fontWeight: true, | |||||
lineClamp: true, | |||||
lineHeight: true, | |||||
opacity: true, | |||||
order: true, | |||||
orphans: true, | |||||
widows: true, | |||||
zIndex: true, | |||||
zoom: true, | |||||
fillOpacity: true, | |||||
strokeDashoffset: true, | |||||
strokeOpacity: true, | |||||
strokeWidth: true | |||||
}; | |||||
function prefixKey(e, t) { | |||||
return e + t.charAt(0).toUpperCase() + t.substring(1); | |||||
} | |||||
var prefixes = ['Webkit', 'ms', 'Moz', 'O']; | |||||
Object.keys(isUnitlessNumber).forEach(function (t) { | |||||
prefixes.forEach(function (e) { | |||||
isUnitlessNumber[prefixKey(e, t)] = isUnitlessNumber[t]; | |||||
}); | |||||
}); | |||||
var msPattern = /^ms-/; | |||||
var _uppercasePattern = /([A-Z])/g; | |||||
function hyphenate(e) { | |||||
return e.replace(_uppercasePattern, '-$1').toLowerCase(); | |||||
} | |||||
function hyphenateStyleName(e) { | |||||
return hyphenate(e).replace(msPattern, '-ms-'); | |||||
} | |||||
var isArray = Array.isArray; | |||||
var keys = Object.keys; | |||||
var unquotedContentValueRegex = /^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/; | |||||
function buildRule(e, t) { | |||||
if (isUnitlessNumber[e] || 'number' != typeof t) { | |||||
'content' !== e || unquotedContentValueRegex.test(t) || (t = "'" + t.replace(/'/g, "\\'") + "'"); | |||||
} else { | |||||
t += 'px'; | |||||
} | |||||
return hyphenateStyleName(e) + ': ' + t + '; '; | |||||
} | |||||
function styleToCssString(e) { | |||||
var t = ''; | |||||
if ('string' == typeof e) { | |||||
return ';' === (e = e.trim()).slice(-1) ? ''.concat(e, ' ') : ''.concat(e, '; '); | |||||
} | |||||
if (!e || 0 === keys(e).length) { | |||||
return t; | |||||
} | |||||
for (r = keys(e), n = 0, s = r.length, void 0; n < s; n++) { | |||||
var r; | |||||
var n; | |||||
var s; | |||||
var o = r[n]; | |||||
var i = e[o]; | |||||
if (isArray(i)) { | |||||
for (a = 0, u = i.length, void 0; a < u; a++) { | |||||
var a; | |||||
var u; | |||||
t += buildRule(o, i[a]); | |||||
} | |||||
} else { | |||||
t += buildRule(o, i); | |||||
} | |||||
} | |||||
return t; | |||||
} | |||||
var _default = styleToCssString; | |||||
exports.default = _default; |
@@ -0,0 +1,19 @@ | |||||
'use strict'; | |||||
Object.defineProperty(exports, '__esModule', { | |||||
value: true | |||||
}); | |||||
exports.$wuxBackdrop = exports.version = exports.getCtx = void 0; | |||||
var getCtx = function (e, t) { | |||||
var r = (1 < arguments.length && void 0 !== t ? t : getCurrentPages()[getCurrentPages().length - 1].zpSelectComponent)(e); | |||||
if (!r) { | |||||
throw new Error('无法找到对应的组件,请按文档说明使用组件'); | |||||
} | |||||
return r; | |||||
}; | |||||
exports.getCtx = getCtx; | |||||
var version = '3.8.9'; | |||||
exports.version = version; | |||||
var $wuxBackdrop = function (e, t) { | |||||
return getCtx(0 < arguments.length && void 0 !== e ? e : '#wux-backdrop', 1 < arguments.length ? t : void 0); | |||||
}; | |||||
exports.$wuxBackdrop = $wuxBackdrop; |
@@ -0,0 +1,359 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<wux-backdrop id="wux-backdrop" v-if="mask" @click="onMaskClick($event, { tagId: 'wux-backdrop' })" :zIndex="zIndex" /> | |||||
<view :class="'wux-class ' + classes.wrap" :style="extStyle"> | |||||
<wux-animation-group | |||||
:wux-class="prefixCls" | |||||
:in="popupVisible" | |||||
:classNames="transitionName" | |||||
@exited="onExited" | |||||
:wrapStyle="" | |||||
:mountOnEnter="mountOnEnter" | |||||
:unmountOnExit="unmountOnExit" | |||||
> | |||||
<view :class="'wux-content-class ' + classes.content"> | |||||
<view :class="'wux-header-class ' + classes.hd" v-if="hasHeader"> | |||||
<view :class="classes.title" v-if="title">{{ title }}</view> | |||||
<block v-else> | |||||
<slot name="header"></slot> | |||||
</block> | |||||
</view> | |||||
<view :class="'wux-body-class ' + classes.bd"> | |||||
<view v-if="content">{{ content }}</view> | |||||
<slot></slot> | |||||
</view> | |||||
<view :class="'wux-footer-class ' + classes.ft" v-if="hasFooter"> | |||||
<view :class="classes.extra" v-if="extra">{{ extra }}</view> | |||||
<block v-else> | |||||
<slot name="footer"></slot> | |||||
</block> | |||||
</view> | |||||
<view :class="'wux-close-class ' + classes.close" v-if="closable" @tap="close"> | |||||
<text :class="classes.x"></text> | |||||
</view> | |||||
</view> | |||||
</wux-animation-group> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
'use strict'; | |||||
import wuxAnimationGroup from '../animation-group/index'; | |||||
import wuxBackdrop from '../backdrop/index'; | |||||
var _baseComponent = _interopRequireDefault(require('../helpers/baseComponent')); | |||||
var _classNames2 = _interopRequireDefault(require('../helpers/classNames')); | |||||
var _styleToCssString = _interopRequireDefault(require('../helpers/styleToCssString')); | |||||
var _index = require('../index'); | |||||
function _interopRequireDefault(e) { | |||||
return e && e.__esModule | |||||
? e | |||||
: { | |||||
default: e | |||||
}; | |||||
} | |||||
function _defineProperty(e, t, a) { | |||||
t in e | |||||
? Object.defineProperty(e, t, { | |||||
value: a, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}) | |||||
: (e[t] = a); | |||||
return e; | |||||
} | |||||
(0, _baseComponent.default)({ | |||||
useSafeArea: true, | |||||
externalClasses: ['wux-content-class', 'wux-header-class', 'wux-body-class', 'wux-footer-class', 'wux-close-class'], | |||||
properties: { | |||||
prefixCls: { | |||||
type: String, | |||||
value: 'wux-popup' | |||||
}, | |||||
animationPrefixCls: { | |||||
type: String, | |||||
value: 'wux-animate' | |||||
}, | |||||
title: { | |||||
type: String, | |||||
value: '' | |||||
}, | |||||
content: { | |||||
type: String, | |||||
value: '' | |||||
}, | |||||
extra: { | |||||
type: String, | |||||
value: '' | |||||
}, | |||||
position: { | |||||
type: String, | |||||
value: 'center', | |||||
observer: 'getTransitionName' | |||||
}, | |||||
wrapStyle: { | |||||
type: [String, Object], | |||||
value: '', | |||||
observer: function (e) { | |||||
this.setData({ | |||||
extStyle: (0, _styleToCssString.default)(e) | |||||
}); | |||||
} | |||||
}, | |||||
closable: { | |||||
type: Boolean, | |||||
value: false | |||||
}, | |||||
mask: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
maskClosable: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
visible: { | |||||
type: Boolean, | |||||
value: false, | |||||
observer: 'setPopupVisible' | |||||
}, | |||||
zIndex: { | |||||
type: Number, | |||||
value: 1000 | |||||
}, | |||||
hasHeader: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
hasFooter: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
mountOnEnter: { | |||||
type: Boolean, | |||||
value: true | |||||
}, | |||||
unmountOnExit: { | |||||
type: Boolean, | |||||
value: true | |||||
} | |||||
}, | |||||
data: { | |||||
transitionName: '', | |||||
popupVisible: false, | |||||
extStyle: '' | |||||
}, | |||||
computed: { | |||||
classes: [ | |||||
'prefixCls, position, safeAreaConfig, isIPhoneX', | |||||
function (e, t, a, i) { | |||||
var o; | |||||
return { | |||||
wrap: (0, _classNames2.default)( | |||||
''.concat(e, '-position'), | |||||
(_defineProperty((o = {}), ''.concat(e, '-position--').concat(t), t), _defineProperty(o, ''.concat(e, '-position--is-iphonex'), a.bottom && i), o) | |||||
), | |||||
content: ''.concat(e, '__content'), | |||||
hd: ''.concat(e, '__hd'), | |||||
title: ''.concat(e, '__title'), | |||||
bd: ''.concat(e, '__bd'), | |||||
ft: ''.concat(e, '__ft'), | |||||
extra: ''.concat(e, '__extra'), | |||||
close: ''.concat(e, '__close'), | |||||
x: ''.concat(e, '__close-x') | |||||
}; | |||||
} | |||||
] | |||||
}, | |||||
methods: { | |||||
close: function () { | |||||
this.$emit('close'); | |||||
}, | |||||
onMaskClick: function () { | |||||
if (this.maskClosable) { | |||||
this.close(); | |||||
} | |||||
}, | |||||
onExited: function () { | |||||
this.$emit('closed'); | |||||
}, | |||||
getTransitionName: function (e) { | |||||
if (0 < arguments.length && void 0 !== e) { | |||||
var t = e; | |||||
} else { | |||||
var t = this.position; | |||||
} | |||||
var a = this.animationPrefixCls; | |||||
var i = ''; | |||||
switch (t) { | |||||
case 'top': | |||||
i = ''.concat(a, '--slideInDown'); | |||||
break; | |||||
case 'right': | |||||
i = ''.concat(a, '--slideInRight'); | |||||
break; | |||||
case 'bottom': | |||||
i = ''.concat(a, '--slideInUp'); | |||||
break; | |||||
case 'left': | |||||
i = ''.concat(a, '--slideInLeft'); | |||||
break; | |||||
default: | |||||
i = ''.concat(a, '--fadeIn'); | |||||
} | |||||
this.setData({ | |||||
transitionName: i | |||||
}); | |||||
}, | |||||
setPopupVisible: function (e) { | |||||
if (this.popupVisible !== e) { | |||||
this.setData({ | |||||
popupVisible: e | |||||
}); | |||||
this.setBackdropVisible(e); | |||||
} | |||||
}, | |||||
setBackdropVisible: function (e) { | |||||
if (this.mask && this.$wuxBackdrop) { | |||||
this.$wuxBackdrop[e ? 'retain' : 'release'](); | |||||
} | |||||
} | |||||
}, | |||||
created: function () { | |||||
if (this.mask) { | |||||
this.$wuxBackdrop = (0, _index.$wuxBackdrop)('#wux-backdrop', this); | |||||
} | |||||
}, | |||||
attached: function () { | |||||
this.setPopupVisible(this.visible); | |||||
this.getTransitionName(); | |||||
} | |||||
}); | |||||
</script> | |||||
<style> | |||||
.wux-popup { | |||||
position: fixed; | |||||
z-index: 1000; | |||||
width: 80%; | |||||
max-width: 600rpx; | |||||
} | |||||
.wux-popup-position.wux-popup-position--center .wux-popup { | |||||
top: 50%; | |||||
left: 50%; | |||||
transform: translate(-50%, -50%); | |||||
} | |||||
.wux-popup-position.wux-popup-position--center .wux-popup__content { | |||||
border-radius: 8rpx; | |||||
} | |||||
.wux-popup-position.wux-popup-position--center .wux-popup__hd { | |||||
padding: 1.3em 1.6em 0.5em; | |||||
} | |||||
.wux-popup-position.wux-popup-position--center .wux-popup__bd { | |||||
padding: 0 1.6em 0.8em; | |||||
} | |||||
.wux-popup-position.wux-popup-position--center .wux-popup__ft::after { | |||||
content: ' '; | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
right: 0; | |||||
height: 1px; | |||||
border-top: 1px solid #d9d9d9; | |||||
color: #d9d9d9; | |||||
transform-origin: 0 0; | |||||
transform: scaleY(0.5); | |||||
} | |||||
.wux-popup-position.wux-popup-position--top .wux-popup { | |||||
position: fixed; | |||||
left: 0; | |||||
top: 0; | |||||
width: 100%; | |||||
max-width: 100%; | |||||
} | |||||
.wux-popup-position.wux-popup-position--right .wux-popup { | |||||
position: fixed; | |||||
top: 0; | |||||
right: 0; | |||||
width: 80%; | |||||
max-width: 100%; | |||||
height: 100%; | |||||
max-height: 100%; | |||||
} | |||||
.wux-popup-position.wux-popup-position--bottom .wux-popup { | |||||
position: fixed; | |||||
left: 0; | |||||
bottom: 0; | |||||
width: 100%; | |||||
max-width: 100%; | |||||
} | |||||
.wux-popup-position.wux-popup-position--left .wux-popup { | |||||
position: fixed; | |||||
left: 0; | |||||
top: 0; | |||||
width: 80%; | |||||
max-width: 100%; | |||||
height: 100%; | |||||
max-height: 100%; | |||||
} | |||||
.wux-popup-position.wux-popup-position--is-iphonex .wux-popup__content { | |||||
padding-bottom: 68rpx; | |||||
} | |||||
@supports (padding-bottom: constant(safe-area-inset-bottom)) { | |||||
.wux-popup-position.wux-popup-position--is-iphonex .wux-popup__content { | |||||
padding-bottom: constant(safe-area-inset-bottom); | |||||
} | |||||
} | |||||
@supports (padding-bottom: env(safe-area-inset-bottom)) { | |||||
.wux-popup-position.wux-popup-position--is-iphonex .wux-popup__content { | |||||
padding-bottom: env(safe-area-inset-bottom); | |||||
} | |||||
} | |||||
.wux-popup__content { | |||||
position: relative; | |||||
background-color: #fff; | |||||
border: 0; | |||||
background-clip: padding-box; | |||||
height: 100%; | |||||
text-align: center; | |||||
overflow: hidden; | |||||
} | |||||
.wux-popup__title { | |||||
font-weight: 400; | |||||
font-size: 36rpx; | |||||
color: rgba(0, 0, 0, 0.85); | |||||
} | |||||
.wux-popup__bd { | |||||
min-height: 80rpx; | |||||
font-size: 30rpx; | |||||
line-height: 1.3; | |||||
word-wrap: break-word; | |||||
word-break: break-all; | |||||
color: rgba(0, 0, 0, 0.45); | |||||
} | |||||
.wux-popup__ft { | |||||
position: relative; | |||||
line-height: 96rpx; | |||||
font-size: 36rpx; | |||||
display: flex; | |||||
} | |||||
.wux-popup__close { | |||||
border: 0; | |||||
padding: 6rpx; | |||||
background-color: transparent; | |||||
outline: 0; | |||||
position: absolute; | |||||
top: 12rpx; | |||||
right: 12rpx; | |||||
height: 42rpx; | |||||
width: 42rpx; | |||||
} | |||||
.wux-popup__close-x { | |||||
display: inline-block; | |||||
width: 30rpx; | |||||
height: 30rpx; | |||||
background-repeat: no-repeat; | |||||
background-size: cover; | |||||
background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2230%22%20height%3D%2230%22%20viewBox%3D%220%200%2030%2030%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22%23888%22%20fill-rule%3D%22evenodd%22%3E%3Cpath%20d%3D%22M1.414%200l28.284%2028.284-1.414%201.414L0%201.414z%22%2F%3E%3Cpath%20d%3D%22M28.284%200L0%2028.284l1.414%201.414L29.698%201.414z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E'); | |||||
} | |||||
</style> |
@@ -0,0 +1,583 @@ | |||||
.wux-text--left { | |||||
text-align: left !important; | |||||
} | |||||
.wux-text--right { | |||||
text-align: right !important; | |||||
} | |||||
.wux-text--center { | |||||
text-align: center !important; | |||||
} | |||||
.wux-text--justify { | |||||
text-align: justify !important; | |||||
} | |||||
.wux-text--nowrap { | |||||
text-align: nowrap !important; | |||||
} | |||||
.wux-text--lowercase { | |||||
text-transform: lowercase !important; | |||||
} | |||||
.wux-text--uppercase { | |||||
text-transform: uppercase !important; | |||||
} | |||||
.wux-text--capitalize { | |||||
text-transform: capitalize !important; | |||||
} | |||||
.wux-light { | |||||
color: #fff !important; | |||||
} | |||||
.wux-light--bg { | |||||
background-color: #fff !important; | |||||
} | |||||
.wux-light--border { | |||||
border-color: #fff !important; | |||||
} | |||||
.wux-stable { | |||||
color: #f8f8f8 !important; | |||||
} | |||||
.wux-stable--bg { | |||||
background-color: #f8f8f8 !important; | |||||
} | |||||
.wux-stable--border { | |||||
border-color: #f8f8f8 !important; | |||||
} | |||||
.wux-positive { | |||||
color: #387ef5 !important; | |||||
} | |||||
.wux-positive--bg { | |||||
background-color: #387ef5 !important; | |||||
} | |||||
.wux-positive--border { | |||||
border-color: #387ef5 !important; | |||||
} | |||||
.wux-calm { | |||||
color: #11c1f3 !important; | |||||
} | |||||
.wux-calm--bg { | |||||
background-color: #11c1f3 !important; | |||||
} | |||||
.wux-calm--border { | |||||
border-color: #11c1f3 !important; | |||||
} | |||||
.wux-balanced { | |||||
color: #33cd5f !important; | |||||
} | |||||
.wux-balanced--bg { | |||||
background-color: #33cd5f !important; | |||||
} | |||||
.wux-balanced--border { | |||||
border-color: #33cd5f !important; | |||||
} | |||||
.wux-energized { | |||||
color: #ffc900 !important; | |||||
} | |||||
.wux-energized--bg { | |||||
background-color: #ffc900 !important; | |||||
} | |||||
.wux-energized--border { | |||||
border-color: #ffc900 !important; | |||||
} | |||||
.wux-assertive { | |||||
color: #ef473a !important; | |||||
} | |||||
.wux-assertive--bg { | |||||
background-color: #ef473a !important; | |||||
} | |||||
.wux-assertive--border { | |||||
border-color: #ef473a !important; | |||||
} | |||||
.wux-royal { | |||||
color: #886aea !important; | |||||
} | |||||
.wux-royal--bg { | |||||
background-color: #886aea !important; | |||||
} | |||||
.wux-royal--border { | |||||
border-color: #886aea !important; | |||||
} | |||||
.wux-dark { | |||||
color: #444 !important; | |||||
} | |||||
.wux-dark--bg { | |||||
background-color: #444 !important; | |||||
} | |||||
.wux-dark--border { | |||||
border-color: #444 !important; | |||||
} | |||||
.wux-m--30, | |||||
.wux-margin--30 { | |||||
margin: 60rpx !important; | |||||
} | |||||
.wux-margin-top--30, | |||||
.wux-mt--30 { | |||||
margin-top: 60rpx !important; | |||||
} | |||||
.wux-margin-right--30, | |||||
.wux-mr--30 { | |||||
margin-right: 60rpx !important; | |||||
} | |||||
.wux-margin-bottom--30, | |||||
.wux-mb--30 { | |||||
margin-bottom: 60rpx !important; | |||||
} | |||||
.wux-margin-left--30, | |||||
.wux-ml--30 { | |||||
margin-left: 60rpx !important; | |||||
} | |||||
.wux-margin-vertical--30, | |||||
.wux-mv--30 { | |||||
margin: 60rpx 0 !important; | |||||
} | |||||
.wux-margin-horizontal--30, | |||||
.wux-mh--30 { | |||||
margin: 0 60rpx !important; | |||||
} | |||||
.wux-p--30, | |||||
.wux-padding--30 { | |||||
padding: 60rpx !important; | |||||
} | |||||
.wux-padding-top--30, | |||||
.wux-pt--30 { | |||||
padding-top: 60rpx !important; | |||||
} | |||||
.wux-padding-right--30, | |||||
.wux-pr--30 { | |||||
padding-right: 60rpx !important; | |||||
} | |||||
.wux-padding-bottom--30, | |||||
.wux-pb--30 { | |||||
padding-bottom: 60rpx !important; | |||||
} | |||||
.wux-padding-left--30, | |||||
.wux-pl--30 { | |||||
padding-left: 60rpx !important; | |||||
} | |||||
.wux-padding-vertical--30, | |||||
.wux-pv--30 { | |||||
padding: 60rpx 0 !important; | |||||
} | |||||
.wux-padding-horizontal--30, | |||||
.wux-ph--30 { | |||||
padding: 0 60rpx !important; | |||||
} | |||||
.wux-m--25, | |||||
.wux-margin--25 { | |||||
margin: 50rpx !important; | |||||
} | |||||
.wux-margin-top--25, | |||||
.wux-mt--25 { | |||||
margin-top: 50rpx !important; | |||||
} | |||||
.wux-margin-right--25, | |||||
.wux-mr--25 { | |||||
margin-right: 50rpx !important; | |||||
} | |||||
.wux-margin-bottom--25, | |||||
.wux-mb--25 { | |||||
margin-bottom: 50rpx !important; | |||||
} | |||||
.wux-margin-left--25, | |||||
.wux-ml--25 { | |||||
margin-left: 50rpx !important; | |||||
} | |||||
.wux-margin-vertical--25, | |||||
.wux-mv--25 { | |||||
margin: 50rpx 0 !important; | |||||
} | |||||
.wux-margin-horizontal--25, | |||||
.wux-mh--25 { | |||||
margin: 0 50rpx !important; | |||||
} | |||||
.wux-p--25, | |||||
.wux-padding--25 { | |||||
padding: 50rpx !important; | |||||
} | |||||
.wux-padding-top--25, | |||||
.wux-pt--25 { | |||||
padding-top: 50rpx !important; | |||||
} | |||||
.wux-padding-right--25, | |||||
.wux-pr--25 { | |||||
padding-right: 50rpx !important; | |||||
} | |||||
.wux-padding-bottom--25, | |||||
.wux-pb--25 { | |||||
padding-bottom: 50rpx !important; | |||||
} | |||||
.wux-padding-left--25, | |||||
.wux-pl--25 { | |||||
padding-left: 50rpx !important; | |||||
} | |||||
.wux-padding-vertical--25, | |||||
.wux-pv--25 { | |||||
padding: 50rpx 0 !important; | |||||
} | |||||
.wux-padding-horizontal--25, | |||||
.wux-ph--25 { | |||||
padding: 0 50rpx !important; | |||||
} | |||||
.wux-m--20, | |||||
.wux-margin--20 { | |||||
margin: 40rpx !important; | |||||
} | |||||
.wux-margin-top--20, | |||||
.wux-mt--20 { | |||||
margin-top: 40rpx !important; | |||||
} | |||||
.wux-margin-right--20, | |||||
.wux-mr--20 { | |||||
margin-right: 40rpx !important; | |||||
} | |||||
.wux-margin-bottom--20, | |||||
.wux-mb--20 { | |||||
margin-bottom: 40rpx !important; | |||||
} | |||||
.wux-margin-left--20, | |||||
.wux-ml--20 { | |||||
margin-left: 40rpx !important; | |||||
} | |||||
.wux-margin-vertical--20, | |||||
.wux-mv--20 { | |||||
margin: 40rpx 0 !important; | |||||
} | |||||
.wux-margin-horizontal--20, | |||||
.wux-mh--20 { | |||||
margin: 0 40rpx !important; | |||||
} | |||||
.wux-p--20, | |||||
.wux-padding--20 { | |||||
padding: 40rpx !important; | |||||
} | |||||
.wux-padding-top--20, | |||||
.wux-pt--20 { | |||||
padding-top: 40rpx !important; | |||||
} | |||||
.wux-padding-right--20, | |||||
.wux-pr--20 { | |||||
padding-right: 40rpx !important; | |||||
} | |||||
.wux-padding-bottom--20, | |||||
.wux-pb--20 { | |||||
padding-bottom: 40rpx !important; | |||||
} | |||||
.wux-padding-left--20, | |||||
.wux-pl--20 { | |||||
padding-left: 40rpx !important; | |||||
} | |||||
.wux-padding-vertical--20, | |||||
.wux-pv--20 { | |||||
padding: 40rpx 0 !important; | |||||
} | |||||
.wux-padding-horizontal--20, | |||||
.wux-ph--20 { | |||||
padding: 0 40rpx !important; | |||||
} | |||||
.wux-m--15, | |||||
.wux-margin--15 { | |||||
margin: 30rpx !important; | |||||
} | |||||
.wux-margin-top--15, | |||||
.wux-mt--15 { | |||||
margin-top: 30rpx !important; | |||||
} | |||||
.wux-margin-right--15, | |||||
.wux-mr--15 { | |||||
margin-right: 30rpx !important; | |||||
} | |||||
.wux-margin-bottom--15, | |||||
.wux-mb--15 { | |||||
margin-bottom: 30rpx !important; | |||||
} | |||||
.wux-margin-left--15, | |||||
.wux-ml--15 { | |||||
margin-left: 30rpx !important; | |||||
} | |||||
.wux-margin-vertical--15, | |||||
.wux-mv--15 { | |||||
margin: 30rpx 0 !important; | |||||
} | |||||
.wux-margin-horizontal--15, | |||||
.wux-mh--15 { | |||||
margin: 0 30rpx !important; | |||||
} | |||||
.wux-p--15, | |||||
.wux-padding--15 { | |||||
padding: 30rpx !important; | |||||
} | |||||
.wux-padding-top--15, | |||||
.wux-pt--15 { | |||||
padding-top: 30rpx !important; | |||||
} | |||||
.wux-padding-right--15, | |||||
.wux-pr--15 { | |||||
padding-right: 30rpx !important; | |||||
} | |||||
.wux-padding-bottom--15, | |||||
.wux-pb--15 { | |||||
padding-bottom: 30rpx !important; | |||||
} | |||||
.wux-padding-left--15, | |||||
.wux-pl--15 { | |||||
padding-left: 30rpx !important; | |||||
} | |||||
.wux-padding-vertical--15, | |||||
.wux-pv--15 { | |||||
padding: 30rpx 0 !important; | |||||
} | |||||
.wux-padding-horizontal--15, | |||||
.wux-ph--15 { | |||||
padding: 0 30rpx !important; | |||||
} | |||||
.wux-m--10, | |||||
.wux-margin--10 { | |||||
margin: 20rpx !important; | |||||
} | |||||
.wux-margin-top--10, | |||||
.wux-mt--10 { | |||||
margin-top: 20rpx !important; | |||||
} | |||||
.wux-margin-right--10, | |||||
.wux-mr--10 { | |||||
margin-right: 20rpx !important; | |||||
} | |||||
.wux-margin-bottom--10, | |||||
.wux-mb--10 { | |||||
margin-bottom: 20rpx !important; | |||||
} | |||||
.wux-margin-left--10, | |||||
.wux-ml--10 { | |||||
margin-left: 20rpx !important; | |||||
} | |||||
.wux-margin-vertical--10, | |||||
.wux-mv--10 { | |||||
margin: 20rpx 0 !important; | |||||
} | |||||
.wux-margin-horizontal--10, | |||||
.wux-mh--10 { | |||||
margin: 0 20rpx !important; | |||||
} | |||||
.wux-p--10, | |||||
.wux-padding--10 { | |||||
padding: 20rpx !important; | |||||
} | |||||
.wux-padding-top--10, | |||||
.wux-pt--10 { | |||||
padding-top: 20rpx !important; | |||||
} | |||||
.wux-padding-right--10, | |||||
.wux-pr--10 { | |||||
padding-right: 20rpx !important; | |||||
} | |||||
.wux-padding-bottom--10, | |||||
.wux-pb--10 { | |||||
padding-bottom: 20rpx !important; | |||||
} | |||||
.wux-padding-left--10, | |||||
.wux-pl--10 { | |||||
padding-left: 20rpx !important; | |||||
} | |||||
.wux-padding-vertical--10, | |||||
.wux-pv--10 { | |||||
padding: 20rpx 0 !important; | |||||
} | |||||
.wux-padding-horizontal--10, | |||||
.wux-ph--10 { | |||||
padding: 0 20rpx !important; | |||||
} | |||||
.wux-m--5, | |||||
.wux-margin--5 { | |||||
margin: 10rpx !important; | |||||
} | |||||
.wux-margin-top--5, | |||||
.wux-mt--5 { | |||||
margin-top: 10rpx !important; | |||||
} | |||||
.wux-margin-right--5, | |||||
.wux-mr--5 { | |||||
margin-right: 10rpx !important; | |||||
} | |||||
.wux-margin-bottom--5, | |||||
.wux-mb--5 { | |||||
margin-bottom: 10rpx !important; | |||||
} | |||||
.wux-margin-left--5, | |||||
.wux-ml--5 { | |||||
margin-left: 10rpx !important; | |||||
} | |||||
.wux-margin-vertical--5, | |||||
.wux-mv--5 { | |||||
margin: 10rpx 0 !important; | |||||
} | |||||
.wux-margin-horizontal--5, | |||||
.wux-mh--5 { | |||||
margin: 0 10rpx !important; | |||||
} | |||||
.wux-p--5, | |||||
.wux-padding--5 { | |||||
padding: 10rpx !important; | |||||
} | |||||
.wux-padding-top--5, | |||||
.wux-pt--5 { | |||||
padding-top: 10rpx !important; | |||||
} | |||||
.wux-padding-right--5, | |||||
.wux-pr--5 { | |||||
padding-right: 10rpx !important; | |||||
} | |||||
.wux-padding-bottom--5, | |||||
.wux-pb--5 { | |||||
padding-bottom: 10rpx !important; | |||||
} | |||||
.wux-padding-left--5, | |||||
.wux-pl--5 { | |||||
padding-left: 10rpx !important; | |||||
} | |||||
.wux-padding-vertical--5, | |||||
.wux-pv--5 { | |||||
padding: 10rpx 0 !important; | |||||
} | |||||
.wux-padding-horizontal--5, | |||||
.wux-ph--5 { | |||||
padding: 0 10rpx !important; | |||||
} | |||||
.wux-m--0, | |||||
.wux-margin--0 { | |||||
margin: 0rpx !important; | |||||
} | |||||
.wux-margin-top--0, | |||||
.wux-mt--0 { | |||||
margin-top: 0rpx !important; | |||||
} | |||||
.wux-margin-right--0, | |||||
.wux-mr--0 { | |||||
margin-right: 0rpx !important; | |||||
} | |||||
.wux-margin-bottom--0, | |||||
.wux-mb--0 { | |||||
margin-bottom: 0rpx !important; | |||||
} | |||||
.wux-margin-left--0, | |||||
.wux-ml--0 { | |||||
margin-left: 0rpx !important; | |||||
} | |||||
.wux-margin-vertical--0, | |||||
.wux-mv--0 { | |||||
margin: 0rpx 0 !important; | |||||
} | |||||
.wux-margin-horizontal--0, | |||||
.wux-mh--0 { | |||||
margin: 0 0rpx !important; | |||||
} | |||||
.wux-p--0, | |||||
.wux-padding--0 { | |||||
padding: 0rpx !important; | |||||
} | |||||
.wux-padding-top--0, | |||||
.wux-pt--0 { | |||||
padding-top: 0rpx !important; | |||||
} | |||||
.wux-padding-right--0, | |||||
.wux-pr--0 { | |||||
padding-right: 0rpx !important; | |||||
} | |||||
.wux-padding-bottom--0, | |||||
.wux-pb--0 { | |||||
padding-bottom: 0rpx !important; | |||||
} | |||||
.wux-padding-left--0, | |||||
.wux-pl--0 { | |||||
padding-left: 0rpx !important; | |||||
} | |||||
.wux-padding-vertical--0, | |||||
.wux-pv--0 { | |||||
padding: 0rpx 0 !important; | |||||
} | |||||
.wux-padding-horizontal--0, | |||||
.wux-ph--0 { | |||||
padding: 0 0rpx !important; | |||||
} | |||||
.wux-clearfix::after, | |||||
.wux-clearfix::before { | |||||
display: table; | |||||
content: ' '; | |||||
} | |||||
.wux-clearfix::after { | |||||
clear: both; | |||||
} | |||||
.wux-pull-right { | |||||
float: right !important; | |||||
} | |||||
.wux-pull-left { | |||||
float: left !important; | |||||
} | |||||
.wux-ellipsis { | |||||
width: auto; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
white-space: nowrap; | |||||
word-wrap: normal; | |||||
} | |||||
.wux-ellipsis--l2 { | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
display: -webkit-box; | |||||
-webkit-line-clamp: 2; | |||||
-webkit-box-orient: vertical; | |||||
} | |||||
.wux-ellipsis--l3 { | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
display: -webkit-box; | |||||
-webkit-line-clamp: 3; | |||||
-webkit-box-orient: vertical; | |||||
} | |||||
.wux-hairline, | |||||
.wux-hairline--bottom, | |||||
.wux-hairline--horizontal, | |||||
.wux-hairline--left, | |||||
.wux-hairline--right, | |||||
.wux-hairline--surrounded, | |||||
.wux-hairline--top, | |||||
.wux-hairline--vertical { | |||||
position: relative; | |||||
} | |||||
.wux-hairline--bottom::after, | |||||
.wux-hairline--horizontal::after, | |||||
.wux-hairline--left::after, | |||||
.wux-hairline--right::after, | |||||
.wux-hairline--surrounded::after, | |||||
.wux-hairline--top::after, | |||||
.wux-hairline--vertical::after, | |||||
.wux-hairline::after { | |||||
content: ' '; | |||||
position: absolute; | |||||
top: 0; | |||||
left: 0; | |||||
width: 200%; | |||||
height: 200%; | |||||
transform: scale(0.5); | |||||
transform-origin: 0 0; | |||||
pointer-events: none; | |||||
box-sizing: border-box; | |||||
border: 0 solid #d9d9d9; | |||||
} | |||||
.wux-hairline--top::after { | |||||
border-top-width: 1px; | |||||
} | |||||
.wux-hairline--right::after { | |||||
border-right-width: 1px; | |||||
} | |||||
.wux-hairline--bottom::after { | |||||
border-bottom-width: 1px; | |||||
} | |||||
.wux-hairline--left::after { | |||||
border-left-width: 1px; | |||||
} | |||||
.wux-hairline--horizontal::after { | |||||
border-width: 1px 0; | |||||
} | |||||
.wux-hairline--vertical::after { | |||||
border-width: 0 1px; | |||||
} | |||||
.wux-hairline--surrounded::after { | |||||
border-width: 1px; | |||||
} |
@@ -0,0 +1 @@ | |||||
# PS:注意,cascader 存在源码级别更改,按业务要求改造过 |
@@ -0,0 +1,849 @@ | |||||
function AMapWX(a) { | |||||
this.key = a.key; | |||||
this.requestConfig = { | |||||
key: a.key, | |||||
s: 'rsx', | |||||
platform: 'WXJS', | |||||
appname: a.key, | |||||
sdkversion: '1.2.0', | |||||
logversion: '2.0' | |||||
}; | |||||
this.MeRequestConfig = { | |||||
key: a.key, | |||||
serviceName: 'https://restapi.amap.com/rest/me' | |||||
}; | |||||
} | |||||
AMapWX.prototype.getWxLocation = function (a, b) { | |||||
uni.getLocation({ | |||||
type: 'gcj02', | |||||
success: function (c) { | |||||
c = c.longitude + ',' + c.latitude; | |||||
uni.setStorage({ | |||||
key: 'userLocation', | |||||
data: c | |||||
}); | |||||
b(c); | |||||
}, | |||||
fail: function (c) { | |||||
uni.getStorage({ | |||||
key: 'userLocation', | |||||
success: function (d) { | |||||
if (d.data) { | |||||
b(d.data); | |||||
} | |||||
} | |||||
}); | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: c.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getMEKeywordsSearch = function (a) { | |||||
if (!a.options) { | |||||
return a.fail({ | |||||
errCode: '0', | |||||
errMsg: '\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570' | |||||
}); | |||||
} | |||||
var b = a.options; | |||||
var c = this.MeRequestConfig; | |||||
var d = { | |||||
key: c.key, | |||||
s: 'rsx', | |||||
platform: 'WXJS', | |||||
appname: a.key, | |||||
sdkversion: '1.2.0', | |||||
logversion: '2.0' | |||||
}; | |||||
if (b.layerId) { | |||||
d.layerId = b.layerId; | |||||
} | |||||
if (b.keywords) { | |||||
d.keywords = b.keywords; | |||||
} | |||||
if (b.city) { | |||||
d.city = b.city; | |||||
} | |||||
if (b.filter) { | |||||
d.filter = b.filter; | |||||
} | |||||
if (b.sortrule) { | |||||
d.sortrule = b.sortrule; | |||||
} | |||||
if (b.pageNum) { | |||||
d.pageNum = b.pageNum; | |||||
} | |||||
if (b.pageSize) { | |||||
d.pageSize = b.pageSize; | |||||
} | |||||
if (b.sig) { | |||||
d.sig = b.sig; | |||||
} | |||||
uni.request({ | |||||
url: c.serviceName + '/cpoint/datasearch/local', | |||||
data: d, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (e) { | |||||
if ((e = e.data) && e.status && '1' === e.status && 0 === e.code) { | |||||
a.success(e.data); | |||||
} else { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: e | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (e) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: e.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getMEIdSearch = function (a) { | |||||
if (!a.options) { | |||||
return a.fail({ | |||||
errCode: '0', | |||||
errMsg: '\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570' | |||||
}); | |||||
} | |||||
var b = a.options; | |||||
var c = this.MeRequestConfig; | |||||
var d = { | |||||
key: c.key, | |||||
s: 'rsx', | |||||
platform: 'WXJS', | |||||
appname: a.key, | |||||
sdkversion: '1.2.0', | |||||
logversion: '2.0' | |||||
}; | |||||
if (b.layerId) { | |||||
d.layerId = b.layerId; | |||||
} | |||||
if (b.id) { | |||||
d.id = b.id; | |||||
} | |||||
if (b.sig) { | |||||
d.sig = b.sig; | |||||
} | |||||
uni.request({ | |||||
url: c.serviceName + '/cpoint/datasearch/id', | |||||
data: d, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (e) { | |||||
if ((e = e.data) && e.status && '1' === e.status && 0 === e.code) { | |||||
a.success(e.data); | |||||
} else { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: e | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (e) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: e.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getMEPolygonSearch = function (a) { | |||||
if (!a.options) { | |||||
return a.fail({ | |||||
errCode: '0', | |||||
errMsg: '\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570' | |||||
}); | |||||
} | |||||
var b = a.options; | |||||
var c = this.MeRequestConfig; | |||||
var d = { | |||||
key: c.key, | |||||
s: 'rsx', | |||||
platform: 'WXJS', | |||||
appname: a.key, | |||||
sdkversion: '1.2.0', | |||||
logversion: '2.0' | |||||
}; | |||||
if (b.layerId) { | |||||
d.layerId = b.layerId; | |||||
} | |||||
if (b.keywords) { | |||||
d.keywords = b.keywords; | |||||
} | |||||
if (b.polygon) { | |||||
d.polygon = b.polygon; | |||||
} | |||||
if (b.filter) { | |||||
d.filter = b.filter; | |||||
} | |||||
if (b.sortrule) { | |||||
d.sortrule = b.sortrule; | |||||
} | |||||
if (b.pageNum) { | |||||
d.pageNum = b.pageNum; | |||||
} | |||||
if (b.pageSize) { | |||||
d.pageSize = b.pageSize; | |||||
} | |||||
if (b.sig) { | |||||
d.sig = b.sig; | |||||
} | |||||
uni.request({ | |||||
url: c.serviceName + '/cpoint/datasearch/polygon', | |||||
data: d, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (e) { | |||||
(e = e.data) && e.status && '1' === e.status && 0 === e.code | |||||
? a.success(e.data) | |||||
: a.fail({ | |||||
errCode: '0', | |||||
errMsg: e | |||||
}); | |||||
}, | |||||
fail: function (e) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: e.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getMEaroundSearch = function (a) { | |||||
if (!a.options) { | |||||
return a.fail({ | |||||
errCode: '0', | |||||
errMsg: '\u7F3A\u5C11\u5FC5\u8981\u53C2\u6570' | |||||
}); | |||||
} | |||||
var b = a.options; | |||||
var c = this.MeRequestConfig; | |||||
var d = { | |||||
key: c.key, | |||||
s: 'rsx', | |||||
platform: 'WXJS', | |||||
appname: a.key, | |||||
sdkversion: '1.2.0', | |||||
logversion: '2.0' | |||||
}; | |||||
if (b.layerId) { | |||||
d.layerId = b.layerId; | |||||
} | |||||
if (b.keywords) { | |||||
d.keywords = b.keywords; | |||||
} | |||||
if (b.center) { | |||||
d.center = b.center; | |||||
} | |||||
if (b.radius) { | |||||
d.radius = b.radius; | |||||
} | |||||
if (b.filter) { | |||||
d.filter = b.filter; | |||||
} | |||||
if (b.sortrule) { | |||||
d.sortrule = b.sortrule; | |||||
} | |||||
if (b.pageNum) { | |||||
d.pageNum = b.pageNum; | |||||
} | |||||
if (b.pageSize) { | |||||
d.pageSize = b.pageSize; | |||||
} | |||||
if (b.sig) { | |||||
d.sig = b.sig; | |||||
} | |||||
uni.request({ | |||||
url: c.serviceName + '/cpoint/datasearch/around', | |||||
data: d, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (e) { | |||||
(e = e.data) && e.status && '1' === e.status && 0 === e.code | |||||
? a.success(e.data) | |||||
: a.fail({ | |||||
errCode: '0', | |||||
errMsg: e | |||||
}); | |||||
}, | |||||
fail: function (e) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: e.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getGeo = function (a) { | |||||
var b = this.requestConfig; | |||||
var c = a.options; | |||||
b = { | |||||
key: this.key, | |||||
extensions: 'all', | |||||
s: b.s, | |||||
platform: b.platform, | |||||
appname: this.key, | |||||
sdkversion: b.sdkversion, | |||||
logversion: b.logversion | |||||
}; | |||||
if (c.address) { | |||||
b.address = c.address; | |||||
} | |||||
if (c.city) { | |||||
b.city = c.city; | |||||
} | |||||
if (c.batch) { | |||||
b.batch = c.batch; | |||||
} | |||||
if (c.sig) { | |||||
b.sig = c.sig; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/geocode/geo', | |||||
data: b, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (d) { | |||||
(d = d.data) && d.status && '1' === d.status | |||||
? a.success(d) | |||||
: a.fail({ | |||||
errCode: '0', | |||||
errMsg: d | |||||
}); | |||||
}, | |||||
fail: function (d) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: d.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getRegeo = function (a) { | |||||
function b(d) { | |||||
var e = that.requestConfig; | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/geocode/regeo', | |||||
data: { | |||||
key: that.key, | |||||
location: d, | |||||
extensions: 'all', | |||||
s: e.s, | |||||
platform: e.platform, | |||||
appname: that.key, | |||||
sdkversion: e.sdkversion, | |||||
logversion: e.logversion | |||||
}, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (g) { | |||||
if (g.data.status && '1' == g.data.status) { | |||||
g = g.data.regeocode; | |||||
var h = g.addressComponent; | |||||
var f = []; | |||||
var k = g.roads[0].name + '\u9644\u8FD1'; | |||||
var m = d.split(',')[0]; | |||||
var n = d.split(',')[1]; | |||||
if (g.pois && g.pois[0]) { | |||||
k = g.pois[0].name + '\u9644\u8FD1'; | |||||
var l = g.pois[0].location; | |||||
if (l) { | |||||
m = parseFloat(l.split(',')[0]); | |||||
n = parseFloat(l.split(',')[1]); | |||||
} | |||||
} | |||||
if (h.provice) { | |||||
f.push(h.provice); | |||||
} | |||||
if (h.city) { | |||||
f.push(h.city); | |||||
} | |||||
if (h.district) { | |||||
f.push(h.district); | |||||
} | |||||
h.streetNumber && h.streetNumber.street && h.streetNumber.number ? (f.push(h.streetNumber.street), f.push(h.streetNumber.number)) : f.push(g.roads[0].name); | |||||
f = f.join(''); | |||||
a.success([ | |||||
{ | |||||
iconPath: a.iconPath, | |||||
width: a.iconWidth, | |||||
height: a.iconHeight, | |||||
name: f, | |||||
desc: k, | |||||
longitude: m, | |||||
latitude: n, | |||||
id: 0, | |||||
regeocodeData: g | |||||
} | |||||
]); | |||||
} else { | |||||
a.fail({ | |||||
errCode: g.data.infocode, | |||||
errMsg: g.data.info | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (g) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: g.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
var that = this; | |||||
a.location | |||||
? b(a.location) | |||||
: that.getWxLocation(a, function (d) { | |||||
b(d); | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getWeather = function (a) { | |||||
function b(g) { | |||||
var h = 'base'; | |||||
if (a.type && 'forecast' == a.type) { | |||||
h = 'all'; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/weather/weatherInfo', | |||||
data: { | |||||
key: that.key, | |||||
city: g, | |||||
extensions: h, | |||||
s: e.s, | |||||
platform: e.platform, | |||||
appname: that.key, | |||||
sdkversion: e.sdkversion, | |||||
logversion: e.logversion | |||||
}, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (f) { | |||||
if (f.data.status && '1' == f.data.status) { | |||||
if (f.data.lives) { | |||||
if ((f = f.data.lives) && 0 < f.length) { | |||||
f = f[0]; | |||||
var k = { | |||||
city: { | |||||
text: '\u57CE\u5E02', | |||||
data: f.city | |||||
}, | |||||
weather: { | |||||
text: '\u5929\u6C14', | |||||
data: f.weather | |||||
}, | |||||
temperature: { | |||||
text: '\u6E29\u5EA6', | |||||
data: f.temperature | |||||
}, | |||||
winddirection: { | |||||
text: '\u98CE\u5411', | |||||
data: f.winddirection + '\u98CE' | |||||
}, | |||||
windpower: { | |||||
text: '\u98CE\u529B', | |||||
data: f.windpower + '\u7EA7' | |||||
}, | |||||
humidity: { | |||||
text: '\u6E7F\u5EA6', | |||||
data: f.humidity + '%' | |||||
} | |||||
}; | |||||
k.liveData = f; | |||||
a.success(k); | |||||
} | |||||
} else { | |||||
if (f.data.forecasts && f.data.forecasts[0]) { | |||||
a.success({ | |||||
forecast: f.data.forecasts[0] | |||||
}); | |||||
} | |||||
} | |||||
} else { | |||||
a.fail({ | |||||
errCode: f.data.infocode, | |||||
errMsg: f.data.info | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (f) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: f.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
function c(g) { | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/geocode/regeo', | |||||
data: { | |||||
key: that.key, | |||||
location: g, | |||||
extensions: 'all', | |||||
s: e.s, | |||||
platform: e.platform, | |||||
appname: that.key, | |||||
sdkversion: e.sdkversion, | |||||
logversion: e.logversion | |||||
}, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (h) { | |||||
if (h.data.status && '1' == h.data.status) { | |||||
h = h.data.regeocode; | |||||
if (h.addressComponent) { | |||||
var f = h.addressComponent.adcode; | |||||
} else { | |||||
if (h.aois && 0 < h.aois.length) { | |||||
f = h.aois[0].adcode; | |||||
} | |||||
} | |||||
b(f); | |||||
} else { | |||||
a.fail({ | |||||
errCode: h.data.infocode, | |||||
errMsg: h.data.info | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (h) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: h.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
var that = this; | |||||
var e = that.requestConfig; | |||||
a.city | |||||
? b(a.city) | |||||
: that.getWxLocation(a, function (g) { | |||||
c(g); | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getPoiAround = function (a) { | |||||
function b(e) { | |||||
e = { | |||||
key: that.key, | |||||
location: e, | |||||
s: d.s, | |||||
platform: d.platform, | |||||
appname: that.key, | |||||
sdkversion: d.sdkversion, | |||||
logversion: d.logversion | |||||
}; | |||||
if (a.querytypes) { | |||||
e.types = a.querytypes; | |||||
} | |||||
if (a.querykeywords) { | |||||
e.keywords = a.querykeywords; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/place/around', | |||||
data: e, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (g) { | |||||
if (g.data.status && '1' == g.data.status) { | |||||
if ((g = g.data) && g.pois) { | |||||
for (h = [], f = 0, void 0; f < g.pois.length; f++) { | |||||
var h; | |||||
var f; | |||||
if (0 == f) { | |||||
var k = a.iconPathSelected; | |||||
} else { | |||||
var k = a.iconPath; | |||||
} | |||||
h.push({ | |||||
latitude: parseFloat(g.pois[f].location.split(',')[1]), | |||||
longitude: parseFloat(g.pois[f].location.split(',')[0]), | |||||
iconPath: k, | |||||
width: 22, | |||||
height: 32, | |||||
id: f, | |||||
name: g.pois[f].name, | |||||
address: g.pois[f].address | |||||
}); | |||||
} | |||||
a.success({ | |||||
markers: h, | |||||
poisData: g.pois | |||||
}); | |||||
} | |||||
} else { | |||||
a.fail({ | |||||
errCode: g.data.infocode, | |||||
errMsg: g.data.info | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (g) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: g.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
var that = this; | |||||
var d = that.requestConfig; | |||||
a.location | |||||
? b(a.location) | |||||
: that.getWxLocation(a, function (e) { | |||||
b(e); | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getStaticmap = function (a) { | |||||
function b(e) { | |||||
c.push('location=' + e); | |||||
if (a.zoom) { | |||||
c.push('zoom=' + a.zoom); | |||||
} | |||||
if (a.size) { | |||||
c.push('size=' + a.size); | |||||
} | |||||
if (a.scale) { | |||||
c.push('scale=' + a.scale); | |||||
} | |||||
if (a.markers) { | |||||
c.push('markers=' + a.markers); | |||||
} | |||||
if (a.labels) { | |||||
c.push('labels=' + a.labels); | |||||
} | |||||
if (a.paths) { | |||||
c.push('paths=' + a.paths); | |||||
} | |||||
if (a.traffic) { | |||||
c.push('traffic=' + a.traffic); | |||||
} | |||||
e = 'https://restapi.amap.com/v3/staticmap?' + c.join('&'); | |||||
a.success({ | |||||
url: e | |||||
}); | |||||
} | |||||
var c = []; | |||||
c.push('key=' + this.key); | |||||
var d = this.requestConfig; | |||||
c.push('s=' + d.s); | |||||
c.push('platform=' + d.platform); | |||||
c.push('appname=' + d.appname); | |||||
c.push('sdkversion=' + d.sdkversion); | |||||
c.push('logversion=' + d.logversion); | |||||
a.location | |||||
? b(a.location) | |||||
: this.getWxLocation(a, function (e) { | |||||
b(e); | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getInputtips = function (a) { | |||||
var b = Object.assign({}, this.requestConfig); | |||||
if (a.location) { | |||||
b.location = a.location; | |||||
} | |||||
if (a.keywords) { | |||||
b.keywords = a.keywords; | |||||
} | |||||
if (a.type) { | |||||
b.type = a.type; | |||||
} | |||||
if (a.city) { | |||||
b.city = a.city; | |||||
} | |||||
if (a.citylimit) { | |||||
b.citylimit = a.citylimit; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/assistant/inputtips', | |||||
data: b, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (c) { | |||||
if (c && c.data && c.data.tips) { | |||||
a.success({ | |||||
tips: c.data.tips | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (c) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: c.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getDrivingRoute = function (a) { | |||||
var b = Object.assign({}, this.requestConfig); | |||||
if (a.origin) { | |||||
b.origin = a.origin; | |||||
} | |||||
if (a.destination) { | |||||
b.destination = a.destination; | |||||
} | |||||
if (a.strategy) { | |||||
b.strategy = a.strategy; | |||||
} | |||||
if (a.waypoints) { | |||||
b.waypoints = a.waypoints; | |||||
} | |||||
if (a.avoidpolygons) { | |||||
b.avoidpolygons = a.avoidpolygons; | |||||
} | |||||
if (a.avoidroad) { | |||||
b.avoidroad = a.avoidroad; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/direction/driving', | |||||
data: b, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (c) { | |||||
if (c && c.data && c.data.route) { | |||||
a.success({ | |||||
paths: c.data.route.paths, | |||||
taxi_cost: c.data.route.taxi_cost || '' | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (c) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: c.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getWalkingRoute = function (a) { | |||||
var b = Object.assign({}, this.requestConfig); | |||||
if (a.origin) { | |||||
b.origin = a.origin; | |||||
} | |||||
if (a.destination) { | |||||
b.destination = a.destination; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/direction/walking', | |||||
data: b, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (c) { | |||||
if (c && c.data && c.data.route) { | |||||
a.success({ | |||||
paths: c.data.route.paths | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (c) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: c.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getTransitRoute = function (a) { | |||||
var b = Object.assign({}, this.requestConfig); | |||||
if (a.origin) { | |||||
b.origin = a.origin; | |||||
} | |||||
if (a.destination) { | |||||
b.destination = a.destination; | |||||
} | |||||
if (a.strategy) { | |||||
b.strategy = a.strategy; | |||||
} | |||||
if (a.city) { | |||||
b.city = a.city; | |||||
} | |||||
if (a.cityd) { | |||||
b.cityd = a.cityd; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/direction/transit/integrated', | |||||
data: b, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (c) { | |||||
if (c && c.data && c.data.route) { | |||||
c = c.data.route; | |||||
a.success({ | |||||
distance: c.distance || '', | |||||
taxi_cost: c.taxi_cost || '', | |||||
transits: c.transits | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (c) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: c.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
AMapWX.prototype.getRidingRoute = function (a) { | |||||
var b = Object.assign({}, this.requestConfig); | |||||
if (a.origin) { | |||||
b.origin = a.origin; | |||||
} | |||||
if (a.destination) { | |||||
b.destination = a.destination; | |||||
} | |||||
uni.request({ | |||||
url: 'https://restapi.amap.com/v3/direction/riding', | |||||
data: b, | |||||
method: 'GET', | |||||
header: { | |||||
'content-type': 'application/json' | |||||
}, | |||||
success: function (c) { | |||||
if (c && c.data && c.data.route) { | |||||
a.success({ | |||||
paths: c.data.route.paths | |||||
}); | |||||
} | |||||
}, | |||||
fail: function (c) { | |||||
a.fail({ | |||||
errCode: '0', | |||||
errMsg: c.errMsg || '' | |||||
}); | |||||
} | |||||
}); | |||||
}; | |||||
export default { AMapWX }; |
@@ -0,0 +1,85 @@ | |||||
# wx-promise-pro | |||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | |||||
[](#contributors-) | |||||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | |||||
✨ 强大、优雅的微信小程序异步库 🚀 | |||||
[](https://www.npmjs.com/package/wx-promise-pro) [](https://www.npmjs.com/package/wx-promise-pro) [](https://opencollective.com/wx-promise-pro) | |||||
[](https://nodei.co/npm/wx-promise-pro/) | |||||
## 优势 | |||||
- 方便集成:一处引用,处处使用 | |||||
- 把微信小程序所有异步 API promise 化并挂在到`wx.pro` 对象下 | |||||
- 支持 ES2018 `finally` 特性 | |||||
- 支持 TypeScript 开发 | |||||
## 安装 | |||||
> 你也可以直接把 `dist` 目录下的 `wx-promise-pro.js` 拷贝到项目里使用 | |||||
```bash | |||||
$ npm i wx-promise-pro -S | |||||
# or | |||||
$ yarn add wx-promise-pro | |||||
``` | |||||
## 初始化 | |||||
```js | |||||
import { promisifyAll, promisify } from 'wx-promise-pro'; | |||||
// promisify all wx‘s api | |||||
promisifyAll(); | |||||
// promisify single api | |||||
promisify(wx.getSystemInfo)().then(console.log); | |||||
``` | |||||
## 示例代码 | |||||
```js | |||||
wx.pro.showLoading({ | |||||
title: '加载中', | |||||
mask: true, | |||||
}); | |||||
wx.pro | |||||
.request({ | |||||
url: 'https://cnodejs.org/api/v1/topics', | |||||
data: {}, | |||||
method: 'GET', | |||||
header: { 'content-type': 'application/json' }, | |||||
}) | |||||
.then((res) => { | |||||
console.log(res); | |||||
}) | |||||
.catch((err) => { | |||||
console.log(err); | |||||
}) | |||||
.finally(() => { | |||||
wx.pro.hideLoading(); | |||||
}); | |||||
``` | |||||
## 贡献者 ✨ | |||||
感谢如下贡献者的贡献 ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | |||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | |||||
<!-- prettier-ignore-start --> | |||||
<!-- markdownlint-disable --> | |||||
<table> | |||||
<tr> | |||||
<td align="center"><a href="https://github.com/wss534857356"><img src="https://avatars0.githubusercontent.com/u/13204332?s=60&v=4" width="100px;" alt=""/><br /><sub><b>Shenshun Weng</b></sub></a><br /><a href="https://github.com/youngjuning/wx-promise-pro/commits?author=youngjuning" title="Code">💻</a></td> | |||||
<td align="center"><a href="https://github.com/kala888"><img src="https://avatars2.githubusercontent.com/u/1215976?v=4" width="100px;" alt=""/><br /><sub><b>kala888</b></sub></a><br /><a href="https://github.com/youngjuning/wx-promise-pro/commits?author=kala888" title="Code">💻</a></td> | |||||
<td align="center"><a href="https://upupming.site"><img src="https://avatars1.githubusercontent.com/u/24741764?v=4" width="100px;" alt=""/><br /><sub><b>Yiming Li</b></sub></a><br /><a href="https://github.com/youngjuning/wx-promise-pro/issues?q=author%3Aupupming" title="Bug reports">🐛</a></td> | |||||
</tr> | |||||
</table> | |||||
<!-- markdownlint-enable --> | |||||
<!-- prettier-ignore-end --> | |||||
<!-- ALL-CONTRIBUTORS-LIST:END --> |
@@ -0,0 +1,39 @@ | |||||
import { asyncMethods } from './methods'; | |||||
// polyfill for finally | |||||
if (!Promise.prototype.finally) { | |||||
Promise.prototype.finally = function (callback) { | |||||
const P = this.constructor; | |||||
return this.then( | |||||
(value) => P.resolve(callback()).then(() => value), | |||||
(reason) => | |||||
P.resolve(callback()).then(() => { | |||||
throw reason; | |||||
}) | |||||
); | |||||
}; | |||||
} | |||||
// core method | |||||
export const promisify = (api) => { | |||||
return (args = {}) => { | |||||
return new Promise((resolve, reject) => { | |||||
api({ | |||||
fail: reject, | |||||
success: resolve, | |||||
...args | |||||
}); | |||||
}); | |||||
}; | |||||
}; | |||||
export const promisifyAll = () => { | |||||
uni.pro = {}; | |||||
Object.keys(wx).forEach((key) => { | |||||
if (asyncMethods.indexOf(key) >= 0) { | |||||
uni.pro[key] = promisify(uni[key]); | |||||
} else if (key !== 'createSignal') { | |||||
uni.pro[key] = uni[key]; | |||||
} | |||||
}); | |||||
}; | |||||
export default promisifyAll; |
@@ -0,0 +1,2 @@ | |||||
// 指定微信api支持Promise风格 | |||||
export const asyncMethods = ['downloadFile', 'request', 'uploadFile', 'connectSocket']; |
@@ -0,0 +1,93 @@ | |||||
import App from './App'; | |||||
// 全局mixins,用于实现setData等功能,请勿删除!'; | |||||
// import zpMixins from '@/uni_modules/zp-mixins/index.js'; | |||||
// 2. 引入组件样式 | |||||
import 'vant/lib/index.css'; | |||||
import { | |||||
Button, | |||||
Tab, | |||||
Tabs, | |||||
Empty, | |||||
Loading, | |||||
Icon, | |||||
CellGroup, | |||||
Cell, | |||||
NavBar, | |||||
Popup, | |||||
Picker, | |||||
Rate, | |||||
SwipeCell, | |||||
Search, | |||||
Uploader, | |||||
NoticeBar, | |||||
Checkbox, | |||||
Cascader, | |||||
Grid, | |||||
GridItem, | |||||
Dialog, | |||||
Field, | |||||
TimePicker, | |||||
DatePicker, | |||||
Form | |||||
} from 'vant'; | |||||
import share from '@/utils/share.js' | |||||
import tootls from './utils/util.map.js' | |||||
// #ifndef VUE3 | |||||
import Vue from 'vue'; | |||||
// Vue.prototype.$tootls = tootls | |||||
// 导入并挂载全局的分享方法 | |||||
Vue.config.productionTip = false; | |||||
App.mpType = 'app'; | |||||
const app = new Vue({ | |||||
...App | |||||
}); | |||||
app.$mount(); | |||||
// #endif | |||||
// #ifdef VUE3 | |||||
import { | |||||
createSSRApp | |||||
} from 'vue'; | |||||
export function createApp() { | |||||
const app = createSSRApp(App); | |||||
app.config.globalProperties.$tootls = tootls; | |||||
app.use(Button); | |||||
app.use(Tab); | |||||
app.use(Tabs); | |||||
app.use(Empty); | |||||
app.use(Loading); | |||||
app.use(Icon); | |||||
app.use(CellGroup); | |||||
app.use(Cell); | |||||
app.use(NavBar); | |||||
app.use(Popup); | |||||
app.use(Picker); | |||||
app.use(Rate); | |||||
app.use(SwipeCell); | |||||
app.use(Search); | |||||
app.use(Uploader); | |||||
app.use(NoticeBar); | |||||
app.use(Checkbox); | |||||
app.use(Cascader); | |||||
app.use(Grid); | |||||
app.use(GridItem); | |||||
app.use(Dialog); | |||||
app.use(Field); | |||||
app.use(TimePicker); | |||||
app.use(DatePicker); | |||||
app.use(Form); | |||||
// app.mixin(zpMixins); | |||||
return { | |||||
app | |||||
}; | |||||
} | |||||
// #endif |
@@ -0,0 +1,83 @@ | |||||
{ | |||||
"name" : "", | |||||
"appid" : "", | |||||
"description" : "", | |||||
"versionName" : "1.0.0", | |||||
"versionCode" : "100", | |||||
"transformPx" : false, | |||||
/* 5+App特有相关 */ | |||||
"app-plus" : { | |||||
"usingComponents" : true, | |||||
"nvueStyleCompiler" : "uni-app", | |||||
"compilerVersion" : 3, | |||||
"splashscreen" : { | |||||
"alwaysShowBeforeRender" : true, | |||||
"waiting" : true, | |||||
"autoclose" : true, | |||||
"delay" : 0 | |||||
}, | |||||
/* 模块配置 */ | |||||
"modules" : {}, | |||||
/* 应用发布信息 */ | |||||
"distribute" : { | |||||
/* android打包配置 */ | |||||
"android" : { | |||||
"permissions" : [ | |||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", | |||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", | |||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", | |||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>", | |||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", | |||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", | |||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", | |||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", | |||||
"<uses-feature android:name=\"android.hardware.camera\"/>", | |||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" | |||||
] | |||||
}, | |||||
/* ios打包配置 */ | |||||
"ios" : {}, | |||||
/* SDK配置 */ | |||||
"sdkConfigs" : {} | |||||
} | |||||
}, | |||||
/* 快应用特有相关 */ | |||||
"quickapp" : {}, | |||||
/* 小程序特有相关 */ | |||||
"mp-weixin" : { | |||||
"appid" : "", | |||||
"setting" : { | |||||
"urlCheck" : false | |||||
}, | |||||
"usingComponents" : true | |||||
}, | |||||
"mp-alipay" : { | |||||
"usingComponents" : true | |||||
}, | |||||
"mp-baidu" : { | |||||
"usingComponents" : true | |||||
}, | |||||
"mp-toutiao" : { | |||||
"usingComponents" : true | |||||
}, | |||||
"uniStatistics" : { | |||||
"enable" : false | |||||
}, | |||||
"vueVersion" : "3", | |||||
"h5" : { | |||||
"sdkConfigs" : { | |||||
"maps" : { | |||||
"amap" : { | |||||
"key" : "29103dae675e5788eb011fb77ade8e3f", | |||||
"securityJsCode" : "", | |||||
"serviceHost" : "" | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,518 @@ | |||||
module.exports = (function () { | |||||
var __MODS__ = {}; | |||||
var __DEFINE__ = function (modId, func, req) { | |||||
var m = { | |||||
exports: {}, | |||||
_tempexports: {} | |||||
}; | |||||
__MODS__[modId] = { | |||||
status: 0, | |||||
func: func, | |||||
req: req, | |||||
m: m | |||||
}; | |||||
}; | |||||
var __REQUIRE__ = function (modId, source) { | |||||
if (!__MODS__[modId]) { | |||||
return require(source); | |||||
} | |||||
if (!__MODS__[modId].status) { | |||||
var m = __MODS__[modId].m; | |||||
m._exports = m._tempexports; | |||||
var desp = Object.getOwnPropertyDescriptor(m, 'exports'); | |||||
if (desp && desp.configurable) { | |||||
Object.defineProperty(m, 'exports', { | |||||
set: function (val) { | |||||
if (typeof val === 'object' && val !== m._exports) { | |||||
m._exports.__proto__ = val.__proto__; | |||||
Object.keys(val).forEach(function (k) { | |||||
m._exports[k] = val[k]; | |||||
}); | |||||
} | |||||
m._tempexports = val; | |||||
}, | |||||
get: function () { | |||||
return m._tempexports; | |||||
} | |||||
}); | |||||
} | |||||
__MODS__[modId].status = 1; | |||||
__MODS__[modId].func(__MODS__[modId].req, m, m.exports); | |||||
} | |||||
return __MODS__[modId].m.exports; | |||||
}; | |||||
__DEFINE__( | |||||
1683361815807, | |||||
function (require, module, exports) { | |||||
!(function (t, e) { | |||||
if ('object' == typeof exports && 'undefined' != typeof module) { | |||||
module.exports = e(); | |||||
} else { | |||||
if ('function' == typeof define && define.amd) { | |||||
define(e); | |||||
} else { | |||||
(t = 'undefined' != typeof globalThis ? globalThis : t || self).dayjs = e(); | |||||
} | |||||
} | |||||
})(this, function () { | |||||
var t = 1000; | |||||
var e = 60000; | |||||
var n = 3600000; | |||||
var r = 'millisecond'; | |||||
var i = 'second'; | |||||
var s = 'minute'; | |||||
var u = 'hour'; | |||||
var a = 'day'; | |||||
var o = 'week'; | |||||
var f = 'month'; | |||||
var h = 'quarter'; | |||||
var c = 'year'; | |||||
var d = 'date'; | |||||
var l = 'Invalid Date'; | |||||
var $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/; | |||||
var y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g; | |||||
var M = { | |||||
name: 'en', | |||||
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), | |||||
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), | |||||
ordinal: function (t) { | |||||
var e = ['th', 'st', 'nd', 'rd']; | |||||
var n = t % 100; | |||||
return '[' + t + (e[(n - 20) % 10] || e[n] || e[0]) + ']'; | |||||
} | |||||
}; | |||||
var m = function (t, e, n) { | |||||
var r = String(t); | |||||
return !r || r.length >= e ? t : '' + Array(e + 1 - r.length).join(n) + t; | |||||
}; | |||||
var v = { | |||||
s: m, | |||||
z: function (t) { | |||||
var e = -t.utcOffset(); | |||||
var n = Math.abs(e); | |||||
var r = Math.floor(n / 60); | |||||
var i = n % 60; | |||||
return (e <= 0 ? '+' : '-') + m(r, 2, '0') + ':' + m(i, 2, '0'); | |||||
}, | |||||
m: function t(e, n) { | |||||
if (e.date() < n.date()) { | |||||
return -t(n, e); | |||||
} | |||||
var r = 12 * (n.year() - e.year()) + (n.month() - e.month()); | |||||
var i = e.clone().add(r, f); | |||||
var s = n - i < 0; | |||||
var u = e.clone().add(r + (s ? -1 : 1), f); | |||||
return +(-(r + (n - i) / (s ? i - u : u - i)) || 0); | |||||
}, | |||||
a: function (t) { | |||||
return t < 0 ? Math.ceil(t) || 0 : Math.floor(t); | |||||
}, | |||||
p: function (t) { | |||||
return ( | |||||
{ | |||||
M: f, | |||||
y: c, | |||||
w: o, | |||||
d: a, | |||||
D: d, | |||||
h: u, | |||||
m: s, | |||||
s: i, | |||||
ms: r, | |||||
Q: h | |||||
}[t] || | |||||
String(t || '') | |||||
.toLowerCase() | |||||
.replace(/s$/, '') | |||||
); | |||||
}, | |||||
u: function (t) { | |||||
return void 0 === t; | |||||
} | |||||
}; | |||||
var g = 'en'; | |||||
var D = {}; | |||||
D[g] = M; | |||||
var p = function (t) { | |||||
return t instanceof _; | |||||
}; | |||||
var S = function t(e, n, r) { | |||||
var i; | |||||
if (!e) { | |||||
return g; | |||||
} | |||||
if ('string' == typeof e) { | |||||
var s = e.toLowerCase(); | |||||
if (D[s]) { | |||||
i = s; | |||||
} | |||||
if (n) { | |||||
D[s] = n; | |||||
i = s; | |||||
} | |||||
var u = e.split('-'); | |||||
if (!i && u.length > 1) { | |||||
return t(u[0]); | |||||
} | |||||
} else { | |||||
var a = e.name; | |||||
D[a] = e; | |||||
i = a; | |||||
} | |||||
if (!r && i) { | |||||
g = i; | |||||
} | |||||
return i || (!r && g); | |||||
}; | |||||
var w = function (t, e) { | |||||
if (p(t)) { | |||||
return t.clone(); | |||||
} | |||||
if ('object' == typeof e) { | |||||
var n = e; | |||||
} else { | |||||
var n = {}; | |||||
} | |||||
n.date = t; | |||||
n.args = arguments; | |||||
return new _(n); | |||||
}; | |||||
var O = v; | |||||
O.l = S; | |||||
O.i = p; | |||||
O.w = function (t, e) { | |||||
return w(t, { | |||||
locale: e.$L, | |||||
utc: e.$u, | |||||
x: e.$x, | |||||
$offset: e.$offset | |||||
}); | |||||
}; | |||||
var _ = (function () { | |||||
function M(t) { | |||||
this.$L = S(t.locale, null, true); | |||||
this.parse(t); | |||||
} | |||||
var m = M.prototype; | |||||
m.parse = function (t) { | |||||
this.$d = (function (t) { | |||||
var e = t.date; | |||||
var n = t.utc; | |||||
if (null === e) { | |||||
return new Date(NaN); | |||||
} | |||||
if (O.u(e)) { | |||||
return new Date(); | |||||
} | |||||
if (e instanceof Date) { | |||||
return new Date(e); | |||||
} | |||||
if ('string' == typeof e && !/Z$/i.test(e)) { | |||||
var r = e.match($); | |||||
if (r) { | |||||
var i = r[2] - 1 || 0; | |||||
var s = (r[7] || '0').substring(0, 3); | |||||
return n | |||||
? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) | |||||
: new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s); | |||||
} | |||||
} | |||||
return new Date(e); | |||||
})(t); | |||||
this.$x = t.x || {}; | |||||
this.init(); | |||||
}; | |||||
m.init = function () { | |||||
var t = this.$d; | |||||
this.$y = t.getFullYear(); | |||||
this.$M = t.getMonth(); | |||||
this.$D = t.getDate(); | |||||
this.$W = t.getDay(); | |||||
this.$H = t.getHours(); | |||||
this.$m = t.getMinutes(); | |||||
this.$s = t.getSeconds(); | |||||
this.$ms = t.getMilliseconds(); | |||||
}; | |||||
m.$utils = function () { | |||||
return O; | |||||
}; | |||||
m.isValid = function () { | |||||
return !(this.$d.toString() === l); | |||||
}; | |||||
m.isSame = function (t, e) { | |||||
var n = w(t); | |||||
return this.startOf(e) <= n && n <= this.endOf(e); | |||||
}; | |||||
m.isAfter = function (t, e) { | |||||
return w(t) < this.startOf(e); | |||||
}; | |||||
m.isBefore = function (t, e) { | |||||
return this.endOf(e) < w(t); | |||||
}; | |||||
m.$g = function (t, e, n) { | |||||
return O.u(t) ? this[e] : this.set(n, t); | |||||
}; | |||||
m.unix = function () { | |||||
return Math.floor(this.valueOf() / 1000); | |||||
}; | |||||
m.valueOf = function () { | |||||
return this.$d.getTime(); | |||||
}; | |||||
m.startOf = function (t, e) { | |||||
var that = this; | |||||
var r = !!O.u(e) || e; | |||||
var h = O.p(t); | |||||
var l = function (t, e) { | |||||
var i = O.w(that.$u ? Date.UTC(that.$y, e, t) : new Date(that.$y, e, t), that); | |||||
return r ? i : i.endOf(a); | |||||
}; | |||||
var $ = function (t, e) { | |||||
return O.w(that.toDate()[t].apply(that.toDate('s'), (r ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), that); | |||||
}; | |||||
var y = this.$W; | |||||
var M = this.$M; | |||||
var m = this.$D; | |||||
var v = 'set' + (this.$u ? 'UTC' : ''); | |||||
switch (h) { | |||||
case c: | |||||
return r ? l(1, 0) : l(31, 11); | |||||
case f: | |||||
return r ? l(1, M) : l(0, M + 1); | |||||
case o: | |||||
var g = this.$locale().weekStart || 0; | |||||
var D = (y < g ? y + 7 : y) - g; | |||||
return l(r ? m - D : m + (6 - D), M); | |||||
case a: | |||||
case d: | |||||
return $(v + 'Hours', 0); | |||||
case u: | |||||
return $(v + 'Minutes', 1); | |||||
case s: | |||||
return $(v + 'Seconds', 2); | |||||
case i: | |||||
return $(v + 'Milliseconds', 3); | |||||
default: | |||||
return this.clone(); | |||||
} | |||||
}; | |||||
m.endOf = function (t) { | |||||
return this.startOf(t, false); | |||||
}; | |||||
m.$set = function (t, e) { | |||||
var n; | |||||
var o = O.p(t); | |||||
var h = 'set' + (this.$u ? 'UTC' : ''); | |||||
var l = ((n = {}), | |||||
(n[a] = h + 'Date'), | |||||
(n[d] = h + 'Date'), | |||||
(n[f] = h + 'Month'), | |||||
(n[c] = h + 'FullYear'), | |||||
(n[u] = h + 'Hours'), | |||||
(n[s] = h + 'Minutes'), | |||||
(n[i] = h + 'Seconds'), | |||||
(n[r] = h + 'Milliseconds'), | |||||
n)[o]; | |||||
if (o === a) { | |||||
var $ = this.$D + (e - this.$W); | |||||
} else { | |||||
var $ = e; | |||||
} | |||||
if (o === f || o === c) { | |||||
var y = this.clone().set(d, 1); | |||||
y.$d[l]($); | |||||
y.init(); | |||||
this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d; | |||||
} else { | |||||
if (l) { | |||||
this.$d[l]($); | |||||
} | |||||
} | |||||
this.init(); | |||||
return this; | |||||
}; | |||||
m.set = function (t, e) { | |||||
return this.clone().$set(t, e); | |||||
}; | |||||
m.get = function (t) { | |||||
return this[O.p(t)](); | |||||
}; | |||||
m.add = function (r, h) { | |||||
var d; | |||||
var that = this; | |||||
r = Number(r); | |||||
var $ = O.p(h); | |||||
var y = function (t) { | |||||
var e = w(that); | |||||
return O.w(e.date(e.date() + Math.round(t * r)), that); | |||||
}; | |||||
if ($ === f) { | |||||
return this.set(f, this.$M + r); | |||||
} | |||||
if ($ === c) { | |||||
return this.set(c, this.$y + r); | |||||
} | |||||
if ($ === a) { | |||||
return y(1); | |||||
} | |||||
if ($ === o) { | |||||
return y(7); | |||||
} | |||||
var M = ((d = {}), (d[s] = e), (d[u] = n), (d[i] = t), d)[$] || 1; | |||||
var m = this.$d.getTime() + r * M; | |||||
return O.w(m, this); | |||||
}; | |||||
m.subtract = function (t, e) { | |||||
return this.add(-1 * t, e); | |||||
}; | |||||
m.format = function (t) { | |||||
var that = this; | |||||
var n = this.$locale(); | |||||
if (!this.isValid()) { | |||||
return n.invalidDate || l; | |||||
} | |||||
var r = t || 'YYYY-MM-DDTHH:mm:ssZ'; | |||||
var i = O.z(this); | |||||
var s = this.$H; | |||||
var u = this.$m; | |||||
var a = this.$M; | |||||
var o = n.weekdays; | |||||
var f = n.months; | |||||
var h = function (t, n, i, s) { | |||||
return (t && (t[n] || t(that, r))) || i[n].slice(0, s); | |||||
}; | |||||
var c = function (t) { | |||||
return O.s(s % 12 || 12, t, '0'); | |||||
}; | |||||
var d = | |||||
n.meridiem || | |||||
function (t, e, n) { | |||||
var r = t < 12 ? 'AM' : 'PM'; | |||||
return n ? r.toLowerCase() : r; | |||||
}; | |||||
var $ = { | |||||
YY: String(this.$y).slice(-2), | |||||
YYYY: this.$y, | |||||
M: a + 1, | |||||
MM: O.s(a + 1, 2, '0'), | |||||
MMM: h(n.monthsShort, a, f, 3), | |||||
MMMM: h(f, a), | |||||
D: this.$D, | |||||
DD: O.s(this.$D, 2, '0'), | |||||
d: String(this.$W), | |||||
dd: h(n.weekdaysMin, this.$W, o, 2), | |||||
ddd: h(n.weekdaysShort, this.$W, o, 3), | |||||
dddd: o[this.$W], | |||||
H: String(s), | |||||
HH: O.s(s, 2, '0'), | |||||
h: c(1), | |||||
hh: c(2), | |||||
a: d(s, u, true), | |||||
A: d(s, u, false), | |||||
m: String(u), | |||||
mm: O.s(u, 2, '0'), | |||||
s: String(this.$s), | |||||
ss: O.s(this.$s, 2, '0'), | |||||
SSS: O.s(this.$ms, 3, '0'), | |||||
Z: i | |||||
}; | |||||
return r.replace(y, function (t, e) { | |||||
return e || $[t] || i.replace(':', ''); | |||||
}); | |||||
}; | |||||
m.utcOffset = function () { | |||||
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); | |||||
}; | |||||
m.diff = function (r, d, l) { | |||||
var $; | |||||
var y = O.p(d); | |||||
var M = w(r); | |||||
var m = (M.utcOffset() - this.utcOffset()) * e; | |||||
var v = this - M; | |||||
var g = O.m(this, M); | |||||
g = | |||||
(($ = {}), | |||||
($[c] = g / 12), | |||||
($[f] = g), | |||||
($[h] = g / 3), | |||||
($[o] = (v - m) / 604800000), | |||||
($[a] = (v - m) / 86400000), | |||||
($[u] = v / n), | |||||
($[s] = v / e), | |||||
($[i] = v / t), | |||||
$)[y] || v; | |||||
return l ? g : O.a(g); | |||||
}; | |||||
m.daysInMonth = function () { | |||||
return this.endOf(f).$D; | |||||
}; | |||||
m.$locale = function () { | |||||
return D[this.$L]; | |||||
}; | |||||
m.locale = function (t, e) { | |||||
if (!t) { | |||||
return this.$L; | |||||
} | |||||
var n = this.clone(); | |||||
var r = S(t, e, true); | |||||
if (r) { | |||||
n.$L = r; | |||||
} | |||||
return n; | |||||
}; | |||||
m.clone = function () { | |||||
return O.w(this.$d, this); | |||||
}; | |||||
m.toDate = function () { | |||||
return new Date(this.valueOf()); | |||||
}; | |||||
m.toJSON = function () { | |||||
return this.isValid() ? this.toISOString() : null; | |||||
}; | |||||
m.toISOString = function () { | |||||
return this.$d.toISOString(); | |||||
}; | |||||
m.toString = function () { | |||||
return this.$d.toUTCString(); | |||||
}; | |||||
return M; | |||||
})(); | |||||
var T = _.prototype; | |||||
w.prototype = T; | |||||
[ | |||||
['$ms', r], | |||||
['$s', i], | |||||
['$m', s], | |||||
['$H', u], | |||||
['$W', a], | |||||
['$M', f], | |||||
['$y', c], | |||||
['$D', d] | |||||
].forEach(function (t) { | |||||
T[t[1]] = function (e) { | |||||
return this.$g(e, t[0], t[1]); | |||||
}; | |||||
}); | |||||
w.extend = function (t, e) { | |||||
t.$i || (t(e, _, w), (t.$i = true)); | |||||
return w; | |||||
}; | |||||
w.locale = S; | |||||
w.isDayjs = p; | |||||
w.unix = function (t) { | |||||
return w(1000 * t); | |||||
}; | |||||
w.en = D[g]; | |||||
w.Ls = D; | |||||
w.p = {}; | |||||
return w; | |||||
}); | |||||
}, | |||||
function (modId) { | |||||
var map = {}; | |||||
return __REQUIRE__(map[modId], modId); | |||||
} | |||||
); | |||||
return __REQUIRE__(1683361815807); | |||||
})(); | |||||
//miniprogram-npm-outsideDeps=[] | |||||
//# sourceMappingURL=index.js.map |
@@ -0,0 +1,252 @@ | |||||
<template> | |||||
<view :class="'_root ' + (selectable ? '_select' : '')" :style="containerStyle"> | |||||
<slot v-if="!nodes[0]" /> | |||||
<node id="_root" :childs="nodes" :opts="[lazyLoad, loadingImg, errorImg, showImgMenu, selectable]" @add.stop.prevent="addFun($event, { tagId: '_root' })" /> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
'use strict'; | |||||
import node from './node/node'; | |||||
function e(e, t, n) { | |||||
if (t in e) { | |||||
Object.defineProperty(e, t, { | |||||
value: n, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}); | |||||
} else { | |||||
e[t] = n; | |||||
} | |||||
return e; | |||||
} | |||||
/*! | |||||
* mp-html v2.4.1 | |||||
* https://github.com/jin-yufeng/mp-html | |||||
* | |||||
* Released under the MIT license | |||||
* Author: Jin Yufeng | |||||
*/ | |||||
var t = require('./parser'); | |||||
var n = []; | |||||
export default { | |||||
components: { | |||||
node | |||||
}, | |||||
data() { | |||||
return { | |||||
nodes: [] | |||||
}; | |||||
}, | |||||
props: { | |||||
containerStyle: String, | |||||
content: { | |||||
type: String, | |||||
default: '' | |||||
}, | |||||
copyLink: { | |||||
type: Boolean, | |||||
default: true | |||||
}, | |||||
domain: String, | |||||
errorImg: String, | |||||
lazyLoad: Boolean, | |||||
loadingImg: String, | |||||
pauseVideo: { | |||||
type: Boolean, | |||||
default: true | |||||
}, | |||||
previewImg: { | |||||
type: Boolean, | |||||
default: true | |||||
}, | |||||
scrollTable: Boolean, | |||||
selectable: null, | |||||
setTitle: { | |||||
type: Boolean, | |||||
default: true | |||||
}, | |||||
showImgMenu: { | |||||
type: Boolean, | |||||
default: true | |||||
}, | |||||
tagStyle: Object, | |||||
useAnchor: null | |||||
}, | |||||
created: function () { | |||||
this.plugins = []; | |||||
for (var e = n.length; e--; ) { | |||||
this.plugins.push(new n[e](this)); | |||||
} | |||||
}, | |||||
destroyed: function () { | |||||
this.hookFun('onDetached'); | |||||
}, | |||||
methods: { | |||||
inFun: function (e, t, n) { | |||||
if (e && t && n) { | |||||
this._in = { | |||||
page: e, | |||||
selector: t, | |||||
scrollTop: n | |||||
}; | |||||
} | |||||
}, | |||||
navigateTo: function (t, n) { | |||||
var that = this; | |||||
return new Promise(function (o, r) { | |||||
if (!that.useAnchor) { | |||||
return void r(Error('Anchor is disabled')); | |||||
} | |||||
var a = uni | |||||
.createSelectorQuery() | |||||
.in(that._in ? that._in.page : that) | |||||
.select((that._in ? that._in.selector : '._root') + (t ? ''.concat('>>>', '#').concat(t) : '')) | |||||
.boundingClientRect(); | |||||
that._in ? a.select(that._in.selector).scrollOffset().select(that._in.selector).boundingClientRect() : a.selectViewport().scrollOffset(); | |||||
a.exec(function (t) { | |||||
if (!t[0]) { | |||||
return void r(Error('Label not found')); | |||||
} | |||||
var a = t[1].scrollTop + t[0].top - (t[2] ? t[2].top : 0) + (n || parseInt(that.useAnchor) || 0); | |||||
that._in | |||||
? that._in.page.setData(e({}, that._in.scrollTop, a)) | |||||
: uni.pageScrollTo({ | |||||
scrollTop: a, | |||||
duration: 300 | |||||
}); | |||||
o(); | |||||
}); | |||||
}); | |||||
}, | |||||
getText: function (e) { | |||||
var t = ''; | |||||
(function e(n) { | |||||
for (var i = 0; i < n.length; i++) { | |||||
var o = n[i]; | |||||
if ('text' === o.type) t += o.text.replace(/&/g, '&'); | |||||
else if ('br' === o.name) { | |||||
t += '\n'; | |||||
} else { | |||||
var r = 'p' === o.name || 'div' === o.name || 'tr' === o.name || 'li' === o.name || ('h' === o.name[0] && o.name[1] > '0' && o.name[1] < '7'); | |||||
if (r && t && '\n' !== t[t.length - 1]) { | |||||
t += '\n'; | |||||
} | |||||
if (o.children) { | |||||
e(o.children); | |||||
} | |||||
r && '\n' !== t[t.length - 1] ? (t += '\n') : ('td' !== o.name && 'th' !== o.name) || (t += '\t'); | |||||
} | |||||
} | |||||
})(e || this.nodes); | |||||
return t; | |||||
}, | |||||
getRect: function () { | |||||
var that = this; | |||||
return new Promise(function (t, n) { | |||||
uni.createSelectorQuery() | |||||
.in(that) | |||||
.select('._root') | |||||
.boundingClientRect() | |||||
.exec(function (e) { | |||||
return e[0] ? t(e[0]) : n(Error('Root label not found')); | |||||
}); | |||||
}); | |||||
}, | |||||
pauseMedia: function () { | |||||
for (var e = (this._videos || []).length; e--; ) { | |||||
this._videos[e].pause(); | |||||
} | |||||
}, | |||||
setPlaybackRate: function (e) { | |||||
this.playbackRate = e; | |||||
for (var t = (this._videos || []).length; t--; ) { | |||||
this._videos[t].playbackRate(e); | |||||
} | |||||
}, | |||||
setContent: function (e, n) { | |||||
var that = this; | |||||
(this.imgList && n) || (this.imgList = []); | |||||
this._videos = []; | |||||
var o = {}; | |||||
var r = new t(this).parse(e); | |||||
if (n) { | |||||
for (a = this.nodes.length, s = r.length, void 0; s--; ) { | |||||
var a; | |||||
var s; | |||||
o['nodes['.concat(a + s, ']')] = r[s]; | |||||
} | |||||
} else { | |||||
o.nodes = r; | |||||
} | |||||
this.setData(o, function () { | |||||
that.hookFun('onLoad'); | |||||
that.$emit('load'); | |||||
}); | |||||
if (this.lazyLoad || this.imgList._unloadimgs < this.imgList.length / 2) { | |||||
var l = 0; | |||||
var c = function e(t) { | |||||
(t && t.height) || (t = {}); | |||||
t.height === l | |||||
? that.$emit('ready', { | |||||
detail: t | |||||
}) | |||||
: ((l = t.height), | |||||
setTimeout(function () { | |||||
that.getRect().then(e).catch(e); | |||||
}, 350)); | |||||
}; | |||||
this.getRect().then(c).catch(c); | |||||
} else { | |||||
this.imgList._unloadimgs || | |||||
this.getRect() | |||||
.then(function (e) { | |||||
that.$emit('ready', { | |||||
detail: e | |||||
}); | |||||
}) | |||||
.catch(function () { | |||||
that.$emit('ready', { | |||||
detail: {} | |||||
}); | |||||
}); | |||||
} | |||||
}, | |||||
hookFun: function (e) { | |||||
for (var t = n.length; t--; ) { | |||||
if (this.plugins[t][e]) { | |||||
this.plugins[t][e](); | |||||
} | |||||
} | |||||
}, | |||||
addFun: function (e, _dataset) { | |||||
/* ---处理dataset begin--- */ | |||||
this.handleDataset(e, _dataset); | |||||
/* ---处理dataset end--- */ | |||||
e.detail.root = this; | |||||
} | |||||
}, | |||||
watch: { | |||||
content: { | |||||
handler: function (e) { | |||||
this.setContent(e); | |||||
}, | |||||
immediate: true | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style> | |||||
._root { | |||||
padding: 1px 0; | |||||
overflow-x: auto; | |||||
overflow-y: hidden; | |||||
-webkit-overflow-scrolling: touch; | |||||
} | |||||
._select { | |||||
-webkit-user-select: text; | |||||
user-select: text; | |||||
} | |||||
</style> |
@@ -0,0 +1,124 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<template v-if="compName === 'el'"> | |||||
<block v-if="n.name === 'img'"> | |||||
<rich-text | |||||
v-if="n.t" | |||||
:style="'display:' + n.t" | |||||
:nodes="'<img class='_img' style=''+(n.attrs.style)+'' src=''+(n.attrs.src)+''>'" | |||||
:data-i="i" | |||||
@tap.stop.prevent="imgTap" | |||||
/> | |||||
<block v-else> | |||||
<image v-if="(opts[1] && !ctrl[i]) || ctrl[i] < 0" class="_img" :style="n.attrs.style" :src="ctrl[i] < 0 ? opts[2] : opts[1]" mode="widthFix" /> | |||||
<image | |||||
:id="n.attrs.id" | |||||
:class="'_img ' + n.attrs.class" | |||||
:style="(ctrl[i] === -1 ? 'display:none;' : '') + 'width:' + (ctrl[i] || 1) + 'px;height:1px;' + n.attrs.style" | |||||
:src="n.attrs.src" | |||||
:mode="!n.h ? 'widthFix' : !n.w ? 'heightFix' : ''" | |||||
:lazy-load="opts[0]" | |||||
:webp="n.webp" | |||||
:show-menu-by-longpress="opts[3] && !n.attrs.ignore" | |||||
:data-i="i" | |||||
@load="imgLoad" | |||||
@error="mediaError" | |||||
@tap.stop.prevent="imgTap" | |||||
@longpress="noop" | |||||
/> | |||||
</block> | |||||
</block> | |||||
<text v-else-if="n.text" :user-select="opts[4] == 'force' && isiOS" decode>{{ n.text }}</text> | |||||
<text v-else-if="n.name === 'br'">\n</text> | |||||
<view | |||||
v-else-if="n.name === 'a'" | |||||
:id="n.attrs.id" | |||||
:class="(n.attrs.href ? '_a ' : '') + n.attrs.class" | |||||
hover-class="_hover" | |||||
:style="'display:inline;' + n.attrs.style" | |||||
:data-i="i" | |||||
@tap.stop.prevent="linkTap" | |||||
> | |||||
<node :childs="n.children" :opts="opts" style="display: inherit" /> | |||||
</view> | |||||
<video | |||||
v-else-if="n.name === 'video'" | |||||
:id="n.attrs.id" | |||||
:class="n.attrs.class" | |||||
:style="n.attrs.style" | |||||
:autoplay="n.attrs.autoplay" | |||||
:controls="n.attrs.controls" | |||||
:loop="n.attrs.loop" | |||||
:muted="n.attrs.muted" | |||||
:object-fit="n.attrs['object-fit']" | |||||
:poster="n.attrs.poster" | |||||
:src="n.src[ctrl[i] || 0]" | |||||
:data-i="i" | |||||
@play="play" | |||||
@error="mediaError" | |||||
/> | |||||
<audio | |||||
v-else-if="n.name === 'audio'" | |||||
:id="n.attrs.id" | |||||
:class="n.attrs.class" | |||||
:style="n.attrs.style" | |||||
:author="n.attrs.author" | |||||
:controls="n.attrs.controls" | |||||
:loop="n.attrs.loop" | |||||
:name="n.attrs.name" | |||||
:poster="n.attrs.poster" | |||||
:src="n.src[ctrl[i] || 0]" | |||||
:data-i="i" | |||||
@play="play" | |||||
@error="mediaError" | |||||
/> | |||||
<rich-text v-else :id="n.attrs.id" :style="n.f" :user-select="opts[4]" :nodes="[n]" /> | |||||
</template> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
import node from './node'; | |||||
export default { | |||||
components: { | |||||
node | |||||
}, | |||||
props: ['data', 'compName'], | |||||
computed: { | |||||
n() { | |||||
return this.data.n; | |||||
}, | |||||
i() { | |||||
return this.data.i; | |||||
}, | |||||
opts() { | |||||
return this.data.opts; | |||||
}, | |||||
ctrl() { | |||||
return this.data.ctrl; | |||||
}, | |||||
isiOS() { | |||||
return this.data.isiOS; | |||||
}, | |||||
imgTap() { | |||||
return this.data.imgTap; | |||||
}, | |||||
imgLoad() { | |||||
return this.data.imgLoad; | |||||
}, | |||||
mediaError() { | |||||
return this.data.mediaError; | |||||
}, | |||||
noop() { | |||||
return this.data.noop; | |||||
}, | |||||
linkTap() { | |||||
return this.data.linkTap; | |||||
}, | |||||
play() { | |||||
return this.data.play; | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style></style> |
@@ -0,0 +1,479 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<block v-for="(n1, i1) in childs" :key="i1"> | |||||
<El compName="el" :data="{ n: n1, i: '' + i1, opts: opts, ctrl: ctrl }" v-if="!n1.c && (!n1.children || n1.name === 'a' || !isInline(n1.name, n1.attrs.style))"></El> | |||||
<view v-else :id="n1.attrs.id" :class="'_' + n1.name + ' ' + n1.attrs.class" :style="n1.attrs.style"> | |||||
<block v-for="(n2, i2) in n1.children" :key="i2"> | |||||
<El | |||||
compName="el" | |||||
:data="{ n: n2, i: i1 + '_' + i2, opts: opts, ctrl: ctrl }" | |||||
v-if="!n2.c && (!n2.children || n2.name === 'a' || !isInline(n2.name, n2.attrs.style))" | |||||
></El> | |||||
<view v-else :id="n2.attrs.id" :class="'_' + n2.name + ' ' + n2.attrs.class" :style="n2.attrs.style"> | |||||
<block v-for="(n3, i3) in n2.children" :key="i3"> | |||||
<El | |||||
compName="el" | |||||
:data="{ n: n3, i: i1 + '_' + i2 + '_' + i3, opts: opts, ctrl: ctrl }" | |||||
v-if="!n3.c && (!n3.children || n3.name === 'a' || !isInline(n3.name, n3.attrs.style))" | |||||
></El> | |||||
<view v-else :id="n3.attrs.id" :class="'_' + n3.name + ' ' + n3.attrs.class" :style="n3.attrs.style"> | |||||
<block v-for="(n4, i4) in n3.children" :key="i4"> | |||||
<El | |||||
compName="el" | |||||
:data="{ n: n4, i: i1 + '_' + i2 + '_' + i3 + '_' + i4, opts: opts, ctrl: ctrl }" | |||||
v-if="!n4.c && (!n4.children || n4.name === 'a' || !isInline(n4.name, n4.attrs.style))" | |||||
></El> | |||||
<view v-else :id="n4.attrs.id" :class="'_' + n4.name + ' ' + n4.attrs.class" :style="n4.attrs.style"> | |||||
<block v-for="(n5, i5) in n4.children" :key="i5"> | |||||
<El | |||||
compName="el" | |||||
:data="{ n: n5, i: i1 + '_' + i2 + '_' + i3 + '_' + i4 + '_' + i5, opts: opts, ctrl: ctrl }" | |||||
v-if="!n5.c && (!n5.children || n5.name === 'a' || !isInline(n5.name, n5.attrs.style))" | |||||
></El> | |||||
<node | |||||
v-else | |||||
:id="n5.attrs.id" | |||||
:class="'_' + n5.name + ' ' + n5.attrs.class" | |||||
:style="n5.attrs.style" | |||||
:childs="n5.children" | |||||
:opts="opts" | |||||
/> | |||||
</block> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</template> | |||||
<script module="isInline" lang="wxs"> | |||||
var e={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};module.exports=function(n,i){return e[n]||-1!==(i||"").indexOf("inline")}; | |||||
</script> | |||||
<script> | |||||
'use strict'; | |||||
import node from './node'; | |||||
import El from './node-el.vue'; | |||||
function t(t, e, i) { | |||||
if (e in t) { | |||||
Object.defineProperty(t, e, { | |||||
value: i, | |||||
enumerable: true, | |||||
configurable: true, | |||||
writable: true | |||||
}); | |||||
} else { | |||||
t[e] = i; | |||||
} | |||||
return t; | |||||
} | |||||
export default { | |||||
components: { | |||||
node, | |||||
El | |||||
}, | |||||
data() { | |||||
return { | |||||
ctrl: {}, | |||||
isiOS: uni.getSystemInfoSync().system.includes('iOS'), | |||||
i1: '', | |||||
n1: { | |||||
c: '', | |||||
children: '', | |||||
name: '', | |||||
attrs: { | |||||
id: '', | |||||
class: '', | |||||
style: '' | |||||
} | |||||
}, | |||||
i2: '', | |||||
n2: { | |||||
c: '', | |||||
children: '', | |||||
name: '', | |||||
attrs: { | |||||
id: '', | |||||
class: '', | |||||
style: '' | |||||
} | |||||
}, | |||||
i3: '', | |||||
n3: { | |||||
c: '', | |||||
children: '', | |||||
name: '', | |||||
attrs: { | |||||
id: '', | |||||
class: '', | |||||
style: '' | |||||
} | |||||
}, | |||||
i4: '', | |||||
n4: { | |||||
c: '', | |||||
children: '', | |||||
name: '', | |||||
attrs: { | |||||
id: '', | |||||
class: '', | |||||
style: '' | |||||
} | |||||
}, | |||||
i5: '', | |||||
n5: { | |||||
c: '', | |||||
children: '', | |||||
name: '', | |||||
attrs: { | |||||
id: '', | |||||
class: '', | |||||
style: '' | |||||
} | |||||
} | |||||
}; | |||||
}, | |||||
props: { | |||||
childs: Array, | |||||
opts: Array | |||||
}, | |||||
options: { | |||||
addGlobalClass: true | |||||
}, | |||||
mounted() { | |||||
// 处理小程序 attached 生命周期 | |||||
this.attached(); | |||||
}, | |||||
methods: { | |||||
attached: function () { | |||||
this.$emit( | |||||
'add', | |||||
{ | |||||
detail: this | |||||
}, | |||||
{ | |||||
bubbles: true, | |||||
composed: true | |||||
} | |||||
); | |||||
}, | |||||
noop: function () {}, | |||||
getNode: function (t) { | |||||
try { | |||||
for (e = t.split('_'), i = this.childs[e[0]], r = 1, void 0; r < e.length; r++) { | |||||
var e; | |||||
var i; | |||||
var r; | |||||
i = i.children[e[r]]; | |||||
} | |||||
return i; | |||||
} catch (t) { | |||||
console.log('CatchClause', t); | |||||
console.log('CatchClause', t); | |||||
return { | |||||
text: '', | |||||
attrs: {}, | |||||
children: [] | |||||
}; | |||||
} | |||||
}, | |||||
play: function (t) { | |||||
this.root.$emit('play'); | |||||
if (this.root.data.pauseVideo) { | |||||
for (e = false, i = t.target.id, r = this.root._videos.length, void 0; r--; ) { | |||||
var e; | |||||
var i; | |||||
var r; | |||||
this.root._videos[r].id === i ? (e = true) : this.root._videos[r].pause(); | |||||
} | |||||
if (!e) { | |||||
var o = uni.createVideoContext(i, this); | |||||
o.id = i; | |||||
if (this.root.playbackRate) { | |||||
o.playbackRate(this.root.playbackRate); | |||||
} | |||||
this.root._videos.push(o); | |||||
} | |||||
} | |||||
}, | |||||
imgTap: function (t) { | |||||
var e = this.getNode(t.target.dataset.i); | |||||
if (e.a) { | |||||
return this.linkTap(e.a); | |||||
} | |||||
if ( | |||||
!e.attrs.ignore && | |||||
(this.root.$emit('imgtap', { | |||||
detail: e.attrs | |||||
}), | |||||
this.root.data.previewImg) | |||||
) { | |||||
var i = this.root.imgList[e.i]; | |||||
uni.previewImage({ | |||||
showmenu: this.root.data.showImgMenu, | |||||
current: i, | |||||
urls: this.root.imgList | |||||
}); | |||||
} | |||||
}, | |||||
imgLoad: function (e) { | |||||
var i; | |||||
var r = e.target.dataset.i; | |||||
var o = this.getNode(r); | |||||
o.w ? ((this.opts[1] && !this.ctrl[r]) || -1 === this.ctrl[r]) && (i = 1) : (i = e.detail.width); | |||||
if (i) { | |||||
this.setData(t({}, 'ctrl.' + r, i)); | |||||
} | |||||
this.checkReady(); | |||||
}, | |||||
checkReady: function () { | |||||
var that = this; | |||||
this.root.data.lazyLoad || | |||||
((this.root.imgList._unloadimgs -= 1), | |||||
this.root.imgList._unloadimgs || | |||||
setTimeout(function () { | |||||
that.root | |||||
.getRect() | |||||
.then(function (e) { | |||||
that.root.$emit('ready', { | |||||
detail: e | |||||
}); | |||||
}) | |||||
.catch(function () { | |||||
that.root.$emit('ready', { | |||||
detail: {} | |||||
}); | |||||
}); | |||||
}, 350)); | |||||
}, | |||||
linkTap: function (t) { | |||||
if (t.currentTarget) { | |||||
var e = this.getNode(t.currentTarget.dataset.i); | |||||
} else { | |||||
var e = {}; | |||||
} | |||||
var i = e.attrs || t; | |||||
var r = i.href; | |||||
this.root.$emit('linktap', { | |||||
detail: Object.assign( | |||||
{ | |||||
innerText: this.root.getText(e.children || []) | |||||
}, | |||||
i | |||||
) | |||||
}); | |||||
if (r) { | |||||
'#' === r[0] | |||||
? this.root.navigateTo(r.substring(1)).catch(function () {}) | |||||
: r.split('?')[0].includes('://') | |||||
? this.root.data.copyLink && | |||||
uni.setClipboardData({ | |||||
data: r, | |||||
success: function () { | |||||
return uni.showToast({ | |||||
title: '链接已复制' | |||||
}); | |||||
} | |||||
}) | |||||
: uni.navigateTo({ | |||||
url: r, | |||||
fail: function () { | |||||
uni.switchTab({ | |||||
url: r, | |||||
fail: function () {} | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
mediaError: function (e) { | |||||
var i = e.target.dataset.i; | |||||
var r = this.getNode(i); | |||||
if ('video' === r.name || 'audio' === r.name) { | |||||
var o = (this.ctrl[i] || 0) + 1; | |||||
if (o > r.src.length) { | |||||
o = 0; | |||||
} | |||||
if (o < r.src.length) { | |||||
return this.setData(t({}, 'ctrl.' + i, o)); | |||||
} | |||||
} else { | |||||
if ('img' === r.name) { | |||||
if (this.opts[2]) { | |||||
this.setData(t({}, 'ctrl.' + i, -1)); | |||||
} | |||||
this.checkReady(); | |||||
} | |||||
} | |||||
if (this.root) { | |||||
this.root.$emit('error', { | |||||
detail: { | |||||
source: r.name, | |||||
attrs: r.attrs, | |||||
errMsg: e.detail.errMsg | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
}, | |||||
created: function () {} | |||||
}; | |||||
</script> | |||||
<style> | |||||
._a { | |||||
padding: 1.5px 0 1.5px 0; | |||||
color: #366092; | |||||
word-break: break-all; | |||||
} | |||||
._hover { | |||||
text-decoration: underline; | |||||
opacity: 0.7; | |||||
} | |||||
._img { | |||||
max-width: 100%; | |||||
-webkit-touch-callout: none; | |||||
} | |||||
._b, | |||||
._strong { | |||||
font-weight: 700; | |||||
} | |||||
._code { | |||||
font-family: monospace; | |||||
} | |||||
._del { | |||||
text-decoration: line-through; | |||||
} | |||||
._em, | |||||
._i { | |||||
font-style: italic; | |||||
} | |||||
._h1 { | |||||
font-size: 2em; | |||||
} | |||||
._h2 { | |||||
font-size: 1.5em; | |||||
} | |||||
._h3 { | |||||
font-size: 1.17em; | |||||
} | |||||
._h5 { | |||||
font-size: 0.83em; | |||||
} | |||||
._h6 { | |||||
font-size: 0.67em; | |||||
} | |||||
._h1, | |||||
._h2, | |||||
._h3, | |||||
._h4, | |||||
._h5, | |||||
._h6 { | |||||
display: block; | |||||
font-weight: 700; | |||||
} | |||||
._ins { | |||||
text-decoration: underline; | |||||
} | |||||
._li { | |||||
display: list-item; | |||||
} | |||||
._ol { | |||||
list-style-type: decimal; | |||||
} | |||||
._ol, | |||||
._ul { | |||||
display: block; | |||||
padding-left: 40px; | |||||
margin: 1em 0; | |||||
} | |||||
._q::before { | |||||
content: '"'; | |||||
} | |||||
._q::after { | |||||
content: '"'; | |||||
} | |||||
._sub { | |||||
font-size: smaller; | |||||
vertical-align: sub; | |||||
} | |||||
._sup { | |||||
font-size: smaller; | |||||
vertical-align: super; | |||||
} | |||||
._tbody, | |||||
._tfoot, | |||||
._thead { | |||||
display: table-row-group; | |||||
} | |||||
._tr { | |||||
display: table-row; | |||||
} | |||||
._td, | |||||
._th { | |||||
display: table-cell; | |||||
vertical-align: middle; | |||||
} | |||||
._th { | |||||
font-weight: 700; | |||||
text-align: center; | |||||
} | |||||
._ul { | |||||
list-style-type: disc; | |||||
} | |||||
._ul ._ul { | |||||
margin: 0; | |||||
list-style-type: circle; | |||||
} | |||||
._ul ._ul ._ul { | |||||
list-style-type: square; | |||||
} | |||||
._abbr, | |||||
._b, | |||||
._code, | |||||
._del, | |||||
._em, | |||||
._i, | |||||
._ins, | |||||
._label, | |||||
._q, | |||||
._span, | |||||
._strong, | |||||
._sub, | |||||
._sup { | |||||
display: inline; | |||||
} | |||||
._blockquote, | |||||
._div, | |||||
._p { | |||||
display: block; | |||||
} | |||||
</style> |
@@ -0,0 +1,410 @@ | |||||
"use strict"; | |||||
function t(t) { | |||||
for (var i = Object.create(null), e = t.split(","), s = e.length; s--;) i[e[s]] = !0; | |||||
return i; | |||||
} | |||||
function i(t, i) { | |||||
for (var e = t.indexOf("&"); -1 !== e;) { | |||||
var s = t.indexOf(";", e + 3), | |||||
a = void 0; | |||||
if (-1 === s) break; | |||||
"#" === t[e + 1] ? (a = parseInt(("x" === t[e + 2] ? "0" : "") + t.substring(e + 2, s)), isNaN(a) || (t = t.substr(0, e) + String.fromCharCode(a) + t.substr(s + 1))) : (a = t.substring(e + 1, s), (n.entities[a] || "amp" === a && i) && (t = t.substr(0, e) + (n.entities[a] || "&") + t.substr(s + 1))), e = t.indexOf("&", e + 1); | |||||
} | |||||
return t; | |||||
} | |||||
function e(t) { | |||||
for (var i = t.length - 1, e = i; e >= -1; e--) (-1 === e || t[e].c || !t[e].name || "div" !== t[e].name && "p" !== t[e].name && "h" !== t[e].name[0] || (t[e].attrs.style || "").includes("inline")) && (i - e >= 5 && t.splice(e + 1, i - e, { | |||||
name: "div", | |||||
attrs: {}, | |||||
children: t.slice(e + 1, i + 1) | |||||
}), i = e - 1); | |||||
} | |||||
function s(t) { | |||||
this.options = t.data || {}, this.tagStyle = Object.assign({}, n.tagStyle, this.options.tagStyle), this.imgList = t.imgList || [], this.imgList._unloadimgs = 0, this.plugins = t.plugins || [], this.attrs = Object.create(null), this.stack = [], this.nodes = [], this.pre = (this.options.containerStyle || "").includes("white-space") && this.options.containerStyle.includes("pre") ? 2 : 0; | |||||
} | |||||
function a(t) { | |||||
this.handler = t; | |||||
} | |||||
var n = { | |||||
trustTags: t("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"), | |||||
blockTags: t("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"), | |||||
ignoreTags: t("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"), | |||||
voidTags: t("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"), | |||||
entities: { | |||||
lt: "<", | |||||
gt: ">", | |||||
quot: '"', | |||||
apos: "'", | |||||
ensp: " ", | |||||
emsp: " ", | |||||
nbsp: " ", | |||||
semi: ";", | |||||
ndash: "–", | |||||
mdash: "—", | |||||
middot: "·", | |||||
lsquo: "‘", | |||||
rsquo: "’", | |||||
ldquo: "“", | |||||
rdquo: "”", | |||||
bull: "•", | |||||
hellip: "…", | |||||
larr: "←", | |||||
uarr: "↑", | |||||
rarr: "→", | |||||
darr: "↓" | |||||
}, | |||||
tagStyle: { | |||||
address: "font-style:italic", | |||||
big: "display:inline;font-size:1.2em", | |||||
caption: "display:table-caption;text-align:center", | |||||
center: "text-align:center", | |||||
cite: "font-style:italic", | |||||
dd: "margin-left:40px", | |||||
mark: "background-color:yellow", | |||||
pre: "font-family:monospace;white-space:pre", | |||||
s: "text-decoration:line-through", | |||||
small: "display:inline;font-size:0.8em", | |||||
strike: "text-decoration:line-through", | |||||
u: "text-decoration:underline" | |||||
}, | |||||
svgDict: { | |||||
animatetransform: "animateTransform", | |||||
lineargradient: "linearGradient", | |||||
viewbox: "viewBox", | |||||
attributename: "attributeName", | |||||
repeatcount: "repeatCount", | |||||
repeatdur: "repeatDur" | |||||
} | |||||
}, | |||||
r = {}, | |||||
o = uni.getSystemInfoSync(), | |||||
h = o.windowWidth, | |||||
l = o.system, | |||||
c = t(" ,\r,\n,\t,\f"), | |||||
d = 0; | |||||
s.prototype.parse = function (t) { | |||||
for (var i = this.plugins.length; i--;) this.plugins[i].onUpdate && (t = this.plugins[i].onUpdate(t, n) || t); | |||||
for (new a(this).parse(t); this.stack.length;) this.popNode(); | |||||
return this.nodes.length > 50 && e(this.nodes), this.nodes; | |||||
}, s.prototype.expose = function () { | |||||
for (var t = this.stack.length; t--;) { | |||||
var i = this.stack[t]; | |||||
if (i.c || "a" === i.name || "video" === i.name || "audio" === i.name) return; | |||||
i.c = 1; | |||||
} | |||||
}, s.prototype.hook = function (t) { | |||||
for (var i = this.plugins.length; i--;) if (this.plugins[i].onParse && !1 === this.plugins[i].onParse(t, this)) return !1; | |||||
return !0; | |||||
}, s.prototype.getUrl = function (t) { | |||||
var i = this.options.domain; | |||||
return "/" === t[0] ? "/" === t[1] ? t = (i ? i.split("://")[0] : "http") + ":" + t : i && (t = i + t) : !i || t.includes("data:") || t.includes("://") || (t = i + "/" + t), t; | |||||
}, s.prototype.parseStyle = function (t) { | |||||
var i = t.attrs, | |||||
e = (this.tagStyle[t.name] || "").split(";").concat((i.style || "").split(";")), | |||||
s = {}, | |||||
a = ""; | |||||
i.id && !this.xml && (this.options.useAnchor ? this.expose() : "img" !== t.name && "a" !== t.name && "video" !== t.name && "audio" !== t.name && (i.id = void 0)), i.width && (s.width = parseFloat(i.width) + (i.width.includes("%") ? "%" : "px"), i.width = void 0), i.height && (s.height = parseFloat(i.height) + (i.height.includes("%") ? "%" : "px"), i.height = void 0); | |||||
for (var n = 0, r = e.length; n < r; n++) { | |||||
var o = e[n].split(":"); | |||||
if (!(o.length < 2)) { | |||||
var l = o.shift().trim().toLowerCase(), | |||||
d = o.join(":").trim(); | |||||
if ("-" === d[0] && d.lastIndexOf("-") > 0 || d.includes("safe")) a += ";".concat(l, ":").concat(d);else if (!s[l] || d.includes("import") || !s[l].includes("import")) { | |||||
if (d.includes("url")) { | |||||
var p = d.indexOf("(") + 1; | |||||
if (p) { | |||||
for (; '"' === d[p] || "'" === d[p] || c[d[p]];) p++; | |||||
d = d.substr(0, p) + this.getUrl(d.substr(p)); | |||||
} | |||||
} else d.includes("rpx") && (d = d.replace(/[0-9.]+\s*rpx/g, function (t) { | |||||
return parseFloat(t) * h / 750 + "px"; | |||||
})); | |||||
s[l] = d; | |||||
} | |||||
} | |||||
} | |||||
return t.attrs.style = a, s; | |||||
}, s.prototype.onTagName = function (t) { | |||||
this.tagName = this.xml ? t : t.toLowerCase(), "svg" === this.tagName && (this.xml = (this.xml || 0) + 1); | |||||
}, s.prototype.onAttrName = function (t) { | |||||
t = this.xml ? t : t.toLowerCase(), "data-" === t.substr(0, 5) ? "data-src" !== t || this.attrs.src ? "img" === this.tagName || "a" === this.tagName ? this.attrName = t : this.attrName = void 0 : this.attrName = "src" : (this.attrName = t, this.attrs[t] = "T"); | |||||
}, s.prototype.onAttrVal = function (t) { | |||||
var e = this.attrName || ""; | |||||
"style" === e || "href" === e ? this.attrs[e] = i(t, !0) : e.includes("src") ? this.attrs[e] = this.getUrl(i(t, !0)) : e && (this.attrs[e] = t); | |||||
}, s.prototype.onOpenTag = function (t) { | |||||
var i = Object.create(null); | |||||
i.name = this.tagName, i.attrs = this.attrs, this.attrs = Object.create(null); | |||||
var e = i.attrs, | |||||
s = this.stack[this.stack.length - 1], | |||||
a = s ? s.children : this.nodes, | |||||
o = this.xml ? t : n.voidTags[i.name]; | |||||
if (r[i.name] && (e.class = r[i.name] + (e.class ? " " + e.class : "")), "embed" === i.name) { | |||||
var l = e.src || ""; | |||||
l.includes(".mp4") || l.includes(".3gp") || l.includes(".m3u8") || (e.type || "").includes("video") ? i.name = "video" : (l.includes(".mp3") || l.includes(".wav") || l.includes(".aac") || l.includes(".m4a") || (e.type || "").includes("audio")) && (i.name = "audio"), e.autostart && (e.autoplay = "T"), e.controls = "T"; | |||||
} | |||||
if ("video" !== i.name && "audio" !== i.name || ("video" !== i.name || e.id || (e.id = "v" + d++), e.controls || e.autoplay || (e.controls = "T"), i.src = [], e.src && (i.src.push(e.src), e.src = void 0), this.expose()), o) { | |||||
if (!this.hook(i) || n.ignoreTags[i.name]) return void ("base" !== i.name || this.options.domain ? "source" === i.name && s && ("video" === s.name || "audio" === s.name) && e.src && s.src.push(e.src) : this.options.domain = e.href); | |||||
var c = this.parseStyle(i); | |||||
if ("img" === i.name) { | |||||
if (e.src && (e.src.includes("webp") && (i.webp = "T"), e.src.includes("data:") && !e["original-src"] && (e.ignore = "T"), !e.ignore || i.webp || e.src.includes("cloud://"))) { | |||||
for (var p = this.stack.length; p--;) { | |||||
var u = this.stack[p]; | |||||
"table" !== u.name || i.webp || e.src.includes("cloud://") || (!c.display || c.display.includes("inline") ? i.t = "inline-block" : i.t = c.display, c.display = void 0); | |||||
var g = u.attrs.style || ""; | |||||
if (!g.includes("flex:") || g.includes("flex:0") || g.includes("flex: 0") || c.width && !(parseInt(c.width) > 100)) { | |||||
if (g.includes("flex") && "100%" === c.width) for (var f = p + 1; f < this.stack.length; f++) { | |||||
var m = this.stack[f].attrs.style || ""; | |||||
if (!m.includes(";width") && !m.includes(" width") && 0 !== m.indexOf("width")) { | |||||
c.width = ""; | |||||
break; | |||||
} | |||||
} else g.includes("inline-block") && (c.width && "%" === c.width[c.width.length - 1] ? (u.attrs.style += ";max-width:" + c.width, c.width = "") : u.attrs.style += ";max-width:100%"); | |||||
} else { | |||||
c.width = "100% !important", c.height = ""; | |||||
for (var v = p + 1; v < this.stack.length; v++) this.stack[v].attrs.style = (this.stack[v].attrs.style || "").replace("inline-", ""); | |||||
} | |||||
"a" === u.name ? i.a = u.attrs : u.c = 1; | |||||
} | |||||
i.i = this.imgList.length; | |||||
var y = e["original-src"] || e.src; | |||||
if (this.imgList.includes(y)) { | |||||
var x = y.indexOf("://"); | |||||
if (-1 !== x) { | |||||
x += 3; | |||||
for (var b = y.substr(0, x); x < y.length && "/" !== y[x]; x++) b += Math.random() > .5 ? y[x].toUpperCase() : y[x]; | |||||
b += y.substr(x), y = b; | |||||
} | |||||
} | |||||
this.imgList.push(y), i.t || (this.imgList._unloadimgs += 1); | |||||
} | |||||
"inline" === c.display && (c.display = ""), e.ignore && (c["max-width"] = c["max-width"] || "100%", e.style += ";-webkit-touch-callout:none"), parseInt(c.width) > h && (c.height = void 0), isNaN(parseInt(c.width)) || (i.w = "T"), !isNaN(parseInt(c.height)) && (!c.height.includes("%") || s && (s.attrs.style || "").includes("height")) && (i.h = "T"); | |||||
} else if ("svg" === i.name) return a.push(i), this.stack.push(i), void this.popNode(); | |||||
for (var w in c) c[w] && (e.style += ";".concat(w, ":").concat(c[w].replace(" !important", ""))); | |||||
e.style = e.style.substr(1) || void 0; | |||||
} else ("pre" === i.name || (e.style || "").includes("white-space") && e.style.includes("pre")) && 2 !== this.pre && (this.pre = i.pre = 1), i.children = [], this.stack.push(i); | |||||
a.push(i); | |||||
}, s.prototype.onCloseTag = function (t) { | |||||
t = this.xml ? t : t.toLowerCase(); | |||||
var i; | |||||
for (i = this.stack.length; i-- && this.stack[i].name !== t;); | |||||
if (-1 !== i) for (; this.stack.length > i;) this.popNode();else if ("p" === t || "br" === t) { | |||||
var e = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes; | |||||
e.push({ | |||||
name: t, | |||||
attrs: { | |||||
class: r[t], | |||||
style: this.tagStyle[t] | |||||
} | |||||
}); | |||||
} | |||||
}, s.prototype.popNode = function () { | |||||
var t = this.stack.pop(), | |||||
i = t.attrs, | |||||
s = t.children, | |||||
a = this.stack[this.stack.length - 1], | |||||
r = a ? a.children : this.nodes; | |||||
if (!this.hook(t) || n.ignoreTags[t.name]) return "title" === t.name && s.length && "text" === s[0].type && this.options.setTitle && uni.setNavigationBarTitle({ | |||||
title: s[0].text | |||||
}), void r.pop(); | |||||
if (t.pre && 2 !== this.pre) { | |||||
this.pre = t.pre = void 0; | |||||
for (var o = this.stack.length; o--;) this.stack[o].pre && (this.pre = 1); | |||||
} | |||||
if ("svg" === t.name) { | |||||
if (this.xml > 1) return void this.xml--; | |||||
var l = "", | |||||
c = i.style; | |||||
return i.style = "", i.xmlns = "http://www.w3.org/2000/svg", function t(i) { | |||||
if ("text" === i.type) return void (l += i.text); | |||||
var e = n.svgDict[i.name] || i.name; | |||||
l += "<" + e; | |||||
for (var s in i.attrs) { | |||||
var a = i.attrs[s]; | |||||
a && (l += " ".concat(n.svgDict[s] || s, '="').concat(a, '"')); | |||||
} | |||||
if (i.children) { | |||||
l += ">"; | |||||
for (var r = 0; r < i.children.length; r++) t(i.children[r]); | |||||
l += "</" + e + ">"; | |||||
} else l += "/>"; | |||||
}(t), t.name = "img", t.attrs = { | |||||
src: "data:image/svg+xml;utf8," + l.replace(/#/g, "%23"), | |||||
style: c, | |||||
ignore: "T" | |||||
}, t.children = void 0, void (this.xml = !1); | |||||
} | |||||
var d = {}; | |||||
if (i.align && ("table" === t.name ? "center" === i.align ? d["margin-inline-start"] = d["margin-inline-end"] = "auto" : d.float = i.align : d["text-align"] = i.align, i.align = void 0), i.dir && (d.direction = i.dir, i.dir = void 0), "font" === t.name && (i.color && (d.color = i.color, i.color = void 0), i.face && (d["font-family"] = i.face, i.face = void 0), i.size)) { | |||||
var p = parseInt(i.size); | |||||
isNaN(p) || (p < 1 ? p = 1 : p > 7 && (p = 7), d["font-size"] = ["x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large"][p - 1]), i.size = void 0; | |||||
} | |||||
if ((i.class || "").includes("align-center") && (d["text-align"] = "center"), Object.assign(d, this.parseStyle(t)), "table" !== t.name && parseInt(d.width) > h && (d["max-width"] = "100%", d["box-sizing"] = "border-box"), n.blockTags[t.name]) t.name = "div";else if (n.trustTags[t.name] || this.xml) { | |||||
if ("a" === t.name || "ad" === t.name) this.expose();else if ("video" === t.name || "audio" === t.name) (d.height || "").includes("auto") && (d.height = void 0), t.children = void 0;else if ("ul" !== t.name && "ol" !== t.name || !t.c) { | |||||
if ("table" === t.name) { | |||||
var u = parseFloat(i.cellpadding), | |||||
g = parseFloat(i.cellspacing), | |||||
f = parseFloat(i.border), | |||||
m = d["border-color"], | |||||
v = d["border-style"]; | |||||
if (t.c && (isNaN(u) && (u = 2), isNaN(g) && (g = 2)), f && (i.style += ";border:".concat(f, "px ").concat(v || "solid", " ").concat(m || "gray")), t.flag && t.c) { | |||||
t.flag = void 0, d.display = "grid", g ? (d["grid-gap"] = g + "px", d.padding = g + "px") : f && (i.style += ";border-left:0;border-top:0"); | |||||
var y = [], | |||||
x = [], | |||||
b = [], | |||||
w = {}; | |||||
!function t(i) { | |||||
for (var e = 0; e < i.length; e++) "tr" === i[e].name ? x.push(i[e]) : t(i[e].children || []); | |||||
}(s); | |||||
for (var k = 1; k <= x.length; k++) { | |||||
for (var N = 1, T = 0; T < x[k - 1].children.length; T++) { | |||||
var O = x[k - 1].children[T]; | |||||
if ("td" === O.name || "th" === O.name) { | |||||
for (; w[k + "." + N];) N++; | |||||
O.c = 1; | |||||
var C = O.attrs.style || "", | |||||
S = C.indexOf("width") ? C.indexOf(";width") : 0; | |||||
if (-1 !== S) { | |||||
var I = C.indexOf(";", S + 6); | |||||
-1 === I && (I = C.length), O.attrs.colspan || (y[N] = C.substring(S ? S + 7 : 6, I)), C = C.substr(0, S) + C.substr(I); | |||||
} | |||||
if (C += ";display:flex", -1 !== (S = C.indexOf("vertical-align"))) { | |||||
var j = C.substr(S + 15, 10); | |||||
j.includes("middle") ? C += ";align-items:center" : j.includes("bottom") && (C += ";align-items:flex-end"); | |||||
} else C += ";align-items:center"; | |||||
if (-1 !== (S = C.indexOf("text-align"))) { | |||||
var A = C.substr(S + 11, 10); | |||||
A.includes("center") ? C += ";justify-content: center" : A.includes("right") && (C += ";justify-content: right"); | |||||
} | |||||
if (C = (f ? ";border:".concat(f, "px ").concat(v || "solid", " ").concat(m || "gray") + (g ? "" : ";border-right:0;border-bottom:0") : "") + (u ? ";padding:".concat(u, "px") : "") + ";" + C, O.attrs.colspan && (C += ";grid-column-start:".concat(N, ";grid-column-end:").concat(N + parseInt(O.attrs.colspan)), O.attrs.rowspan || (C += ";grid-row-start:".concat(k, ";grid-row-end:").concat(k + 1)), N += parseInt(O.attrs.colspan) - 1), O.attrs.rowspan) { | |||||
C += ";grid-row-start:".concat(k, ";grid-row-end:").concat(k + parseInt(O.attrs.rowspan)), O.attrs.colspan || (C += ";grid-column-start:".concat(N, ";grid-column-end:").concat(N + 1)); | |||||
for (var L = 1; L < O.attrs.rowspan; L++) for (var z = 0; z < (O.attrs.colspan || 1); z++) w[k + L + "." + (N - z)] = 1; | |||||
} | |||||
C && (O.attrs.style = C), b.push(O), N++; | |||||
} | |||||
} | |||||
if (1 === k) { | |||||
for (var q = "", U = 1; U < N; U++) q += (y[U] ? y[U] : "auto") + " "; | |||||
d["grid-template-columns"] = q; | |||||
} | |||||
} | |||||
t.children = b; | |||||
} else t.c && (d.display = "table"), isNaN(g) || (d["border-spacing"] = g + "px"), (f || u || t.c) && function i(e) { | |||||
for (var s = 0; s < e.length; s++) { | |||||
var a = e[s]; | |||||
t.c && (a.c = 1), "th" === a.name || "td" === a.name ? (f && (a.attrs.style = "border:".concat(f, "px ").concat(v || "solid", " ").concat(m || "gray", ";").concat(a.attrs.style || "")), u && (a.attrs.style = "padding:".concat(u, "px;").concat(a.attrs.style || ""))) : a.children && i(a.children); | |||||
} | |||||
}(s); | |||||
if (this.options.scrollTable && !(i.style || "").includes("inline")) { | |||||
var F = Object.assign({}, t); | |||||
t.name = "div", t.attrs = { | |||||
style: "overflow-x:auto;padding:1px" | |||||
}, t.children = [F], i = F.attrs; | |||||
} | |||||
} else if ("td" !== t.name && "th" !== t.name || !i.colspan && !i.rowspan) { | |||||
if ("ruby" === t.name) { | |||||
t.name = "span"; | |||||
for (var V = 0; V < s.length - 1; V++) "text" === s[V].type && "rt" === s[V + 1].name && (s[V] = { | |||||
name: "span", | |||||
attrs: { | |||||
style: "display:inline-block;text-align:center" | |||||
}, | |||||
children: [{ | |||||
name: "div", | |||||
attrs: { | |||||
style: "font-size:50%;" + (s[V + 1].attrs.style || "") | |||||
}, | |||||
children: s[V + 1].children | |||||
}, s[V]] | |||||
}, s.splice(V + 1, 1)); | |||||
} | |||||
} else for (var D = this.stack.length; D--;) if ("table" === this.stack[D].name) { | |||||
this.stack[D].flag = 1; | |||||
break; | |||||
} | |||||
} else { | |||||
var B = { | |||||
a: "lower-alpha", | |||||
A: "upper-alpha", | |||||
i: "lower-roman", | |||||
I: "upper-roman" | |||||
}; | |||||
B[i.type] && (i.style += ";list-style-type:" + B[i.type], i.type = void 0), t.c = 1; | |||||
for (var P = s.length; P--;) "li" === s[P].name && (s[P].c = 1); | |||||
} | |||||
} else t.name = "span"; | |||||
if ((d.display || "").includes("flex") && !t.c) for (var Z = s.length; Z--;) { | |||||
var _ = s[Z]; | |||||
_.f && (_.attrs.style = (_.attrs.style || "") + _.f, _.f = void 0); | |||||
} | |||||
var G = a && ((a.attrs.style || "").includes("flex") || (a.attrs.style || "").includes("grid")) && !t.c && !(d.display || "").includes("inline"); | |||||
G && (t.f = ";max-width:100%"), s.length >= 50 && t.c && !(d.display || "").includes("flex") && e(s); | |||||
for (var M in d) if (d[M]) { | |||||
var W = ";".concat(M, ":").concat(d[M].replace(" !important", "")); | |||||
G && (M.includes("flex") && "flex-direction" !== M || "align-self" === M || M.includes("grid") || "-" === d[M][0] || M.includes("width") && W.includes("%")) ? (t.f += W, "width" === M && (i.style += ";width:100%")) : i.style += W; | |||||
} | |||||
i.style = i.style.substr(1) || void 0; | |||||
}, s.prototype.onText = function (t) { | |||||
if (!this.pre) { | |||||
for (var e, s = "", a = 0, n = t.length; a < n; a++) c[t[a]] ? (" " !== s[s.length - 1] && (s += " "), "\n" !== t[a] || e || (e = !0)) : s += t[a]; | |||||
if (" " === s && e) return; | |||||
t = s; | |||||
} | |||||
var r = Object.create(null); | |||||
if (r.type = "text", r.text = i(t), this.hook(r)) { | |||||
"force" === this.options.selectable && l.includes("iOS") && !uni.canIUse("rich-text.user-select") && this.expose(); | |||||
(this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes).push(r); | |||||
} | |||||
}, a.prototype.parse = function (t) { | |||||
this.content = t || "", this.i = 0, this.start = 0, this.state = this.text; | |||||
for (var i = this.content.length; -1 !== this.i && this.i < i;) this.state(); | |||||
}, a.prototype.checkClose = function (t) { | |||||
var i = "/" === this.content[this.i]; | |||||
return !!(">" === this.content[this.i] || i && ">" === this.content[this.i + 1]) && (t && this.handler[t](this.content.substring(this.start, this.i)), this.i += i ? 2 : 1, this.start = this.i, this.handler.onOpenTag(i), "script" === this.handler.tagName ? (this.i = this.content.indexOf("</", this.i), -1 !== this.i && (this.i += 2, this.start = this.i), this.state = this.endTag) : this.state = this.text, !0); | |||||
}, a.prototype.text = function () { | |||||
if (this.i = this.content.indexOf("<", this.i), -1 === this.i) return void (this.start < this.content.length && this.handler.onText(this.content.substring(this.start, this.content.length))); | |||||
var t = this.content[this.i + 1]; | |||||
if (t >= "a" && t <= "z" || t >= "A" && t <= "Z") this.start !== this.i && this.handler.onText(this.content.substring(this.start, this.i)), this.start = ++this.i, this.state = this.tagName;else if ("/" === t || "!" === t || "?" === t) { | |||||
this.start !== this.i && this.handler.onText(this.content.substring(this.start, this.i)); | |||||
var i = this.content[this.i + 2]; | |||||
if ("/" === t && (i >= "a" && i <= "z" || i >= "A" && i <= "Z")) return this.i += 2, this.start = this.i, void (this.state = this.endTag); | |||||
var e = "--\x3e"; | |||||
"!" === t && "-" === this.content[this.i + 2] && "-" === this.content[this.i + 3] || (e = ">"), this.i = this.content.indexOf(e, this.i), -1 !== this.i && (this.i += e.length, this.start = this.i); | |||||
} else this.i++; | |||||
}, a.prototype.tagName = function () { | |||||
if (c[this.content[this.i]]) { | |||||
for (this.handler.onTagName(this.content.substring(this.start, this.i)); c[this.content[++this.i]];); | |||||
this.i < this.content.length && !this.checkClose() && (this.start = this.i, this.state = this.attrName); | |||||
} else this.checkClose("onTagName") || this.i++; | |||||
}, a.prototype.attrName = function () { | |||||
var t = this.content[this.i]; | |||||
if (c[t] || "=" === t) { | |||||
this.handler.onAttrName(this.content.substring(this.start, this.i)); | |||||
for (var i = "=" === t, e = this.content.length; ++this.i < e;) if (t = this.content[this.i], !c[t]) { | |||||
if (this.checkClose()) return; | |||||
if (i) return this.start = this.i, void (this.state = this.attrVal); | |||||
if ("=" !== this.content[this.i]) return this.start = this.i, void (this.state = this.attrName); | |||||
i = !0; | |||||
} | |||||
} else this.checkClose("onAttrName") || this.i++; | |||||
}, a.prototype.attrVal = function () { | |||||
var t = this.content[this.i], | |||||
i = this.content.length; | |||||
if ('"' === t || "'" === t) { | |||||
if (this.start = ++this.i, this.i = this.content.indexOf(t, this.i), -1 === this.i) return; | |||||
this.handler.onAttrVal(this.content.substring(this.start, this.i)); | |||||
} else for (; this.i < i; this.i++) { | |||||
if (c[this.content[this.i]]) { | |||||
this.handler.onAttrVal(this.content.substring(this.start, this.i)); | |||||
break; | |||||
} | |||||
if (this.checkClose("onAttrVal")) return; | |||||
} | |||||
for (; c[this.content[++this.i]];); | |||||
this.i < i && !this.checkClose() && (this.start = this.i, this.state = this.attrName); | |||||
}, a.prototype.endTag = function () { | |||||
var t = this.content[this.i]; | |||||
if (c[t] || ">" === t || "/" === t) { | |||||
if (this.handler.onCloseTag(this.content.substring(this.start, this.i)), ">" !== t && (this.i = this.content.indexOf(">", this.i), -1 === this.i)) return; | |||||
this.start = ++this.i, this.state = this.text; | |||||
} else this.i++; | |||||
}, module.exports = s; |
@@ -0,0 +1,181 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<custom-nav-bar position="fixed" color="black" left-text="新增关联企业" left-arrow /> | |||||
<scroll-view :scroll-y="true" :style="'height: ' + (windowHeight - 80 - 36 - 20) + 'px;'"> | |||||
<view class="create-enterprise"> | |||||
<view class="border"> | |||||
<view class="create-enterprise-title"> | |||||
企业名称 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<input class="create-enterprise-input" @input="headleInput" :value="form.enterpriseName" | |||||
data-name="enterpriseName" type="text" placeholder="请输入企业名称" /> | |||||
</view> | |||||
<view class="border"> | |||||
<view class="create-enterprise-title"> | |||||
法人姓名 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<input class="create-enterprise-input" @input="headleInput" :value="form.legalName" data-name="legalName" | |||||
type="text" placeholder="请输入法人姓名" /> | |||||
</view> | |||||
<view class="border"> | |||||
<view class="create-enterprise-title"> | |||||
企业社会统一信用代码 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<input class="create-enterprise-input" @input="headleInput" :value="form.identificationNumber" | |||||
data-name="identificationNumber" type="text" placeholder="请输入企业社会统一信用代码" /> | |||||
</view> | |||||
</view> | |||||
</scroll-view> | |||||
<view class="enterprise-button"> | |||||
<van-button v-if="isForm" @tap.native="submit" custom-style="height: 80rpx;" color="#E0383E" | |||||
block>立即关联</van-button> | |||||
<van-button v-if="!isForm" custom-style="height: 80rpx;" color="#C1C1C1" block>立即关联</van-button> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { enterprise } = app.globalData.api; | |||||
import * as enterprise from '@/api/enterprise'; // 企业 | |||||
export default { | |||||
components: {}, | |||||
data() { | |||||
return { | |||||
// env: app.globalData.env, | |||||
// appName: app.globalData.env.appName, | |||||
form: { | |||||
enterpriseName: '', | |||||
legalName: '', | |||||
identificationNumber: '' | |||||
}, | |||||
isForm: false, | |||||
windowHeight: null, | |||||
name: '' | |||||
}; | |||||
}, | |||||
async onLoad() { | |||||
const res = uni.getSystemInfoSync(); | |||||
this.setData({ | |||||
windowHeight: res.windowHeight | |||||
}); | |||||
}, | |||||
async onShow() {}, | |||||
methods: { | |||||
// 返回首页企业 | |||||
onClickLeft() { | |||||
uni.navigateTo({ | |||||
url: '/packages/enterprise/pages/relation-enterprise/relation-enterprise' | |||||
}); | |||||
}, | |||||
// 输入框重新赋值 | |||||
headleInput(event) { | |||||
let { | |||||
value | |||||
} = event.detail; | |||||
const { | |||||
name | |||||
} = event.currentTarget.dataset; | |||||
this.form[name] = value; | |||||
this.setData({ | |||||
...this.form, | |||||
[name]: this[name] | |||||
}); | |||||
const { | |||||
enterpriseName, | |||||
identificationNumber, | |||||
legalName | |||||
} = this.form; | |||||
if (enterpriseName !== '' && identificationNumber !== '' && legalName !== '') { | |||||
this.setData({ | |||||
isForm: true | |||||
}); | |||||
} else { | |||||
this.setData({ | |||||
isForm: false | |||||
}); | |||||
} | |||||
}, | |||||
async submit() { | |||||
const { | |||||
enterpriseName, | |||||
identificationNumber, | |||||
legalName | |||||
} = this.form; | |||||
if (enterpriseName === '' || identificationNumber === '' || legalName === '') { | |||||
uni.showToast({ | |||||
title: enterpriseName === '' ? | |||||
'企业名称不能为空' : legalName === '' ? | |||||
'法人姓名不能为空' : identificationNumber === '' ? | |||||
'企业社会统一信用代码不能为空' : '其中一项不能为空', | |||||
icon: 'none' | |||||
}); | |||||
return false; | |||||
} | |||||
let params = { | |||||
enterpriseName, | |||||
legalName, | |||||
identificationNumber | |||||
}; | |||||
const res = await enterprise.createAffiliatedEnterprise(params); | |||||
if (res.code !== 0) { | |||||
uni.showToast({ | |||||
title: '添加关联企业失败', | |||||
icon: 'none' | |||||
}); | |||||
return; | |||||
} | |||||
uni.showToast({ | |||||
title: '添加企业成功', | |||||
icon: 'none' | |||||
}); | |||||
uni.redirectTo({ | |||||
url: '../relation-enterprise/relation-enterprise' | |||||
}); | |||||
//获取已经打开的页面的数组 | |||||
var pages = getCurrentPages(); | |||||
//获取上一个页面的所有的方法和data中的数据 | |||||
var lastpage = pages[pages.length - 2]; | |||||
lastpage.getEnterpriseList(); | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
.create-enterprise { | |||||
padding: 136rpx 40rpx; | |||||
} | |||||
.border { | |||||
padding: 42rpx 0; | |||||
border-bottom: 1px solid #efefef; | |||||
} | |||||
.create-enterprise-title { | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
} | |||||
.create-enterprise-input { | |||||
margin-top: 24rpx; | |||||
} | |||||
.ml-10 { | |||||
margin-left: 10px; | |||||
} | |||||
.enterprise-button { | |||||
padding: 25rpx 36rpx; | |||||
} | |||||
</style> |
@@ -0,0 +1,340 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<custom-nav-bar position="fixed" color="black" left-text="诉求详情" left-arrow border /> | |||||
<view class="myAppeal"> | |||||
<!-- 内容部分 --> | |||||
<view class="myAppeal-conent"> | |||||
<view class="godd-replay-head"> | |||||
<image src="/static/packages/enterprise/image/my-appeal.png" mode="aspectFill" /> | |||||
<text class="myAppeal-head-title">{{ List.enterpriseName }}</text> | |||||
</view> | |||||
<view class="myAppeal-flex"> | |||||
<block v-for="(type, index) in typeList" :key="index"> | |||||
<view v-if="List.appealType + '' === type.value" class="myAppeal-type" | |||||
:style="'background-color: ' + type.cssClass + ';'">{{ type.label }}</view> | |||||
</block> | |||||
<view> | |||||
<text class="myAppeal-conent-block">{{ toods.getDateTime(List.createTime, 2) }}</text> | |||||
<block v-for="(state, index) in statusList" :key="index"> | |||||
<text v-if="List.appealProcessStatus + '' === state.value" | |||||
class="myAppeal-conent-bg myAppeal-conent-block" :style="'background-color: ' + state.cssClass + ';'"> | |||||
{{ state.label }} | |||||
</text> | |||||
</block> | |||||
</view> | |||||
</view> | |||||
<view class="myAppeal-title mt-21 uniline">{{ List.appealTitle }}</view> | |||||
<view class="myAppeal-subheading"> | |||||
<rich-text :nodes="List.appealContent" /> | |||||
</view> | |||||
<view class="myAppeal-imgage" v-if="List.appealEnclosure"> | |||||
<image mode="aspectFill" data-name="appealEnclosure" @tap="viewImage" :data-item="item" :src="item" | |||||
v-for="(item, index) in List.appealEnclosure" :key="index"></image> | |||||
</view> | |||||
<view class="myAppeal-conent-block mt-21" v-if="List.appealCurrentLocation !== null"> | |||||
{{ List.appealCurrentLocation }} | |||||
</view> | |||||
<!-- 判断是否有回复信息 --> | |||||
<block v-if="List.perfectReplyFlag === 1"> | |||||
<view class="good-reply-title"> | |||||
<text>处理过程</text> | |||||
</view> | |||||
<view class="myAppeal-bg"> | |||||
<view> | |||||
<view class="flex flex-v-center"> | |||||
<image src="/static/images/ic-success.png" mode="aspectFill"></image> | |||||
<text>{{ List.nickName || '' }}</text> | |||||
</view> | |||||
</view> | |||||
<view class="myAppeal-bg-conent"> | |||||
<rich-text :nodes="List.appealReply || ''" /> | |||||
<view class="myAppeal-conent-block mt-16">{{ toods.getDateTime(List.replyTime, 2) }}</view> | |||||
</view> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<!-- <script module="toods" lang="wxs" src="@/wxs/util.wxs"></script> --> | |||||
<script> | |||||
// TODO: 企业-我的诉求详情 + 民生-我的调解详情此页面复用 | |||||
import * as enterprise from '@/api/enterprise'; | |||||
import * as publicApi from '@/api/publicApi'; | |||||
import * as peopleApi from '@/api/peopleApi'; | |||||
export default { | |||||
data() { | |||||
return { | |||||
option: {}, | |||||
type: { | |||||
value: '', | |||||
cssClass: '', | |||||
label: '' | |||||
}, | |||||
status: 'appeal_process_status', | |||||
typeList: [], | |||||
statusList: [], | |||||
List: null, | |||||
state: { | |||||
value: '', | |||||
cssClass: '', | |||||
label: '' | |||||
} | |||||
}; | |||||
}, | |||||
async onLoad(option) { | |||||
// TODO: key:是区分企业-我的诉求详情和民生-我的调解详情 key默认为 1:企业 | |||||
this.setData({ | |||||
option | |||||
}); | |||||
await this.getAppealApi(); | |||||
await this.getTypeList(); | |||||
await this.getStateList(); | |||||
}, | |||||
methods: { | |||||
// 返回我的诉求 | |||||
onClickLeft() { | |||||
uni.navigateTo({ | |||||
url: `/packages/enterprise/pages/my-appeal/my-appeal?name=${this.option.name}` | |||||
}); | |||||
}, | |||||
// 获取类型字典 | |||||
async getTypeList() { | |||||
const res = await publicApi.getDictDataApi({ | |||||
dictType: this.type | |||||
}); | |||||
if (res.data) { | |||||
this.setData({ | |||||
typeList: res.data.list | |||||
}); | |||||
} | |||||
}, | |||||
// 获取状态字典 | |||||
async getStateList() { | |||||
const res = await publicApi.getDictDataApi({ | |||||
dictType: this.status | |||||
}); | |||||
if (res.data) { | |||||
this.setData({ | |||||
statusList: res.data.list | |||||
}); | |||||
} | |||||
}, | |||||
// 查看图片 | |||||
viewImage(event) { | |||||
const url = event.currentTarget.dataset.item; | |||||
const name = event.currentTarget.dataset.name; | |||||
uni.previewImage({ | |||||
current: url, | |||||
// 当前显示图片的http链接 | |||||
urls: this.List[name] // 需要预览的图片http链接列表 | |||||
}); | |||||
}, | |||||
// 获得诉求 | |||||
async getAppealApi() { | |||||
let res = await enterprise.getAppealIdApi({ | |||||
id: this.option.id | |||||
}); | |||||
if (res.data) { | |||||
this.setData({ | |||||
List: res.data | |||||
}); | |||||
} | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
page { | |||||
background-color: #fff; | |||||
} | |||||
.mt-16 { | |||||
margin-top: 16rpx; | |||||
} | |||||
.mt-20 { | |||||
margin-top: 40rpx; | |||||
} | |||||
.mt-21 { | |||||
margin-top: 21rpx; | |||||
} | |||||
.myAppeal { | |||||
padding: 37rpx 32rpx 40rpx 40rpx; | |||||
} | |||||
.myAppeal>.myAppeal-title { | |||||
position: relative; | |||||
width: 175rpx; | |||||
height: 10rpx; | |||||
background: #ffe5e9; | |||||
border-radius: 2rpx; | |||||
line-height: 0; | |||||
margin-top: 10px; | |||||
text { | |||||
position: absolute; | |||||
top: -5px; | |||||
text-align: center; | |||||
width: 100%; | |||||
font-size: 36rpx; | |||||
font-weight: 500; | |||||
color: #000000; | |||||
} | |||||
} | |||||
.myAppeal-conent { | |||||
height: 100%; | |||||
&:not(:first-child) { | |||||
margin-top: 37rpx; | |||||
} | |||||
.godd-replay-head { | |||||
display: flex; | |||||
.myAppeal-head-title { | |||||
font-size: 32rpx; | |||||
font-weight: 500; | |||||
color: #fe3b53; | |||||
} | |||||
image { | |||||
width: 44rpx; | |||||
height: 44rpx; | |||||
border-radius: 50%; | |||||
margin-right: 24rpx; | |||||
} | |||||
} | |||||
.myAppeal-flex { | |||||
margin-top: 32rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
.myAppeal-type { | |||||
width: 88rpx; | |||||
height: 38rpx; | |||||
line-height: 38rpx; | |||||
text-align: center; | |||||
color: #fff; | |||||
box-shadow: 2px 2px 2px 0px rgba(12, 181, 207, 0.1); | |||||
border-radius: 8rpx; | |||||
} | |||||
.myAppeal-conent-title { | |||||
font-size: 32rpx; | |||||
font-weight: 400; | |||||
color: #fe3b53; | |||||
} | |||||
.myAppeal-conent-bg { | |||||
padding: 5rpx 20rpx; | |||||
height: 38rpx; | |||||
text-align: center; | |||||
color: #fff; | |||||
line-height: 38rpx; | |||||
box-shadow: 2px 2px 2px 0px rgba(254, 61, 85, 0.1); | |||||
border-radius: 500rpx; | |||||
margin-left: 39rpx; | |||||
} | |||||
} | |||||
} | |||||
.myAppeal-conent-block { | |||||
font-size: 24rpx; | |||||
font-weight: 400; | |||||
color: #999999; | |||||
} | |||||
.myAppeal-title { | |||||
font-size: 32rpx; | |||||
font-weight: 500; | |||||
color: #000000; | |||||
} | |||||
.myAppeal-subheading { | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
margin-top: 24rpx; | |||||
} | |||||
.myAppeal-imgage { | |||||
margin-top: 24rpx; | |||||
display: grid; | |||||
grid-template-columns: 1fr 1fr 1fr; | |||||
image { | |||||
width: 222rpx; | |||||
height: 222rpx; | |||||
border-radius: 10rpx; | |||||
margin-right: 10rpx; | |||||
} | |||||
} | |||||
.good-reply-title { | |||||
position: relative; | |||||
width: 175rpx; | |||||
height: 10rpx; | |||||
background: #ffced6; | |||||
border-radius: 2rpx; | |||||
line-height: 0; | |||||
margin-top: 60rpx; | |||||
text { | |||||
position: absolute; | |||||
top: -5px; | |||||
text-align: center; | |||||
width: 100%; | |||||
font-size: 36rpx; | |||||
font-weight: 500; | |||||
color: #000000; | |||||
} | |||||
} | |||||
.myAppeal-bg { | |||||
width: 678rpx; | |||||
height: 232rpx; | |||||
border-radius: 8px; | |||||
margin-top: 50rpx; | |||||
image { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
margin-right: 8rpx; | |||||
} | |||||
text { | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #fe3b53; | |||||
} | |||||
.myAppeal-bg-conent { | |||||
margin-top: 16rpx; | |||||
margin-left: 30rpx; | |||||
padding: 20rpx 24rpx 20rpx 28rpx; | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
border-radius: 8rpx; | |||||
background: #f7f7f7; | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,72 @@ | |||||
<template> | |||||
<view> | |||||
<custom-nav-bar position="fixed" color="black" :left-text="options.name" left-arrow border /> | |||||
<view class="list flex flex-center flex-col"> | |||||
<image class="qr" :src="recursionObj.icon" :show-menu-by-longpress="true"></image> | |||||
<view class="qr-text">{{ recursionObj.remark }}</view> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
import * as publicApi from '@/api/publicApi'; | |||||
export default { | |||||
data() { | |||||
return { | |||||
recursionObj: { | |||||
icon: '', | |||||
remark: '' | |||||
}, | |||||
options: { | |||||
name: '' | |||||
} | |||||
}; | |||||
} | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
, | |||||
onLoad(options) { | |||||
this.options = options | |||||
this.recursionApi(); | |||||
}, | |||||
methods: { | |||||
async recursionApi() { | |||||
const { | |||||
data | |||||
} = await publicApi.recursionApi({ | |||||
bannerType: this.options.bannerType, | |||||
parentId: this.options.parentId | |||||
}); | |||||
if (data.length) { | |||||
this.recursionObj = data[0] | |||||
} | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
.list { | |||||
margin-top: 207rpx; | |||||
width: 100%; | |||||
.qr { | |||||
width: 576rpx; | |||||
height: 576rpx; | |||||
} | |||||
.qr-text { | |||||
margin-top: 55rpx; | |||||
width: 543rpx; | |||||
font-size: 30rpx; | |||||
font-weight: 400; | |||||
color: #222222; | |||||
line-height: 40rpx; | |||||
text-align: justify; | |||||
text-align-last: center; | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,199 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<block v-if="options.name === '便民办事'"> | |||||
<custom-nav-bar position="fixed" color="black" :left-text="options.name" left-arrow /> | |||||
<view class="second-model"> | |||||
<view class="second-line flex flex-v-center flex-between" :data-item="item" @tap="headleDetails" | |||||
v-for="(item, index) in newsPageList" :key="index"> | |||||
<view class="line-name flex1 line-text-1">{{ item.title }}</view> | |||||
<image class="line-you" src="/static/images/ic-you.png"></image> | |||||
</view> | |||||
</view> | |||||
</block> | |||||
<block v-if="options.name === '政策推送'"> | |||||
<custom-nav-bar :left-text="options.name" left-arrow /> | |||||
<image class="second-header" :src="recursionObj.icon"></image> | |||||
<view class="second-section"> | |||||
<view class="section-item flex flex-between" :data-item="item" @tap="headleDetails" | |||||
v-for="(item, index) in newsPageList" :key="index"> | |||||
<view class="section-item-left flex1 flex flex-between flex-col"> | |||||
<view class="consult-content-title text-line-2">{{ item.title }}</view> | |||||
<view class="consult-content-block"> | |||||
<text class="block-first">{{ toods.getDateTime(item.createTime) }}</text> | |||||
<text>{{ item.publisher }}</text> | |||||
</view> | |||||
</view> | |||||
<image class="section-item-right" :src="item.pics" mode="aspectFill"></image> | |||||
</view> | |||||
</view> | |||||
</block> | |||||
<!-- 此处归属于生活模块 --> | |||||
<block v-if="options.pageType === '1'"> | |||||
<custom-nav-bar position="fixed" color="black" :left-text="options.name" left-arrow /> | |||||
<view class="second-model"> | |||||
<view class="second-line flex flex-v-center flex-between" :data-item="item" @tap="headleDetails2" | |||||
v-for="(item, index) in newsPageList" :key="index"> | |||||
<view class="line-name flex1 line-text-1">{{ item.title }}</view> | |||||
<image class="line-you" src="/static/images/ic-you.png"></image> | |||||
</view> | |||||
</view> | |||||
</block> | |||||
</view> | |||||
</template> | |||||
<!-- <script module="toods" lang="wxs" src="@/wxs/util.wxs"></script> --> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { | |||||
// peopleApi, | |||||
// publicApi | |||||
// } = app.globalData.api; | |||||
import * as publicApi from '@/api/publicApi'; | |||||
import * as peopleApi from '@/api/peopleApi'; | |||||
export default { | |||||
data() { | |||||
return { | |||||
options: { | |||||
name: '', | |||||
pageType: '' | |||||
}, | |||||
recursionObj: { | |||||
icon: '' | |||||
}, | |||||
newsPageList: [] | |||||
}; | |||||
}, | |||||
onLoad(options) { | |||||
this.options = options | |||||
this.newsPageApi(); | |||||
if (this.options.name === '政策推送') { | |||||
this.recursionApi(); | |||||
} | |||||
}, | |||||
methods: { | |||||
async newsPageApi() { | |||||
const param = { | |||||
pageNo: 1, | |||||
pageSize: 99, | |||||
categoryId: this.options.categoryId | |||||
}; | |||||
const { | |||||
data: { | |||||
list = [] | |||||
} | |||||
} = await peopleApi.newsPageApi(param); | |||||
if (list.length) { | |||||
this.newsPageList = list | |||||
} | |||||
}, | |||||
async recursionApi() { | |||||
const res = await publicApi.recursionApi({ | |||||
bannerType: 3, | |||||
parentId: this.options.parentId | |||||
}); | |||||
if (res.data) { | |||||
this.recursionObj = res.data[0] | |||||
} | |||||
}, | |||||
// 进入详情页 | |||||
headleDetails(event) { | |||||
const { | |||||
item | |||||
} = event.currentTarget.dataset; | |||||
uni.navigateTo({ | |||||
url: `/packages/public/pages/details/details-no-ops?name=${this.options.name}详情&referId=${item.id}` | |||||
}); | |||||
}, | |||||
headleDetails2(event) { | |||||
const { | |||||
item | |||||
} = event.currentTarget.dataset; | |||||
uni.navigateTo({ | |||||
url: `/packages/public/pages/details/details-no-ops?name=介休政务百科-详情&referId=${item.id}` | |||||
}); | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
// 办事指南 start | |||||
.second-model { | |||||
margin-top: 32rpx; | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 0 12rpx; | |||||
.second-line { | |||||
height: 120rpx; | |||||
border-bottom: 1px solid #efefef; | |||||
position: relative; | |||||
.line-name { | |||||
font-size: 34rpx; | |||||
font-weight: 400; | |||||
color: #007bd7; | |||||
line-height: 34rpx; | |||||
margin-left: 42rpx; | |||||
} | |||||
.line-you { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
} | |||||
} | |||||
} | |||||
// 政策推送 start | |||||
.second-header { | |||||
width: 100%; | |||||
height: 330rpx; | |||||
} | |||||
.second-section { | |||||
margin-top: 50rpx; | |||||
padding: 0 40rpx 0; | |||||
.section-item { | |||||
padding: 24rpx 0; | |||||
border-bottom: 1px solid #e1e1e1; | |||||
&:first-child { | |||||
padding-top: 0; | |||||
} | |||||
.section-item-left { | |||||
margin-right: 50rpx; | |||||
.consult-content-title { | |||||
font-size: 32rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
} | |||||
.consult-content-block { | |||||
font-size: 24rpx; | |||||
font-weight: 400; | |||||
color: #999999; | |||||
.block-first { | |||||
margin-right: 18rpx; | |||||
} | |||||
} | |||||
} | |||||
.section-item-right { | |||||
width: 200rpx; | |||||
height: 150rpx; | |||||
border-radius: 8rpx; | |||||
} | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,228 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<custom-nav-bar position="fixed" color="black" :left-text="options.name" left-arrow /> | |||||
<view class="second-model" v-if="options.name === '办事指南'"> | |||||
<view class="second-line flex flex-v-center flex-between" :style="itemName.cssStyle" | |||||
v-for="(itemName, idx) in recursionList" :key="idx"> | |||||
<navigator v-if="itemName.clickUrl" class="line-navigator" :url="toods.updateQuery(itemName.clickUrl, itemName)" | |||||
hover-class="none"></navigator> | |||||
<image class="line-img" :src="itemName.icon"></image> | |||||
<view class="line-name flex1">{{ itemName.name }}</view> | |||||
<image class="line-you" src="/static/images/ic-you.png"></image> | |||||
</view> | |||||
</view> | |||||
<view class="two-model flex flex-v-center flex-between" v-if="options.name === '事务办理'"> | |||||
<view class="second-line flex flex-col line1" :style="itemName.cssStyle" v-for="(itemName, idx) in recursionList" | |||||
:key="idx"> | |||||
<navigator v-if="itemName.clickUrl" class="line-navigator" :url="toods.updateQuery(itemName.clickUrl, itemName)" | |||||
hover-class="none"></navigator> | |||||
<image class="line-bg" :src="itemName.icon"></image> | |||||
<view class="line-title">{{ itemName.name }}</view> | |||||
<view v-if="itemName.remark" class="line-msg">{{ itemName.remark }}</view> | |||||
</view> | |||||
</view> | |||||
<view class="three-model" v-if="options.name === '便民小知识'"> | |||||
<view class="second-line flex flex-v-center flex-between" :style="itemName.cssStyle" | |||||
v-for="(itemName, idx) in recursionList" :key="idx"> | |||||
<navigator v-if="itemName.clickUrl" class="line-navigator" :url="toods.updateQuery(itemName.clickUrl, itemName)" | |||||
hover-class="none"></navigator> | |||||
<view class="line-name flex1 line-text-1">{{ itemName.name }}</view> | |||||
<image class="line-you" src="/static/images/ic-you.png"></image> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<!-- <script module="toods" lang="wxs" src="@/wxs/util.wxs"></script> --> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { | |||||
// publicApi | |||||
// } = app.globalData.api; | |||||
import * as publicApi from '@/api/publicApi'; | |||||
export default { | |||||
data() { | |||||
return { | |||||
options: { | |||||
name: '' | |||||
}, | |||||
recursionList: [] | |||||
}; | |||||
}, | |||||
onLoad(options) { | |||||
console.log(options) | |||||
this.options = options | |||||
this.recursionApi(); | |||||
}, | |||||
methods: { | |||||
async recursionApi() { | |||||
const { | |||||
bannerType, | |||||
parentId | |||||
} = this.options; | |||||
const res = await publicApi.recursionApi({ | |||||
bannerType, | |||||
parentId | |||||
}); | |||||
if (res.data) { | |||||
this.recursionList = res.data | |||||
} | |||||
}, | |||||
// 通用函数 | |||||
generalFunction(res) { | |||||
if (res.data && res.data.createTime) { | |||||
// res.data.createTime = app.globalData.util.timeFormat(res.data.createTime); | |||||
if (res.data.content) { | |||||
res.data.content = res.data.content | |||||
.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ') | |||||
.replace(/</g, '<') | |||||
.replace(/>/g, '>') | |||||
.replace(/&nbsp;/g, ' ') | |||||
.replace(/"/g, '"'); | |||||
} | |||||
return res.data; | |||||
} | |||||
return {}; | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
.line-navigator { | |||||
width: 100%; | |||||
height: 100%; | |||||
position: absolute; | |||||
z-index: 10; | |||||
top: 0; | |||||
left: 0; | |||||
} | |||||
.second-model { | |||||
margin-top: 32rpx; | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 0 12rpx; | |||||
.second-line { | |||||
height: 120rpx; | |||||
border-bottom: 1px solid #efefef; | |||||
position: relative; | |||||
.line-img { | |||||
width: 70rpx; | |||||
height: 70rpx; | |||||
border-radius: 50%; | |||||
} | |||||
.line-bg { | |||||
width: 100%; | |||||
height: 100%; | |||||
position: absolute; | |||||
z-index: -1; | |||||
top: 0; | |||||
left: 0; | |||||
} | |||||
.line-name { | |||||
font-size: 34rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
line-height: 34rpx; | |||||
margin-left: 42rpx; | |||||
} | |||||
.line-you { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
} | |||||
} | |||||
} | |||||
.two-model { | |||||
margin-top: 29rpx; | |||||
flex-wrap: wrap; | |||||
.second-line { | |||||
width: 343rpx; | |||||
height: 110rpx; | |||||
justify-content: center; | |||||
padding-left: 39rpx; | |||||
position: relative; | |||||
&:not(:first-child) { | |||||
margin-top: 16rpx; | |||||
} | |||||
.line-bg { | |||||
width: 100%; | |||||
height: 100%; | |||||
position: absolute; | |||||
z-index: -1; | |||||
top: 0; | |||||
left: 0; | |||||
} | |||||
.line-title { | |||||
font-size: 40rpx; | |||||
font-weight: 500; | |||||
line-height: 32rpx; | |||||
} | |||||
.line-msg { | |||||
margin-top: 21rpx; | |||||
font-size: 26rpx; | |||||
font-weight: 400; | |||||
color: #666666; | |||||
line-height: 26rpx; | |||||
} | |||||
} | |||||
.line1 { | |||||
width: 100%; | |||||
height: 171rpx; | |||||
.line-title { | |||||
font-size: 40rpx; | |||||
font-weight: 500; | |||||
line-height: 40rpx; | |||||
} | |||||
} | |||||
} | |||||
.three-model { | |||||
margin-top: 32rpx; | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 0 12rpx; | |||||
.second-line { | |||||
height: 120rpx; | |||||
border-bottom: 1px solid #efefef; | |||||
position: relative; | |||||
.line-name { | |||||
font-size: 34rpx; | |||||
font-weight: 400; | |||||
color: #007bd7; | |||||
line-height: 34rpx; | |||||
margin-left: 42rpx; | |||||
} | |||||
.line-you { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
} | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,444 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<custom-nav-bar position="fixed" color="black" left-text="发布诉求" left-arrow /> | |||||
<view class="line"></view> | |||||
<van-notice-bar color="#FF7F34" background="#FEF9F5" text="* 属于必填项" /> | |||||
<view class="card"> | |||||
<view class="flex flex-between issue-pd"> | |||||
<view class="card-title"> | |||||
关联企业 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<view> | |||||
<text v-if="appealDetails !== null">{{ appealDetails.enterpriseName }}</text> | |||||
<block v-if="appealDetails === null"> | |||||
<text class="card-placeholder">您未关联企业,去关联</text> | |||||
<van-icon @tap.native="headleEnterprise" color="#FE3B53" class="ml-10" name="add-o" size="16px" /> | |||||
</block> | |||||
</view> | |||||
</view> | |||||
<view class="flex flex-between issue-pd"> | |||||
<view class="card-title"> | |||||
诉求类型 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<view class="flex"> | |||||
<picker @change="bindPickerChange" data-name="appealType" data-index="appealTypeIndex" | |||||
data-list="appealTypeList" range-key="label" :value="value" :range="appealTypeList"> | |||||
<view class="picker"> | |||||
<text v-if="form.appealType !== ''" class="card-placeholder" | |||||
style="color: #000000">{{ appealTypeList[appealTypeIndex].label }}</text> | |||||
<text v-if="form.appealType === ''" class="card-placeholder" style="color: #999">请选择诉求类型</text> | |||||
<van-icon color="#FE3B53" class="ml-10" name="arrow-down" size="16px" /> | |||||
</view> | |||||
</picker> | |||||
</view> | |||||
</view> | |||||
<view class="issue-pd"> | |||||
<view class="card-title"> | |||||
诉求标题 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<view class="mt-16"> | |||||
<input class="card-content" type="text" @input="headleInput" :value="form.appealTitle" data-name="appealTitle" | |||||
maxlength="30" placeholder="请输入诉求标题,文字不超过30字" /> | |||||
</view> | |||||
</view> | |||||
<view class="issue-pd"> | |||||
<view class="card-title"> | |||||
诉求内容 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<view class="mt-16"> | |||||
<textarea class="textarea card-content" :value="form.appealContent" @input="headleInput" | |||||
data-name="appealContent" maxlength="200" placeholder="请输入诉求内容,文字不超过200字"></textarea> | |||||
<view class="mt-16"> | |||||
<van-uploader :file-list="fileList" :deletable="true" @after-read="afterRead" max-count="9" | |||||
@delete="imageDelete"> | |||||
<van-icon name="/packages/enterprise/image/camera.png" size="80px" /> | |||||
</van-uploader> | |||||
<view class="mt-16 card-block">附件不超过9个,每个大小不超过1M</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view class="issue-pd"> | |||||
<view class="card-title"> | |||||
姓名 | |||||
<text class="red ml-10">*</text> | |||||
</view> | |||||
<view class="mt-16"> | |||||
<input class="flex1 textarea-class" @input="headleInput" v-model="form.name" type="text" data-name="name" | |||||
placeholder="请输入姓名" /> | |||||
</view> | |||||
</view> | |||||
<view class="issue-pd"> | |||||
<view class="card-title">当前位置</view> | |||||
<view class="mt-16 flex flex-between"> | |||||
<input style="width: 90%" class="card-content" type="text" :value="form.appealCurrentLocation" disabled | |||||
maxlength="30" placeholder="请选择地址" /> | |||||
<van-icon name="location-o" @click="headleAdress" color="#FE3B53" size="16px" /> | |||||
</view> | |||||
</view> | |||||
<view class="flex flex-between issue-pd"> | |||||
<view class="card-title">同意对外展示我的诉求</view> | |||||
<view class="flex"> | |||||
<picker @change="bindPickerChange" data-name="appealShowFlag" data-index="appealShowFlagIndex" | |||||
data-list="agreeList" range-key="label" :value="value" :range="agreeList"> | |||||
<view class="picker"> | |||||
<text v-if="form.appealShowFlag !== ''" class="card-placeholder" | |||||
style="color: #000000">{{ agreeList[appealShowFlagIndex].label }}</text> | |||||
<text v-if="form.appealShowFlag === ''" class="card-placeholder" style="color: #999">请选择诉求类型</text> | |||||
<van-icon color="#FE3B53" class="ml-10" name="arrow-down" size="16px" /> | |||||
</view> | |||||
</picker> | |||||
</view> | |||||
</view> | |||||
<view class="mt-50"> | |||||
<van-button @click="submit" block color="#FE3B53">提交信息</van-button> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { enterprise, publicApi } = app.globalData.api; | |||||
import * as publicApi from '@/api/publicApi'; | |||||
import * as enterprise from '@/api/enterprise'; | |||||
export default { | |||||
components: {}, | |||||
data() { | |||||
return { | |||||
userInfoCount: null, | |||||
userId: uni.getStorageSync('userInfoData').userId, | |||||
fileList: [], | |||||
appealEnclosure: [], | |||||
appealTypeList: [], | |||||
agreeList: [{ | |||||
label: '是', | |||||
value: 1 | |||||
}, | |||||
{ | |||||
label: '否', | |||||
value: 0 | |||||
} | |||||
], | |||||
enterpriseList: [], | |||||
enterpriseIndex: '', | |||||
appealTypeIndex: '', | |||||
appealShowFlagIndex: 0, | |||||
appealDetails: null, | |||||
form: { | |||||
appealShowFlag: 1, | |||||
enterpriseId: '', | |||||
appealType: '', | |||||
appealTitle: '', | |||||
appealContent: '', | |||||
// appealCurrentLocation: app.globalData.config.locationInfo.name, | |||||
name: '' | |||||
}, | |||||
checked: false, | |||||
name: '', | |||||
value: '', | |||||
label: '' | |||||
}; | |||||
}, | |||||
async onLoad(optons) { | |||||
if (Object.keys(optons).length) { | |||||
this.getEnterprise(optons.id); | |||||
} | |||||
}, | |||||
async onShow() { | |||||
const userInfoCount = uni.getStorageSync('userInfoCount'); | |||||
this.setData({ | |||||
userInfoCount | |||||
}); | |||||
this.getEnterpriseList(); | |||||
this.getAppelaTypeList(); | |||||
const userInfoData = uni.getStorageSync('userInfoData'); | |||||
this.setData({ | |||||
userId: userInfoData.userId | |||||
}); | |||||
}, | |||||
methods: { | |||||
// 获取企业列表 | |||||
async getEnterpriseList() { | |||||
const res = await enterprise.getEnterpriseListApi({ | |||||
userId: this.userId | |||||
}); | |||||
if (res.data) { | |||||
this.setData({ | |||||
enterpriseList: res.data.list | |||||
}); | |||||
} | |||||
}, | |||||
// 字典请求-诉求类型 | |||||
async getAppelaTypeList() { | |||||
const res = await publicApi.getDictDataApi({ | |||||
dictType: 'appeal_type' | |||||
}); | |||||
if (res.data) { | |||||
this.setData({ | |||||
appealTypeList: res.data.list | |||||
}); | |||||
} | |||||
}, | |||||
// 跳转关联企业页面 | |||||
headleEnterprise() { | |||||
// 暂时去除跳转实名认证 | |||||
// const { | |||||
// userInfoCount | |||||
// } = this.data; | |||||
// if (userInfoCount.realNameAuthFlag === 1) { | |||||
uni.navigateTo({ | |||||
url: `/packages/enterprise/pages/relation-enterprise/relation-enterprise` | |||||
}); | |||||
// } else if (userInfoCount.realNameAuthFlag === 0) { | |||||
// wx.navigateTo({ | |||||
// url: `/packages/enterprise/pages/enterprise-certification/enterprise-certification`, | |||||
// }); | |||||
// } | |||||
}, | |||||
// 选择对应的诉求类型 | |||||
bindPickerChange: function(e) { | |||||
let { | |||||
name | |||||
} = e.target.dataset; | |||||
const { | |||||
index | |||||
} = e.target.dataset; | |||||
const Listname = e.target.dataset.list; | |||||
const List = this[Listname]; | |||||
name = `form.${name}`; | |||||
this.setData({ | |||||
[index]: e.detail.value, | |||||
[name]: Listname === 'enterpriseList' ? List[e.detail.value].id : List[e.detail.value].value | |||||
}); | |||||
}, | |||||
// 清楚对应的image图片 | |||||
imageDelete(event) { | |||||
const { | |||||
index | |||||
} = event.detail; | |||||
const Image = this.fileList; | |||||
Image.splice(index, 1); | |||||
this.setData({ | |||||
fileList: Image | |||||
}); | |||||
}, | |||||
// 上传图片 | |||||
async afterRead(event) { | |||||
const { | |||||
file | |||||
} = event.detail; | |||||
// const res = await app.globalData.upload({ | |||||
// file | |||||
// }); | |||||
if (res.code !== 0) { | |||||
uni.showToast({ | |||||
title: '上传图片失败', | |||||
icon: 'none' | |||||
}); | |||||
return false; | |||||
} | |||||
const { | |||||
fileList | |||||
} = this; | |||||
const { | |||||
appealEnclosure | |||||
} = this; | |||||
const url = res.data; | |||||
fileList.push({ | |||||
url | |||||
}); | |||||
appealEnclosure.push(url); | |||||
this.setData({ | |||||
fileList, | |||||
appealEnclosure | |||||
}); | |||||
}, | |||||
// 输入框重新赋值 | |||||
headleInput(event) { | |||||
const { | |||||
value | |||||
} = event.detail; | |||||
const { | |||||
name | |||||
} = event.currentTarget.dataset; | |||||
this.form[name] = value; | |||||
this.setData({ | |||||
...this.form, | |||||
[name]: this[name] | |||||
}); | |||||
console.log(this.form); | |||||
}, | |||||
// 选择地址 | |||||
headleAdress() { | |||||
this.setData({ | |||||
form: { | |||||
...this.form, | |||||
// appealCurrentLocation: app.globalData.config.locationInfo.name | |||||
} | |||||
}); | |||||
}, | |||||
// 获得企业详情 | |||||
async getEnterprise(id) { | |||||
const res = await enterprise.getEnterpriseApi(id); | |||||
if (res.data) { | |||||
this.setData({ | |||||
...this, | |||||
appealDetails: res.data, | |||||
form: { | |||||
...this.form, | |||||
enterpriseId: res.data.id | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
// 提交form表单 | |||||
async submit() { | |||||
const { | |||||
enterpriseId, | |||||
appealType, | |||||
appealTitle, | |||||
appealContent, | |||||
appealCurrentLocation, | |||||
name | |||||
} = this.form; | |||||
const params = { | |||||
enterpriseId, | |||||
appealType, | |||||
appealTitle, | |||||
appealContent, | |||||
appealCurrentLocation, | |||||
appealProcessStatus: 1, | |||||
appealShowFlag: 1, | |||||
appealEnclosure: this.appealEnclosure, | |||||
name | |||||
}; | |||||
if (enterpriseId === '' || appealType === '' || appealTitle === '' || appealContent === '') { | |||||
/* eslint-disable*/ | |||||
uni.showToast({ | |||||
title: enterpriseId == '' ? | |||||
'请选择关联企业' : appealType == '' ? | |||||
'请选择选择诉求类型' : appealType == '' ? | |||||
'请输入诉求标题' : appealType == '' ? | |||||
'请输入诉求内容' : '带*属于必填项', | |||||
icon: 'none' | |||||
}); | |||||
return false; | |||||
} | |||||
const res = await enterprise.createAppealApi(params); | |||||
if (res.code !== 0) { | |||||
uni.showToast({ | |||||
title: res.msg, | |||||
icon: 'none' | |||||
}); | |||||
return; | |||||
} | |||||
uni.showToast({ | |||||
title: '发布诉求成功', | |||||
icon: 'none' | |||||
}); | |||||
uni.redirectTo({ | |||||
url: '/packages/enterprise/pages/my-appeal/my-appeal' | |||||
}); | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
.ml-10 { | |||||
margin-left: 20rpx; | |||||
} | |||||
.mt-16 { | |||||
margin-top: 16rpx; | |||||
} | |||||
.mt-50 { | |||||
margin-top: 50rpx; | |||||
} | |||||
.mt-100 { | |||||
margin-top: 100rpx; | |||||
} | |||||
page { | |||||
background-color: #fff; | |||||
} | |||||
.van-notice-bar { | |||||
--notice-bar-padding: 0 40rpx; | |||||
} | |||||
.line { | |||||
width: 100%; | |||||
height: 36rpx; | |||||
} | |||||
.card { | |||||
padding: 0rpx 40rpx 40rpx 40rpx; | |||||
} | |||||
.issue-pd { | |||||
align-items: center; | |||||
padding: 42rpx 0; | |||||
border-bottom: 1px solid #efefef; | |||||
} | |||||
.card-title { | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
} | |||||
.card-content { | |||||
font-size: 32rpx; | |||||
font-weight: 400; | |||||
} | |||||
.card-placeholder { | |||||
font-size: 32rpx; | |||||
font-weight: 400; | |||||
color: #999999; | |||||
} | |||||
.card-block { | |||||
font-size: 26rpx; | |||||
font-weight: 400; | |||||
color: #999999; | |||||
} | |||||
.textarea { | |||||
width: 100%; | |||||
height: 180rpx; | |||||
line-height: 40rpx; | |||||
} | |||||
.ic-check { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
margin-right: 20rpx; | |||||
} | |||||
</style> |
@@ -0,0 +1,345 @@ | |||||
<template> | |||||
<view> | |||||
<custom-nav-bar position="fixed" color="black" left-text="我的诉求" left-arrow border /> | |||||
<scroll-view :scroll-y="true" :style="'height:' + (windowHeight + 'px')" @scrolltolower="headleTopLower"> | |||||
<view class="myAppeal"> | |||||
<!-- 内容部分 --> | |||||
<view v-if="List.length !== 0" class="myAppeal-conent" @tap="details" :data-item="item" | |||||
v-for="(item, index) in List" :key="index"> | |||||
<view class="godd-replay-head"> | |||||
<image src="/static/packages/enterprise/image/my-appeal.png" mode="aspectFill" /> | |||||
<text class="myAppeal-head-title">{{ item.enterpriseName }}</text> | |||||
</view> | |||||
<view class="myAppeal-flex"> | |||||
<block v-for="(type, index1) in typeList" :key="index1"> | |||||
<view v-if="item.appealType + '' === type.value" class="myAppeal-type" | |||||
:style="'background-color: ' + type.cssClass + ';'">{{ type.label }}</view> | |||||
</block> | |||||
<view> | |||||
<text class="myAppeal-conent-block">{{ toods.getDateTime(item.createTime, 2) }}</text> | |||||
<block v-for="(state, index1) in statusList" :key="index1"> | |||||
<text v-if="item.appealProcessStatus + '' === state.value" | |||||
class="myAppeal-conent-bg myAppeal-conent-block" :style="'background-color: ' + state.cssClass + ';'"> | |||||
{{ state.label }} | |||||
</text> | |||||
</block> | |||||
</view> | |||||
</view> | |||||
<view class="myAppeal-title mt-21 uniline">{{ item.appealTitle }}</view> | |||||
<view class="myAppeal-subheading multi-line"> | |||||
<rich-text :nodes="item.appealContent"></rich-text> | |||||
</view> | |||||
<view class="myAppeal-imgage" v-if="item.appealEnclosure"> | |||||
<image v-if="key < 3" :src="url" v-for="(url, key) in item.appealEnclosure" :key="key"></image> | |||||
</view> | |||||
<view class="myAppeal-conent-block mt-21 uniline" v-if="item.appealCurrentLocation !== null"> | |||||
<rich-text :nodes="item.appealCurrentLocation" /> | |||||
</view> | |||||
<view class="border"></view> | |||||
<view class="myAppeal-bg" v-if="item.perfectReplyFlag === 1"> | |||||
<view> | |||||
<view> | |||||
<image src="/static/images/ic-success.png" mode="aspectFill"></image> | |||||
<text>{{ item.nickName }}</text> | |||||
</view> | |||||
<view class="myAppeal-conent-block">{{ toods.getDateTime(item.replyTime, 2) }}</view> | |||||
</view> | |||||
<view class="myAppeal-bg-conent"> | |||||
<rich-text :nodes="item.appealReply"></rich-text> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<van-empty v-if="List.length === 0" description="暂时没有我的诉求" /> | |||||
</view> | |||||
</scroll-view> | |||||
</view> | |||||
</template> | |||||
<!-- <script module="toods" lang="wxs" src="@/wxs/util.wxs"></script> --> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { | |||||
// enterprise, | |||||
// publicApi | |||||
// } = app.globalData.api; | |||||
import * as publicApi from '@/api/publicApi'; | |||||
import * as enterprise from '@/api/enterprise'; | |||||
export default { | |||||
data() { | |||||
return { | |||||
windowHeight: null, | |||||
option: {}, | |||||
type: { | |||||
value: '', | |||||
cssClass: '', | |||||
label: '' | |||||
}, | |||||
status: 'appeal_process_status', | |||||
typeList: [], | |||||
statusList: [], | |||||
List: [], | |||||
params: { | |||||
userId: uni.getStorageSync('userInfoData').userId, | |||||
pageNo: 1, | |||||
pageSize: 15 | |||||
}, | |||||
state: { | |||||
value: '', | |||||
cssClass: '', | |||||
label: '' | |||||
}, | |||||
url: '' | |||||
}; | |||||
}, | |||||
async onLoad(option) { | |||||
const res = uni.getSystemInfoSync(); | |||||
this.windowHeight = res.windowHeight | |||||
this.option = option | |||||
await this.getAppealList(); | |||||
await this.getTypeList(); | |||||
await this.getStateList(); | |||||
}, | |||||
methods: { | |||||
// 详情页跳转 | |||||
details(event) { | |||||
const { | |||||
item | |||||
} = event.currentTarget.dataset; | |||||
uni.navigateTo({ | |||||
url: `/packages/enterprise/pages/details/details?id=${item.id}` | |||||
}); | |||||
}, | |||||
// 获取我的企业列表 | |||||
async getAppealList() { | |||||
const res = await enterprise.getAppealListApi(this.params); | |||||
if (res.data && res.data.list.length === 0) { | |||||
uni.showToast({ | |||||
title: '已经加载底部了', | |||||
icon: 'none' | |||||
}); | |||||
return; | |||||
} | |||||
if (res.data) { | |||||
this.List = this.List.concat(res.data.list) | |||||
} | |||||
}, | |||||
// 获取类型字典 | |||||
async getTypeList() { | |||||
const res = await publicApi.getDictDataApi({ | |||||
dictType: this.type | |||||
}); | |||||
if (res.data) { | |||||
this.typeList = res.data.list | |||||
} | |||||
}, | |||||
// 获取状态字典 | |||||
async getStateList() { | |||||
const res = await publicApi.getDictDataApi({ | |||||
dictType: this.status | |||||
}); | |||||
if (res.data) { | |||||
this.statusList = res.data.list | |||||
} | |||||
}, | |||||
// 分页加载 | |||||
headleTopLower() { | |||||
const { | |||||
userId, | |||||
pageNo, | |||||
pageSize | |||||
} = this.params; | |||||
this.params = { | |||||
userId: userId, | |||||
pageNo: pageNo + 1, | |||||
pageSize: pageSize | |||||
} | |||||
this.getAppealList(); | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
page { | |||||
background-color: #fff; | |||||
} | |||||
.mt-20 { | |||||
margin-top: 40rpx; | |||||
} | |||||
.mt-21 { | |||||
margin-top: 21rpx; | |||||
} | |||||
.myAppeal { | |||||
padding: 37rpx 40rpx 40rpx 40rpx; | |||||
} | |||||
.myAppeal>.myAppeal-title { | |||||
position: relative; | |||||
width: 175rpx; | |||||
height: 10rpx; | |||||
background: #ffe5e9; | |||||
border-radius: 2rpx; | |||||
line-height: 0; | |||||
margin-top: 10px; | |||||
text { | |||||
position: absolute; | |||||
top: -5px; | |||||
text-align: center; | |||||
width: 100%; | |||||
font-size: 36rpx; | |||||
font-weight: 500; | |||||
color: #000000; | |||||
} | |||||
} | |||||
.myAppeal-conent { | |||||
height: 100%; | |||||
&:not(:first-child) { | |||||
margin-top: 37rpx; | |||||
} | |||||
.godd-replay-head { | |||||
display: flex; | |||||
.myAppeal-head-title { | |||||
font-size: 32rpx; | |||||
font-weight: 500; | |||||
color: #fe3b53; | |||||
} | |||||
image { | |||||
width: 44rpx; | |||||
height: 44rpx; | |||||
margin-right: 24rpx; | |||||
} | |||||
} | |||||
.myAppeal-flex { | |||||
margin-top: 32rpx; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
.myAppeal-type { | |||||
width: 88rpx; | |||||
height: 38rpx; | |||||
line-height: 38rpx; | |||||
text-align: center; | |||||
color: #fff; | |||||
box-shadow: 2px 2px 2px 0px rgba(12, 181, 207, 0.1); | |||||
border-radius: 8rpx; | |||||
} | |||||
.myAppeal-conent-title { | |||||
font-size: 32rpx; | |||||
font-weight: 400; | |||||
color: #fe3b53; | |||||
} | |||||
.myAppeal-conent-bg { | |||||
padding: 5rpx 20rpx; | |||||
height: 38rpx; | |||||
text-align: center; | |||||
color: #fff; | |||||
line-height: 38rpx; | |||||
box-shadow: 2px 2px 2px 0px rgba(254, 61, 85, 0.1); | |||||
border-radius: 500rpx; | |||||
margin-left: 39rpx; | |||||
} | |||||
} | |||||
} | |||||
.border { | |||||
padding: 16rpx 0 18rpx 0; | |||||
border-bottom: 1px solid #efefef; | |||||
} | |||||
.myAppeal-conent-block { | |||||
font-size: 24rpx; | |||||
font-weight: 400; | |||||
color: #999999; | |||||
} | |||||
.myAppeal-title { | |||||
font-size: 32rpx; | |||||
font-weight: 500; | |||||
color: #000000; | |||||
} | |||||
.myAppeal-subheading { | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
margin-top: 24rpx; | |||||
} | |||||
.myAppeal-imgage { | |||||
margin-top: 24rpx; | |||||
display: grid; | |||||
grid-template-columns: 1fr 1fr 1fr; | |||||
image { | |||||
width: 222rpx; | |||||
height: 222rpx; | |||||
border-radius: 10rpx; | |||||
margin-right: 10rpx; | |||||
} | |||||
} | |||||
.myAppeal-bg { | |||||
width: 678rpx; | |||||
background: #f7f7f7; | |||||
border-radius: 8px; | |||||
margin-top: 32rpx; | |||||
padding: 28rpx 20rpx; | |||||
view { | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
image { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
margin-right: 8rpx; | |||||
} | |||||
text { | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #fe3b53; | |||||
} | |||||
} | |||||
.myAppeal-bg-conent { | |||||
padding: 16rpx 0 0 40rpx; | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,211 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<custom-nav-bar position="fixed" color="black" left-text="关联企业" left-arrow /> | |||||
<view class="enterprise" v-if="List.length !== 0"> | |||||
<van-swipe-cell :right-width="80" async-close v-for="(item, index) in List" :key="index"> | |||||
<view class="flex flex-v-center border" @tap="relationDetails" :data-item="item"> | |||||
<image class="enterprise-icon" src="/static/packages/enterprise/image/my-appeal.png" mode="aspectFill"> | |||||
</image> | |||||
<view> | |||||
<view class="enterprise-title">{{ item.enterpriseName }}</view> | |||||
<view class="mt-24 enterprise-block"> | |||||
<text class="">法人姓名:</text> | |||||
<text class="red">{{ item.legalName }}</text> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view slot="right" :data-item="item" :data-index="index" @tap="swipeCell" class="enterprise-right"> | |||||
<view class="enterprise-circle"> | |||||
<van-icon name="delete-o" size="28px" color="#fff" /> | |||||
</view> | |||||
</view> | |||||
</van-swipe-cell> | |||||
</view> | |||||
<view class="custom-image" v-if="List.length === 0"> | |||||
<view style="width: 100%"> | |||||
<image class="image" src="/static/packages/enterprise/image/enterprise-none.png" mode="aspectFill"></image> | |||||
<view class="custom-image-title">您还未关联任何企业</view> | |||||
<van-button @tap.native="createEnterprise" custom-style="width:300rpx;height: 80rpx;" type="primary" | |||||
color="#E0383E">新增关联企业</van-button> | |||||
</view> | |||||
</view> | |||||
<view class="enterprise-button" v-if="List.length !== 0"> | |||||
<van-button @tap.native="createEnterprise" custom-style="height: 80rpx;" color="#E0383E" block>新增关联企业</van-button> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { enterprise } = app.globalData.api; | |||||
// import * as publicApi from '@/api/publicApi'; | |||||
import * as enterprise from '@/api/enterprise'; | |||||
export default { | |||||
components: {}, | |||||
data() { | |||||
return { | |||||
List: null | |||||
}; | |||||
}, | |||||
async onLoad() { | |||||
const res = uni.getSystemInfoSync(); | |||||
this.getEnterpriseList(); | |||||
}, | |||||
methods: { | |||||
// 返回上一步 | |||||
onClickLeft() { | |||||
uni.navigateTo({ | |||||
url: '/packages/enterprise/pages/issue-appeal/issue-appeal' | |||||
}); | |||||
}, | |||||
// 清楚对应的企业列表 | |||||
async swipeCell(event) { | |||||
const { | |||||
item, | |||||
index | |||||
} = event.currentTarget.dataset; | |||||
const res = await enterprise.DeleteEnterpriseIdApi(item.id); | |||||
if (res.code !== 0) { | |||||
uni.showToast({ | |||||
title: res.msg, | |||||
icon: 'none' | |||||
}); | |||||
return false; | |||||
} | |||||
uni.showToast({ | |||||
title: '移除成功', | |||||
icon: 'none' | |||||
}); | |||||
const { | |||||
List | |||||
} = this; | |||||
List.splice(index, 1); | |||||
this.setData({ | |||||
List: List | |||||
}); | |||||
}, | |||||
// 跳转-添加企业 | |||||
createEnterprise() { | |||||
uni.navigateTo({ | |||||
url: '/packages/enterprise/pages/create-enterprise/create-enterprise' | |||||
}); | |||||
}, | |||||
// 获取企业列表 | |||||
async getEnterpriseList() { | |||||
const res = await enterprise.getEnterpriseListApi({ | |||||
pageNo: 1, | |||||
pageSize: 15, | |||||
userId: uni.getStorageSync('userInfoData').userId | |||||
}); | |||||
if (res.data) { | |||||
this.setData({ | |||||
List: res.data.list | |||||
}); | |||||
} | |||||
}, | |||||
// 跳转我的诉求列表 | |||||
relationDetails(event) { | |||||
const { | |||||
item | |||||
} = event.currentTarget.dataset; | |||||
uni.redirectTo({ | |||||
url: `/packages/enterprise/pages/issue-appeal/issue-appeal?id=${item.id}` | |||||
}); | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
.mt-78 { | |||||
margin-top: 78rpx; | |||||
} | |||||
.enterprise { | |||||
padding: 36rpx 36rpx 0rpx 36rpx; | |||||
padding-bottom: 140rpx; | |||||
} | |||||
.border { | |||||
padding: 23rpx 0; | |||||
border-bottom: 1px solid #efefef; | |||||
} | |||||
.mt-24 { | |||||
margin-top: 24rpx; | |||||
} | |||||
.enterprise-title { | |||||
font-size: 32rpx; | |||||
font-weight: 500; | |||||
color: #333333; | |||||
} | |||||
.enterprise-block { | |||||
font-size: 28rpx; | |||||
font-weight: 400; | |||||
color: #666666; | |||||
} | |||||
.enterprise-icon { | |||||
width: 122rpx; | |||||
height: 122rpx; | |||||
margin-right: 23rpx; | |||||
border-radius: 10rpx; | |||||
} | |||||
.enterprise-right { | |||||
width: 160rpx; | |||||
height: 100%; | |||||
background: #f2f2f2; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
} | |||||
.enterprise-circle { | |||||
width: 90rpx; | |||||
height: 90rpx; | |||||
background-color: #e0383f; | |||||
border-radius: 50%; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
} | |||||
.enterprise-button { | |||||
padding: 25rpx 36rpx; | |||||
position: fixed; | |||||
bottom: 0; | |||||
left: 0; | |||||
width: 100%; | |||||
background-color: #ffffff; | |||||
} | |||||
.custom-image { | |||||
padding: 122rpx 25rpx 0 25rpx; | |||||
text-align: center; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
.image { | |||||
width: 100%; | |||||
height: 241rpx; | |||||
} | |||||
.custom-image-title { | |||||
margin: 78rpx 0 60rpx 0; | |||||
font-size: 32rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,243 @@ | |||||
<template> | |||||
<view style="height: 100%"> | |||||
<custom-nav-bar position="fixed" color="black" left-text="精彩介休" left-arrow /> | |||||
<view class="search"> | |||||
<view> | |||||
<view class="flex flex-between search-input"> | |||||
<input class="input" type="text" placeholder-class="placeholder-style" placeholder="请输入你想查询的内容" /> | |||||
<view class="search-icon flex flex-center"> | |||||
<image class="imgage" | |||||
src="https://zongzhi.xuqidata.com:5009/xq-ssg/d17f4b5125b293f8cf7ff1b633e4722c105ec1411347a9df1e0737c47300e535.png"> | |||||
</image> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view class="life-tabs"> | |||||
<van-tabs :active="tabs.active" title-active-color="#FE3B53" line-width="40px" | |||||
@change="onChange($event, { tagId: 'lifeListTabs' })" :ellipsis="false" id="lifeListTabs"> | |||||
<van-tab :title="key.name" v-for="(key, index) in recursionList" :key="index"> | |||||
<view class="life-tabs-flex"> | |||||
<van-grid column-num="2" :border="false" :center="false"> | |||||
<van-grid-item use-slot :url="item.clickUrl + '&name=' + item.name" | |||||
v-for="(item, index1) in key.children" :key="index1"> | |||||
<view class="flex flex-v-center"> | |||||
<view class="life-tabs-icon flex flex-center"> | |||||
<image class="icon" :src="item.icon" /> | |||||
</view> | |||||
<text class="life-iocn-title">{{ item.name }}</text> | |||||
</view> | |||||
</van-grid-item> | |||||
</van-grid> | |||||
</view> | |||||
</van-tab> | |||||
</van-tabs> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { publicApi } = app.globalData.api; | |||||
import * as publicApi from '@/api/publicApi'; | |||||
export default { | |||||
components: {}, | |||||
data() { | |||||
return { | |||||
// env: app.globalData.env, | |||||
// appName: app.globalData.env.appName, | |||||
tabs: { | |||||
active: 0, | |||||
list: [{ | |||||
id: 1, | |||||
title: '政务服务' | |||||
}, | |||||
{ | |||||
id: 2, | |||||
title: '公共服务' | |||||
}, | |||||
{ | |||||
id: 3, | |||||
title: '生活服务' | |||||
}, | |||||
{ | |||||
id: 4, | |||||
title: '企业服务' | |||||
}, | |||||
{ | |||||
id: 5, | |||||
title: '区级服务' | |||||
}, | |||||
{ | |||||
id: 6, | |||||
title: '全部' | |||||
} | |||||
], | |||||
first: { | |||||
title: '精彩介休', | |||||
list: [{ | |||||
bgColor: 'linear-gradient(180deg, #FC9D38 0%, #FE9153 100%)', | |||||
icon: '/images/life/gourmet.png', | |||||
name: '美食' | |||||
}, | |||||
{ | |||||
bgColor: 'linear-gradient(180deg, #FF5F7A 0%, #FE3B53 100%)', | |||||
icon: '/images/life/market.png', | |||||
name: '商场' | |||||
}, | |||||
{ | |||||
bgColor: 'linear-gradient(180deg, #FF95A7 0%, #FF6A7C 100%)', | |||||
icon: '/images/life/film.png', | |||||
name: '电影演出' | |||||
}, | |||||
{ | |||||
bgColor: 'linear-gradient(180deg, #F48BC0 0%, #EF6BA8 100%)', | |||||
icon: '/images/life/park.png', | |||||
name: '公园' | |||||
}, | |||||
{ | |||||
bgColor: 'linear-gradient(180deg, #B17DF3 0%, #A068F0 100%)', | |||||
icon: '/images/life/scenic.png', | |||||
name: '景点' | |||||
}, | |||||
{ | |||||
bgColor: 'linear-gradient(180deg, #22ACFB 0%, #1593F7 100%)', | |||||
icon: '/images/life/hospital.png', | |||||
name: '医院' | |||||
}, | |||||
{ | |||||
bgColor: 'linear-gradient(180deg, #329CF0 0%, #2789EC 100%)', | |||||
icon: '/images/life/bus.png', | |||||
name: '公交车' | |||||
}, | |||||
{ | |||||
bgColor: 'linear-gradient(180deg, #8D8EFF 0%, #7375F6 100%)', | |||||
icon: '/images/life/all.png', | |||||
name: '全部' | |||||
} | |||||
] | |||||
} | |||||
}, | |||||
recursionList: '' | |||||
}; | |||||
}, | |||||
async onLoad() { | |||||
this.recursionApi(); | |||||
}, | |||||
methods: { | |||||
async recursionApi() { | |||||
const res = await publicApi.recursionApi({ | |||||
bannerType: 2, | |||||
parentId: 15 | |||||
}); | |||||
if (res.data) { | |||||
this.setData({ | |||||
recursionList: res.data | |||||
}); | |||||
// 触发tabs重绘,解决tabs底部下划线位置错误 | |||||
this.zpSelectComponent('#lifeListTabs').resize(); | |||||
} | |||||
}, | |||||
onChange(e, _dataset) { | |||||
/* ---处理dataset begin--- */ | |||||
this.handleDataset(e, _dataset); | |||||
/* ---处理dataset end--- */ | |||||
console.log('占位:函数 onChange 未声明'); | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
.right-icon { | |||||
width: 64rpx; | |||||
height: 64rpx; | |||||
background: #ffffff; | |||||
border-radius: 35px; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
border: 1px solid #e1e1e1; | |||||
.icon { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
} | |||||
} | |||||
.search { | |||||
padding: 30rpx 30rpx 54rpx 30rpx; | |||||
.search-input { | |||||
height: 64rpx; | |||||
line-height: 64rpx; | |||||
background: #f9f9f9; | |||||
border-radius: 1000rpx; | |||||
border: 1px solid #e1e1e1; | |||||
.input { | |||||
width: 87%; | |||||
line-height: 64rpx; | |||||
height: 60rpx; | |||||
text-decoration: 20rpx; | |||||
padding-left: 30rpx; | |||||
font-size: 26rpx; | |||||
font-weight: 400; | |||||
} | |||||
.placeholder-style { | |||||
text-align: center; | |||||
color: #c1c1c1; | |||||
} | |||||
} | |||||
.search-icon { | |||||
width: 64rpx; | |||||
height: 64rpx; | |||||
background: #ffffff; | |||||
border-radius: 5000rpx; | |||||
border: 1px solid #e1e1e1; | |||||
.imgage { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
} | |||||
} | |||||
.life-tabs { | |||||
margin-top: 40rpx; | |||||
.van-tabs__wrap { | |||||
border-bottom: 1px solid #c1c1c1; | |||||
} | |||||
.life-tabs-flex { | |||||
margin-top: 50rpx; | |||||
.life-tabs-icon { | |||||
width: 70rpx; | |||||
height: 70rpx; | |||||
box-shadow: 0px 6px 4px 0px rgba(254, 80, 107, 0.1); | |||||
border-radius: 500rpx; | |||||
.icon { | |||||
width: 70rpx; | |||||
height: 70rpx; | |||||
} | |||||
} | |||||
.life-iocn-title { | |||||
margin-left: 32rpx; | |||||
font-size: 34rpx; | |||||
font-weight: 400; | |||||
color: #333333; | |||||
line-height: 34rpx; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
</style> |
@@ -0,0 +1,303 @@ | |||||
<template> | |||||
<view> | |||||
<custom-nav-bar position="fixed" color="black" :left-text="optin.name" left-arrow /> | |||||
<view class="search"> | |||||
<view class="flex flex-between search-input"> | |||||
<input class="input" :value="searchValue" type="text" confirm-type="search" | |||||
placeholder-class="placeholder-style" placeholder="请输入搜索商户名称" @input="onSearch" @confirm="onChange" /> | |||||
<view class="search-icon flex flex-center"> | |||||
<image class="imgage" src="/static/images/search.png"></image> | |||||
</view> | |||||
</view> | |||||
<view class="life-tabs" v-if="dataList.length !== 0"> | |||||
<view class="life-conent" @tap="headleDetails" :data-item="item" v-for="(item, index) in dataList" :key="index"> | |||||
<image class="life-conent-image" :src="item.merchantPhoto" mode="aspectFill"></image> | |||||
<view class="life-conent-article flex flex-col flex-between"> | |||||
<view class="life-conent-title text-line-1">{{ item.merchantName }}</view> | |||||
<view class="life-conent-block text-line-2"> | |||||
<rich-text :nodes="item.merchantIntroduce"></rich-text> | |||||
</view> | |||||
<view class="life-conent-rate flex flex-v-center flex-between"> | |||||
<van-rate readonly icon="/images/void-icon2.png" void-icon="/images/rate-icon.png" | |||||
:value="item.merchantGrade" /> | |||||
<view> | |||||
<text>距离</text> | |||||
<!-- <text class="rate-loca-active">{{ $tootls.setMorKm(item.distance) }}</text> --> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<van-empty v-if="dataList.length === 0" :description="'暂无' + optin.name" /> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<!-- <script module="toods" lang="wxs" src="@/wxs/util.wxs"></script> --> | |||||
<script> | |||||
// const app = getApp(); | |||||
// const { | |||||
// lifeApi | |||||
// } = app.globalData.api; | |||||
import * as lifeApi from '@/api/lifeApi'; | |||||
export default { | |||||
components: {}, | |||||
data() { | |||||
return { | |||||
searchValue: '', | |||||
optin: { | |||||
name: '' | |||||
}, | |||||
dataList: [], | |||||
pageNo: 1, | |||||
pageSize: 10, | |||||
total: 0 | |||||
}; | |||||
}, | |||||
onLoad(optin) { | |||||
this.optin = optin | |||||
this.merchantPageApi(); | |||||
}, | |||||
onReachBottom() { | |||||
if (this.dataList.length === this.total) { | |||||
return; | |||||
} | |||||
this.merchantPageApi(false); | |||||
}, | |||||
methods: { | |||||
// 生活对应栏目的分页查询 | |||||
async merchantPageApi(reset = true) { | |||||
const params = this.generalQueryData(reset); | |||||
const res = await lifeApi.merchantPageApi(params); | |||||
let _goodsList = [] | |||||
if (res.data) { | |||||
const { | |||||
list = [], total = 0 | |||||
} = res.data; | |||||
if (reset) { | |||||
_goodsList = list; | |||||
} else { | |||||
_goodsList = this.dataList.concat(list); | |||||
} | |||||
this.pageNo = params.pageNo || 1; | |||||
this.total = total; | |||||
_goodsList.forEach((element) => { | |||||
if (element.merchantIntroduce) { | |||||
element.merchantIntroduce = element.merchantIntroduce.replace(/(\<img|\<p|src=null)/gi, function($0, | |||||
$1) { | |||||
console.log($0, $1); | |||||
return { | |||||
'<img': '<img style="width:100%;height:auto;display:block;" ', | |||||
'<p': '<p', | |||||
'<article': '<div', | |||||
'</article': '</div', | |||||
'<header': '<div', | |||||
'</header': '</div' | |||||
} [$1]; | |||||
}); | |||||
} | |||||
}); | |||||
console.log(_goodsList) | |||||
this.dataList = _goodsList | |||||
// this.setData({ | |||||
// dataList: _goodsList | |||||
// }); | |||||
} | |||||
}, | |||||
onChange(e) { | |||||
this.searchValue = e.detail.value | |||||
// this.setData({ | |||||
// searchValue: e.detail.value | |||||
// }); | |||||
this.merchantPageApi(); | |||||
}, | |||||
onSearch(e) { | |||||
if (e.detail.value !== '') { | |||||
return; | |||||
} | |||||
this.searchValue = e.detail.value | |||||
// this.setData({ | |||||
// searchValue: e.detail.value | |||||
// }); | |||||
this.merchantPageApi(); | |||||
}, | |||||
// 分页参数处理事件 | |||||
generalQueryData(reset = false) { | |||||
const { | |||||
pageNo, | |||||
pageSize, | |||||
searchValue, | |||||
optin | |||||
} = this; | |||||
// const { | |||||
// latitude, | |||||
// longitude | |||||
// } = app.globalData.config.locationInfo; | |||||
const params = { | |||||
pageNo: 1, | |||||
pageSize: 10 | |||||
}; | |||||
if (optin.type === '1') { | |||||
params.latitude = latitude; | |||||
params.longitude = longitude; | |||||
// params.nearFlag = 1; | |||||
} | |||||
if (searchValue) { | |||||
params.merchantName = searchValue; | |||||
} | |||||
if (optin.id) { | |||||
params.merchantType = optin.id; | |||||
} | |||||
if (reset) { | |||||
return params; | |||||
} | |||||
return { | |||||
...params, | |||||
pageNo: pageNo + 1, | |||||
pageSize | |||||
}; | |||||
}, | |||||
// 进入详情页 | |||||
headleDetails(event) { | |||||
const { | |||||
id | |||||
} = event.currentTarget.dataset.item; | |||||
uni.navigateTo({ | |||||
url: `/packages/public/pages/details/details?name=店铺详情&referId=${id}` | |||||
}); | |||||
} | |||||
} | |||||
}; | |||||
</script> | |||||
<style lang="less"> | |||||
page { | |||||
--rate-icon-size: 26rpx; // 评分大小 | |||||
--rate-icon-gutter: 8rpx; // 评分图标之前的距离 | |||||
} | |||||
.right-icon { | |||||
width: 64rpx; | |||||
height: 64rpx; | |||||
background: #ffffff; | |||||
border-radius: 35px; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
border: 1px solid #e1e1e1; | |||||
.icon { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
} | |||||
} | |||||
.search { | |||||
padding: 30rpx 30rpx 54rpx 30rpx; | |||||
.search-input { | |||||
height: 64rpx; | |||||
line-height: 64rpx; | |||||
background: #f9f9f9; | |||||
border-radius: 35rpx; | |||||
border: 1px solid #e1e1e1; | |||||
text-align: center; | |||||
position: relative; | |||||
box-sizing: content-box; | |||||
.input { | |||||
width: 100%; | |||||
height: 64rpx; | |||||
line-height: 64rpx; | |||||
text-decoration: 20rpx; | |||||
padding: 0 64rpx; | |||||
font-size: 26rpx; | |||||
font-weight: 400; | |||||
} | |||||
.placeholder-style { | |||||
text-align: center; | |||||
color: #c1c1c1; | |||||
} | |||||
} | |||||
.search-icon { | |||||
width: 64rpx; | |||||
height: 64rpx; | |||||
background: #ffffff; | |||||
border-radius: 35rpx; | |||||
border: 1px solid #e1e1e1; | |||||
position: absolute; | |||||
right: -1px; | |||||
top: 0; | |||||
z-index: 1; | |||||
.imgage { | |||||
width: 32rpx; | |||||
height: 32rpx; | |||||
} | |||||
} | |||||
.life-tabs { | |||||
margin-top: 40rpx; | |||||
.van-tabs__wrap { | |||||
border-bottom: 1px solid #c1c1c1; | |||||
} | |||||
.life-conent { | |||||
margin-top: 37rpx; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
padding-bottom: 24rpx; | |||||
border-bottom: 1px solid #efefef; | |||||
.life-conent-image { | |||||
width: 160rpx; | |||||
height: 160rpx; | |||||
border-radius: 10rpx; | |||||
} | |||||
.life-conent-article { | |||||
flex: 1; | |||||
margin-left: 24rpx; | |||||
.life-conent-title { | |||||
font-size: 30rpx; | |||||
font-weight: 500; | |||||
color: #333333; | |||||
line-height: 30rpx; | |||||
} | |||||
.life-conent-block { | |||||
margin-top: 21rpx; | |||||
font-size: 26rpx; | |||||
font-weight: 400; | |||||
color: #666666; | |||||
line-height: 38rpx; | |||||
height: 66rpx; | |||||
} | |||||
.life-conent-rate { | |||||
font-size: 24rpx; | |||||
font-weight: 400; | |||||
color: #999999; | |||||
line-height: 24rpx; | |||||
margin-top: 9rpx; | |||||
.rate-loca-active { | |||||
color: #333333; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
</style> |