├── .gitignore
├── README.md
├── app.js
├── app.json
├── app.wxss
├── assets
└── image
│ ├── GitHub.png
│ └── shareImg.jpg
├── components
├── baseCard
│ ├── baseCard.js
│ ├── baseCard.json
│ ├── baseCard.wxml
│ └── baseCard.wxss
├── basicInfo
│ ├── basicInfo.js
│ ├── basicInfo.json
│ ├── basicInfo.wxml
│ └── basicInfo.wxss
├── betterTabBar
│ ├── betterTabBar.js
│ ├── betterTabBar.json
│ ├── betterTabBar.wxml
│ └── betterTabBar.wxss
├── bottomMessage
│ ├── bottomMessage.js
│ ├── bottomMessage.json
│ ├── bottomMessage.wxml
│ └── bottomMessage.wxss
├── charts
│ ├── ec-canvas
│ │ ├── ec-canvas.js
│ │ ├── ec-canvas.json
│ │ ├── ec-canvas.wxml
│ │ ├── ec-canvas.wxss
│ │ ├── echarts.js
│ │ └── wx-canvas.js
│ └── pieChart
│ │ ├── pieChart.js
│ │ ├── pieChart.json
│ │ ├── pieChart.wxml
│ │ └── pieChart.wxss
├── iViewUi
│ ├── action-sheet
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── alert
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── avatar
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── badge
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── base
│ │ └── index.js
│ ├── button
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── card
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── cell-group
│ │ ├── index.js
│ │ ├── index.json
│ │ └── index.wxml
│ ├── cell
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── checkbox-group
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── checkbox
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── col
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── collapse-item
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── collapse
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── count-down
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── divider
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── drawer
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── grid-icon
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── grid-item
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── grid-label
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── grid
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── icon
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── index-item
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── index
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── input-number
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── input
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── load-more
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── message
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── modal
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── notice-bar
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── page
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── panel
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── progress
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── radio-group
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── radio
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── rate
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── row
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── slide
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── spin
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── step
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── steps
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── sticky-item
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── sticky
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── swipeout
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── switch
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── tab-bar-item
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── tab-bar
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── tab
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── tabs
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ ├── tag
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
│ └── toast
│ │ ├── index.js
│ │ ├── index.json
│ │ ├── index.wxml
│ │ └── index.wxss
├── my-table
│ ├── my-table.js
│ ├── my-table.json
│ ├── my-table.wxml
│ └── my-table.wxss
└── topBar
│ ├── topBar.js
│ ├── topBar.json
│ ├── topBar.wxml
│ └── topBar.wxss
├── models
├── ResponseModel.js
├── problemModel.js
└── questionnaireModel.js
├── network
├── analysis.js
├── complete.js
├── config.js
├── questionnaire.js
├── requests.js
└── user.js
├── pages
├── analysis
│ ├── analysis.js
│ ├── analysis.json
│ ├── analysis.wxml
│ └── analysis.wxss
├── basicEdition
│ ├── basicEdition.js
│ ├── basicEdition.json
│ ├── basicEdition.wxml
│ └── basicEdition.wxss
├── basicInfoEdition
│ ├── basicInfoEdition.js
│ ├── basicInfoEdition.json
│ ├── basicInfoEdition.wxml
│ └── basicInfoEdition.wxss
├── complete
│ ├── childCmp
│ │ └── completeCard
│ │ │ ├── completeCard.js
│ │ │ ├── completeCard.json
│ │ │ ├── completeCard.wxml
│ │ │ └── completeCard.wxss
│ ├── complete.js
│ ├── complete.json
│ ├── complete.wxml
│ └── complete.wxss
├── detailedAnalysis
│ ├── detailedAnalysis.js
│ ├── detailedAnalysis.json
│ ├── detailedAnalysis.wxml
│ └── detailedAnalysis.wxss
├── manage
│ ├── childCmp
│ │ └── itemCard
│ │ │ ├── itemCard.js
│ │ │ ├── itemCard.json
│ │ │ ├── itemCard.wxml
│ │ │ └── itemCard.wxss
│ ├── manage.js
│ ├── manage.json
│ ├── manage.wxml
│ └── manage.wxss
├── problemEdition
│ ├── childCmp
│ │ └── optionCard
│ │ │ ├── optionCard.js
│ │ │ ├── optionCard.json
│ │ │ ├── optionCard.wxml
│ │ │ └── optionCard.wxss
│ ├── problemEdition.js
│ ├── problemEdition.json
│ ├── problemEdition.wxml
│ └── problemEdition.wxss
├── profile
│ ├── profile.js
│ ├── profile.json
│ ├── profile.wxml
│ └── profile.wxss
├── questionnaire
│ ├── childCmp
│ │ └── problemCard
│ │ │ ├── problemCard.js
│ │ │ ├── problemCard.json
│ │ │ ├── problemCard.wxml
│ │ │ └── problemCard.wxss
│ ├── questionnaire.js
│ ├── questionnaire.json
│ ├── questionnaire.wxml
│ └── questionnaire.wxss
└── success
│ ├── success.js
│ ├── success.json
│ ├── success.wxml
│ └── success.wxss
├── project.config.json
├── sitemap.json
├── utils
├── base64.js
├── messageBox.js
└── timeHelper.js
└── wxs
└── common.wxs
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 问卷调查平台小程序版
2 |
3 | #### 此项目是问卷调查平台的小程序端项目
4 |
5 | #### API接口文档 https://www.showdoc.cc/EasyQuestionnaire
6 |
7 | #### (web端) https://github.com/yuzhanglong/EasyQuestionnaire-web
8 |
9 | #### 后端项目地址:https://github.com/yuzhanglong/EasyQuestionnaire-backend
10 |
11 |
12 | ## 项目结构
13 | ```
14 | EasyQuestionnaire-MiniProgram
15 | ├─ app.js // 项目入口
16 | ├─ app.json // 配置
17 | ├─ app.wxss
18 | ├─ assets // 静态文件
19 | │ └─ image
20 | │ ├─ GitHub.png
21 | │ └─ shareImg.jpg // 分享时的配图
22 | ├─ components // 组件目录
23 | │ ├─ baseCard // 基础卡片组件
24 | │ ├─ basicInfo // 基本信息组件
25 | │ ├─ betterTabBar // tabbar组件
26 | │ ├─ bottomMessage // 底部信息组件
27 | │ ├─ charts // 图标相关(未启用)
28 | │ │ └─ pieChart
29 | │ ├─ iViewUi // 项目所依赖的ui 作出了一些小小的修改
30 | │ ├─ my-table // 表格组件
31 | │ └─ topBar // 顶部组件
32 | ├─ models // 模型
33 | │ ├─ problemModel.js
34 | │ ├─ questionnaireModel.js
35 | │ └─ ResponseModel.js
36 | ├─ network // 请求封装
37 | │ ├─ analysis.js
38 | │ ├─ complete.js
39 | │ ├─ config.js
40 | │ ├─ questionnaire.js
41 | │ ├─ requests.js
42 | │ └─ user.js
43 | ├─ pages // 视图文件
44 | │ ├─ analysis // 数据分析页面
45 | │ ├─ basicEdition // 问卷基本信息编辑页面
46 | │ ├─ basicInfoEdition // 问卷主副标题编辑页面
47 | │ ├─ complete // 填报页面
48 | │ │ ├─ childCmp
49 | │ │ │ └─ completeCard // 填报问题卡片
50 | │ ├─ detailedAnalysis // 单个题目的数据分析页面
51 | │ ├─ manage // 问卷管理页面
52 | │ │ ├─ childCmp
53 | │ │ │ └─ itemCard
54 | │ ├─ problemEdition // 问卷编辑页面
55 | │ │ ├─ childCmp
56 | │ │ │ └─ optionCard
57 | │ ├─ profile // 个人中心
58 | │ ├─ questionnaire
59 | │ │ ├─ childCmp
60 | │ │ │ └─ problemCard
61 | │ └─ success // 填报成功页面
62 | ├─ project.config.json
63 | ├─ README.md // 项目自述
64 | ├─ sitemap.json
65 | ├─ utils // 工具相关
66 | │ ├─ base64.js
67 | │ ├─ messageBox.js
68 | │ └─ timeHelper.js
69 | └─ wxs // 全局wxs
70 | └─ common.wxs
71 |
72 | ```
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | import {UserRequest} from "./network/user";
3 |
4 | const TOKEN = 'token';
5 |
6 | App({
7 | globalData: {
8 | userInfo: null,
9 | token: '',
10 | isLogin: false,
11 | initSuccess: true
12 | },
13 | onLaunch() {
14 | const token = wx.getStorageSync(TOKEN);
15 | if (token) {
16 | this.checkToken(token);
17 | this.getUserInfo();
18 | } else {
19 | this.weChatLogin();
20 | }
21 | },
22 |
23 | checkToken(token) {
24 | UserRequest.checkToken(token)
25 | .then(res => {
26 | this.globalData.token = token;
27 | if (this.userInfoReadyCallback) {
28 | this.userInfoReadyCallback(token);
29 | }
30 | })
31 | .catch(() => {
32 | // 重新登录
33 | this.weChatLogin();
34 | })
35 | },
36 |
37 | weChatLogin() {
38 | // 登录
39 | wx.login({
40 | success: res => {
41 | // 发送 res.code 到后台换取 openId, sessionKey, unionId
42 | UserRequest.userLogin('testNickName', res.code)
43 | .then(res => {
44 | this.globalData.token = res.data.token;
45 | wx.setStorageSync(TOKEN, this.globalData.token);
46 | if (this.userInfoReadyCallback) {
47 | this.userInfoReadyCallback(res.data.token);
48 | }
49 | }).catch(() => {
50 | this.globalData.initSuccess = false;
51 | });
52 | }
53 | });
54 |
55 | // 获取用户信息
56 | wx.getSetting({
57 | success: res => {
58 | if (res.authSetting['scope.userInfo']) {
59 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
60 | this.getUserInfo();
61 | } else {
62 | wx.authorize({
63 | scope: 'scope.userInfo',
64 | success() {
65 | // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
66 | this.getUserInfo();
67 | }
68 | })
69 | }
70 | }
71 | })
72 | },
73 |
74 | getUserInfo() {
75 | wx.getUserInfo({
76 | success: res => {
77 | // 可以将 res 发送给后台解码出 unionId
78 | this.globalData.userInfo = res.userInfo
79 | }
80 | })
81 | }
82 | });
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/manage/manage",
4 | "pages/questionnaire/questionnaire",
5 | "pages/profile/profile",
6 | "pages/basicEdition/basicEdition",
7 | "pages/basicInfoEdition/basicInfoEdition",
8 | "pages/problemEdition/problemEdition",
9 | "pages/problemEdition/childCmp/optionCard/optionCard",
10 | "pages/complete/complete",
11 | "pages/success/success",
12 | "pages/analysis/analysis",
13 | "pages/detailedAnalysis/detailedAnalysis"
14 | ],
15 | "window": {
16 | "backgroundTextStyle": "light",
17 | "navigationBarBackgroundColor": "#fff",
18 | "navigationBarTitleText": "WeChat",
19 | "navigationBarTextStyle": "black",
20 | "navigationStyle": "default"
21 | },
22 | "sitemapLocation": "sitemap.json"
23 | }
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/assets/image/GitHub.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/assets/image/GitHub.png
--------------------------------------------------------------------------------
/assets/image/shareImg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/assets/image/shareImg.jpg
--------------------------------------------------------------------------------
/components/baseCard/baseCard.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | widthByVw: Number,
4 | tailWidthByVw:Number
5 | },
6 | data: {},
7 | methods: {},
8 | options: {
9 | multipleSlots: true
10 | }
11 | });
12 |
--------------------------------------------------------------------------------
/components/baseCard/baseCard.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/components/baseCard/baseCard.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/components/baseCard/baseCard.wxss:
--------------------------------------------------------------------------------
1 | .base-card {
2 | background-color: white;
3 | /* 和上方文字对齐*/
4 | margin-left: 30rpx;
5 | margin-right: 30rpx;
6 | }
7 |
8 |
9 | .base-card-body {
10 | flex: 1;
11 | }
12 |
13 | .base-card-tail {
14 | padding-left: 4rpx;
15 | }
16 |
17 | .base-card-items {
18 | display: flex;
19 | padding-top: 20rpx;
20 | padding-bottom: 20rpx;
21 | }
22 |
23 | .base-card-head{
24 | display: flex;
25 | flex-direction: column;
26 | justify-content: center;
27 | }
--------------------------------------------------------------------------------
/components/basicInfo/basicInfo.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | title: String,
4 | subTitle: String,
5 | questionnaireId: Number,
6 | showEditionButtion: Boolean
7 | },
8 | data: {},
9 | methods: {
10 | gotoEditQuestionnaireBasicInfo() {
11 | let qid = this.properties.questionnaireId;
12 | let subTitle = this.properties.subTitle;
13 | let title = this.properties.title;
14 | wx.navigateTo({
15 | url: `/pages/basicInfoEdition/basicInfoEdition?qid=${qid}&title=${title}&subTitle=${subTitle}`
16 | });
17 | }
18 | }
19 | });
20 |
--------------------------------------------------------------------------------
/components/basicInfo/basicInfo.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/components/basicInfo/basicInfo.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{title}}
5 | {{subTitle}}
6 |
7 |
8 | 编辑
9 |
10 |
11 |
--------------------------------------------------------------------------------
/components/basicInfo/basicInfo.wxss:
--------------------------------------------------------------------------------
1 | .basic-info {
2 | background-color: white;
3 | /* 和上方文字对齐*/
4 | margin-left: 30rpx;
5 | margin-right: 30rpx;
6 |
7 | }
8 |
9 | .basic-info-wrap {
10 | padding: 24rpx;
11 | display: flex;
12 | }
13 |
14 | .basic-info-title {
15 | font-size: 32rpx;
16 | }
17 |
18 | .basic-info-subtitle {
19 | padding-top: 22rpx;
20 | font-size: 23rpx;
21 | color: #86878B;
22 | }
23 |
24 | .title-group {
25 | width: 77vw;
26 | }
27 |
28 | .edit-button-wrap {
29 | display: flex;
30 | flex-direction: column;
31 | justify-content: center;
32 | font-size: 26rpx;
33 | color: #368DFF;
34 | }
--------------------------------------------------------------------------------
/components/betterTabBar/betterTabBar.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | current: String
4 | },
5 | methods: {
6 | handleChange(event) {
7 | let key = event.detail.key;
8 | let url = null;
9 | key === 'questionnaire' ? url = '/pages/questionnaire/questionnaire?qid=new' : url = `/pages/${key}/${key}`;
10 | wx.navigateTo({
11 | url: url
12 | });
13 | }
14 | }
15 | });
16 |
--------------------------------------------------------------------------------
/components/betterTabBar/betterTabBar.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-tab-bar": "/components/iViewUi/tab-bar/index",
5 | "i-tab-bar-item": "/components/iViewUi/tab-bar-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/components/betterTabBar/betterTabBar.wxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
10 |
14 |
15 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/components/betterTabBar/betterTabBar.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/components/betterTabBar/betterTabBar.wxss
--------------------------------------------------------------------------------
/components/bottomMessage/bottomMessage.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | message: {
4 | type: String,
5 | value: "感谢你使用EasyQuestionnaire"
6 | }
7 | },
8 | data: {},
9 | methods: {}
10 | });
11 |
--------------------------------------------------------------------------------
/components/bottomMessage/bottomMessage.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-load-more": "/components/iViewUi/load-more/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/components/bottomMessage/bottomMessage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/components/bottomMessage/bottomMessage.wxss:
--------------------------------------------------------------------------------
1 | .bottom-message {
2 | padding-top: 50px;
3 | }
--------------------------------------------------------------------------------
/components/charts/ec-canvas/ec-canvas.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/charts/ec-canvas/ec-canvas.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/components/charts/ec-canvas/ec-canvas.wxss:
--------------------------------------------------------------------------------
1 | .ec-canvas {
2 | width: 100%;
3 | height: 100%;
4 | }
5 |
--------------------------------------------------------------------------------
/components/charts/pieChart/pieChart.js:
--------------------------------------------------------------------------------
1 | import * as echarts from '../ec-canvas/echarts';
2 |
3 |
4 | Component({
5 | properties: {
6 | backGroundColor: String,
7 | chartColor: Array,
8 | chartData: Array,
9 | width: Number,
10 | height: Number
11 | },
12 | data: {
13 | ec: {
14 | lazyLoad: true
15 | }
16 | },
17 | lifetimes: {
18 | created() {
19 | this.ecComponent = this.selectComponent('.mychart-dom-bar');
20 |
21 | },
22 | attached() {
23 | this.initPieChart();
24 | }
25 | },
26 | methods: {
27 | initPieChart() {
28 | this.ecComponent.init((canvas, width, height, dpr) => {
29 | // 获取组件的 canvas、width、height 后的回调函数
30 | // 在这里初始化图表
31 | const chart = echarts.init(canvas, null, {
32 | width: width,
33 | height: height,
34 | devicePixelRatio: dpr // new
35 | });
36 | this.setOption(chart);
37 | this.chart = chart;
38 | return chart;
39 | })
40 | },
41 | setOption(chart) {
42 | console.log(this.properties);
43 | const option = {
44 | backgroundColor: this.properties.backGroundColor || "#ffffff",
45 | color: this.properties.chartColor || ["#37A2DA", "#32C5E9", "#67E0E3", "#91F2DE", "#FFDB5C", "#FF9F7F"],
46 | series: [{
47 | label: {
48 | normal: {
49 | fontSize: 14
50 | }
51 | },
52 | type: 'pie',
53 | radius: '65%',
54 | center: ['50%', '50%'],
55 | data: this.properties.chartData || [{value: 55, name: '测试数据'}]
56 | }]
57 | };
58 | chart.setOption(option);
59 | }
60 | }
61 | }
62 | );
63 |
64 |
--------------------------------------------------------------------------------
/components/charts/pieChart/pieChart.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "ec-canvas": "../ec-canvas/ec-canvas"
5 | }
6 | }
--------------------------------------------------------------------------------
/components/charts/pieChart/pieChart.wxml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/components/charts/pieChart/pieChart.wxss:
--------------------------------------------------------------------------------
1 | ec-canvas {
2 | width: 100%;
3 | height: 100%;
4 | }
5 |
6 | .pie-chart {
7 | width: 300px;
8 | height: 300px;
9 | }
--------------------------------------------------------------------------------
/components/iViewUi/action-sheet/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class', 'i-class-mask', 'i-class-header'],
3 |
4 | options: {
5 | multipleSlots: true
6 | },
7 |
8 | properties: {
9 | visible: {
10 | type: Boolean,
11 | value: false
12 | },
13 | maskClosable: {
14 | type: Boolean,
15 | value: true
16 | },
17 | showCancel: {
18 | type: Boolean,
19 | value: false
20 | },
21 | cancelText: {
22 | type: String,
23 | value: '取消'
24 | },
25 | actions: {
26 | type: Array,
27 | value: []
28 | }
29 | },
30 |
31 | methods: {
32 | handleClickMask () {
33 | if (!this.data.maskClosable) return;
34 | this.handleClickCancel();
35 | },
36 |
37 | handleClickItem ({ currentTarget = {} }) {
38 | const dataset = currentTarget.dataset || {};
39 | const { index } = dataset;
40 | this.triggerEvent('click', { index });
41 | },
42 |
43 | handleClickCancel () {
44 | this.triggerEvent('cancel');
45 | }
46 | }
47 | });
48 |
--------------------------------------------------------------------------------
/components/iViewUi/action-sheet/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-button": "../button/index",
6 | "i-icon": "../icon/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/components/iViewUi/action-sheet/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
14 |
15 |
16 | {{ item.name }}
17 |
18 |
19 |
20 |
21 | {{ cancelText }}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/components/iViewUi/action-sheet/index.wxss:
--------------------------------------------------------------------------------
1 | .i-as {
2 | position: fixed;
3 | width: 100%;
4 | box-sizing: border-box;
5 | left: 0;
6 | right: 0;
7 | bottom: 0;
8 | background: #f7f7f7;
9 | transform: translate3d(0, 100%, 0);
10 | transform-origin: center;
11 | transition: all .2s ease-in-out;
12 | z-index: 900;
13 | visibility: hidden
14 | }
15 |
16 | .i-as-show {
17 | transform: translate3d(0, 0, 0);
18 | visibility: visible
19 | }
20 |
21 | .i-as-mask {
22 | position: fixed;
23 | top: 0;
24 | left: 0;
25 | right: 0;
26 | bottom: 0;
27 | background: rgba(0, 0, 0, .7);
28 | z-index: 900;
29 | transition: all .2s ease-in-out;
30 | opacity: 0;
31 | visibility: hidden
32 | }
33 |
34 | .i-as-mask-show {
35 | opacity: 1;
36 | visibility: visible
37 | }
38 |
39 | .i-as-action-item {
40 | position: relative;
41 | /*此处修改*/
42 | background-color: white;
43 | }
44 |
45 | .i-as-action-item::after {
46 | content: '';
47 | position: absolute;
48 | top: 0;
49 | left: 0;
50 | width: 200%;
51 | height: 200%;
52 | transform: scale(.5);
53 | transform-origin: 0 0;
54 | pointer-events: none;
55 | box-sizing: border-box;
56 | border: 0 solid #e9eaec;
57 | border-bottom-width: 1px;
58 |
59 | }
60 |
61 | .i-as-header {
62 | background: #fff;
63 | text-align: center;
64 | position: relative;
65 | font-size: 12px;
66 | color: #80848f
67 | }
68 |
69 | .i-as-header::after {
70 | content: '';
71 | position: absolute;
72 | top: 0;
73 | left: 0;
74 | width: 200%;
75 | height: 200%;
76 | transform: scale(.5);
77 | transform-origin: 0 0;
78 | pointer-events: none;
79 | box-sizing: border-box;
80 | border: 0 solid #e9eaec;
81 | border-bottom-width: 1px
82 | }
83 |
84 | .i-as-cancel {
85 | margin-top: 6px;
86 | background-color: white;
87 | }
88 |
89 | .i-as-btn-loading {
90 | display: inline-block;
91 | vertical-align: middle;
92 | margin-right: 10px;
93 | width: 12px;
94 | height: 12px;
95 | background: 0 0;
96 | border-radius: 50%;
97 | border: 2px solid #e5e5e5;
98 | border-color: #666 #e5e5e5 #e5e5e5 #e5e5e5;
99 | animation: btn-spin .6s linear;
100 | animation-iteration-count: infinite
101 | }
102 |
103 | .i-as-btn-text {
104 | display: inline-block;
105 | vertical-align: middle
106 | }
107 |
108 | .i-as-btn-icon {
109 | font-size: 14px !important;
110 | margin-right: 4px
111 | }
112 |
113 | @keyframes btn-spin {
114 | 0% {
115 | transform: rotate(0)
116 | }100% {
117 | transform: rotate(360deg)
118 | }
119 | }
--------------------------------------------------------------------------------
/components/iViewUi/alert/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | options: {
4 | multipleSlots: true
5 | },
6 | properties: {
7 | //info, success, warning, error
8 | type: {
9 | type: String,
10 | value: 'info'
11 | },
12 | closable: {
13 | type: Boolean,
14 | value: false
15 | },
16 | showIcon: {
17 | type: Boolean,
18 | default: false
19 | },
20 | desc: {
21 | type: Boolean,
22 | default: false
23 | },
24 | },
25 | data: {
26 | closed: false
27 | },
28 | methods: {
29 | handleTap() {
30 | this.setData({
31 | closed: !this.data.closed,
32 | });
33 | this.triggerEvent('close');
34 | },
35 |
36 | }
37 | });
38 |
--------------------------------------------------------------------------------
/components/iViewUi/alert/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-icon": "../icon/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/alert/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/components/iViewUi/alert/index.wxss:
--------------------------------------------------------------------------------
1 | .i-alert{position:relative;margin:10px;padding:8px 48px 8px 16px;font-size:14px;border-radius:2px;color:#fff;background:#f7f7f7;color:#495060}.i-alert.i-alert-with-icon{padding:8px 48px 8px 38px}.i-alert-info{color:#fff;background:#2db7f5}.i-alert-success{color:#fff;background:#19be6b}.i-alert-warning{color:#fff;background:#f90}.i-alert-error{color:#fff;background:#ed3f14}.i-alert-icon{position:absolute;top:9px;left:16px;font-size:14px}.i-alert-desc{font-size:12px}.i-alert-with-desc{padding:16px;position:relative}.i-alert-with-desc.i-alert-with-icon{padding:16px 16px 16px 69px}.i-alert-with-desc .i-alert-icon{top:50%;left:24px;margin-top:-21px;font-size:28px}.i-alert-close{font-size:12px;position:absolute;right:16px;top:8px;overflow:hidden;cursor:pointer}
--------------------------------------------------------------------------------
/components/iViewUi/avatar/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | properties: {
5 | // circle || square
6 | shape: {
7 | type: String,
8 | value: 'circle'
9 | },
10 | // small || large || default
11 | size: {
12 | type: String,
13 | value: 'default'
14 | },
15 | src: {
16 | type: String,
17 | value: ''
18 | }
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/components/iViewUi/avatar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/avatar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/components/iViewUi/avatar/index.wxss:
--------------------------------------------------------------------------------
1 | .i-avatar{display:inline-block;text-align:center;background:#ccc;color:#fff;white-space:nowrap;position:relative;overflow:hidden;vertical-align:middle;width:32px;height:32px;line-height:32px;border-radius:16px;font-size:18px}.i-avatar .ivu-avatar-string{line-height:32px}.i-avatar-large{width:40px;height:40px;line-height:40px;border-radius:20px;font-size:24px}.i-avatar-large .ivu-avatar-string{line-height:40px}.i-avatar-small{width:24px;height:24px;line-height:24px;border-radius:12px;font-size:14px}.i-avatar-small .ivu-avatar-string{line-height:24px}.i-avatar-image{background:0 0}.i-avatar-square{border-radius:4px}.i-avatar>image{width:100%;height:100%}
--------------------------------------------------------------------------------
/components/iViewUi/badge/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class', 'i-class-alone'],
3 |
4 | properties: {
5 | count: {
6 | type: Number,
7 | value: 0,
8 | observer: 'finalCount'
9 | },
10 | overflowCount: {
11 | type: Number,
12 | value: 99
13 | },
14 | dot: {
15 | type: Boolean,
16 | value: false
17 | },
18 | },
19 | data: {
20 | finalCount: 0
21 | },
22 | methods: {
23 | finalCount() {
24 | this.setData({
25 | finalCount: parseInt(this.data.count) >= parseInt(this.data.overflowCount) ? `${this.data.overflowCount}+` : this.data.count
26 | });
27 | },
28 | }
29 | });
30 |
--------------------------------------------------------------------------------
/components/iViewUi/badge/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/badge/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ finalCount }}
5 |
6 |
--------------------------------------------------------------------------------
/components/iViewUi/badge/index.wxss:
--------------------------------------------------------------------------------
1 | .i-badge{position:relative;display:inline-block;line-height:1;vertical-align:middle}.i-badge-count{position:absolute;transform:translateX(50%);top:-6px;right:0;height:18px;border-radius:9px;min-width:18px;background:#ed3f14;border:1px solid transparent;color:#fff;line-height:18px;text-align:center;padding:0 5px;font-size:12px;white-space:nowrap;transform-origin:-10% center;z-index:10;box-shadow:0 0 0 1px #fff;box-sizing:border-box;text-rendering:optimizeLegibility}.i-badge-count-alone{top:auto;display:block;position:relative;transform:translateX(0)}.i-badge-dot{position:absolute;transform:translateX(-50%);transform-origin:0 center;top:-4px;right:-8px;height:8px;width:8px;border-radius:100%;background:#ed3f14;z-index:10;box-shadow:0 0 0 1px #fff}
--------------------------------------------------------------------------------
/components/iViewUi/base/index.js:
--------------------------------------------------------------------------------
1 | function getCtx (selector) {
2 | const pages = getCurrentPages();
3 | const ctx = pages[pages.length - 1];
4 |
5 | const componentCtx = ctx.selectComponent(selector);
6 |
7 | if (!componentCtx) {
8 | console.error('无法找到对应的组件,请按文档说明使用组件');
9 | return null;
10 | }
11 | return componentCtx;
12 | }
13 |
14 | function Toast(options) {
15 | const { selector = '#toast' } = options;
16 | const ctx = getCtx(selector);
17 |
18 | ctx.handleShow(options);
19 | }
20 |
21 | Toast.hide = function (selector = '#toast') {
22 | const ctx = getCtx(selector);
23 |
24 | ctx.handleHide();
25 | };
26 |
27 | function Message(options) {
28 | const { selector = '#message' } = options;
29 | const ctx = getCtx(selector);
30 |
31 | ctx.handleShow(options);
32 | }
33 |
34 | module.exports = {
35 | $Toast: Toast,
36 | $Message: Message
37 | };
--------------------------------------------------------------------------------
/components/iViewUi/button/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | properties: {
5 | // default, primary, ghost, info, success, warning, error
6 | type: {
7 | type: String,
8 | value: '',
9 | },
10 | inline: {
11 | type: Boolean,
12 | value: false
13 | },
14 | // default, large, small
15 | size: {
16 | type: String,
17 | value: '',
18 | },
19 | // circle, square
20 | shape: {
21 | type: String,
22 | value: 'square'
23 | },
24 | disabled: {
25 | type: Boolean,
26 | value: false,
27 | },
28 | loading: {
29 | type: Boolean,
30 | value: false,
31 | },
32 | long: {
33 | type: Boolean,
34 | value: false
35 | },
36 | openType: String,
37 | appParameter: String,
38 | hoverStopPropagation: Boolean,
39 | hoverStartTime: {
40 | type: Number,
41 | value: 20
42 | },
43 | hoverStayTime: {
44 | type: Number,
45 | value: 70
46 | },
47 | lang: {
48 | type: String,
49 | value: 'en'
50 | },
51 | sessionFrom: {
52 | type: String,
53 | value: ''
54 | },
55 | sendMessageTitle: String,
56 | sendMessagePath: String,
57 | sendMessageImg: String,
58 | showMessageCard: Boolean
59 | },
60 |
61 | methods: {
62 | handleTap () {
63 | if (this.data.disabled) return false;
64 |
65 | this.triggerEvent('click');
66 | },
67 | bindgetuserinfo({ detail = {} } = {}) {
68 | this.triggerEvent('getuserinfo', detail);
69 | },
70 | bindcontact({ detail = {} } = {}) {
71 | this.triggerEvent('contact', detail);
72 | },
73 | bindgetphonenumber({ detail = {} } = {}) {
74 | this.triggerEvent('getphonenumber', detail);
75 | },
76 | binderror({ detail = {} } = {}) {
77 | this.triggerEvent('error', detail);
78 | }
79 | }
80 | });
81 |
--------------------------------------------------------------------------------
/components/iViewUi/button/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/button/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/button/index.wxss:
--------------------------------------------------------------------------------
1 | .i-btn {
2 | text-align: center;
3 | vertical-align: middle;
4 | touch-action: manipulation;
5 | cursor: pointer;
6 | background-image: none;
7 | white-space: nowrap;
8 | user-select: none;
9 | font-size: 14px;
10 | border-radius: 2px;
11 | border: 0 !important;
12 | position: relative;
13 | text-decoration: none;
14 | height: 44px;
15 | line-height: 44px;
16 | box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
17 | color: #fff !important;
18 | background: #f7f7f7;
19 | color: #495060 !important;
20 | margin: 10px
21 | }
22 |
23 | .i-btn-hover {
24 | opacity: .9;
25 | }
26 |
27 | .i-btn-long {
28 | border-radius: 0;
29 | margin: 0;
30 | box-shadow: none
31 | }
32 |
33 | .i-btn-large {
34 | height: 48px;
35 | line-height: 48px
36 | }
37 |
38 | .i-btn-small {
39 | height: 40px;
40 | line-height: 40px
41 | }
42 |
43 | .i-btn-primary {
44 | color: #fff !important;
45 | background: #2d8cf0 !important
46 | }
47 |
48 | .i-btn-ghost {
49 | color: #fff !important;
50 | background: #fff !important;
51 | color: #495060 !important
52 | }
53 |
54 | .i-btn-success {
55 | color: #fff !important;
56 | background: #19be6b !important
57 | }
58 |
59 | .i-btn-warning {
60 | color: #fff !important;
61 | background: #f90 !important
62 | }
63 |
64 | .i-btn-error {
65 | color: #fff !important;
66 | background: #ed3f14 !important
67 | }
68 |
69 | .i-btn-info {
70 | color: #fff !important;
71 | background: #2db7f5 !important
72 | }
73 |
74 | .i-btn-circle {
75 | border-radius: 44px
76 | }
77 |
78 | .i-btn-large.i-btn-circle {
79 | border-radius: 48px
80 | }
81 |
82 | .i-btn-small.i-btn-circle {
83 | border-radius: 40px
84 | }
85 |
86 | .i-btn-loading {
87 | opacity: .6
88 | }
89 |
90 | .i-btn-loading-inner {
91 | display: inline-block;
92 | margin-right: 12px;
93 | vertical-align: middle;
94 | width: 14px;
95 | height: 14px;
96 | background: 0 0;
97 | border-radius: 50%;
98 | border: 2px solid #fff;
99 | border-color: #fff #fff #fff transparent;
100 | animation: btn-spin .6s linear;
101 | animation-iteration-count: infinite
102 | }
103 |
104 | .i-btn-disabled {
105 | color: #bbbec4 !important;
106 | background: #f7f7f7 !important
107 | }
108 |
109 | .i-btn-inline {
110 | display: inline-block
111 | }
112 |
113 | @keyframes btn-spin {
114 | 0% {
115 | transform: rotate(0)
116 | }100% {
117 | transform: rotate(360deg)
118 | }
119 | }
--------------------------------------------------------------------------------
/components/iViewUi/card/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | options: {
5 | multipleSlots: true
6 | },
7 |
8 | properties: {
9 | full: {
10 | type: Boolean,
11 | value: false
12 | },
13 | thumb: {
14 | type: String,
15 | value: ''
16 | },
17 | title: {
18 | type: String,
19 | value: ''
20 | }
21 | }
22 | });
23 |
--------------------------------------------------------------------------------
/components/iViewUi/card/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/card/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/components/iViewUi/card/index.wxss:
--------------------------------------------------------------------------------
1 | .i-card{margin:0 16px;font-size:14px;overflow:hidden;position:relative;background:#fff;border:1rpx solid #dddee1;border-radius:5px}.i-card-full{margin:0;border-left:none;border-right:none;border-radius:0}.i-card-header{display:flex;padding:6px 16px;align-items:center}.i-card-header-content{flex:1;text-align:left}.i-card-header-thumb{display:inline-block;width:64px;height:64px;position:relative;margin-left:auto;margin-right:auto;overflow:hidden;background-size:cover;vertical-align:middle}.i-card-header-title{display:inline-block;vertical-align:middle;font-size:14px;color:#1c2438}.i-card-header-extra{flex:1;text-align:right;font-size:14px;color:#80848f}.i-card-body{position:relative;padding:6px 16px;color:#495060;font-size:14px}.i-card-body::before{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-top-width:1px}.i-card-footer{position:relative;padding:6px 16px;color:#80848f;font-size:12px}
--------------------------------------------------------------------------------
/components/iViewUi/cell-group/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../cell/index': {
6 | type: 'child',
7 | linked () {
8 | this._updateIsLastCell();
9 | },
10 | linkChanged () {
11 | this._updateIsLastCell();
12 | },
13 | unlinked () {
14 | this._updateIsLastCell();
15 | }
16 | }
17 | },
18 |
19 | methods: {
20 | _updateIsLastCell() {
21 | let cells = this.getRelationNodes('../cell/index');
22 | const len = cells.length;
23 |
24 | if (len > 0) {
25 | let lastIndex = len - 1;
26 |
27 | cells.forEach((cell, index) => {
28 | cell.updateIsLastCell(index === lastIndex);
29 | });
30 | }
31 | }
32 | }
33 | });
34 |
--------------------------------------------------------------------------------
/components/iViewUi/cell-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/cell-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/components/iViewUi/cell/index.js:
--------------------------------------------------------------------------------
1 | const warn = (msg, getValue) => {
2 | console.warn(msg);
3 | console.log('接受到的值为:', getValue);
4 | };
5 |
6 | Component({
7 | externalClasses: ['i-class'],
8 |
9 | options: {
10 | multipleSlots: true
11 | },
12 |
13 | relations: {
14 | '../cell-group/index': {
15 | type: 'parent'
16 | }
17 | },
18 |
19 | properties: {
20 | // 左侧标题
21 | title: {
22 | type: String
23 | },
24 | // 标题下方的描述信息
25 | label: {
26 | type: String
27 | },
28 | // 右侧内容
29 | value: {
30 | type: String
31 | },
32 | // 只有点击 footer 区域才触发 tab 事件
33 | onlyTapFooter: {
34 | type: Boolean
35 | },
36 | // 是否展示右侧箭头并开启尝试以 url 跳转
37 | isLink: {
38 | type: null,
39 | value: ''
40 | },
41 | // 链接类型,可选值为 navigateTo,redirectTo,switchTab,reLaunch
42 | linkType: {
43 | type: String,
44 | value: 'navigateTo'
45 | },
46 | url: {
47 | type: String,
48 | value: ''
49 | },
50 | // 标题颜色
51 | titleColor: String
52 | },
53 |
54 | data: {
55 | isLastCell: true
56 | },
57 |
58 | methods: {
59 | navigateTo() {
60 | const {url} = this.data;
61 | const type = typeof this.data.isLink;
62 |
63 | this.triggerEvent('click', {});
64 |
65 | if (!this.data.isLink || !url || url === 'true' || url === 'false') return;
66 |
67 | if (type !== 'boolean' && type !== 'string') {
68 | warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink);
69 | return;
70 | }
71 |
72 | if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) {
73 | warn('linkType 属性可选值为 navigateTo,redirectTo,switchTab,reLaunch', this.data.linkType);
74 | return;
75 | }
76 | wx[this.data.linkType].call(wx, {url});
77 | },
78 | handleTap() {
79 | if (!this.data.onlyTapFooter) {
80 | this.navigateTo();
81 | }
82 | },
83 |
84 | updateIsLastCell(isLastCell) {
85 | this.setData({isLastCell});
86 | }
87 | }
88 | });
89 |
--------------------------------------------------------------------------------
/components/iViewUi/cell/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/cell/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{ title }}
7 | {{ label }}
8 |
9 |
10 |
11 | {{ value }}
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/components/iViewUi/cell/index.wxss:
--------------------------------------------------------------------------------
1 | .i-cell {
2 | position: relative;
3 | padding: 12px 15px;
4 | display: flex;
5 | background: #fff;
6 | align-items: center;
7 | line-height: 1.4;
8 | font-size: 14px;
9 | overflow: hidden
10 | }
11 |
12 | .i-cell::after {
13 | content: '';
14 | position: absolute;
15 | top: 0;
16 | left: 0;
17 | width: 200%;
18 | height: 200%;
19 | transform: scale(.5);
20 | transform-origin: 0 0;
21 | pointer-events: none;
22 | box-sizing: border-box;
23 | border: 0 solid #e9eaec;
24 | border-bottom-width: 1px;
25 | left: 15px;
26 | right: 0
27 | }
28 |
29 |
30 | .i-cell-last::after {
31 | display: none
32 | }
33 |
34 | .i-cell-icon {
35 | margin-right: 5px
36 | }
37 |
38 | .i-cell-icon
39 |
40 | :empty{display:none}.i-cell-bd{flex:1}.i-cell-text{line-height:24px;font-size:14px}.i-cell-desc{line-height:1.2;font-size:12px;color:#80848f}.i-cell-ft{position:relative;text-align:right;color:#495060}.i-cell-access .i-cell-ft{padding-right:13px}.i-cell-access .i-cell-ft::after{content:" ";display:inline-block;width:6px;height:6px;position:absolute;top:50%;right:2px;border-width:2px 2px 0 0;border-color:#dddee1;border-style:solid;transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0)}
--------------------------------------------------------------------------------
/components/iViewUi/checkbox-group/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | relations: {
4 | '../checkbox/index': {
5 | type: 'child',
6 | linked() {
7 | this.changeCurrent();
8 | },
9 | linkChanged() {
10 | this.changeCurrent();
11 | },
12 | unlinked() {
13 | this.changeCurrent();
14 | }
15 | }
16 | },
17 | properties: {
18 | current: {
19 | type: Array,
20 | value: [],
21 | observer: 'changeCurrent'
22 | },
23 | },
24 | methods: {
25 | changeCurrent(val = this.data.current) {
26 | let items = this.getRelationNodes('../checkbox/index');
27 | const len = items.length;
28 | if (len > 0) {
29 | items.forEach(item => {
30 | item.changeCurrent(val.indexOf(item.data.value) !== -1);
31 | });
32 | }
33 | },
34 | emitEvent(current) {
35 | this.triggerEvent('change', current);
36 | }
37 | }
38 | });
39 |
--------------------------------------------------------------------------------
/components/iViewUi/checkbox-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-cell-group": "../cell-group/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/checkbox-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/components/iViewUi/checkbox-group/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/components/iViewUi/checkbox-group/index.wxss
--------------------------------------------------------------------------------
/components/iViewUi/checkbox/index.js:
--------------------------------------------------------------------------------
1 | const prefixCls = 'i-checkbox';
2 |
3 | Component({
4 | externalClasses: ['i-class'],
5 | relations: {
6 | '../checkbox-group/index': {
7 | type: 'parent'
8 | }
9 | },
10 | properties: {
11 | value: {
12 | type: String,
13 | value: ''
14 | },
15 | checked: {
16 | type: Boolean,
17 | value: false
18 | },
19 | disabled: {
20 | type: Boolean,
21 | value: false
22 | },
23 | color: {
24 | type: String,
25 | value: '#2d8cf0'
26 | },
27 | position: {
28 | type: String,
29 | value: 'left', //left right
30 | observer: 'setPosition'
31 | }
32 | },
33 | data: {
34 | checked: true,
35 | positionCls: `${prefixCls}-checkbox-left`,
36 | },
37 | attached() {
38 | this.setPosition();
39 | },
40 | methods: {
41 | changeCurrent(current) {
42 | this.setData({ checked: current });
43 | },
44 | checkboxChange() {
45 | if (this.data.disabled) return;
46 | const item = { current: !this.data.checked, value: this.data.value };
47 | const parent = this.getRelationNodes('../checkbox-group/index')[0];
48 | parent ? parent.emitEvent(item) : this.triggerEvent('change', item);
49 | },
50 | setPosition() {
51 | this.setData({
52 | positionCls: this.data.position.indexOf('left') !== -1 ? `${prefixCls}-checkbox-left` : `${prefixCls}-checkbox-right`,
53 | });
54 | }
55 | }
56 | });
57 |
--------------------------------------------------------------------------------
/components/iViewUi/checkbox/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-cell": "../cell/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/checkbox/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/components/iViewUi/checkbox/index.wxss:
--------------------------------------------------------------------------------
1 | .i-checkbox-cell::after{display:block}.i-checkbox-checkbox-left{float:left}.i-checkbox-checkbox-right{float:right}.i-checkbox-radio{vertical-align:middle}.i-checkbox-title{display:inline-block;vertical-align:middle}
--------------------------------------------------------------------------------
/components/iViewUi/col/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../row/index': {
6 | type: 'parent'
7 | }
8 | },
9 |
10 | properties: {
11 | span: {
12 | value: 0,
13 | type: Number
14 | },
15 | offset: {
16 | value: 0,
17 | type: Number
18 | }
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/components/iViewUi/col/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/iViewUi/col/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/col/index.wxss:
--------------------------------------------------------------------------------
1 | .i-col{float:left;box-sizing:border-box;width:0}.i-col-span-1{display:block;width:4.16666667%}.i-col-offset-1{margin-left:4.16666667%}.i-col-span-2{display:block;width:8.33333333%}.i-col-offset-2{margin-left:8.33333333%}.i-col-span-3{display:block;width:12.5%}.i-col-offset-3{margin-left:12.5%}.i-col-span-4{display:block;width:16.66666667%}.i-col-offset-4{margin-left:16.66666667%}.i-col-span-5{display:block;width:20.83333333%}.i-col-offset-5{margin-left:20.83333333%}.i-col-span-6{display:block;width:25%}.i-col-offset-6{margin-left:25%}.i-col-span-7{display:block;width:29.16666667%}.i-col-offset-7{margin-left:29.16666667%}.i-col-span-8{display:block;width:33.33333333%}.i-col-offset-8{margin-left:33.33333333%}.i-col-span-9{display:block;width:37.5%}.i-col-offset-9{margin-left:37.5%}.i-col-span-10{display:block;width:41.66666667%}.i-col-offset-10{margin-left:41.66666667%}.i-col-span-11{display:block;width:45.83333333%}.i-col-offset-11{margin-left:45.83333333%}.i-col-span-12{display:block;width:50%}.i-col-offset-12{margin-left:50%}.i-col-span-13{display:block;width:54.16666667%}.i-col-offset-13{margin-left:54.16666667%}.i-col-span-14{display:block;width:58.33333333%}.i-col-offset-14{margin-left:58.33333333%}.i-col-span-15{display:block;width:62.5%}.i-col-offset-15{margin-left:62.5%}.i-col-span-16{display:block;width:66.66666667%}.i-col-offset-16{margin-left:66.66666667%}.i-col-span-17{display:block;width:70.83333333%}.i-col-offset-17{margin-left:70.83333333%}.i-col-span-18{display:block;width:75%}.i-col-offset-18{margin-left:75%}.i-col-span-19{display:block;width:79.16666667%}.i-col-offset-19{margin-left:79.16666667%}.i-col-span-20{display:block;width:83.33333333%}.i-col-offset-20{margin-left:83.33333333%}.i-col-span-21{display:block;width:87.5%}.i-col-offset-21{margin-left:87.5%}.i-col-span-22{display:block;width:91.66666667%}.i-col-offset-22{margin-left:91.66666667%}.i-col-span-23{display:block;width:95.83333333%}.i-col-offset-23{margin-left:95.83333333%}.i-col-span-24{display:block;width:100%}.i-col-offset-24{margin-left:100%}
--------------------------------------------------------------------------------
/components/iViewUi/collapse-item/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class-content', 'i-class-title', 'i-class'],
3 |
4 | relations: {
5 | '../collapse/index': {
6 | type: 'parent',
7 | linked: function (target) {
8 | const options = {
9 | accordion: target.data.accordion
10 | }
11 | if (target.data.name === this.data.name) {
12 | options.showContent = 'i-collapse-item-show-content';
13 | }
14 | this.setData(options);
15 | }
16 | }
17 | },
18 |
19 | properties: {
20 | title: String,
21 | name: String
22 | },
23 |
24 | data: {
25 | showContent: '',
26 | accordion: false
27 | },
28 |
29 | options: {
30 | multipleSlots: true
31 | },
32 |
33 | methods: {
34 | trigger(e) {
35 | const data = this.data;
36 | if (data.accordion) {
37 | this.triggerEvent('collapse', {name: data.name}, {composed: true, bubbles: true});
38 | } else {
39 | this.setData({
40 | showContent: data.showContent ? '' : 'i-collapse-item-show-content'
41 | });
42 | }
43 | },
44 | }
45 | });
46 |
47 |
--------------------------------------------------------------------------------
/components/iViewUi/collapse-item/index.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "component": true,
4 | "usingComponents": {
5 | "i-icon": "../icon/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/collapse-item/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{title}}
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/components/iViewUi/collapse-item/index.wxss:
--------------------------------------------------------------------------------
1 | .i-collapse-item{padding:2px 8px;border-top:1px solid #dddee1}.i-collapse-item-title{vertical-align:middle}.i-collapse-item-title-wrap{padding:2px 0 0}.i-collapse-item-content{padding:6px;display:none}.i-collapse-item-show-content{display:block}.i-collapse-item-arrow{transition:transform .2s ease-in-out}.i-collapse-item-arrow-show{transition:transform .2s ease-in-out;transform:rotate(90deg)}
--------------------------------------------------------------------------------
/components/iViewUi/collapse/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../collapse-item/index': {
6 | type: 'child'
7 | }
8 | },
9 | properties: {
10 | name: String,
11 | accordion: Boolean
12 | },
13 | methods: {
14 | clickfn(e) {
15 | const params = e.detail;
16 | const allList = this.getRelationNodes('../collapse-item/index');
17 | allList.forEach((item) => {
18 | if (params.name === item.data.name) {
19 | item.setData({
20 | showContent: 'i-collapse-item-show-content'
21 | });
22 | } else {
23 | item.setData({
24 | showContent: ''
25 | });
26 | }
27 | });
28 | },
29 | }
30 | });
31 |
32 |
--------------------------------------------------------------------------------
/components/iViewUi/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/collapse/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/components/iViewUi/collapse/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/components/iViewUi/collapse/index.wxss
--------------------------------------------------------------------------------
/components/iViewUi/count-down/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | target: Number,
4 | showDay: Boolean,
5 | callback: String,
6 | format: Array,
7 | clearTimer: Boolean
8 | },
9 | externalClasses: ['countdown-class'],
10 | data: {
11 | time: '',
12 | resultFormat: [],
13 | changeFormat: false
14 | },
15 | ready() {
16 | this.getFormat();
17 |
18 | },
19 | methods: {
20 | getFormat() {
21 | const data = this.data;
22 | const len = data.format.length;
23 |
24 | if (!data.showDay) data.resultFormat.push('');
25 |
26 | if (len >= 3) {
27 | for (let i = 0; i < len; i++) {
28 | if (data.resultFormat.length >= 4) break;
29 | if (data.format[i]) {
30 | data.resultFormat.push(data.format[i].toString());
31 | }
32 | }
33 |
34 | if (data.resultFormat.length >= 4) data.changeFormat = true;
35 | }
36 |
37 | this.getLastTime();
38 | },
39 | init() {
40 | const self = this;
41 | setTimeout(function () {
42 | self.getLastTime.call(self);
43 | }, 1000);
44 | },
45 | getLastTime() {
46 | const data = this.data;
47 | const gapTime = Math.ceil((data.target - new Date().getTime()) / 1000);
48 | let result = '';
49 | let time = '00:00:00';
50 | let day = '00';
51 | const format = data.resultFormat;
52 |
53 | if (gapTime > 0) {
54 | day = this.formatNum(parseInt(gapTime / 86400));
55 | let lastTime = gapTime % 86400;
56 | const hour = this.formatNum(parseInt(lastTime / 3600));
57 | lastTime = lastTime % 3600;
58 | const minute = this.formatNum(parseInt(lastTime / 60));
59 | const second = this.formatNum(lastTime % 60);
60 |
61 | if (data.changeFormat) time = `${hour}${format[1]}${minute}${format[2]}${second}${format[3]}`;
62 | else time = `${hour}:${minute}:${second}`;
63 |
64 | if (!data.clearTimer) this.init.call(this);
65 | } else {
66 | this.endfn();
67 | }
68 |
69 | if (data.showDay) {
70 | if (data.changeFormat) {
71 | result = `${day}${format[0]} ${time}`;
72 | } else {
73 | result = `${day}d ${time}`;
74 | }
75 | } else {
76 | result = time;
77 | }
78 | this.setData({
79 | time: result
80 | });
81 |
82 | },
83 | formatNum(num) {
84 | return num > 9 ? num : `0${num}`;
85 | },
86 | endfn() {
87 | this.triggerEvent('callback', {});
88 | }
89 | }
90 | });
91 |
--------------------------------------------------------------------------------
/components/iViewUi/count-down/index.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "component": true
4 | }
5 |
--------------------------------------------------------------------------------
/components/iViewUi/count-down/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{time}}
3 |
4 |
5 |
--------------------------------------------------------------------------------
/components/iViewUi/count-down/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/components/iViewUi/count-down/index.wxss
--------------------------------------------------------------------------------
/components/iViewUi/divider/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties: {
4 | content: {
5 | type: String,
6 | value: ''
7 | },
8 | height : {
9 | type: Number,
10 | value: 48
11 | },
12 | color : {
13 | type : String,
14 | value : '#80848f'
15 | },
16 | lineColor : {
17 | type : String,
18 | value : '#e9eaec'
19 | },
20 | size : {
21 | type: String,
22 | value: 12
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/components/iViewUi/divider/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/divider/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{content}}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | module.exports = {
12 | getStyle : function(color,size,height){
13 | var color = 'color:' + color +';';
14 | var size = 'font-size:' + size + 'px;';
15 | var height = 'height:' + height+'px;'
16 | return color + size + height;
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/components/iViewUi/divider/index.wxss:
--------------------------------------------------------------------------------
1 | .i-divider{width:100%;text-align:center;font-size:12px;position:relative;display:flex;align-items:center;justify-content:center}.i-divider-line{position:absolute;left:0;width:100%;height:1rpx;background-color:#f7f7f7;top:50%}.i-divider-content{background:#fff;position:relative;z-index:1;display:inline-block;padding:0 10px}
--------------------------------------------------------------------------------
/components/iViewUi/drawer/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties: {
4 | visible: {
5 | type: Boolean,
6 | value: false
7 | },
8 |
9 | mask: {
10 | type: Boolean,
11 | value: true
12 | },
13 |
14 | maskClosable: {
15 | type: Boolean,
16 | value: true
17 | },
18 |
19 | mode: {
20 | type: String,
21 | value: 'left' // left right
22 | }
23 | },
24 | data: {},
25 | methods: {
26 | handleMaskClick() {
27 | if (!this.data.maskClosable) {
28 | return;
29 | }
30 | this.triggerEvent('close', {});
31 | }
32 | }
33 | });
34 |
--------------------------------------------------------------------------------
/components/iViewUi/drawer/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/drawer/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/components/iViewUi/drawer/index.wxss:
--------------------------------------------------------------------------------
1 | .i-drawer{visibility:hidden}.i-drawer-show{visibility:visible}.i-drawer-show .i-drawer-mask{display:block;opacity:1}.i-drawer-show .i-drawer-container{opacity:1}.i-drawer-show.i-drawer-left .i-drawer-container,.i-drawer-show.i-drawer-right .i-drawer-container{transform:translate3d(0,-50%,0)}.i-drawer-mask{opacity:0;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.6);transition:all .3s ease-in-out}.i-drawer-container{position:fixed;left:50%;top:50%;transform:translate3d(-50%,-50%,0);transform-origin:center;transition:all .3s ease-in-out;z-index:7;opacity:0}.i-drawer-left .i-drawer-container{left:0;top:50%;transform:translate3d(-100%,-50%,0)}.i-drawer-right .i-drawer-container{right:0;top:50%;left:auto;transform:translate3d(100%,-50%,0)}
--------------------------------------------------------------------------------
/components/iViewUi/grid-icon/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../grid-item/index': {
6 | type: 'parent'
7 | }
8 | },
9 |
10 | });
11 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-icon/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-icon/index.wxss:
--------------------------------------------------------------------------------
1 | .i-grid-icon{display:block;width:28px;height:28px;margin:0 auto}.i-grid-icon image{width:100%;height:100%}
--------------------------------------------------------------------------------
/components/iViewUi/grid-item/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../grid/index': {
6 | type: 'parent'
7 | },
8 | '../grid-icon/index': {
9 | type: 'child'
10 | }
11 | },
12 |
13 | data: {
14 | width: '33.33%'
15 | }
16 | });
17 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-item/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-item/index.wxss:
--------------------------------------------------------------------------------
1 | .i-grid-item{position:relative;float:left;padding:20px 10px;width:33.33333333%;box-sizing:border-box;border-right:1rpx solid #e9eaec;border-bottom:1rpx solid #e9eaec}
--------------------------------------------------------------------------------
/components/iViewUi/grid-label/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../grid-item/index': {
6 | type: 'parent'
7 | }
8 | },
9 |
10 | });
11 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-label/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-label/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/grid-label/index.wxss:
--------------------------------------------------------------------------------
1 | .i-grid-label{margin-top:5px;display:block;text-align:center;color:#1c2438;font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
--------------------------------------------------------------------------------
/components/iViewUi/grid/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../grid-item/index': {
6 | type: 'child',
7 | linked () {
8 | this.setGridItemWidth();
9 | },
10 | linkChanged () {
11 | this.setGridItemWidth();
12 | },
13 | unlinked () {
14 | this.setGridItemWidth();
15 | }
16 | }
17 | },
18 |
19 | methods: {
20 | setGridItemWidth () {
21 | const nodes = this.getRelationNodes('../grid-item/index');
22 |
23 | // const len = nodes.length;
24 | // if (len < 3) {
25 | // nodes.forEach(item => {
26 | // item.setData({
27 | // 'width': '33.33%'
28 | // });
29 | // });
30 | // } else {
31 | // const width = 100 / nodes.length;
32 | // nodes.forEach(item => {
33 | // item.setData({
34 | // 'width': width + '%'
35 | // });
36 | // });
37 | // }
38 | const width = 100 / nodes.length;
39 | nodes.forEach(item => {
40 | item.setData({
41 | 'width': width + '%'
42 | });
43 | });
44 | }
45 | },
46 |
47 | ready () {
48 | this.setGridItemWidth();
49 | }
50 | });
51 |
--------------------------------------------------------------------------------
/components/iViewUi/grid/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/grid/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/grid/index.wxss:
--------------------------------------------------------------------------------
1 | .i-grid{border-top:1rpx solid #e9eaec;border-left:1rpx solid #e9eaec;overflow:hidden}
--------------------------------------------------------------------------------
/components/iViewUi/icon/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | properties: {
5 | type: {
6 | type: String,
7 | value: ''
8 | },
9 | custom: {
10 | type: String,
11 | value: ''
12 | },
13 | size: {
14 | type: Number,
15 | value: 14
16 | },
17 | color: {
18 | type: String,
19 | value: ''
20 | }
21 | }
22 | });
23 |
--------------------------------------------------------------------------------
/components/iViewUi/icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/icon/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/index-item/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties : {
4 | name : {
5 | type : String,
6 | value : ''
7 | }
8 | },
9 | relations : {
10 | '../index/index' : {
11 | type : 'parent'
12 | }
13 | },
14 | data : {
15 | top : 0,
16 | height : 0,
17 | currentName : ''
18 | },
19 | methods: {
20 | updateDataChange() {
21 | const className = '.i-index-item';
22 | const query = wx.createSelectorQuery().in(this);
23 | query.select( className ).boundingClientRect((res)=>{
24 | this.setData({
25 | top : res.top,
26 | height : res.height,
27 | currentName : this.data.name
28 | })
29 | }).exec()
30 | }
31 | }
32 | })
--------------------------------------------------------------------------------
/components/iViewUi/index-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/index-item/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | module.exports = {
9 |
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/components/iViewUi/index-item/index.wxss:
--------------------------------------------------------------------------------
1 | .i-index-item-header{height:30px;line-height:30px;background:#eee;font-size:14px;padding-left:10px;width:100%;box-sizing:border-box}.i-index-item-content{font-size:14px}
--------------------------------------------------------------------------------
/components/iViewUi/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
17 | {{item}}
18 |
19 |
20 | {{currentName}}
21 |
22 |
23 |
24 | module.exports = {
25 | setScrollStyle : function(height){
26 | var units = ['%','px','rem','rpx','em','rem'];
27 | var hasUnits = false;
28 | for( var i = 0; i < units.length;i++ ){
29 | var u = units[i];
30 | if( height.indexOf( u ) > -1 ){
31 | hasUnits = true;
32 | break;
33 | }
34 | }
35 | return 'height:'+ ( hasUnits ? height : height+'px' );
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/components/iViewUi/index/index.wxss:
--------------------------------------------------------------------------------
1 | .i-index{width:100%;height:100%}.i-index-line{position:absolute;left:0;width:100%;height:1rpx;background-color:#f7f7f7;top:50%}.i-index-content{background:#fff;position:relative;z-index:1;display:inline-block;padding:0 10px}.i-index-fixed{position:fixed;right:0;top:50%;z-index:10;padding-left:10px;transform:translateY(-50%)}.i-index-fixed-item{display:block;height:18px;line-height:18px;padding:0 5px;text-align:center;color:#2d8cf0;font-size:12px;border-radius:50%}.i-index-fixed-item-current{background:#2d8cf0;color:#fff}.i-index-tooltip{position:fixed;left:50%;top:50%;transform:translate3d(-50%,-50%,0);background:rgba(0,0,0,.7);color:#fff;font-size:24px;border-radius:50%;width:80px;height:80px;line-height:80px;text-align:center}
--------------------------------------------------------------------------------
/components/iViewUi/input-number/index.js:
--------------------------------------------------------------------------------
1 | function addNum (num1, num2) {
2 | let sq1, sq2, m;
3 | try {
4 | sq1 = num1.toString().split('.')[1].length;
5 | }
6 | catch (e) {
7 | sq1 = 0;
8 | }
9 | try {
10 | sq2 = num2.toString().split('.')[1].length;
11 | }
12 | catch (e) {
13 | sq2 = 0;
14 | }
15 | m = Math.pow(10, Math.max(sq1, sq2));
16 | return (Math.round(num1 * m) + Math.round(num2 * m)) / m;
17 | }
18 |
19 | Component({
20 | externalClasses: ['i-class'],
21 |
22 | properties: {
23 | // small || default || large
24 | size: String,
25 | value: {
26 | type: Number,
27 | value: 1
28 | },
29 | min: {
30 | type: Number,
31 | value: -Infinity
32 | },
33 | max: {
34 | type: Number,
35 | value: Infinity
36 | },
37 | step: {
38 | type: Number,
39 | value: 1
40 | }
41 | },
42 |
43 |
44 | methods: {
45 | handleChangeStep(e, type) {
46 | const { dataset = {} } = e.currentTarget;
47 | const { disabled } = dataset;
48 | const { step } = this.data;
49 | let { value } = this.data;
50 |
51 | if (disabled) return null;
52 |
53 | if (type === 'minus') {
54 | value = addNum(value, -step);
55 | } else if (type === 'plus') {
56 | value = addNum(value, step);
57 | }
58 |
59 | if (value < this.data.min || value > this.data.max) return null;
60 |
61 | this.handleEmit(value, type);
62 | },
63 |
64 | handleMinus(e) {
65 | this.handleChangeStep(e, 'minus');
66 | },
67 |
68 | handlePlus(e) {
69 | this.handleChangeStep(e, 'plus');
70 | },
71 |
72 | handleBlur(e) {
73 | let { value } = e.detail;
74 | const { min, max } = this.data;
75 |
76 | if (!value) {
77 | setTimeout(() => {
78 | this.handleEmit(value);
79 | }, 16);
80 | return;
81 | }
82 |
83 | value = +value;
84 | if (value > max) {
85 | value = max;
86 | } else if (value < min) {
87 | value = min;
88 | }
89 |
90 | this.handleEmit(value);
91 | },
92 | handleEmit (value, type) {
93 | const data = {
94 | value: value
95 | };
96 | if (type) data.type = type;
97 |
98 | this.triggerEvent('change', data);
99 | }
100 | }
101 | });
102 |
--------------------------------------------------------------------------------
/components/iViewUi/input-number/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/input-number/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 | +
5 |
6 |
--------------------------------------------------------------------------------
/components/iViewUi/input-number/index.wxss:
--------------------------------------------------------------------------------
1 | .i-input-number{color:#495060}.i-input-number view{display:inline-block;line-height:20px;padding:5px 0;text-align:center;min-width:40px;box-sizing:border-box;vertical-align:middle;font-size:12px;border:1rpx solid #dddee1}.i-input-number-minus{border-right:none;border-radius:2px 0 0 2px}.i-input-number-plus{border-left:none;border-radius:0 2px 2px 0}.i-input-number-text{border:1rpx solid #dddee1;display:inline-block;text-align:center;vertical-align:middle;height:30px;width:40px;min-height:auto;font-size:12px;line-height:30px}.i-input-number-disabled{border-color:#dddee1;color:#bbbec4;background:#f7f7f7}
--------------------------------------------------------------------------------
/components/iViewUi/input/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | behaviors: ['wx://form-field'],
3 |
4 | externalClasses: ['i-class'],
5 |
6 | properties: {
7 | title: {
8 | type: String
9 | },
10 | // text || textarea || password || number
11 | type: {
12 | type: String,
13 | value: 'text'
14 | },
15 | disabled: {
16 | type: Boolean,
17 | value: false
18 | },
19 | placeholder: {
20 | type: String,
21 | value: ''
22 | },
23 | autofocus: {
24 | type: Boolean,
25 | value: false
26 | },
27 | mode: {
28 | type: String,
29 | value: 'normal'
30 | },
31 | right: {
32 | type: Boolean,
33 | value: false
34 | },
35 | error: {
36 | type: Boolean,
37 | value: false
38 | },
39 | maxlength: {
40 | type: Number
41 | }
42 | },
43 |
44 | methods: {
45 | handleInputChange(event) {
46 | const { detail = {} } = event;
47 | const { value = '' } = detail;
48 | this.setData({ value });
49 |
50 | this.triggerEvent('change', event);
51 | },
52 |
53 | handleInputFocus(event) {
54 | this.triggerEvent('focus', event);
55 | },
56 |
57 | handleInputBlur(event) {
58 | this.triggerEvent('blur', event);
59 | }
60 | }
61 | });
62 |
--------------------------------------------------------------------------------
/components/iViewUi/input/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/input/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{ title }}
3 |
17 |
31 |
32 |
--------------------------------------------------------------------------------
/components/iViewUi/input/index.wxss:
--------------------------------------------------------------------------------
1 | .i-cell{position:relative;padding:12px 15px;display:flex;background:#fff;align-items:center;line-height:1.4;font-size:14px;overflow:hidden}.i-cell::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px;left:15px;right:0}.i-cell-last::after{display:none}.i-cell-icon{margin-right:5px}.i-cell-icon:empty{display:none}.i-cell-bd{flex:1}.i-cell-text{line-height:24px;font-size:14px}.i-cell-desc{line-height:1.2;font-size:12px;color:#80848f}.i-cell-ft{position:relative;text-align:right;color:#495060}.i-cell-access .i-cell-ft{padding-right:13px}.i-cell-access .i-cell-ft::after{content:" ";display:inline-block;width:6px;height:6px;position:absolute;top:50%;right:2px;border-width:2px 2px 0 0;border-color:#dddee1;border-style:solid;transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0)}.i-input{padding:7px 15px;color:#495060}.i-input-wrapped{margin:10px 15px;background-color:#fff}.i-input-wrapped::after{left:0;border-width:1px;border-radius:4px}.i-input-error{color:#ed3f14}.i-input-title{color:#495060;min-width:65px;padding-right:10px}.i-input-input{flex:1;line-height:1.6;padding:4px 0;min-height:22px;height:auto;font-size:14px}.i-input-placeholder{font-size:14px}.i-input-input-right{text-align:right}.i-input.i-input-wrapped::after{display:block}.i-input-wrapped.i-input-error::after{border-color:#ed3f14}
--------------------------------------------------------------------------------
/components/iViewUi/load-more/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | properties: {
5 | loading: {
6 | type: Boolean,
7 | value: true
8 | },
9 | tip: {
10 | type: String,
11 | value: ''
12 | }
13 | },
14 | });
15 |
--------------------------------------------------------------------------------
/components/iViewUi/load-more/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/load-more/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ tip }}
5 | 正在加载
6 |
7 |
8 |
--------------------------------------------------------------------------------
/components/iViewUi/load-more/index.wxss:
--------------------------------------------------------------------------------
1 | .i-load-more{width:65%;margin:1.5em auto;line-height:1.6em;font-size:14px;text-align:center}.i-load-more-loading{display:inline-block;margin-right:12px;vertical-align:middle;width:14px;height:14px;background:0 0;border-radius:50%;border:2px solid #e9eaec;border-color:#e9eaec #e9eaec #e9eaec #2d8cf0;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-load-more-tip{display:inline-block;vertical-align:middle;color:#495060}.i-load-more-line{border-top:1px solid #dddee1;display:flex;border-top:0}.i-load-more-line::before{position:relative;top:-1px;-webkit-box-flex:1;-webkit-flex:1;flex:1;content:'';border-top:1px solid #dddee1}.i-load-more-line::after{position:relative;top:-1px;-webkit-box-flex:1;-webkit-flex:1;flex:1;content:'';border-top:1px solid #dddee1}.i-load-more-line .i-load-more-tip{position:relative;top:-.9em;padding:0 .55em}.i-load-more-empty{width:4px;height:4px;border-radius:50%;background-color:#e5e5e5;display:inline-block;position:relative;vertical-align:0;top:-.16em}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
--------------------------------------------------------------------------------
/components/iViewUi/message/index.js:
--------------------------------------------------------------------------------
1 | const default_data = {
2 | visible: false,
3 | content: '',
4 | duration: 2,
5 | type: 'default', // default || success || warning || error
6 | };
7 |
8 | let timmer = null;
9 |
10 | Component({
11 | externalClasses: ['i-class'],
12 |
13 | data: {
14 | ...default_data
15 | },
16 |
17 | methods: {
18 | handleShow (options) {
19 | const { type = 'default', duration = 2 } = options;
20 |
21 | this.setData({
22 | ...options,
23 | type,
24 | duration,
25 | visible: true
26 | });
27 |
28 | const d = this.data.duration * 1000;
29 |
30 | if (timmer) clearTimeout(timmer);
31 | if (d !== 0) {
32 | timmer = setTimeout(() => {
33 | this.handleHide();
34 | timmer = null;
35 | }, d);
36 | }
37 | },
38 |
39 | handleHide () {
40 | this.setData({
41 | ...default_data
42 | });
43 | }
44 | }
45 | });
--------------------------------------------------------------------------------
/components/iViewUi/message/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/message/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{ content }}
3 |
--------------------------------------------------------------------------------
/components/iViewUi/message/index.wxss:
--------------------------------------------------------------------------------
1 | .i-message{display:block;width:100%;min-height:32px;line-height:2.3;position:fixed;top:0;left:0;right:0;background:#2d8cf0;color:#fff;text-align:center;font-size:14px;z-index:1010;opacity:0;-webkit-transform:translateZ(0) translateY(-100%);transition:all .4s ease-in-out}.i-message-show{-webkit-transform:translateZ(0) translateY(0);opacity:1}.i-message-default{background:#2d8cf0}.i-message-success{background:#19be6b}.i-message-warning{background:#f90}.i-message-error{background:#ed3f14}
--------------------------------------------------------------------------------
/components/iViewUi/modal/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class', 'i-class-mask'],
3 |
4 | properties: {
5 | visible: {
6 | type: Boolean,
7 | value: false
8 | },
9 | title: {
10 | type: String,
11 | value: ''
12 | },
13 | showOk: {
14 | type: Boolean,
15 | value: true
16 | },
17 | showCancel: {
18 | type: Boolean,
19 | value: true
20 | },
21 | okText: {
22 | type: String,
23 | value: '确定'
24 | },
25 | cancelText: {
26 | type: String,
27 | value: '取消'
28 | },
29 | // 按钮组,有此值时,不显示 ok 和 cancel 按钮
30 | actions: {
31 | type: Array,
32 | value: []
33 | },
34 | // horizontal || vertical
35 | actionMode: {
36 | type: String,
37 | value: 'horizontal'
38 | }
39 | },
40 |
41 | methods: {
42 | handleClickItem ({ currentTarget = {} }) {
43 | const dataset = currentTarget.dataset || {};
44 | const { index } = dataset;
45 | this.triggerEvent('click', { index });
46 | },
47 | handleClickOk () {
48 | this.triggerEvent('ok');
49 | },
50 | handleClickCancel () {
51 | this.triggerEvent('cancel');
52 | }
53 | }
54 | });
55 |
--------------------------------------------------------------------------------
/components/iViewUi/modal/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-grid": "../grid/index",
5 | "i-grid-item": "../grid-item/index",
6 | "i-button": "../button/index",
7 | "i-icon": "../icon/index"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/components/iViewUi/modal/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ title }}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
31 | {{ cancelText }}
32 |
33 |
34 |
35 | {{ okText }}
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | {{ item.name }}
50 |
51 |
--------------------------------------------------------------------------------
/components/iViewUi/modal/index.wxss:
--------------------------------------------------------------------------------
1 |
2 |
3 | .i-modal{position:fixed;overflow:auto;top:0;right:0;bottom:0;left:0;height:100%;z-index:1000;display:flex;outline:0;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;transform:translateZ(1px);opacity:0;visibility:hidden}.i-modal-show{visibility:visible;opacity:1}.i-modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7);z-index:1000;transition:all .2s ease-in-out;opacity:0;visibility:hidden}.i-modal-mask-show{opacity:1;visibility:visible}.i-modal-main{width:270px;position:relative}.i-modal-content{border-radius:7px;padding-top:15px;position:relative;background-color:#fff;border:0;background-clip:padding-box;text-align:center;height:100%;overflow:hidden}.i-modal-body{max-height:100px;margin-bottom:15px;font-size:14px;color:#80848f;height:100%;line-height:1.5;overflow:auto}.i-modal-title{padding:6px 15px 15px;margin:0;font-size:18px;line-height:1;color:#1c2438;text-align:center}.i-modal-actions{margin:0 1px}.i-modal-action-vertical{position:relative}.i-modal-action-vertical:after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-top-width:1px}.i-modal-grid{border-radius:0 0 7px 7px;border-left:none}.i-modal-grid-item,.i-modal-grid-item-last{padding:0;border-bottom:none}.i-modal-grid-item-last{border-right:none}.i-modal-btn-ok{color:#2d8cf0!important}.i-modal-btn-loading{display:inline-block;vertical-align:middle;margin-right:10px;width:12px;height:12px;background:0 0;border-radius:50%;border:2px solid #e5e5e5;border-color:#666 #e5e5e5 #e5e5e5 #e5e5e5;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-modal-btn-text{display:inline-block;vertical-align:middle}.i-modal-btn-icon{font-size:14px!important;margin-right:4px}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
4 |
--------------------------------------------------------------------------------
/components/iViewUi/notice-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-icon": "../icon/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/notice-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/components/iViewUi/notice-bar/index.wxss:
--------------------------------------------------------------------------------
1 | .i-noticebar{display:flex;height:72rpx;line-height:72rpx;font-size:14px;color:#f76a24;background-color:#fefcec;overflow:hidden}.i-noticebar-icon{display:flex;margin-left:30rpx;align-items:center}.i-noticebar-icon+view{margin-left:10rpx}.i-noticebar-operation{display:flex;margin-right:16rpx;align-items:center}.i-noticebar-content-wrap{position:relative;flex:1;margin:0 30rpx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.i-noticebar-content-wrap .i-noticebar-content{position:absolute;transition-duration:20s}
--------------------------------------------------------------------------------
/components/iViewUi/page/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | options: {
5 | multipleSlots: true
6 | },
7 |
8 | properties: {
9 | // button || number || pointer
10 | mode: {
11 | type: String,
12 | value: 'button'
13 | },
14 | current: {
15 | type: Number,
16 | value: 1
17 | },
18 | total: {
19 | type: Number,
20 | value: 0
21 | },
22 | // 是否隐藏数值
23 | simple: {
24 | type: Boolean,
25 | value: false
26 | }
27 | },
28 |
29 | methods: {
30 | handleChange (type) {
31 | this.triggerEvent('change', {
32 | type: type
33 | });
34 | },
35 | handlePrev () {
36 | this.handleChange('prev');
37 | },
38 | handleNext () {
39 | this.handleChange('next');
40 | }
41 | }
42 | });
43 |
--------------------------------------------------------------------------------
/components/iViewUi/page/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-button": "../button/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/page/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{ current }}/{{total}}
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/components/iViewUi/page/index.wxss:
--------------------------------------------------------------------------------
1 | .i-page{display:block;width:100%;height:44px;overflow:hidden;box-sizing:border-box;position:relative}.i-page-prev{position:absolute;left:10px;top:0}.i-page-next{position:absolute;right:10px;top:0}.i-page-number{width:100%;height:44px;line-height:44px;margin:0 auto;text-align:center}.i-page-number-current{display:inline;color:#2d8cf0}.i-page-pointer{width:100%;height:44px;line-height:44px;margin:0 auto;text-align:center}.i-page-pointer-dot{display:inline-block;width:8px;height:8px;margin:0 2px;border-radius:50%;background:#bbbec4}.i-page-pointer-dot.current{background:#80848f}.i-page-button{display:inline-block;margin:0}
--------------------------------------------------------------------------------
/components/iViewUi/panel/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | properties: {
5 | title: {
6 | type: String,
7 | value: ''
8 | },
9 | // 标题顶部距离
10 | hideTop: {
11 | type: Boolean,
12 | value: false
13 | },
14 | hideBorder: {
15 | type: Boolean,
16 | value: false
17 | }
18 | }
19 | });
20 |
--------------------------------------------------------------------------------
/components/iViewUi/panel/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/panel/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | {{ title }}
3 |
4 |
5 |
--------------------------------------------------------------------------------
/components/iViewUi/panel/index.wxss:
--------------------------------------------------------------------------------
1 | .i-panel{position:relative;overflow:hidden}.i-panel-title{font-size:14px;line-height:1;color:#1c2438;padding:20px 16px 10px}.i-panel-title-hide-top{padding-top:0}.i-panel-content{position:relative;background:#fff;overflow:hidden}.i-panel-content::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-top-width:1px;border-bottom-width:1px}.i-panel-without-border::after{border:0 none}
--------------------------------------------------------------------------------
/components/iViewUi/progress/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | properties: {
5 | percent: {
6 | type: Number,
7 | value: 0
8 | },
9 | // normal || active || wrong || success
10 | status: {
11 | type: String,
12 | value: 'normal'
13 | },
14 | strokeWidth: {
15 | type: Number,
16 | value: 10
17 | },
18 | hideInfo: {
19 | type: Boolean,
20 | value: false
21 | }
22 | }
23 | });
24 |
--------------------------------------------------------------------------------
/components/iViewUi/progress/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/progress/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{ percent }}%
9 |
10 |
--------------------------------------------------------------------------------
/components/iViewUi/progress/index.wxss:
--------------------------------------------------------------------------------
1 | .i-progress{display:inline-block;width:100%;font-size:12px;position:relative}.i-progress-outer{display:inline-block;width:100%;margin-right:0;padding-right:0;box-sizing:border-box}.i-progress-show-info .i-progress-outer{padding-right:55px;margin-right:-55px}.i-progress-inner{display:inline-block;width:100%;background-color:#f3f3f3;border-radius:100px;vertical-align:middle}.i-progress-bg{border-radius:100px;background-color:#2db7f5;transition:all .2s linear;position:relative}.i-progress-text{display:inline-block;margin-left:5px;text-align:left;font-size:1em;vertical-align:middle}.i-progress-active .i-progress-bg:before{content:'';opacity:0;position:absolute;top:0;left:0;right:0;bottom:0;background:#fff;border-radius:10px;animation:i-progress-active 2s ease-in-out infinite}.i-progress-wrong .i-progress-bg{background-color:#ed3f14}.i-progress-wrong .i-progress-text{color:#ed3f14}.i-progress-success .i-progress-bg{background-color:#19be6b}.i-progress-success .i-progress-text{color:#19be6b}@keyframes i-progress-active{0%{opacity:.3;width:0}100%{opacity:0;width:100%}}
--------------------------------------------------------------------------------
/components/iViewUi/radio-group/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | relations: {
4 | '../radio/index': {
5 | type: 'child',
6 | linked() {
7 | this.changeCurrent();
8 | },
9 | linkChanged() {
10 | this.changeCurrent();
11 | },
12 | unlinked() {
13 | this.changeCurrent();
14 | }
15 | }
16 | },
17 | properties: {
18 | current: {
19 | type: String,
20 | value: '',
21 | observer: 'changeCurrent'
22 | },
23 | },
24 | methods: {
25 | changeCurrent(val = this.data.current) {
26 | let items = this.getRelationNodes('../radio/index');
27 | const len = items.length;
28 | if (len > 0) {
29 | items.forEach(item => {
30 | item.changeCurrent(val === item.data.value);
31 | });
32 | }
33 | },
34 | emitEvent(current) {
35 | this.triggerEvent('change', current);
36 | }
37 | }
38 | });
39 |
--------------------------------------------------------------------------------
/components/iViewUi/radio-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-cell-group": "../cell-group/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/radio-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/components/iViewUi/radio-group/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/components/iViewUi/radio-group/index.wxss
--------------------------------------------------------------------------------
/components/iViewUi/radio/index.js:
--------------------------------------------------------------------------------
1 | const prefixCls = 'i-radio';
2 |
3 | Component({
4 | externalClasses: ['i-class'],
5 | relations: {
6 | '../radio-group/index': {
7 | type: 'parent'
8 | }
9 | },
10 | properties: {
11 | value: {
12 | type: String,
13 | value: ''
14 | },
15 | checked: {
16 | type: Boolean,
17 | value: false
18 | },
19 | disabled: {
20 | type: Boolean,
21 | value: false
22 | },
23 | color: {
24 | type: String,
25 | value: '#2d8cf0'
26 | },
27 | position: {
28 | type: String,
29 | value: 'left', //left right
30 | observer: 'setPosition'
31 | }
32 | },
33 | data: {
34 | checked: true,
35 | positionCls: `${prefixCls}-radio-left`,
36 | },
37 | attached() {
38 | this.setPosition();
39 | },
40 | methods: {
41 | changeCurrent(current) {
42 | this.setData({ checked: current });
43 | },
44 | radioChange() {
45 | if (this.data.disabled) return;
46 | const item = { current: !this.data.checked, value: this.data.value };
47 | const parent = this.getRelationNodes('../radio-group/index')[0];
48 | parent ? parent.emitEvent(item) : this.triggerEvent('change', item);
49 | },
50 | setPosition() {
51 | this.setData({
52 | positionCls: this.data.position.indexOf('left') !== -1 ? `${prefixCls}-radio-left` : `${prefixCls}-radio-right`,
53 | });
54 | }
55 | }
56 | });
57 |
--------------------------------------------------------------------------------
/components/iViewUi/radio/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-cell": "../cell/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/radio/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/components/iViewUi/radio/index.wxss:
--------------------------------------------------------------------------------
1 | .i-radio-cell::after{display:block}.i-radio-radio-left{float:left}.i-radio-radio-right{float:right}.i-radio-radio{vertical-align:middle}.i-radio-title{display:inline-block;vertical-align:middle}
--------------------------------------------------------------------------------
/components/iViewUi/rate/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties : {
4 | count : {
5 | type : Number,
6 | value : 5
7 | },
8 | value : {
9 | type : Number,
10 | value : 0
11 | },
12 | disabled : {
13 | type : Boolean,
14 | value : false
15 | },
16 | size : {
17 | type : Number,
18 | value : 20
19 | },
20 | name : {
21 | type : String,
22 | value : ''
23 | }
24 | },
25 | data : {
26 | touchesStart : {
27 | pageX : 0
28 | }
29 | },
30 | methods : {
31 | handleClick(e){
32 | const data = this.data;
33 | if( data.disabled ){
34 | return;
35 | }
36 | const index = e.currentTarget.dataset.index;
37 | this.triggerEvent('change',{
38 | index : index + 1
39 | })
40 | },
41 | handleTouchMove(e){
42 | const data = this.data;
43 | if( data.disabled ){
44 | return;
45 | }
46 | if( !e.changedTouches[0] ){
47 | return;
48 | }
49 | const movePageX = e.changedTouches[0].pageX;
50 | const space = movePageX - data.touchesStart.pageX;
51 |
52 | if( space <= 0 ){
53 | return;
54 | }
55 | let setIndex = Math.ceil( space/data.size );
56 | setIndex = setIndex > data.count ? data.count : setIndex ;
57 | this.triggerEvent('change',{
58 | index : setIndex
59 | })
60 | }
61 | },
62 | ready(){
63 | const className = '.i-rate';
64 | var query = wx.createSelectorQuery().in(this)
65 | query.select( className ).boundingClientRect((res)=>{
66 | this.data.touchesStart.pageX = res.left || 0;
67 | }).exec()
68 | }
69 | });
70 |
--------------------------------------------------------------------------------
/components/iViewUi/rate/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":{
4 | "i-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/components/iViewUi/rate/index.wxml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | var prefixCls = 'i-rate';
18 | module.exports = {
19 | getCurrent: function (value, index) {
20 | if (index < value) {
21 | return prefixCls + '-current'
22 | }
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/components/iViewUi/rate/index.wxss:
--------------------------------------------------------------------------------
1 | .i-rate{margin:0;padding:0;font-size:20px;display:inline-block;vertical-align:middle;font-weight:400;font-style:normal}.i-rate-hide-input{display:none}.i-rate-star{display:inline-block;color:#e9e9e9}.i-rate-current{color:#f5a623}.i-rate-text{display:inline-block;vertical-align:middle;margin-left:6px;font-size:14px}
--------------------------------------------------------------------------------
/components/iViewUi/row/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../col/index': {
6 | type: 'child'
7 | }
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/components/iViewUi/row/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/row/index.wxml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/iViewUi/row/index.wxss:
--------------------------------------------------------------------------------
1 | .i-row:after{content:"";display:table;clear:both}
--------------------------------------------------------------------------------
/components/iViewUi/slide/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | options: {
4 | // 在组件定义时的选项中启用多slot支持
5 | multipleSlots: true
6 | },
7 | methods : {
8 | handleTap2(){
9 | console.log(event,1111111)
10 | },
11 | handleTap3(){
12 |
13 | }
14 | }
15 | });
16 |
--------------------------------------------------------------------------------
/components/iViewUi/slide/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-button": "../button/index",
6 | "i-icon": "../icon/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/components/iViewUi/slide/index.wxml:
--------------------------------------------------------------------------------
1 |
2 | 1111
3 |
4 |
--------------------------------------------------------------------------------
/components/iViewUi/slide/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/components/iViewUi/slide/index.wxss
--------------------------------------------------------------------------------
/components/iViewUi/spin/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | properties: {
5 | // small || default || large
6 | size: {
7 | type: String,
8 | value: 'default'
9 | },
10 | fix: {
11 | type: Boolean,
12 | value: false
13 | },
14 | fullscreen: {
15 | type: Boolean,
16 | value: false
17 | },
18 | custom: {
19 | type: Boolean,
20 | value: false
21 | }
22 | }
23 | });
24 |
--------------------------------------------------------------------------------
/components/iViewUi/spin/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/spin/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/components/iViewUi/spin/index.wxss:
--------------------------------------------------------------------------------
1 | .i-spin{color:#2d8cf0;vertical-align:middle;text-align:center}.i-spin-dot{position:relative;display:block;border-radius:50%;background-color:#2d8cf0;width:20px;height:20px;animation:ani-spin-bounce 1s 0s ease-in-out infinite}.i-spin-large .i-spin-dot{width:32px;height:32px}.i-spin-small .i-spin-dot{width:12px;height:12px}.i-spin-fix{position:absolute;top:0;left:0;z-index:8;width:100%;height:100%;background-color:rgba(255,255,255,.9)}.i-spin-fullscreen{z-index:2010}.i-spin-fullscreen-wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.i-spin-fix .i-spin-main{position:absolute;top:50%;left:50%;-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.i-spin-fix .i-spin-dot{display:inline-block}.i-spin-show-text .i-spin-dot,.i-spin-text{display:none}.i-spin-show-text .i-spin-text{display:block;font-size:14px}@keyframes ani-spin-bounce{0%{transform:scale(0)}100%{transform:scale(1);opacity:0}}
--------------------------------------------------------------------------------
/components/iViewUi/step/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties : {
4 | status : {
5 | type : String,
6 | //wait、process、finish、error
7 | value : ''
8 | },
9 | title : {
10 | type : String,
11 | value : ''
12 | },
13 | content : {
14 | type : String,
15 | value : ''
16 | },
17 | icon : {
18 | type : String,
19 | value : ''
20 | }
21 | },
22 | options: {
23 | // 在组件定义时的选项中启用多slot支持
24 | multipleSlots: true
25 | },
26 | relations : {
27 | '../steps/index' : {
28 | type : 'parent'
29 | }
30 | },
31 | data : {
32 | //step length
33 | len : 1,
34 | //current in step index
35 | index : 0,
36 | //parent component select current index
37 | current : 0,
38 | //css direction
39 | direction : 'horizontal'
40 | },
41 | methods : {
42 | updateDataChange( options ){
43 | this.setData({
44 | len : options.len,
45 | index : options.index,
46 | current : options.current,
47 | direction : options.direction
48 | })
49 | }
50 | }
51 |
52 | })
--------------------------------------------------------------------------------
/components/iViewUi/step/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-icon": "../icon/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/step/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ index+1 }}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{title}}
12 |
13 |
14 |
15 |
16 |
17 | {{content}}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | var allStatus = ['wait','process','finish','error'];
26 | module.exports = {
27 | noIco : function( status,current,index,icon ){
28 | var aindex = allStatus.indexOf(status);
29 | var noIcon = true;
30 | if( index < current || icon !== '' ){
31 | noIcon = false;
32 | }
33 | return noIcon;
34 | },
35 | getIcoClass : function( status,ico ){
36 | var class = '';
37 | if( status === 'error' ){
38 | class = 'close';
39 | }else{
40 | class = 'right';
41 | }
42 | if( ico !== '' ){
43 | class = ico;
44 | }
45 | return class;
46 | },
47 | getItemStyle : function(len,direction){
48 | if( direction === 'horizontal' ){
49 | return 'width :'+100/len + '%';
50 | }else{
51 | return 'width : 100%;';
52 | }
53 | },
54 | getClass : function( status,current,index ) {
55 | //wait、process、finish、error
56 | var startClass = 'i-step-'
57 | var classes = '';
58 | var cindex = allStatus.indexOf( status );
59 | if( cindex !== -1 ){
60 | classes = startClass + allStatus[cindex];
61 | }
62 | if( index < current ){
63 | classes = startClass + 'finish';
64 | }else if( index === current ){
65 | classes = startClass + 'process';
66 | }
67 | return classes;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/components/iViewUi/step/index.wxss:
--------------------------------------------------------------------------------
1 | .i-step-ico{width:24px;height:100%;border-radius:100%;background:#fff;position:relative;z-index:2;margin:0 auto;border:#dddee1 solid 1px}.i-step-ico-in{vertical-align:baseline}.i-step-line{position:absolute;left:50%;top:12px;width:100%;height:1px;background:#dddee1}.i-step-horizontal .i-step-ico::after{position:absolute;top:11px;left:23px;z-index:1;content:'';height:1px;background:#fff;width:10px}.i-step-horizontal .i-step-item-main{text-align:center}.i-step-horizontal .i-step-ico::before{position:absolute;top:11px;left:-11px;z-index:1;content:'';height:1px;background:#fff;width:10px}.i-step-ico{box-sizing:border-box;font-size:12px}.i-step-process .i-step-ico{border:#2d8cf0 solid 1px;color:#fff;background:#2d8cf0}.i-step-wait .i-step-ico{border:#e9eaec solid 1px;color:#e9eaec}.i-step-wait .i-step-line{background:#2d8cf0}.i-step-finish .i-step-ico{border:#2d8cf0 solid 1px;color:#2d8cf0}.i-step-finish .i-step-line{background:#2d8cf0}.i-step-error .i-step-ico{border:#ed3f14 solid 1px;color:#ed3f14}.i-step-error .i-step-line{background:#ed3f14}.i-step-item{font-size:12px;position:relative;display:inline-block;box-sizing:border-box;padding-left:10px;vertical-align:top}.i-step-item-ico{width:100%;height:24px;line-height:24px;text-align:center}.i-step-item-main{margin-top:10px;clear:both}.i-step-item-title{font-size:14px;font-weight:700;color:#1c2438}.i-step-item-content{font-size:12px;font-weight:700;margin-top:2px;color:#80848f}.i-step-vertical{padding-bottom:30px}.i-step-vertical .i-step-item-ico{width:24px;float:left}.i-step-vertical .i-step-item-main{margin-left:40px;margin-top:0;clear:inherit}.i-step-vertical .i-step-line{position:absolute;height:100%;top:0;left:10px;margin:0 0 0 12px;width:1px}
--------------------------------------------------------------------------------
/components/iViewUi/steps/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties : {
4 | current : {
5 | type : Number,
6 | value : -1,
7 | observer : '_updateDataChange'
8 | },
9 | status : {
10 | type : String,
11 | //wait、process、finish、error
12 | value : ''
13 | },
14 | direction : {
15 | type : String,
16 | //value has horizontal or vertical
17 | value : 'horizontal'
18 | }
19 | },
20 | relations : {
21 | '../step/index' : {
22 | type : 'child',
23 | linked(){
24 | this._updateDataChange();
25 | },
26 | linkChanged () {
27 | this._updateDataChange();
28 | },
29 | unlinked () {
30 | this._updateDataChange();
31 | }
32 | }
33 | },
34 | methods: {
35 | _updateDataChange() {
36 | let steps = this.getRelationNodes('../step/index');
37 | const len = steps.length;
38 | if (len > 0) {
39 | steps.forEach((step, index) => {
40 | step.updateDataChange({
41 | len : len,
42 | index : index,
43 | current : this.data.current,
44 | direction : this.data.direction
45 | });
46 | });
47 | }
48 | }
49 | }
50 | })
--------------------------------------------------------------------------------
/components/iViewUi/steps/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/steps/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/components/iViewUi/steps/index.wxss:
--------------------------------------------------------------------------------
1 | .i-steps{width:100%}
--------------------------------------------------------------------------------
/components/iViewUi/sticky-item/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | options: {
4 | multipleSlots: true
5 | },
6 | relations : {
7 | '../sticky/index' : {
8 | type : 'parent'
9 | }
10 | },
11 | data : {
12 | top : 0,
13 | height : 0,
14 | isFixed : false,
15 | index : -1,
16 | },
17 | methods: {
18 | updateScrollTopChange(scrollTop){
19 | const data = this.data;
20 | const top = data.top;
21 | const height = data.height;
22 | this.setData({
23 | isFixed : ( scrollTop >= top && scrollTop < top + height ) ? true : false
24 | })
25 | },
26 | updateDataChange(index) {
27 | const className = '.i-sticky-item';
28 | const query = wx.createSelectorQuery().in(this);
29 | query.select( className ).boundingClientRect((res)=>{
30 | if( res ){
31 | this.setData({
32 | top : res.top,
33 | height : res.height,
34 | index : index
35 | })
36 | }
37 | }).exec()
38 | }
39 | }
40 | })
--------------------------------------------------------------------------------
/components/iViewUi/sticky-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/sticky-item/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/components/iViewUi/sticky-item/index.wxss:
--------------------------------------------------------------------------------
1 | .i-sticky-item-header{background:#eee;font-size:14px;width:100%;height:32px;line-height:32px}.i-sticky-item-content{font-size:14px}.i-sticky-title{width:100%;padding:0 15px;box-sizing:border-box;background:#eee}.i-sticky-fixed .i-sticky-title{position:fixed;top:0}
--------------------------------------------------------------------------------
/components/iViewUi/sticky/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties : {
4 | scrollTop : {
5 | type : Number,
6 | observer(val){
7 | this._updateScrollTopChange();
8 | }
9 | }
10 | },
11 | relations : {
12 | '../sticky-item/index' : {
13 | type : 'child',
14 | linked(){
15 | this._updateDataChange();
16 | },
17 | linkChanged () {
18 | this._updateDataChange();
19 | },
20 | unlinked () {
21 | this._updateDataChange();
22 | }
23 | }
24 | },
25 | data : {
26 | timer : null,
27 | itemLength : 0,
28 | },
29 | methods : {
30 | _updateScrollTopChange(){
31 | const stickies = this.getRelationNodes('../sticky-item/index');
32 | if( stickies.length > 0 ){
33 | stickies.forEach((item) => {
34 | if( item ){
35 | item.updateScrollTopChange( this.data.scrollTop );
36 | }
37 | })
38 | }
39 | },
40 | _updateDataChange( ){
41 | const stickies = this.getRelationNodes('../sticky-item/index');
42 | if( stickies.length > 0 ){
43 | if( this.data.timer ){
44 | clearTimeout( this.data.timer )
45 | this.setData({
46 | timer : null
47 | })
48 | }
49 | this.data.timer = setTimeout(()=>{
50 | stickies.forEach((item,index) => {
51 | if( item ){
52 | item.updateDataChange(index);
53 | }
54 | })
55 | },0)
56 | this.setData({
57 | timer : this.data.timer
58 | })
59 | }
60 | }
61 | }
62 |
63 | })
--------------------------------------------------------------------------------
/components/iViewUi/sticky/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/sticky/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/components/iViewUi/sticky/index.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yuzhanglong/EasyQuestionnaire-MiniProgram/bda7c123bd9f8e6bdeb3e529db304b878881e0d1/components/iViewUi/sticky/index.wxss
--------------------------------------------------------------------------------
/components/iViewUi/swipeout/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-cell": "../cell/index",
5 | "i-icon": "../icon/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/components/iViewUi/swipeout/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
15 |
20 |
21 | {{item.name}}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | module.exports = {
31 | setStyle : function( item ){
32 | var defaults = '#f7f7f7';
33 | return 'background:' + ( item.background ? item.background : defaults ) +';' + 'color:'+ item.color;
34 | },
35 | setPosition : function( position ){
36 | return 'transform:translate(' + position.pageX + 'px,0);';
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/components/iViewUi/swipeout/index.wxss:
--------------------------------------------------------------------------------
1 | .i-swipeout-wrap{border-bottom:#dddee1 solid 1px;background:#fff;position:relative;overflow:hidden}.i-swipeout-item{width:100%;padding:15px 20px;box-sizing:border-box;transition:transform .2s ease;font-size:14px}.i-swipeout-content{white-space:nowrap;overflow:hidden}.i-swipeout-button-right-group{position:absolute;right:-100%;top:0;height:100%;z-index:1;width:100%}.i-swipeout-button-right-item{height:100%;float:left;white-space:nowrap;box-sizing:border-box;display:flex;align-items:center;justify-content:center}
--------------------------------------------------------------------------------
/components/iViewUi/switch/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties : {
4 | value : {
5 | type : Boolean,
6 | value : false
7 | },
8 | //large small default
9 | size : {
10 | type : String,
11 | value : 'default'
12 | },
13 | // is or not disable
14 | disabled : {
15 | type : Boolean,
16 | value : false
17 | },
18 | // hidden inut name
19 | name : {
20 | type : String,
21 | value : ''
22 | }
23 | },
24 | options: {
25 | // 在组件定义时的选项中启用多slot支持
26 | multipleSlots: true
27 | },
28 | methods : {
29 | toggle(){
30 | if( this.data.disabled ) return;
31 | const data = this.data;
32 | const value = data.value ? false : true;
33 | this.triggerEvent('change',{
34 | value : value
35 | })
36 | }
37 | }
38 | });
39 |
--------------------------------------------------------------------------------
/components/iViewUi/switch/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/switch/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | var sizes = ['large', 'default'];
12 | var prefixCls = 'i-switch';
13 | module.exports = {
14 | setSize : function( size ){
15 | var index = sizes.indexOf( size );
16 | return prefixCls + ( index > -1 ? ( '-'+size ) : 'default' )
17 | },
18 | setCurrent : function( value,disabled ){
19 | var className = value && !disabled ? prefixCls + '-checked' : '';
20 | if( disabled ){
21 | className += ' ' + prefixCls + '-disabled';
22 | }
23 | return className;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/components/iViewUi/switch/index.wxss:
--------------------------------------------------------------------------------
1 | .i-switch{display:inline-block;width:48px;height:24px;line-height:24px;border-radius:24px;vertical-align:middle;border:1px solid #ccc;background-color:#ccc;position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:all .2s ease-in-out}.i-switch-hide-input{display:none;opacity:0}.i-switch-inner{color:#fff;font-size:12px;position:absolute;left:25px;vertical-align:middle}.i-switch-inner .i-icon{width:12px;height:12px;text-align:center;vertical-align:middle}.i-switch:after{content:'';width:22px;height:22px;border-radius:22px;background-color:#fff;position:absolute;left:1px;top:1px;cursor:pointer;transition:left .2s ease-in-out,width .2s ease-in-out}.i-switch-checked:after{left:8px}.i-switch-large{width:60px}.i-switch-large.i-switch-checked:after{left:37px}.i-switch-checked:after{left:25px}.i-switch-checked{border-color:#2d8cf0;background-color:#2d8cf0}.i-switch-checked .i-switch-inner{left:8px}.i-switch-checked:after{left:25px}.i-switch-disabled{background:#f3f3f3;border-color:#f3f3f3}.i-switch-disabled:after{background:#ccc;cursor:not-allowed}.i-switch-disabled .i-switch-inner{color:#ccc}
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar-item/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../tab-bar/index': {
6 | type: 'parent'
7 | }
8 | },
9 |
10 | properties: {
11 | icon: {
12 | type: String,
13 | value: ''
14 | },
15 | currentIcon: {
16 | type: String,
17 | value: ''
18 | },
19 | img: {
20 | type: String,
21 | value: ''
22 | },
23 | currentImg: {
24 | type: String,
25 | value: ''
26 | },
27 | key: {
28 | type: String,
29 | value: ''
30 | },
31 | title: {
32 | type: String,
33 | value: ''
34 | },
35 | dot: {
36 | type: Boolean,
37 | value: false
38 | },
39 | count: {
40 | type: Number,
41 | value: 0
42 | }
43 | },
44 |
45 | data: {
46 | current: false,
47 | currentColor: ''
48 | },
49 |
50 | methods: {
51 | changeCurrent (current) {
52 | this.setData({ current });
53 | },
54 | changeCurrentColor (currentColor) {
55 | this.setData({ currentColor });
56 | },
57 | handleClickItem () {
58 | const parent = this.getRelationNodes('../tab-bar/index')[0];
59 | parent.emitEvent(this.data.key);
60 | }
61 | }
62 | });
63 |
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-badge": "../badge/index",
6 | "i-icon": "../icon/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar-item/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{ title }}
7 | {{ title }}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar-item/index.wxss:
--------------------------------------------------------------------------------
1 | .i-tab-bar-item{flex:1;display:flex;width:100%;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;text-align:center}.i-tab-bar-item-icon{display:flex;-webkit-box-pack:center;justify-content:center;box-sizing:border-box;color:#80848f}.i-tab-bar-item-icon-current{color:#2d8cf0}.i-tab-bar-item-img{display:flex;-webkit-box-pack:center;justify-content:center;box-sizing:border-box;width:22px;height:22px}.i-tab-bar-item-title{font-size:10px;margin:3px 0 0;line-height:1;text-align:center;box-sizing:border-box;color:#80848f}.i-tab-bar-item-title-current{color:#2d8cf0}.i-tab-bar-item-img{display:flex;-webkit-box-pack:center;justify-content:center;box-sizing:border-box;color:#80848f}
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../tab-bar-item/index': {
6 | type: 'child',
7 | linked () {
8 | this.changeCurrent();
9 | },
10 | linkChanged () {
11 | this.changeCurrent();
12 | },
13 | unlinked () {
14 | this.changeCurrent();
15 | }
16 | }
17 | },
18 |
19 | properties: {
20 | current: {
21 | type: String,
22 | value: '',
23 | observer: 'changeCurrent'
24 | },
25 | color: {
26 | type: String,
27 | value: ''
28 | },
29 | fixed: {
30 | type: Boolean,
31 | value: false
32 | }
33 | },
34 |
35 | data: {
36 | list: []
37 | },
38 |
39 | methods: {
40 | changeCurrent (val = this.data.current) {
41 | let items = this.getRelationNodes('../tab-bar-item/index');
42 | const len = items.length;
43 |
44 | if (len > 0) {
45 | const list = [];
46 | items.forEach(item => {
47 | item.changeCurrent(item.data.key === val);
48 | item.changeCurrentColor(this.data.color);
49 | list.push({
50 | key: item.data.key
51 | });
52 | });
53 | this.setData({
54 | list: list
55 | });
56 | }
57 | },
58 | emitEvent (key) {
59 | this.triggerEvent('change', { key });
60 | },
61 | handleClickItem (e) {
62 | const key = e.currentTarget.dataset.key;
63 | this.emitEvent(key);
64 | }
65 | }
66 | });
67 |
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/components/iViewUi/tab-bar/index.wxss:
--------------------------------------------------------------------------------
1 | .i-tab-bar{display:flex;width:100%;height:50px;box-sizing:border-box;position:relative;justify-content:space-around;align-items:center;-webkit-box-align:center;background:#fff}.i-tab-bar::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-top-width:1px}.i-tab-bar-fixed{position:fixed;bottom:0;z-index:2}.i-tab-bar-list{position:absolute;top:0;bottom:0;left:0;right:0}.i-tab-bar-layer{display:block;float:left;height:100%}
--------------------------------------------------------------------------------
/components/iViewUi/tab/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../tabs/index': {
6 | type: 'parent'
7 | }
8 | },
9 |
10 | properties: {
11 | key: {
12 | type: String,
13 | value: ''
14 | },
15 | title: {
16 | type: String,
17 | value: ''
18 | },
19 | dot: {
20 | type: Boolean,
21 | value: false
22 | },
23 | count: {
24 | type: Number,
25 | value: 0
26 | }
27 | },
28 |
29 | data: {
30 | current: false,
31 | currentColor: '',
32 | scroll: false
33 | },
34 |
35 | methods: {
36 | changeCurrent (current) {
37 | this.setData({ current });
38 | },
39 | changeCurrentColor (currentColor) {
40 | this.setData({ currentColor });
41 | },
42 | changeScroll (scroll) {
43 | this.setData({ scroll });
44 | },
45 | handleClickItem () {
46 | const parent = this.getRelationNodes('../tabs/index')[0];
47 | parent.emitEvent(this.data.key);
48 | }
49 | }
50 | });
51 |
--------------------------------------------------------------------------------
/components/iViewUi/tab/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-badge": "../badge/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/tab/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ title }}
5 | {{ title }}
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/components/iViewUi/tab/index.wxss:
--------------------------------------------------------------------------------
1 | .i-tabs-tab{flex:1;display:flex;width:100%;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;text-align:center;position:relative}.i-tabs-tab-bar{display:block;width:100%;height:2px;background:0 0;position:absolute;bottom:0;left:0;background:#2d8cf0}.i-tabs-tab-title{font-size:14px;text-align:center;box-sizing:border-box;color:#80848f}.i-tabs-tab-title-current{color:#2d8cf0}.i-tabs-tab-scroll{display:inline-block;width:60px}
--------------------------------------------------------------------------------
/components/iViewUi/tabs/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 |
4 | relations: {
5 | '../tab/index': {
6 | type: 'child',
7 | linked () {
8 | this.changeCurrent();
9 | },
10 | linkChanged () {
11 | this.changeCurrent();
12 | },
13 | unlinked () {
14 | this.changeCurrent();
15 | }
16 | }
17 | },
18 |
19 | properties: {
20 | current: {
21 | type: String,
22 | value: '',
23 | observer: 'changeCurrent'
24 | },
25 | color: {
26 | type: String,
27 | value: ''
28 | },
29 | scroll: {
30 | type: Boolean,
31 | value: false
32 | },
33 | fixed: {
34 | type: Boolean,
35 | value: false
36 | }
37 | },
38 |
39 | methods: {
40 | changeCurrent (val = this.data.current) {
41 | let items = this.getRelationNodes('../tab/index');
42 | const len = items.length;
43 |
44 | if (len > 0) {
45 | items.forEach(item => {
46 | item.changeScroll(this.data.scroll);
47 | item.changeCurrent(item.data.key === val);
48 | item.changeCurrentColor(this.data.color);
49 | });
50 | }
51 | },
52 | emitEvent (key) {
53 | this.triggerEvent('change', { key });
54 | }
55 | }
56 | });
57 |
--------------------------------------------------------------------------------
/components/iViewUi/tabs/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/iViewUi/tabs/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/components/iViewUi/tabs/index.wxss:
--------------------------------------------------------------------------------
1 | .i-tabs{display:flex;width:100%;height:42px;line-height:42px;box-sizing:border-box;position:relative;justify-content:space-around;align-items:center;-webkit-box-align:center;background:#fff}.i-tabs::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px}.i-tabs-scroll{display:block;overflow-x:auto;white-space:nowrap}.i-tabs-fixed{position:fixed;top:0;z-index:2}
--------------------------------------------------------------------------------
/components/iViewUi/tag/index.js:
--------------------------------------------------------------------------------
1 | Component({
2 | externalClasses: ['i-class'],
3 | properties : {
4 | //slot name
5 | name : {
6 | type : String,
7 | value : ''
8 | },
9 | //can click or not click
10 | checkable : {
11 | type : Boolean,
12 | value : false
13 | },
14 | //is current choose
15 | checked : {
16 | type : Boolean,
17 | value : true
18 | },
19 | //background and color setting
20 | color : {
21 | type : String,
22 | value : 'default'
23 | },
24 | //control fill or not
25 | type : {
26 | type : String,
27 | value : 'dot'
28 | }
29 | },
30 | methods : {
31 | tapTag(){
32 | const data = this.data;
33 | if( data.checkable ){
34 | const checked = data.checked ? false : true;
35 | this.triggerEvent('change',{
36 | name : data.name || '',
37 | checked : checked
38 | });
39 | }
40 | }
41 | }
42 | })
--------------------------------------------------------------------------------
/components/iViewUi/tag/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component" : true
3 | }
--------------------------------------------------------------------------------
/components/iViewUi/tag/index.wxml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | module.exports = {
8 | getClass : function(color,type,checked,checkable) {
9 | var initColorList = ['blue', 'green', 'red', 'yellow', 'default'];
10 | var theme = '';
11 | var className = 'i-tag-';
12 | if( initColorList.indexOf( color ) > -1 ){
13 | theme = className + color;
14 | }
15 | if( type === 'border' ){
16 | theme = className+color+'-border';
17 | }
18 | if( checkable && checked ){
19 | theme = className+color+'-checked';
20 | }else if( checkable && !checked ){
21 | theme = ( type === 'border' ? className + color +'-border' : className+'none' );
22 | }
23 |
24 | return theme;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/components/iViewUi/tag/index.wxss:
--------------------------------------------------------------------------------
1 | .i-tag {
2 | display: inline-block;
3 | height: 18px;
4 | line-height: 18px;
5 | padding: 0 4px;
6 | border-radius: 2px;
7 | background: #fff;
8 | font-size: 11px;
9 | vertical-align: middle;
10 | border: 1rpx solid #dddee1
11 | }
12 |
13 | .i-tag-none {
14 | border-color: #fff
15 | }
16 |
17 | .i-tag-default {
18 | border-color: #dddee1;
19 | background: #e9eaec
20 | }
21 |
22 | .i-tag-red {
23 | background: #ed3f14;
24 | color: #fff
25 | }
26 |
27 | .i-tag-red-border {
28 | color: #ed3f14;
29 | background: #fff;
30 | border-color: #ed3f14
31 | }
32 |
33 | .i-tag-red-checked {
34 | background: #ed3f14;
35 | color: #fff;
36 | border-color: #ed3f14
37 | }
38 |
39 | .i-tag-green {
40 | background: #19be6b;
41 | color: #fff;
42 | border-color: #19be6b
43 | }
44 |
45 | .i-tag-green-border {
46 | color: #19be6b;
47 | background: #fff;
48 | border-color: #19be6b
49 | }
50 |
51 | .i-tag-green-checked {
52 | background: #19be6b;
53 | color: #fff;
54 | border-color: #19be6b
55 | }
56 |
57 | .i-tag-blue {
58 | background: #2d8cf0;
59 | color: #fff;
60 | border-color: #2d8cf0
61 | }
62 |
63 | .i-tag-blue-border {
64 | color: #2d8cf0;
65 | background: #fff;
66 | border-color: #2d8cf0
67 | }
68 |
69 | .i-tag-blue-checked {
70 | background: #2d8cf0;
71 | color: #fff;
72 | border-color: #2d8cf0
73 | }
74 |
75 | .i-tag-yellow {
76 | background: #f90;
77 | color: #fff;
78 | border-color: #f90
79 | }
80 |
81 | .i-tag-yellow-border {
82 | color: #f90;
83 | background: #fff;
84 | border-color: #f90
85 | }
86 |
87 | .i-tag-yellow-checked {
88 | background: #f90;
89 | color: #fff;
90 | border-color: #f90
91 | }
92 |
93 | .i-tag-default-checked {
94 | background: #e9eaec;
95 | color: #495060;
96 | border-color: #e9eaec
97 | }
--------------------------------------------------------------------------------
/components/iViewUi/toast/index.js:
--------------------------------------------------------------------------------
1 | const default_data = {
2 | visible: false,
3 | content: '',
4 | icon: '',
5 | image: '',
6 | duration: 2,
7 | mask: true,
8 | type: 'default', // default || success || warning || error || loading
9 | };
10 |
11 | let timmer = null;
12 |
13 | Component({
14 | externalClasses: ['i-class'],
15 |
16 | data: {
17 | ...default_data
18 | },
19 |
20 | methods: {
21 | handleShow (options) {
22 | const { type = 'default', duration = 2 } = options;
23 |
24 | this.setData({
25 | ...options,
26 | type,
27 | duration,
28 | visible: true
29 | });
30 |
31 | const d = this.data.duration * 1000;
32 |
33 | if (timmer) clearTimeout(timmer);
34 | if (d !== 0) {
35 | timmer = setTimeout(() => {
36 | this.handleHide();
37 | timmer = null;
38 | }, d);
39 | }
40 | },
41 |
42 | handleHide () {
43 | this.setData({
44 | ...default_data
45 | });
46 | }
47 | }
48 | });
49 |
--------------------------------------------------------------------------------
/components/iViewUi/toast/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents":
4 | {
5 | "i-icon": "../icon/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/components/iViewUi/toast/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | {{ content }}
16 |
--------------------------------------------------------------------------------
/components/iViewUi/toast/index.wxss:
--------------------------------------------------------------------------------
1 | .i-toast{position:fixed;top:35%;left:50%;transform:translate3d(-50%,-50%,0);background:rgba(0,0,0,.7);color:#fff;font-size:14px;line-height:1.5em;margin:0 auto;box-sizing:border-box;padding:10px 18px;text-align:center;border-radius:4px;z-index:1010}.i-toast-mask{position:fixed;top:0;bottom:0;left:0;right:0;z-index:1010}.i-toast-icon{font-size:38px!important;margin-bottom:6px}.i-toast-image{max-width:100px;max-height:100px}.i-toast-loading{display:inline-block;vertical-align:middle;width:28px;height:28px;background:0 0;border-radius:50%;border:2px solid #fff;border-color:#fff #fff #fff #2d8cf0;animation:btn-spin .8s linear;animation-iteration-count:infinite}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
--------------------------------------------------------------------------------
/components/my-table/my-table.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | column: Object,
4 | row: Object,
5 | showTable: Boolean
6 | },
7 | data: {},
8 | methods: {}
9 | });
10 |
--------------------------------------------------------------------------------
/components/my-table/my-table.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | }
5 | }
--------------------------------------------------------------------------------
/components/my-table/my-table.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 | {{item.data}}
7 |
8 |
9 |
10 |
11 | 抱歉 这道题的数据无法用表格呈现 请查看详细
12 |
13 |
14 |
15 |
20 |
21 |
22 |
27 | {{rowItem[columnItem.name] || columnItem.default}}
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/components/my-table/my-table.wxss:
--------------------------------------------------------------------------------
1 | .table-head {
2 | display: flex;
3 | align-content: space-between;
4 | padding-bottom: 10px;
5 | color: #909C95;
6 | font-size: 25rpx;
7 | font-weight: bold;
8 | }
9 |
10 |
11 | .table {
12 | display: flex;
13 | flex-direction: column;
14 | }
15 |
16 | .can-not-show-table{
17 | color: #909C95;
18 | font-size: 25rpx;
19 | }
20 |
21 |
22 | .table-column {
23 | display: flex;
24 | font-size: 25rpx;
25 | }
26 |
27 | .table-row {
28 | border-top: 1px solid #EBF5EE;
29 | padding-bottom: 10px;
30 | padding-top: 10px;
31 | }
32 |
33 |
34 | .table-row-emphasis {
35 | border-bottom: 1px solid #EBF5EE;
36 | border-top: 1px solid #EBF5EE;
37 | padding-bottom: 10px;
38 | padding-top: 10px;
39 | background-color: #FAFAFA;
40 | }
41 |
42 | .table-column-item{
43 | padding-right: 10px;
44 | }
--------------------------------------------------------------------------------
/components/topBar/topBar.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {},
3 | data: {},
4 | methods: {},
5 | options: {
6 | multipleSlots: true
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/components/topBar/topBar.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/components/topBar/topBar.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/components/topBar/topBar.wxss:
--------------------------------------------------------------------------------
1 | .top-bar{
2 | display: flex;
3 | background-color: white;
4 | height: 100rpx;
5 | }
6 |
7 |
8 | .top-bar-left{
9 | width: 100rpx;
10 | }
11 |
12 | .top-bar-mid{
13 | flex: 1;
14 | }
15 |
16 | .top-bar-right{
17 | width: 120rpx;
18 | }
--------------------------------------------------------------------------------
/models/ResponseModel.js:
--------------------------------------------------------------------------------
1 | class ResponseModel {
2 | constructor(json) {
3 | if ('errorCode' in json) {
4 | this.errorCode = json['errorCode'];
5 | }
6 | if (json['information'] !== undefined) {
7 | this.information = json['information'];
8 | }
9 | }
10 | }
11 |
12 | export {
13 | ResponseModel
14 | }
--------------------------------------------------------------------------------
/models/problemModel.js:
--------------------------------------------------------------------------------
1 | class ProblemModel {
2 | constructor(json) {
3 | this.isRequire = json['isRequire'];
4 | this.options = json['options'];
5 | this.problemId = json['problemId'];
6 | this.targetQuestionnaireId = json['targetQuestionnaireId'];
7 | this.title = json['title'];
8 | this.type = json['type'];
9 | }
10 | }
11 |
12 | export {
13 | ProblemModel
14 | }
--------------------------------------------------------------------------------
/models/questionnaireModel.js:
--------------------------------------------------------------------------------
1 | import {TimeHelper} from "../utils/timeHelper";
2 |
3 | class Questionnaire {
4 | constructor(json) {
5 | this.basicInfo = new QuestionnaireCondition(json['basicInfo']);
6 | this.problems = json['problems'];
7 | }
8 | }
9 |
10 |
11 | class QuestionnaireCondition {
12 | constructor(json) {
13 | this.condition = json['condition'];
14 | this.deadlineControl = json['deadlineControl'];
15 | this.equipmentControl = json['equipmentControl'];
16 | this.ipControl = json['ipControl'];
17 | this.isSecret = json['isSecret'];
18 | this.questionnaireId = json['questionnaireId'];
19 | this.renewTime = json['renewTime'];
20 | this.secretKey = json['secretKey'];
21 | this.subTitle = json['subTitle'];
22 | this.title = json['title'];
23 | this.wechatControl = json['wechatControl'];
24 | this.deadline = json['deadline'];
25 | this.deadlineDate = TimeHelper.GMTtoDate(json['deadline']);
26 | this.deadlineTime = TimeHelper.GMTtoTime(json['deadline']);
27 | }
28 |
29 |
30 | deadlineArrayToGMTString() {
31 | this.deadline = `${this.deadlineDate} ${this.deadlineTime}`;
32 | }
33 |
34 | deleteUselessData() {
35 | delete this.deadlineDate;
36 | delete this.deadlineTime;
37 | }
38 | }
39 |
40 | export {
41 | QuestionnaireCondition,
42 | Questionnaire
43 | }
--------------------------------------------------------------------------------
/network/analysis.js:
--------------------------------------------------------------------------------
1 | import request from "./requests";
2 | import {base64} from "../utils/base64";
3 |
4 | class AnalysisRequest {
5 | static getAnalysisData(qid, token) {
6 | return request({
7 | method: 'get',
8 | url: 'analysis/' + qid,
9 | header: {
10 | "authorization": "Basic " + base64.encode(`${token}:`)
11 | }
12 | })
13 | }
14 |
15 |
16 | static getProblemAnalysisData(pid, token) {
17 | return request({
18 | method: 'get',
19 | url: 'analysis/problem/' + pid,
20 | header: {
21 | "authorization": "Basic " + base64.encode(`${token}:`)
22 | }
23 | })
24 | }
25 | }
26 |
27 | export {
28 | AnalysisRequest
29 | }
--------------------------------------------------------------------------------
/network/complete.js:
--------------------------------------------------------------------------------
1 | import request from "./requests";
2 |
3 |
4 | class CompleteRequest {
5 | static getCondition(qid) {
6 | return request({
7 | method: 'get',
8 | url: 'completes/get_condition/' + qid
9 | })
10 | }
11 |
12 | static checkSecretKey(qid, key) {
13 | return request({
14 | method: 'post',
15 | url: 'completes/check_key/' + qid,
16 | data: {
17 | secretKey: key !== null ? key : "key"
18 | }
19 | })
20 | }
21 |
22 | static submitComplete(data, qid) {
23 | let myDate = new Date();
24 | return request({
25 | method: 'post',
26 | url: 'completes/submit_data/' + qid,
27 | data: {
28 | completeData: data,
29 | submitTime: myDate.getTime()
30 | }
31 | })
32 | }
33 | }
34 |
35 | export {
36 | CompleteRequest
37 | }
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/network/config.js:
--------------------------------------------------------------------------------
1 | const BASE_URL = "http://192.168.0.129:5000/v1";
2 | const USER_TYPE = 1001;
3 | export {
4 | BASE_URL,
5 | USER_TYPE
6 | }
--------------------------------------------------------------------------------
/network/requests.js:
--------------------------------------------------------------------------------
1 | import {BASE_URL} from "./config";
2 |
3 | export default function request(option) {
4 | return new Promise((resolve, reject) => {
5 | wx.request({
6 | url: BASE_URL + '/' + option.url,
7 | method: option.method || 'get',
8 | data: option.data || {},
9 | success: result => {
10 | if (result.statusCode < 300) {
11 | resolve(result);
12 | } else {
13 | reject(result);
14 | }
15 | },
16 | fail: reject,
17 | header: option.header || {},
18 | });
19 | })
20 | }
--------------------------------------------------------------------------------
/network/user.js:
--------------------------------------------------------------------------------
1 | import request from "./requests";
2 | import {USER_TYPE} from "./config";
3 | import {base64} from "../utils/base64";
4 |
5 | class UserRequest {
6 |
7 | static userLogin(userName, secretCode) {
8 | return request({
9 | url: "users/login",
10 | method: "post",
11 | data: {
12 | "userName": userName,
13 | "secret": secretCode,
14 | "type": USER_TYPE
15 | },
16 | header: {}
17 | });
18 | }
19 |
20 |
21 | static checkToken(token) {
22 | return request({
23 | url: "users/token",
24 | method: "get",
25 | data: null,
26 | header: {
27 | "authorization": "Basic " + base64.encode(`${token}:`)
28 | }
29 | });
30 | }
31 | }
32 |
33 |
34 | export {
35 | UserRequest
36 | }
--------------------------------------------------------------------------------
/pages/analysis/analysis.js:
--------------------------------------------------------------------------------
1 | import {AnalysisRequest} from "../../network/analysis";
2 | import {MessageBox} from "../../utils/messageBox";
3 |
4 | const app = getApp();
5 |
6 |
7 | Page({
8 | data: {
9 | basicInfo: null,
10 | resolutions: [],
11 | tableColumn: [
12 | {
13 | name: "title",
14 | data: "选项",
15 | width: 400,
16 | default: "这个选项没有内容"
17 | },
18 | {
19 | name: "resolution",
20 | data: "选择此项的人数",
21 | width: 300,
22 | default: 0
23 | }
24 | ],
25 | tableColumnForScore: [
26 | {
27 | name: "title",
28 | data: "等级(1 - 5)",
29 | width: 400,
30 | default: "这个选项没有内容"
31 | },
32 | {
33 | name: "resolution",
34 | data: "倾向该等级的人数",
35 | width: 300,
36 | default: 0
37 | }
38 | ]
39 | },
40 | onLoad(options) {
41 | let qid = options.qid;
42 | AnalysisRequest.getAnalysisData(qid, app.globalData.token)
43 | .then(res => {
44 | console.log(res);
45 | this.setData({
46 | basicInfo: res.data.basicInfo,
47 | resolutions: res.data.data
48 | })
49 | })
50 | .catch(() => {
51 | MessageBox.handleError({
52 | message: "抱歉 数据获取失败 三秒后返回首页"
53 | });
54 | setTimeout(() => {
55 | wx.navigateBack();
56 | }, 3000)
57 | })
58 | },
59 | gotoDetailedAnalysis(event) {
60 | console.log(event);
61 | // 注意这里 problemid 的i小写
62 | let pid = event.currentTarget.dataset.problemid;
63 | wx.navigateTo({
64 | url: "/pages/detailedAnalysis/detailedAnalysis?pid=" + pid
65 | })
66 | }
67 | });
--------------------------------------------------------------------------------
/pages/analysis/analysis.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "basic-info": "/components/basicInfo/basicInfo",
4 | "my-table": "/components/my-table/my-table",
5 | "i-message": "/components/iViewUi/message/index",
6 | "bottom-message": "/components/bottomMessage/bottomMessage"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/analysis/analysis.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
12 | {{item.title}}
13 | 查看详细
17 |
18 |
19 |
22 |
23 |
24 |
27 |
28 |
29 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/pages/analysis/analysis.wxss:
--------------------------------------------------------------------------------
1 | .resolution-items{
2 | justify-content: center;
3 | padding-left: 5vw;
4 | padding-top: 40px;
5 | width: 90vw;
6 | }
7 |
8 | .resolution-items-title{
9 | font-size: 28rpx;
10 | padding-bottom: 20rpx;
11 | }
12 |
13 | .bottom-message{
14 | padding-top: 50px;
15 | }
16 |
17 | .show-detail-text{
18 | color: #51B7CA;
19 | }
--------------------------------------------------------------------------------
/pages/basicEdition/basicEdition.js:
--------------------------------------------------------------------------------
1 | import {QuestionnaireRequest} from "../../network/questionnaire";
2 | import {QuestionnaireCondition} from "../../models/questionnaireModel";
3 | import {ResponseModel} from "../../models/ResponseModel";
4 | import {MessageBox} from "../../utils/messageBox";
5 |
6 | const app = getApp();
7 | Page({
8 | data: {
9 | questionnaireId: null,
10 | questionnaireCondition: {},
11 | },
12 |
13 | onLoad(options) {
14 | this.data.questionnaireId = options.qid;
15 | let token = app.globalData.token;
16 | let qid = this.data.questionnaireId;
17 | QuestionnaireRequest.getQuesionnaireCondition(qid, token)
18 | .then(res => {
19 | let q = new QuestionnaireCondition(res.data);
20 | this.setData({
21 | questionnaireCondition: q
22 | });
23 | MessageBox.handleSuccess({
24 | message: `当前编辑: ${q.title}`
25 | });
26 | })
27 | .catch(err => {
28 | let response = new ResponseModel(err.data);
29 | MessageBox.handleError({
30 | message: response.information || "抱歉 获取失败"
31 | })
32 | });
33 | },
34 |
35 | switchChange(event) {
36 | let conditionType = event.target.dataset.type;
37 | let helper = `questionnaireCondition.${conditionType}`;
38 | this.setData({
39 | [helper]: !this.data.questionnaireCondition[conditionType]
40 | })
41 | },
42 |
43 | // 注意 在微信开发工具的模拟器下input无法修改值 需要真机调试
44 | secretInputChange(event) {
45 | let newValue = event.detail.detail.value;
46 | this.setData({
47 | 'questionnaireCondition.secretKey': newValue
48 | })
49 | },
50 | bindTimeChange(event) {
51 | let target = 'questionnaireCondition.deadlineTime';
52 | this.setData({
53 | [target]: event.detail.value + ':00'
54 | });
55 | },
56 |
57 | bindDateChange(event) {
58 | let target = 'questionnaireCondition.deadlineDate';
59 | this.setData({
60 | [target]: event.detail.value
61 | });
62 | },
63 |
64 | subMitData() {
65 | this.data.questionnaireCondition.deadlineArrayToGMTString();
66 | let c = new QuestionnaireCondition(this.data.questionnaireCondition);
67 | c.deadlineArrayToGMTString();
68 | c.deleteUselessData();
69 | QuestionnaireRequest.editQuesitonnaire(c, app.globalData.token)
70 | .then(() => {
71 | MessageBox.handleSuccess({
72 | message: "问卷编辑成功~"
73 | });
74 | })
75 | .catch(err => {
76 | let response = new ResponseModel(err.data);
77 | MessageBox.handleError({
78 | message: response.information || "抱歉 编辑失败"
79 | })
80 | })
81 | }
82 | });
--------------------------------------------------------------------------------
/pages/basicEdition/basicEdition.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "i-message": "/components/iViewUi/message/index",
4 | "i-cell-group": "/components/iViewUi/cell-group/index",
5 | "i-cell": "/components/iViewUi/cell/index",
6 | "i-input": "/components/iViewUi/input/index",
7 | "i-button": "/components/iViewUi/button/index",
8 | "i-card": "/components/iViewUi/card/index",
9 | "i-tag": "/components/iViewUi/tag/index"
10 | }
11 | }
--------------------------------------------------------------------------------
/pages/basicEdition/basicEdition.wxss:
--------------------------------------------------------------------------------
1 | .picker {
2 | color: #C0C0C0;
3 | }
--------------------------------------------------------------------------------
/pages/basicInfoEdition/basicInfoEdition.js:
--------------------------------------------------------------------------------
1 | import {QuestionnaireRequest} from "../../network/questionnaire";
2 | import {MessageBox} from "../../utils/messageBox";
3 | import {ResponseModel} from "../../models/ResponseModel";
4 |
5 | const app = getApp();
6 |
7 | Page({
8 | data: {
9 | title: "",
10 | subTitle: "",
11 | questionnaireId: null
12 | },
13 |
14 | onLoad(options) {
15 | this.setData({
16 | title: options.title,
17 | subTitle: options.subTitle,
18 | questionnaireId: options.qid
19 | });
20 | },
21 |
22 |
23 | editQuestionnaireBasicInfo() {
24 | let dataMap = {
25 | title: this.data.title,
26 | subTitle: this.data.subTitle,
27 | questionnaireId: this.data.questionnaireId
28 | };
29 | QuestionnaireRequest.editQuesitonnaire(dataMap, app.globalData.token)
30 | .then(() => {
31 | wx.navigateBack();
32 | })
33 | .catch(err => {
34 | let response = new ResponseModel(err.data);
35 | MessageBox.handleError({
36 | message: response.information
37 | })
38 | });
39 | },
40 |
41 | subTitleChange(event) {
42 | this.setData({
43 | subTitle: event.detail.detail.value
44 | });
45 | },
46 |
47 | titleChange(event) {
48 | this.setData({
49 | title: event.detail.detail.value
50 | });
51 | }
52 |
53 | });
--------------------------------------------------------------------------------
/pages/basicInfoEdition/basicInfoEdition.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "i-input": "/components/iViewUi/input/index",
4 | "i-button": "/components/iViewUi/button/index",
5 | "i-message": "/components/iViewUi/message/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/pages/basicInfoEdition/basicInfoEdition.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 问卷标题
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 | 问卷副标题
19 |
20 |
21 |
22 |
25 |
26 |
27 |
28 |
29 |
30 | 保存上述设置
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/pages/basicInfoEdition/basicInfoEdition.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F5F6FA
3 | }
4 |
5 |
6 | .basic-info-edition-title {
7 | padding-left: 30rpx;
8 | padding-top: 40rpx;
9 | color: #86878B;
10 | font-size: 25rpx;
11 | }
12 |
13 | .title-input-container {
14 | padding-left: 30rpx;
15 | padding-top: 30rpx;
16 | padding-right: 30rpx;
17 | }
18 |
19 | .save-button-wrap {
20 | height: 10vh;
21 | padding-top: 10rpx;
22 | background-color: white;
23 | position: fixed;
24 | text-align: center;
25 | width: 100vw;
26 | bottom: 0;
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/pages/complete/childCmp/completeCard/completeCard.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | title: String,
4 | isRequired: Boolean,
5 | index: Number,
6 | type: String
7 | },
8 | data: {},
9 | methods: {}
10 | });
11 |
--------------------------------------------------------------------------------
/pages/complete/childCmp/completeCard/completeCard.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-tag": "/components/iViewUi/tag/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/pages/complete/childCmp/completeCard/completeCard.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
9 | {{common.getProblemTypeChineseName(type)}}
10 |
11 |
12 |
14 | 必填项
15 |
16 |
17 |
18 |
19 | {{(index + 1) + '. ' + title}}
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/pages/complete/childCmp/completeCard/completeCard.wxss:
--------------------------------------------------------------------------------
1 | .complete-card {
2 | background-color: white;
3 | }
4 |
5 |
6 | .complete-card-title {
7 |
8 | }
9 |
10 | .complete-card-wrap {
11 | padding: 24rpx;
12 | }
13 |
14 | .complete-card-problem-tag {
15 | padding-right: 16rpx;
16 | }
17 |
18 | .i-tags-2 {
19 | padding-left: 10rpx;
20 | }
--------------------------------------------------------------------------------
/pages/complete/complete.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "basic-info": "/components/basicInfo/basicInfo",
4 | "i-message": "/components/iViewUi/message/index",
5 | "i-input": "/components/iViewUi/input/index",
6 | "i-button": "/components/iViewUi/button/index",
7 | "complete-card": "childCmp/completeCard/completeCard",
8 | "i-radio-group": "/components/iViewUi/radio-group/index",
9 | "i-radio": "/components/iViewUi/radio/index",
10 | "i-rate": "/components/iViewUi/rate/index"
11 | }
12 | }
--------------------------------------------------------------------------------
/pages/complete/complete.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F5F6FA
3 | }
4 |
5 | .complete-top-info {
6 | padding-left: 30rpx;
7 | padding-top: 40rpx;
8 | color: #86878B;
9 | font-size: 25rpx;
10 | text-align: center;
11 | }
12 |
13 | .check-secret-input {
14 | padding-left: 30rpx;
15 | padding-right: 30rpx;
16 | padding-top: 30rpx;
17 | }
18 |
19 |
20 | .check-secret-button-wrap {
21 | padding-top: 30rpx;
22 | }
23 |
24 | .basic-info-container {
25 | padding-top: 30rpx;
26 | }
27 |
28 | .complete-card-items {
29 | padding-left: 30rpx;
30 | padding-right: 30rpx;
31 | padding-top: 30rpx;
32 | }
33 |
34 | .complete-card-items-single-select, .complete-card-items-multiply-select {
35 | padding-top: 20rpx;
36 | display: flex;
37 | flex-direction: column;
38 | }
39 |
40 | .complete-card-items-single-select-items, .complete-card-items-multiply-select-items {
41 | padding-top: 10rpx;
42 | padding-bottom: 10rpx;
43 | }
44 |
45 | .save-button-wrap {
46 | height: 10vh;
47 | padding-top: 10rpx;
48 | background-color: white;
49 | position: fixed;
50 | text-align: center;
51 | width: 100vw;
52 | bottom: 0;
53 | }
54 | .complete-form-container{
55 | padding-bottom: 13vh;
56 | }
--------------------------------------------------------------------------------
/pages/detailedAnalysis/detailedAnalysis.js:
--------------------------------------------------------------------------------
1 | import {AnalysisRequest} from "../../network/analysis";
2 |
3 |
4 | const app = getApp();
5 |
6 | // 处理填空题的页面
7 | Page({
8 | data: {
9 | resolution: {},
10 | tableColumnForBlankFill: [
11 | {
12 | name: "title",
13 | data: "序号",
14 | width: 400,
15 | default: "这个选项没有内容"
16 | },
17 | {
18 | name: "resolution",
19 | data: "填空内容",
20 | width: 300,
21 | default: "这个人啥都没填"
22 | }
23 | ],
24 | publishedResolution: []
25 | },
26 | onLoad: function (options) {
27 | console.log(options);
28 | let pid = options.pid;
29 | AnalysisRequest.getProblemAnalysisData(pid, app.globalData.token).then(res => {
30 | let publishedResolution = [];
31 | let detailResolution = res.data.problemResolution.resolution;
32 | let counter = 1;
33 | for (let i = 0; i < detailResolution.length; i++) {
34 | if (!detailResolution[i]) continue;
35 | publishedResolution.push({
36 | title: counter,
37 | resolution: detailResolution[i]
38 | });
39 | counter++;
40 | }
41 | this.setData({
42 | resolution: res.data.problemResolution,
43 | publishedResolution: publishedResolution
44 | })
45 | })
46 | }
47 | });
--------------------------------------------------------------------------------
/pages/detailedAnalysis/detailedAnalysis.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "my-table": "/components/my-table/my-table"
4 | }
5 | }
--------------------------------------------------------------------------------
/pages/detailedAnalysis/detailedAnalysis.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{resolution.title}}
4 |
5 |
6 |
7 |
8 | {{publishedResolution.length ? '*未填写这道题目的人会被自动过滤' : '这道题暂时没有人填写'}}
9 |
10 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/pages/detailedAnalysis/detailedAnalysis.wxss:
--------------------------------------------------------------------------------
1 | .problem-title {
2 | padding-top: 2vh;
3 | text-align: center;
4 | }
5 |
6 | .table-wrap{
7 | padding-top: 30px;
8 | width: 90vw;
9 | padding-left: 5vw;
10 | }
11 |
12 | .blank-fill-message{
13 | font-size: 28rpx;
14 | padding-bottom: 20px;
15 | color: #C0C0C0;
16 | }
--------------------------------------------------------------------------------
/pages/manage/childCmp/itemCard/itemCard.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | title: String,
4 | condition: Boolean
5 | },
6 | data: {},
7 | methods: {}
8 | });
9 |
--------------------------------------------------------------------------------
/pages/manage/childCmp/itemCard/itemCard.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-tag": "/components/iViewUi/tag/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/pages/manage/childCmp/itemCard/itemCard.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 | {{condition ? '发布中' : '未发布'}}
7 |
8 |
9 |
10 | {{title}}
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/pages/manage/childCmp/itemCard/itemCard.wxss:
--------------------------------------------------------------------------------
1 | .item-card {
2 | margin-top: 45rpx;
3 | height: 100rpx;
4 | width: 90vw;
5 | background-color: white;
6 | display: flex;
7 | align-items: center;
8 | }
9 |
10 | .item-card-condition-mark-tag {
11 | white-space: nowrap;
12 | }
13 |
14 | .item-card-condition-mark {
15 | padding-left: 20rpx;
16 | width: 30rpx;
17 | }
18 |
19 | .item-card-title {
20 | padding-left: 80rpx;
21 | flex: 1;
22 | font-size: 26rpx;
23 | }
24 |
25 | .item-card-tail {
26 | padding-top: 25rpx;
27 | width: 120rpx;
28 | }
--------------------------------------------------------------------------------
/pages/manage/manage.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "item-card": "/pages/manage/childCmp/itemCard/itemCard",
4 | "top-bar": "/components/topBar/topBar",
5 | "i-icon": "/components/iViewUi/icon/index",
6 | "i-action-sheet": "/components/iViewUi/action-sheet/index",
7 | "better-tab-bar": "/components/betterTabBar/betterTabBar",
8 | "i-message": "/components/iViewUi/message/index",
9 | "i-modal": "/components/iViewUi/modal/index",
10 | "i-button": "/components/iViewUi/button/index",
11 | "bottom-message": "/components/bottomMessage/bottomMessage"
12 | }
13 | }
--------------------------------------------------------------------------------
/pages/manage/manage.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | 是否{{activeQuestionnaire.condition ? "取消": ""}}发布?
8 |
9 |
10 |
11 |
12 |
13 |
18 |
19 |
20 |
21 |
22 |
27 |
29 |
30 |
31 |
32 |
33 |
34 |
40 |
41 |
42 | {{activeQuestionnaire.title}}
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/pages/manage/manage.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F5F6FA
3 | }
4 |
5 |
6 | .menu-icon-button {
7 | color: white;
8 | margin: 0;
9 | padding: 0;
10 | }
11 |
12 | .menu-icon-button-hover {
13 | background-color: #F5F6FA;
14 | }
15 |
16 | #item-card-wrap {
17 | display: flex;
18 | align-items: center;
19 | flex-direction: column;
20 | }
21 |
22 | .action-sheet-in-manage {
23 | background-color: white;
24 | }
25 |
26 |
27 | .manage {
28 | padding-bottom: 5vh;
29 | }
--------------------------------------------------------------------------------
/pages/problemEdition/childCmp/optionCard/optionCard.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | title: String,
4 | onlyShowTitle: Boolean
5 | },
6 | data: {},
7 | methods: {}
8 | });
9 |
--------------------------------------------------------------------------------
/pages/problemEdition/childCmp/optionCard/optionCard.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-icon": "/components/iViewUi/icon/index",
5 | "base-card": "/components/baseCard/baseCard",
6 | "i-input": "/components/iViewUi/input/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/problemEdition/childCmp/optionCard/optionCard.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/pages/problemEdition/childCmp/optionCard/optionCard.wxss:
--------------------------------------------------------------------------------
1 | .option-head-icon-wrap{
2 | padding-left: 15rpx;
3 | padding-top: 20rpx;
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/pages/problemEdition/problemEdition.js:
--------------------------------------------------------------------------------
1 | import {QuestionnaireRequest} from "../../network/questionnaire";
2 | import {ProblemModel} from "../../models/problemModel";
3 | import {MessageBox} from "../../utils/messageBox";
4 |
5 | const app = getApp();
6 |
7 |
8 | Page({
9 | data: {
10 | problem: {},
11 | confirmDeleteVisiable: false,
12 | confirmDeleteAction: [
13 | {
14 | name: '取消'
15 | },
16 | {
17 | name: '删除',
18 | color: '#ed3f14',
19 | loading: false
20 | }
21 | ]
22 | },
23 | onLoad(options) {
24 | console.log(options);
25 | QuestionnaireRequest.getOneProblem(options.pid, app.globalData.token)
26 | .then(res => {
27 | let p = new ProblemModel(res.data);
28 | this.setData({
29 | problem: p
30 | })
31 | })
32 | .catch(() => {
33 | MessageBox.handleError({
34 | message: "抱歉 问题数据获取失败 三秒后将返回"
35 | });
36 | setTimeout(() => {
37 | wx.navigateBack();
38 | }, 3000)
39 | })
40 | },
41 | titleChange(event) {
42 | this.setData({
43 | ['problem.title']: event.detail.detail.value
44 | });
45 | },
46 | addOneOption() {
47 | let p = this.data.problem;
48 | p.options.push({
49 | title: "请为这个选项添加一个标题",
50 | optionId: new Date().getTime()
51 | });
52 | this.setData({
53 | problem: p
54 | })
55 | },
56 | isRequireChange() {
57 | this.setData({
58 | ['problem.isRequire']: !this.data.problem.isRequire
59 | })
60 | },
61 |
62 |
63 | deleteProblem() {
64 | this.setData({
65 | confirmDeleteVisiable: true
66 | });
67 |
68 |
69 | },
70 | handleClick(event) {
71 | this.setData({
72 | confirmDeleteVisiable: false
73 | });
74 | let res = event.detail.index;
75 | if (res) {
76 | this.gotoDeleteProblem();
77 | }
78 | },
79 |
80 | gotoDeleteProblem() {
81 | let pid = this.data.problem.problemId;
82 | console.log(this.data.problem);
83 | console.log(pid);
84 | QuestionnaireRequest.deleteOneProblem(pid, app.globalData.token)
85 | .then(() => {
86 | wx.navigateBack();
87 | })
88 | .catch(err => {
89 | console.log(err);
90 | })
91 | },
92 |
93 | saveProblemEdition() {
94 | QuestionnaireRequest.editOneProblem(this.data.problem, app.globalData.token)
95 | .then(() => {
96 | wx.navigateBack();
97 | })
98 | .catch(err => {
99 | console.log(err);
100 | })
101 | }
102 | });
--------------------------------------------------------------------------------
/pages/problemEdition/problemEdition.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "i-input": "/components/iViewUi/input/index",
4 | "i-button": "/components/iViewUi/button/index",
5 | "i-icon": "/components/iViewUi/icon/index",
6 | "i-modal": "/components/iViewUi/modal/index",
7 | "option-card": "/pages/problemEdition/childCmp/optionCard/optionCard",
8 | "base-card": "/components/baseCard/baseCard"
9 | }
10 | }
--------------------------------------------------------------------------------
/pages/problemEdition/problemEdition.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 标题
6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
16 | 选项
17 |
18 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
29 | + 添加选项
30 |
31 |
32 |
33 | 设置
34 |
35 |
36 |
37 |
38 |
39 |
40 | 设为必填项
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | 删除这道题目
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | 点击删除
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | 保存上述设置
69 |
70 |
71 |
72 |
73 |
77 | 删除后无法恢复哦
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/pages/problemEdition/problemEdition.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F5F6FA
3 | }
4 |
5 | .questionnaire-title {
6 | padding-left: 30rpx;
7 | padding-top: 30rpx;
8 | color: #86878B;
9 | font-size: 25rpx;
10 | }
11 |
12 | .problem-title-container {
13 | padding-left: 30rpx;
14 | padding-top: 30rpx;
15 | padding-right: 30rpx;
16 | }
17 |
18 | .options-container {
19 | padding-top: 20rpx;
20 | }
21 |
22 | .add-one-option-tag {
23 | text-align: center;
24 | color: #368DFF;
25 | }
26 |
27 | .setting-text {
28 | padding-left: 20rpx;
29 | font-size: 30rpx;
30 | }
31 |
32 | .setting-container {
33 | padding-top: 30rpx;
34 | }
35 |
36 | .save-button-wrap {
37 | height: 10vh;
38 | padding-top: 10rpx;
39 | background-color: white;
40 | position: fixed;
41 | text-align: center;
42 | width: 100vw;
43 | bottom: 0;
44 | }
45 |
46 | .problem-edition-head{
47 | padding-bottom: 12vh;
48 | }
--------------------------------------------------------------------------------
/pages/profile/profile.js:
--------------------------------------------------------------------------------
1 | // pages/profile/profile.js
2 |
3 | const app = getApp();
4 |
5 |
6 | Page({
7 | data: {
8 | userInfo: {}
9 | },
10 |
11 | onLoad: function () {
12 | // 隐藏小房子
13 | wx.hideHomeButton();
14 |
15 | // 拉取个人信息
16 | this.setData({
17 | userInfo: app.globalData.userInfo
18 | });
19 | },
20 |
21 | });
--------------------------------------------------------------------------------
/pages/profile/profile.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "better-tab-bar": "/components/betterTabBar/betterTabBar"
4 | }
5 | }
--------------------------------------------------------------------------------
/pages/profile/profile.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 | {{userInfo.nickName}}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/pages/profile/profile.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F5F6FA
3 | }
4 |
5 | .userinfo-avatar {
6 | width: 100rpx;
7 | height: 100rpx;
8 | margin: 20rpx;
9 | border-radius: 50%;
10 | }
11 |
12 | #userInfo{
13 | padding-left: 20rpx;
14 | display: flex;
15 | padding-top: 30rpx;
16 | }
17 |
18 | #userInfo-nickname{
19 | display: flex;
20 | flex-direction: column;
21 | justify-content: center;
22 | }
--------------------------------------------------------------------------------
/pages/questionnaire/childCmp/problemCard/problemCard.js:
--------------------------------------------------------------------------------
1 | Component({
2 | properties: {
3 | problem: Object,
4 | number: Number,
5 | onlyShowTitle: Boolean
6 | },
7 | data: {},
8 | methods: {
9 | gotoEditPrblem() {
10 | let pid = this.properties.problem.problemId;
11 | wx.navigateTo({
12 | url: `/pages/problemEdition/problemEdition?pid=${pid}`
13 | });
14 | }
15 | },
16 | options: {
17 | multipleSlots: true
18 | },
19 | });
20 |
--------------------------------------------------------------------------------
/pages/questionnaire/childCmp/problemCard/problemCard.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "i-icon": "/components/iViewUi/icon/index",
5 | "base-card": "/components/baseCard/baseCard",
6 | "i-tag": "/components/iViewUi/tag/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/pages/questionnaire/childCmp/problemCard/problemCard.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 | {{common.getProblemTypeChineseName(problem.type)}}
8 |
9 |
10 |
11 |
12 | {{onlyShowTitle ? '' : number + 1 + '. '+ problem.title}}
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/pages/questionnaire/childCmp/problemCard/problemCard.wxss:
--------------------------------------------------------------------------------
1 | .problem-card {
2 | background-color: white;
3 | /* 和上方文字对齐*/
4 | margin-left: 30rpx;
5 | margin-right: 30rpx;
6 | }
7 |
8 | .problem-card-items {
9 | display: flex;
10 | padding: 25rpx;
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/pages/questionnaire/questionnaire.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "basic-info": "../../components/basicInfo/basicInfo",
4 | "problem-card": "childCmp/problemCard/problemCard",
5 | "i-icon": "/components/iViewUi/icon/index",
6 | "i-action-sheet": "/components/iViewUi/action-sheet/index",
7 | "i-message": "/components/iViewUi/message/index",
8 | "i-tag": "/components/iViewUi/tag/index"
9 | }
10 | }
--------------------------------------------------------------------------------
/pages/questionnaire/questionnaire.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 标题与描述
5 |
6 |
7 |
11 |
12 |
13 |
14 | 问题
15 |
16 |
17 |
18 |
20 |
21 |
22 | {{common.getProblemTypeChineseName(item.type)}}
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | + 添加一个问题
34 |
35 |
36 |
37 |
38 |
39 |
40 |
45 |
46 | 请选择你要添加题目的类型
47 |
48 |
49 |
--------------------------------------------------------------------------------
/pages/questionnaire/questionnaire.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F5F6FA
3 | }
4 |
5 | .questionnaire-title {
6 | padding-left: 30rpx;
7 | padding-top: 30rpx;
8 | color: #86878B;
9 | font-size: 25rpx;
10 | }
11 |
12 | .basic-info-container {
13 | padding-top: 30rpx;
14 | }
15 |
16 | .problems-container {
17 | padding-top: 30rpx;
18 | }
19 |
20 | .add-problem-message {
21 | text-align: center;
22 | display: flex;
23 | flex-direction: column;
24 | justify-content: center;
25 | }
26 |
27 | .add-problem-message-text {
28 | height: 50rpx;
29 | font-size: 30rpx;
30 | color: #368DFF;
31 | }
32 |
33 | .problems-container-items {
34 | padding-top: 4rpx;
35 | }
36 |
37 | .problems-container-add-problem {
38 | padding-top: 4rpx;
39 | }
--------------------------------------------------------------------------------
/pages/success/success.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {},
3 | gotoHome() {
4 | wx.redirectTo({
5 | url: "/pages/manage/manage"
6 | })
7 | }
8 | });
--------------------------------------------------------------------------------
/pages/success/success.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | }
4 | }
--------------------------------------------------------------------------------
/pages/success/success.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 提交成功啦~感谢您的参与 Thanks♪(・ω・)ノ
4 |
5 |
10 |
11 |
12 |
13 | coderyzl
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/pages/success/success.wxss:
--------------------------------------------------------------------------------
1 | .success-title {
2 | text-align: center;
3 | padding-top: 10vh;
4 | font-size: 50rpx;
5 | }
6 |
7 | .github-img {
8 | width: 50rpx;
9 | height: 50rpx;
10 | }
11 |
12 |
13 | .github-img-wrap {
14 | position: fixed;
15 | bottom: 3vh;
16 | left: 0;
17 | right: 0;
18 | font-size: 38rpx;
19 | }
20 |
21 | .back-button{
22 | margin-top: 10vh;
23 | width: 60vw;
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "enhance": true,
10 | "postcss": true,
11 | "minified": true,
12 | "newFeature": true,
13 | "coverView": true,
14 | "autoAudits": false,
15 | "showShadowRootInWxmlPanel": true,
16 | "scopeDataCheck": false,
17 | "checkInvalidKey": true,
18 | "checkSiteMap": true,
19 | "uploadWithSourceMap": true,
20 | "babelSetting": {
21 | "ignore": [],
22 | "disablePlugins": [],
23 | "outputPath": ""
24 | }
25 | },
26 | "compileType": "miniprogram",
27 | "libVersion": "2.10.3",
28 | "appid": "wx5f4796ed0742846d",
29 | "projectname": "EasyQuestionnaire-MiniProgram",
30 | "debugOptions": {
31 | "hidedInDevtools": []
32 | },
33 | "isGameTourist": false,
34 | "simulatorType": "wechat",
35 | "simulatorPluginLibVersion": {},
36 | "condition": {
37 | "search": {
38 | "current": -1,
39 | "list": []
40 | },
41 | "conversation": {
42 | "current": -1,
43 | "list": []
44 | },
45 | "plugin": {
46 | "current": -1,
47 | "list": []
48 | },
49 | "game": {
50 | "currentL": -1,
51 | "list": []
52 | },
53 | "gamePlugin": {
54 | "current": -1,
55 | "list": []
56 | },
57 | "miniprogram": {
58 | "current": -1,
59 | "list": [
60 | {
61 | "id": -1,
62 | "name": "pages/profile/profile",
63 | "pathName": "pages/profile/profile",
64 | "query": "",
65 | "scene": null
66 | },
67 | {
68 | "id": 1,
69 | "name": "pages/complete/complete",
70 | "pathName": "pages/complete/complete",
71 | "query": "qid=15840024747252362",
72 | "scene": null
73 | },
74 | {
75 | "id": -1,
76 | "name": "pages/success/success",
77 | "pathName": "pages/success/success",
78 | "query": "",
79 | "scene": null
80 | },
81 | {
82 | "id": 3,
83 | "name": "pages/analysis/analysis",
84 | "pathName": "pages/analysis/analysis",
85 | "query": "qid=15840024747252362",
86 | "scene": null
87 | },
88 | {
89 | "id": 4,
90 | "name": "pages/detailAnalysis/detailedAnalysis",
91 | "pathName": "pages/detailedAnalysis/detailedAnalysis",
92 | "query": "pid=15840024764976294",
93 | "scene": null
94 | }
95 | ]
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/utils/messageBox.js:
--------------------------------------------------------------------------------
1 | import {$Message} from '../components/iViewUi/base/index'
2 |
3 | class MessageBox {
4 | static handleDefault({message, duration}) {
5 | $Message({
6 | content: message,
7 | duration: duration || 2,
8 | });
9 | }
10 |
11 | static handleSuccess({message, duration}) {
12 | $Message({
13 | content: message,
14 | type: 'success',
15 | duration: duration || 2,
16 | });
17 | }
18 |
19 | static handleWarning({message, duration}) {
20 | $Message({
21 | content: message,
22 | type: 'warning',
23 | duration: duration || 2,
24 | });
25 | }
26 |
27 | static handleError({message, duration}) {
28 | $Message({
29 | content: message,
30 | type: 'error',
31 | duration: duration || 2,
32 | });
33 | }
34 | }
35 |
36 | export {
37 | MessageBox
38 | }
--------------------------------------------------------------------------------
/utils/timeHelper.js:
--------------------------------------------------------------------------------
1 | class TimeHelper {
2 | static GMTtoDate(time) {
3 | let date = new Date(time);
4 | return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
5 | }
6 |
7 | static GMTtoTime(time) {
8 | let date = new Date(time);
9 | return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
10 | }
11 | }
12 |
13 | export {
14 | TimeHelper
15 | }
--------------------------------------------------------------------------------
/wxs/common.wxs:
--------------------------------------------------------------------------------
1 | function getProblemTypeChineseName(type) {
2 | var problemTypeChineseNameMap = {
3 | "SINGLE_SELECT": "单选题",
4 | "MULTIPLY_SELECT": "多选题",
5 | "BLANK_FILL": "填空题",
6 | "DROP_DOWN": "下拉题",
7 | "SCORE": "评价题"
8 | };
9 | return problemTypeChineseNameMap[type];
10 | }
11 |
12 | // 适配饼图
13 | function getDataDict(resolutions) {
14 | var list = [];
15 | for (var i = 0; i < resolutions.length; i++) {
16 | if (!resolutions[i].resolution) continue;
17 | list.push({
18 | value: resolutions[i].resolution,
19 | name: resolutions[i].title
20 | })
21 | }
22 | return list
23 | }
24 |
25 |
26 | function isShowOptions(type) {
27 | return type === 'SINGLE_SELECT' || type === 'MULTIPLY_SELECT' || type === 'DROP_DOWN';
28 | }
29 |
30 | module.exports = {
31 | getProblemTypeChineseName: getProblemTypeChineseName,
32 | isShowOptions: isShowOptions,
33 | getDataDict: getDataDict
34 | };
--------------------------------------------------------------------------------