123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- //logs.js
- // const util = require('../../utils/util.js')
- // const app = require('../../utils/util.js');
- Page({
- data: {
- showSelect: false, //多选的问题
- manyi: [{
- id: 1,
- name: '不满意'
- }, {
- id: 2,
- name: '一般'
- }, {
- id: 3,
- name: '满意'
- }],
- checkboxArr: [{
- checked: false,
- id: "1",
- name: "通俗易懂",
- },
- {
- checked: false,
- id: "2",
- name: "准点时间",
- },
- {
- checked: false,
- id: "3",
- name: "礼貌友好",
- },
- {
- checked: false,
- id: "4",
- name: "携带工具",
- },
- {
- checked: false,
- id: "5",
- name: "认真",
- },
- {
- checked: false,
- id: "6",
- name: "很专心",
- },
- {
- checked: false,
- id: "7",
- name: "积极向上",
- },
- {
- checked: false,
- id: "8",
- name: "完成服务培训标准",
- },
- ],
- remarks: [],
- arr: [],
- },
- parameterTap(e) {
- var that = this
- var this_checked = e.currentTarget.dataset.id
- var parameterList = this.data.manyi
- for (var i = 0; i < parameterList.length; i++) {
- if (parameterList[i].id == this_checked) {
- parameterList[i].checked = true;
- } else {
- parameterList[i].checked = false;
- }
- }
- that.setData({
- manyi: parameterList
- })
- },
- // checkboxChange(e) {
- // console.log('checkbox发生change事件,携带value值为:', e.detail.value)
- // const items = this.data.checkboxArr
- // const values = e.detail.value
- // this.setData({
- // remarks: values
- // })
- // for (let i = 0, lenI = items.length; i < lenI; ++i) {
- // items[i].checked = false
- // for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
- // if (items[i].name === values[j]) {
- // items[i].checked = true
- // this.setData({
- // showSelect:true
- // })
- // console.log(this.data.showSelect, "55555");
- // break
- // }
- // }
- // }
- // this.setData({
- // items
- // })
- // },
- checkboxChange: function (event) {
- console.log(event, "000000000000000000000");
- for (var i = 0; i < this.data.checkboxArr.length; i++) {
- if (event.currentTarget.id == this.data.checkboxArr[i].id) {
- if (this.data.checkboxArr[i].checked == true) {
- this.data.arr.pop(this.data.checkboxArr[i].name);
- console.log("8588888888888888");
- this.data.checkboxArr[i].checked = false;
- var checkboxArr = this.data.checkboxArr;
- this.setData({
- checkboxArr,
- remarks: this.data.arr
- })
- } else {
- this.data.arr.push(this.data.checkboxArr[i].name);
- this.data.checkboxArr[i].checked = true;
- var checkboxArr = this.data.checkboxArr;
- this.setData({
- checkboxArr,
- remarks: this.data.arr
- }),
- console.log(this.data.remarks, "333333333333333333");
- }
- }
- }
- },
- formSubmit(e) {
- console.log("提交评价");
- console.log(this.data.remarks);
- let pingjia = ''
- this.data.manyi.forEach(item => {
- if (item.checked) {
- pingjia = item.name;
- }
- })
- console.log(pingjia,"11111");
-
- },
- onLoad: function () {
- }
- })
|