commit e0de3c2e4301d904691a35322bbbc944e97d13f1 Author: jiangrui <403209447@qq.com> Date: Thu Jan 12 16:47:33 2023 +0800 init diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab9ed6b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +/miniprogram/miniprogram_npm \ No newline at end of file diff --git a/miniprogram/apis/config.ts b/miniprogram/apis/config.ts new file mode 100644 index 0000000..4d7b5c1 --- /dev/null +++ b/miniprogram/apis/config.ts @@ -0,0 +1,9 @@ + +import { request } from '../utils/request' + +export function sysConfig() { + return request({ + url: '/sysConfig', + method: 'GET', + }) +} diff --git a/miniprogram/apis/consumer.ts b/miniprogram/apis/consumer.ts new file mode 100644 index 0000000..05422bc --- /dev/null +++ b/miniprogram/apis/consumer.ts @@ -0,0 +1,18 @@ + +import { request } from '../utils/request' + +export function bindPhone(data: any) { + return request({ + url: '/consumer/bindPhone', + method: 'POST', + data + }) +} + +export function bindPhoneList() { + return request({ + url: '/consumer/bindPhoneList', + method: 'GET', + + }) +} diff --git a/miniprogram/apis/information.ts b/miniprogram/apis/information.ts new file mode 100644 index 0000000..872cb2e --- /dev/null +++ b/miniprogram/apis/information.ts @@ -0,0 +1,75 @@ +import { request } from '../utils/request' + +export function informationList() { + return request({ + url: '/consumer/staff', + method: 'GET', + }) +} + +export function informationAdd(data: any) { + return request({ + // url: '/consumer/staff', + url:'/consumer/staff/V2', + method: 'POST', + data + }) +} +export function informationDelete(data: any) { + return request({ + url: '/consumer/staff/delete', + method: 'POST', + data + }) +} +export function dataRecord(id: any) { + return request({ + url: '/consumer/staff/dataRecord?id=' + id, + method: 'GET', + }) +} +export function corrigendaApply(data: any) { + return request({ + url: '/consumer/corrigendaRecord/apply', + method: 'POST', + data + }) +} +export function corrigendaList(data: any) { + return request({ + url: '/consumer/corrigendaRecord/list', + method: 'POST', + data + }) +} +export function updateWithDataId(data: any) { + return request({ + url: '/consumer/staff/updateWithDataId', + method: 'PUT', + data + }) +} + +export function redDotMarkDeal(id: any) { + return request({ + url: `/consumer/staff/redDotMarkDeal?dataId=${id}`, + method: "GET" + }); +} + +export function agentApply(data: any) { + return request({ + url: `/consumer/staff/businessNameAuthenticationApply`, + method: "POST", + data + }); +} + +export function businessLinkNameList(data: any) { + return request({ + url: `/consumer/business/businessLinkNameList`, + method: "GET", + data + }); +} + diff --git a/miniprogram/apis/inspection.ts b/miniprogram/apis/inspection.ts new file mode 100644 index 0000000..858e1bf --- /dev/null +++ b/miniprogram/apis/inspection.ts @@ -0,0 +1,55 @@ +import { request } from '../utils/request' + +export function originatorList(data:any) { + return request({ + url: '/consumer/inspectionRecord/originator/list', + method: 'POST', + data + }) +} + +export function inspectedList(data:any) { + return request({ + url: '/consumer/inspectionRecord/inspectedPerson/list', + method: 'POST', + data + }) +} + +export function deal(data:any) { + return request({ + url: '/consumer/inspectionRecord/inspectedPerson/deal', + method: 'POST', + data + }) +} + +export function defaultConfig(data:any) { + return request({ + url: '/consumer/inspectionRecord/inspectedPerson/defaultConfig', + method: 'POST', + data + }) +} + +export function defaultConfigFind() { + return request({ + url: '/consumer/inspectionRecord/inspectedPerson/defaultConfigFind', + method: 'GET' + }) +} + +export function apply(data:any) { + return request({ + url: '/consumer/inspectionRecord/originator/apply', + method: 'POST', + data + }) +} + +export function timeCheck() { + return request({ + url: '/consumer/inspectionRecord/originator/timeCheck', + method: 'GET' + }) +} diff --git a/miniprogram/apis/login.ts b/miniprogram/apis/login.ts new file mode 100644 index 0000000..8add0ab --- /dev/null +++ b/miniprogram/apis/login.ts @@ -0,0 +1,48 @@ +import { request } from '../utils/request' + +export function login(data:any) { + return request({ + url: '/commonLogin/login', + method: 'POST', + data + }) +} + +export function sendSms(data:any) { + return request({ + url: '/consumer/codeSend', + method: 'POST', + data + }) +} + +export function userInfo(data:any) { + return request({ + url: '/consumer', + method: 'GET', + data + }) +} + +export function wxLogin(data:any) { + return request({ + url: '/consumer/commonLogin/wechat/login', + method: 'POST', + data + }) +} + +export function realNameAuthentication(data:any) { + return request({ + url: '/consumer/auth/realNameAuthentication', + method: 'POST', + data + }) +} + +export function realNameAuthenticationResultCheck() { + return request({ + url: '/consumer/auth/realNameAuthenticationResultCheck', + method: 'GET' + }) +} \ No newline at end of file diff --git a/miniprogram/apis/open.ts b/miniprogram/apis/open.ts new file mode 100644 index 0000000..8b68808 --- /dev/null +++ b/miniprogram/apis/open.ts @@ -0,0 +1,9 @@ +import { request } from '../utils/request' + +export function getOpenId(data:any) { + return request({ + url: '/wechat/open/wx/get', + method: 'POST', + data + }) +} diff --git a/miniprogram/apis/pay.ts b/miniprogram/apis/pay.ts new file mode 100644 index 0000000..2d7e8ff --- /dev/null +++ b/miniprogram/apis/pay.ts @@ -0,0 +1,17 @@ +import { request } from '../utils/request' + +export function pay(data:any) { + return request({ + url: '/consumer/pay', + method: 'POST', + data + }) +} + +export function getPayInfo(data:any) { + return request({ + url: '/consumer/pay', + method: 'GET', + data + }) +} \ No newline at end of file diff --git a/miniprogram/apis/phone.ts b/miniprogram/apis/phone.ts new file mode 100644 index 0000000..9e340fc --- /dev/null +++ b/miniprogram/apis/phone.ts @@ -0,0 +1,52 @@ + +import { request } from '../utils/request' + +export function info(data: any) { + return request({ + url: `/phone/info`, + method: 'POST', + data + }) +} +export function list(data: any) { + return request({ + url: `/phone/infoList`, + method: 'POST', + data + }) +} +export function etcData(phone: any) { + return request({ + url: `/phone/electronicCertificateData?phone=${phone}`, + method: 'GET', + }) +} +export function evaluateLaunch(data: any) { + return request({ + url: `/phone/evaluateLaunch`, + method: 'POST', + data + }) +} +export function cleanPhoneDate(phone: any) { + return request({ + url: `/phone/cleanPhoneDate?phone=${phone}`, + method: 'DELETE', + }) +} + + +export function etcChoose(data: any) { + return request({ + url: `/phone/electronicCertificateChose`, + method: 'POST', + data + }) +} + +export function labelStatistics(phone: string) { + return request({ + url: `/phone/labelStatistics?phone=${phone}`, + method: 'GET', + }) +} diff --git a/miniprogram/apis/question.ts b/miniprogram/apis/question.ts new file mode 100644 index 0000000..cf9e4ef --- /dev/null +++ b/miniprogram/apis/question.ts @@ -0,0 +1,9 @@ +import { request } from '../utils/request' + +export function list(data:any) { + return request({ + url: '/consumer/questions/list', + method: 'POST', + data + }) +} \ No newline at end of file diff --git a/miniprogram/apis/report.ts b/miniprogram/apis/report.ts new file mode 100644 index 0000000..32b314c --- /dev/null +++ b/miniprogram/apis/report.ts @@ -0,0 +1,93 @@ +import { request } from '../utils/request' + +export function list(data: any) { + return request({ + url: '/consumer/report/list', + method: 'POST', + data + }) +} + +export function certificateList(data: any) { + return request({ + url: '/consumer/report/electronicCertificate/list', + method: 'POST', + data + }) +} + +export function visitRecord(data: any) { + return request({ + url: '/consumer/report/electronicCertificate/visitRecord', + method: 'POST', + data + }) +} + +export function certificateSave(data: any) { + return request({ + url: '/consumer/report/electronicCertificate/save', + method: 'POST', + data + }) +} + +export function certificateDiscard(data: any) { + return request({ + url: '/consumer/report/electronicCertificate/discard', + method: 'GET', + data + }) +} + +export function reportDelete(data: any) { + return request({ + url: '/consumer/report/reportDelete', + method: 'DELETE', + data + }) +} + +export function reportSave(data: any) { + return request({ + url: '/consumer/report/save', + method: 'POST', + data + }) +} + +export function reportPreview(data: any) { + return request({ + url: '/consumer/report/preview', + method: 'POST', + data + }) +} + +export function visitReport(id: any) { + return request({ + url: `/consumer/inspectionRecord/originator/visitReport?id=${id}`, + method: 'GET', + }) +} + +export function certificateDetail(id: any) { + return request({ + url: `/consumer/report/electronicCertificate/info?id=${id}`, + method: 'GET', + }) +} + +export function certificateDetail2(id: any) { + return request({ + url: `/consumer/report/electronicCertificate/visit?id=${id}`, + method: 'GET', + }) +} +export function reportCreateDate(id: any) { + return request({ + url: `/consumer/report/reportCreateDate?id=${id}`, + method: 'GET', + }) +} + diff --git a/miniprogram/apis/socket.ts b/miniprogram/apis/socket.ts new file mode 100644 index 0000000..5cbfd4f --- /dev/null +++ b/miniprogram/apis/socket.ts @@ -0,0 +1,14 @@ +import { request } from '../utils/request' + +export function codeScanningSuccess(id:any) { + return request({ + url: `/consumer/webSocket/codeScanningSuccess/${id}`, + method: 'GET' + }) +} +export function codeScanningLogin(id:string) { + return request({ + url: `/consumer/webSocket/codeScanningLogin/${id}`, + method: 'GET' + }) +} \ No newline at end of file diff --git a/miniprogram/apis/tag.ts b/miniprogram/apis/tag.ts new file mode 100644 index 0000000..38d5021 --- /dev/null +++ b/miniprogram/apis/tag.ts @@ -0,0 +1,11 @@ + + +import { request } from '../utils/request' + +export function list(data: any) { + return request({ + url: `/evaluateLabel/list`, + method: 'POST', + data + }) +} \ No newline at end of file diff --git a/miniprogram/apis/upload.ts b/miniprogram/apis/upload.ts new file mode 100644 index 0000000..77ed5d3 --- /dev/null +++ b/miniprogram/apis/upload.ts @@ -0,0 +1,10 @@ + +import { request } from '../utils/request' + +export function uploadImg(data) { + return request({ + url: '/consumer/commonLogin/upload', + method: 'POST', + data + }) +} diff --git a/miniprogram/app.json b/miniprogram/app.json new file mode 100644 index 0000000..f9411c1 --- /dev/null +++ b/miniprogram/app.json @@ -0,0 +1,62 @@ +{ + "pages": [ + "pages/index/index", + "pages/shareTimeLine/shareTimeLine", + "pages/QA/QA", + "pages/service/service", + "pages/login/login", + "pages/pay/pay", + "pages/reportDetail/reportDetail", + "pages/report/report", + "pages/my/my", + "pages/searchResult/searchResult", + "pages/information/information", + "pages/guide/guide", + "pages/addPhone/addPhone", + "pages/corrigendum/corrigendum", + "pages/reportPreview/reportPreview", + "pages/generateReport/generateReport", + "pages/informationCreate/informationCreate", + "pages/informationDetail/informationDetail", + "pages/informationEventCreate/informationEventCreate", + "pages/informationEdit/informationEdit", + "pages/dataRecords/dataRecords", + "pages/createReport/createReport", + "pages/apply/apply", + "pages/inspected/inspected", + "pages/inspectedRecords/inspectedRecords", + "pages/logs/logs", + "pages/applySetting/applySetting", + "pages/member/member", + "pages/memberPreview/memberPreview", + "pages/certification/certification", + "pages/certificationResult/certificationResult", + "pages/answer/answer", + "pages/personal/personal", + "pages/visitor/visitor", + "pages/certificateCreate/certificateCreate", + "pages/privacy/privacy", + "pages/agreement/agreement", + "pages/errataRecords/errataRecords", + "pages/errataDetail/errataDetail", + "pages/scanLogin/scanLogin", + "pages/scanResult/scanResult", + "pages/webView/webView", + "pages/question/question", + "pages/questionDetail/questionDetail", + "pages/whiteList/whiteList", + "pages/addAuthName/addAuthName" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "众评", + "navigationBarTextStyle": "black" + }, + + "usingComponents": { + "filter": "/components/filter/filter" + }, + "style": "v2", + "sitemapLocation": "sitemap.json" +} \ No newline at end of file diff --git a/miniprogram/app.scss b/miniprogram/app.scss new file mode 100644 index 0000000..75f4fde --- /dev/null +++ b/miniprogram/app.scss @@ -0,0 +1 @@ +/**app.wxss**/ diff --git a/miniprogram/app.ts b/miniprogram/app.ts new file mode 100644 index 0000000..07b3d2b --- /dev/null +++ b/miniprogram/app.ts @@ -0,0 +1,212 @@ +// app.ts +import { userInfo, login } from './apis/login' +import { getOpenId } from './apis/open' +import { pay } from './apis/pay' +import { querystrToObj } from './utils/util' +import { bindPhoneList } from "./apis/consumer"; +App({ + globalData: {}, + onLaunch() { + const res = wx.getMenuButtonBoundingClientRect() + wx.setStorageSync('MenuButtonBoundingClientRect', res) + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // const token = wx.getStorageSync('Authorization') + // if (!token) { + // wx.reLaunch({ + // url: '/pages/login/login' + // }) + // } + // return + // 登录 + this.login().then(() => { + this.globalData.ready = true + this.reload() + }).catch(() => { + this.globalData.ready = true + }) + /* + wx.login({ + success: res => { + console.log(res.code) + // 发送 res.code 到后台换取 openId, sessionKey, unionId + getOpenId({ + field: res.code + }).then((res:any) => { + this.globalData.openId = res.d.openId + login({ + openId: res.d.openId, + staffType: 'WECHAT' + }).then((res:any) => { + wx.setStorageSync('Authorization', res.d) + this.getUserInfo().then(() => { + this.globalData.ready = true + this.reload() + }) + }).catch(() => { + this.globalData.ready = true + wx.reLaunch({ + url: '/pages/login/login' + }) + }) + }) + }, + }) + */ + }, + onShow(options) { + console.log('appShow', options) + const { path, query } = options + let { q, source } = query + if (['pages/apply/apply', 'pages/reportPreview/reportPreview', 'pages/scanLogin/scanLogin'].includes(path)) { + let pageQueryStr = '' + if (q) { + q = decodeURIComponent(q) + const queryStr = q.split('?')[1] + const queryObj = querystrToObj(decodeURIComponent(querystrToObj(queryStr).query)) + pageQueryStr = decodeURIComponent(querystrToObj(queryStr).query) + source = queryObj.source + } + const backPage = `/${path}?${pageQueryStr}` + console.log(backPage) + wx.setStorageSync('QSource', source) + wx.setStorageSync('backPage', backPage) + } else { + wx.removeStorageSync('QSource') + wx.removeStorageSync('backPage') + } + }, + // 登录 + login() { + console.log('login,app.ts'); + + return new Promise((resolve, reject) => { + wx.login({ + success: res => { + console.log(res.code) + // 发送 res.code 到后台换取 openId, sessionKey, unionId + getOpenId({ + field: res.code + }).then((res: any) => { + this.globalData.openId = res.d.openId + this.globalData.unionId = res.d.unionId + login({ + openId: res.d.openId, + // ...res.d, + loginType: 1 + }).then((res: any) => { + wx.setStorageSync('Authorization', res.d) + // this.getBindPhoneList() + bindPhoneList().then(res => { + // wx.setStorageSync('accountList', res.d) + // this.globalData.accountList = res.d + wx.setStorageSync('accountList', res.d) + console.log(wx.getStorageSync('userInfo').phone,res.d); + + wx.setStorageSync('userInfo', res.d.find(item => item.phone === wx.getStorageSync('userInfo').phone) || res.d[0]) + // this.globalData.userInfo = res.d[0] + }) + // this.getUserInfo().then(() => { + // resolve(true) + // this.getBindPhoneList() + // }).catch((err: any) => { + // reject(err) + // }) + }).catch((err) => { + // this.globalData.ready = true + // wx.reLaunch({ + // url: '/pages/login/login' + // }) + reject(err) + }) + }).catch((err) => { + reject(err) + }) + }, + }) + }) + }, + // getBindPhoneList() { + // bindPhoneList().then(res => { + // // console.log(res); + // wx.setStorageSync('accountList', res.d) + // }) + // }, + // 获取用户信息, 在登录或开通会员等 用户信息改变时调用 + getUserInfo() { + return userInfo({}).then((res: any) => { + this.globalData.userInfo = res.d + return res.d + }) + }, + // 页面重载 + reload() { + const pages = getCurrentPages() + const currentPage = pages[pages.length - 1] + currentPage.onLoad(currentPage.options) + currentPage.onShow() + }, + /** + * 实名认证校验 + * @param skip 是否跳转到实名页面 + * @returns + */ + certificationVerify(skip = false): boolean { + const status = this.globalData.userInfo?.status + let val = false + if (Number(status) >= 3) val = true + if (skip && !val) { + wx.navigateTo({ + url: '/pages/certification/certification' + }) + } + return val + }, + + /** + * 会员校验 + * @param skip 是否跳转到购买会员页面 + * @returns + */ + memberVerify(skip = false): boolean { + const status = this.globalData.userInfo?.status + let val = false + if (Number(status) === 4) val = true + if (skip && !val) { + wx.navigateTo({ + url: '/pages/member/member' + }) + } + return val + }, + /** + * 发起支付 + * @param payType + * @returns + */ + pay(payType: String) { + return new Promise((resolve, reject) => { + pay({ + payType, + wxPayApiType: 'JSAPI' + }).then((res: any) => { + wx.requestPayment({ + ...res.d, + success: (res: any) => { + resolve(res) + }, + fail: (err: any) => { + wx.showToast({ + icon: 'none', + title: '支付失败, 请稍后再试!' + }) + reject(err) + } + }) + }) + }) + } +}) \ No newline at end of file diff --git a/miniprogram/assets/images/index/icon_fw.png b/miniprogram/assets/images/index/icon_fw.png new file mode 100644 index 0000000..9e63cea Binary files /dev/null and b/miniprogram/assets/images/index/icon_fw.png differ diff --git a/miniprogram/assets/images/index/icon_gh.png b/miniprogram/assets/images/index/icon_gh.png new file mode 100644 index 0000000..b73e906 Binary files /dev/null and b/miniprogram/assets/images/index/icon_gh.png differ diff --git a/miniprogram/assets/images/index/icon_search.png b/miniprogram/assets/images/index/icon_search.png new file mode 100644 index 0000000..b2631f2 Binary files /dev/null and b/miniprogram/assets/images/index/icon_search.png differ diff --git a/miniprogram/assets/images/index/icon_seemore.png b/miniprogram/assets/images/index/icon_seemore.png new file mode 100644 index 0000000..23f2b48 Binary files /dev/null and b/miniprogram/assets/images/index/icon_seemore.png differ diff --git a/miniprogram/assets/images/index/name.png b/miniprogram/assets/images/index/name.png new file mode 100644 index 0000000..45c0dc8 Binary files /dev/null and b/miniprogram/assets/images/index/name.png differ diff --git a/miniprogram/assets/images/index/pic.png b/miniprogram/assets/images/index/pic.png new file mode 100644 index 0000000..7ef415a Binary files /dev/null and b/miniprogram/assets/images/index/pic.png differ diff --git a/miniprogram/assets/images/index/slogan.png b/miniprogram/assets/images/index/slogan.png new file mode 100644 index 0000000..6810a49 Binary files /dev/null and b/miniprogram/assets/images/index/slogan.png differ diff --git a/miniprogram/assets/images/index/tongxunlu@2x.png b/miniprogram/assets/images/index/tongxunlu@2x.png new file mode 100644 index 0000000..c79c221 Binary files /dev/null and b/miniprogram/assets/images/index/tongxunlu@2x.png differ diff --git a/miniprogram/assets/images/my/icon_close.png b/miniprogram/assets/images/my/icon_close.png new file mode 100644 index 0000000..b3e32dd Binary files /dev/null and b/miniprogram/assets/images/my/icon_close.png differ diff --git a/miniprogram/assets/images/my/icon_phone.png b/miniprogram/assets/images/my/icon_phone.png new file mode 100644 index 0000000..082c744 Binary files /dev/null and b/miniprogram/assets/images/my/icon_phone.png differ diff --git a/miniprogram/assets/images/my/icon_question.png b/miniprogram/assets/images/my/icon_question.png new file mode 100644 index 0000000..104ffbf Binary files /dev/null and b/miniprogram/assets/images/my/icon_question.png differ diff --git a/miniprogram/assets/images/my/icon_switch.png b/miniprogram/assets/images/my/icon_switch.png new file mode 100644 index 0000000..f0be447 Binary files /dev/null and b/miniprogram/assets/images/my/icon_switch.png differ diff --git a/miniprogram/assets/images/my/icon_wechat.png b/miniprogram/assets/images/my/icon_wechat.png new file mode 100644 index 0000000..e645474 Binary files /dev/null and b/miniprogram/assets/images/my/icon_wechat.png differ diff --git a/miniprogram/assets/images/my/icon_wxFriend.png b/miniprogram/assets/images/my/icon_wxFriend.png new file mode 100644 index 0000000..c99562a Binary files /dev/null and b/miniprogram/assets/images/my/icon_wxFriend.png differ diff --git a/miniprogram/assets/images/navbar/back_black.png b/miniprogram/assets/images/navbar/back_black.png new file mode 100644 index 0000000..0c07341 Binary files /dev/null and b/miniprogram/assets/images/navbar/back_black.png differ diff --git a/miniprogram/assets/images/navbar/back_white.png b/miniprogram/assets/images/navbar/back_white.png new file mode 100644 index 0000000..98f7cbd Binary files /dev/null and b/miniprogram/assets/images/navbar/back_white.png differ diff --git a/miniprogram/assets/images/pay/gougou@2x.png b/miniprogram/assets/images/pay/gougou@2x.png new file mode 100644 index 0000000..f32c262 Binary files /dev/null and b/miniprogram/assets/images/pay/gougou@2x.png differ diff --git a/miniprogram/assets/images/pay/icon_wxPay.png b/miniprogram/assets/images/pay/icon_wxPay.png new file mode 100644 index 0000000..c2e9acb Binary files /dev/null and b/miniprogram/assets/images/pay/icon_wxPay.png differ diff --git a/miniprogram/assets/images/reportDetail/topbg.png b/miniprogram/assets/images/reportDetail/topbg.png new file mode 100644 index 0000000..4cea8d4 Binary files /dev/null and b/miniprogram/assets/images/reportDetail/topbg.png differ diff --git a/miniprogram/assets/images/searchResult/Certificate.png b/miniprogram/assets/images/searchResult/Certificate.png new file mode 100644 index 0000000..f8b4f2b Binary files /dev/null and b/miniprogram/assets/images/searchResult/Certificate.png differ diff --git a/miniprogram/assets/images/searchResult/a-ziyuan106@2x.png b/miniprogram/assets/images/searchResult/a-ziyuan106@2x.png new file mode 100644 index 0000000..2ef05e1 Binary files /dev/null and b/miniprogram/assets/images/searchResult/a-ziyuan106@2x.png differ diff --git a/miniprogram/assets/images/searchResult/cStar.png b/miniprogram/assets/images/searchResult/cStar.png new file mode 100644 index 0000000..487f7b9 Binary files /dev/null and b/miniprogram/assets/images/searchResult/cStar.png differ diff --git a/miniprogram/assets/images/searchResult/cStar_active.png b/miniprogram/assets/images/searchResult/cStar_active.png new file mode 100644 index 0000000..04e026c Binary files /dev/null and b/miniprogram/assets/images/searchResult/cStar_active.png differ diff --git a/miniprogram/assets/images/searchResult/commented.png b/miniprogram/assets/images/searchResult/commented.png new file mode 100644 index 0000000..f86b2bd Binary files /dev/null and b/miniprogram/assets/images/searchResult/commented.png differ diff --git a/miniprogram/assets/images/searchResult/dianping@2x.png b/miniprogram/assets/images/searchResult/dianping@2x.png new file mode 100644 index 0000000..9088b4c Binary files /dev/null and b/miniprogram/assets/images/searchResult/dianping@2x.png differ diff --git a/miniprogram/assets/images/searchResult/fenxiang@2x.png b/miniprogram/assets/images/searchResult/fenxiang@2x.png new file mode 100644 index 0000000..05afbdc Binary files /dev/null and b/miniprogram/assets/images/searchResult/fenxiang@2x.png differ diff --git a/miniprogram/assets/images/searchResult/icon_arrow_right.png b/miniprogram/assets/images/searchResult/icon_arrow_right.png new file mode 100644 index 0000000..93ae4c3 Binary files /dev/null and b/miniprogram/assets/images/searchResult/icon_arrow_right.png differ diff --git a/miniprogram/assets/images/searchResult/icon_avatar_default.png b/miniprogram/assets/images/searchResult/icon_avatar_default.png new file mode 100644 index 0000000..35a908e Binary files /dev/null and b/miniprogram/assets/images/searchResult/icon_avatar_default.png differ diff --git a/miniprogram/assets/images/searchResult/icon_avatar_primary.png b/miniprogram/assets/images/searchResult/icon_avatar_primary.png new file mode 100644 index 0000000..c258849 Binary files /dev/null and b/miniprogram/assets/images/searchResult/icon_avatar_primary.png differ diff --git a/miniprogram/assets/images/searchResult/icon_close.png b/miniprogram/assets/images/searchResult/icon_close.png new file mode 100644 index 0000000..428a1e3 Binary files /dev/null and b/miniprogram/assets/images/searchResult/icon_close.png differ diff --git a/miniprogram/assets/images/searchResult/icon_report.png b/miniprogram/assets/images/searchResult/icon_report.png new file mode 100644 index 0000000..7b38c01 Binary files /dev/null and b/miniprogram/assets/images/searchResult/icon_report.png differ diff --git a/miniprogram/assets/images/searchResult/icon_rz.png b/miniprogram/assets/images/searchResult/icon_rz.png new file mode 100644 index 0000000..f14ec6b Binary files /dev/null and b/miniprogram/assets/images/searchResult/icon_rz.png differ diff --git a/miniprogram/assets/images/searchResult/noCertificate.png b/miniprogram/assets/images/searchResult/noCertificate.png new file mode 100644 index 0000000..e89c2a3 Binary files /dev/null and b/miniprogram/assets/images/searchResult/noCertificate.png differ diff --git a/miniprogram/assets/images/searchResult/star_0.5.png b/miniprogram/assets/images/searchResult/star_0.5.png new file mode 100644 index 0000000..d0b3e51 Binary files /dev/null and b/miniprogram/assets/images/searchResult/star_0.5.png differ diff --git a/miniprogram/assets/images/searchResult/star_0.png b/miniprogram/assets/images/searchResult/star_0.png new file mode 100644 index 0000000..9bbb8c4 Binary files /dev/null and b/miniprogram/assets/images/searchResult/star_0.png differ diff --git a/miniprogram/assets/images/searchResult/star_1.png b/miniprogram/assets/images/searchResult/star_1.png new file mode 100644 index 0000000..25176b9 Binary files /dev/null and b/miniprogram/assets/images/searchResult/star_1.png differ diff --git a/miniprogram/assets/images/searchResult/unCommented.png b/miniprogram/assets/images/searchResult/unCommented.png new file mode 100644 index 0000000..9241317 Binary files /dev/null and b/miniprogram/assets/images/searchResult/unCommented.png differ diff --git a/miniprogram/assets/images/shareTimeLine/line.png b/miniprogram/assets/images/shareTimeLine/line.png new file mode 100644 index 0000000..86ab913 Binary files /dev/null and b/miniprogram/assets/images/shareTimeLine/line.png differ diff --git a/miniprogram/components/btn/btn.json b/miniprogram/components/btn/btn.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/btn/btn.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/btn/btn.scss b/miniprogram/components/btn/btn.scss new file mode 100644 index 0000000..fc28a49 --- /dev/null +++ b/miniprogram/components/btn/btn.scss @@ -0,0 +1,87 @@ +/* components/btn/btn.wxss */ +$primary: #6571D9; +$member: #653E12; + +.btn-cmp { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + border-radius: 44rpx; + font-size: 24rpx; +} + +.primary { + background: $primary; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + box-sizing: border-box; + padding: 0 20rpx; + + &.plain { + box-sizing: border-box; + color: $primary; + border: 1rpx solid $primary; + background: #FFFFFF; + } +} + +.primary45 { + background: #4B5AE5; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + box-sizing: border-box; + padding: 0 20rpx; +} + +.white { + background: #FFFFFF; + border: 1rpx solid #CDCDCD; + font-size: 24rpx; + font-family: PingFang SC; + // font-weight: bold; + color: #A1A1A1; +} + +.default { + background: #7A8BFF; + border: 1rpx solid #FFFFFF; + border-radius: 25rpx; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: bold; + color: #FFFFFF; +} + +.default45 { + background: #7A8BFF; + border: 1rpx solid #FFFFFF; + border-radius: 45rpx; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: bold; + color: #FFFFFF; +} +.info{ + background: #FFFFFF; + color: #6979E8; + border-radius: 25rpx; + font-family: PingFang SC; +} + +.member { + font-family: PingFang SC; + font-weight: 500; + color: #653E12; + background: #E5C7A3; + + &.plain { + box-sizing: border-box; + color: #7986FF; + border: 1rpx solid #7986FF; + background: #FFFFFF; + } +} \ No newline at end of file diff --git a/miniprogram/components/btn/btn.ts b/miniprogram/components/btn/btn.ts new file mode 100644 index 0000000..d97e667 --- /dev/null +++ b/miniprogram/components/btn/btn.ts @@ -0,0 +1,48 @@ +// components/btn/btn.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + type: { + type: String, + value: 'primary' + }, + plain: { + type: Boolean, + value: false + }, + width: { + type: String, + value: '184rpx' + }, + height: { + type: String, + value: '60rpx' + }, + fontSize: { + type: String, + value: '24rpx' + }, + bgColor:{ + type:String, + }, + padding:{ + type:String, + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/components/btn/btn.wxml b/miniprogram/components/btn/btn.wxml new file mode 100644 index 0000000..2e3c491 --- /dev/null +++ b/miniprogram/components/btn/btn.wxml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/miniprogram/components/btnClose/btnClose.json b/miniprogram/components/btnClose/btnClose.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/btnClose/btnClose.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/btnClose/btnClose.scss b/miniprogram/components/btnClose/btnClose.scss new file mode 100644 index 0000000..026decd --- /dev/null +++ b/miniprogram/components/btnClose/btnClose.scss @@ -0,0 +1,9 @@ +/* components/btnClose/btnClose.wxss */ +.btn_close { + width: 26rpx; + height: 26rpx; + position: absolute; + right: 20rpx; + top: 20rpx; + color: #D8D8D8; +} \ No newline at end of file diff --git a/miniprogram/components/btnClose/btnClose.ts b/miniprogram/components/btnClose/btnClose.ts new file mode 100644 index 0000000..277b3cd --- /dev/null +++ b/miniprogram/components/btnClose/btnClose.ts @@ -0,0 +1,23 @@ +// components/btnClose/btnClose.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + close(){} + } +}) diff --git a/miniprogram/components/btnClose/btnClose.wxml b/miniprogram/components/btnClose/btnClose.wxml new file mode 100644 index 0000000..f454814 --- /dev/null +++ b/miniprogram/components/btnClose/btnClose.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/miniprogram/components/confirm/confirm.json b/miniprogram/components/confirm/confirm.json new file mode 100644 index 0000000..119198a --- /dev/null +++ b/miniprogram/components/confirm/confirm.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "shadow": "/components/shadow/shadow" + } +} \ No newline at end of file diff --git a/miniprogram/components/confirm/confirm.scss b/miniprogram/components/confirm/confirm.scss new file mode 100644 index 0000000..a010deb --- /dev/null +++ b/miniprogram/components/confirm/confirm.scss @@ -0,0 +1,98 @@ +/* components/confirm/confirm.wxss */ +.message-box { + width: 558rpx; + background: #ffffff; + border-radius: 24rpx; + box-sizing: border-box; + // padding: 68rpx 76rpx; + padding-top: 63rpx; + + display: flex; + flex-direction: column; + align-items: center; + + text-align: center; + + position: relative; + + .cancel-icon { + position: absolute; + right: 10rpx; + top: 0; + padding: 21rpx; + width: 31rpx; + height: 31rpx; + } + + .type-icon { + width: 121rpx; + height: 156rpx; + margin-bottom: 15rpx; + } + + .title { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + opacity: 0.61; + // line-height: 30rpx; + margin-bottom: 36rpx; + } + + .message { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + line-height: 36rpx; + padding: 0 52rpx 54rpx 52rpx; + } + + .btns { + display: flex; + width: 100%; + border-top: 1px solid #E9E9E9; + align-items: center; + justify-content: space-around; + height: 98rpx; + + &::after { + content: ''; + border-left: 1px solid #000; + position: absolute; + } + } + + .confirm-btn { + // width: 100%; + height: 98rpx; + line-height: 98rpx; + // border-radius: 38rpx; + // text-align: center; + // background: #3A61B1; + width: 100%; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + // margin-top: 32rpx; + } + + .cancel-btn { + // font-size: 26rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #C3C3C3; + // padding: 15rpx; + border-right: 1px solid #E9E9E9; + box-sizing: border-box; + width: 100%; + height: 98rpx; + line-height: 98rpx; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + } +} \ No newline at end of file diff --git a/miniprogram/components/confirm/confirm.ts b/miniprogram/components/confirm/confirm.ts new file mode 100644 index 0000000..fb1a5c0 --- /dev/null +++ b/miniprogram/components/confirm/confirm.ts @@ -0,0 +1,67 @@ +// components/confirm/confirm.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + title: { + type: String, + value: '' + }, + message: { + type: String, + value: '' + }, + confirmText: { + type: String, + value: '' + }, + cancelText: { + type: String, + value: '' + }, + confirmShow: { + type: Boolean, + value: true + }, + cancelShow: { + type: Boolean, + value: true + }, + }, + + /** + * 组件的初始数据 + */ + data: { + visible: false + }, + + /** + * 组件的方法列表 + */ + methods: { + confirm() { + this.triggerEvent('confirm') + this.hidden() + }, + cencel() { + this.triggerEvent('cancel') + this.hidden() + }, + close() { + this.triggerEvent('close') + this.hidden() + }, + show() { + this.setData({ + visible: true + }) + }, + hidden() { + this.setData({ + visible: false + }) + } + } +}) diff --git a/miniprogram/components/confirm/confirm.wxml b/miniprogram/components/confirm/confirm.wxml new file mode 100644 index 0000000..380c1ae --- /dev/null +++ b/miniprogram/components/confirm/confirm.wxml @@ -0,0 +1,17 @@ + + + + + + + {{title}} + {{message}} + + {{cancelText}} + {{confirmText}} + + + + + + \ No newline at end of file diff --git a/miniprogram/components/dataSource/dataSource.json b/miniprogram/components/dataSource/dataSource.json new file mode 100644 index 0000000..ec84d2d --- /dev/null +++ b/miniprogram/components/dataSource/dataSource.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "redDot":"/components/redDot/redDot" + } +} \ No newline at end of file diff --git a/miniprogram/components/dataSource/dataSource.scss b/miniprogram/components/dataSource/dataSource.scss new file mode 100644 index 0000000..5d8fa46 --- /dev/null +++ b/miniprogram/components/dataSource/dataSource.scss @@ -0,0 +1,25 @@ +/* components/dataSource/dataSource.wxss */ +.operation { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #2F88DB; + text-align: right; + margin-left: 68rpx; + position: relative; + .operationIcon { + margin-right: 9rpx; + width: 20rpx; + height: 22rpx; + } + .redDot { + width: 10rpx; + height: 10rpx; + display: inline-block; + border-radius: 50%; + background: red; + position: absolute; + top: 0px; + } +} + diff --git a/miniprogram/components/dataSource/dataSource.ts b/miniprogram/components/dataSource/dataSource.ts new file mode 100644 index 0000000..b512609 --- /dev/null +++ b/miniprogram/components/dataSource/dataSource.ts @@ -0,0 +1,35 @@ +// components/dataSource/dataSource.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + dataId: { + type: String + }, + redDotMark: { + type: Boolean, + value: false + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + handleRecords(e: WechatMiniprogram.BaseEvent) { + console.log(e); + + wx.navigateTo({ + url: '/pages/dataRecords/dataRecords?id=' + e.currentTarget.dataset.id + }) + }, + } +}) diff --git a/miniprogram/components/dataSource/dataSource.wxml b/miniprogram/components/dataSource/dataSource.wxml new file mode 100644 index 0000000..6376d80 --- /dev/null +++ b/miniprogram/components/dataSource/dataSource.wxml @@ -0,0 +1,5 @@ + + + 数据记录 + + \ No newline at end of file diff --git a/miniprogram/components/dialog/dialog.json b/miniprogram/components/dialog/dialog.json new file mode 100644 index 0000000..cd7025b --- /dev/null +++ b/miniprogram/components/dialog/dialog.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "shadow":"/components/shadow/shadow", + "btn":"/components/btn/btn", + "btnClose":"/components/btnClose/btnClose" + } +} \ No newline at end of file diff --git a/miniprogram/components/dialog/dialog.scss b/miniprogram/components/dialog/dialog.scss new file mode 100644 index 0000000..4fbcb1d --- /dev/null +++ b/miniprogram/components/dialog/dialog.scss @@ -0,0 +1,113 @@ +/* components/dialog/dialog.wxss */ +.dialog_long { + background: rgba($color: #000000, $alpha: 0.5); + // width: 100%; + overflow: auto; + height: 100%; + // position: fixed; + position: absolute; + left: 0; + top: 0; + z-index: 150; + + + .dialog_box { + margin: 180rpx 65rpx; + // margin-top: 180rpx 65rpx 0 65rpx; + background: #fff; + // margin: 65rpx; + border-radius: 24rpx; + padding: 66rpx; + position: relative; + + .dialog_title { + text-align: center; + margin-bottom: 40rpx; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: bold; + color: #A1A1A1; + } + + .dialog_content { + + text { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: bold; + color: #3E3E3E; + // margin-bottom: 27rpx; + } + } + } +} + +.timeLine { + margin-top: 27rpx; + height: 600rpx; + overflow:auto; + margin-bottom: 20rpx; + padding-left: 20rpx; + + .timeLine_item { + display: flex; + border-left: 1px solid #6471D9; + padding-left: 44rpx; + position: relative; + + &:last-child { + border-left: 0; + } + + .step { + background: #E9EBFF; + border-radius: 50%; + width: 43rpx; + height: 43rpx; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #6471D9; + display: flex; + justify-content: center; + align-items: center; + margin-right: 24rpx; + position: absolute; + left: -20rpx; + + // &:not(:first-child) { + // &::after { + // content: ""; + // border-left: 1px solid #000; + // position: absolute; + // height: 100px; + // } + // } + } + + .timeLine_content { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: bold; + color: #6471D9; + flex: 1; + padding-bottom: 33rpx; + + + + .contentText { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C2C2C2; + margin-top: 14rpx; + } + + image { + width: 343rpx; + height: 452rpx; + margin-top: 25rpx; + } + } + } +} \ No newline at end of file diff --git a/miniprogram/components/dialog/dialog.ts b/miniprogram/components/dialog/dialog.ts new file mode 100644 index 0000000..f3785c6 --- /dev/null +++ b/miniprogram/components/dialog/dialog.ts @@ -0,0 +1,54 @@ +// components/dialog/dialog.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + visible: { + type: Boolean, + value: false + }, + position: { + type: String, + value:"" + }, + + title: { + type: String, + value: '标题' + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + close() { + console.log('close'); + + this.triggerEvent('close') + this.hidden() + }, + hidden() { + this.setData({ + visible: false + }) + }, + goChrivc() { + wx.navigateToMiniProgram({ + appId: 'wx1da91ccb94c17c99', + path: 'pages/report/report', + success(res) { + // 打开成功 + } + }) + } + } +}) diff --git a/miniprogram/components/dialog/dialog.wxml b/miniprogram/components/dialog/dialog.wxml new file mode 100644 index 0000000..3a9ae86 --- /dev/null +++ b/miniprogram/components/dialog/dialog.wxml @@ -0,0 +1,64 @@ + + + + + + 提示 + + 您即将进入全国人力资源信息数据验证平台,邀请对方授权个人信息报告,操作流程如下: + + + 1 + + 登录小程序 + 通过手机号+验证码登录小程序; + + + + + 2 + + 实名认证 + 基于国家数据平台的信息安全规范,平台用户均为实名用户,请先完成实名认证。 + + + + + 3 + + 新增个人信息报告 + 查看、完善自填数据后,进入信息报告页面,您可根据您的需求选择性勾选数据生成个人信息报告,生成后的个人信息报告不可再次修改。 + + + + + 3 + + 查验他人 + 进入查验他人页面,输入准确的姓名和手机号码,向他人发起实名查验申请,他人同意并授权后即可查看其个人信息报告。 + + + + + + 4 + + 给报告添加电子证书 + 每份个人信息报告可生成多个授权查验的电子证书,通过电子证书授权允许他人查看个人信息报告。 + + + + + 5 + + 返回众评,选择证书展示 + 完成电子证书授权后,返回众评再次选择想要展示的个人信息报告及对应的授权电子证书即可。 + + + + + 跳转至溯源优才小程序 + + + + \ No newline at end of file diff --git a/miniprogram/components/dialog/images/step3-2.png b/miniprogram/components/dialog/images/step3-2.png new file mode 100644 index 0000000..096f7b6 Binary files /dev/null and b/miniprogram/components/dialog/images/step3-2.png differ diff --git a/miniprogram/components/dialog/images/step3.png b/miniprogram/components/dialog/images/step3.png new file mode 100644 index 0000000..adf399f Binary files /dev/null and b/miniprogram/components/dialog/images/step3.png differ diff --git a/miniprogram/components/dialog/images/step4.png b/miniprogram/components/dialog/images/step4.png new file mode 100644 index 0000000..c6e5db1 Binary files /dev/null and b/miniprogram/components/dialog/images/step4.png differ diff --git a/miniprogram/components/fileBox/fileBox.json b/miniprogram/components/fileBox/fileBox.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/fileBox/fileBox.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/fileBox/fileBox.scss b/miniprogram/components/fileBox/fileBox.scss new file mode 100644 index 0000000..6884cef --- /dev/null +++ b/miniprogram/components/fileBox/fileBox.scss @@ -0,0 +1,14 @@ +/* components/fileBox/fileBox.wxss */ +.fileBox { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + line-height: 30rpx; + + .icon_file { + width: 36rpx; + height: 36rpx; + margin-right: 9rpx; + } +} \ No newline at end of file diff --git a/miniprogram/components/fileBox/fileBox.ts b/miniprogram/components/fileBox/fileBox.ts new file mode 100644 index 0000000..babb341 --- /dev/null +++ b/miniprogram/components/fileBox/fileBox.ts @@ -0,0 +1,36 @@ +// components/fileBox/fileBox.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + imgs: { + type: Array, + value: [] + } + }, + + /** + * 组件的初始数据 + */ + data: { + index: 0 + }, + + /** + * 组件的方法列表 + */ + methods: { + preview() { + let temps: { url: any }[] = [] + this.data.imgs.map((item: any) => { + console.log(item); + + temps.push({ + url: item, + }) + }) + wx.previewMedia({ sources: temps, current: this.data.index }) + } + } +}) diff --git a/miniprogram/components/fileBox/fileBox.wxml b/miniprogram/components/fileBox/fileBox.wxml new file mode 100644 index 0000000..18f8dcd --- /dev/null +++ b/miniprogram/components/fileBox/fileBox.wxml @@ -0,0 +1,4 @@ + + + {{imgs.length}}个附件 + \ No newline at end of file diff --git a/miniprogram/components/filter/filter.json b/miniprogram/components/filter/filter.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/filter/filter.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/filter/filter.scss b/miniprogram/components/filter/filter.scss new file mode 100644 index 0000000..aa33d4a --- /dev/null +++ b/miniprogram/components/filter/filter.scss @@ -0,0 +1 @@ +/* components/filter/filter.wxss */ \ No newline at end of file diff --git a/miniprogram/components/filter/filter.ts b/miniprogram/components/filter/filter.ts new file mode 100644 index 0000000..3e52297 --- /dev/null +++ b/miniprogram/components/filter/filter.ts @@ -0,0 +1,58 @@ +// components/filter/filter.ts +import { parseTime, optionsFilter, splitDates, hideInformation } from '../../utils/index' +Component({ + options: { + styleIsolation: "shared" + }, + /** + * 组件的属性列表 + */ + properties: { + type: { + type: String, + observer() { + this.initData() + } + }, + value: { + type: String, + observer() { + this.initData() + } + }, + params: { + type: Array, + value: [], + observer() { + this.initData() + } + } + }, + + /** + * 组件的初始数据 + */ + data: { + funs: { parseTime, optionsFilter, splitDates, hideInformation }, + _value: '' + }, + + lifetimes: { + ready() { + this.initData() + } + }, + + /** + * 组件的方法列表 + */ + methods: { + initData() { + const { type, value, params, funs } = this.data + this.setData({ + // @ts-ignore + _value: funs[type](value, ...params) + }) + } + } +}) diff --git a/miniprogram/components/filter/filter.wxml b/miniprogram/components/filter/filter.wxml new file mode 100644 index 0000000..f6b2aa8 --- /dev/null +++ b/miniprogram/components/filter/filter.wxml @@ -0,0 +1,2 @@ + +{{_value}} diff --git a/miniprogram/components/guide/guide.json b/miniprogram/components/guide/guide.json new file mode 100644 index 0000000..119198a --- /dev/null +++ b/miniprogram/components/guide/guide.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "shadow": "/components/shadow/shadow" + } +} \ No newline at end of file diff --git a/miniprogram/components/guide/guide.scss b/miniprogram/components/guide/guide.scss new file mode 100644 index 0000000..bab34bc --- /dev/null +++ b/miniprogram/components/guide/guide.scss @@ -0,0 +1,156 @@ +/* components/guide/guide.wxss */ +.guide-cmp { + font-size: 24rpx; + // font-weight: bold; + // font-family: YouSheBiaoTiHei; + // font-weight: 400; + color: #FFFFFF; + position: fixed; + top: 30rpx; + right: 0; + z-index: 100; + // background: #3A61B1; + width: 172rpx; + height: 50rpx; + border: 1px solid #FFFFFF; + border-right: 0; + border-radius: 25px 0px 0px 25px; + font-family: PingFang SC; + font-weight: 500; + // border-top-left-radius: 20rpx; + // border-bottom-left-radius: 20rpx; + display: flex; + justify-content: center; + align-items: center; + // font-style: italic; + + .icon_guideClose { + width: 11rpx; + height: 11rpx; + margin-left: 7rpx; + } +} + +.guide-shadow { + width: 558rpx; + // height: 200rpx; + border-radius: 24rpx; + // background: linear-gradient(#BAC8E4, #FFF 162rpx); + display: flex; + flex-direction: column; + align-items: center; + padding: 35rpx 50rpx; + padding-bottom: 58rpx; + position: relative; + + .cancel { + position: absolute; + top: 0; + right: 10rpx; + width: 31rpx; + height: 31rpx; + padding: 21rpx; + } + + .title { + font-size: 34rpx; + font-family: PingFang SC; + font-weight: bold; + margin-bottom: 75rpx; + color: #FFFFFF; + } + + .font-item { + width: 100%; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + margin-bottom: 30rpx; + + text { + color: #3A61B1; + } + } + + .btn { + width: 404rpx; + height: 75rpx; + line-height: 75rpx; + border-radius: 38rpx; + text-align: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + margin-top: 12rpx; + background: #3A61B1; + } +} + +.guide { + width: 100%; + height: 100%; + padding-top: 210rpx; + color: #fff; + + .title { + text-align: center; + } + + swiper { + margin-top: 100rpx; + height: 1000rpx; + text-align: center; + } + + .steps { + text-align: center; + + .current { + font-size: 48rpx; + } + } + + .remember { + font-size: 24rpx; + display: flex; + align-items: center; + justify-content: center; + + .checkbox { + width: 19rpx; + height: 19rpx; + border-radius: 6rpx; + border: 1rpx solid #fff; + margin-right: 12rpx; + } + } + + .btn_close { + margin-top: 20rpx; + width: 340rpx; + height: 69rpx; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + background: none; + border: 3rpx solid #3A61B1; + border-radius: 35rpx; + } +} + +.icon_search { + width: 20rpx; + height: 20rpx; + margin-right: 8rpx; +} + +.my { + width: 127rpx; + height: 58rpx; + background: #6571D9; + border-radius: 29rpx 0px 0px 29rpx; + border: 0; +} \ No newline at end of file diff --git a/miniprogram/components/guide/guide.ts b/miniprogram/components/guide/guide.ts new file mode 100644 index 0000000..325d595 --- /dev/null +++ b/miniprogram/components/guide/guide.ts @@ -0,0 +1,76 @@ +// components/guide/guide.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + realName: { + type: Boolean, + value: false + }, + title: { + type: String, + value: '查看我的号码' + } + }, + + /** + * 组件的初始数据 + */ + data: { + show: false, + current: 1, + steps: [{ + // url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/33fc395162ea4ee58483d056627b6217:附件_1660788247.png', height: '778rpx', + url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/41a16263956d45fda44214e58543d586:附件_1665473077.png', height: '778rpx', + }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/0fa3a164228247f4839e72a1b3b550d5:附件_1660788307.png', height: '903rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/7b237c62ba7f4981a0bf7f384334fc75:附件_1660788523.png', height: '950rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/b80807ac97fb48dda9c576ae73e1ed1d:附件_1660788465.png', height: '1050rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/cf95856c688642e1ad71d541ba29759f:附件_1660788570.png', height: '1076rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/addf3101aac14c2f877c80e1b3289339:附件_1660788609.png', height: '989rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/ca4c058b91674c9aafe21d5275646392:附件_1660788643.png', height: '909rpx', } + ], + tagShow: true + }, + + /** + * 组件的方法列表 + */ + methods: { + guideShow() { + if (!this.data.realName) { + wx.redirectTo({ + url: '/pages/login/login' + }) + } else { + wx.redirectTo({ + url: '/pages/my/my' + }) + } + }, + goSearch() { + wx.reLaunch({ + url: '/pages/index/index' + }) + }, + guideHide() { + this.setData({ + show: false + }) + }, + stepChange(e) { + const { current } = e.detail + this.setData({ + current: current + 1 + }) + }, + closeTag() { + console.log('closeTag'); + + this.setData({ + tagShow: false + }) + } + } +}) diff --git a/miniprogram/components/guide/guide.wxml b/miniprogram/components/guide/guide.wxml new file mode 100644 index 0000000..251d4a7 --- /dev/null +++ b/miniprogram/components/guide/guide.wxml @@ -0,0 +1,5 @@ + +{{title}} + + 查号码 + \ No newline at end of file diff --git a/miniprogram/components/guide/images/icon_search.png b/miniprogram/components/guide/images/icon_search.png new file mode 100644 index 0000000..282b2a8 Binary files /dev/null and b/miniprogram/components/guide/images/icon_search.png differ diff --git a/miniprogram/components/icon/icon.json b/miniprogram/components/icon/icon.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/icon/icon.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/icon/icon.scss b/miniprogram/components/icon/icon.scss new file mode 100644 index 0000000..518f475 --- /dev/null +++ b/miniprogram/components/icon/icon.scss @@ -0,0 +1 @@ +/* components/icon/icon.wxss */ \ No newline at end of file diff --git a/miniprogram/components/icon/icon.ts b/miniprogram/components/icon/icon.ts new file mode 100644 index 0000000..51c167f --- /dev/null +++ b/miniprogram/components/icon/icon.ts @@ -0,0 +1,23 @@ +// components/icon/icon.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/components/icon/icon.wxml b/miniprogram/components/icon/icon.wxml new file mode 100644 index 0000000..4bd32e3 --- /dev/null +++ b/miniprogram/components/icon/icon.wxml @@ -0,0 +1,2 @@ + + diff --git a/miniprogram/components/message/message.json b/miniprogram/components/message/message.json new file mode 100644 index 0000000..119198a --- /dev/null +++ b/miniprogram/components/message/message.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "shadow": "/components/shadow/shadow" + } +} \ No newline at end of file diff --git a/miniprogram/components/message/message.scss b/miniprogram/components/message/message.scss new file mode 100644 index 0000000..d5ab9f9 --- /dev/null +++ b/miniprogram/components/message/message.scss @@ -0,0 +1,62 @@ +/* components/message/message.wxss */ +.message-box{ + width: 558rpx; + background: #ffffff; + border-radius: 24rpx; + box-sizing: border-box; + padding: 68rpx 76rpx; + + display: flex; + flex-direction: column; + align-items: center; + + text-align: center; + + position: relative; + .cancel-icon{ + position: absolute; + right: 10rpx; + top: 0; + padding: 21rpx; + width: 31rpx; + height: 31rpx; + } + .type-icon{ + width: 121rpx; + height: 156rpx; + margin-bottom: 15rpx; + } + .title{ + font-size: 34rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + } + .message{ + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + margin-top: 20rpx; + } + .confim-btn{ + width: 100%; + height: 76rpx; + line-height: 76rpx; + border-radius: 38rpx; + text-align: center; + background: #3A61B1; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + margin-top: 32rpx; + } + .cancel-btn{ + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + padding: 15rpx; + } +} \ No newline at end of file diff --git a/miniprogram/components/message/message.ts b/miniprogram/components/message/message.ts new file mode 100644 index 0000000..f76b995 --- /dev/null +++ b/miniprogram/components/message/message.ts @@ -0,0 +1,71 @@ +// components/message/message.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + title: { + type: String, + value: '' + }, + message: { + type: String, + value: '' + }, + confirmText: { + type: String, + value: '' + }, + cancelText: { + type: String, + value: '' + }, + confirmShow: { + type: Boolean, + value: true + }, + cancelShow: { + type: Boolean, + value: true + }, + iconShow: { + type: Boolean, + value: true + } + }, + + /** + * 组件的初始数据 + */ + data: { + visible: false + }, + + /** + * 组件的方法列表 + */ + methods: { + confirm() { + this.triggerEvent('confirm') + this.hidden() + }, + cencel() { + this.triggerEvent('cancel') + this.hidden() + }, + close() { + this.triggerEvent('close') + this.hidden() + }, + show() { + this.setData({ + visible: true + }) + }, + hidden() { + this.setData({ + visible: false + }) + } + } +}) diff --git a/miniprogram/components/message/message.wxml b/miniprogram/components/message/message.wxml new file mode 100644 index 0000000..007a053 --- /dev/null +++ b/miniprogram/components/message/message.wxml @@ -0,0 +1,13 @@ + + + + + + + {{title}} + {{message}} + {{confirmText}} + {{cancelText}} + + + \ No newline at end of file diff --git a/miniprogram/components/navBar/navBar.json b/miniprogram/components/navBar/navBar.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/navBar/navBar.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/navBar/navBar.scss b/miniprogram/components/navBar/navBar.scss new file mode 100644 index 0000000..55ced19 --- /dev/null +++ b/miniprogram/components/navBar/navBar.scss @@ -0,0 +1,47 @@ +/* components/navBar/navBar.wxss */ +// .fill{ +// height: 44rpx; +// background: red; +// } +.nav-bar-container{ + // padding-top: constant(safe-area-inset-top); + // padding-top: env(safe-area-inset-top); + // padding-top: 16px; + background: transparent; + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 100; + .nav-bar-box{ + // height: 96rpx; + background: transparent; + height: 48px; + display: grid; + grid-template-columns: 25% 50% 25%; + align-items: center; + box-sizing: border-box; + padding: 0 30rpx; + &.white{ + color: #ffffff; + } + .left{ + display: flex; + align-items: center; + justify-content: flex-start; + .back{ + width: 20rpx; + height: 35rpx; + padding: 15rpx 30rpx 15rpx 0; + } + } + .center{ + display: flex; + justify-content: center; + } + .right{ + display: flex; + justify-content: flex-end; + } + } +} \ No newline at end of file diff --git a/miniprogram/components/navBar/navBar.ts b/miniprogram/components/navBar/navBar.ts new file mode 100644 index 0000000..41fa014 --- /dev/null +++ b/miniprogram/components/navBar/navBar.ts @@ -0,0 +1,60 @@ +// components/navBar/navBar.ts +Component({ + /** + * 组件的属性列表 + */ + options: { + multipleSlots: true, + styleIsolation: 'apply-shared' + }, + + properties: { + bg: { + type: String, + value: '' + }, + filled: { + type: Boolean, + value: true + }, + type: { + type: String, + value: 'white' + }, + back: { + type: Boolean, + value: true + } + }, + + /** + * 组件的初始数据 + */ + data: { + menuInfo: wx.getStorageSync('MenuButtonBoundingClientRect'), + padding: 8, + pageNum: 0 + }, + + lifetimes: { + ready() { + console.log('getCurrentPages().length',getCurrentPages().length); + + this.setData({ + pageNum: getCurrentPages().length + }) + + } + }, + + /** + * 组件的方法列表 + */ + methods: { + handleBack() { + wx.navigateBack({ + delta: 1 + }) + }, + } +}) diff --git a/miniprogram/components/navBar/navBar.wxml b/miniprogram/components/navBar/navBar.wxml new file mode 100644 index 0000000..2bf90a3 --- /dev/null +++ b/miniprogram/components/navBar/navBar.wxml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/miniprogram/components/not/not.json b/miniprogram/components/not/not.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/not/not.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/not/not.scss b/miniprogram/components/not/not.scss new file mode 100644 index 0000000..94b2835 --- /dev/null +++ b/miniprogram/components/not/not.scss @@ -0,0 +1,15 @@ +/* components/not/not.wxss */ +.not-cmp{ + display: flex; + flex-direction: column; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + image{ + width: 369rpx; + height: 338rpx; + margin-bottom: 30rpx; + } +} \ No newline at end of file diff --git a/miniprogram/components/not/not.ts b/miniprogram/components/not/not.ts new file mode 100644 index 0000000..b473ca6 --- /dev/null +++ b/miniprogram/components/not/not.ts @@ -0,0 +1,25 @@ +// components/not/not.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + top: { + type: String + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/components/not/not.wxml b/miniprogram/components/not/not.wxml new file mode 100644 index 0000000..7825169 --- /dev/null +++ b/miniprogram/components/not/not.wxml @@ -0,0 +1,5 @@ + + + + 暂无相关信息... + diff --git a/miniprogram/components/painter/lib/downloader.js b/miniprogram/components/painter/lib/downloader.js new file mode 100644 index 0000000..0c56cc3 --- /dev/null +++ b/miniprogram/components/painter/lib/downloader.js @@ -0,0 +1,251 @@ +/** + * LRU 文件存储,使用该 downloader 可以让下载的文件存储在本地,下次进入小程序后可以直接使用 + * 详细设计文档可查看 https://juejin.im/post/5b42d3ede51d4519277b6ce3 + */ +const util = require('./util'); + +const SAVED_FILES_KEY = 'savedFiles'; +const KEY_TOTAL_SIZE = 'totalSize'; +const KEY_PATH = 'path'; +const KEY_TIME = 'time'; +const KEY_SIZE = 'size'; + +// 可存储总共为 6M,目前小程序可允许的最大本地存储为 10M +let MAX_SPACE_IN_B = 6 * 1024 * 1024; +let savedFiles = {}; + +export default class Dowloader { + constructor() { + // app 如果设置了最大存储空间,则使用 app 中的 + if (getApp().PAINTER_MAX_LRU_SPACE) { + MAX_SPACE_IN_B = getApp().PAINTER_MAX_LRU_SPACE; + } + wx.getStorage({ + key: SAVED_FILES_KEY, + success: function (res) { + if (res.data) { + savedFiles = res.data; + } + }, + }); + } + + /** + * 下载文件,会用 lru 方式来缓存文件到本地 + * @param {String} url 文件的 url + */ + download(url, lru) { + return new Promise((resolve, reject) => { + if (!(url && util.isValidUrl(url))) { + resolve(url); + return; + } + if (!lru) { + // 无 lru 情况下直接判断 临时文件是否存在,不存在重新下载 + wx.getFileInfo({ + filePath: url, + success: () => { + resolve(url); + }, + fail: () => { + downloadFile(url, lru).then((path) => { + resolve(path); + }, () => { + reject(); + }); + }, + }) + return + } + + const file = getFile(url); + + if (file) { + // 检查文件是否正常,不正常需要重新下载 + wx.getSavedFileInfo({ + filePath: file[KEY_PATH], + success: (res) => { + resolve(file[KEY_PATH]); + }, + fail: (error) => { + console.error(`the file is broken, redownload it, ${JSON.stringify(error)}`); + downloadFile(url, lru).then((path) => { + resolve(path); + }, () => { + reject(); + }); + }, + }); + } else { + downloadFile(url, lru).then((path) => { + resolve(path); + }, () => { + reject(); + }); + } + }); + } +} + +function downloadFile(url, lru) { + return new Promise((resolve, reject) => { + wx.downloadFile({ + url: url, + success: function (res) { + if (res.statusCode !== 200) { + console.error(`downloadFile ${url} failed res.statusCode is not 200`); + reject(); + return; + } + const { + tempFilePath + } = res; + wx.getFileInfo({ + filePath: tempFilePath, + success: (tmpRes) => { + const newFileSize = tmpRes.size; + lru ? doLru(newFileSize).then(() => { + saveFile(url, newFileSize, tempFilePath).then((filePath) => { + resolve(filePath); + }); + }, () => { + resolve(tempFilePath); + }) : resolve(tempFilePath); + }, + fail: (error) => { + // 文件大小信息获取失败,则此文件也不要进行存储 + console.error(`getFileInfo ${res.tempFilePath} failed, ${JSON.stringify(error)}`); + resolve(res.tempFilePath); + }, + }); + }, + fail: function (error) { + console.error(`downloadFile failed, ${JSON.stringify(error)} `); + reject(); + }, + }); + }); +} + +function saveFile(key, newFileSize, tempFilePath) { + return new Promise((resolve, reject) => { + wx.saveFile({ + tempFilePath: tempFilePath, + success: (fileRes) => { + const totalSize = savedFiles[KEY_TOTAL_SIZE] ? savedFiles[KEY_TOTAL_SIZE] : 0; + savedFiles[key] = {}; + savedFiles[key][KEY_PATH] = fileRes.savedFilePath; + savedFiles[key][KEY_TIME] = new Date().getTime(); + savedFiles[key][KEY_SIZE] = newFileSize; + savedFiles['totalSize'] = newFileSize + totalSize; + wx.setStorage({ + key: SAVED_FILES_KEY, + data: savedFiles, + }); + resolve(fileRes.savedFilePath); + }, + fail: (error) => { + console.error(`saveFile ${key} failed, then we delete all files, ${JSON.stringify(error)}`); + // 由于 saveFile 成功后,res.tempFilePath 处的文件会被移除,所以在存储未成功时,我们还是继续使用临时文件 + resolve(tempFilePath); + // 如果出现错误,就直接情况本地的所有文件,因为你不知道是不是因为哪次lru的某个文件未删除成功 + reset(); + }, + }); + }); +} + +/** + * 清空所有下载相关内容 + */ +function reset() { + wx.removeStorage({ + key: SAVED_FILES_KEY, + success: () => { + wx.getSavedFileList({ + success: (listRes) => { + removeFiles(listRes.fileList); + }, + fail: (getError) => { + console.error(`getSavedFileList failed, ${JSON.stringify(getError)}`); + }, + }); + }, + }); +} + +function doLru(size) { + if (size > MAX_SPACE_IN_B) { + return Promise.reject() + } + return new Promise((resolve, reject) => { + let totalSize = savedFiles[KEY_TOTAL_SIZE] ? savedFiles[KEY_TOTAL_SIZE] : 0; + + if (size + totalSize <= MAX_SPACE_IN_B) { + resolve(); + return; + } + // 如果加上新文件后大小超过最大限制,则进行 lru + const pathsShouldDelete = []; + // 按照最后一次的访问时间,从小到大排序 + const allFiles = JSON.parse(JSON.stringify(savedFiles)); + delete allFiles[KEY_TOTAL_SIZE]; + const sortedKeys = Object.keys(allFiles).sort((a, b) => { + return allFiles[a][KEY_TIME] - allFiles[b][KEY_TIME]; + }); + + for (const sortedKey of sortedKeys) { + totalSize -= savedFiles[sortedKey].size; + pathsShouldDelete.push(savedFiles[sortedKey][KEY_PATH]); + delete savedFiles[sortedKey]; + if (totalSize + size < MAX_SPACE_IN_B) { + break; + } + } + + savedFiles['totalSize'] = totalSize; + + wx.setStorage({ + key: SAVED_FILES_KEY, + data: savedFiles, + success: () => { + // 保证 storage 中不会存在不存在的文件数据 + if (pathsShouldDelete.length > 0) { + removeFiles(pathsShouldDelete); + } + resolve(); + }, + fail: (error) => { + console.error(`doLru setStorage failed, ${JSON.stringify(error)}`); + reject(); + }, + }); + }); +} + +function removeFiles(pathsShouldDelete) { + for (const pathDel of pathsShouldDelete) { + let delPath = pathDel; + if (typeof pathDel === 'object') { + delPath = pathDel.filePath; + } + wx.removeSavedFile({ + filePath: delPath, + fail: (error) => { + console.error(`removeSavedFile ${pathDel} failed, ${JSON.stringify(error)}`); + }, + }); + } +} + +function getFile(key) { + if (!savedFiles[key]) { + return; + } + savedFiles[key]['time'] = new Date().getTime(); + wx.setStorage({ + key: SAVED_FILES_KEY, + data: savedFiles, + }); + return savedFiles[key]; +} \ No newline at end of file diff --git a/miniprogram/components/painter/lib/gradient.js b/miniprogram/components/painter/lib/gradient.js new file mode 100644 index 0000000..f0729e4 --- /dev/null +++ b/miniprogram/components/painter/lib/gradient.js @@ -0,0 +1,102 @@ +/* eslint-disable */ +// 当ctx传入当前文件,const grd = ctx.createCircularGradient() 和 +// const grd = this.ctx.createLinearGradient() 无效,因此只能分开处理 +// 先分析,在外部创建grd,再传入使用就可以 + +!(function () { + + var api = { + isGradient: function(bg) { + if (bg && (bg.startsWith('linear') || bg.startsWith('radial'))) { + return true; + } + return false; + }, + + doGradient: function(bg, width, height, ctx) { + if (bg.startsWith('linear')) { + linearEffect(width, height, bg, ctx); + } else if (bg.startsWith('radial')) { + radialEffect(width, height, bg, ctx); + } + }, + } + + function analizeGrad(string) { + const colorPercents = string.substring(0, string.length - 1).split("%,"); + const colors = []; + const percents = []; + for (let colorPercent of colorPercents) { + colors.push(colorPercent.substring(0, colorPercent.lastIndexOf(" ")).trim()); + percents.push(colorPercent.substring(colorPercent.lastIndexOf(" "), colorPercent.length) / 100); + } + return {colors: colors, percents: percents}; + } + + function radialEffect(width, height, bg, ctx) { + const colorPer = analizeGrad(bg.match(/radial-gradient\((.+)\)/)[1]); + const grd = ctx.createCircularGradient(0, 0, width < height ? height / 2 : width / 2); + for (let i = 0; i < colorPer.colors.length; i++) { + grd.addColorStop(colorPer.percents[i], colorPer.colors[i]); + } + ctx.fillStyle = grd; + //ctx.fillRect(-(width / 2), -(height / 2), width, height); + } + + function analizeLinear(bg, width, height) { + const direction = bg.match(/([-]?\d{1,3})deg/); + const dir = direction && direction[1] ? parseFloat(direction[1]) : 0; + let coordinate; + switch (dir) { + case 0: coordinate = [0, -height / 2, 0, height / 2]; break; + case 90: coordinate = [width / 2, 0, -width / 2, 0]; break; + case -90: coordinate = [-width / 2, 0, width / 2, 0]; break; + case 180: coordinate = [0, height / 2, 0, -height / 2]; break; + case -180: coordinate = [0, -height / 2, 0, height / 2]; break; + default: + let x1 = 0; + let y1 = 0; + let x2 = 0; + let y2 = 0; + if (direction[1] > 0 && direction[1] < 90) { + x1 = (width / 2) - ((width / 2) * Math.tan((90 - direction[1]) * Math.PI * 2 / 360) - height / 2) * Math.sin(2 * (90 - direction[1]) * Math.PI * 2 / 360) / 2; + y2 = Math.tan((90 - direction[1]) * Math.PI * 2 / 360) * x1; + x2 = -x1; + y1 = -y2; + } else if (direction[1] > -180 && direction[1] < -90) { + x1 = -(width / 2) + ((width / 2) * Math.tan((90 - direction[1]) * Math.PI * 2 / 360) - height / 2) * Math.sin(2 * (90 - direction[1]) * Math.PI * 2 / 360) / 2; + y2 = Math.tan((90 - direction[1]) * Math.PI * 2 / 360) * x1; + x2 = -x1; + y1 = -y2; + } else if (direction[1] > 90 && direction[1] < 180) { + x1 = (width / 2) + (-(width / 2) * Math.tan((90 - direction[1]) * Math.PI * 2 / 360) - height / 2) * Math.sin(2 * (90 - direction[1]) * Math.PI * 2 / 360) / 2; + y2 = Math.tan((90 - direction[1]) * Math.PI * 2 / 360) * x1; + x2 = -x1; + y1 = -y2; + } else { + x1 = -(width / 2) - (-(width / 2) * Math.tan((90 - direction[1]) * Math.PI * 2 / 360) - height / 2) * Math.sin(2 * (90 - direction[1]) * Math.PI * 2 / 360) / 2; + y2 = Math.tan((90 - direction[1]) * Math.PI * 2 / 360) * x1; + x2 = -x1; + y1 = -y2; + } + coordinate = [x1, y1, x2, y2]; + break; + } + return coordinate; + } + + function linearEffect(width, height, bg, ctx) { + const param = analizeLinear(bg, width, height); + const grd = ctx.createLinearGradient(param[0], param[1], param[2], param[3]); + const content = bg.match(/linear-gradient\((.+)\)/)[1]; + const colorPer = analizeGrad(content.substring(content.indexOf(',') + 1)); + for (let i = 0; i < colorPer.colors.length; i++) { + grd.addColorStop(colorPer.percents[i], colorPer.colors[i]); + } + ctx.fillStyle = grd + //ctx.fillRect(-(width / 2), -(height / 2), width, height); + } + + module.exports = { api } + +})(); diff --git a/miniprogram/components/painter/lib/pen.js b/miniprogram/components/painter/lib/pen.js new file mode 100644 index 0000000..aa290fa --- /dev/null +++ b/miniprogram/components/painter/lib/pen.js @@ -0,0 +1,750 @@ +const QR = require('./qrcode.js'); +const GD = require('./gradient.js'); + +export default class Painter { + constructor(ctx, data) { + this.ctx = ctx; + this.data = data; + this.globalWidth = {}; + this.globalHeight = {}; + } + + isMoving = false + movingCache = {} + paint(callback, isMoving, movingCache) { + this.style = { + width: this.data.width.toPx(), + height: this.data.height.toPx(), + }; + if (isMoving) { + this.isMoving = true + this.movingCache = movingCache + } + this._background(); + for (const view of this.data.views) { + this._drawAbsolute(view); + } + this.ctx.draw(false, () => { + callback && callback(this.callbackInfo); + }); + } + + _background() { + this.ctx.save(); + const { + width, + height, + } = this.style; + const bg = this.data.background; + this.ctx.translate(width / 2, height / 2); + + this._doClip(this.data.borderRadius, width, height); + if (!bg) { + // 如果未设置背景,则默认使用透明色 + this.ctx.fillStyle = 'transparent'; + this.ctx.fillRect(-(width / 2), -(height / 2), width, height); + } else if (bg.startsWith('#') || bg.startsWith('rgba') || bg.toLowerCase() === 'transparent') { + // 背景填充颜色 + this.ctx.fillStyle = bg; + this.ctx.fillRect(-(width / 2), -(height / 2), width, height); + } else if (GD.api.isGradient(bg)) { + GD.api.doGradient(bg, width, height, this.ctx); + this.ctx.fillRect(-(width / 2), -(height / 2), width, height); + } else { + // 背景填充图片 + this.ctx.drawImage(bg, -(width / 2), -(height / 2), width, height); + } + this.ctx.restore(); + } + + _drawAbsolute(view) { + if (!(view && view.type)) { + // 过滤无效 view + return + } + // 证明 css 为数组形式,需要合并 + if (view.css && view.css.length) { + /* eslint-disable no-param-reassign */ + view.css = Object.assign(...view.css); + } + switch (view.type) { + case 'image': + this._drawAbsImage(view); + break; + case 'text': + this._fillAbsText(view); + break; + case 'rect': + this._drawAbsRect(view); + break; + case 'qrcode': + this._drawQRCode(view); + break; + default: + break; + } + } + + _border({ + borderRadius = 0, + width, + height, + borderWidth = 0, + borderStyle = 'solid' + }) { + let r1 = 0, + r2 = 0, + r3 = 0, + r4 = 0 + const minSize = Math.min(width, height); + if (borderRadius) { + const border = borderRadius.split(/\s+/) + if (border.length === 4) { + r1 = Math.min(border[0].toPx(false, minSize), width / 2, height / 2); + r2 = Math.min(border[1].toPx(false, minSize), width / 2, height / 2); + r3 = Math.min(border[2].toPx(false, minSize), width / 2, height / 2); + r4 = Math.min(border[3].toPx(false, minSize), width / 2, height / 2); + } else { + r1 = r2 = r3 = r4 = Math.min(borderRadius && borderRadius.toPx(false, minSize), width / 2, height / 2); + } + } + const lineWidth = borderWidth && borderWidth.toPx(false, minSize); + this.ctx.lineWidth = lineWidth; + if (borderStyle === 'dashed') { + this.ctx.setLineDash([lineWidth * 4 / 3, lineWidth * 4 / 3]); + // this.ctx.lineDashOffset = 2 * lineWidth + } else if (borderStyle === 'dotted') { + this.ctx.setLineDash([lineWidth, lineWidth]); + } + const notSolid = borderStyle !== 'solid' + this.ctx.beginPath(); + + notSolid && r1 === 0 && this.ctx.moveTo(-width / 2 - lineWidth, -height / 2 - lineWidth / 2) // 顶边虚线规避重叠规则 + r1 !== 0 && this.ctx.arc(-width / 2 + r1, -height / 2 + r1, r1 + lineWidth / 2, 1 * Math.PI, 1.5 * Math.PI); //左上角圆弧 + this.ctx.lineTo(r2 === 0 ? notSolid ? width / 2 : width / 2 + lineWidth / 2 : width / 2 - r2, -height / 2 - lineWidth / 2); // 顶边线 + + notSolid && r2 === 0 && this.ctx.moveTo(width / 2 + lineWidth / 2, -height / 2 - lineWidth) // 右边虚线规避重叠规则 + r2 !== 0 && this.ctx.arc(width / 2 - r2, -height / 2 + r2, r2 + lineWidth / 2, 1.5 * Math.PI, 2 * Math.PI); // 右上角圆弧 + this.ctx.lineTo(width / 2 + lineWidth / 2, r3 === 0 ? notSolid ? height / 2 : height / 2 + lineWidth / 2 : height / 2 - r3); // 右边线 + + notSolid && r3 === 0 && this.ctx.moveTo(width / 2 + lineWidth, height / 2 + lineWidth / 2) // 底边虚线规避重叠规则 + r3 !== 0 && this.ctx.arc(width / 2 - r3, height / 2 - r3, r3 + lineWidth / 2, 0, 0.5 * Math.PI); // 右下角圆弧 + this.ctx.lineTo(r4 === 0 ? notSolid ? -width / 2 : -width / 2 - lineWidth / 2 : -width / 2 + r4, height / 2 + lineWidth / 2); // 底边线 + + notSolid && r4 === 0 && this.ctx.moveTo(-width / 2 - lineWidth / 2, height / 2 + lineWidth) // 左边虚线规避重叠规则 + r4 !== 0 && this.ctx.arc(-width / 2 + r4, height / 2 - r4, r4 + lineWidth / 2, 0.5 * Math.PI, 1 * Math.PI); // 左下角圆弧 + this.ctx.lineTo(-width / 2 - lineWidth / 2, r1 === 0 ? notSolid ? -height / 2 : -height / 2 - lineWidth / 2 : -height / 2 + r1); // 左边线 + notSolid && r1 === 0 && this.ctx.moveTo(-width / 2 - lineWidth, -height / 2 - lineWidth / 2) // 顶边虚线规避重叠规则 + + if (!notSolid) { + this.ctx.closePath(); + } + } + + /** + * 根据 borderRadius 进行裁减 + */ + _doClip(borderRadius, width, height, borderStyle) { + if (borderRadius && width && height) { + // 防止在某些机型上周边有黑框现象,此处如果直接设置 fillStyle 为透明,在 Android 机型上会导致被裁减的图片也变为透明, iOS 和 IDE 上不会 + // globalAlpha 在 1.9.90 起支持,低版本下无效,但把 fillStyle 设为了 white,相对默认的 black 要好点 + this.ctx.globalAlpha = 0; + this.ctx.fillStyle = 'white'; + this._border({ + borderRadius, + width, + height, + borderStyle + }) + this.ctx.fill(); + // 在 ios 的 6.6.6 版本上 clip 有 bug,禁掉此类型上的 clip,也就意味着,在此版本微信的 ios 设备下无法使用 border 属性 + if (!(getApp().systemInfo && + getApp().systemInfo.version <= '6.6.6' && + getApp().systemInfo.platform === 'ios')) { + this.ctx.clip(); + } + this.ctx.globalAlpha = 1; + } + } + + /** + * 画边框 + */ + _doBorder(view, width, height) { + if (!view.css) { + return; + } + const { + borderRadius, + borderWidth, + borderColor, + borderStyle + } = view.css; + if (!borderWidth) { + return; + } + this.ctx.save(); + this._preProcess(view, true); + this.ctx.strokeStyle = (borderColor || 'black'); + this._border({ + borderRadius, + width, + height, + borderWidth, + borderStyle + }) + this.ctx.stroke(); + this.ctx.restore(); + } + + _preProcess(view, notClip) { + let width = 0; + let height; + let extra; + const paddings = this._doPaddings(view); + switch (view.type) { + case 'text': { + const textArray = view.text.split('\n'); + // 处理多个连续的'\n' + for (let i = 0; i < textArray.length; ++i) { + if (textArray[i] === '') { + textArray[i] = ' '; + } + } + const fontWeight = view.css.fontWeight === 'bold' ? 'bold' : 'normal'; + const textStyle = view.css.textStyle === 'italic' ? 'italic' : 'normal'; + if (!view.css.fontSize) { + view.css.fontSize = '20rpx'; + } + this.ctx.font = `${textStyle} ${fontWeight} ${view.css.fontSize.toPx()}px ${view.css.fontFamily ? view.css.fontFamily : 'sans-serif'}`; + // 计算行数 + let lines = 0; + const linesArray = []; + for (let i = 0; i < textArray.length; ++i) { + const textLength = this.ctx.measureText(textArray[i]).width; + const minWidth = view.css.fontSize.toPx() + paddings[1] + paddings[3]; + let partWidth = view.css.width ? view.css.width.toPx(false, this.style.width) - paddings[1] - paddings[3] : textLength; + if (partWidth < minWidth) { + partWidth = minWidth; + } + const calLines = Math.ceil(textLength / partWidth); + // 取最长的作为 width + width = partWidth > width ? partWidth : width; + lines += calLines; + linesArray[i] = calLines; + } + lines = view.css.maxLines < lines ? view.css.maxLines : lines; + const lineHeight = view.css.lineHeight ? view.css.lineHeight.toPx() : view.css.fontSize.toPx(); + height = lineHeight * lines; + extra = { + lines: lines, + lineHeight: lineHeight, + textArray: textArray, + linesArray: linesArray, + }; + break; + } + case 'image': { + // image的长宽设置成auto的逻辑处理 + const ratio = getApp().systemInfo.pixelRatio ? getApp().systemInfo.pixelRatio : 2; + // 有css却未设置width或height,则默认为auto + if (view.css) { + if (!view.css.width) { + view.css.width = 'auto'; + } + if (!view.css.height) { + view.css.height = 'auto'; + } + } + if (!view.css || (view.css.width === 'auto' && view.css.height === 'auto')) { + width = Math.round(view.sWidth / ratio); + height = Math.round(view.sHeight / ratio); + } else if (view.css.width === 'auto') { + height = view.css.height.toPx(false, this.style.height); + width = view.sWidth / view.sHeight * height; + } else if (view.css.height === 'auto') { + width = view.css.width.toPx(false, this.style.width); + height = view.sHeight / view.sWidth * width; + } else { + width = view.css.width.toPx(false, this.style.width); + height = view.css.height.toPx(false, this.style.height); + } + break; + } + default: + if (!(view.css.width && view.css.height)) { + console.error('You should set width and height'); + return; + } + width = view.css.width.toPx(false, this.style.width); + height = view.css.height.toPx(false, this.style.height); + break; + } + let x; + if (view.css && view.css.right) { + if (typeof view.css.right === 'string') { + x = this.style.width - view.css.right.toPx(true, this.style.width); + } else { + // 可以用数组方式,把文字长度计算进去 + // [right, 文字id, 乘数(默认 1)] + const rights = view.css.right; + x = this.style.width - rights[0].toPx(true, this.style.width) - this.globalWidth[rights[1]] * (rights[2] || 1); + } + } else if (view.css && view.css.left) { + if (typeof view.css.left === 'string') { + x = view.css.left.toPx(true, this.style.width); + } else { + const lefts = view.css.left; + x = lefts[0].toPx(true, this.style.width) + this.globalWidth[lefts[1]] * (lefts[2] || 1); + } + } else { + x = 0; + } + //const y = view.css && view.css.bottom ? this.style.height - height - view.css.bottom.toPx(true) : (view.css && view.css.top ? view.css.top.toPx(true) : 0); + let y; + if (view.css && view.css.bottom) { + y = this.style.height - height - view.css.bottom.toPx(true, this.style.height); + } else { + if (view.css && view.css.top) { + if (typeof view.css.top === 'string') { + y = view.css.top.toPx(true, this.style.height); + } else { + const tops = view.css.top; + y = tops[0].toPx(true, this.style.height) + this.globalHeight[tops[1]] * (tops[2] || 1); + } + } else { + y = 0 + } + } + + const angle = view.css && view.css.rotate ? this._getAngle(view.css.rotate) : 0; + // 当设置了 right 时,默认 align 用 right,反之用 left + const align = view.css && view.css.align ? view.css.align : (view.css && view.css.right ? 'right' : 'left'); + const verticalAlign = view.css && view.css.verticalAlign ? view.css.verticalAlign : 'top'; + // 记录绘制时的画布 + let xa = 0; + switch (align) { + case 'center': + xa = x; + break; + case 'right': + xa = x - width / 2; + break; + default: + xa = x + width / 2; + break; + } + let ya = 0; + switch (verticalAlign) { + case 'center': + ya = y; + break; + case 'bottom': + ya = y - height / 2; + break; + default: + ya = y + height / 2; + break; + } + this.ctx.translate(xa, ya); + // 记录该 view 的有效点击区域 + // TODO ,旋转和裁剪的判断 + // 记录在真实画布上的左侧 + let left = x + if (align === 'center') { + left = x - width / 2 + } else if (align === 'right') { + left = x - width + } + var top = y; + if (verticalAlign === 'center') { + top = y - height / 2; + } else if (verticalAlign === 'bottom') { + top = y - height + } + if (view.rect) { + view.rect.left = left; + view.rect.top = top; + view.rect.right = left + width; + view.rect.bottom = top + height; + view.rect.x = view.css && view.css.right ? x - width : x; + view.rect.y = y; + } else { + view.rect = { + left: left, + top: top, + right: left + width, + bottom: top + height, + x: view.css && view.css.right ? x - width : x, + y: y + }; + } + + view.rect.left = view.rect.left - paddings[3]; + view.rect.top = view.rect.top - paddings[0]; + view.rect.right = view.rect.right + paddings[1]; + view.rect.bottom = view.rect.bottom + paddings[2]; + if (view.type === 'text') { + view.rect.minWidth = view.css.fontSize.toPx() + paddings[1] + paddings[3]; + } + + this.ctx.rotate(angle); + if (!notClip && view.css && view.css.borderRadius && view.type !== 'rect') { + this._doClip(view.css.borderRadius, width, height, view.css.borderStyle); + } + this._doShadow(view); + if (view.id) { + this.globalWidth[view.id] = width; + this.globalHeight[view.id] = height; + } + return { + width: width, + height: height, + x: x, + y: y, + extra: extra, + }; + } + + _doPaddings(view) { + const { + padding, + } = view.css; + let pd = [0, 0, 0, 0]; + if (padding) { + const pdg = padding.split(/\s+/); + if (pdg.length === 1) { + const x = pdg[0].toPx(); + pd = [x, x, x, x]; + } + if (pdg.length === 2) { + const x = pdg[0].toPx(); + const y = pdg[1].toPx(); + pd = [x, y, x, y]; + } + if (pdg.length === 3) { + const x = pdg[0].toPx(); + const y = pdg[1].toPx(); + const z = pdg[2].toPx(); + pd = [x, y, z, y]; + } + if (pdg.length === 4) { + const x = pdg[0].toPx(); + const y = pdg[1].toPx(); + const z = pdg[2].toPx(); + const a = pdg[3].toPx(); + pd = [x, y, z, a]; + } + } + return pd; + } + + // 画文字的背景图片 + _doBackground(view) { + this.ctx.save(); + const { + width: rawWidth, + height: rawHeight, + } = this._preProcess(view, true); + + const { + background, + } = view.css; + let pd = this._doPaddings(view); + const width = rawWidth + pd[1] + pd[3]; + const height = rawHeight + pd[0] + pd[2]; + + this._doClip(view.css.borderRadius, width, height, view.css.borderStyle) + if (GD.api.isGradient(background)) { + GD.api.doGradient(background, width, height, this.ctx); + } else { + this.ctx.fillStyle = background; + } + this.ctx.fillRect(-(width / 2), -(height / 2), width, height); + + this.ctx.restore(); + } + + _drawQRCode(view) { + this.ctx.save(); + const { + width, + height, + } = this._preProcess(view); + QR.api.draw(view.content, this.ctx, -width / 2, -height / 2, width, height, view.css.background, view.css.color); + this.ctx.restore(); + this._doBorder(view, width, height); + } + + _drawAbsImage(view) { + if (!view.url) { + return; + } + this.ctx.save(); + const { + width, + height, + } = this._preProcess(view); + // 获得缩放到图片大小级别的裁减框 + let rWidth = view.sWidth; + let rHeight = view.sHeight; + let startX = 0; + let startY = 0; + // 绘画区域比例 + const cp = width / height; + // 原图比例 + const op = view.sWidth / view.sHeight; + if (cp >= op) { + rHeight = rWidth / cp; + startY = Math.round((view.sHeight - rHeight) / 2); + } else { + rWidth = rHeight * cp; + startX = Math.round((view.sWidth - rWidth) / 2); + } + if (view.css && view.css.mode === 'scaleToFill') { + this.ctx.drawImage(view.url, -(width / 2), -(height / 2), width, height); + } else { + this.ctx.drawImage(view.url, startX, startY, rWidth, rHeight, -(width / 2), -(height / 2), width, height); + view.rect.startX = startX / view.sWidth; + view.rect.startY = startY / view.sHeight; + view.rect.endX = (startX + rWidth) / view.sWidth; + view.rect.endY = (startY + rHeight) / view.sHeight; + } + this.ctx.restore(); + this._doBorder(view, width, height); + } + + callbackInfo = {} + _fillAbsText(view) { + if (!view.text) { + return; + } + if (view.css.background) { + // 生成背景 + this._doBackground(view); + } + this.ctx.save(); + const { + width, + height, + extra, + } = this._preProcess(view, view.css.background && view.css.borderRadius); + this.ctx.fillStyle = (view.css.color || 'black'); + if (this.isMoving && JSON.stringify(this.movingCache) !== JSON.stringify({})) { + this.globalWidth[view.id] = this.movingCache.globalWidth + this.ctx.setTextAlign(view.css.textAlign ? view.css.textAlign : 'left'); + for (const i of this.movingCache.lineArray) { + const { + measuredWith, + text, + x, + y, + textDecoration + } = i + if (view.css.textStyle === 'stroke') { + this.ctx.strokeText(text, x, y, measuredWith); + } else { + this.ctx.fillText(text, x, y, measuredWith); + } + if (textDecoration) { + const fontSize = view.css.fontSize.toPx(); + this.ctx.lineWidth = fontSize / 13; + this.ctx.beginPath(); + this.ctx.moveTo(...textDecoration.moveTo); + this.ctx.lineTo(...textDecoration.lineTo); + this.ctx.closePath(); + this.ctx.strokeStyle = view.css.color; + this.ctx.stroke(); + } + } + } else { + const { + lines, + lineHeight, + textArray, + linesArray, + } = extra; + // 如果设置了id,则保留 text 的长度 + if (view.id) { + let textWidth = 0; + for (let i = 0; i < textArray.length; ++i) { + const _w = this.ctx.measureText(textArray[i]).width + textWidth = _w > textWidth ? _w : textWidth; + } + this.globalWidth[view.id] = width ? (textWidth < width ? textWidth : width) : textWidth; + if (!this.isMoving) { + Object.assign(this.callbackInfo, { + globalWidth: this.globalWidth[view.id] + }) + } + } + let lineIndex = 0; + for (let j = 0; j < textArray.length; ++j) { + const preLineLength = Math.ceil(textArray[j].length / linesArray[j]); + let start = 0; + let alreadyCount = 0; + + for (let i = 0; i < linesArray[j]; ++i) { + // 绘制行数大于最大行数,则直接跳出循环 + if (lineIndex >= lines) { + break; + } + alreadyCount = preLineLength; + let text = textArray[j].substr(start, alreadyCount); + let measuredWith = this.ctx.measureText(text).width; + // 如果测量大小小于width一个字符的大小,则进行补齐,如果测量大小超出 width,则进行减除 + // 如果已经到文本末尾,也不要进行该循环 + while ((start + alreadyCount <= textArray[j].length) && (width - measuredWith > view.css.fontSize.toPx() || measuredWith - width > view.css.fontSize.toPx())) { + if (measuredWith < width) { + text = textArray[j].substr(start, ++alreadyCount); + } else { + if (text.length <= 1) { + // 如果只有一个字符时,直接跳出循环 + break; + } + text = textArray[j].substr(start, --alreadyCount); + // break; + } + measuredWith = this.ctx.measureText(text).width; + } + start += text.length + // 如果是最后一行了,发现还有未绘制完的内容,则加... + if (lineIndex === lines - 1 && (j < textArray.length - 1 || start < textArray[j].length)) { + while (this.ctx.measureText(`${text}...`).width > width) { + if (text.length <= 1) { + // 如果只有一个字符时,直接跳出循环 + break; + } + text = text.substring(0, text.length - 1); + } + text += '...'; + measuredWith = this.ctx.measureText(text).width; + } + this.ctx.setTextAlign(view.css.textAlign ? view.css.textAlign : 'left'); + let x; + let lineX; + switch (view.css.textAlign) { + case 'center': + x = 0; + lineX = x - measuredWith / 2; + break; + case 'right': + x = (width / 2); + lineX = x - measuredWith; + break; + default: + x = -(width / 2); + lineX = x; + break; + } + const y = -(height / 2) + (lineIndex === 0 ? view.css.fontSize.toPx() : (view.css.fontSize.toPx() + lineIndex * lineHeight)); + lineIndex++; + if (view.css.textStyle === 'stroke') { + this.ctx.strokeText(text, x, y, measuredWith); + } else { + this.ctx.fillText(text, x, y, measuredWith); + } + const fontSize = view.css.fontSize.toPx(); + let textDecoration; + if (view.css.textDecoration) { + this.ctx.lineWidth = fontSize / 13; + this.ctx.beginPath(); + if (/\bunderline\b/.test(view.css.textDecoration)) { + this.ctx.moveTo(lineX, y); + this.ctx.lineTo(lineX + measuredWith, y); + textDecoration = { + moveTo: [lineX, y], + lineTo: [lineX + measuredWith, y] + } + } + if (/\boverline\b/.test(view.css.textDecoration)) { + this.ctx.moveTo(lineX, y - fontSize); + this.ctx.lineTo(lineX + measuredWith, y - fontSize); + textDecoration = { + moveTo: [lineX, y - fontSize], + lineTo: [lineX + measuredWith, y - fontSize] + } + } + if (/\bline-through\b/.test(view.css.textDecoration)) { + this.ctx.moveTo(lineX, y - fontSize / 3); + this.ctx.lineTo(lineX + measuredWith, y - fontSize / 3); + textDecoration = { + moveTo: [lineX, y - fontSize / 3], + lineTo: [lineX + measuredWith, y - fontSize / 3] + } + } + this.ctx.closePath(); + this.ctx.strokeStyle = view.css.color; + this.ctx.stroke(); + } + if (!this.isMoving) { + this.callbackInfo.lineArray ? this.callbackInfo.lineArray.push({ + text, + x, + y, + measuredWith, + textDecoration + }) : this.callbackInfo.lineArray = [{ + text, + x, + y, + measuredWith, + textDecoration + }] + } + } + } + } + this.ctx.restore(); + this._doBorder(view, width, height); + } + + _drawAbsRect(view) { + this.ctx.save(); + const { + width, + height, + } = this._preProcess(view); + if (GD.api.isGradient(view.css.color)) { + GD.api.doGradient(view.css.color, width, height, this.ctx); + } else { + this.ctx.fillStyle = view.css.color; + } + const { + borderRadius, + borderStyle, + borderWidth + } = view.css + this._border({ + borderRadius, + width, + height, + borderWidth, + borderStyle + }) + this.ctx.fill(); + this.ctx.restore(); + this._doBorder(view, width, height); + } + + // shadow 支持 (x, y, blur, color), 不支持 spread + // shadow:0px 0px 10px rgba(0,0,0,0.1); + _doShadow(view) { + if (!view.css || !view.css.shadow) { + return; + } + const box = view.css.shadow.replace(/,\s+/g, ',').split(/\s+/); + if (box.length > 4) { + console.error('shadow don\'t spread option'); + return; + } + this.ctx.shadowOffsetX = parseInt(box[0], 10); + this.ctx.shadowOffsetY = parseInt(box[1], 10); + this.ctx.shadowBlur = parseInt(box[2], 10); + this.ctx.shadowColor = box[3]; + } + + _getAngle(angle) { + return Number(angle) * Math.PI / 180; + } +} diff --git a/miniprogram/components/painter/lib/qrcode.js b/miniprogram/components/painter/lib/qrcode.js new file mode 100644 index 0000000..264c202 --- /dev/null +++ b/miniprogram/components/painter/lib/qrcode.js @@ -0,0 +1,784 @@ +/* eslint-disable */ +!(function () { + + // alignment pattern + var adelta = [ + 0, 11, 15, 19, 23, 27, 31, + 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, + 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28 + ]; + + // version block + var vpat = [ + 0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, + 0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9, + 0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, + 0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, + 0x541, 0xc69 + ]; + + // final format bits with mask: level << 3 | mask + var fmtword = [ + 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L + 0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M + 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q + 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H + ]; + + // 4 per version: number of blocks 1,2; data width; ecc width + var eccblocks = [ + 1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, + 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, + 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, + 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, + 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, + 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, + 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, + 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, + 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, + 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, + 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, + 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, + 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, + 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, + 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, + 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, + 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, + 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, + 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, + 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, + 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, + 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, + 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, + 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, + 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, + 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, + 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, + 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, + 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, + 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, + 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, + 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, + 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, + 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, + 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, + 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, + 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, + 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, + 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, + 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30 + ]; + + // Galois field log table + var glog = [ + 0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, + 0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71, + 0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45, + 0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6, + 0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88, + 0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40, + 0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d, + 0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57, + 0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18, + 0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e, + 0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61, + 0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2, + 0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6, + 0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a, + 0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7, + 0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf + ]; + + // Galios field exponent table + var gexp = [ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, + 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, + 0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23, + 0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1, + 0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, + 0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2, + 0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce, + 0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc, + 0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54, + 0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73, + 0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff, + 0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41, + 0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6, + 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09, + 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16, + 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00 + ]; + + // Working buffers: + // data input and ecc append, image working buffer, fixed part of image, run lengths for badness + var strinbuf = [], eccbuf = [], qrframe = [], framask = [], rlens = []; + // Control values - width is based on version, last 4 are from table. + var version, width, neccblk1, neccblk2, datablkw, eccblkwid; + var ecclevel = 2; + // set bit to indicate cell in qrframe is immutable. symmetric around diagonal + function setmask(x, y) { + var bt; + if (x > y) { + bt = x; + x = y; + y = bt; + } + // y*y = 1+3+5... + bt = y; + bt *= y; + bt += y; + bt >>= 1; + bt += x; + framask[bt] = 1; + } + + // enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask) + function putalign(x, y) { + var j; + + qrframe[x + width * y] = 1; + for (j = -2; j < 2; j++) { + qrframe[(x + j) + width * (y - 2)] = 1; + qrframe[(x - 2) + width * (y + j + 1)] = 1; + qrframe[(x + 2) + width * (y + j)] = 1; + qrframe[(x + j + 1) + width * (y + 2)] = 1; + } + for (j = 0; j < 2; j++) { + setmask(x - 1, y + j); + setmask(x + 1, y - j); + setmask(x - j, y - 1); + setmask(x + j, y + 1); + } + } + + //======================================================================== + // Reed Solomon error correction + // exponentiation mod N + function modnn(x) { + while (x >= 255) { + x -= 255; + x = (x >> 8) + (x & 255); + } + return x; + } + + var genpoly = []; + + // Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given. + function appendrs(data, dlen, ecbuf, eclen) { + var i, j, fb; + + for (i = 0; i < eclen; i++) + strinbuf[ecbuf + i] = 0; + for (i = 0; i < dlen; i++) { + fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]]; + if (fb != 255) /* fb term is non-zero */ + for (j = 1; j < eclen; j++) + strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])]; + else + for (j = ecbuf; j < ecbuf + eclen; j++) + strinbuf[j] = strinbuf[j + 1]; + strinbuf[ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])]; + } + } + + //======================================================================== + // Frame data insert following the path rules + + // check mask - since symmetrical use half. + function ismasked(x, y) { + var bt; + if (x > y) { + bt = x; + x = y; + y = bt; + } + bt = y; + bt += y * y; + bt >>= 1; + bt += x; + return framask[bt]; + } + + //======================================================================== + // Apply the selected mask out of the 8. + function applymask(m) { + var x, y, r3x, r3y; + + switch (m) { + case 0: + for (y = 0; y < width; y++) + for (x = 0; x < width; x++) + if (!((x + y) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + break; + case 1: + for (y = 0; y < width; y++) + for (x = 0; x < width; x++) + if (!(y & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + break; + case 2: + for (y = 0; y < width; y++) + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!r3x && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + break; + case 3: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = r3y, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!r3x && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 4: + for (y = 0; y < width; y++) + for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++ , r3x++) { + if (r3x == 3) { + r3x = 0; + r3y = !r3y; + } + if (!r3y && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + break; + case 5: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 6: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 7: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + } + return; + } + + // Badness coefficients. + var N1 = 3, N2 = 3, N3 = 40, N4 = 10; + + // Using the table of the length of each run, calculate the amount of bad image + // - long runs or those that look like finders; called twice, once each for X and Y + function badruns(length) { + var i; + var runsbad = 0; + for (i = 0; i <= length; i++) + if (rlens[i] >= 5) + runsbad += N1 + rlens[i] - 5; + // BwBBBwB as in finder + for (i = 3; i < length - 1; i += 2) + if (rlens[i - 2] == rlens[i + 2] + && rlens[i + 2] == rlens[i - 1] + && rlens[i - 1] == rlens[i + 1] + && rlens[i - 1] * 3 == rlens[i] + // white around the black pattern? Not part of spec + && (rlens[i - 3] == 0 // beginning + || i + 3 > length // end + || rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4) + ) + runsbad += N3; + return runsbad; + } + + // Calculate how bad the masked image is - blocks, imbalance, runs, or finders. + function badcheck() { + var x, y, h, b, b1; + var thisbad = 0; + var bw = 0; + + // blocks of same color. + for (y = 0; y < width - 1; y++) + for (x = 0; x < width - 1; x++) + if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y] + && qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black + || !(qrframe[x + width * y] || qrframe[(x + 1) + width * y] + || qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white + thisbad += N2; + + // X runs + for (y = 0; y < width; y++) { + rlens[0] = 0; + for (h = b = x = 0; x < width; x++) { + if ((b1 = qrframe[x + width * y]) == b) + rlens[h]++; + else + rlens[++h] = 1; + b = b1; + bw += b ? 1 : -1; + } + thisbad += badruns(h); + } + + // black/white imbalance + if (bw < 0) + bw = -bw; + + var big = bw; + var count = 0; + big += big << 2; + big <<= 1; + while (big > width * width) + big -= width * width, count++; + thisbad += count * N4; + + // Y runs + for (x = 0; x < width; x++) { + rlens[0] = 0; + for (h = b = y = 0; y < width; y++) { + if ((b1 = qrframe[x + width * y]) == b) + rlens[h]++; + else + rlens[++h] = 1; + b = b1; + } + thisbad += badruns(h); + } + return thisbad; + } + + function genframe(instring) { + var x, y, k, t, v, i, j, m; + + // find the smallest version that fits the string + t = instring.length; + version = 0; + do { + version++; + k = (ecclevel - 1) * 4 + (version - 1) * 16; + neccblk1 = eccblocks[k++]; + neccblk2 = eccblocks[k++]; + datablkw = eccblocks[k++]; + eccblkwid = eccblocks[k]; + k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9); + if (t <= k) + break; + } while (version < 40); + + // FIXME - insure that it fits insted of being truncated + width = 17 + 4 * version; + + // allocate, clear and setup data structures + v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; + for (t = 0; t < v; t++) + eccbuf[t] = 0; + strinbuf = instring.slice(0); + + for (t = 0; t < width * width; t++) + qrframe[t] = 0; + + for (t = 0; t < (width * (width + 1) + 1) / 2; t++) + framask[t] = 0; + + // insert finders - black to frame, white to mask + for (t = 0; t < 3; t++) { + k = 0; + y = 0; + if (t == 1) + k = (width - 7); + if (t == 2) + y = (width - 7); + qrframe[(y + 3) + width * (k + 3)] = 1; + for (x = 0; x < 6; x++) { + qrframe[(y + x) + width * k] = 1; + qrframe[y + width * (k + x + 1)] = 1; + qrframe[(y + 6) + width * (k + x)] = 1; + qrframe[(y + x + 1) + width * (k + 6)] = 1; + } + for (x = 1; x < 5; x++) { + setmask(y + x, k + 1); + setmask(y + 1, k + x + 1); + setmask(y + 5, k + x); + setmask(y + x + 1, k + 5); + } + for (x = 2; x < 4; x++) { + qrframe[(y + x) + width * (k + 2)] = 1; + qrframe[(y + 2) + width * (k + x + 1)] = 1; + qrframe[(y + 4) + width * (k + x)] = 1; + qrframe[(y + x + 1) + width * (k + 4)] = 1; + } + } + + // alignment blocks + if (version > 1) { + t = adelta[version]; + y = width - 7; + for (; ;) { + x = width - 7; + while (x > t - 3) { + putalign(x, y); + if (x < t) + break; + x -= t; + } + if (y <= t + 9) + break; + y -= t; + putalign(6, y); + putalign(y, 6); + } + } + + // single black + qrframe[8 + width * (width - 8)] = 1; + + // timing gap - mask only + for (y = 0; y < 7; y++) { + setmask(7, y); + setmask(width - 8, y); + setmask(7, y + width - 7); + } + for (x = 0; x < 8; x++) { + setmask(x, 7); + setmask(x + width - 8, 7); + setmask(x, width - 8); + } + + // reserve mask-format area + for (x = 0; x < 9; x++) + setmask(x, 8); + for (x = 0; x < 8; x++) { + setmask(x + width - 8, 8); + setmask(8, x); + } + for (y = 0; y < 7; y++) + setmask(8, y + width - 7); + + // timing row/col + for (x = 0; x < width - 14; x++) + if (x & 1) { + setmask(8 + x, 6); + setmask(6, 8 + x); + } + else { + qrframe[(8 + x) + width * 6] = 1; + qrframe[6 + width * (8 + x)] = 1; + } + + // version block + if (version > 6) { + t = vpat[version - 7]; + k = 17; + for (x = 0; x < 6; x++) + for (y = 0; y < 3; y++ , k--) + if (1 & (k > 11 ? version >> (k - 12) : t >> k)) { + qrframe[(5 - x) + width * (2 - y + width - 11)] = 1; + qrframe[(2 - y + width - 11) + width * (5 - x)] = 1; + } + else { + setmask(5 - x, 2 - y + width - 11); + setmask(2 - y + width - 11, 5 - x); + } + } + + // sync mask bits - only set above for white spaces, so add in black bits + for (y = 0; y < width; y++) + for (x = 0; x <= y; x++) + if (qrframe[x + width * y]) + setmask(x, y); + + // convert string to bitstream + // 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported) + v = strinbuf.length; + + // string to array + for (i = 0; i < v; i++) + eccbuf[i] = strinbuf.charCodeAt(i); + strinbuf = eccbuf.slice(0); + + // calculate max string length + x = datablkw * (neccblk1 + neccblk2) + neccblk2; + if (v >= x - 2) { + v = x - 2; + if (version > 9) + v--; + } + + // shift and repack to insert length prefix + i = v; + if (version > 9) { + strinbuf[i + 2] = 0; + strinbuf[i + 3] = 0; + while (i--) { + t = strinbuf[i]; + strinbuf[i + 3] |= 255 & (t << 4); + strinbuf[i + 2] = t >> 4; + } + strinbuf[2] |= 255 & (v << 4); + strinbuf[1] = v >> 4; + strinbuf[0] = 0x40 | (v >> 12); + } + else { + strinbuf[i + 1] = 0; + strinbuf[i + 2] = 0; + while (i--) { + t = strinbuf[i]; + strinbuf[i + 2] |= 255 & (t << 4); + strinbuf[i + 1] = t >> 4; + } + strinbuf[1] |= 255 & (v << 4); + strinbuf[0] = 0x40 | (v >> 4); + } + // fill to end with pad pattern + i = v + 3 - (version < 10); + while (i < x) { + strinbuf[i++] = 0xec; + // buffer has room if (i == x) break; + strinbuf[i++] = 0x11; + } + + // calculate and append ECC + + // calculate generator polynomial + genpoly[0] = 1; + for (i = 0; i < eccblkwid; i++) { + genpoly[i + 1] = 1; + for (j = i; j > 0; j--) + genpoly[j] = genpoly[j] + ? genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1]; + genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)]; + } + for (i = 0; i <= eccblkwid; i++) + genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step + + // append ecc to data buffer + k = x; + y = 0; + for (i = 0; i < neccblk1; i++) { + appendrs(y, datablkw, k, eccblkwid); + y += datablkw; + k += eccblkwid; + } + for (i = 0; i < neccblk2; i++) { + appendrs(y, datablkw + 1, k, eccblkwid); + y += datablkw + 1; + k += eccblkwid; + } + // interleave blocks + y = 0; + for (i = 0; i < datablkw; i++) { + for (j = 0; j < neccblk1; j++) + eccbuf[y++] = strinbuf[i + j * datablkw]; + for (j = 0; j < neccblk2; j++) + eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; + } + for (j = 0; j < neccblk2; j++) + eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; + for (i = 0; i < eccblkwid; i++) + for (j = 0; j < neccblk1 + neccblk2; j++) + eccbuf[y++] = strinbuf[x + i + j * eccblkwid]; + strinbuf = eccbuf; + + // pack bits into frame avoiding masked area. + x = y = width - 1; + k = v = 1; // up, minus + /* inteleaved data and ecc codes */ + m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; + for (i = 0; i < m; i++) { + t = strinbuf[i]; + for (j = 0; j < 8; j++ , t <<= 1) { + if (0x80 & t) + qrframe[x + width * y] = 1; + do { // find next fill position + if (v) + x--; + else { + x++; + if (k) { + if (y != 0) + y--; + else { + x -= 2; + k = !k; + if (x == 6) { + x--; + y = 9; + } + } + } + else { + if (y != width - 1) + y++; + else { + x -= 2; + k = !k; + if (x == 6) { + x--; + y -= 8; + } + } + } + } + v = !v; + } while (ismasked(x, y)); + } + } + + // save pre-mask copy of frame + strinbuf = qrframe.slice(0); + t = 0; // best + y = 30000; // demerit + // for instead of while since in original arduino code + // if an early mask was "good enough" it wouldn't try for a better one + // since they get more complex and take longer. + for (k = 0; k < 8; k++) { + applymask(k); // returns black-white imbalance + x = badcheck(); + if (x < y) { // current mask better than previous best? + y = x; + t = k; + } + if (t == 7) + break; // don't increment i to a void redoing mask + qrframe = strinbuf.slice(0); // reset for next pass + } + if (t != k) // redo best mask - none good enough, last wasn't t + applymask(t); + + // add in final mask/ecclevel bytes + y = fmtword[t + ((ecclevel - 1) << 3)]; + // low byte + for (k = 0; k < 8; k++ , y >>= 1) + if (y & 1) { + qrframe[(width - 1 - k) + width * 8] = 1; + if (k < 6) + qrframe[8 + width * k] = 1; + else + qrframe[8 + width * (k + 1)] = 1; + } + // high byte + for (k = 0; k < 7; k++ , y >>= 1) + if (y & 1) { + qrframe[8 + width * (width - 7 + k)] = 1; + if (k) + qrframe[(6 - k) + width * 8] = 1; + else + qrframe[7 + width * 8] = 1; + } + return qrframe; + } + + + + + var _canvas = null; + + var api = { + + get ecclevel() { + return ecclevel; + }, + + set ecclevel(val) { + ecclevel = val; + }, + + get size() { + return _size; + }, + + set size(val) { + _size = val + }, + + get canvas() { + return _canvas; + }, + + set canvas(el) { + _canvas = el; + }, + + getFrame: function (string) { + return genframe(string); + }, + //这里的utf16to8(str)是对Text中的字符串进行转码,让其支持中文 + utf16to8: function (str) { + var out, i, len, c; + + out = ""; + len = str.length; + for (i = 0; i < len; i++) { + c = str.charCodeAt(i); + if ((c >= 0x0001) && (c <= 0x007F)) { + out += str.charAt(i); + } else if (c > 0x07FF) { + out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); + out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); + out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); + } else { + out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); + out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); + } + } + return out; + }, + /** + * 新增$this参数,传入组件的this,兼容在组件中生成 + * @param bg 目前只能设置颜色值 + */ + draw: function (str, ctx, startX, startY, cavW, cavH, bg, color, $this, ecc) { + var that = this; + ecclevel = ecc || ecclevel; + if (!ctx) { + console.warn('No canvas provided to draw QR code in!') + return; + } + var size = Math.min(cavW, cavH); + str = that.utf16to8(str);//增加中文显示 + + var frame = that.getFrame(str); + var px = size / width; + if (bg) { + ctx.setFillStyle(bg) + ctx.fillRect(startX, startY, cavW, cavW); + } + ctx.setFillStyle(color || 'black'); + for (var i = 0; i < width; i++) { + for (var j = 0; j < width; j++) { + if (frame[j * width + i]) { + ctx.fillRect(startX + px * i, startY + px * j, px, px); + } + } + } + } + } + module.exports = { api } + // exports.draw = api; + +})(); \ No newline at end of file diff --git a/miniprogram/components/painter/lib/util.js b/miniprogram/components/painter/lib/util.js new file mode 100644 index 0000000..292df2a --- /dev/null +++ b/miniprogram/components/painter/lib/util.js @@ -0,0 +1,68 @@ + +function isValidUrl(url) { + return /(ht|f)tp(s?):\/\/([^ \\/]*\.)+[^ \\/]*(:[0-9]+)?\/?/.test(url); +} + +/** + * 深度对比两个对象是否一致 + * from: https://github.com/epoberezkin/fast-deep-equal + * @param {Object} a 对象a + * @param {Object} b 对象b + * @return {Boolean} 是否相同 + */ +/* eslint-disable */ +function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + var arrA = Array.isArray(a) + , arrB = Array.isArray(b) + , i + , length + , key; + + if (arrA && arrB) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + if (arrA != arrB) return false; + + var dateA = a instanceof Date + , dateB = b instanceof Date; + if (dateA != dateB) return false; + if (dateA && dateB) return a.getTime() == b.getTime(); + + var regexpA = a instanceof RegExp + , regexpB = b instanceof RegExp; + if (regexpA != regexpB) return false; + if (regexpA && regexpB) return a.toString() == b.toString(); + + var keys = Object.keys(a); + length = keys.length; + + if (length !== Object.keys(b).length) + return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + key = keys[i]; + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + return a!==a && b!==b; +} + +module.exports = { + isValidUrl, + equal +}; + diff --git a/miniprogram/components/painter/painter.js b/miniprogram/components/painter/painter.js new file mode 100644 index 0000000..d0fa6ee --- /dev/null +++ b/miniprogram/components/painter/painter.js @@ -0,0 +1,838 @@ +import Pen from './lib/pen'; +import Downloader from './lib/downloader'; + +const util = require('./lib/util'); + +const downloader = new Downloader(); + +// 最大尝试的绘制次数 +const MAX_PAINT_COUNT = 5; +const ACTION_DEFAULT_SIZE = 24; +const ACTION_OFFSET = '2rpx'; +Component({ + canvasWidthInPx: 0, + canvasHeightInPx: 0, + paintCount: 0, + currentPalette: {}, + movingCache: {}, + outterDisabled: false, + isDisabled: false, + needClear: false, + /** + * 组件的属性列表 + */ + properties: { + customStyle: { + type: String, + }, + // 运行自定义选择框和删除缩放按钮 + customActionStyle: { + type: Object, + }, + palette: { + type: Object, + observer: function (newVal, oldVal) { + if (this.isNeedRefresh(newVal, oldVal)) { + this.paintCount = 0; + this.startPaint(); + } + }, + }, + dancePalette: { + type: Object, + observer: function (newVal, oldVal) { + if (!this.isEmpty(newVal)) { + this.initDancePalette(newVal); + } + }, + }, + // 缩放比,会在传入的 palette 中统一乘以该缩放比 + scaleRatio: { + type: Number, + value: 1 + }, + widthPixels: { + type: Number, + value: 0 + }, + // 启用脏检查,默认 false + dirty: { + type: Boolean, + value: false, + }, + LRU: { + type: Boolean, + value: true, + }, + action: { + type: Object, + observer: function (newVal, oldVal) { + if (newVal && !this.isEmpty(newVal)) { + this.doAction(newVal, (callbackInfo) => { + this.movingCache = callbackInfo + }, false, true) + } + }, + }, + disableAction: { + type: Boolean, + observer: function (isDisabled) { + this.outterDisabled = isDisabled + this.isDisabled = isDisabled + } + }, + clearActionBox: { + type: Boolean, + observer: function (needClear) { + if (needClear && !this.needClear) { + if (this.frontContext) { + setTimeout(() => { + this.frontContext.draw(); + }, 100); + this.touchedView = {}; + this.prevFindedIndex = this.findedIndex + this.findedIndex = -1; + } + } + this.needClear = needClear + } + }, + }, + + data: { + picURL: '', + showCanvas: true, + painterStyle: '', + }, + + methods: { + + /** + * 判断一个 object 是否为 空 + * @param {object} object + */ + isEmpty(object) { + for (const i in object) { + return false; + } + return true; + }, + + isNeedRefresh(newVal, oldVal) { + if (!newVal || this.isEmpty(newVal) || (this.data.dirty && util.equal(newVal, oldVal))) { + return false; + } + return true; + }, + + getBox(rect, type) { + const boxArea = { + type: 'rect', + css: { + height: `${rect.bottom - rect.top}px`, + width: `${rect.right - rect.left}px`, + left: `${rect.left}px`, + top: `${rect.top}px`, + borderWidth: '4rpx', + borderColor: '#1A7AF8', + color: 'transparent' + } + } + if (type === 'text') { + boxArea.css = Object.assign({}, boxArea.css, { + borderStyle: 'dashed' + }) + } + if (this.properties.customActionStyle && this.properties.customActionStyle.border) { + boxArea.css = Object.assign({}, boxArea.css, this.properties.customActionStyle.border) + } + Object.assign(boxArea, { + id: 'box' + }) + return boxArea + }, + + getScaleIcon(rect, type) { + let scaleArea = {} + const { + customActionStyle + } = this.properties + if (customActionStyle && customActionStyle.scale) { + scaleArea = { + type: 'image', + url: type === 'text' ? customActionStyle.scale.textIcon : customActionStyle.scale.imageIcon, + css: { + height: `${2 * ACTION_DEFAULT_SIZE}rpx`, + width: `${2 * ACTION_DEFAULT_SIZE}rpx`, + borderRadius: `${ACTION_DEFAULT_SIZE}rpx`, + } + } + } else { + scaleArea = { + type: 'rect', + css: { + height: `${2 * ACTION_DEFAULT_SIZE}rpx`, + width: `${2 * ACTION_DEFAULT_SIZE}rpx`, + borderRadius: `${ACTION_DEFAULT_SIZE}rpx`, + color: '#0000ff', + } + } + } + scaleArea.css = Object.assign({}, scaleArea.css, { + align: 'center', + left: `${rect.right + ACTION_OFFSET.toPx()}px`, + top: type === 'text' ? `${rect.top - ACTION_OFFSET.toPx() - scaleArea.css.height.toPx() / 2}px` : `${rect.bottom - ACTION_OFFSET.toPx() - scaleArea.css.height.toPx() / 2}px` + }) + Object.assign(scaleArea, { + id: 'scale' + }) + return scaleArea + }, + + getDeleteIcon(rect) { + let deleteArea = {} + const { + customActionStyle + } = this.properties + if (customActionStyle && customActionStyle.scale) { + deleteArea = { + type: 'image', + url: customActionStyle.delete.icon, + css: { + height: `${2 * ACTION_DEFAULT_SIZE}rpx`, + width: `${2 * ACTION_DEFAULT_SIZE}rpx`, + borderRadius: `${ACTION_DEFAULT_SIZE}rpx`, + } + } + } else { + deleteArea = { + type: 'rect', + css: { + height: `${2 * ACTION_DEFAULT_SIZE}rpx`, + width: `${2 * ACTION_DEFAULT_SIZE}rpx`, + borderRadius: `${ACTION_DEFAULT_SIZE}rpx`, + color: '#0000ff', + } + } + } + deleteArea.css = Object.assign({}, deleteArea.css, { + align: 'center', + left: `${rect.left - ACTION_OFFSET.toPx()}px`, + top: `${rect.top - ACTION_OFFSET.toPx() - deleteArea.css.height.toPx() / 2}px` + }) + Object.assign(deleteArea, { + id: 'delete' + }) + return deleteArea + }, + + doAction(action, callback, isMoving, overwrite) { + let newVal = null + if (action) { + newVal = action.view + } + if (newVal && newVal.id && this.touchedView.id !== newVal.id) { + // 带 id 的动作给撤回时使用,不带 id,表示对当前选中对象进行操作 + const { + views + } = this.currentPalette; + for (let i = 0; i < views.length; i++) { + if (views[i].id === newVal.id) { + // 跨层回撤,需要重新构建三层关系 + this.touchedView = views[i]; + this.findedIndex = i; + this.sliceLayers(); + break + } + } + } + + const doView = this.touchedView + + if (!doView || this.isEmpty(doView)) { + return + } + if (newVal && newVal.css) { + if (overwrite) { + doView.css = newVal.css + } else if (Array.isArray(doView.css) && Array.isArray(newVal.css)) { + doView.css = Object.assign({}, ...doView.css, ...newVal.css) + } else if (Array.isArray(doView.css)) { + doView.css = Object.assign({}, ...doView.css, newVal.css) + } else if (Array.isArray(newVal.css)) { + doView.css = Object.assign({}, doView.css, ...newVal.css) + } else { + doView.css = Object.assign({}, doView.css, newVal.css) + } + } + if (newVal && newVal.rect) { + doView.rect = newVal.rect; + } + if (newVal && newVal.url && doView.url && newVal.url !== doView.url) { + downloader.download(newVal.url, this.properties.LRU).then((path) => { + if (newVal.url.startsWith('https')) { + doView.originUrl = newVal.url + } + doView.url = path; + wx.getImageInfo({ + src: path, + success: (res) => { + doView.sHeight = res.height + doView.sWidth = res.width + this.reDraw(doView, callback, isMoving) + }, + fail: () => { + this.reDraw(doView, callback, isMoving) + } + }) + }).catch((error) => { + // 未下载成功,直接绘制 + console.error(error) + this.reDraw(doView, callback, isMoving) + }) + } else { + (newVal && newVal.text && doView.text && newVal.text !== doView.text) && (doView.text = newVal.text); + (newVal && newVal.content && doView.content && newVal.content !== doView.content) && (doView.content = newVal.content); + this.reDraw(doView, callback, isMoving) + } + }, + + reDraw(doView, callback, isMoving) { + const draw = { + width: this.currentPalette.width, + height: this.currentPalette.height, + views: this.isEmpty(doView) ? [] : [doView] + } + const pen = new Pen(this.globalContext, draw); + + if (isMoving && doView.type === 'text') { + pen.paint((callbackInfo) => { + callback && callback(callbackInfo); + this.triggerEvent('viewUpdate', { + view: this.touchedView + }); + }, true, this.movingCache); + } else { + // 某些机型(华为 P20)非移动和缩放场景下,只绘制一遍会偶然性图片绘制失败 + if (!isMoving && !this.isScale) { + pen.paint() + } + pen.paint((callbackInfo) => { + callback && callback(callbackInfo); + this.triggerEvent('viewUpdate', { + view: this.touchedView + }); + }) + } + + const { + rect, + css, + type + } = doView + + this.block = { + width: this.currentPalette.width, + height: this.currentPalette.height, + views: this.isEmpty(doView) ? [] : [this.getBox(rect, doView.type)] + } + if (css && css.scalable) { + this.block.views.push(this.getScaleIcon(rect, type)) + } + if (css && css.deletable) { + this.block.views.push(this.getDeleteIcon(rect)) + } + const topBlock = new Pen(this.frontContext, this.block) + topBlock.paint(); + }, + + isInView(x, y, rect) { + return (x > rect.left && + y > rect.top && + x < rect.right && + y < rect.bottom + ) + }, + + isInDelete(x, y) { + for (const view of this.block.views) { + if (view.id === 'delete') { + return (x > view.rect.left && + y > view.rect.top && + x < view.rect.right && + y < view.rect.bottom) + } + } + return false + }, + + isInScale(x, y) { + for (const view of this.block.views) { + if (view.id === 'scale') { + return (x > view.rect.left && + y > view.rect.top && + x < view.rect.right && + y < view.rect.bottom) + } + } + return false + }, + + touchedView: {}, + findedIndex: -1, + onClick() { + const x = this.startX + const y = this.startY + const totalLayerCount = this.currentPalette.views.length + let canBeTouched = [] + let isDelete = false + let deleteIndex = -1 + for (let i = totalLayerCount - 1; i >= 0; i--) { + const view = this.currentPalette.views[i] + const { + rect + } = view + if (this.touchedView && this.touchedView.id && this.touchedView.id === view.id && this.isInDelete(x, y, rect)) { + canBeTouched.length = 0 + deleteIndex = i + isDelete = true + break + } + if (this.isInView(x, y, rect)) { + canBeTouched.push({ + view, + index: i + }) + } + } + this.touchedView = {} + if (canBeTouched.length === 0) { + this.findedIndex = -1 + } else { + let i = 0 + const touchAble = canBeTouched.filter(item => Boolean(item.view.id)) + if (touchAble.length === 0) { + this.findedIndex = canBeTouched[0].index + } else { + for (i = 0; i < touchAble.length; i++) { + if (this.findedIndex === touchAble[i].index) { + i++ + break + } + } + if (i === touchAble.length) { + i = 0 + } + this.touchedView = touchAble[i].view + this.findedIndex = touchAble[i].index + this.triggerEvent('viewClicked', { + view: this.touchedView + }) + } + } + if (this.findedIndex < 0 || (this.touchedView && !this.touchedView.id)) { + // 证明点击了背景 或无法移动的view + this.frontContext.draw(); + if (isDelete) { + this.triggerEvent('touchEnd', { + view: this.currentPalette.views[deleteIndex], + index: deleteIndex, + type: 'delete' + }) + this.doAction() + } else if (this.findedIndex < 0) { + this.triggerEvent('viewClicked', {}) + } + this.findedIndex = -1 + this.prevFindedIndex = -1 + } else if (this.touchedView && this.touchedView.id) { + this.sliceLayers(); + } + }, + + sliceLayers() { + const bottomLayers = this.currentPalette.views.slice(0, this.findedIndex) + const topLayers = this.currentPalette.views.slice(this.findedIndex + 1) + const bottomDraw = { + width: this.currentPalette.width, + height: this.currentPalette.height, + background: this.currentPalette.background, + views: bottomLayers + } + const topDraw = { + width: this.currentPalette.width, + height: this.currentPalette.height, + views: topLayers + } + if (this.prevFindedIndex < this.findedIndex) { + new Pen(this.bottomContext, bottomDraw).paint(); + this.doAction(null, (callbackInfo) => { + this.movingCache = callbackInfo + }) + new Pen(this.topContext, topDraw).paint(); + } else { + new Pen(this.topContext, topDraw).paint(); + this.doAction(null, (callbackInfo) => { + this.movingCache = callbackInfo + }) + new Pen(this.bottomContext, bottomDraw).paint(); + } + this.prevFindedIndex = this.findedIndex + }, + + startX: 0, + startY: 0, + startH: 0, + startW: 0, + isScale: false, + startTimeStamp: 0, + onTouchStart(event) { + if (this.isDisabled) { + return + } + const { + x, + y + } = event.touches[0] + this.startX = x + this.startY = y + this.startTimeStamp = new Date().getTime() + if (this.touchedView && !this.isEmpty(this.touchedView)) { + const { + rect + } = this.touchedView + if (this.isInScale(x, y, rect)) { + this.isScale = true + this.movingCache = {} + this.startH = rect.bottom - rect.top + this.startW = rect.right - rect.left + } else { + this.isScale = false + } + } else { + this.isScale = false + } + }, + + onTouchEnd(e) { + if (this.isDisabled) { + return + } + const current = new Date().getTime() + if ((current - this.startTimeStamp) <= 500 && !this.hasMove) { + !this.isScale && this.onClick(e) + } else if (this.touchedView && !this.isEmpty(this.touchedView)) { + this.triggerEvent('touchEnd', { + view: this.touchedView, + }) + } + this.hasMove = false + }, + + onTouchCancel(e) { + if (this.isDisabled) { + return + } + this.onTouchEnd(e) + }, + + hasMove: false, + onTouchMove(event) { + if (this.isDisabled) { + return + } + this.hasMove = true + if (!this.touchedView || (this.touchedView && !this.touchedView.id)) { + return + } + const { + x, + y + } = event.touches[0] + const offsetX = x - this.startX + const offsetY = y - this.startY + const { + rect, + type + } = this.touchedView + let css = {} + if (this.isScale) { + const newW = this.startW + offsetX > 1 ? this.startW + offsetX : 1 + if (this.touchedView.css && this.touchedView.css.minWidth) { + if (newW < this.touchedView.css.minWidth.toPx()) { + return + } + } + if (this.touchedView.rect && this.touchedView.rect.minWidth) { + if (newW < this.touchedView.rect.minWidth) { + return + } + } + const newH = this.startH + offsetY > 1 ? this.startH + offsetY : 1 + css = { + width: `${newW}px`, + } + if (type !== 'text') { + if (type === 'image') { + css.height = `${(newW) * this.startH / this.startW }px` + } else { + css.height = `${newH}px` + } + } + } else { + this.startX = x + this.startY = y + css = { + left: `${rect.x + offsetX}px`, + top: `${rect.y + offsetY}px`, + right: undefined, + bottom: undefined + } + } + this.doAction({ + view: { + css + } + }, (callbackInfo) => { + if (this.isScale) { + this.movingCache = callbackInfo + } + }, !this.isScale) + }, + + initScreenK() { + if (!(getApp() && getApp().systemInfo && getApp().systemInfo.screenWidth)) { + try { + getApp().systemInfo = wx.getSystemInfoSync(); + } catch (e) { + console.error(`Painter get system info failed, ${JSON.stringify(e)}`); + return; + } + } + this.screenK = 0.5; + if (getApp() && getApp().systemInfo && getApp().systemInfo.screenWidth) { + this.screenK = getApp().systemInfo.screenWidth / 750; + } + setStringPrototype(this.screenK, this.properties.scaleRatio); + }, + + initDancePalette() { + this.isDisabled = true; + this.initScreenK(); + this.downloadImages(this.properties.dancePalette).then((palette) => { + this.currentPalette = palette + const { + width, + height + } = palette; + + if (!width || !height) { + console.error(`You should set width and height correctly for painter, width: ${width}, height: ${height}`); + return; + } + this.setData({ + painterStyle: `width:${width.toPx()}px;height:${height.toPx()}px;`, + }); + this.frontContext || (this.frontContext = wx.createCanvasContext('front', this)); + this.bottomContext || (this.bottomContext = wx.createCanvasContext('bottom', this)); + this.topContext || (this.topContext = wx.createCanvasContext('top', this)); + this.globalContext || (this.globalContext = wx.createCanvasContext('k-canvas', this)); + new Pen(this.bottomContext, palette).paint(() => { + this.isDisabled = false; + this.isDisabled = this.outterDisabled; + this.triggerEvent('didShow'); + }); + this.globalContext.draw(); + this.frontContext.draw(); + this.topContext.draw(); + }); + this.touchedView = {}; + }, + + startPaint() { + this.initScreenK(); + + this.downloadImages(this.properties.palette).then((palette) => { + const { + width, + height + } = palette; + + if (!width || !height) { + console.error(`You should set width and height correctly for painter, width: ${width}, height: ${height}`); + return; + } + + // 生成图片时,根据设置的像素值重新绘制 + this.canvasWidthInPx = width.toPx(); + if (this.properties.widthPixels) { + setStringPrototype(this.screenK, this.properties.widthPixels / this.canvasWidthInPx) + this.canvasWidthInPx = this.properties.widthPixels + } + + this.canvasHeightInPx = height.toPx(); + this.setData({ + photoStyle: `width:${this.canvasWidthInPx}px;height:${this.canvasHeightInPx}px;`, + }); + this.photoContext || (this.photoContext = wx.createCanvasContext('photo', this)); + + new Pen(this.photoContext, palette).paint(() => { + this.saveImgToLocal(); + }); + setStringPrototype(this.screenK, this.properties.scaleRatio); + }); + }, + + downloadImages(palette) { + return new Promise((resolve, reject) => { + let preCount = 0; + let completeCount = 0; + const paletteCopy = JSON.parse(JSON.stringify(palette)); + if (paletteCopy.background) { + preCount++; + downloader.download(paletteCopy.background, this.properties.LRU).then((path) => { + paletteCopy.background = path; + completeCount++; + if (preCount === completeCount) { + resolve(paletteCopy); + } + }, () => { + completeCount++; + if (preCount === completeCount) { + resolve(paletteCopy); + } + }); + } + if (paletteCopy.views) { + for (const view of paletteCopy.views) { + if (view && view.type === 'image' && view.url) { + preCount++; + /* eslint-disable no-loop-func */ + downloader.download(view.url, this.properties.LRU).then((path) => { + view.originUrl = view.url; + view.url = path; + wx.getImageInfo({ + src: path, + success: (res) => { + // 获得一下图片信息,供后续裁减使用 + view.sWidth = res.width; + view.sHeight = res.height; + }, + fail: (error) => { + // 如果图片坏了,则直接置空,防止坑爹的 canvas 画崩溃了 + view.url = ""; + console.error(`getImageInfo ${view.url} failed, ${JSON.stringify(error)}`); + }, + complete: () => { + completeCount++; + if (preCount === completeCount) { + resolve(paletteCopy); + } + }, + }); + }, () => { + completeCount++; + if (preCount === completeCount) { + resolve(paletteCopy); + } + }); + } + } + } + if (preCount === 0) { + resolve(paletteCopy); + } + }); + }, + + saveImgToLocal() { + const that = this; + setTimeout(() => { + wx.canvasToTempFilePath({ + canvasId: 'photo', + destWidth: that.canvasWidthInPx, + destHeight: that.canvasHeightInPx, + success: function (res) { + that.getImageInfo(res.tempFilePath); + }, + fail: function (error) { + console.error(`canvasToTempFilePath failed, ${JSON.stringify(error)}`); + that.triggerEvent('imgErr', { + error: error + }); + }, + }, this); + }, 300); + }, + + getImageInfo(filePath) { + const that = this; + wx.getImageInfo({ + src: filePath, + success: (infoRes) => { + if (that.paintCount > MAX_PAINT_COUNT) { + const error = `The result is always fault, even we tried ${MAX_PAINT_COUNT} times`; + console.error(error); + that.triggerEvent('imgErr', { + error: error + }); + return; + } + // 比例相符时才证明绘制成功,否则进行强制重绘制 + if (Math.abs((infoRes.width * that.canvasHeightInPx - that.canvasWidthInPx * infoRes.height) / (infoRes.height * that.canvasHeightInPx)) < 0.01) { + that.triggerEvent('imgOK', { + path: filePath + }); + } else { + that.startPaint(); + } + that.paintCount++; + }, + fail: (error) => { + console.error(`getImageInfo failed, ${JSON.stringify(error)}`); + that.triggerEvent('imgErr', { + error: error + }); + }, + }); + }, + }, +}); + + +function setStringPrototype(screenK, scale) { + /* eslint-disable no-extend-native */ + /** + * 是否支持负数 + * @param {Boolean} minus 是否支持负数 + * @param {Number} baseSize 当设置了 % 号时,设置的基准值 + */ + String.prototype.toPx = function toPx(minus, baseSize) { + if (this === '0') { + return 0 + } + let reg; + if (minus) { + reg = /^-?[0-9]+([.]{1}[0-9]+){0,1}(rpx|px|%)$/g; + } else { + reg = /^[0-9]+([.]{1}[0-9]+){0,1}(rpx|px|%)$/g; + } + const results = reg.exec(this); + if (!this || !results) { + console.error(`The size: ${this} is illegal`); + return 0; + } + const unit = results[2]; + const value = parseFloat(this); + + let res = 0; + if (unit === 'rpx') { + res = Math.round(value * (screenK || 0.5) * (scale || 1)); + } else if (unit === 'px') { + res = Math.round(value * (scale || 1)); + } else if (unit === '%') { + res = Math.round(value * baseSize / 100); + } + return res; + }; +} \ No newline at end of file diff --git a/miniprogram/components/painter/painter.json b/miniprogram/components/painter/painter.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/painter/painter.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/painter/painter.wxml b/miniprogram/components/painter/painter.wxml new file mode 100644 index 0000000..c2f85fd --- /dev/null +++ b/miniprogram/components/painter/painter.wxml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/miniprogram/components/rating/img/star-o.png b/miniprogram/components/rating/img/star-o.png new file mode 100644 index 0000000..908277a Binary files /dev/null and b/miniprogram/components/rating/img/star-o.png differ diff --git a/miniprogram/components/rating/img/star.png b/miniprogram/components/rating/img/star.png new file mode 100644 index 0000000..873d049 Binary files /dev/null and b/miniprogram/components/rating/img/star.png differ diff --git a/miniprogram/components/rating/rating.json b/miniprogram/components/rating/rating.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/rating/rating.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/rating/rating.scss b/miniprogram/components/rating/rating.scss new file mode 100644 index 0000000..03048a0 --- /dev/null +++ b/miniprogram/components/rating/rating.scss @@ -0,0 +1,25 @@ +.stars { + display: flex; + width: var(--width--); + height: var(--height--); + /* width: 100%; + height: 100px; */ +} + +.stars view { + position: relative; + width: var(--width--); + height: var(--height--); + margin-right: 20rpx; +} + +.stars view image:nth-of-type(1) { + width: 50%; + height: 100%; + margin-right: -2rpx; +} +.stars view image:nth-of-type(2) { + width: 50%; + height: 100%; + margin-left: -1rpx; +} \ No newline at end of file diff --git a/miniprogram/components/rating/rating.ts b/miniprogram/components/rating/rating.ts new file mode 100644 index 0000000..37d652e --- /dev/null +++ b/miniprogram/components/rating/rating.ts @@ -0,0 +1,225 @@ +// components/star.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + //接收自定义的高度 + setSize: Number, + }, + + data: { + stars: [ + { + flag1: 2, + flag2: 2, + bgImgL: "/assets/images/searchResult/Lstar.png", + bgfImgL: "/assets/images/searchResult/Lstar.active.png", + bgImgR: "/assets/images/searchResult/Rstar.png", + bgfImgR: "/assets/images/searchResult/Rstar.active.png", + }, + { + flag1: 1, + flag2: 1, + bgImgL: "/assets/images/searchResult/Lstar.png", + bgfImgL: "/assets/images/searchResult/Lstar.active.png", + bgImgR: "/assets/images/searchResult/Rstar.png", + bgfImgR: "/assets/images/searchResult/Rstar.active.png", + }, + { + flag1: 1, + flag2: 1, + bgImgL: "/assets/images/searchResult/Lstar.png", + bgfImgL: "/assets/images/searchResult/Lstar.active.png", + bgImgR: "/assets/images/searchResult/Rstar.png", + bgfImgR: "/assets/images/searchResult/Rstar.active.png", + }, + { + flag1: 1, + flag2: 1, + bgImgL: "/assets/images/searchResult/Lstar.png", + bgfImgL: "/assets/images/searchResult/Lstar.active.png", + bgImgR: "/assets/images/searchResult/Rstar.png", + bgfImgR: "/assets/images/searchResult/Rstar.active.png", + }, + { + flag1: 1, + flag2: 1, + bgImgL: "/assets/images/searchResult/Lstar.png", + bgfImgL: "/assets/images/searchResult/Lstar.active.png", + bgImgR: "/assets/images/searchResult/Rstar.png", + bgfImgR: "/assets/images/searchResult/Rstar.active.png", + }, + + ], + star_num: 1, // 默认1分 最低0.5分 + Lindex: 0, //左下标 + Rindex: 0, //右下标 + oldScore: '', //旧分数 + newScore: ''//新分数 + }, + + /** + * 组件的方法列表 + */ + methods: { + //点击左边 + scoreL: function (e) { + var _this = this; + this.setData({ + oldScore: this.data.star_num + }) + // console.log("旧分数",this.data.oldScore) + var index = e.currentTarget.dataset.index; + //改变分数 + _this.setData({ + star_num: index + 0.5 // 评分 + }) + this.setData({ + newScore: this.data.star_num + }) + // console.log("新分数",this.data.newScore) + this.judgeNum() //重新渲染星星 + }, + //点击右边 + scoreR: function (e) { + this.setData({ + oldScore: this.data.star_num + }) + var _this = this; + var index = e.currentTarget.dataset.index; + // 评分 + _this.setData({ + star_num: index + 1 // 评分 + }) + this.setData({ + newScore: this.data.star_num + }) + this.judgeNum() + }, + changeL(param) { //左移 1代表减 2代表加 + var that = this; + // console.log("LL左下标",that.data.Lindex) + // console.log("LL右下标",that.data.Rindex) + var item = 'stars[' + that.data.Lindex + '].flag1' + if (param === 1) { //左移动 + // console.log("锚点1") + const middle = that.data.Lindex + var item = 'stars[' + middle + '].flag1' + that.setData({ + [item]: 1, + Lindex: that.data.Lindex - 1 + }) + } + if (param === 2) { + // console.log("锚点2") + const middle = that.data.Lindex + 1 + var item = 'stars[' + middle + '].flag1' + that.setData({ + [item]: 2, + Lindex: that.data.Lindex + 1 + }) + } + }, + changeR(param) { //右移 1代表减 2代表加 + const that = this + var item = 'stars[' + that.data.Lindex + '].flag2' + if (param === 1) { //左移动 + // console.log("锚点3") + that.setData({ + [item]: 1, + Rindex: this.data.Rindex - 1 + }) + } + if (param === 2) { + // console.log("锚点4") + const middle = that.data.Rindex + 1 + var item = 'stars[' + middle + '].flag2' + that.setData({ + [item]: 2, + Rindex: this.data.Rindex + 1 + }) + } + }, + judgeNum: function () { + const isPoint = (this.data.oldScore) % 1 == 0 ? false : true + const flag = this.data.newScore - this.data.oldScore //分差 + if (flag < 0) {//分差小于0 扣分 + if (isPoint) { //是小数(左) + const LorR = { + toL: true, + toR: false, + } + const count = Math.abs(flag) * 2 //变化的次数 LRLR + for (var i = 0; i < count; i++) { + if (LorR.toL) { + this.changeL(1) + } + if (LorR.toR) { + this.changeR(1) + } + LorR.toL = !LorR.toL + LorR.toR = !LorR.toR + } + }//是整数(右) + else { + const LorR = { + toL: false, + toR: true, + } + const count = Math.abs(flag) * 2 //变化的次数 LRLR + for (var i = 0; i < count; i++) { + if (LorR.toL) { + this.changeL(1) + } + if (LorR.toR) { + this.changeR(1) + } + LorR.toL = !LorR.toL + LorR.toR = !LorR.toR + } + } + } //分差大于0 加分 + else { + if (isPoint) {//是小数 + const LorR = { + toL: false, + toR: true, + } + const count = Math.abs(flag) * 2 //变化的次数 LRLR + for (var i = 0; i < count; i++) { + if (LorR.toL) { + this.changeL(2) + } + if (LorR.toR) { + this.changeR(2) + } + LorR.toL = !LorR.toL + LorR.toR = !LorR.toR + } + } + else { //是整数 + const LorR = { + toL: true, + toR: false, + } + const count = Math.abs(flag) * 2 //变化的次数 LRLR + for (var i = 0; i < count; i++) { + if (LorR.toL) { + this.changeL(2) + } + if (LorR.toR) { + this.changeR(2) + } + LorR.toL = !LorR.toL + LorR.toR = !LorR.toR + } + } + } + }, + setNum() { //向父组件传值 + //传入的参数名称 starNum + this.triggerEvent('myevent', { starNum: this.data.star_num }) + } + } +}) \ No newline at end of file diff --git a/miniprogram/components/rating/rating.wxml b/miniprogram/components/rating/rating.wxml new file mode 100644 index 0000000..9af003c --- /dev/null +++ b/miniprogram/components/rating/rating.wxml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/miniprogram/components/redDot/redDot.json b/miniprogram/components/redDot/redDot.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/redDot/redDot.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/redDot/redDot.scss b/miniprogram/components/redDot/redDot.scss new file mode 100644 index 0000000..3f3a033 --- /dev/null +++ b/miniprogram/components/redDot/redDot.scss @@ -0,0 +1,10 @@ +/* components/redDot/redDot.wxss */ +.redDot { + width: 10rpx; + height: 10rpx; + display: inline-block; + border-radius: 50%; + background: red; + position: absolute; + top: 0px; +} \ No newline at end of file diff --git a/miniprogram/components/redDot/redDot.ts b/miniprogram/components/redDot/redDot.ts new file mode 100644 index 0000000..c309dc3 --- /dev/null +++ b/miniprogram/components/redDot/redDot.ts @@ -0,0 +1,34 @@ +// components/redDot/redDot.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + redDotMark: { + type: Boolean, + value: false + }, + // method: { + // type: String, + // value: 'value' + // }, + // redDotMakStr: { + // type: String, + // value: '' + // } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/components/redDot/redDot.wxml b/miniprogram/components/redDot/redDot.wxml new file mode 100644 index 0000000..1ed5e80 --- /dev/null +++ b/miniprogram/components/redDot/redDot.wxml @@ -0,0 +1,3 @@ + + + diff --git a/miniprogram/components/shadow/shadow.json b/miniprogram/components/shadow/shadow.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/shadow/shadow.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/shadow/shadow.scss b/miniprogram/components/shadow/shadow.scss new file mode 100644 index 0000000..b78ef26 --- /dev/null +++ b/miniprogram/components/shadow/shadow.scss @@ -0,0 +1,25 @@ +/* components/shadow/shadow.wxss */ +.shadow-cmp{ + position: fixed; + z-index: 150; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba($color: #000000, $alpha: 0.35); + // background: rgba($color: #000000, $alpha: 0.85); + display: flex; + justify-content: center; +} + +.center{ + align-items: center; +} + +.top{ + align-items: flex-start; +} + +.bottom{ + align-items: flex-end; +} \ No newline at end of file diff --git a/miniprogram/components/shadow/shadow.ts b/miniprogram/components/shadow/shadow.ts new file mode 100644 index 0000000..89bffec --- /dev/null +++ b/miniprogram/components/shadow/shadow.ts @@ -0,0 +1,26 @@ +// components/shadow/shadow.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + position: { + type: String, + value: 'center' + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/components/shadow/shadow.wxml b/miniprogram/components/shadow/shadow.wxml new file mode 100644 index 0000000..20a0b33 --- /dev/null +++ b/miniprogram/components/shadow/shadow.wxml @@ -0,0 +1,4 @@ + + + + diff --git a/miniprogram/components/sourceLabel/sourceLabel.json b/miniprogram/components/sourceLabel/sourceLabel.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/sourceLabel/sourceLabel.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/sourceLabel/sourceLabel.scss b/miniprogram/components/sourceLabel/sourceLabel.scss new file mode 100644 index 0000000..7ace38d --- /dev/null +++ b/miniprogram/components/sourceLabel/sourceLabel.scss @@ -0,0 +1,16 @@ +/* components/source/source.wxss */ +.source { + font-size: 20rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + display: flex; + align-items: center; + margin-left: 9rpx; + + .icon_source { + width: 20rpx; + height: 20rpx; + margin-right: 11rpx; + } +} \ No newline at end of file diff --git a/miniprogram/components/sourceLabel/sourceLabel.ts b/miniprogram/components/sourceLabel/sourceLabel.ts new file mode 100644 index 0000000..0f7badc --- /dev/null +++ b/miniprogram/components/sourceLabel/sourceLabel.ts @@ -0,0 +1,26 @@ +// components/source/source.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + data: { + type: Object, + value: undefined + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/components/sourceLabel/sourceLabel.wxml b/miniprogram/components/sourceLabel/sourceLabel.wxml new file mode 100644 index 0000000..aa90aa9 --- /dev/null +++ b/miniprogram/components/sourceLabel/sourceLabel.wxml @@ -0,0 +1,12 @@ + + + + + + 来源于{{ + data.dataSourceType==='CONSUMER' + ? + (data.modifiable===false?'实名认证':data.dataSourceName + (data.dataSourceType==='CONSUMER'?'自填':'添加')) + : + data.dataSourceName + (data.dataSourceType==='CONSUMER'?'自填':'添加')}} + \ No newline at end of file diff --git a/miniprogram/components/star/star.json b/miniprogram/components/star/star.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/star/star.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/star/star.scss b/miniprogram/components/star/star.scss new file mode 100644 index 0000000..89eb2fa --- /dev/null +++ b/miniprogram/components/star/star.scss @@ -0,0 +1,46 @@ +/* components/star/star.wxss */ +.starList { + display: flex; + justify-content: center; + + .starItem { + margin-right: 38rpx; + + &:last-child { + margin-right: 0; + } + + image { + width: 40rpx; + height: 40rpx; + } + + // .cStars { + // width: 30rpx; + // height: 30rpx; + // } + + // .stars { + // width: 40rpx; + // height: 40rpx; + // } + } + + .cStars { + margin-right: 49rpx; + + image { + width: 58rpx; + height: 58rpx; + } + } + + .rStars { + margin-right: 20rpx; + + image { + width: 30rpx; + height: 30rpx; + } + } +} \ No newline at end of file diff --git a/miniprogram/components/star/star.ts b/miniprogram/components/star/star.ts new file mode 100644 index 0000000..5ba201b --- /dev/null +++ b/miniprogram/components/star/star.ts @@ -0,0 +1,144 @@ +// components/star/star.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + score: { + type: Number, + value: 5 + }, + starKey: { + type: String, + }, + starType: { + type: String, + value: "stars" + }, + size:{ + type:String, + // value:"" + } + }, + + /** + * 组件的初始数据 + */ + data: { + stars: [ + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + } + ], + starsList: { + stars: [ + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + }, + { + bgImg: "/assets/images/searchResult/star_0.png", + bgImg_half: "/assets/images/searchResult/star_0.5.png", + bgImg_all: "/assets/images/searchResult/star_1.png" + } + ], + cStars: [ + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + } + ], + rStars: [ + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + }, + { + bgImg: "/assets/images/searchResult/cStar.png", + bgImg_all: "/assets/images/searchResult/cStar_active.png" + } + ], + } + }, + + /** + * 组件的方法列表 + */ + methods: { + handleClick(e) { + console.log(e); + // if (e.currentTarget.dataset.score === 1) { + // this.triggerEvent('setScore', { score: 0 }) + // }else{ + this.triggerEvent('setScore', { score: e.currentTarget.dataset.score }) + // } + + } + } +}) diff --git a/miniprogram/components/star/star.wxml b/miniprogram/components/star/star.wxml new file mode 100644 index 0000000..ca37a0f --- /dev/null +++ b/miniprogram/components/star/star.wxml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/miniprogram/components/tagList/tagList.json b/miniprogram/components/tagList/tagList.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/tagList/tagList.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/tagList/tagList.scss b/miniprogram/components/tagList/tagList.scss new file mode 100644 index 0000000..2a26e62 --- /dev/null +++ b/miniprogram/components/tagList/tagList.scss @@ -0,0 +1,100 @@ +/* components/tagList/tagList.wxss */ +.top { + display: flex; + justify-content: space-between; + + + .title { + font-size: 30rpx; + font-family: PingFang SC; + font-weight: bold; + color: #4F536B; + margin-bottom: 20rpx; + } + + .operation { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #6571D9; + display: flex; + align-items: center; + justify-content: center; + } + + .icon_arrow_right { + width: 7rpx; + height: 13rpx; + margin-left: 10rpx; + } + +} +.noTag { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C5C5C5; + text-align: center; +} +.tagList { + margin: 0 20rpx 0 0; + display: flex; + flex-wrap: wrap; + + + .tagItem { + background: #EEF0FC; + width: 163rpx; + height: 60rpx; + border-radius: 30rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #7986FF; + position: relative; + margin-right: 50rpx; + margin-bottom: 20rpx; + + &:nth-child(3n) { + margin-right: 0; + } + + .numTag { + font-size: 20rpx; + font-family: Alibaba PuHuiTi; + font-weight: 800; + font-style: italic; + color: #FFFFFF; + background: #C1C1C1; + border-radius: 14rpx 14rpx 14rpx 5rpx; + width: 51rpx; + height: 27rpx; + display: flex; + align-items: center; + justify-content: center; + position: absolute; + right: -40rpx; + top: 0; + } + + &:first-child { + .numTag { + background: #FF662A; + } + } + } +} + +.filter_blur { + filter: blur(3px); +} + +.count { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #9F9F9F; +} \ No newline at end of file diff --git a/miniprogram/components/tagList/tagList.ts b/miniprogram/components/tagList/tagList.ts new file mode 100644 index 0000000..ed9a57a --- /dev/null +++ b/miniprogram/components/tagList/tagList.ts @@ -0,0 +1,34 @@ +// components/tagList/tagList.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + consumer: { + type: Object, + // value:[] + }, + isSelf: { + type: Boolean, + value: false + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + handleTagList() { + console.log('handleTagList'); + + this.triggerEvent('showTagList') + } + } +}) diff --git a/miniprogram/components/tagList/tagList.wxml b/miniprogram/components/tagList/tagList.wxml new file mode 100644 index 0000000..7cdca1f --- /dev/null +++ b/miniprogram/components/tagList/tagList.wxml @@ -0,0 +1,41 @@ + + + + 印象标签 + 查看所有印象标签 + + + + + + + + {{item.content}} + {{item.content}} + + x{{item.contentCount}} + + + + 暂未收到任何印象标签 + + + + 共收到{{consumer.labelCount}}条印象标签,其中“{{consumer.labelVoList[0].content}}”获得了{{consumer.labelVoList[0].contentCount}}次点击 + \ No newline at end of file diff --git a/miniprogram/components/uploadImages/uploadImages.json b/miniprogram/components/uploadImages/uploadImages.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/components/uploadImages/uploadImages.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/uploadImages/uploadImages.scss b/miniprogram/components/uploadImages/uploadImages.scss new file mode 100644 index 0000000..cd2084b --- /dev/null +++ b/miniprogram/components/uploadImages/uploadImages.scss @@ -0,0 +1,26 @@ +/* components/uploadImages/uploadImages.wxss */ +.uploadImg { + .text { + color: #C3C3C3; + font-size: 28rpx; + + .icon_file { + width: 28rpx; + height: 25rpx; + margin-left: 14rpx; + } + } + + .icon { + color: #3A61B1; + font-size: 24rpx; + display: flex; + align-items: center; + .icon_add { + width: 29rpx; + height: 29rpx; + margin-right: 14rpx; + } + } + +} \ No newline at end of file diff --git a/miniprogram/components/uploadImages/uploadImages.ts b/miniprogram/components/uploadImages/uploadImages.ts new file mode 100644 index 0000000..7ac5b78 --- /dev/null +++ b/miniprogram/components/uploadImages/uploadImages.ts @@ -0,0 +1,150 @@ +import { uploadImg } from "../../apis/upload"; +Component({ + /** + * 组件的属性列表 + */ + properties: { + isText: { + type: Boolean, + value: false + } + // count: { //最多选择图片的张数,默认9张 + // type: Number, + // value: 9 + // }, + // uploadUrl: { //图片上传的服务器路径 + // type: String, + // value: '' + // }, + // showUrl: { //图片的拼接路径 + // type: String, + // value: '' + // } + }, + + /** + * 组件的初始数据 + */ + data: { + detailPics: [], //上传的结果图片集合 + }, + + ready: function () { + // console.log(this.data) + }, + + /** + * 组件的方法列表 + */ + methods: { + + uploadDetailImage: function (e) { //这里是选取图片的方法 + this.setData({ + detailPics: [] + }) + var that = this; + var pics = []; + var detailPics = that.data.detailPics; + if (detailPics.length >= that.data.count) { + wx.showToast({ + title: '最多选择' + that.data.count + '张!', + }) + return; + } + wx.chooseMedia({ + count: 9,//that.data.count, // 最多可以选择的图片张数,默认9 + sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 + sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 + success: function (res) { + console.log(res); + + var imgs = res.tempFiles; + for (var i = 0; i < imgs.length; i++) { + pics.push(imgs[i]) + } + console.log(imgs); + + that.uploadimg({ + url: 'https://www.chrivc.com/api/consumer/commonLogin/upload', //这里是你图片上传的接口 + // url:'http://office.xianci.info:18085/consumer/commonLogin/upload', + path: pics, //这里是选取的图片的地址数组 + }); + }, + }) + + }, + //多张图片上传 + uploadimg: function (data) { + console.log(data); + + wx.showLoading({ + title: '上传中...', + mask: true, + }) + var that = this, + i = data.i ? data.i : 0, + success = data.success ? data.success : 0, + fail = data.fail ? data.fail : 0; + console.log(wx.getStorageSync("Authorization")); + + wx.uploadFile({ + url: data.url, + filePath: data.path[i].tempFilePath, + header: { + "Content-Type": "multipart/form-data", + "authorization": wx.getStorageSync("Authorization") + }, + name: 'file', + formData: {}, + success: (resp) => { + console.log('success'); + wx.hideLoading(); + success++; + var str = JSON.parse(resp.data).d + var detailPics = that.data.detailPics; + str = str.slice(0, str.lastIndexOf(':') + 1) + '附件_' + str.slice(str.lastIndexOf(':') + 1) + // console.log('str',str.slice(0, str.lastIndexOf(':') + 1) + '附件_' + str.slice(str.lastIndexOf(':') + 1)); + // sources.lastIndexOf(':') + 1) + '附件_' + sources.slice(sources.lastIndexOf(':') + 1) + detailPics.push({ name: str.split(':')[2], url: str }) + that.setData({ + detailPics: detailPics + }) + }, + fail: (res) => { + fail++; + console.log('fail:' + i + "fail:" + fail); + }, + complete: (res1) => { + console.log(res1,res1.data); + let t = JSON.parse(res1.data) + if(t.c!==200){ + wx.showToast({ + duration: 1500, + icon:'none', + title:t.m + }) + }else{ + i++; + if (i == data.path.length) { //当图片传完时,停止调用 + console.log('执行完毕'); + console.log('成功:' + success + " 失败:" + fail); + var myEventDetail = { + picsList: that.data.detailPics + } // detail对象,提供给事件监听函数 + // console.log(myEventDetail); + + var myEventOption = {} // 触发事件的选项 + that.triggerEvent('myevent', myEventDetail, myEventOption)//结果返回调用的页面 + } else { //若图片还没有传完,则继续调用函数 + data.i = i; + data.success = success; + data.fail = fail; + that.uploadimg(data);//递归,回调自己 + } + } + } + }); + }, + + } +}) \ No newline at end of file diff --git a/miniprogram/components/uploadImages/uploadImages.wxml b/miniprogram/components/uploadImages/uploadImages.wxml new file mode 100644 index 0000000..d0070cc --- /dev/null +++ b/miniprogram/components/uploadImages/uploadImages.wxml @@ -0,0 +1,9 @@ + + + 请选择图片格式的附件 + + + 附件 + + \ No newline at end of file diff --git a/miniprogram/components/userInfo/userInfo.json b/miniprogram/components/userInfo/userInfo.json new file mode 100644 index 0000000..f970180 --- /dev/null +++ b/miniprogram/components/userInfo/userInfo.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "shadow":"/components/shadow/shadow", + "btnClose":"/components/btnClose/btnClose", + "btn":"/components/btn/btn" + } +} \ No newline at end of file diff --git a/miniprogram/components/userInfo/userInfo.scss b/miniprogram/components/userInfo/userInfo.scss new file mode 100644 index 0000000..602d577 --- /dev/null +++ b/miniprogram/components/userInfo/userInfo.scss @@ -0,0 +1,87 @@ +/* components/userInfo/userInfo.wxss */ + +.userInfo_box { + display: flex; + align-items: center; + margin-bottom: 50rpx; + + .avatar { + width: 77rpx; + height: 77rpx; + margin-right: 26rpx; + } + + .username { + font-size: 42rpx; + font-family: PingFang SC; + font-weight: bold; + color: #FFFFFF; + flex-direction: column; + display: flex; + + .icon_noCertificate { + width: 142rpx; + height: 34rpx; + } + } + + .checkInfo { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #CFD6FF; + } +} + +.dialog { + background: #fff; + position: relative; + padding: 30rpx; + margin: 65rpx; + border-radius: 24rpx; + width: 100%; + + .dialog_title { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #3E3E3E; + text-align: center; + margin-bottom: 16rpx; + } + + .dialog_subTitle { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #9F9F9F; + text-align: center; + margin-bottom: 35rpx; + } + + .tip { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #9F9F9F; + text-align: center; + } +} + +.dialogToLogin { + padding: 0 60rpx; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + + + + text { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: bold; + color: #3E3E3E; + margin-bottom: 38rpx; + } +} \ No newline at end of file diff --git a/miniprogram/components/userInfo/userInfo.ts b/miniprogram/components/userInfo/userInfo.ts new file mode 100644 index 0000000..eb05463 --- /dev/null +++ b/miniprogram/components/userInfo/userInfo.ts @@ -0,0 +1,50 @@ +// components/userInfo/userInfo.ts +Component({ + /** + * 组件的属性列表 + */ + properties: { + realName: { + type: Boolean, + value: false + }, + phone: { + type: String, + value: '' + } + }, + + /** + * 组件的初始数据 + */ + data: { + visible: false + }, + + /** + * 组件的方法列表 + */ + methods: { + show() { + if (!this.data.realName) { + this.setData({ + visible: true + }) + } + }, + close() { + this.setData({ + visible: false + }) + }, + goChrivc() { + wx.navigateToMiniProgram({ + appId: 'wx1da91ccb94c17c99', + path: 'pages/information/information', + success(res) { + // 打开成功 + } + }) + } + } +}) diff --git a/miniprogram/components/userInfo/userInfo.wxml b/miniprogram/components/userInfo/userInfo.wxml new file mode 100644 index 0000000..b519aaf --- /dev/null +++ b/miniprogram/components/userInfo/userInfo.wxml @@ -0,0 +1,18 @@ + + + + {{phone}} + + + + + 实名认证 + + + 手机号码已完成全国人力资源信息数据验证平台实名认证的用户,将通过“实名认证”标签展示,用户可前往“全国人力资源信息数据验证平台”小程序完成本人实名认证。 + 前往认证 + + + + + \ No newline at end of file diff --git a/miniprogram/pages/QA/QA.json b/miniprogram/pages/QA/QA.json new file mode 100644 index 0000000..e0db51a --- /dev/null +++ b/miniprogram/pages/QA/QA.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "问题与回答", + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/QA/QA.scss b/miniprogram/pages/QA/QA.scss new file mode 100644 index 0000000..c09f46b --- /dev/null +++ b/miniprogram/pages/QA/QA.scss @@ -0,0 +1,5 @@ +/* pages/QA/QA.wxss */ +.privacy-page{ + padding: 30rpx; + line-height: 50rpx; +} \ No newline at end of file diff --git a/miniprogram/pages/QA/QA.ts b/miniprogram/pages/QA/QA.ts new file mode 100644 index 0000000..8cd57f4 --- /dev/null +++ b/miniprogram/pages/QA/QA.ts @@ -0,0 +1,66 @@ +// pages/QA/QA.ts +Page({ + + /** + * 页面的初始数据 + */ + data: { + nodes: `

1、什么是众评数据?

众评数据是基于手机号码统计的相关数据,数据包括综合评价、标签、全国人力资源信息数据验证平台个人信息报告。

2、什么是全国人力资源信息数据验证平台个人信息报告?

个人信息报告所有数据均通过全国人力资源信息数据验证平台收录,由报告主体授权后展示在众评数据中,主要用于个人增信展示或提供给他人查验。

3、什么是实名认证用户?

手机号码已完成全国人力资源信息数据验证平台实名认证的用户,通过“实名认证”标签展示,用户需要实名认证可前往“全国人力资源信息数据验证平台”完成实名认证流程。

4、如何绑定多个手机号码?

通过“切换手机号”更换当前登录手机号,如需绑定其他号码,可通过手机号及验证码新增绑定手机号。

5、如何查看评价及标签详情?

本人被评价人数达到3人后,可开通查看评价及标签详情权限,您可邀请好友为您综合评价。

` + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/QA/QA.wxml b/miniprogram/pages/QA/QA.wxml new file mode 100644 index 0000000..731560c --- /dev/null +++ b/miniprogram/pages/QA/QA.wxml @@ -0,0 +1,6 @@ + + + + + + diff --git a/miniprogram/pages/addAuthName/addAuthName.json b/miniprogram/pages/addAuthName/addAuthName.json new file mode 100644 index 0000000..3ab2aea --- /dev/null +++ b/miniprogram/pages/addAuthName/addAuthName.json @@ -0,0 +1,8 @@ +{ + "navigationStyle": "custom", + "navigationBarTextStyle": "white", + "usingComponents": { + "btn": "/components/btn/btn", + "navBar": "/components/navBar/navBar" + } +} diff --git a/miniprogram/pages/addAuthName/addAuthName.scss b/miniprogram/pages/addAuthName/addAuthName.scss new file mode 100644 index 0000000..35268f8 --- /dev/null +++ b/miniprogram/pages/addAuthName/addAuthName.scss @@ -0,0 +1,151 @@ +/* pages/addAuthName/addAuthName.wxss */ +.informationEdit-page { + .dataName { + font-size: 36rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; + } + + .radios { + display: flex; + margin-top: 33rpx; + + .radio { + width: 155rpx; + height: 55rpx; + // color: #3A61B1; + background: #FFFFFF; + border: 1px solid #E2E2E2; + border-radius: 10rpx; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + line-height: 30px; + text-align: center; + margin-right: 27rpx; + } + + .active { + color: #3A61B1; + border: 1px solid #3A61B1; + } + } + + .form { + padding: 42rpx 58rpx; + + .formItem { + border-bottom: 2rpx solid #F3F5F8; + padding: 41rpx 0; + // display: flex; + justify-content: space-between; + + .formLabel { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + margin-bottom: 32rpx; + } + + .picker { + font-size: 28rpx; + } + + .datePicker { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 33rpx; + + // padding-bottom: 41rpx; + .to { + width: 33rpx; + height: 3rpx; + background: #C3C3C3; + } + } + } + + .list { + margin-top: 20rpx; + + .item { + padding-bottom: 20rpx; + border-bottom: 1px solid #F3F5F8; + margin: 20px 20px 0 20px; + + .icon_zheng { + width: 24rpx; + height: 28rpx; + margin-left: 10rpx; + } + } + } + } + + // .fileList { + // margin-top: 30rpx; + + // .fileItem { + // background: #F3F5F8; + // border-radius: 10px; + // height: 159rpx; + // display: flex; + // justify-content: space-between; + // flex-direction: row; + // align-items: center; + // height: 107rpx; + // padding: 0 29rpx 0 24rpx; + // margin-bottom: 20rpx; + + // .fileItem_top { + // display: flex; + // align-items: center; + // font-size: 24rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #3A61B1; + // } + + // .fileItem_bottom { + // display: flex; + // align-items: center; + // justify-content: space-between; + // width: 100%; + // font-size: 24rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #3A61B1; + + // .updateDate { + // font-size: 22rpx; + // font-family: PingFang SC; + // font-weight: 400; + // color: #C3C3C3; + // line-height: 30px; + // } + // } + // } + // } + + .submitLayout { + // display: flex; + // justify-content: center; + position: fixed; + bottom: 54rpx; + margin-left: 49rpx; + } +} + +.radio-group { + display: flex; +} + +.weui-cell { + display: flex; + margin-right: 30rpx; + justify-content: space-around; +} \ No newline at end of file diff --git a/miniprogram/pages/addAuthName/addAuthName.ts b/miniprogram/pages/addAuthName/addAuthName.ts new file mode 100644 index 0000000..89666bc --- /dev/null +++ b/miniprogram/pages/addAuthName/addAuthName.ts @@ -0,0 +1,123 @@ +// pages/addAuthName/addAuthName.ts +import { businessLinkNameList } from "../../apis/information"; +Page({ + + /** + * 页面的初始数据 + */ + data: { + value: '', + type: 'ACADEMIC_EDUCATION', + resultList: undefined, + formName: '' + }, + inputChange(e) { + console.log(e.detail.value); + // let payload = + const { type } = this.data + businessLinkNameList({ type, name: e.detail.value || undefined }).then((res: any) => { + this.setData({ + resultList: res.d, + }) + }) + + }, + handleSelect(e) { + var pages = getCurrentPages(); + var prevPage = pages[pages.length - 2] + if (this.data.formName === '单位名称') { + prevPage.setData({ //修改上一个页面的变量 + dwmc: e.currentTarget.dataset.name, + businessNameAuthenticationTag: e.currentTarget.dataset.authentication + }) + } else { + prevPage.setData({ //修改上一个页面的变量 + jyjg: e.currentTarget.dataset.name, + businessNameAuthenticationTag: e.currentTarget.dataset.authentication + }) + } + + wx.navigateBack({ + delta: 1 + }) + }, + handleCreate() { + const { value, formName } = this.data + var pages = getCurrentPages(); + var prevPage = pages[pages.length - 2] + if (formName === '单位名称') { + prevPage.setData({ //修改上一个页面的变量 + dwmc: value, + businessNameAuthenticationTag: false + }) + } else { + prevPage.setData({ //修改上一个页面的变量 + jyjg: value, + businessNameAuthenticationTag: false + }) + } + + wx.navigateBack({ + delta: 1 + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log(options); + this.setData({ + formName: options.formName + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/addAuthName/addAuthName.wxml b/miniprogram/pages/addAuthName/addAuthName.wxml new file mode 100644 index 0000000..f8f20e7 --- /dev/null +++ b/miniprogram/pages/addAuthName/addAuthName.wxml @@ -0,0 +1,22 @@ + + + + + {{formName}} + + + + {{formName}} + + + + {{item.name}} + + + + + + 确认添加 + + + \ No newline at end of file diff --git a/miniprogram/pages/addPhone/addPhone.json b/miniprogram/pages/addPhone/addPhone.json new file mode 100644 index 0000000..1679e3e --- /dev/null +++ b/miniprogram/pages/addPhone/addPhone.json @@ -0,0 +1,9 @@ +{ + "navigationBarBackgroundColor": "#3A61B1", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "添加手机号", + "usingComponents": { + "btn": "/components/btn/btn", + "shadow": "/components/shadow/shadow" + } +} \ No newline at end of file diff --git a/miniprogram/pages/addPhone/addPhone.scss b/miniprogram/pages/addPhone/addPhone.scss new file mode 100644 index 0000000..f8157c1 --- /dev/null +++ b/miniprogram/pages/addPhone/addPhone.scss @@ -0,0 +1,334 @@ +/* pages/certification/certification.wxss */ +.step-box { + background: #3A61B1; + box-sizing: border-box; + padding-top: 30rpx; + padding-bottom: 88rpx; + display: flex; + justify-content: center; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #B3C2E1; + justify-content: space-between; + padding-left: 30rpx; + padding-right: 30rpx; + + .step-item { + width: 246rpx; + display: flex; + // flex-direction: column; + align-items: center; + + image { + width: 65rpx; + height: 65rpx; + // margin-bottom: 20rpx; + margin-right: 15rpx; + } + + text { + flex: 1; + } + } + + .line { + width: 142rpx; + height: 3rpx; + background: #ECEEF3; + opacity: 0.12; + margin-top: 32rpx; + } +} + +.white-box { + background: #fff; + border-radius: 32rpx; + margin-top: -32rpx; + box-sizing: border-box; + padding: 47rpx; + + .title-box { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + + .edit-box { + display: flex; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #2F88DB; + + image { + width: 29rpx; + height: 28rpx; + margin-right: 10rpx; + } + } + } + + .description { + display: flex; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #B3B3B3; + margin-top: 18rpx; + background: #FFF7F1; + padding: 25rpx 35rpx 29rpx 29rpx; + align-items: baseline; + color: #FE633A; + border-radius: 10px; + line-height: 37rpx; + + image { + width: 20rpx; + height: 20rpx; + margin-right: 10rpx; + } + + text { + flex: 1; + } + } + + .form-box { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 15rpx; + + .form-item { + display: flex; + align-items: center; + box-sizing: border-box; + padding: 40rpx 30rpx; + border-bottom: 1rpx solid #D7D7D7; + + &:last-child { + border: none; + } + + text { + margin-right: 43rpx; + } + } + } + + .btn-box { + display: flex; + justify-content: center; + margin-top: 10rpx; + } + + .table-box { + .table-title { + display: flex; + justify-content: space-around; + margin-top: 80rpx; + + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + } + + .table-content { + border: 1rpx solid #E6E6E6; + display: flex; + margin-top: 40rpx; + + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #6E6E6E; + + .table-col { + display: flex; + flex-direction: column; + justify-content: center; + box-sizing: border-box; + width: 50%; + padding: 40rpx; + + &:last-child { + border-left: 1rpx solid #E6E6E6; + } + + .item { + display: flex; + align-items: center; + margin-bottom: 58rpx; + + &:last-child { + margin-bottom: 0; + } + + image { + width: 63rpx; + height: 63rpx; + margin-right: 32rpx; + flex-shrink: 0; + } + } + } + } + } + + .field-box { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 50rpx; + + .field-item { + display: flex; + margin-bottom: 46rpx; + + text { + margin-right: 43rpx; + } + } + } + + .information { + box-sizing: border-box; + padding: 30rpx; + border-radius: 10rpx; + background: #FFF7F1; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + line-height: 36rpx; + color: #FE633A; + } + + .price-box { + display: flex; + flex-direction: column; + align-items: flex-end; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + margin-top: 48rpx; + + .price { + font-size: 24rpx; + font-weight: 500; + font-family: PingFang SC; + color: #FF5129; + margin-top: 24rpx; + + text { + font-size: 48rpx; + font-weight: 800; + + } + } + } + + .bottom-box { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + box-shadow: 0 0 18rpx #CCCCCC; + box-sizing: border-box; + padding: 24rpx 50rpx; + padding-bottom: calc(constant(safe-area-inset-top) + 24rpx); + padding-bottom: calc(env(safe-area-inset-top) + 24rpx); + } +} + +.payShadow { + width: 100%; + background: #FFF; + border-radius: 24rpx 24rpx 0 0; + padding-bottom: 50rpx; + + .cancel-box { + box-sizing: border-box; + padding: 10rpx; + display: flex; + align-items: center; + justify-content: space-between; + + image { + width: 31rpx; + height: 31rpx; + padding: 20rpx; + } + + text { + padding: 20rpx; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #2F88DB; + } + } + + .pay-info-box { + display: flex; + flex-direction: column; + align-items: center; + + .title { + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + margin-bottom: 24rpx; + } + + .price-box { + font-size: 40rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FF5129; + margin-bottom: 32rpx; + + text { + font-size: 80rpx; + font-weight: 800; + } + } + + .time { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + margin-bottom: 60rpx; + } + + .pay-type { + display: flex; + align-items: center; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + width: 100%; + box-sizing: border-box; + padding: 0 56rpx; + margin-bottom: 100rpx; + + image { + width: 43rpx; + height: 43rpx; + margin-right: 16rpx; + } + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/addPhone/addPhone.ts b/miniprogram/pages/addPhone/addPhone.ts new file mode 100644 index 0000000..808a8e5 --- /dev/null +++ b/miniprogram/pages/addPhone/addPhone.ts @@ -0,0 +1,154 @@ +// pages/certification/certification.ts +import { getPayInfo } from '../../apis/pay' +import { realNameAuthentication } from '../../apis/login' +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + step: 1, + name: '', + idCard: '', + phoneNumber: '',//app.globalData.userInfo?.username, + info: {}, + payShow: false, + type: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + // this.setData({ + // phoneNumber: app.globalData.userInfo?.username + // }) + this.getInfo() + // console.log(options.phoneNumber===''); + + this.setData({ + phoneNumber: options.phoneNumber, + idCard: options.phoneNumber==='' ? '' : app.globalData.userInfo.idCard || '', + name: options.phoneNumber==='' ? '' : app.globalData.userInfo.name || '', + type: options.phoneNumber==='' ? 'add' : 'refresh' + }) + }, + getInfo() { + getPayInfo({}).then((res: any) => { + this.setData({ + info: res.d + }) + }) + }, + pay() { + const { name, idCard, phoneNumber, type } = this.data + realNameAuthentication({ + name, idCard, phoneNumber, + wxPayApiType: 'JSAPI', + authType: type === 'add' ? 'PHONE_ADD' : 'PHONE_REFRESH' + }).then((res: any) => { + console.log(res) + wx.requestPayment({ + ...res.d, + success: (res: any) => { + console.log(res) + wx.navigateTo({ + url: '/pages/certificationResult/certificationResult' + }) + }, + fail: (err: any) => { + console.log(err) + wx.showToast({ + icon: 'none', + title: '支付失败, 请稍后再试!' + }) + } + }) + }) + }, + showShadow() { + this.setData({ + payShow: true + }) + }, + hideShadow() { + this.setData({ + payShow: false + }) + }, + next() { + const { name, idCard } = this.data + if (!name) { + wx.showToast({ + icon: 'none', + title: '请输入您的真实姓名' + }) + return + } + if (!idCard) { + wx.showToast({ + icon: 'none', + title: '请输入您的身份证号' + }) + return + } + this.setData({ + step: 2 + }) + }, + edit() { + this.setData({ + step: 1 + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/addPhone/addPhone.wxml b/miniprogram/pages/addPhone/addPhone.wxml new file mode 100644 index 0000000..bd1c2ae --- /dev/null +++ b/miniprogram/pages/addPhone/addPhone.wxml @@ -0,0 +1,128 @@ + + + + + 输入实名信息 + + + + + 确认信息并支付 + + + + + + 实名信息 + + + 返回修改 + + + + + + 您可以通过实名认证添加多个手机号码,认证添加的手机号均可用于账号登录,为顺利完成实名认证,请您准确填写您的手机号! + + + + 真实姓名 + + + + 身份证号 + + + + 手机号码 + + + + + + 提交并进入下一步 + + + + + + + + + 真实姓名 + {{name}} + + + 身份证号 + {{idCard}} + + + 手机号码 + {{phoneNumber}} + + + 本次服务由国家级大数据平台提供实名匹配认证,认证成功后可查看数据档案详情,补充自填信息,申请勘误,生成个人信息报告。请仔细核实认证信息,若因数据档案填写失误造成认证失败,此次认证费用将无法退还。 + + 支付金额 + ¥{{info.realNameAuthentication / 100}} + + + 信息确认无误,立即支付 + + + + + + + + + + + + 支付金额 + ¥{{info.realNameAuthentication / 100}} + + 确认付款 + + + + diff --git a/miniprogram/pages/agreement/agreement.json b/miniprogram/pages/agreement/agreement.json new file mode 100644 index 0000000..84ae421 --- /dev/null +++ b/miniprogram/pages/agreement/agreement.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "用户协议", + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/agreement/agreement.scss b/miniprogram/pages/agreement/agreement.scss new file mode 100644 index 0000000..424e3ef --- /dev/null +++ b/miniprogram/pages/agreement/agreement.scss @@ -0,0 +1 @@ +/* pages/agreement/agreement.wxss */ \ No newline at end of file diff --git a/miniprogram/pages/agreement/agreement.ts b/miniprogram/pages/agreement/agreement.ts new file mode 100644 index 0000000..5a0f8b1 --- /dev/null +++ b/miniprogram/pages/agreement/agreement.ts @@ -0,0 +1,66 @@ +// pages/agreement/agreement.ts +Page({ + + /** + * 页面的初始数据 + */ + data: { + nodes: `

溯源优才平台用户服务协议

全国产品防伪溯源验证公共平台拥有溯源优才——全国人力资源信息数据验证平台(简称"溯源优才平台"或“平台”),并授权成都德锋创享科技有限公司负责网站的日常操作,为服务使用人(以下称"您"或者"用户")提供个人人力资源信息溯源服务。用户应当阅读、理解并同意本协议的全部条款。一经点击"同意",则协议成立。如果您是本平台的日常用户,请随时关注本协议的更新。为明确用户在接受和提供溯源优才——全国人力资源信息数据验证平台查询服务过程中的权利和义务,本着平等自愿的原则,双方就相关事宜达成如下协议。

 

第一条:服务事项

本协议所指的溯源优才——全国人力资源信息数据验证平台查询服务包括数据档案数据自填、数据档案数据查询和数据档案数据报告。

 

第二条:用户的权利和义务

(一)用户点击"同意",即是向平台证明、声明和保证用户为所查询信息的主体。

(二)用户应对以该用户名义进行的自填、申请、查询等所有操作行为承担法律责任。

(三)用户应注意以下事项,否则用户承担由此带来的不利后果:

1.   用户应向平台提供正确、完整、真实的用户注册申请资料和其它表单,并根据实际变化情况及时更新。因注册资料有误引起的后果由用户承担。

2.   .用户妥善保管本人信息,包括并不限于账号、密码。如因用户本人保管数据档案不善,导致他人获得您的数据档案,或因此导致个人信息报告被他人取得可能导致用户遭受损失的后果由用户承担。

(四)用户若认为我们采集、保存、提供的信息存在错误、遗漏的,您有权向我们或经您授权的其他信息提供者提出异议,并要求更正。

(五)您同意我们不对信息提供者采集、保存、提供的您的信息中存在的错误、遗漏等瑕疵承担任何法律责任。如您对其他信息提供者采集、保存、提供的您的信息存在异议或因此产生了任何争议或纠纷,您保证概与我们无关,并保证会直接联系该信息提供者进行解决。

(六)用户生成的个人信息报告可通过授权向他人进行展示,如因用户本人授权错误,导致个人信息报告被他人取得可能导致用户遭受损失的后果由用户承担。

(七)用户不得传送任何包含病毒、木马、蠕虫等可能破坏,感染,密码拦截任何系统,数据和信息的程序,不得通过黑客、密码破译等方式违法侵入计算机和网络系统,他人账户。

 

第三条:平台的权利和义务

(一)平台有权制定溯源优才——全国人力资源信息数据验证平台查询服务的相关业务操作规范。

(二)平台有权依据法律、法规、规章或业务需要对服务内容、操作流程进行调整,并在网站对外公告有关变更事项后实施,不另行单独通知用户。

(三)平台收集本人信息,只为核实并确认身份及从数据库中抽取正确的人力资源信息,不会对外提供或泄露,不会用作其他用途。

(四)为处理用户使用溯源优才平台查询要求,以确定用户即为上述所证明、声明和保证的人士,平台可查阅和使用目前保留在系统中任何和全部用户的信用报告信息,以及用户在使用溯源优才平台时所提供的用于配对的资料。

(五)用户使用溯源优才平台时所提供给电话号码包括手机号码,平台或者授权第三者将来任何时候,可在溯源优才平台或其相关系统,用于鉴别用户身份的用途。

(六)溯源优才平台建立和完善内部管理制度,维护本网站的正常运行,保证按照有关业务规则公布的时间对外提供服务。

 

第四条:不可抗力条款

因下列原因致使溯源优才平台不能正常提供服务而可能导致的损失,平台不承担责任:

1.   因台风、地震、海啸、洪水、战争等不可抗力因素,造成互联网不能正常执行业务;

2.   计算机病毒、黑客攻击、网络通信故障等征信中心不能控制的因素;

3.   为了维护溯源优才平台的正常运行,将定期或不定期地对系统运行的相关设备进行维护或者检修,因此而造成查询服务在合理时间内的中断,平台不承担责任。

 

第五条:协议的变更和终止

鉴于网络服务的特殊性,平台变更本协议及其附件的若干条款时,将提前通过网站公告有关变更事项。如用户在平台发布上述协议变更的有关公告后继续使用互联网查询的,视为用户已接受协议的有关变更,并受其约束。本协议中的相关条款根据该变更而自动做相应修改,双方无须另行签订书面协议。

 

第六条:免责条款

(一)在法律允许的范围内,平台对以下情形导致的服务中断或受阻不承担责任:

1.受到计算机病毒、木马或其他恶意程序、黑客攻击的破坏;

2.用户或溯源优才平台的电脑软件、系统、硬件和通信线路出现故障;

3.用户操作不当;

4.用户通过非我们授权的方式使用本服务;

5.其他平台无法控制或合理预见的情形。

(二)平台对从信息提供者处所采集的信息的真实性、合法性、有效性、准确性以及完整性不承担任何责任,另有约定的除外。

(三)用户在使用本服务的过程中,可能会遇到网络故障或因其他主体行为带来的风险,平台不对任何信息的真实性、适用性、合法性承担责任,也不对因其他主体的侵权行为给您造成的损害负责。

(四)在任何情况下,全国产品防伪溯源验证公共平台不声明及保证只要用户提供正确资料,就一定能通过溯源优才平台获取本人相关信用信息。

 

第七条:法律适用条款以及争议解决方式

本协议的生效、解释、履行及争议的解决均适用中华人民共和国法律。在协议履行期间,凡由本协议引起的或与本协议有关的一切争议、纠纷,当事人应首先协商解决。协商不成,任何一方均可向所在地法院提起诉讼。

 

第八条:附则

(一)本协议的某一条款被确认无效,均不影响本协议其他条款的效力。

(二)本协议未尽事宜,根据我国相关法律、法规及溯源优才平台相关业务规定办理。如需制定补充协议,其法律效力同本协议。

(三)本协议自使用者点击"同意"并取得用户身份,则协议成立。

(四)若本协议中有任何条文被任何司法管辖区具有适当司法管辖权的法官裁定为非法、无效或不可强制执行的,本合同的其他条款仍继续有效。

 


` + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/agreement/agreement.wxml b/miniprogram/pages/agreement/agreement.wxml new file mode 100644 index 0000000..9ae781a --- /dev/null +++ b/miniprogram/pages/agreement/agreement.wxml @@ -0,0 +1,5 @@ + + + + + diff --git a/miniprogram/pages/answer/answer.json b/miniprogram/pages/answer/answer.json new file mode 100644 index 0000000..647f3e0 --- /dev/null +++ b/miniprogram/pages/answer/answer.json @@ -0,0 +1,10 @@ +{ + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#313035", + "navigationBarTitleText": " ", + "navigationStyle": "custom", + "usingComponents": { + "navBar": "/components/navBar/navBar", + "btn": "/components/btn/btn" + } +} \ No newline at end of file diff --git a/miniprogram/pages/answer/answer.scss b/miniprogram/pages/answer/answer.scss new file mode 100644 index 0000000..116fb18 --- /dev/null +++ b/miniprogram/pages/answer/answer.scss @@ -0,0 +1,121 @@ +/* pages/answer/answer.wxss */ +.answer-page{ + box-sizing: border-box; + padding: 46rpx 54rpx; +} + +.title-box{ + display: flex; + align-items: center; + font-size: 36rpx; + font-family: PingFang SC; + font-weight: bold; + color: #653E12; + margin-bottom: 34rpx; + image{ + width: 35rpx; + height: 40rpx; + margin-right: 10rpx; + } +} +.description{ + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + line-height: 36px; + opacity: 0.61; +} + +.form-box{ + .form-item{ + border-bottom: 2rpx solid #F3F5F8; + display: flex; + justify-content: space-between; + align-items: center; + padding: 55rpx 0; + // &:last-child{ + // border-bottom: none; + // } + &.break{ + flex-direction: column; + align-items: flex-start; + padding: 26rpx 0; + .label{ + margin-bottom: 27rpx; + } + } + .label{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + } + .select-box{ + display: flex; + justify-content: space-between; + width: 100%; + .select-item{ + width: 195rpx; + height: 55rpx; + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; + border-radius: 10rpx; + border: 1rpx solid #E2E2E2; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + &.active{ + background: #E5C7A3; + color: #653E12; + border: none; + } + } + } + .picker-box{ + display: flex; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + image{ + width: 14rpx; + height: 25rpx; + margin-left: 20rpx; + } + } + .input-box{ + width: 100%; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + display: flex; + justify-content: space-between; + align-items: center; + } + } +} + +.radio-box{ + display: flex; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 40rpx; + radio{ + zoom: .7; + margin-right: 18rpx; + } +} +.btn-box{ + display: flex; + justify-content: center; + margin-top: 68rpx; +} \ No newline at end of file diff --git a/miniprogram/pages/answer/answer.ts b/miniprogram/pages/answer/answer.ts new file mode 100644 index 0000000..a96f96e --- /dev/null +++ b/miniprogram/pages/answer/answer.ts @@ -0,0 +1,176 @@ +// pages/answer/answer.ts +import { list } from '../../apis/report' +import { defaultConfig, defaultConfigFind } from '../../apis/inspection' +Page({ + + /** + * 页面的初始数据 + */ + data: { + deal: null, + oldDataDeal: false, + expirationDay: '', + + reportId: '', + + selectIndex: '', + reportList: [], + dealOptions: [ + { + label: '每次都询问', + value: null, + }, + { + label: '每次都同意', + value: true, + }, + { + label: '每次都拒绝', + value: false, + }, + ] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.getInfo() + this.getReportList() + }, + + getInfo() { + defaultConfigFind().then((res:any) => { + console.log(res) + if (res.d) { + const { deal, expirationDay, oldDataDeal, reportId } = res.d + this.setData({ + deal, expirationDay, oldDataDeal, reportId + }) + this.setSelect() + } + }) + }, + + getReportList() { + list({ + size: 999999 + }).then((res:any) => { + this.setData({ + reportList: res.d.records + }) + this.setSelect() + }) + }, + + submit(){ + const {selectIndex, expirationDay, deal, oldDataDeal, reportList} = this.data + if (!selectIndex) { + wx.showToast({ + icon: 'none', + title: '请选择报告' + }) + return + } + if (!expirationDay) { + wx.showToast({ + icon: 'none', + title: '请输入查验有效期' + }) + return + } + defaultConfig({ + expirationDay, deal, oldDataDeal, + // @ts-ignore + reportId: reportList[selectIndex].id + }).then(() => { + wx.showToast({ + icon: 'none', + title: '设置成功!' + }) + wx.navigateBack({ + delta: 1 + }) + }) + }, + + setSelect() { + const { reportList, reportId } = this.data + if (reportList && reportId) { + const index = reportList.findIndex((item:any) => item.id === reportId) + if (index !== -1) { + this.setData({ + selectIndex: index + '' + }) + } + } + }, + + reportChange(e:WechatMiniprogram.CustomEvent) { + const { value } = e.detail + this.setData({ + selectIndex: value + }) + }, + changeDeal(e:WechatMiniprogram.BaseEvent) { + const { value } = e.currentTarget.dataset + this.setData({ + deal: value + }) + }, + radioChange() { + const { oldDataDeal } = this.data + this.setData({ + oldDataDeal: !oldDataDeal + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/answer/answer.wxml b/miniprogram/pages/answer/answer.wxml new file mode 100644 index 0000000..0e2147a --- /dev/null +++ b/miniprogram/pages/answer/answer.wxml @@ -0,0 +1,40 @@ + + + + + + 设置默认应答 + + 年费会员专属服务 + + + 默认授权与否 + + {{item.label}} + + + + 默认授权报告 + + + {{selectIndex ? reportList[selectIndex].name : '请选择'}} + + + + + + 默认查验有效期 + + + 天 + + + + + + 按照此次设置处理当前未处理的所有查验申请 + + + 确认设置 + + diff --git a/miniprogram/pages/apply/apply.json b/miniprogram/pages/apply/apply.json new file mode 100644 index 0000000..fb24a8e --- /dev/null +++ b/miniprogram/pages/apply/apply.json @@ -0,0 +1,11 @@ +{ + "navigationStyle": "custom", + "navigationBarTextStyle": "white", + "usingComponents": { + "guide": "/components/guide/guide", + "shadow": "/components/shadow/shadow", + "btn": "/components/btn/btn", + "not": "/components/not/not", + "navBar": "/components/navBar/navBar" + } +} \ No newline at end of file diff --git a/miniprogram/pages/apply/apply.scss b/miniprogram/pages/apply/apply.scss new file mode 100644 index 0000000..e079cc0 --- /dev/null +++ b/miniprogram/pages/apply/apply.scss @@ -0,0 +1,173 @@ +/* pages/apply/apply.wxss */ +page{ + background: #F6F6F6; +} +.logo{ + width: 208rpx; + height: 37rpx; +} +.list-box{ + box-sizing: border-box; + padding: 20rpx 30rpx; +} + +.white-box{ + background: #FFF; + margin-bottom: 26rpx; + border-radius: 16rpx; + box-sizing: border-box; + padding: 30rpx 43rpx; + display: flex; + .radio-box{ + margin-right: 20rpx; + radio{ + zoom: 0.7; + } + } + .info-container{ + width: 100%; + } +} +.title-box{ + display: flex; + justify-content: space-between; + align-items: center; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #494949; + .status { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #A6A6A6; + &.warning{ + color: #FF4931; + } + } +} + +.info-box{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + margin-top: 30rpx; +} + +.btn-container{ + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 26rpx; + height: 60rpx; + .btn-box{ + display: flex; + align-items: center; + .btn{ + color: #3A61B1; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + } + .line{ + width: 1rpx; + height: 17rpx; + background: #737373; + margin: 0 35rpx; + } + } + .primary-btn{ + width: 190rpx; + height: 60rpx; + font-size: 24rpx; + } +} + +.bottom-fill{ + height: 145rpx; +} +.bottom-box{ + position: fixed; + bottom: 0; + left: 0; + width: 100%; + box-shadow: 0 0 20rpx #CCCCCC; + background: #FFFFFF; + box-sizing: border-box; + padding: 30rpx; + display: flex; + justify-content: space-between; + align-items: center; + .btn_setDefault{ + width: 231rpx; + height: 63rpx; + // background: url('https://chrivc.obs.cn-north-4.myhuaweicloud.com/7b7a5764f0e842dea973659fc8df8f20:附件_1662451660.png); + } + .batch-btn{ + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + padding: 10rpx 0; + } +} + +.modal-shadow{ + display: flex; + flex-direction: column; + align-items: center; + width: 558rpx; + background: #FFF; + border-radius: 24rpx; + position: relative; + padding-top: 62rpx; + .cancel{ + position: absolute; + width: 31rpx; + height: 31rpx; + padding: 21rpx; + top: 0; + right: 10rpx; + } + .report-icon{ + width: 199rpx; + height: 153rpx; + margin-bottom: 32rpx; + } + .infomation{ + text-align: center; + width: 100%; + box-sizing: border-box; + padding: 0 54rpx; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + } + .btn-box{ + display: flex; + width: 100%; + .btn{ + width: 50%; + height: 120rpx; + display: flex; + justify-content: center; + align-items: center; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + &.agree{ + color: #2DC779; + } + &.refuse{ + color: #FF6C6C; + } + image{ + width: 39rpx; + height: 27rpx; + margin-right: 8rpx; + } + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/apply/apply.ts b/miniprogram/pages/apply/apply.ts new file mode 100644 index 0000000..2bdfe45 --- /dev/null +++ b/miniprogram/pages/apply/apply.ts @@ -0,0 +1,224 @@ +// pages/apply/apply.ts +const app = getApp() +import { querystrToObj } from '../../utils/util' +import { inspectedList, deal } from '../../apis/inspection' +Page({ + + /** + * 页面的初始数据 + */ + data: { + listQuery: { + current: 1 + }, + list: [], + status: { + WAIT: '待处理', + AGREE: '已同意', + REFUSE: '已拒绝', + AGREE_TIME_OUT: "已失效" + }, + shadowShow: false, + selectItem: {}, // 单个处理选中 + selectObj: {}, // 批量选中 + batch: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + getList() { + inspectedList(this.data.listQuery).then((res:any) => { + console.log(res) + const list = res.d.records + if (list.length) { + this.setData({ + list: this.data.list.concat(list) + }) + } else { + wx.showToast({ + icon: 'none', + title: '没有更多了!' + }) + } + }) + }, + + handleClick(e:WechatMiniprogram.BaseEvent){ + const { batch } = this.data + const { item } = e.currentTarget.dataset + if (batch) { + wx.showToast({ + icon: 'none', + title: '请先退出批量处理!' + }) + return + } + this.setData({ + selectItem: item + }) + this.showShadow() + }, + handleAgree() { + const { selectItem, batch } = this.data + // @ts-ignore + let ids = [selectItem.id] + if (batch) ids = this.getBatchSelectIds() + + wx.navigateTo({ + // @ts-ignore + url: `/pages/applySetting/applySetting?ids=${ids.join(',')}&name=${selectItem.name || ''}&batch=${batch ? 1 : ''}` + }) + this.hideShadow() + }, + handleRefuse() { + const { selectItem, batch } = this.data + // @ts-ignore + let ids = [selectItem.id] + if (batch) ids = this.getBatchSelectIds() + deal({ + agree: false, + ids + }).then(() => { + wx.showToast({ + icon: 'none', + title: '操作成功!' + }) + this.hideShadow() + app.reload() + }) + }, + handleBatch() { + const ids = this.getBatchSelectIds() + if (!ids.length) { + wx.showToast({ + icon: 'none', + title: '请选择申请!' + }) + return + } + console.log(ids) + this.showShadow() + }, + changeBatch() { + const { batch } = this.data + this.setData({ + selectObj: {}, + batch: !batch + }) + }, + getBatchSelectIds() { + const { selectObj } = this.data + // @ts-ignore + const ids = Object.keys(selectObj).filter((key) => selectObj[key]) + return ids + }, + radioChange(e: WechatMiniprogram.BaseEvent) { + const { id } = e.currentTarget.dataset + // @ts-ignore + const val = this.data.selectObj[id] + this.setData({ + [`selectObj.${id}`]: !val + }) + }, + jumpSetting(e: WechatMiniprogram.BaseEvent) { + const { item } = e.currentTarget.dataset + wx.navigateTo({ + url: `/pages/applySetting/applySetting?id=${item.id}&name=${item.name}` + }) + }, + jumpReport(e: WechatMiniprogram.BaseEvent) { + wx.navigateTo({ + url: `/pages/reportPreview/reportPreview?id=${e.currentTarget.dataset.id}&type=1&active=2` + }) + }, + jumpInspected(e: WechatMiniprogram.BaseEvent) { + const { item } = e.currentTarget.dataset + wx.reLaunch({ + url: `/pages/inspected/inspected?name=${item.name}&phone=${item.phone}` + }) + }, + jumpAnswer() { + if (app.memberVerify(true)) { + wx.navigateTo({ + url: '/pages/answer/answer' + }) + } + }, + showShadow() { + this.setData({ + shadowShow: true + }) + }, + hideShadow() { + this.setData({ + shadowShow: false + }) + }, + + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + list: [], + ['listQuery.current']: 1, + batch: false, + selectObj: {}, + selectItem: {} + }) + this.getList() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + this.setData({ + ['listQuery.current']: this.data.listQuery.current + 1 + }) + this.getList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) + +export {} diff --git a/miniprogram/pages/apply/apply.wxml b/miniprogram/pages/apply/apply.wxml new file mode 100644 index 0000000..37f86d1 --- /dev/null +++ b/miniprogram/pages/apply/apply.wxml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + {{item.name}}的查验申请 + 对方已读 + {{status[item.status]}} + + 申请时间: + + + 手机号:{{item.phone}} + + + 查验对方 + + 在线沟通 + + 去授权 + 查看授权报告 + + + + + + + + + {{batch ? '退出' : ''}}批量处理 + 去操作 + + + + + + + + + + + + + 以上用户 + 用户{{selectItem.name}} + 实名向您发起查验申请,您同意后可授权其查验您的个人信息报告。是否同意授权? + + + + + 同意 + + + + 拒绝 + + + + + \ No newline at end of file diff --git a/miniprogram/pages/applySetting/applySetting.json b/miniprogram/pages/applySetting/applySetting.json new file mode 100644 index 0000000..8cd254d --- /dev/null +++ b/miniprogram/pages/applySetting/applySetting.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": " ", + "usingComponents": { + "btn": "/components/btn/btn", + "message-box": "/components/message/message" + } +} \ No newline at end of file diff --git a/miniprogram/pages/applySetting/applySetting.scss b/miniprogram/pages/applySetting/applySetting.scss new file mode 100644 index 0000000..bb3b84e --- /dev/null +++ b/miniprogram/pages/applySetting/applySetting.scss @@ -0,0 +1,97 @@ +/* pages/applySetting/applySetting.wxss */ +.apply-setting-page{ + box-sizing: border-box; + padding: 46rpx 55rpx; +} +.title{ + font-size: 36rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + margin-bottom: 38rpx; +} +.description{ + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + margin-bottom: 88rpx; +} + +.field-box{ + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 45rpx; + .label { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949 + } + .select-box{ + display: flex; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + + // margin-bottom: 40rpx; + image{ + width: 14rpx; + height: 25rpx; + margin-left: 17rpx; + } + } + .switch-box{ + display: flex; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + + // margin-bottom: 50rpx; + switch{ + // .wx-switch-input{ + // width: 88rpx; + // height: 50rpx; + // } + margin-right: 20rpx; + zoom: .6; + } + } +} + +.add-report{ + padding-bottom: 40rpx; + border-bottom: 2rpx solid #F3F5F8; + margin-bottom: 28rpx; + + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + + display: flex; + align-items: center; + image{ + width: 21rpx; + height: 21rpx; + margin-right: 9rpx; + } +} + +.select-time{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; +} + +.btn-box{ + display: flex; + justify-content: center; + margin-top: 76rpx; +} \ No newline at end of file diff --git a/miniprogram/pages/applySetting/applySetting.ts b/miniprogram/pages/applySetting/applySetting.ts new file mode 100644 index 0000000..76cd233 --- /dev/null +++ b/miniprogram/pages/applySetting/applySetting.ts @@ -0,0 +1,167 @@ +// pages/applySetting/applySetting.ts +import { list } from '../../apis/report' +import { deal } from '../../apis/inspection' +import { parseTime } from "../../utils/index" + +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + ids: [], + name: '', + batch: '', + reportList: [], + selectIndex: undefined, + endDate: undefined, + startDate: parseTime(new Date().getTime(), '{y}-{m}-{d}'), + unlimited: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options:any) { + const { ids, name, batch } = options + this.setData({ + ids: ids.split(','), + name, + batch + }) + }, + + getReportList() { + list({ + size: 999999 + }).then((res:any) => { + this.setData({ + reportList: res.d.records + }) + }) + }, + submit() { + const {reportList, selectIndex, endDate, unlimited, ids} = this.data + if (!selectIndex) { + wx.showToast({ + icon: 'none', + title: '请选择报告' + }) + return + } + if (!unlimited && !endDate) { + wx.showToast({ + icon: 'none', + title: '请选择授权截止时间' + }) + return + } + deal({ + ids: ids, + // @ts-ignore + endDate: unlimited ? undefined : (new Date(endDate + ' 23:59:59').getTime() / 1000), + // @ts-ignore + reportId: reportList[selectIndex].id, + agree: true, + }).then(() => { + if (app.memberVerify()) { + this.showShadow('shadow1') + } else { + this.showShadow('shadow2') + } + }) + }, + jumpBuy() { + wx.redirectTo({ + url: "/pages/member/member" + }) + }, + jumpSet() { + wx.redirectTo({ + url: "/pages/answer/answer" + }) + }, + jumpReport() { + wx.navigateTo({ + url: '/pages/generateReport/generateReport' + }) + }, + reportChange(e:WechatMiniprogram.CustomEvent) { + const { value } = e.detail + this.setData({ + selectIndex: value + }) + }, + bindDateChange(e:WechatMiniprogram.CustomEvent) { + const { value } = e.detail + this.setData({ + endDate: value + }) + }, + bindLimitChange(e:WechatMiniprogram.CustomEvent) { + const { value } = e.detail + this.setData({ + unlimited: value + }) + }, + showShadow(name: string) { + this.selectComponent('#' + name).show() + }, + back() { + wx.navigateBack({ + delta: 1 + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.getReportList() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) + +export {} \ No newline at end of file diff --git a/miniprogram/pages/applySetting/applySetting.wxml b/miniprogram/pages/applySetting/applySetting.wxml new file mode 100644 index 0000000..e353baf --- /dev/null +++ b/miniprogram/pages/applySetting/applySetting.wxml @@ -0,0 +1,27 @@ + + + 设置授权 + 您同意向以上申请人申请人{{name}}授权个人信息报告,请选择您授权的报告。 + + 选择报告 + + {{selectIndex ? reportList[selectIndex].name : '请选择'}} + + + + + 生成新报告 + + + 授权期限 + 不限时间 + + + {{endDate ? endDate : '选择截止时间'}} + + + 确认授权 + + + + diff --git a/miniprogram/pages/certificateCreate/certificateCreate.json b/miniprogram/pages/certificateCreate/certificateCreate.json new file mode 100644 index 0000000..8be2216 --- /dev/null +++ b/miniprogram/pages/certificateCreate/certificateCreate.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": " ", + "usingComponents": { + "shadow": "/components/shadow/shadow", + "btn": "/components/btn/btn" + } +} \ No newline at end of file diff --git a/miniprogram/pages/certificateCreate/certificateCreate.scss b/miniprogram/pages/certificateCreate/certificateCreate.scss new file mode 100644 index 0000000..5816b6b --- /dev/null +++ b/miniprogram/pages/certificateCreate/certificateCreate.scss @@ -0,0 +1,292 @@ +/* pages/certificateCreate/certificateCreate.wxss */ +.certificate-create-page { + box-sizing: border-box; + padding: 48rpx 54rpx; + + .title { + font-size: 36rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + } +} + +.form-box { + .form-item { + padding: 40rpx 0; + border-bottom: 2rpx solid #F3F5F8; + display: flex; + justify-content: space-between; + align-items: center; + + &:last-child { + border: none; + } + + &.switch { + display: flex; + flex-direction: column; + align-items: flex-start; + + switch { + zoom: .7; + margin-right: 20rpx; + } + + .label { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20rpx; + } + + .time { + display: flex; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + + image { + width: 24rpx; + height: 24rpx; + margin-right: 19rpx; + } + } + } + + .label { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + flex-shrink: 0; + } + + .name-input { + text-align: right; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + } + + .switch-box { + display: flex; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + } + + .tagList { + display: flex; + flex-wrap: wrap; + .tagItem { + width: 231rpx; + height: 49rpx; + background: #E7EDF8; + border-radius: 25rpx; + display: flex; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + padding-left: 12rpx; + box-sizing: border-box; + margin-bottom: 20rpx; + margin-right: 20rpx; + + .icon_delete { + margin-left: 15rpx; + width: 16rpx; + height: 18rpx; + } + } + } + + .operations { + display: flex; + justify-content: space-between; + width: 100%; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + margin-top: 23rpx; + + view { + display: flex; + align-items: center; + + .icon_add { + width: 26rpx; + height: 26rpx; + margin-right: 10rpx; + } + + .icon_contact { + width: 25rpx; + height: 25rpx; + margin-right: 10rpx; + } + } + } + + } +} + +.btn-box { + display: flex; + justify-content: center; + margin-top: 80rpx; +} + +.member-shadow { + width: 558rpx; + box-sizing: border-box; + padding: 56rpx 66rpx; + background: linear-gradient(#F9EBDB, #FFFFFF 112rpx); + border-radius: 24rpx; + position: relative; + + .cancel { + position: absolute; + top: 0; + right: 10rpx; + width: 31rpx; + height: 31rpx; + padding: 21rpx; + } + + .title { + padding-top: 30rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #502B16; + margin-bottom: 30rpx; + } + + .price { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + margin-bottom: 30rpx; + + text { + color: #FF5129; + font-weight: bold; + } + } + + .grid-box { + display: flex; + justify-content: space-between; + + .grid-item { + display: flex; + flex-direction: column; + align-items: center; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + color: #502B16; + text-align: center; + width: 86rpx; + + image { + width: 74rpx; + height: 85rpx; + margin-bottom: 22rpx; + } + } + } + + .btn-box { + position: relative; + z-index: 2; + } + + .bg { + position: absolute; + bottom: 0; + right: 0; + width: 256rpx; + height: 273rpx; + z-index: 1; + } +} + +.addPhone-shadow { + width: 558rpx; + background: #FFFFFF; + + box-sizing: border-box; + border-radius: 24rpx; + + .title { + padding: 64rpx 55rpx 0 60rpx; + text-align: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + line-height: 30rpx; + margin-bottom: 58rpx; + + } + + .form { + padding: 0 55rpx 0 60rpx; + + .border_input { + width: 100%; + height: 70rpx; + background: #FFFFFF; + border: 1rpx solid #E6E6E6; + border-radius: 10rpx; + box-sizing: border-box; + margin-bottom: 58rpx; + padding-left: 28rpx; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + } + } + + .btns { + display: flex; + border-top: 1px solid #E9E9E9; + justify-content: space-evenly; + + .btn { + flex: 1; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + } + + .btn_cancel { + display: flex; + align-items: center; + justify-content: center; + height: 98rpx; + color: #838383; + } + + .btn_ok { + display: flex; + align-items: center; + justify-content: center; + border-left: 1px solid #E9E9E9; + color: #3A61B1; + height: 98rpx; + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/certificateCreate/certificateCreate.ts b/miniprogram/pages/certificateCreate/certificateCreate.ts new file mode 100644 index 0000000..3a600fd --- /dev/null +++ b/miniprogram/pages/certificateCreate/certificateCreate.ts @@ -0,0 +1,283 @@ +// pages/certificateCreate/certificateCreate.ts +import { certificateSave } from '../../apis/report' +import { getPayInfo } from '../../apis/pay' +import { timeCheck } from "../../apis/inspection" +import { parseTime } from "../../utils/index" +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + id: '', + name: '', + authorizationTimes: '', + endDate: '', + + startDate: parseTime(new Date().getTime(), '{y}-{m}-{d}'), + isEveryone: false, + unNum: false, + unTime: false, + + dayPrice: '0.00', + electronicCertificateSinglePayment: '0.00', + memberShow: false, + etcDefaultName: '', + whiteList: [], + phone: '', + addPhoneShow: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options: any) { + const { id } = options + this.setData({ + id + }) + this.getNum() + this.getPrice() + this.nameInit() + }, + nameInit() { + const now = new Date(); + + let etcDefaultName = + now.getFullYear() + + "" + + (now.getMonth() + 1 < 10 + ? "0" + (now.getMonth() + 1) + : now.getMonth() + 1) + + "" + + (now.getDate() < 10 ? "0" + now.getDate() : now.getDate()) + + "" + + (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + + (now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes()) + + (now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds()); + + this.setData({ + etcDefaultName: etcDefaultName + ',可点击修改' + }) + }, + submit() { + const { id, name, authorizationTimes, endDate, unNum, unTime, etcDefaultName, whiteList, isEveryone } = this.data + // if (!name) { + // wx.showToast({ + // icon: 'none', + // title: '请输入证书名称' + // }) + // return + // } + if (!unNum && !authorizationTimes) { + wx.showToast({ + icon: 'none', + title: '请输入查看次数' + }) + return + } + if (!unTime && !endDate) { + wx.showToast({ + icon: 'none', + title: '请选择授权期限' + }) + return + } + certificateSave({ + reportId: id, + name: name ? name : etcDefaultName.split(',')[0], + authorizationTimes: unNum ? undefined : authorizationTimes, + endDate: unTime ? undefined : (new Date(endDate + ' 23:59:59').getTime() / 1000), + whiteList: isEveryone ? undefined : whiteList.toString() + }).then(() => { + this.hideShadow() + wx.showToast({ + icon: 'none', + title: '创建成功!' + }) + wx.navigateBack({ + delta: 1 + }) + }).catch(err => { + if (err.c === 501005) { + this.showShadow() + } else { + this.hideShadow() + } + }) + }, + buyOnce() { + app.pay('ELECTRONIC_CERTIFICATE_SINGLE_PAYMENT').then(() => { + this.submit() + }) + }, + getNum() { + if (!app.memberVerify()) return + timeCheck().then((res: any) => { + this.setData({ + num: res.d + }) + }) + }, + getPrice() { + getPayInfo({}).then((res: any) => { + const { electronicCertificateSinglePayment, annualFee } = res.d + this.setData({ + electronicCertificateSinglePayment, + dayPrice: (annualFee / 100 / 356).toFixed(2) + }) + }) + }, + jumpMember() { + wx.navigateTo({ + url: '/pages/member/member' + }) + this.hideShadow() + }, + showShadow() { + this.setData({ + memberShow: true + }) + }, + hideShadow() { + this.setData({ + memberShow: false + }) + }, + bindDateChange(e: WechatMiniprogram.CustomEvent) { + const { value } = e.detail + this.setData({ + endDate: value + }) + }, + switchChange(e: WechatMiniprogram.CustomEvent) { + const { key } = e.currentTarget.dataset + const { value } = e.detail + this.setData({ + [key]: value + }) + }, + showAddPhone() { + this.setData({ + addPhoneShow: true + }) + }, + handleContact() { + let { whiteList } = this.data + wx.chooseContact({ + success: t => { + let temp = t.phoneNumber.replaceAll('-', '').replaceAll(' ', '') + if (temp.length !== 11) { + wx.showToast({ + icon: 'none', + title: '手机号格式错误!' + }) + return + } else { + whiteList.push(temp) + this.setData({ + whiteList + }) + } + }, + fail: e => console.log(e), + complete: () => { } + }) + }, + closeAddPhone() { + this.setData({ + addPhoneShow: false + }) + }, + addPhone() { + let { whiteList, phone } = this.data + + if (!phone) { + wx.showToast({ + icon: 'none', + title: '请输入授权手机号' + }) + return + } + if (phone.length !== 11) { + wx.showToast({ + icon: 'none', + title: '手机号格式错误' + }) + return + } + // console.log(phone); + if (whiteList.indexOf(phone) > -1) { + wx.showToast({ + icon: 'none', + title: '已添加该手机号' + }) + return + } + whiteList.push(phone) + this.setData({ + whiteList, + addPhoneShow: false, + phone: '' + }) + }, + handleDeletePhone(e) { + let { whiteList } = this.data + whiteList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + whiteList + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) + +export { } diff --git a/miniprogram/pages/certificateCreate/certificateCreate.wxml b/miniprogram/pages/certificateCreate/certificateCreate.wxml new file mode 100644 index 0000000..76f1dfc --- /dev/null +++ b/miniprogram/pages/certificateCreate/certificateCreate.wxml @@ -0,0 +1,133 @@ + + + 新建电子证书 + + + 电子证书名称 + + + + + 授权查看人 + + + + 所有人  + + + + {{item}} + + + + + 添加 + + + 通讯录获取 + + + + + + + 允许查看次数 + + + 不限次数 + + + + + + + 授权期限 + + + 不限时间 + + + + + + {{endDate || '选择截止时间'}} + + + + + + 确认新建 + + + + + + 开通年费会员 获免费次数 + 低至{{dayPrice}}元/天 + + + + 电子证书特权 + + + + 查验特权 + + + + 应答特权 + + + + 批量处理 + + + + 点击购买年费会员 + + + 购买单次¥{{electronicCertificateSinglePayment / 100}} + + + + + + + + 授权手机号 + + + 取消 + 确定 + + + + + \ No newline at end of file diff --git a/miniprogram/pages/certification/certification.json b/miniprogram/pages/certification/certification.json new file mode 100644 index 0000000..5c60915 --- /dev/null +++ b/miniprogram/pages/certification/certification.json @@ -0,0 +1,9 @@ +{ + "navigationBarBackgroundColor": "#3A61B1", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "实名认证", + "usingComponents": { + "btn": "/components/btn/btn", + "shadow": "/components/shadow/shadow" + } +} \ No newline at end of file diff --git a/miniprogram/pages/certification/certification.scss b/miniprogram/pages/certification/certification.scss new file mode 100644 index 0000000..4e077bf --- /dev/null +++ b/miniprogram/pages/certification/certification.scss @@ -0,0 +1,279 @@ +/* pages/certification/certification.wxss */ +.step-box{ + background: #3A61B1; + box-sizing: border-box; + padding-top: 30rpx; + padding-bottom: 88rpx; + display: flex; + justify-content: center; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #B3C2E1; + .step-item{ + width: 145rpx; + display: flex; + flex-direction: column; + align-items: center; + image{ + width: 65rpx; + height: 65rpx; + margin-bottom: 20rpx; + } + } + .line{ + width: 142rpx; + height: 3rpx; + background: #ECEEF3; + opacity: 0.12; + margin-top: 32rpx; + } +} + +.white-box{ + background: #fff; + border-radius: 32rpx; + margin-top: -32rpx; + box-sizing: border-box; + padding: 47rpx; + .title-box{ + display: flex; + justify-content: space-between; + align-items: center; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + .edit-box{ + display: flex; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #2F88DB; + image{ + width: 29rpx; + height: 28rpx; + margin-right: 10rpx; + } + } + } + .description{ + display: flex; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #B3B3B3; + margin-top: 18rpx; + image{ + width: 20rpx; + height: 20rpx; + margin-right: 10rpx; + } + } + .form-box{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 15rpx; + .form-item{ + display: flex; + align-items: center; + box-sizing: border-box; + padding: 40rpx 30rpx; + border-bottom: 1rpx solid #D7D7D7; + &:last-child{ + border: none; + } + text{ + margin-right: 43rpx; + } + } + } + .btn-box{ + display: flex; + justify-content: center; + margin-top: 10rpx; + } + .table-box{ + .table-title{ + display: flex; + justify-content: space-around; + margin-top: 80rpx; + + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + } + .table-content{ + border: 1rpx solid #E6E6E6; + display: flex; + margin-top: 40rpx; + + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #6E6E6E; + .table-col{ + display: flex; + flex-direction: column; + justify-content: center; + box-sizing: border-box; + width: 50%; + padding: 40rpx; + &:last-child{ + border-left: 1rpx solid #E6E6E6; + } + .item{ + display: flex; + align-items: center; + margin-bottom: 58rpx; + &:last-child{ + margin-bottom: 0; + } + image{ + width: 63rpx; + height: 63rpx; + margin-right: 32rpx; + flex-shrink: 0; + } + } + } + } + } + + .field-box{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 50rpx; + .field-item{ + display: flex; + margin-bottom: 46rpx; + text{ + margin-right: 43rpx; + } + } + } + .information{ + box-sizing: border-box; + padding: 30rpx; + border-radius: 10rpx; + background: #FFF7F1; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + line-height: 36rpx; + color: #FE633A; + } + .price-box{ + display: flex; + flex-direction: column; + align-items: flex-end; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + margin-top: 48rpx; + .price{ + font-size: 24rpx; + font-weight: 500; + font-family: PingFang SC; + color: #FF5129; + margin-top: 24rpx; + text{ + font-size: 48rpx; + font-weight: 800; + + } + } + } + .bottom-box{ + position: fixed; + left: 0; + bottom: 0; + width: 100%; + box-shadow: 0 0 18rpx #CCCCCC; + box-sizing: border-box; + padding: 24rpx 50rpx; + padding-bottom: calc(constant(safe-area-inset-top) + 24rpx); + padding-bottom: calc(env(safe-area-inset-top) + 24rpx); + } +} + +.payShadow{ + width: 100%; + background: #FFF; + border-radius: 24rpx 24rpx 0 0; + padding-bottom: 50rpx; + .cancel-box{ + box-sizing: border-box; + padding: 10rpx; + display: flex; + align-items: center; + justify-content: space-between; + image{ + width: 31rpx; + height: 31rpx; + padding: 20rpx; + } + text{ + padding: 20rpx; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #2F88DB; + } + } + .pay-info-box{ + display: flex; + flex-direction: column; + align-items: center; + .title{ + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + margin-bottom: 24rpx; + } + .price-box{ + font-size: 40rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FF5129; + margin-bottom: 32rpx; + text{ + font-size: 80rpx; + font-weight: 800; + } + } + .time{ + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + margin-bottom: 60rpx; + } + .pay-type{ + display: flex; + align-items: center; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + width: 100%; + box-sizing: border-box; + padding: 0 56rpx; + margin-bottom: 100rpx; + image{ + width: 43rpx; + height: 43rpx; + margin-right: 16rpx; + } + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/certification/certification.ts b/miniprogram/pages/certification/certification.ts new file mode 100644 index 0000000..457d3e8 --- /dev/null +++ b/miniprogram/pages/certification/certification.ts @@ -0,0 +1,149 @@ +// pages/certification/certification.ts +import { getPayInfo } from '../../apis/pay' +import { realNameAuthentication } from '../../apis/login' +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + step: 1, + name: '', + idCard: '', + phoneNumber: app.globalData.userInfo?.username, + info: {}, + payShow: false, + isRefresh: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + phoneNumber: app.globalData.userInfo?.username, + idCard: options.idCard === '' ? '' : app.globalData.userInfo?.idCard, + name: options.idCard === '' ? '' : app.globalData.userInfo?.name, + isRefresh: options.idCard !== '' + }) + this.getInfo() + }, + getInfo() { + getPayInfo({}).then((res: any) => { + this.setData({ + info: res.d + }) + }) + }, + pay() { + const { name, idCard, phoneNumber,isRefresh } = this.data + realNameAuthentication({ + name, idCard, phoneNumber, + wxPayApiType: 'JSAPI', + authType:isRefresh?'PHONE_REFRESH':'FIRST' + }).then((res: any) => { + console.log(res) + wx.requestPayment({ + ...res.d, + success: (res: any) => { + console.log(res) + wx.navigateTo({ + url: '/pages/certificationResult/certificationResult' + }) + }, + fail: (err: any) => { + console.log(err) + wx.showToast({ + icon: 'none', + title: '支付失败, 请稍后再试!' + }) + } + }) + }) + }, + showShadow() { + this.setData({ + payShow: true + }) + }, + hideShadow() { + this.setData({ + payShow: false + }) + }, + next() { + const { name, idCard } = this.data + if (!name) { + wx.showToast({ + icon: 'none', + title: '请输入您的真实姓名' + }) + return + } + if (!idCard) { + wx.showToast({ + icon: 'none', + title: '请输入您的身份证号' + }) + return + } + this.setData({ + step: 2 + }) + }, + edit() { + this.setData({ + step: 1 + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/certification/certification.wxml b/miniprogram/pages/certification/certification.wxml new file mode 100644 index 0000000..53badad --- /dev/null +++ b/miniprogram/pages/certification/certification.wxml @@ -0,0 +1,129 @@ + + + + + + 输入信息 + + + + + 确认并支付 + + + + + 认证结果 + + + + + 实名信息 + + + 返回修改 + + + + + + 为顺利完成实名认证,请准确输入您的个人身份信息。 + + + + 真实姓名 + + + + 身份证号 + + + + 手机号码 + + + + + + 提交并进入下一步 + + + + + 实名用户 + 非实名用户 + + + + + + 查看所有数据 + + + + 可以自填数据 + + + + 可对信息发起勘误申请 + + + + 对他人查看设置应答 + + + + + + 无法查看所有数据详情 + + + + + + + + + + 真实姓名 + {{name}} + + + 身份证号 + {{idCard}} + + + 手机号码 + {{phoneNumber}} + + + 本次服务由国家级大数据平台提供实名匹配认证,认证成功后可查看数据档案详情,补充自填信息,申请勘误,生成个人信息报告。请仔细核实认证信息,若因数据档案填写失误造成认证失败,此次认证费用将无法退还。 + + 支付金额 + ¥{{info.realNameAuthentication / 100}} + + + 信息确认无误,立即支付 + + + + + + + + + + + + 支付金额 + ¥{{info.realNameAuthentication / 100}} + + 确认付款 + + + + diff --git a/miniprogram/pages/certificationResult/certificationResult.json b/miniprogram/pages/certificationResult/certificationResult.json new file mode 100644 index 0000000..a30e2da --- /dev/null +++ b/miniprogram/pages/certificationResult/certificationResult.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "实名认证", + "usingComponents": { + "btn": "/components/btn/btn" + } +} \ No newline at end of file diff --git a/miniprogram/pages/certificationResult/certificationResult.scss b/miniprogram/pages/certificationResult/certificationResult.scss new file mode 100644 index 0000000..a1f7efa --- /dev/null +++ b/miniprogram/pages/certificationResult/certificationResult.scss @@ -0,0 +1,29 @@ +/* pages/certificationResult/certificationResult.wxss */ +.certification-result-page{ + display: flex; + flex-direction: column; + align-items: center; + padding-top: 170rpx; + image{ + width: 170rpx; + height: 219rpx; + margin-bottom: 10rpx; + } + .title{ + font-size: 36rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-bottom: 36rpx; + } + .description{ + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + line-height: 36rpx; + opacity: 0.61; + text-align: center; + margin-bottom: 36rpx; + } +} \ No newline at end of file diff --git a/miniprogram/pages/certificationResult/certificationResult.ts b/miniprogram/pages/certificationResult/certificationResult.ts new file mode 100644 index 0000000..27c2146 --- /dev/null +++ b/miniprogram/pages/certificationResult/certificationResult.ts @@ -0,0 +1,100 @@ +// pages/certificationResult/certificationResult.ts +const app = getApp() +import { realNameAuthenticationResultCheck } from '../../apis/login' +Page({ + + /** + * 页面的初始数据 + */ + data: { + status: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.getData() + }, + + async getData() { + await app.getUserInfo() + realNameAuthenticationResultCheck().then((res:any) => { + let status + switch (res.d) { + case '认证成功': + status = 'success' + break; + case '认证失败': + status = 'fail' + break; + case '认证异常': + status = 'warning' + break; + } + this.setData({ + status + }) + }) + + }, + jumpInfomation() { + wx.reLaunch({ + url: '/pages/information/information' + }) + }, + back() { + wx.navigateBack({ + delta: 1 + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/certificationResult/certificationResult.wxml b/miniprogram/pages/certificationResult/certificationResult.wxml new file mode 100644 index 0000000..bc5b7ff --- /dev/null +++ b/miniprogram/pages/certificationResult/certificationResult.wxml @@ -0,0 +1,11 @@ + + + + 实名认证成功! + 实名认证失败! + 发生了一点异常... + 您提供的实名认证信息有误,认证失败。\n请提供准确信息重新认证 + 因数据库异常暂时无法进行实名认证,请稍后重试,\n此次认证费用将原路退回。 + 返回数据档案 + 重新认证 + diff --git a/miniprogram/pages/certificationResult/certificationResult.wxss b/miniprogram/pages/certificationResult/certificationResult.wxss new file mode 100644 index 0000000..a3767b4 --- /dev/null +++ b/miniprogram/pages/certificationResult/certificationResult.wxss @@ -0,0 +1 @@ +/* pages/certificationResult/certificationResult.wxss */ \ No newline at end of file diff --git a/miniprogram/pages/corrigendum/corrigendum.json b/miniprogram/pages/corrigendum/corrigendum.json new file mode 100644 index 0000000..2c8188b --- /dev/null +++ b/miniprogram/pages/corrigendum/corrigendum.json @@ -0,0 +1,8 @@ +{ + "navigationStyle": "custom", + "navigationBarTextStyle": "white", + "usingComponents": { + "btn": "/components/btn/btn", + "navBar": "/components/navBar/navBar" + } +} \ No newline at end of file diff --git a/miniprogram/pages/corrigendum/corrigendum.scss b/miniprogram/pages/corrigendum/corrigendum.scss new file mode 100644 index 0000000..bde0aca --- /dev/null +++ b/miniprogram/pages/corrigendum/corrigendum.scss @@ -0,0 +1,71 @@ +/* pages/corrigendum/corrigendum.wxss */ +.corrigendum-page { + padding: 27rpx 55rpx 178rpx 55rpx; + .dataName{ + font-size: 36rpx; +font-family: PingFang SC; +font-weight: bold; +color: #333333; + } + .dataRecord { + border-bottom: 2rpx solid #F3F5F8; + padding-bottom: 40rpx; + margin-bottom: 40rpx; + + .tip { + background: #FFF7F1; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + color: #FE633A; + line-height: 36rpx; + padding: 28rpx 29rpx 34rpx 30rpx; + margin-bottom: 34rpx; + } + + .row1 { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #494949; + margin-bottom: 37rpx; + } + + + + } + + .row2 { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + line-height: 44rpx; + word-break: break-all; + } + + .mb29 { + margin-bottom: 29rpx; + } + + .mb23 { + margin-bottom: 23rpx; + } + + .mb30 { + margin-bottom: 30rpx; + } + + .submitLayout { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + background: #fff; + height: 160rpx; + display: flex; + justify-content: space-evenly; + align-items: center; + box-shadow: 0px 0px 18rpx 0rpx #CCCCCC; + } +} \ No newline at end of file diff --git a/miniprogram/pages/corrigendum/corrigendum.ts b/miniprogram/pages/corrigendum/corrigendum.ts new file mode 100644 index 0000000..ecdfc9f --- /dev/null +++ b/miniprogram/pages/corrigendum/corrigendum.ts @@ -0,0 +1,113 @@ +// pages/corrigendum/corrigendum.ts +import { corrigendaApply, dataRecord } from "../../apis/information"; +Page({ + + /** + * 页面的初始数据 + */ + data: { + id: '', + record: {}, + content: '' + }, + handleApply() { + const { content, record } = this.data + + if (!content) { + wx.showToast({ + icon: 'none', + title: `请输入勘误内容` + }) + return + } + + let payload = { + applyRemark: content, + data: { + ...record + } + } + + corrigendaApply(payload).then(res => { + wx.showToast({ + icon: 'none', + title: `提交勘误成功` + }) + wx.navigateBack({ + delta: 1 + }) + }) + }, + getDataRecord(id: string | undefined) { + dataRecord(id).then((res: any) => { + // console.log(res); + if (res.c === 200) { + this.setData({ + record: res.d[0], + // current: res.d[0] + }) + } + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + // this.setData({ + // record: wx.getStorageSync('corrigendumInfo') + // }) + this.setData({ + id: options.id + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.getDataRecord(this.data.id) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/corrigendum/corrigendum.wxml b/miniprogram/pages/corrigendum/corrigendum.wxml new file mode 100644 index 0000000..f544d29 --- /dev/null +++ b/miniprogram/pages/corrigendum/corrigendum.wxml @@ -0,0 +1,28 @@ + + + + 我要勘误 + + + 请详细描述您需要勘误的内容和问题,您的勘误申请将 + 提交至数据来源方{{record.dataSourceName}},联系方式:{{record.businessPhone}} + 对方核实无误后将完成勘误。 + {{record.dataSourceName}}{{record.dataSourceType==='CONSUMER'?'自填':'添加'}}于 + + + 采集时间: + + + 收录时间: + + + 数据内容: + {{record.dataValue}} + + 勘误内容 + + + + 提交勘误 + + \ No newline at end of file diff --git a/miniprogram/pages/corrigendum/corrigendum.wxss b/miniprogram/pages/corrigendum/corrigendum.wxss new file mode 100644 index 0000000..13c91c1 --- /dev/null +++ b/miniprogram/pages/corrigendum/corrigendum.wxss @@ -0,0 +1 @@ +/* pages/corrigendum/corrigendum.wxss */ \ No newline at end of file diff --git a/miniprogram/pages/createReport/createReport.json b/miniprogram/pages/createReport/createReport.json new file mode 100644 index 0000000..44cdc68 --- /dev/null +++ b/miniprogram/pages/createReport/createReport.json @@ -0,0 +1,9 @@ +{ + "navigationStyle": "custom", + "navigationBarTextStyle": "white", + "usingComponents": { + "btn": "/components/btn/btn", + "navBar": "/components/navBar/navBar", + "message-box": "/components/message/message" + } +} diff --git a/miniprogram/pages/createReport/createReport.scss b/miniprogram/pages/createReport/createReport.scss new file mode 100644 index 0000000..9d3060e --- /dev/null +++ b/miniprogram/pages/createReport/createReport.scss @@ -0,0 +1,63 @@ +/* pages/createReport/createReport.wxss */ +.form { + padding: 0rpx 54rpx; + + .formItem { + font-size: 28rpx; + display: flex; + justify-content: space-between; + padding-top: 40rpx; + padding-bottom: 40rpx; + + &:not(:first-child) { + border-top: 2rpx solid #F3F5F8; + // margin-top: 40rpx; + padding-bottom: 0; + } + + .name { + text-align: right; + } + } +} + +.column { + flex-direction: column; +} + +.title { + font-size: 36rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + margin-bottom: 30rpx; + padding: 48rpx 54rpx 0 54rpx; +} + +.tip { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: rgba(131, 131, 131, .61); + padding-left: 55rpx; + + image { + width: 20rpx; + height: 20rpx; + margin-right: 12rpx; + } +} + +.label { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; +} + +.btnLayout { + display: flex; + justify-content: center; + align-items: center; + margin: 270rpx auto; +} \ No newline at end of file diff --git a/miniprogram/pages/createReport/createReport.ts b/miniprogram/pages/createReport/createReport.ts new file mode 100644 index 0000000..f96165d --- /dev/null +++ b/miniprogram/pages/createReport/createReport.ts @@ -0,0 +1,112 @@ +// pages/createReport/createReport.ts +import { reportSave } from "../../apis/report"; +Page({ + + /** + * 页面的初始数据 + */ + data: { + dataIds: [], + name: '', + remark: '', + reportFormDefaultName: '' + }, + createReport() { + const { dataIds, name, remark, reportFormDefaultName } = this.data + + reportSave({ + dataIds, + name: name === '' ? reportFormDefaultName.split(',')[0] : name, + remark + }).then(res => { + if (res.c === 200) { + this.selectComponent('#' + 'shadow2').show() + } + }) + }, + jumpReportList() { + wx.switchTab({ + url: '/pages/report/report' + }) + }, + nameInit() { + const now = new Date(); + + let reportFormDefaultName = + now.getFullYear() + + "" + + (now.getMonth() + 1 < 10 + ? "0" + (now.getMonth() + 1) + : now.getMonth() + 1) + + "" + + (now.getDate() < 10 ? "0" + now.getDate() : now.getDate()) + + "" + + (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + + (now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes()) + + (now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds()); + console.log(reportFormDefaultName); + + this.setData({ + reportFormDefaultName:reportFormDefaultName+',可点击修改' + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.nameInit() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + dataIds: wx.getStorageSync('reportIds') + }) + this.nameInit() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/createReport/createReport.wxml b/miniprogram/pages/createReport/createReport.wxml new file mode 100644 index 0000000..5923965 --- /dev/null +++ b/miniprogram/pages/createReport/createReport.wxml @@ -0,0 +1,25 @@ + + + + + 设置报告名称 + + 报告名称不对外展示,仅方便个人区别 + + + + + 报告名称 + + + + 描述 + + + + + 立即生成个人信息报告 + + + + \ No newline at end of file diff --git a/miniprogram/pages/dataRecords/dataRecords.json b/miniprogram/pages/dataRecords/dataRecords.json new file mode 100644 index 0000000..2c8188b --- /dev/null +++ b/miniprogram/pages/dataRecords/dataRecords.json @@ -0,0 +1,8 @@ +{ + "navigationStyle": "custom", + "navigationBarTextStyle": "white", + "usingComponents": { + "btn": "/components/btn/btn", + "navBar": "/components/navBar/navBar" + } +} \ No newline at end of file diff --git a/miniprogram/pages/dataRecords/dataRecords.scss b/miniprogram/pages/dataRecords/dataRecords.scss new file mode 100644 index 0000000..40a0ca2 --- /dev/null +++ b/miniprogram/pages/dataRecords/dataRecords.scss @@ -0,0 +1,98 @@ +/* pages/dataRecords/dataRecords.wxss */ +.dataRecords-page { + padding: 39rpx 46rpx 160rpx 89rpx; + + .dataName { + font-size: 36rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; + } + + .dataRecords { + .dataRecord { + border-bottom: 1px solid #F3F5F8; + padding: 0 0 42rpx 0; + margin-bottom: 50rpx; + position: relative; + + &:not(:first-child) { + &::before { + content: ''; + border-left: 2rpx solid #F3F5F8; + position: absolute; + left: -27rpx; + height: 118%; + top: -222rpx; + } + } + + .row1 { + font-size: 33rpx; + font-family: PingFang SC; + font-weight: bold; + color: #494949; + position: relative; + margin-bottom: 38rpx; + word-break: break-all; + + &::before { + content: ''; + width: 22rpx; + height: 22rpx; + background: #EDEDED; + border-radius: 50%; + position: absolute; + left: -35rpx; + top: 12rpx; + } + } + + .row2 { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + margin-bottom: 33rpx; + word-break: break-all; + &:last-child{ + margin-bottom: 23rpx; + } + } + } + + .current { + .row1 { + font-size: 33rpx; + font-family: PingFang SC; + font-weight: bold; + color: #494949; + position: relative; + + &::before { + content: ''; + width: 16rpx; + height: 16rpx; + background: #3A61B1; + border-radius: 50%; + position: absolute; + left: -35rpx; + top: 12rpx; + } + } + } + } + + .submitLayout { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + background: #fff; + height: 160rpx; + display: flex; + justify-content: space-evenly; + align-items: center; + box-shadow: 0px 0px 18rpx 0rpx #CCCCCC; + } +} \ No newline at end of file diff --git a/miniprogram/pages/dataRecords/dataRecords.ts b/miniprogram/pages/dataRecords/dataRecords.ts new file mode 100644 index 0000000..8664af0 --- /dev/null +++ b/miniprogram/pages/dataRecords/dataRecords.ts @@ -0,0 +1,111 @@ +// pages/dataRecords/dataRecords.ts +import { dataRecord } from "../../apis/information"; +Page({ + + /** + * 页面的初始数据 + */ + data: { + id: undefined, + current: {}, + records: [], + formName: '' + }, + + handleEdit() { + // console.log(e); + const { records } = this.data + // const { value } = e.currentTarget.dataset + let value = records[0] + const { formName } = this.data + // let formName = wx.getStorageSync("informationName") + wx.setStorageSync('informationEditInfo', value) + + wx.setStorageSync('informationEditDataName', formName === '职业经历' ? (value.dataName === '内容' ? '岗位描述' : value.dataName) : (value.dataName === '内容' ? '事件描述' : value.dataName)) + wx.navigateTo({ + url: `/pages/informationEdit/informationEdit?type=edit` + }) + }, + handleCorrigendum() { + const { current, id } = this.data + wx.setStorageSync('corrigendumInfo', current) + wx.navigateTo({ + url: `/pages/corrigendum/corrigendum?id=${id}` + }) + }, + + getDataRecord(id: string | undefined) { + dataRecord(id).then((res: any) => { + console.log(res); + if (res.c === 200) { + this.setData({ + records: res.d, + current: res.d[0] + }) + } + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let { id } = options + this.setData({ + id: options.id, + formName: wx.getStorageSync('informationName') + }) + // this.getDataRecord(id) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // console.log('onShow'); + + this.getDataRecord(this.data.id) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/dataRecords/dataRecords.wxml b/miniprogram/pages/dataRecords/dataRecords.wxml new file mode 100644 index 0000000..676aefe --- /dev/null +++ b/miniprogram/pages/dataRecords/dataRecords.wxml @@ -0,0 +1,30 @@ + + + + {{formName === '职业经历' ? (records[0].dataName === '内容' ? '岗位描述' : records[0].dataName) : (records[0].dataName === '内容' ? '事件描述' : records[0].dataName)}} + + + + {{item.dataSourceName}}{{item.dataSourceType==='CONSUMER'?'自填':'添加'}}于 + + + 采集时间: + + + 收录时间: + + + 数据内容: + {{item.dataValue}} + + + + + + 修改 + + + 我要勘误 + + + \ No newline at end of file diff --git a/miniprogram/pages/errataDetail/errataDetail.json b/miniprogram/pages/errataDetail/errataDetail.json new file mode 100644 index 0000000..de42a93 --- /dev/null +++ b/miniprogram/pages/errataDetail/errataDetail.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "勘误详情", + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/errataDetail/errataDetail.scss b/miniprogram/pages/errataDetail/errataDetail.scss new file mode 100644 index 0000000..3a8c77c --- /dev/null +++ b/miniprogram/pages/errataDetail/errataDetail.scss @@ -0,0 +1,57 @@ +/* pages/errataDetail/errataDetail.wxss */ +.errata-detail-page{ + box-sizing: border-box; + padding: 55rpx; +} +.field-box{ + padding-bottom: 20rpx; + border-bottom: 1rpx solid #F3F5F8; + margin-bottom: 46rpx; + .field-item{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + display: flex; + margin-bottom: 28rpx; + .label{ + flex-shrink: 0; + color: #838383; + } + } +} +.remark-box{ + .remark-item{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + line-height: 36rpx; + + margin-bottom: 58rpx; + .label{ + color: #494949; + display: flex; + align-items: center; + margin-bottom: 26rpx; + } + .status{ + width: 92rpx; + height: 34rpx; + background: #E9E9E9; + border-radius: 10rpx; + display: flex; + align-items: center; + justify-content: center; + + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #AFAFAF; + &.warning{ + background: #FFD2CC; + color: #FF4931; + } + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/errataDetail/errataDetail.ts b/miniprogram/pages/errataDetail/errataDetail.ts new file mode 100644 index 0000000..e234141 --- /dev/null +++ b/miniprogram/pages/errataDetail/errataDetail.ts @@ -0,0 +1,72 @@ +// pages/errataDetail/errataDetail.ts +Page({ + + /** + * 页面的初始数据 + */ + data: { + info: wx.getStorageSync('errataDetail'), + status: { + WAIT: '待处理', + PROCESSED: '已处理' + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.setData({ + info: wx.getStorageSync('errataDetail') + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/errataDetail/errataDetail.wxml b/miniprogram/pages/errataDetail/errataDetail.wxml new file mode 100644 index 0000000..b86826f --- /dev/null +++ b/miniprogram/pages/errataDetail/errataDetail.wxml @@ -0,0 +1,30 @@ + + + + + 字段名称:{{info.data.dataName}} + + + 数据来源:{{info.data.dataSourceName}} + + + 采集时间: + + + 收录时间: + + + 数据内容:{{info.data.dataValue}} + + + + + 勘误内容: + {{info.applyRemark || '无'}} + + + 勘误结果:{{status[info.status]}} + 备注:{{info.dealRemark}} + + + diff --git a/miniprogram/pages/errataRecords/errataRecords.json b/miniprogram/pages/errataRecords/errataRecords.json new file mode 100644 index 0000000..df95309 --- /dev/null +++ b/miniprogram/pages/errataRecords/errataRecords.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "勘误记录", + "usingComponents": { + "not": "/components/not/not" + } +} \ No newline at end of file diff --git a/miniprogram/pages/errataRecords/errataRecords.scss b/miniprogram/pages/errataRecords/errataRecords.scss new file mode 100644 index 0000000..4c36140 --- /dev/null +++ b/miniprogram/pages/errataRecords/errataRecords.scss @@ -0,0 +1,50 @@ +/* pages/errataRecords/errataRecords.wxss */ +page{ + background: #F6F6F6; +} +.errata-records-page{ + box-sizing: border-box; + padding: 20rpx 30rpx; +} + +.white-box{ + background: #FFFFFF; + border-radius: 16rpx; + box-sizing: border-box; + padding: 48rpx 40rpx; + margin-bottom: 20rpx; + + .time { + display: flex; + justify-content: space-between; + align-items: center; + + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #494949; + .status{ + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #AFAFAF; + &.warning{ + color: #FF4931; + } + } + } + .source{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + margin-top: 40rpx; + } + .phone{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + margin-top: 30rpx; + } +} \ No newline at end of file diff --git a/miniprogram/pages/errataRecords/errataRecords.ts b/miniprogram/pages/errataRecords/errataRecords.ts new file mode 100644 index 0000000..875560f --- /dev/null +++ b/miniprogram/pages/errataRecords/errataRecords.ts @@ -0,0 +1,105 @@ +// pages/errataRecords/errataRecords.ts +import { corrigendaList } from '../../apis/information' +Page({ + + /** + * 页面的初始数据 + */ + data: { + listQuery: { + current: 1 + }, + list: [], + status: { + WAIT: '待处理', + PROCESSED: '已处理' + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.setData({ + list: [], + ['listQuery.current']: 1 + }) + this.getList() + }, + + getList() { + corrigendaList(this.data.listQuery).then((res:any) => { + console.log(res) + const list = res.d.records + if (list.length) { + this.setData({ + list: this.data.list.concat(list) + }) + } else { + wx.showToast({ + icon: 'none', + title: '没有更多了!' + }) + } + }) + }, + jumpDetail(e: WechatMiniprogram.BaseEvent) { + const { item } = e.currentTarget.dataset + wx.setStorageSync('errataDetail', item) + wx.navigateTo({ + url: '/pages/errataDetail/errataDetail' + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + this.setData({ + ['listQuery.current']: this.data.listQuery.current + 1 + }) + this.getList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/errataRecords/errataRecords.wxml b/miniprogram/pages/errataRecords/errataRecords.wxml new file mode 100644 index 0000000..b024eef --- /dev/null +++ b/miniprogram/pages/errataRecords/errataRecords.wxml @@ -0,0 +1,14 @@ + + + + + + + {{status[item.status]}} + + 数据来源:{{item.name}} + 联系电话:{{item.phone}} + + + + diff --git a/miniprogram/pages/generateReport/generateReport.json b/miniprogram/pages/generateReport/generateReport.json new file mode 100644 index 0000000..e14ca6a --- /dev/null +++ b/miniprogram/pages/generateReport/generateReport.json @@ -0,0 +1,9 @@ +{ + "navigationBarBackgroundColor": "#3A61B1", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "勾选内容", + "usingComponents": { + "btn": "/components/btn/btn", + "shadow": "/components/shadow/shadow" + } +} \ No newline at end of file diff --git a/miniprogram/pages/generateReport/generateReport.scss b/miniprogram/pages/generateReport/generateReport.scss new file mode 100644 index 0000000..e7773b6 --- /dev/null +++ b/miniprogram/pages/generateReport/generateReport.scss @@ -0,0 +1,557 @@ +/* pages/generateReport/generateReport.wxss */ +.stepList { + background: #3A61B1; + display: flex; + justify-content: space-between; + padding: 63rpx 27rpx 84rpx 29rpx; + + .stepItem { + font-size: 22rpx; + color: #fff; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + position: relative; + + + + text { + margin-top: 31rpx; + } + + .stepIcon { + width: 56rpx; + height: 55rpx; + } + + .stepArrow { + width: 23rpx; + height: 16rpx; + position: absolute; + top: 22rpx; + left: -34rpx; + } + } +} + +.white-box { + background: #fff; + border-radius: 32rpx; + margin-top: -32rpx; + box-sizing: border-box; + padding: 47rpx; + + .stepContent { + padding-bottom: 160rpx; + + .noData { + margin: 204rpx auto; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #838383; + + image { + width: 369rpx; + height: 338rpx; + } + } + + .valueItemList { + display: flex; + flex-direction: column; + + checkbox { + flex: 0; + margin-right: 34rpx; + } + + .valueLabel { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #282828; + line-height: 50rpx; + margin-bottom: 34rpx; + display: flex; + } + + .value { + // display: flex; + flex: 100%; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + padding-left: 26rpx; + margin-bottom: 41rpx; + display: flex; + } + } + + .valueItem { + display: flex; + // justify-content: space-between; + // align-items: center; + margin-bottom: 60rpx; + + checkbox { + flex: 1; + margin-right: 34rpx; + } + + .valueBox { + flex: 1; + display: flex; + justify-content: space-between; + align-items: center; + } + + .valueLabel { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #282828; + line-height: 50rpx; + } + + .value { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + } + } + + .eduList { + .eduItem { + border-bottom: 2rpx solid #F3F5F8; + padding-bottom: 49rpx; + margin-bottom: 47rpx; + + &:last-child { + border-bottom: 0; + } + + // padding-bottom: 49rpx; + // border-bottom: 2rpx solid #F3F5F8; + // margin-bottom: 47rpx; + + // &:not(:last-child) { + // border-bottom: 0; + // margin-bottom: 0; + // } + + .itemPanel { + display: flex; + + .panel { + // padding-left: 34rpx; + flex: 1; + + // &:not(:first-child){ + + // } + + + .panel_top { + + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20rpx; + } + + .panel_bottom { + font-size: 30rpx; + font-family: PingFang SC; + font-weight: bold; + color: #282828; + } + } + + + } + + .contents { + margin-top: 57rpx; + padding-left: 34rpx; + + .content { + margin-bottom: 54rpx; + display: flex; + justify-content: space-between; + + .column { + flex-direction: column; + align-items: inherit !important + } + + .valueBox { + flex: 1; + display: flex; + // padding-left: 34rpx; + justify-content: space-between; + align-items: center; + + .valueLabel { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + } + + .value { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + line-height: 30rpx; + } + + .valueTextarea { + margin-top: 26rpx; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + line-height: 42rpx; + } + } + } + } + } + } + } + + // .panel { + // padding: 47rpx 0 49rpx 0; + + // &:not(:first-child) { + // border-top: 2px solid #F3F5F8; + // // padding: 47rpx 0 49rpx 0; + // } + + // .panel_top { + // font-size: 26rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #494949; + // display: flex; + // justify-content: space-between; + // align-items: center; + // margin-bottom: 20rpx; + + // .fold { + // width: 25rpx; + // height: 14rpx; + // flex-shrink: 0; + // transform: rotate(180deg); + // } + + // .unfold { + // width: 25rpx; + // height: 14rpx; + // flex-shrink: 0; + // } + // } + + // .panel_bottom { + // font-size: 30rpx; + // font-family: PingFang SC; + // font-weight: bold; + // color: #282828; + // } + + // .panel_content { + // .infoList { + // .infoItem { + // margin-bottom: 54rpx; + // display: flex; + // justify-content: space-between; + + // .valueLabel { + // font-size: 28rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #838383; + // } + + // .value { + // font-size: 28rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #494949; + // line-height: 30rpx; + // } + + // .eventTitle { + // font-size: 32rpx; + // font-family: PingFang SC; + // font-weight: bold; + // color: #282828; + // line-height: 50px; + // } + + // .eventList { + // .eventItem { + // margin-top: 45rpx; + + // .eventDate { + // font-size: 26rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #838383; + // margin-bottom: 19rpx; + // } + + // .eventContent { + // font-size: 26rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #494949; + // } + // } + // } + + + + // } + + + // .column { + // flex-direction: column; + // } + + // } + + // } + + // } + +} + + + +.fileList { + width: 100%; + + .fileItem { + // width: 598rpx; + height: 103rpx; + background: #F3F5F8; + border-radius: 10rpx; + display: flex; + align-items: center; + // justify-content: center; + word-break: break-all; + padding-left: 24rpx; + margin-top: 20rpx; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + + .icon_img { + width: 26rpx; + height: 26rpx; + margin-right: 18rpx; + } + } +} + +.eventList { + .eventTitle { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #282828; + line-height: 50rpx; + display: flex; + margin-bottom: 48rpx; + } + + .eventItem { + display: flex; + margin-bottom: 45rpx; + + &:not(:first-child) { + // border-top: 2rpx solid #F3F5F8; + padding-top: 40rpx; + } + + .eventBox { + width: 100%; + flex: 1; + + .eventDate { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + margin-bottom: 19rpx; + } + + .eventContent { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + } + } + } +} + +// .eventList { +// .eventItem { +// margin-top: 45rpx; +// .eventDate { +// font-size: 26rpx; +// font-family: PingFang SC; +// font-weight: 500; +// color: #838383; +// margin-bottom: 19rpx; +// } +// .eventContent { +// font-size: 26rpx; +// font-family: PingFang SC; +// font-weight: 500; +// color: #494949; +// } +// } +// } + +.btn_next { + display: flex; + position: fixed; + bottom: 0; + height: 160rpx; + align-items: center; + justify-content: space-between; + width: 100%; + padding: 24rpx 54rpx 54rpx 47rpx; + box-sizing: border-box; + background: #fff; + box-shadow: 2px -4px 18rpx rgba(204, 204, 204, .62); + + .curAllCheck { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #6E6E6E; + line-height: 30rpx + } + + .complate { + display: flex; + align-items: center; + } + + .preview { + margin-right: 26rpx; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #707070; + line-height: 50rpx; + } +} + + +.checkbox { + width: 32rpx; + height: 32rpx; + background: #FFFFFF; + border: 3rpx solid #D4D4D4; + border-radius: 6rpx; + margin-right: 34rpx; + position: relative; + top: 4rpx; + min-width: 32rpx; +} + +.half { + background: #fff; + position: relative; + border: 3rpx solid #3FB778; + margin-right: 34rpx; + + &::before { + content: ''; + width: 6rpx; + height: 14rpx; + border-bottom: 4rpx solid #3FB778; + border-right: 4rpx solid #3FB778; + position: absolute; + left: 12rpx; + top: 6rpx; + transform: rotate(45deg); + } +} + +.checked { + background: #3FB778; + position: relative; + border: 3rpx solid #3FB778; + margin-right: 34rpx; + + &::before { + content: ''; + width: 6rpx; + height: 14rpx; + border-bottom: 4rpx solid #fff; + border-right: 4rpx solid #fff; + position: absolute; + left: 12rpx; + top: 6rpx; + transform: rotate(45deg); + } +} + +.fold { + width: 25rpx; + height: 14rpx; + flex-shrink: 0; + transform: rotate(180deg); +} + +.unfold { + width: 25rpx; + height: 14rpx; + flex-shrink: 0; +} + +.line { + height: 2rpx; + background: #F3F5F8; + width: 100%; + margin-top: 49rpx; + margin-bottom: 47rpx; +} + +.arrow { + flex: 30rpx; + display: flex; + align-items: center; + justify-content: flex-end; + height: 42rpx; +} + +.selectAllBox { + display: flex; + align-items: center; + + text { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #6E6E6E; + line-height: 36rpx; + margin-left: -8px; + } +} \ No newline at end of file diff --git a/miniprogram/pages/generateReport/generateReport.ts b/miniprogram/pages/generateReport/generateReport.ts new file mode 100644 index 0000000..26f6bd5 --- /dev/null +++ b/miniprogram/pages/generateReport/generateReport.ts @@ -0,0 +1,707 @@ +// pages/generateReport/generateReport.ts +import { informationList } from "../../apis/information"; +import { list } from "../../apis/report"; +Page({ + + /** + * 页面的初始数据 + */ + data: { + list: {}, + current: 0, + pageMap: ['基础信息', '学历教育', '非学历教育', '职业经历', '社会活动经历'], + ids: [], + checkList: { + 基础信息: { + checked: false, + checkAll: false, + indeterminate: false, + // 手机号码: { + // checked: false, + // checkAll: false, + // indeterminate: false, + // value: [] + // }, + // 座机号码: { + // checked: false, + // checkAll: false, + // indeterminate: false, + // value: [] + // }, + // 通信地址: { + // checked: false, + // checkAll: false, + // indeterminate: false, + // value: [] + // }, + // 电子邮箱: { + // checked: false, + // checkAll: false, + // indeterminate: false, + // value: [] + // } + }, + // 学历教育: [], + // 非学历教育: [], + // 职业经历: [], + // 社会活动经历: [] + }, + toggles: { + 学历教育: [], + 非学历教育: [], + 职业经历: [], + 社会活动经历: [] + } + // eduToggles + }, + dataFormat(data: any) { + // console.log('##',data); + + let tempData = data + let { checkList } = this.data + + Object.keys(tempData).forEach((listKey: any) => { + if (Array.isArray(tempData[listKey])) { + + checkList[listKey] = { + checkAll: false, + indeterminate: false, + value: [] + }; + let { toggles } = this.data + tempData[listKey].map((item: any, itemIndex: any) => { + if ( + listKey === "学历教育" || + listKey === "非学历教育" || + listKey === "职业经历" || + listKey === "社会活动经历" + ) { + toggles[listKey].push(true); + this.setData({ + toggles + }) + let tempObj = {}; + // if (item['时间'] && !item['时间'].deleteTag) { + Object.keys(item).forEach(eduKey => { + if (eduKey !== "上级Id") { + tempObj.checkAll = false; + tempObj.indeterminate = false; + if (item[eduKey].length > 0) { + tempObj[eduKey] = { + checked: false, + checkAll: false, + indeterminate: false, + keys: [], + value: [] + }; + item[eduKey].map((eventItem: {}, eventItemIndex: string | number) => { + // console.log('eventItem', eventItem); + + let eventItemKeys: any[] = []; + Object.keys(eventItem).forEach(eventKey => { + if (eventKey !== "上级Id") { + eventItemKeys.push( + item[eduKey][eventItemIndex][eventKey].dataId + ); + } + }); + // console.log(eduKey,eventItemKeys.toString()); + + tempObj[eduKey].keys.push(eventItemKeys.toString()) + + tempObj[eduKey].value.push({ + [eventItemKeys.toString()]: false + }); + + // console.log(tempObj[eduKey].value); + }); + } else { + tempObj[eduKey] = { + [item[eduKey].dataId]: false + }; + } + } + }); + checkList[listKey].value.push(tempObj); + // } + } + }); + + } else { + Object.keys(tempData[listKey]).forEach(item => { + // console.log('###', tempData); + + if (item !== "上级Id") { + if (Array.isArray(tempData[listKey][item])) { + checkList[listKey][item] = { + checked: false, + checkAll: false, + indeterminate: false, + value: [] + } + tempData[listKey][item].map((arr: { [x: string]: { dataId: any; }; }) => { + checkList[listKey][item].value.push({ + [arr["值"].dataId]: false + }); + }); + } else { + checkList[listKey][item] = { + checked: false, + checkAll: false, + indeterminate: false, + [tempData[listKey][item].dataId]: false + }; + } + } + }); + this.setData({ + checkList + }) + } + }); + }, + previewImg(e: WechatMiniprogram.CustomEvent) { + const { url } = e.currentTarget.dataset + wx.previewMedia({ sources: [{ url }], current: 0 }) + }, + + handleToggle(e: WechatMiniprogram.CustomEvent) { + const { key, index } = e.currentTarget.dataset + let { toggles } = this.data + toggles[key][index] = !toggles[key][index] + this.setData({ + toggles + }) + }, + + getInformation() { + informationList().then((res: any) => { + if (res.c === 200) { + let tempData = res.d.jsonObject; + Object.keys(tempData).forEach((key1: string) => { + if (key1 === '基础信息') { + Object.keys(tempData[key1]).forEach((key2: string) => { + if (key2 !== '上级Id') { + if (Array.isArray(tempData[key1][key2])) { + let deleteIdx: any[] = [] + tempData[key1][key2].map((item: any, index: number) => { + if (key2 === '手机号码') { + if (item['值'].phoneExpireTag) { + deleteIdx.push(index) + } + } else { + if (item['值'].deleteTag) { + deleteIdx.push(index) + } + } + }) + deleteIdx.reverse().map(idx => { + tempData[key1][key2].splice(idx, 1) + }) + } + } + }) + } else { + + } + }) + + let keyArr = ['学历教育', '非学历教育', '职业经历', '社会活动经历'] + + keyArr.map((key: string) => { + let deleteIdx: any[] = [] + let eDeleteIdx: any[] = [] + // let temp = tempData[key] + tempData[key] && tempData[key].map((item: any, index: number) => { + if (key !== '社会活动经历') { + if (!item['时间'].deleteTag) { + if (item['附件']) { + let temps = this.strToArr(item['附件'].dataValue) + let fileArr: { name: string[]; url: string }[] = [] + temps.map((item: any) => { + fileArr.push({ + name: item.split(':')[2], + url: item + }) + }) + item['附件'].dataValue = fileArr + } + if (item['事件/活动记录']) { + item['事件/活动记录'].map((eventItem: any, eventIndex: any) => { + if (eventItem['附件']) { + let temps = this.strToArr(eventItem['附件'].dataValue || '') + let fileArr: { name: string[]; url: string }[] = [] + temps.map((tempItem: any) => { + fileArr.push({ + name: tempItem.split(':')[2], + url: tempItem + }) + }) + item['事件/活动记录'][eventIndex]['附件'].dataValue = fileArr + } + }) + } + if (item['岗位记录']) { + item['岗位记录'].map((eventItem: any, eventIndex: any) => { + if (!eventItem['时间'].deleteTag) { + if (eventItem['附件']) { + let temps = this.strToArr(eventItem['附件'].dataValue || '') + let fileArr: { name: string[]; url: string }[] = [] + temps.map((tempItem: any) => { + fileArr.push({ + name: tempItem.split(':')[2], + url: tempItem + }) + }) + item['岗位记录'][eventIndex]['附件'].dataValue = fileArr + } + } else { + // console.log(eventItem,key); + eDeleteIdx.push(eventIndex) + } + + }) + // console.log('delete',eDeleteIdx); + + eDeleteIdx.reverse().map(idx => { + tempData[key][index]['岗位记录'].splice(idx, 1) + }) + } + } else { + // console.log('删除',key,index,tempData[key][index]['教育机构'].dataValue) + // tempData[key].splice(index, 1) + deleteIdx.push(index) + } + } else { + if (item['事件/活动记录']) { + item['事件/活动记录'].map((eventItem: any, eventIndex: any) => { + if (!eventItem['时间'].deleteTag) { + if (eventItem['附件']) { + let temps = this.strToArr(eventItem['附件'].dataValue || '') + let fileArr: { name: string[]; url: string }[] = [] + temps.map((tempItem: any) => { + fileArr.push({ + name: tempItem.split(':')[2], + url: tempItem + }) + }) + item['事件/活动记录'][eventIndex]['附件'].dataValue = fileArr + } + } else { + eDeleteIdx.push(eventIndex) + } + + }) + eDeleteIdx.reverse().map(idx => { + tempData[key][index]['事件/活动记录'].splice(idx, 1) + }) + } + } + }) + deleteIdx.reverse().map(idx => { + tempData[key].splice(idx, 1) + }) + }) + + + + this.setData({ + list: tempData + }) + this.dataFormat(tempData) + } + }) + }, + + checkboxChange(e: any) { + console.log(e); + }, + + preStep() { + let { current } = this.data + this.setData({ + current: current-- + }) + }, + + nextStep() { + let { current } = this.data + this.setData({ + current: current + 1 + }) + }, + + preview() { + let ids = this.getCheckListIds() + }, + + complate() { + let ids = this.getCheckListIds() + wx.setStorageSync('reportIds', ids) + wx.navigateTo({ + url: '/pages/createReport/createReport' + }) + }, + + previewReport() { + let ids = this.getCheckListIds() + wx.setStorageSync('reportIds', ids) + if (ids.length > 0) { + wx.navigateTo({ + url: `/pages/reportPreview/reportPreview?type=0&active=1` + }) + } else { + wx.showToast({ + icon: 'none', + title: '请勾选最少一条数据' + }) + } + }, + + getCheckListIds() { + let filterMap = ["checkAll", "indeterminate", "checked", "keys"]; + let ids: any[] = []; + const { checkList } = this.data + Object.keys(checkList).forEach(key1 => { + Object.keys(checkList[key1]).forEach(key2 => { + if (filterMap.indexOf(key2) === -1) { + if (Array.isArray(checkList[key1][key2])) { + // 2-5 + checkList[key1][key2].map((item: any) => { + Object.keys(item).forEach(key => { + if (filterMap.indexOf(key) === -1) { + if (item[key].value !== undefined) { + item[key].value.map((ite: any) => { + if (ite[Object.keys(ite)]) { + // console.log(Object.keys(ite)); + Object.keys(ite) + .toString() + .split(",") + .map(v => { + ids.push(v); + }); + } + }); + } else { + if (item[key][Object.keys(item[key])]) { + // console.log("######", Object.keys(item[key])); + ids.push(Object.keys(item[key]).toString()); + } + } + } + }); + }); + } else { + // 1 基础信息 + console.log("1 基础信息"); + Object.keys(checkList[key1][key2]).forEach(biKey => { + if (filterMap.indexOf(biKey) === -1) { + if (Array.isArray(checkList[key1][key2][biKey])) { + checkList[key1][key2][biKey].map((item: any) => { + if (item[Object.keys(item)] === true) { + ids.push(Object.keys(item).toString()); + } + }); + } else { + if (checkList[key1][key2][biKey]) { + ids.push(biKey); + } + } + } + }); + } + } + }); + }); + return ids; + }, + + strToArr(str: string) { + // console.log(str); + + return (str || '').split(',') + }, + + handleTabChange(e: WechatMiniprogram.CustomEvent) { + console.log(e); + + this.setData({ + current: e.currentTarget.dataset.index + }) + }, + + handleChecked(e: WechatMiniprogram.CustomEvent) { + console.log(e); + + const { dataid, key1, key2, index, eindex } = e.currentTarget.dataset + let { checkList, list } = this.data + console.log(dataid, key1, key2, index, eindex); + + let filterMap = ["checkAll", "indeterminate", "checked"]; + + if (key1 === '基础信息') { + let tempList = list[key1][key2]; + if (index === undefined) { + checkList[key1][key2][dataid] = !checkList[key1][key2][dataid] + } else { + console.log(checkList[key1][key2].value[index][dataid]); + + checkList[key1][key2].value[index][dataid] = !checkList[key1][key2].value[index][dataid] + tempList = tempList.filter((item: any) => !item["值"].deleteTag); + + } + } else { + if (key2 === '事件/活动记录' || key2 === '岗位记录') { + Object.keys(checkList[key1].value[index][key2].value[eindex]).forEach((ekey: string) => { + checkList[key1].value[index][key2].value[eindex][ekey] = !checkList[key1].value[index][key2].value[eindex][ekey] + }) + } else { + checkList[key1].value[index][key2][list[key1][index][key2].dataId] = !checkList[key1].value[index][key2][list[key1][index][key2].dataId] + } + } + + + + this.setData({ + checkList, + }) + this.checkHalf(key1, key2, index) + }, + + checkHalf(key1: string, key2: string, index: number) { + const { checkList } = this.data; + let max = 0; + let checkedCount = 0; + let filterMap = ['checked', 'checkAll', 'indeterminate'] + let listMax = 0; + let listCheckedCount = 0; + // 当前 + if (key1 === '基础信息') { + Object.keys(checkList[key1]).forEach((key: string) => { + if (filterMap.indexOf(key) === -1) { + if (Array.isArray(checkList[key1][key].value)) { + // max += checkList[key1][key].value.length; + checkList[key1][key].value.map(item => { + max++; + if (key === key2) { + listMax++; + } + // + if (item[Object.keys(item)] === true) { + checkedCount++; + if (key === key2) { + listCheckedCount++; + } + } + }) + + checkList[key1][key2 || key].checkAll = key2 === undefined ? checkList[key1].checkAll : listCheckedCount === listMax; + checkList[key1][key2 || key].indeterminate = + listCheckedCount > 0 && listCheckedCount < listMax; + } else { + if (checkList[key1][key][Object.keys(checkList[key1][key])] === true) { + checkedCount++; + } + max++ + } + } + }) + } else { + console.log(checkList[key1].value, index); + + Object.keys(checkList[key1].value[index]).forEach(key => { + console.log(key); + + if (filterMap.indexOf(key) === -1) { + if (checkList[key1].value[index][key].value) { + checkList[key1].value[index][key].value.map((item: any) => { + max++; + if (key2 === '事件/活动记录' || key2 === '岗位记录') { + if (key === key2) { + listMax++; + } + } + if (item[Object.keys(item)] === true) { + checkedCount++; + if (key === key2) { + listCheckedCount++; + } + } + if (key === key2) { + console.log(listMax, listCheckedCount); + + checkList[key1].value[index][key2 || key].checkAll = key2 === undefined ? checkList[key1].value[index].checkAll : listCheckedCount === listMax; + checkList[key1].value[index][key2 || key].indeterminate = + listCheckedCount > 0 && listCheckedCount < listMax; + } + }) + } else { + max++; + if (checkList[key1].value[index][key][Object.keys(checkList[key1].value[index][key])] === true) { + checkedCount++; + } + } + } + }) + + checkList[key1].value[index].checkAll = checkedCount === max; + checkList[key1].value[index].indeterminate = + checkedCount > 0 && checkedCount < max; + } + this.setData({ + checkList + }) + }, + + handleCheckAll(e: WechatMiniprogram.CustomEvent) { + const { key1, key2, index } = e.currentTarget.dataset + let { checkList, list } = this.data + if (key2 === '事件/活动记录' || key2 === '岗位记录') { + checkList[key1].value[index][key2].checkAll = !checkList[key1].value[index][key2].checkAll + checkList[key1].value[index][key2].indeterminate = false + list[key1][index][key2].map((item: any, idx: number) => { + checkList[key1].value[index][key2].value.map((eItem: any, eidx) => { + eItem[checkList[key1].value[index][key2].keys[eidx]] = checkList[key1].value[index][key2].checkAll + }) + }) + } else { + + if (key2 === undefined) { + // console.log('=undefinde'); + + checkList[key1].value[index].checkAll = !checkList[key1].value[index].checkAll + Object.keys(list[key1][index]).forEach((tmpKey2: string) => { + if (tmpKey2 !== '上级Id') { + if (Array.isArray(list[key1][index][tmpKey2])) { + list[key1][index][tmpKey2].map((item: any, eventIndex: number) => { + + checkList[key1].value[index][tmpKey2].checkAll = checkList[key1].value[index].checkAll + checkList[key1].value[index][tmpKey2].value[eventIndex][checkList[key1].value[index][tmpKey2].keys[eventIndex]] = checkList[key1].value[index].checkAll + }) + } else { + checkList[key1].value[index][tmpKey2][list[key1][index][tmpKey2].dataId] = checkList[key1].value[index].checkAll + } + } + }) + } else { + checkList[key1][key2].checkAll = !checkList[key1][key2].checkAll + checkList[key1][key2].indeterminate = false + list[key1][key2].map((item: any, idx: number) => { + if (!item['值'].deleteTag) { + checkList[key1][key2].value[idx][item['值'].dataId] = checkList[key1][key2].checkAll + } + }) + } + } + + this.setData({ + checkList + }) + }, + + handleCurrentPageCheckAll(e: WechatMiniprogram.CustomEvent) { + const { key1 } = e.currentTarget.dataset + let { checkList, list } = this.data + checkList[key1].checkAll = !checkList[key1].checkAll + + + if (key1 === '基础信息') { + Object.keys(list[key1]).forEach(key => { + + if (key !== '上级Id') { + if (Array.isArray(list[key1][key])) { + checkList[key1][key].checkAll = checkList[key1].checkAll + list[key1][key].map((item: any, index: number) => { + if (!item['值'].deleteTag) { + checkList[key1][key].value[index][item['值'].dataId] = checkList[key1].checkAll + } + }) + } else { + checkList[key1][key][list[key1][key].dataId] = checkList[key1].checkAll + } + } + }) + this.checkHalf(key1) + } else { + list[key1].map((item: any, index: number) => { + checkList[key1].value[index].checkAll = checkList[key1].checkAll + checkList[key1].value[index].indeterminate = false + Object.keys(item).forEach((key2: string) => { + if (key2 !== '上级Id') { + if (Array.isArray(item[key2])) { + checkList[key1].value[index][key2].checkAll = checkList[key1].checkAll + item[key2].map((event: any, eIndex: any) => { + checkList[key1].value[index][key2].value[eIndex][checkList[key1].value[index][key2].keys[eIndex]] = checkList[key1].checkAll + }) + } else { + checkList[key1].value[index][key2][item[key2].dataId] = checkList[key1].checkAll + } + } + }) + }) + } + + + this.setData({ + checkList + }) + + // checkList[key1] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.getInformation() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/generateReport/generateReport.wxml b/miniprogram/pages/generateReport/generateReport.wxml new file mode 100644 index 0000000..a68e25e --- /dev/null +++ b/miniprogram/pages/generateReport/generateReport.wxml @@ -0,0 +1,681 @@ + + + + + + + + 基础信息 + + + + + + + + 学历教育 + + + + + + 非学历教育 + + + + + + 职业经历 + + + + + + + 社会活动经历 + + + + + + + + + + + + + + 姓名 + + {{list['基础信息']['姓名'].dataValue}} + + + + + + + + + 性别 + + {{list['基础信息']['性别'].dataValue}} + + + + + + + + + 身份证号 + + {{list['基础信息']['身份证号'].dataValue}} + + + + + + + + + 出生日期 + + {{list['基础信息']['出生日期'].dataValue}} + + + + + + + + + 民族 + + {{list['基础信息']['民族'].dataValue}} + + + + + + + + + 身份证注册地 + + {{list['基础信息']['身份证注册地'].dataValue}} + + + + + + + 手机号码 + + + + + + {{item['值'].dataValue}} + + + + + + + + 座机号码 + + + + + + {{item['值'].dataValue}} + + + + + + + + 通信地址 + + + + + + {{item['值'].dataValue}} + + + + + + + + 电子邮箱 + + + + + + {{item['值'].dataValue}} + + + + + + + + + + 政治面貌 + + {{list['基础信息']['政治面貌'].dataValue}} + + + + + + + + 婚姻状况 + + {{list['基础信息']['婚姻状况'].dataValue}} + + + + + + + + + + + + + + + + + + + + {{item['教育机构'].dataValue}} + + + + + + + + 教育机构 + + {{item['教育机构'].dataValue}} + + + + + + + + 时间 + + + + + + + + + + + 专业名称 + + {{item['专业名称'].dataValue}} + + + + + + + + + 专业描述 + + {{item['专业描述'].dataValue}} + + + + + + + + + 专业层次 + + {{item['专业层次'].dataValue}} + + + + + + + + + + + 学制 + + {{item['学制'].dataValue}} + + + + + + + + + 是否全日制 + + {{item['是否全日制'].dataValue}} + + + + + + + + + 班期 + + {{item['班期'].dataValue}} + + + + + + + + + 教育结果 + + {{item['教育结果'].dataValue}} + + + + + + + + + 附件 + + + + {{item.name}} + + + + + + + + + 事件/活动记录 + + + + + + + + {{eItem['内容'].dataValue}} + + + + {{fItem.name}} + + + + + + + + + + + 暂无相关信息... + + + + + + + + + + + + + + + + + {{item['教育机构'].dataValue}} + + + + + + + + 教育机构 + + {{item['教育机构'].dataValue}} + + + + + + + + + 机构描述 + + {{item['机构描述'].dataValue}} + + + + + + + + + 时间 + + + + + + + + + + + 教育产品 + + {{item['教育产品'].dataValue}} + + + + + + + + + 产品描述 + + {{item['产品描述'].dataValue}} + + + + + + + + + 班期 + + {{item['班期'].dataValue}} + + + + + + + + + + + 教育结果 + + {{item['教育结果'].dataValue}} + + + + + + + + + 附件 + + + + {{item.name}} + + + + + + + + + 事件/活动记录 + + + + + + + + {{eItem['内容'].dataValue}} + + + + {{fItem.name}} + + + + + + + + + + + 暂无相关信息... + + + + + + + + + + + + + + + + + + + {{item['单位名称'].dataValue}} + + + + + + + + 时间 + + + + + + + + + + + 单位名称 + + {{item['单位名称'].dataValue}} + + + + + + + + + 单位介绍 + + {{item['单位介绍'].dataValue}} + + + + + + + + + 附件 + + + + {{fItem.name}} + + + + + + + + + 岗位记录 + + + + + + + + + {{eItem['内容'].dataValue}} + {{eItem['岗位名称'].dataValue}} + + + + {{fItem.name}} + + + + + + + + + + 事件/活动记录 + + + + + + + + + {{eItem['内容'].dataValue}} + + + + {{fItem.name}} + + + + + + + + + + + 暂无相关信息... + + + + + + + + + + + + + + + {{eItem['内容'].dataValue}} + + + + {{fItem.name}} + + + + + + + + + + + 暂无相关信息... + + + + + + + + + 本页全选 + + + + + + 下一步选择{{pageMap[current+1]}} + + 预览 + 勾选完毕,生成报告 + + + \ No newline at end of file diff --git a/miniprogram/pages/guide/guide.json b/miniprogram/pages/guide/guide.json new file mode 100644 index 0000000..ced5b27 --- /dev/null +++ b/miniprogram/pages/guide/guide.json @@ -0,0 +1,4 @@ +{ + "navigationStyle": "custom", + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/guide/guide.scss b/miniprogram/pages/guide/guide.scss new file mode 100644 index 0000000..107243d --- /dev/null +++ b/miniprogram/pages/guide/guide.scss @@ -0,0 +1,84 @@ +/* pages/guide/guide.wxss */ +page { + // display: flex; + // height: 100%; + background: rgba($color: #000000, $alpha: 0.85); +} + +.guide { + width: 100%; + height: 100%; + padding-top: 106rpx; + color: #fff; + // background: rgba($color: #000000, $alpha: 0.85); + + + .title { + text-align: center; + } + + swiper { + margin-top: 52rpx; + height: 1177rpx; + text-align: center; + + swiper-item { + .swiper-item { + width: 100%; + height: 100%; + // margin-bottom: 100rpx; + } + } + } + + .steps { + text-align: center; + + .current { + font-size: 48rpx; + } + } + + .remember { + font-size: 24rpx; + display: flex; + align-items: center; + justify-content: center; + margin-top: 10rpx; + + .checkbox { + width: 22rpx; + height: 22rpx; + border-radius: 6rpx; + border: 1rpx solid #fff; + margin-right: 12rpx; + } + + .checked { + // background:url('https://chrivc.obs.cn-north-4.myhuaweicloud.com/5dee8fef68304274bfbbb0d539a0ba03:附件_1660802502.png'); + background: url('https://chrivc.obs.cn-north-4.myhuaweicloud.com/e5b914fafb09446b9526c99842e3c253:附件_1660803676.png'); + background-size: cover; + width: 22rpx; + height: 22rpx; + border-radius: 6rpx; + margin-right: 12rpx; + border: 1rpx solid #fff; + } + } + + .btn_close { + margin-top: 20rpx; + width: 340rpx; + height: 69rpx; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + background: none; + border: 3rpx solid #3A61B1; + border-radius: 35rpx; + display: flex; + align-items: center; + justify-content: center; + } +} \ No newline at end of file diff --git a/miniprogram/pages/guide/guide.ts b/miniprogram/pages/guide/guide.ts new file mode 100644 index 0000000..efb0242 --- /dev/null +++ b/miniprogram/pages/guide/guide.ts @@ -0,0 +1,101 @@ +// pages/guide/guide.ts +Page({ + + /** + * 页面的初始数据 + */ + data: { + current: 1, + steps: [{ + // url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/5b5b8cc9ff064204a361d05889ebb45a:附件_1661483704.png', height: '1175rpx', + url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/d116774ef2594033ae202c83e84ae108:附件_1665474737.png', height: '1175rpx', + }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/c1692ab7cfa74b0d9e1493a52dc2944d:附件_1665474769.png', height: '1175rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/eb569d76801546c78bf710681e4ca9ef:附件_1665474786.png', height: '1175rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/85fa02927ae343c2a77d23e98531e399:附件_1665474800.png', height: '1175rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/d4920d16a64b46eca164c4a459fb3406:附件_1667802318.png', height: '1175rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/26df74ccf9a8479e99dd3f7d029d0b5e:附件_1665474837.png', height: '1175rpx', }, + { url: 'https://chrivc.obs.cn-north-4.myhuaweicloud.com/85b02a8b4291478299e79677f166dfe7:附件_1665474852.png', height: '1175rpx', } + ], + remember: false + }, + stepChange(e: WechatMiniprogram.CustomEvent) { + // console.log(e.detail); + const { current } = e.detail + this.setData({ + current: current + 1 + }) + }, + handleExit() { + let { remember } = this.data + if (remember) { + wx.setStorageSync('showGuide', JSON.stringify(remember)) + } + wx.navigateBack({ + delta: 1 + }) + }, + handleChecked() { + let { remember } = this.data + this.setData({ + remember: !remember + }) + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/guide/guide.wxml b/miniprogram/pages/guide/guide.wxml new file mode 100644 index 0000000..9d4f9ac --- /dev/null +++ b/miniprogram/pages/guide/guide.wxml @@ -0,0 +1,16 @@ + + + 新手指引 + {{current}} / 7 + + + + + + + + + 下次登录不再自动弹出 + + + \ No newline at end of file diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json new file mode 100644 index 0000000..8f42b3c --- /dev/null +++ b/miniprogram/pages/index/index.json @@ -0,0 +1,6 @@ +{ + "navigationStyle": "custom", + "usingComponents": { + "btn": "/components/btn/btn" + } +} \ No newline at end of file diff --git a/miniprogram/pages/index/index.scss b/miniprogram/pages/index/index.scss new file mode 100644 index 0000000..77757ea --- /dev/null +++ b/miniprogram/pages/index/index.scss @@ -0,0 +1,178 @@ +/**index.wxss**/ +page { + background: #7E8BFF; + height: 100%; + background: url("https://chrivc.obs.cn-north-4.myhuaweicloud.com/1cde69cc683a42219c12e8e7e4f6bed0:生意伙伴人品如何@2x.png"); + background-size: 100%; +} + +.index-page { + // background: #7E8BFF; + // padding-top:1000rpx 30rpx; + padding: 0rpx 40rpx; + + height: 100%; + + // padding: 30rpx 30rpx; + .nameSlogan { + margin-top: 237rpx; + display: flex; + align-items: center; + flex-direction: column; + + .name { + width: 135rpx; + height: 61rpx; + margin-bottom: 17rpx; + } + + .slogan { + width: 368rpx; + height: 35rpx; + margin-bottom: 374rpx; + } + } + + + .description { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + line-height: 22px; + opacity: 0.58; + margin-bottom: 31rpx; + } + + .pic { + margin-top: 221rpx; + width: 544rpx; + height: 376rpx; + margin-bottom: 21rpx; + } + + .search_box { + // background: #fff; + // border-radius: 32rpx; + // margin-top: 36rpx; + // padding: 64rpx 48rpx; + + .top { + display: flex; + justify-content: space-between; + align-items: center; + + .mobileContact { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + text-decoration: underline; + color: #4D8DFF; + + image { + width: 22rpx; + height: 23rpx; + } + } + } + + .btns { + display: flex; + flex-direction: column; + } + } + + .footer { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + display: flex; + justify-content: center; + margin-top: 180rpx; + } +} + +// input { +// height: 98rpx; +// // width: 100%; +// background: #F9F9F9; +// border-radius: 49rpx; +// margin-top: 30rpx; +// margin-bottom: 37rpx; +// padding-left: 36rpx; +// font-size: 24rpx; +// } + +.source { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + display: flex; + align-items: center; + margin-bottom: 25rpx; + + .sourceItem { + display: flex; + align-items: center; + margin-right: 25rpx; + + .icon_seemore { + width: 26.8rpx; + height: 26rpx; + margin-right: 7rpx; + } + + .icon_gh { + width: 26.8rpx; + height: 26rpx; + margin-right: 4rpx; + } + + .icon_fw { + width: 27rpx; + height: 25.6rpx; + margin-right: 7rpx; + } + } + +} + + + +.input_contact { + display: flex; + align-items: center; + justify-content: space-between; + background: #fff; + border-radius: 45rpx; + height: 90rpx; + margin-bottom: 20rpx; + + .icon_search { + width: 26rpx; + height: 25rpx; + margin-left: 28rpx; + } + + input { + height: 90rpx; + font-size: 24rpx; + width: 400rpx; + } + + .btn_contact { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + margin-right: 18rpx; + + .icon_contact { + width: 22rpx; + height: 22rpx; + margin-right: 8rpx; + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts new file mode 100644 index 0000000..853213e --- /dev/null +++ b/miniprogram/pages/index/index.ts @@ -0,0 +1,139 @@ +// index.ts +// 获取应用实例 +const app = getApp() +import { info } from "../../apis/phone"; +import { bindPhoneList } from "../../apis/consumer"; +import { userInfo } from "../../apis/login"; + +Page({ + data: { + // phone: '13408085719', + phone: '', + motto: 'Hello World', + userInfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo'), + canIUseGetUserProfile: false, + canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'), // 如需尝试获取用户信息可改为false + // isBind: false + }, + // 事件处理函数 + handleResult() { + // console.log('handleResult'); + // info(this.data.phone).then(res=>{ + // console.log(res); + + // }) + const { phone } = this.data + if (!phone) { + wx.showToast({ + icon: 'none', + title: '请输入手机号' + }) + return + } + if (phone.length !== 11) { + wx.showToast({ + icon: 'none', + title: '请输入手机号格式错误' + }) + return + } + wx.navigateTo({ + url: `/pages/searchResult/searchResult?phone=${phone}`, + }) + }, + goPrivacy() { + wx.navigateTo({ + url: '/pages/privacy/privacy' + }) + }, + goQA() { + wx.navigateTo({ + url: '/pages/QA/QA' + }) + }, + goService() { + wx.navigateTo({ + url: '/pages/service/service' + }) + }, + handleContact() { + let { phone } = this.data + wx.chooseContact({ + success: t => { + let temp = t.phoneNumber.replaceAll('-', '').replaceAll(' ', '') + if (temp.length !== 11) { + wx.showToast({ + icon: 'none', + title: '手机号格式错误!' + }) + return + } else { + this.setData({ + phone: temp + }) + } + }, + fail: e => console.log(e), + complete: () => { } + }) + }, + checkMy() { + if (wx.getStorageSync('accountList').length > 0) { + wx.navigateTo({ + url: '/pages/my/my' + }) + } else { + wx.navigateTo({ + url: '/pages/login/login' + }) + } + }, + getBindPhoneList() { + bindPhoneList().then(res => { + wx.setStorageSync('accountList', res.d); + let userInfo = wx.getStorageSync('userInfo'); + if (!userInfo) { + wx.setStorageSync('userInfo', res.d[0]) + } else { + wx.setStorageSync('userInfo', res.d.find((consumer: any) => consumer.id === userInfo.id)) + } + }) + }, + onLoad() { + // @ts-ignore + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + }, + onShow() { + this.getBindPhoneList() + + }, + getUserProfile() { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户数据档案均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户数据档案后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + console.log(res) + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + }, + getUserInfo(e: any) { + // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户数据档案 + console.log(e) + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + } +}) + +export { } diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml new file mode 100644 index 0000000..21f7aaf --- /dev/null +++ b/miniprogram/pages/index/index.wxml @@ -0,0 +1,46 @@ + + + + + + + + + + 四川私慕科技有限公司 + + + + + 全国人力资源信息数据验证平台 + + + 众评是四川私慕科技有限公司与全国人力资源信息数据验证平台共同推出的一款个人综合社交评价工具,所有关键数据存储、隐私安全保障、用户行为数据溯源均由全国人力资源信息数据验证平台提供相应接口及支撑。 + + + + + + + + + 通讯录选取 + + + + + 查看众评数据 + 查看我的号码 + + + + 《隐私政策》| + 《用户协议》| +  Q&A + + \ No newline at end of file diff --git a/miniprogram/pages/information/information.json b/miniprogram/pages/information/information.json new file mode 100644 index 0000000..9e01175 --- /dev/null +++ b/miniprogram/pages/information/information.json @@ -0,0 +1,12 @@ +{ + "navigationStyle": "custom", + "navigationBarTextStyle": "white", + "usingComponents": { + "btn": "/components/btn/btn", + "guide": "/components/guide/guide", + "navBar": "/components/navBar/navBar", + "dataSource":"/components/dataSource/dataSource", + "redDot":"/components/redDot/redDot", + "shadow":"/components/shadow/shadow" + } +} \ No newline at end of file diff --git a/miniprogram/pages/information/information.scss b/miniprogram/pages/information/information.scss new file mode 100644 index 0000000..5b9162c --- /dev/null +++ b/miniprogram/pages/information/information.scss @@ -0,0 +1,534 @@ +/* pages/information/information.wxss */ +.persion-icon-box { + display: flex; + align-items: center; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + + .nav-right { + width: 47rpx; + height: 54rpx; + margin-right: 28rpx; + } +} + +.logo { + width: 208rpx; + height: 37rpx; +} + +.bg-box { + position: relative; + + .bg { + width: 750rpx; + height: 500rpx; + } + + .header { + position: absolute; + top: 240rpx; + left: 407rpx; + + .top { + font-size: 47rpx; + font-family: FZZhengHeiS-DB-GB; + font-weight: 400; + color: #FFFFFF; + line-height: 69rpx; + opacity: 0.8; + margin-bottom: 20rpx; + } + + .bottom { + font-size: 29rpx; + font-family: PingFang SC; + font-weight: bold; + color: #FFFFFF; + line-height: 42rpx; + opacity: 0.57; + margin-bottom: 16rpx; + } + + .line { + width: 79rpx; + height: 8rpx; + background: #FFFFFF; + opacity: 0.32; + } + } +} + +.scanBtn { + position: fixed; + left: 0; + width: 40rpx; + top: 200rpx; +} + +.white-box { + margin-top: -32rpx; + border-radius: 32rpx; + background: #FFFFFF; + position: relative; + z-index: 2; + padding: 51rpx 30rpx 0 29rpx; + + .tipBox { + background: #FFF7F1; + border-radius: 10rpx; + padding: 41rpx 31rpx 38rpx 38rpx; + color: #FE633A; + margin-bottom: 45rpx; + + .title { + font-family: PingFang SC; + font-weight: bold; + } + + .description { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + margin-bottom: 19rpx; + margin-top: 20rpx; + line-height: 34rpx; + } + } +} + +.icon_arrow_right { + width: 8rpx; + height: 15rpx; + margin-left: 10rpx; + position: relative; + top: 1rpx; +} + +.fun-item { + display: flex; + flex-direction: column; + margin-bottom: 73rpx; + + .panel { + display: flex; + justify-content: space-between; + + .left { + display: flex; + align-items: center; + + text { + font-size: 34rpx; + font-family: PingFang SC; + font-weight: bold; + color: #282828; + width: 100%; + } + } + + .right { + display: flex; + align-items: center; + + text { + font-size: 28rpx; + color: #C3C3C3; + margin-right: 26rpx; + } + } + + .icon { + width: 65rpx; + height: 65rpx; + margin-right: 37rpx; + flex-shrink: 0; + } + + + .fold { + width: 25rpx; + height: 14rpx; + flex-shrink: 0; + transform: rotate(180deg); + } + + .unfold { + width: 25rpx; + height: 14rpx; + flex-shrink: 0; + } + } + + .infoList { + // margin-top: 31rpx; + + .infoItem { + border-top: 2px solid #F3F5F8; + // margin: 31rpx 0 42rpx 0; + padding: 37rpx 4rpx 42rpx 9rpx; + + .infoItem_top { + display: flex; + justify-content: space-between; + align-items: center; + + .key { + font-size: 32rpx; + color: #282828; + font-family: PingFang SC; + font-weight: bold; + } + + .value { + color: #494949; + font-size: 28rpx; + display: flex; + } + } + + .infoItem_bottom { + display: flex; + justify-content: space-between; + align-items: center; + + + + .operations { + display: flex; + + .operation { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #2F88DB; + margin-left: 68rpx; + + .operationIcon { + margin-right: 9rpx; + width: 20rpx; + height: 22rpx; + } + } + } + } + + .valueList { + margin-top: 31rpx; + + .deleteTag { + border: 1px dashed #BFBFBF; + background: #fff !important; + + .value { + &:first-child { + text-decoration: line-through; + } + } + } + + .valueItem { + background: #F3F5F8; + border-radius: 10rpx; + padding: 30rpx 38rpx 36rpx 36rpx; + display: flex; + margin-bottom: 20rpx; + flex-direction: column; + + .operations { + display: flex; + justify-content: flex-end; + + .operation { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #2F88DB; + text-align: right; + margin-left: 68rpx; + + .operationIcon { + margin-right: 9rpx; + width: 20rpx; + height: 22rpx; + } + } + } + } + + } + } + + .eduList { + .eduItem { + margin-top: 39rpx; + border-radius: 10px; + position: relative; + + .eduItemTimeLine { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-bottom: 20rpx; + } + + .deleteTag { + text-decoration: line-through; + } + + .deleteTagText { + margin-left: 10rpx; + color: rgb(255, 76, 76) + } + + .eduItemRoute { + background: #F3F5F8; + min-height: 130rpx; + padding-top: 20rpx; + display: flex; + flex-direction: column; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: bold; + color: #282828; + padding: 32rpx 29rpx 0 37rpx; + border-radius: 10px; + + .eduItemDate { + display: flex; + justify-content: space-between; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + + text { + color: #3A61B1; + } + } + + .eduName { + position: relative; + // padding-top: 20rpx; + // padding-bottom: 20rpx; + margin: 20rpx 0; + max-width: 530rpx; + + image { + width: 22rpx; + height: 26rpx; + margin-left: 10rpx; + } + } + } + } + + .addBar1 { + display: flex; + justify-content: center; + + .btn_add { + display: flex; + align-items: center; + // justify-content: center; + background: #3A61B1; + border-radius: 24px; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + // width: 203rpx; + height: 50rpx; + // line-height: 47rpx; + padding-right: 16rpx; + color: #FFFFFF; + box-sizing: content-box; + margin-top: 30rpx; + + text { + font-size: 36rpx; + position: relative; + top: -1rpx; + margin-right: 9rpx; + padding-left: 17rpx; + } + } + } + + } + } +} + +.report-btn { + display: flex; + justify-content: center; + margin-bottom: 40rpx; + // margin-top: 146rpx; + padding-left: 48rpx; + padding-right: 58rpx; + + .reportTip { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #919191; + + text { + color: #3A61B1; + text-decoration: underline; + } + } +} + +.date { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + padding-bottom: 20rpx; + // line-height: 60rpx; +} + +.icon_add { + width: 40rpx; + height: 40rpx; +} + +.addBar { + padding-left: 21rpx; + display: flex; + align-items: center; + color: #3A61B1; + font-size: 24rpx; + + .icon_add_form { + width: 40rpx; + height: 40rpx; + margin-right: 20rpx; + } +} + +.icon_time { + width: 24rpx; + height: 24rpx; + margin-right: 17rpx; +} + +.arrow_right { + width: 14rpx; + height: 25rpx; +} + +.fixed { + position: fixed; + left: 30rpx; + bottom: 10%; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + line-height: 30px; + + .toggleAll { + width: 90rpx; + height: 90rpx; + border-radius: 16rpx; + border: 2rpx solid rgba(180, 180, 180, .7); + margin-bottom: 15rpx; + box-sizing: border-box; + padding: 20rpx; + line-height: 28rpx; + display: flex; + justify-content: center; + align-items: center; + background: #fff; + } + + .isShowInvalid { + width: 90rpx; + height: 90rpx; + border-radius: 16rpx; + border: 2rpx solid rgba(180, 180, 180, .7); + box-sizing: border-box; + line-height: 28rpx; + display: flex; + justify-content: center; + align-items: center; + background: #fff; + display: flex; + flex-direction: column; + margin-bottom: 15rpx; + font-size: 18rpx; + + .icon_invalid { + width: 36rpx; + height: 25rpx; + margin-bottom: 8rpx; + } + } + + .goTop { + width: 90rpx; + height: 90rpx; + border-radius: 16rpx; + border: 2rpx solid rgba(180, 180, 180, .7); + box-sizing: border-box; + line-height: 28rpx; + display: flex; + justify-content: center; + align-items: center; + background: #fff; + display: flex; + flex-direction: column; + + .icon_top { + width: 21rpx; + height: 26rpx; + } + } +} + +.phoneTip { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #AEAEAE; + line-height: 37rpx; + margin-bottom: 29rpx; + + image { + width: 20rpx; + height: 20rpx; + margin-right: 15rpx; + } +} + +.outDate { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FF5129; + margin-left: 23rpx; +} + +.stages-cmp { + .stages-box { + background: #fff; + width: 80%; + border-radius: 20rpx; + text-align: center; + + .stages { + .item { + padding: 20rpx; + border-bottom: 1px solid #eee; + } + } + + .cancel-btn { + padding: 20rpx; + color: #AEAEAE; + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/information/information.ts b/miniprogram/pages/information/information.ts new file mode 100644 index 0000000..1c800c6 --- /dev/null +++ b/miniprogram/pages/information/information.ts @@ -0,0 +1,348 @@ +// pages/information/information.ts +import { informationList, informationDelete, redDotMarkDeal } from '../../apis/information' +// import { codeScanningSuccess } from '../../apis/socket' +import { querystrToObj } from '../../utils/util' +const app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + + data: { + headeBg: '', + toggles: { + '基础信息': false, + '学历教育': false, + '非学历教育': false, + '职业经历': false, + '社会活动记录': false + }, + userInfo: {}, + list: {}, + fixed: 'black', + redDotMakStr: '', + superiorIdAttachInfoResponseVoMap: [], + isShowInvalid: true, + dialogStage: false, + stages: [{ name: '高等教育', value: 4 }, + { name: '高中', value: 5 }, + { name: '职高', value: 6 }, + { name: '初中', value: 7 }, + { name: '中专', value: 8 }, + { name: '小学', value: 9 }] + }, + scanCode() { + wx.scanCode({ + success(res) { + const { result } = res + console.log(result) + // if (/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(result)) { + // codeScanningSuccess(res.result).then(su => { + // console.log(su) + // wx.navigateTo({ + // url: `/pages/scanLogin/scanLogin?id=${res.result}` + // }) + // }) + // // https://www.chrivc.com/api/consumer/wechatshare/getUrlLink?b=2&query=source%3D2%26type%3D2%26active%3D3%26id%3D1563042929900044289 + // } else + if (/^https:\/\/www.chrivc.com\/api\/consumer\/wechatshare\/getUrlLink\?/.test(result)) { + const queryStr = result.split('?')[1] + const { query, b } = querystrToObj(queryStr) + // const queryObj = querystrToObj(decodeURIComponent(query)) + if (b == 1) { + wx.reLaunch({ + url: `/pages/apply/apply?${decodeURIComponent(query)}` + }) + } else if (b == 2) { + wx.navigateTo({ + url: `/pages/reportPreview/reportPreview?${decodeURIComponent(query)}` + }) + } else if (b == 3) { + wx.navigateTo({ + url: `/pages/scanLogin/scanLogin?${decodeURIComponent(query)}` + }) + // if (/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(queryObj.id)) { + // codeScanningSuccess(queryObj.id).then(su => { + // console.log(su) + // wx.navigateTo({ + // url: `/pages/scanLogin/scanLogin?id=${queryObj.id}` + // }) + // }) + // } + } else { + wx.showToast({ + icon: 'error', + title: '未知页面' + }) + } + } else if (result === 'https://chrivc.com/mobile/#/appdownload') { + wx.showToast({ + icon: 'none', + title: '下载APP请使用微信或自带浏览器扫码操作!', + duration: 2000 + }) + } else { + wx.navigateTo({ + url: `/pages/scanResult/scanResult?result=${result}` + }) + } + } + }) + }, + handleToggle(e: WechatMiniprogram.CustomEvent) { + const { toggled, key, show } = e.currentTarget.dataset + if (show) { + const { toggles } = this.data + toggles[key] = !toggled + this.setData({ + toggles: toggles + }) + } + }, + handleCertification(e: WechatMiniprogram.BaseEvent) { + const { idcard } = e.currentTarget.dataset + wx.navigateTo({ + url: `/pages/certification/certification?idCard=${idcard}` + }) + }, + handleDetail(e: WechatMiniprogram.BaseEvent) { + const { key, index } = e.currentTarget.dataset + if (key === '社会活动经历') { + wx.setStorageSync('informationDetail', this.data.list[e.currentTarget.dataset.key][0]['事件/活动记录'][index]) + wx.setStorageSync('informationName', key) + this.handleRedDot(this.data.list[e.currentTarget.dataset.key][0]['事件/活动记录'][index]['上级Id']) + } else { + wx.setStorageSync('informationDetail', this.data.list[e.currentTarget.dataset.key][index]) + wx.setStorageSync('informationName', key) + this.handleRedDot(this.data.list[e.currentTarget.dataset.key][index]['上级Id']) + } + wx.navigateTo({ + url: '/pages/informationDetail/informationDetail?index=' + index + }) + }, + handleRedDot(id: any) { + redDotMarkDeal(id).then(res => { + console.log(res); + }) + }, + goPersonal() { + wx.navigateTo({ + url: '/pages/personal/personal' + }) + }, + handleRecords(e: WechatMiniprogram.BaseEvent) { + wx.navigateTo({ + url: '/pages/dataRecords/dataRecords?id=' + e.currentTarget.dataset.id + }) + }, + handleCreate(e: WechatMiniprogram.BaseEvent) { + // console.log(e); + + const { key } = e.currentTarget.dataset; + const { list, dialogStage } = this.data + if (key === '社会活动经历') { + wx.setStorageSync('informationName', key) + wx.setStorageSync('eventName', key) + wx.setStorageSync('eventId', list['社会活动经历'] && list['社会活动经历'][0]['上级Id'] || '社会活动经历') + // wx.setStorageSync('eventId', (list['社会活动经历'] && list['社会活动经历'][0] && list['社会活动经历'][0]['上级Id']) || '社会活动经历') + wx.navigateTo({ + url: '/pages/informationEventCreate/informationEventCreate' + }) + } else { + wx.setStorageSync('informationName', key) + if (key === '学历教育') { + this.setData({ + dialogStage: !dialogStage + }) + } else { + wx.navigateTo({ + url: '/pages/informationCreate/informationCreate' + }) + } + } + }, + handleAddEdu(e: WechatMiniprogram.BaseEvent) { + + const { stage } = e.currentTarget.dataset + wx.setStorageSync('educationStage', stage) + console.log(stage); + wx.navigateTo({ + url: '/pages/informationCreate/informationCreate' + }) + }, + getInformation() { + if (app.certificationVerify()) { + informationList().then((res: any) => { + // console.log(res); + if (res.c === 200) { + this.setData({ + list: res.d.jsonObject, + redDotMakStr: res.d.redDotMakStr, + superiorIdAttachInfoResponseVoMap: res.d.superiorIdAttachInfoResponseVoMap + }) + } + }) + } + }, + handleAdd(e: WechatMiniprogram.BaseEvent) { + + + const { name, key, keyid, value } = e.currentTarget.dataset + console.log('handleAdd', name, key, keyid, value); + if (name !== '手机号码') { + console.log('name'); + + wx.setStorageSync('informationEditDataName', name) + wx.setStorageSync('informationName', key) + wx.removeStorageSync('informationEditInfo') + wx.navigateTo({ + // url: '/pages/informationEdit/informationEdit?type=' + 'add' + url: `/pages/informationEdit/informationEdit?type=add&keyId=${keyid}` + }) + } else { + wx.navigateTo({ + url: `/pages/addPhone/addPhone?phoneNumber=${value || ''}` + }) + } + + }, + handleEdit(e: WechatMiniprogram.BaseEvent) { + console.log(e); + + const { value, name } = e.currentTarget.dataset + wx.setStorageSync('informationEditInfo', value) + wx.setStorageSync('informationEditDataName', name) + wx.navigateTo({ + url: '/pages/informationEdit/informationEdit?type=edit' + }) + }, + handleDelete(e: WechatMiniprogram.BaseEvent) { + informationDelete({ + dataId: e.currentTarget.dataset.id, + deleteAll: false + }).then((res: any) => { + if (res.c === 200) { + this.getInformation() + } + }) + }, + handleGenerateReport() { + wx.navigateTo({ + url: '/pages/generateReport/generateReport' + }) + }, + toggleAll() { + this.setData({ + toggles: { + 基础信息: false, + 学历教育: false, + 非学历教育: false, + 职业经历: false, + 社会活动经历: false + }, + }) + }, + goTop() { + wx.pageScrollTo({ + scrollTop: 0 + }) + }, + isShowGuide() { + // console.log(typeof JSON.parse(wx.getStorageSync('showGuide'))); + if (!wx.getStorageSync('showGuide')) { + wx.navigateTo({ + url: '/pages/guide/guide' + }) + } + }, + goReport() { + wx.switchTab({ + url: '/pages/report/report' + }) + }, + handleInvalid() { + this.setData({ + isShowInvalid: !this.data.isShowInvalid + }) + }, + stageCencel() { + this.setData({ + dialogStage: !this.data.dialogStage + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.isShowGuide() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + userInfo: app.globalData.userInfo, + isCer: app.certificationVerify(), + isMember: app.memberVerify() + }) + this.getInformation() + }, + + onPageScroll(e) { + const { scrollTop } = e + if (scrollTop > 150) { + this.setData({ + headeBg: '#3A61B1' + }) + } else { + this.setData({ + headeBg: '' + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/information/information.wxml b/miniprogram/pages/information/information.wxml new file mode 100644 index 0000000..3cd7439 --- /dev/null +++ b/miniprogram/pages/information/information.wxml @@ -0,0 +1,634 @@ + + + + + + + + + + + + + + 个人服务 + Personal service + + + + + + 实名认证 + {{userInfo.idCard?'因手机号码可通过过户、注销等情况变更用户信息,为确保手机号实名认证信息匹配,三个月内未登录的手机号码再次登陆时需重新完成实名认证。':'您的账户尚未进行实名认证,完成实名认证后您可以查看数据档案详情、补充自填信息、申请勘误、生成个人信息报告。'}} + 立即实名认证 + + + + + + + + + + 基础信息 + + + 认证可见 + + + + + + + + 姓名 + {{list['基础信息']['姓名'].dataValue}} + + + + + 由本人实名认证 + + + + + + + + + + + 性别 + {{list['基础信息']['性别'].dataValue}} + + + + + 由本人实名认证 + + + + + + + + + + + + + 身份证号 + {{list['基础信息']['身份证号'].dataValue}} + + + + + 由本人实名认证 + + + + + + + + + + + 出生日期 + {{list['基础信息']['出生日期'].dataValue}} + + + + + 由本人实名认证 + + + + + + + + + + + 民族 + {{list['基础信息']['民族'].dataValue}} + + + + + + 由{{list['基础信息']['民族'].dataSourceType==='CONSUMER'? list['基础信息']['民族'].dataSourceName +'自填' + : list['基础信息']['民族'].dataSourceName +'添加'}} + + + + 修改 + + + + + + + + + + 身份证注册地 + {{list['基础信息']['身份证注册地'].dataValue}} + + + + + 由本人实名认证 + + + + + + + + + + + 手机号码 + + + + + + + + 三个月内未登录的手机号,需重新进行实名认证 + + + + {{item['值'].dataValue}}已过期 + + + 实名认证 + + + + + 重新认证 + + + + + + + + + + 座机号码 + + + + + + + + {{item['值'].dataValue}} + + + 由{{item['值'].dataSourceType==='CONSUMER'? item['值'].dataSourceName +'自填' + : item['值'].dataSourceName +'添加'}} + + + + 编辑 + + + 删除 + + + + + + + + + + + 通信地址 + + + + + + + + {{item['值'].dataValue}} + + + 由{{item['值'].dataSourceType==='CONSUMER'? item['值'].dataSourceName +'自填' + : item['值'].dataSourceName +'添加'}} + + + + 编辑 + + + 删除 + + + + + + + + + + + 电子邮箱 + + + + + + + + {{item['值'].dataValue}} + + + 由{{item['值'].dataSourceType==='CONSUMER'? item['值'].dataSourceName +'自填' + : item['值'].dataSourceName +'添加'}} + + + + 编辑 + + + 删除 + + + + + + + + + + + 政治面貌 + {{list['基础信息']['政治面貌'].dataValue}} + + + + + + 由{{list['基础信息']['政治面貌'].dataSourceType==='CONSUMER'? list['基础信息']['政治面貌'].dataSourceName +'自填' + : list['基础信息']['政治面貌'].dataSourceName +'添加'}} + + + + 编辑 + + + + + + + + + + 婚姻状况 + {{list['基础信息']['婚姻状况'].dataValue}} + + + + + + 由{{list['基础信息']['婚姻状况'].dataSourceType==='CONSUMER'? list['基础信息']['婚姻状况'].dataSourceName +'自填' + : list['基础信息']['婚姻状况'].dataSourceName +'添加'}} + + + + 编辑 + + + + + + + + + + + + + + 学历教育 + + + 认证可见 + + + + + + + + + + + + + {{item['教育机构'].dataValue}}已删除 + + + + 由{{item['教育机构'].dataSourceType==='CONSUMER'? item['教育机构'].dataSourceName +'自填' + : item['教育机构'].dataSourceName +'添加'}} + + + + + + 详情> + + {{item['教育机构'].dataValue}} + + + + + + 由{{item['教育机构'].dataSourceType==='CONSUMER'? item['教育机构'].dataSourceName +'自填' + : item['教育机构'].dataSourceName +'添加'}} + + + + + +添加学历教育 + + + + + + + + + + 非学历教育 + + + 认证可见 + + + + + + + + + + + + + {{item['教育机构'].dataValue}}已删除 + + + + 由{{item['教育机构'].dataSourceType==='CONSUMER'? item['教育机构'].dataSourceName +'自填' + : item['教育机构'].dataSourceName +'添加'}} + + + + + + 详情> + + {{item['教育机构'].dataValue}} + + + + + + + 由{{item['教育机构'].dataSourceType==='CONSUMER'? item['教育机构'].dataSourceName +'自填' + : item['教育机构'].dataSourceName +'添加'}} + + + + + +添加非学历教育 + + + + + + + + + + 职业经历 + + + 认证可见 + + + + + + + + + + + + + {{item['单位名称'].dataValue}}已删除 + + + + 由{{item['单位名称'].dataSourceType==='CONSUMER'? item['单位名称'].dataSourceName +'自填' + : item['单位名称'].dataSourceName +'添加'}} + + + + + + 详情> + + {{item['单位名称'].dataValue}} + + + + + + 由{{item['单位名称'].dataSourceType==='CONSUMER'? item['单位名称'].dataSourceName +'自填' + : item['单位名称'].dataSourceName +'添加'}} + + + + + +添加职业经历 + + + + + + + + + + 社会活动经历 + + + 认证可见 + + + + + + + + + + + + + + + + + {{item['内容'].dataValue}}已删除 + + + + 由{{item['内容'].dataSourceType==='CONSUMER'? item['内容'].dataSourceName +'自填' + : item['内容'].dataSourceName +'添加'}} + + + + + + + 详情> + + {{item['内容'].dataValue}} + + + + + + 由{{item['内容'].dataSourceType==='CONSUMER'? item['内容'].dataSourceName +'自填' + : item['内容'].dataSourceName +'添加'}} + + + + + + + + +添加社会活动经历 + + + + + + + + + + 失效数据 + + 全部收起 + + + 顶部 + + + + + + + 您可以在【信息报告管理】中针对您的个人数据档案勾选全部或部分数据生成不同版本的信息报告,用于个人增信展示或者提供给他人查验。 + + + + + + + + + + {{item.name}} + + 取消 + + + + \ No newline at end of file diff --git a/miniprogram/pages/informationCreate/informationCreate.json b/miniprogram/pages/informationCreate/informationCreate.json new file mode 100644 index 0000000..36e654e --- /dev/null +++ b/miniprogram/pages/informationCreate/informationCreate.json @@ -0,0 +1,9 @@ +{ + "navigationBarBackgroundColor": "#3A61B1", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "", + "usingComponents": { + "btn": "/components/btn/btn", + "uploadImages":"/components/uploadImages/uploadImages" + } +} \ No newline at end of file diff --git a/miniprogram/pages/informationCreate/informationCreate.scss b/miniprogram/pages/informationCreate/informationCreate.scss new file mode 100644 index 0000000..14f4dab --- /dev/null +++ b/miniprogram/pages/informationCreate/informationCreate.scss @@ -0,0 +1,487 @@ +/* pages/certification/certification.wxss */ +.form { + padding-bottom: 160rpx; + + .formItem { + border-bottom: 2rpx solid #F3F5F8; + padding: 41rpx 0; + display: flex; + justify-content: space-between; + .uploadImg { + color: #C3C3C3; + font-size: 28rpx; + } + + input { + text-align: right; + } + + .formLabel {} + + .datePicker { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 33rpx; + + // padding-bottom: 41rpx; + .to { + width: 33rpx; + height: 3rpx; + background: #C3C3C3; + } + } + } +} + +.submitLayout { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + background: #fff; + height: 160rpx; + display: flex; + justify-content: center; + align-items: center; + box-shadow: 0px 0px 18rpx 0rpx #CCCCCC; +} + + + +.icon_img { + width: 26rpx; + height: 26rpx; + margin-right: 18rpx; +} + +.icon_delete { + width: 25rpx; + height: 24rpx; +} + +.eduItems { + .eduItem { + border-bottom: 1px solid #F3F5F8; + padding-bottom: 40rpx; + margin-bottom: 25rpx; + + .eduItem_top { + display: flex; + justify-content: space-between; + align-items: center; + + .key { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + } + + .value { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + line-height: 30px; + } + } + + .eduItem_textarea { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + line-height: 42rpx; + margin-top: 26rpx; + margin-bottom: 26rpx; + } + + // .fileList { + // margin-top: 30rpx; + // .fileItem { + // background: #F3F5F8; + // border-radius: 10px; + // height: 159rpx; + // display: flex; + // flex-direction: column; + // justify-content: center; + // padding: 0 29rpx 0 24rpx; + + // .fileItem_top { + // display: flex; + // align-items: center; + // font-size: 24rpx; + // font-family: PingFang SC; + // font-weight: 500; + // color: #3A61B1; + // } + + // .fileItem_bottom { + // display: flex; + // align-items: center; + // justify-content: space-between; + + // .updateDate { + // font-size: 22rpx; + // font-family: PingFang SC; + // font-weight: 400; + // color: #C3C3C3; + // line-height: 30px; + // } + // } + // } + // } + + .eduItem_bottom { + display: flex; + justify-content: space-between; + align-items: center; + + .updateDate { + font-size: 22rpx; + color: #C3C3C3; + } + } + } +} + +.fileList { + margin-top: 30rpx; + + .fileItem { + background: #F3F5F8; + border-radius: 10px; + height: 159rpx; + display: flex; + justify-content: space-between; + flex-direction: row; + align-items: center; + height: 107rpx; + padding: 0 29rpx 0 24rpx; + margin-bottom: 20rpx; + + .fileItem_top { + display: flex; + align-items: center; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + } + + .fileItem_bottom { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A61B1; + + .updateDate { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + color: #C3C3C3; + line-height: 30px; + } + } + } +} + +.eventLayout { + .eventTitle { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #282828; + line-height: 50rpx; + } + + .eventList { + margin-top: 49rpx; + + .eventItem { + margin-bottom: 48rpx; + + .eventDate { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #838383; + + .icon_time { + width: 24rpx; + height: 24rpx; + margin-right: 17rpx; + } + } + + .eventContent { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 19rpx; + margin-bottom: 17rpx; + } + + .updateDate { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + color: #C3C3C3; + line-height: 30px; + } + } + } +} + + + + + + + +.operations { + display: flex; + + .operation { + color: #2F88DB; + font-size: 24rpx; + margin-left: 68rpx; + + .operationIcon { + width: 21rpx; + height: 21rpx; + margin-right: 9rpx; + } + } +} + + +.white-box { + background: #fff; + border-radius: 32rpx; + margin-top: -32rpx; + box-sizing: border-box; + padding: 47rpx; + + .title-box { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + + .edit-box { + display: flex; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #2F88DB; + + image { + width: 29rpx; + height: 28rpx; + margin-right: 10rpx; + } + } + } + + .description { + display: flex; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #B3B3B3; + margin-top: 18rpx; + + image { + width: 20rpx; + height: 20rpx; + margin-right: 10rpx; + } + } + + .form-box { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 15rpx; + + .form-item { + display: flex; + align-items: center; + box-sizing: border-box; + padding: 40rpx 30rpx; + border-bottom: 1rpx solid #D7D7D7; + + &:last-child { + border: none; + } + + text { + margin-right: 43rpx; + } + } + } + + .btn-box { + display: flex; + justify-content: center; + margin-top: 10rpx; + } + + .table-box { + .table-title { + display: flex; + justify-content: space-around; + margin-top: 80rpx; + + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + } + + .table-content { + border: 1rpx solid #E6E6E6; + display: flex; + margin-top: 40rpx; + + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: #6E6E6E; + + .table-col { + display: flex; + flex-direction: column; + justify-content: center; + box-sizing: border-box; + width: 50%; + padding: 40rpx; + + &:last-child { + border-left: 1rpx solid #E6E6E6; + } + + .item { + display: flex; + align-items: center; + margin-bottom: 58rpx; + + &:last-child { + margin-bottom: 0; + } + + image { + width: 63rpx; + height: 63rpx; + margin-right: 32rpx; + flex-shrink: 0; + } + } + } + } + } + + .field-box { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #494949; + margin-top: 50rpx; + + .field-item { + display: flex; + margin-bottom: 46rpx; + + text { + margin-right: 43rpx; + } + } + } + + .information { + box-sizing: border-box; + padding: 30rpx; + border-radius: 10rpx; + background: #FFF7F1; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + line-height: 36rpx; + color: #FE633A; + } + + .price-box { + display: flex; + flex-direction: column; + align-items: flex-end; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000000; + margin-top: 48rpx; + + .price { + font-size: 24rpx; + font-weight: 500; + font-family: PingFang SC; + color: #FF5129; + margin-top: 24rpx; + + text { + font-size: 48rpx; + font-weight: 800; + + } + } + } + + .bottom-box { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + box-shadow: 0 0 18rpx #CCCCCC; + box-sizing: border-box; + padding: 24rpx 50rpx; + padding-bottom: calc(constant(safe-area-inset-top) + 24rpx); + padding-bottom: calc(env(safe-area-inset-top) + 24rpx); + } +} + +.picker-box { + display: flex; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #C3C3C3; + + image { + width: 14rpx; + height: 25rpx; + margin-left: 20rpx; + } +} + +.radio-group { + display: flex; +} + +.weui-cell { + display: flex; + margin-right: 30rpx; + justify-content: space-around; +} \ No newline at end of file diff --git a/miniprogram/pages/informationCreate/informationCreate.ts b/miniprogram/pages/informationCreate/informationCreate.ts new file mode 100644 index 0000000..6e70aed --- /dev/null +++ b/miniprogram/pages/informationCreate/informationCreate.ts @@ -0,0 +1,348 @@ +// pages/certification/certification.ts +import { informationAdd } from '../../apis/information' + +// import { uploadImg } from "../../apis/upload"; +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + // date: '', + now: new Date(), + formName: '', + // form: { + startDate: '', + endDate: '', + jyjg: '', + bq: '', + zymc: '', + // zybh: '', + zycc: '', + xz: '', + sfqrz: '', + jyjg1: '', + zyms: '', + fj: '', + // 非学历额外 + jycp: '', + // cpbh: '', + cpms: '', + jgms: '', + // + dwmc: '', + dwjs: '', + // }, + fileList: [], + countPic: 9,//上传图片最大数量 + showImgUrl: "", //路径拼接,一般上传返回的都是文件名, + uploadImgUrl: '',//图片的上传的路径, + options: [{ name: '全日制' }, { name: '非全日制' }], + zyccOptions: [{ name: '专科' }, { name: '本科' }, { name: '硕士研究生' }, { name: '博士研究生' }], + jyjgOptions: [{ name: '在读' }, { name: '结业' }, { name: '毕业' }, { name: '肄业' }], + xzOptions: [{ name: '二年制' }, { name: '三年制' }, { name: '四年制' }, { name: '五年制' }], + endDateTyeps: [{ name: '当天', value: 0 }, { name: '至今', value: 1 }, { name: '时间选择', value: 2 }], + endDateType: '', + // businessNameAuthenticationTag: undefined + }, + bindDateChange(e) { + this.setData({ + [e.currentTarget.dataset.key]: e.detail.value + }) + }, + radioChange(e) { + console.log(e); + const value = Number(e.detail.value) + switch (value) { + case 0: + this.setData({ + endDate: '当天', + endDateType: value + }) + break; + case 1: + this.setData({ + endDate: '至今', + endDateType: value + }) + break; + case 2: + this.setData({ + endDate: '', + endDateType: value + }) + break; + } + + }, + // bindSfqrzChange(e: WechatMiniprogram.CustomEvent) { + // this.setData({ + // value: this.data.options[e.detail.value].name + // }) + // }, + bindZyccChange(e: WechatMiniprogram.CustomEvent) { + this.setData({ + zycc: this.data.zyccOptions[e.detail.value].name + }) + }, + bindJyjgChange(e: WechatMiniprogram.CustomEvent) { + this.setData({ + jyjg1: this.data.jyjgOptions[e.detail.value].name + }) + }, + xzChange(e: WechatMiniprogram.CustomEvent) { + this.setData({ + xz: this.data.xzOptions[e.detail.value].name + }) + }, + handleCreate() { + // console.log(this.data); + // console.log('handleCreate'); + + let { startDate, endDate, bq, zymc, zycc, xz, sfqrz, jyjg, jyjg1, zyms, fj, fileList + , jycp, cpms, jgms + , dwmc, dwjs, formName, educationStage } = this.data + + if (formName === '职业经历') { + if (!dwmc) { + wx.showToast({ + icon: 'none', + title: `请输入单位名称` + }) + return + } + } + if (!startDate) { + // console.log('请选择开始时间'); + + wx.showToast({ + icon: 'none', + title: `请选择开始时间` + }) + return + } + if (!endDate) { + wx.showToast({ + icon: 'none', + title: `请选择结束时间` + }) + return + } + if (new Date(startDate).getTime() > new Date(endDate).getTime()) { + wx.showToast({ + icon: 'none', + title: `时间范围不正确` + }) + return + } + if (formName === '学历教育' || formName === '非学历教育') { + console.log(this.data); + + if (!jyjg) { + wx.showToast({ + icon: 'none', + title: `请输入教育机构` + }) + return + } + } + + + let payload = {} + if (this.data.formName === '学历教育') { + // payload = { + // '学历教育': [{ + // '教育机构': jyjg, + // '时间': startDate + (endDate ? ',' + endDate : ''), + // '班期': bq, + // '专业名称': zymc, + // '专业层次': zycc, + // '学制': xz, + // '是否全日制': sfqrz, + // '教育结果': jyjg1, + // '专业描述': zyms, + // '附件': fileList.map(item => item.url).toString() + // }] + // } + payload = { + // businessNameAuthenticationName: '', + // businessNameAuthenticationTag: '', + educationStage, + jsonObject: { + '学历教育': [{ + '教育机构': jyjg, + '时间': startDate + (endDate ? ',' + endDate : ''), + '班期': bq, + '专业名称': zymc, + '专业层次': zycc, + '学制': xz, + '是否全日制': sfqrz, + '教育结果': jyjg1, + '专业描述': zyms, + '附件': fileList.map(item => item.url).toString() + }] + } + } + if (this.data.businessNameAuthenticationTag !== undefined) { + payload.businessNameAuthenticationName = jyjg + payload.businessNameAuthenticationTag = this.data.businessNameAuthenticationTag + } + console.log(payload); + + + } else if (this.data.formName === '非学历教育') { + payload = { + jsonObject: { + '非学历教育': [{ + '教育机构': jyjg, + '时间': startDate + (endDate ? ',' + endDate : ''), + '班期': bq, + '教育产品': jycp, + '教育结果': jyjg1, + '产品描述': cpms, + '机构描述': jgms, + '附件': fileList.map(item => item.url).toString() + }] + } + } + if (this.data.businessNameAuthenticationTag !== undefined) { + payload.businessNameAuthenticationName = jyjg + payload.businessNameAuthenticationTag = this.data.businessNameAuthenticationTag + } + + } else if (this.data.formName === '职业经历') { + payload = { + jsonObject: { + '职业经历': [{ + '单位名称': dwmc, + '时间': startDate + (endDate ? ',' + endDate : ''), + '单位介绍': cpms, + '附件': fileList.map(item => item.url).toString() + }] + } + } + if (this.data.businessNameAuthenticationTag !== undefined) { + payload.businessNameAuthenticationName = dwmc + payload.businessNameAuthenticationTag = this.data.businessNameAuthenticationTag + } + } + // console.log(payload); + + informationAdd(payload).then((res: any) => { + if (res.c === 200) { + wx.reLaunch({ + url: '/pages/information/information', + }) + } + }) + }, + optionsChange(e: WechatMiniprogram.CustomEvent) { + console.log(e); + + this.setData({ + sfqrz: this.data.options[e.detail.value].name + }) + }, + zyccChange(e: WechatMiniprogram.CustomEvent) { + console.log(e); + + this.setData({ + zycc: this.data.zyccOptions[e.detail.value].name + }) + }, + + handleDeleteFile(e: WechatMiniprogram.CustomEvent) { + console.log(e); + + let { fileList } = this.data + fileList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + fileList + }) + }, + //监听组件事件,返回的结果 + myEventListener: function (e: WechatMiniprogram.CustomEvent) { + console.log("上传的图片结果集合") + console.log(e.detail.picsList) + this.setData({ + fileList: e.detail.picsList + }) + }, + jumpAddAuthName(e) { + wx.navigateTo({ + url: `/pages/addAuthName/addAuthName?formName=${e.currentTarget.dataset.key}` + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + this.setData({ + formName: wx.getStorageSync('informationName'), + educationStage:wx.getStorageSync('educationStage') + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // console.log('onshow'); + // console.log(this.data.jyjg, this.data.businessNameAuthenticationTag) + + // let pages = getCurrentPages(); + // let currPage = pages[pages.length - 1]; + // console.log(currPage.data); + // if (currPage.data.jyjg) { + // this.setData({ + // //将携带的参数赋值 + // jyjg: currPage.data.jyjg, + // businessNameAuthenticationTag: currPage.data.courseid, + // }); + // } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/informationCreate/informationCreate.wxml b/miniprogram/pages/informationCreate/informationCreate.wxml new file mode 100644 index 0000000..3786e98 --- /dev/null +++ b/miniprogram/pages/informationCreate/informationCreate.wxml @@ -0,0 +1,241 @@ + + + + + + + 单位名称 + + + + + + + 单位介绍 +