作者 lihongjuan

注意力测试

正在显示 74 个修改的文件 包含 4241 行增加0 行删除
  1 +//app.js
  2 +App({
  3 + onLaunch: function () {
  4 + // 展示本地存储能力
  5 + var logs = wx.getStorageSync('logs') || []
  6 + logs.unshift(Date.now())
  7 + wx.setStorageSync('logs', logs)
  8 +
  9 + // 登录
  10 + wx.login({
  11 + success: res => {
  12 + // 发送 res.code 到后台换取 openId, sessionKey, unionId
  13 + }
  14 + })
  15 + // 获取用户信息
  16 + wx.getSetting({
  17 + success: res => {
  18 + if (res.authSetting['scope.userInfo']) {
  19 + // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
  20 + wx.getUserInfo({
  21 + success: res => {
  22 + // 可以将 res 发送给后台解码出 unionId
  23 + this.globalData.userInfo = res.userInfo
  24 +
  25 + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  26 + // 所以此处加入 callback 以防止这种情况
  27 + if (this.userInfoReadyCallback) {
  28 + this.userInfoReadyCallback(res)
  29 + }
  30 + }
  31 + })
  32 + }
  33 + }
  34 + })
  35 + },
  36 +
  37 +
  38 + post: function (url, data, headerParams) {
  39 + wx.showNavigationBarLoading()
  40 + var promise = new Promise((resolve, reject) => {
  41 + //init
  42 + let that = this;
  43 + let postData = data;
  44 + let baseUrl = 'https://attention.w.bronet.cn/api/';
  45 + //网络请求
  46 + let header = {
  47 + // 'XX-Device-Type': 'wxapp',
  48 + 'token': wx.getStorageSync("token") || ''
  49 + }
  50 + header = Object.assign(header, headerParams)
  51 + //网络请求
  52 + wx.request({
  53 + url: baseUrl + url,
  54 + data: postData,
  55 + method: headerParams,
  56 + header: header,
  57 + success: function (res) { //返回取得的数据
  58 + if (res.data.code == '1') {
  59 + resolve(res.data.data);
  60 + } else if (res.data.code == '201') {
  61 + resolve(res.data);
  62 + } else {
  63 + // wx.showToast({
  64 + // title: res.data.msg,
  65 + // duration: 1200,
  66 + // icon: 'none'
  67 + // })
  68 + reject(res)
  69 + }
  70 +
  71 + // else if (res.data.code == '42002') {
  72 +
  73 + // }
  74 + // setTimeout(function () {
  75 +
  76 + // wx.hideNavigationBarLoading()
  77 + // }, 600)
  78 + },
  79 + fail: function (e) {
  80 + reject('网络出错');
  81 + // wx.hideLoading()
  82 + wx.hideNavigationBarLoading()
  83 + },
  84 + complete: function () {
  85 + wx.hideNavigationBarLoading()
  86 + },
  87 + })
  88 + });
  89 + return promise;
  90 + },
  91 + globalData: {
  92 + userInfo: null
  93 + }
  94 +})
  1 +{
  2 + "pages": [
  3 + "pages/homepage/homepage",
  4 + "pages/attentionone/attentionone",
  5 + "pages/attentiontwo/attentiontwo",
  6 +
  7 + "pages/parentping/parentping",
  8 + "pages/question/question",
  9 +
  10 +
  11 +
  12 +
  13 +
  14 +
  15 + "pages/aboutdanke/aboutdanke",
  16 +
  17 + "pages/index/index",
  18 + "pages/logs/logs"
  19 +
  20 + ],
  21 + "window": {
  22 + "backgroundTextStyle": "light",
  23 + "navigationBarBackgroundColor": "#fff",
  24 + "navigationBarTitleText": "",
  25 + "navigationBarTextStyle": "black"
  26 + },
  27 + "sitemapLocation": "sitemap.json"
  28 +}
  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 +}

549 字节

248.9 KB

490 字节

770 字节

765 字节

1015 字节

1021 字节

1007 字节

972 字节

  1 +// pages/aboutdanke/aboutdanke.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + commonnum:'陶姐TAO'
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 +
  16 + },
  17 +
  18 + // copy(){
  19 + // let that=this;
  20 + // wx.setClipboardData({
  21 + // data: that.data.commonnum,
  22 + // success: function (res) {
  23 + // wx.showToast({
  24 + // title: '复制成功',
  25 + // });
  26 + // }
  27 + // });
  28 +
  29 +
  30 + // },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面初次渲染完成
  34 + */
  35 + onReady: function () {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面显示
  41 + */
  42 + onShow: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 生命周期函数--监听页面隐藏
  48 + */
  49 + onHide: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 生命周期函数--监听页面卸载
  55 + */
  56 + onUnload: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 页面相关事件处理函数--监听用户下拉动作
  62 + */
  63 + onPullDownRefresh: function () {
  64 +
  65 + },
  66 +
  67 + /**
  68 + * 页面上拉触底事件的处理函数
  69 + */
  70 + onReachBottom: function () {
  71 +
  72 + },
  73 +
  74 + /**
  75 + * 用户点击右上角分享
  76 + */
  77 + onShareAppMessage: function () {
  78 +
  79 + }
  80 +})
  1 +{
  2 + "navigationBarTitleText": "关于蛋壳"
  3 +}
  1 +<view class="dankepage">
  2 + <image src="/img/aboutdanke.png" mode="widthFix"></image>
  3 +
  4 +
  5 +
  6 + <view class="dankepageox">
  7 + <view class="dankepageboxitem">
  8 + <view class="dankepageboxitemleft">
  9 + <image src="/img/gongzhong.png"></image>
  10 + </view>
  11 +
  12 + <view class="danlepageboxitemright" bindlongtap='copy' data-word="{{commonnum}}">
  13 + <text selectable='true'> 关注陶姐公众号:{{commonnum}}</text>
  14 + </view>
  15 + </view>
  16 + <view class="dankepageboxitem">
  17 + <view class="dankepageboxitemleft">
  18 + <image src="/img/weixin.png"></image>
  19 + </view>
  20 +
  21 + <view class="danlepageboxitemright">
  22 + <text selectable='true'> 添加陶姐微信: taoma817</text>
  23 + </view>
  24 + </view>
  25 + <view class="dankepageboxitem">
  26 + <view class="dankepageboxitemleft">
  27 + <image src="/img/douyin.png"></image>
  28 + </view>
  29 +
  30 + <view class="danlepageboxitemright">
  31 + <text selectable='true'>关注抖音账号:苏州小小蛋壳</text>
  32 + </view>
  33 + </view>
  34 + <view class="dankepageboxitem">
  35 + <view class="dankepageboxitemleft">
  36 + <image src="/img/taobao.png"></image>
  37 + </view>
  38 +
  39 + <view class="danlepageboxitemright">
  40 + <text selectable='true'>搜索淘宝店铺:小蛋壳育儿</text>
  41 + </view>
  42 + </view>
  43 + </view>
  44 +</view>
  1 +page{
  2 + width:750rpx;
  3 + height:100%;
  4 + overflow-y: hidden;
  5 +}
  6 +.dankepage{
  7 + width:100%;
  8 + height:1224rpx;
  9 + position: relative;
  10 + overflow: hidden;
  11 +}
  12 +.dankepage image{
  13 + width:100%;
  14 + height:100%;
  15 +}
  16 +.dankepageboxitem{
  17 + display:flex;
  18 + align-items: center;
  19 + width:359rpx;
  20 + border-bottom:1rpx solid #7D7D7D;
  21 + padding: 5rpx 0;
  22 + box-sizing: border-box;
  23 +
  24 +}
  25 +.dankepageboxitemleft{
  26 + width:30rpx;
  27 + height:30rpx;
  28 + font-size: 0
  29 +}
  30 +.danlepageboxitemright{
  31 + color:#313131;
  32 + font-size: 24rpx;
  33 + font-weight: bold;
  34 + margin-left:10rpx;
  35 +}
  36 +.dankepageox{
  37 + position: absolute;
  38 + bottom:306rpx;
  39 + left:21rpx;
  40 + border-top:1rpx solid #7D7D7D
  41 +
  42 +}
  1 +// pages/attentionone/attentionone.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + maskHidden: false,
  10 + id: '',
  11 + description: '',
  12 + qrcode: '',
  13 + rings: ''
  14 + },
  15 +
  16 + /**
  17 + * 生命周期函数--监听页面加载
  18 + */
  19 + onLoad: function(options) {
  20 + this.setData({
  21 + id: options.id,
  22 + title:""
  23 + })
  24 +
  25 + this.getresult()
  26 +
  27 + },
  28 +
  29 + // 获取结果
  30 + getresult() {
  31 + let that = this;
  32 + var url = 'index/answer_log_detail';
  33 + var params = {
  34 + answer_log_id: that.data.id,
  35 +
  36 + }
  37 + app.post(url, params).then((res) => {
  38 + console.log(res);
  39 + that.setData({
  40 +
  41 + description: res.description,
  42 + qrcode: res.qrcode,
  43 + rings: res.rings,
  44 + title:res.title
  45 +
  46 + })
  47 +
  48 + that.savefilecode()
  49 +
  50 +
  51 + }).catch((err) => {
  52 +
  53 + })
  54 + },
  55 +
  56 + createNewImg: function() {
  57 + var that = this;
  58 + console.log(9999)
  59 + var context = wx.createCanvasContext('mycanvas');
  60 + // var img = '/img/no.png';
  61 +
  62 + // context.createPattern(img, 0, 0, 375, 667)
  63 + // context.style.background ='/img/tuijianimg1.png'
  64 + // context.setFillStyle("#ffe200");
  65 + context.fillRect(0, 0, 375, 603);
  66 + var path = "/img/attentionsevenone.png";
  67 + context.drawImage(path, 0, 0, 375, 603);
  68 + // context.drawImage(path, 0, 0, 680, 300);
  69 +
  70 + var path2 = that.data.qrcode;
  71 + context.drawImage(path2, 10, 540, 55, 55);
  72 +
  73 + context.setFontSize(20);
  74 + context.setFillStyle('#CE6198');
  75 + context.setTextAlign('center');
  76 + context.fillText(that.data.title, 185, 120);
  77 +
  78 +
  79 + context.setFontSize(16);
  80 + context.setFillStyle('#CE6198');
  81 + context.setTextAlign('center');
  82 +
  83 + var str = that.data.description;
  84 + var x = 145;
  85 + var len = Math.ceil(str.length / 12);
  86 + for (var i = 0; i < len; i++) {
  87 + var j = i * 12;
  88 + var strs = str.substring(j, 12 * (i + 1));
  89 + context.fillText(strs, 180, x + 22 * i, 900);
  90 + }
  91 +
  92 + context.setFontSize(12);
  93 + context.setFillStyle('#EA595D');
  94 + context.setTextAlign('center');
  95 + context.fillText(that.data.rings[6].sort_name, 140, 220);
  96 + context.setFontSize(12);
  97 + context.setFillStyle('#EA595D');
  98 + context.setTextAlign('center');
  99 + context.fillText(that.data.rings[6].percent, 142, 235);
  100 +
  101 + context.setFontSize(12);
  102 + context.setFillStyle('#fff');
  103 + context.setTextAlign('center');
  104 +
  105 + var str = that.data.rings[6].description;
  106 + var x = 260;
  107 + var len = Math.ceil(str.length /4);
  108 + for (var i = 0; i < len; i++) {
  109 + var j = i * 4;
  110 + var strs = str.substring(j, 5 * (i + 1));
  111 + context.fillText(strs, 150, x + 22 * i, 2000);
  112 + }
  113 +
  114 + context.setFontSize(12);
  115 + context.setFillStyle('#CE6198');
  116 + context.setTextAlign('center');
  117 + context.fillText(that.data.rings[5].sort_name, 240, 216);
  118 +
  119 + context.setFontSize(12);
  120 + context.setFillStyle('#CE6198');
  121 + context.setTextAlign('center');
  122 + context.fillText(that.data.rings[5].percent, 242, 232);
  123 +
  124 +
  125 +
  126 + context.setFontSize(12);
  127 + context.setFillStyle('#fff');
  128 + context.setTextAlign('center');
  129 +
  130 + var str = that.data.rings[5].description;
  131 + var x = 260;
  132 + var len = Math.ceil(str.length / 5);
  133 + for (var i = 0; i < len; i++) {
  134 + var j = i * 5;
  135 + var strs = str.substring(j, 5 * (i + 1));
  136 + context.fillText(strs, 235, x + 22 * i, 2000);
  137 + }
  138 +
  139 +
  140 + context.setFontSize(12);
  141 + context.setFillStyle('#F49E15');
  142 + context.setTextAlign('center');
  143 + context.fillText(that.data.rings[0].sort_name, 70, 295);
  144 +
  145 + context.setFontSize(12);
  146 + context.setFillStyle('#F49E15');
  147 + context.setTextAlign('center');
  148 + context.fillText(that.data.rings[0].percent, 72, 310);
  149 +
  150 + context.setFontSize(12);
  151 + context.setFillStyle('#fff');
  152 + context.setTextAlign('center');
  153 +
  154 + var str = that.data.rings[0].description;
  155 + var x = 340;
  156 + var len = Math.ceil(str.length / 5);
  157 + for (var i = 0; i < len; i++) {
  158 + var j = i * 5;
  159 + var strs = str.substring(j, 5 * (i + 1));
  160 + context.fillText(strs, 95, x + 22 * i, 2000);
  161 + }
  162 +
  163 + context.setFontSize(12);
  164 + context.setFillStyle('#898989');
  165 + context.setTextAlign('center');
  166 + context.fillText(that.data.rings[1].sort_name, 68, 460);
  167 + context.setFontSize(12);
  168 + context.setFillStyle('#898989');
  169 + context.setTextAlign('center');
  170 + context.fillText(that.data.rings[1].percent, 70, 475);
  171 +
  172 + context.setFontSize(12);
  173 + context.setFillStyle('#fff');
  174 + context.setTextAlign('center');
  175 +
  176 + var str = that.data.rings[1].description;
  177 + var x = 396;
  178 + var len = Math.ceil(str.length / 5);
  179 + for (var i = 0; i < len; i++) {
  180 + var j = i * 5;
  181 + var strs = str.substring(j, 5 * (i + 1));
  182 + context.fillText(strs, 110, x + 18 * i, 2000);
  183 + }
  184 +
  185 + context.setFontSize(12);
  186 + context.setFillStyle('#1BB4A5');
  187 + context.setTextAlign('center');
  188 + context.fillText(that.data.rings[2].sort_name, 190, 489);
  189 +
  190 + context.setFontSize(12);
  191 + context.setFillStyle('#1BB4A5');
  192 + context.setTextAlign('center');
  193 + context.fillText(that.data.rings[2].percent, 192, 505);
  194 +
  195 + context.setFontSize(12);
  196 + context.setFillStyle('#fff');
  197 + context.setTextAlign('center');
  198 +
  199 + var str = that.data.rings[2].description;
  200 + var x = 400;
  201 + var len = Math.ceil(str.length / 4);
  202 + for (var i = 0; i < len; i++) {
  203 + var j = i * 4;
  204 + var strs = str.substring(j, 4 * (i + 1));
  205 + context.fillText(strs, 190, x + 22 * i, 2000);
  206 + }
  207 +
  208 +
  209 + context.setFontSize(12);
  210 + context.setFillStyle('#1A97D0');
  211 + context.setTextAlign('center');
  212 + context.fillText(that.data.rings[3].sort_name, 306, 459);
  213 + context.setFontSize(14);
  214 + context.setFillStyle('#1A97D0');
  215 + context.setTextAlign('center');
  216 + context.fillText(that.data.rings[3].percent, 308, 474);
  217 +
  218 + context.setFontSize(12);
  219 + context.setFillStyle('#fff');
  220 + context.setTextAlign('center');
  221 +
  222 + var str = that.data.rings[3].description;
  223 + var x = 395;
  224 + var len = Math.ceil(str.length / 5);
  225 + for (var i = 0; i < len; i++) {
  226 + var j = i * 5;
  227 + var strs = str.substring(j, 5 * (i + 1));
  228 + context.fillText(strs, 265, x + 22 * i, 2000);
  229 + }
  230 +
  231 +
  232 + context.setFontSize(12);
  233 + context.setFillStyle('#A6639E');
  234 + context.setTextAlign('center');
  235 + context.fillText('听觉转移', 308, 298);
  236 + context.setFontSize(12);
  237 + context.setFillStyle('#A6639E');
  238 + context.setTextAlign('center');
  239 + context.fillText('25%', 312, 312);
  240 +
  241 + context.setFontSize(12);
  242 + context.setFillStyle('#fff');
  243 + context.setTextAlign('center');
  244 +
  245 + var str = '听见,是我最大的努力';
  246 + var x = 338;
  247 + var len = Math.ceil(str.length / 5);
  248 + for (var i = 0; i < len; i++) {
  249 + var j = i * 5;
  250 + var strs = str.substring(j, 5 * (i + 1));
  251 + context.fillText(strs, 270, x + 22 * i, 2000);
  252 + }
  253 +
  254 +
  255 +
  256 +
  257 +
  258 + // var path2 = that.data.codeurl;
  259 + // console.log('888777666554433', path2)
  260 + // var path3 = "/img/feihuiyuan.png";
  261 + // var path4 = "/img/dali.png";
  262 + // var path5 = "/img/tiyanactive.png";
  263 +
  264 + // this.drawCircular(context, 96, 96, this.data.imgwidth * 0.7, this.data.imgheight * 0.7, path2);
  265 +
  266 + context.save(); // 保存当前context的状态
  267 +
  268 + // context.setFontSize(20);
  269 + // context.setFillStyle('#78482F');
  270 + // context.setTextAlign('center');
  271 + // let nickname = wx.getStorageSync("nickname");
  272 + // console.log('889900', nickname)
  273 + // context.fillText(nickname, 184, 45);
  274 +
  275 + // context.setFontSize(15);
  276 + // context.setFillStyle('#78482F');
  277 + // context.setTextAlign('center');
  278 + // context.fillText('期待你的加入', 185, 75);
  279 +
  280 + // var path1 = that.data.saveimg;
  281 + // console.log('头像', path1)
  282 +
  283 + // context.arc(76, 56, 35, 0, 2 * Math.PI) //画出圆
  284 + // context.setFillStyle('#ffffff')
  285 + // context.strokeStyle = "#ffe200";
  286 + // context.clip(); //裁剪上面的圆形00
  287 + // context.drawImage(path1, 41, 21, 70, 70); // 在刚刚裁剪的园上画图
  288 + context.draw();
  289 +
  290 +
  291 +
  292 + //将生成好的图片保存到本地,需要延迟一会,绘制期间耗时
  293 + setTimeout(function() {
  294 + wx.canvasToTempFilePath({
  295 + canvasId: 'mycanvas',
  296 + success: function(res) {
  297 + console.log(res)
  298 + var tempFilePath = res.tempFilePath;
  299 + console.log(tempFilePath)
  300 + that.setData({
  301 + imagePath: tempFilePath,
  302 + canvasHidden: true
  303 + });
  304 + },
  305 + fail: function(res) {
  306 + console.log(res);
  307 + }
  308 + });
  309 + }, 200);
  310 + },
  311 +
  312 +
  313 + drawCircular(ctx, width, height, x, y, url) {
  314 +
  315 + var avatarurl_width = width;
  316 + var avatarurl_heigth = height;
  317 + var avatarurl_x = x;
  318 + var avatarurl_y = y;
  319 +
  320 + console.log(avatarurl_width);
  321 + console.log(avatarurl_heigth);
  322 + console.log(avatarurl_x);
  323 + console.log(avatarurl_y);
  324 + ctx.save();
  325 + ctx.beginPath();
  326 + ctx.arc(avatarurl_width / 2 + avatarurl_x, avatarurl_heigth / 2 + avatarurl_y, avatarurl_width / 2, 0, Math.PI * 2, false);
  327 + ctx.clip();
  328 + ctx.drawImage(url, avatarurl_x, avatarurl_y, avatarurl_width, avatarurl_heigth);
  329 + ctx.restore();
  330 + },
  331 +
  332 + //点击保存到相册
  333 + baocun: function() {
  334 + console.log(999)
  335 + var that = this
  336 + wx.getSetting({
  337 + success(res) {
  338 + if (!res.authSetting['scope.writePhotosAlbum']) {
  339 + wx.authorize({
  340 + scope: 'scope.writePhotosAlbum',
  341 + success() { //这里是用户同意授权后的回调
  342 +
  343 +
  344 + wx.saveImageToPhotosAlbum({
  345 + filePath: that.data.imagePath,
  346 + success(res) {
  347 + wx.showModal({
  348 + content: '图片已保存到相册',
  349 + showCancel: false,
  350 + confirmText: '好的',
  351 + confirmColor: '#333',
  352 + success: function(res) {
  353 + if (res.confirm) {
  354 + console.log('用户点击确定');
  355 + /* 该隐藏的隐藏 */
  356 + that.setData({
  357 + maskHidden: false
  358 + })
  359 + }
  360 + },
  361 + fail: function(res) {
  362 +
  363 + }
  364 + })
  365 + }
  366 + })
  367 +
  368 +
  369 +
  370 + },
  371 + fail() { //这里是用户拒绝授权后的回调
  372 +
  373 +
  374 + // wx.openSetting({
  375 + // success: function (data) {
  376 + // console.log(data)
  377 + // if (data.authSetting["scope.writePhotosAlbum"] === true) {
  378 + // console.log("是否授权成功")
  379 + // } else {
  380 + // applyApi.toast("授权失败");
  381 + // }
  382 + // }
  383 + // })
  384 + wx.showModal({
  385 + title: '提示',
  386 + content: '您取消授权,无法保存图片,点击确定打开权限',
  387 + success(res) {
  388 + if (res.confirm) {
  389 + console.log('用户点击确定')
  390 + wx.openSetting({
  391 + success(res) {
  392 + console.log(res.authSetting)
  393 + // res.authSetting = {
  394 + // "scope.userInfo": true,
  395 + // "scope.userLocation": true
  396 + // }
  397 + }
  398 + })
  399 + } else if (res.cancel) {
  400 + console.log('用户点击取消')
  401 + }
  402 + }
  403 + })
  404 +
  405 + }
  406 + })
  407 + } else { //用户已经授权过了
  408 +
  409 + console.log(that.data.imagePath)
  410 + wx.saveImageToPhotosAlbum({
  411 + filePath: that.data.imagePath,
  412 + success(res) {
  413 + wx.showModal({
  414 + content: '图片已保存到相册',
  415 + showCancel: false,
  416 + confirmText: '好的',
  417 + confirmColor: '#333',
  418 + success: function(res) {
  419 + if (res.confirm) {
  420 + console.log('用户点击确定');
  421 + /* 该隐藏的隐藏 */
  422 + that.setData({
  423 + maskHidden: false
  424 + })
  425 + }
  426 + },
  427 + fail: function(res) {
  428 +
  429 + }
  430 + })
  431 + }
  432 + })
  433 + }
  434 + }
  435 + })
  436 +
  437 + },
  438 +
  439 + hideceng() {
  440 + this.setData({
  441 + maskHidden: false
  442 + })
  443 + },
  444 +
  445 +
  446 + savephoto() {
  447 +
  448 + console.log(54683485)
  449 + let that = this;
  450 + this.setData({
  451 + maskHidden: false
  452 + });
  453 + wx.showToast({
  454 + title: '海报生成中',
  455 + icon: 'loading',
  456 + duration: 1000
  457 + });
  458 + setTimeout(function() {
  459 + wx.hideToast()
  460 + that.createNewImg();
  461 + that.setData({
  462 + maskHidden: true
  463 + });
  464 + }, 1000)
  465 +
  466 + },
  467 +
  468 + savefilecode() {
  469 + let that = this;
  470 + console.log(that.data.codeurl)
  471 + wx.downloadFile({
  472 + url: that.data.qrcode,
  473 + header: {},
  474 + success: function (res) {
  475 + console.log('下载图片下载图片下载图片', res)
  476 + var tempFilePath = res.tempFilePath
  477 + //console.log('临时文件地址是:' + tempFilePath)
  478 + wx.saveFile({
  479 + tempFilePath: tempFilePath,
  480 + success: function (res) {
  481 + console.log(res)
  482 + var saveFilePath = res.savedFilePath;
  483 + that.setData({
  484 + qrcode: res.savedFilePath
  485 + })
  486 +
  487 + console.log('123456855555555', that.data.qrcode)
  488 +
  489 + }, //可以将saveFilePath写入到页面数据中
  490 + fail: function (res) { },
  491 + complete: function (res) {
  492 + console.log('complete后的res数据:')
  493 + },
  494 + }) //,
  495 + },
  496 + // fail: function (res) {
  497 + // wx.showModal({
  498 + // title: '下载失败',
  499 + // content: '请联系管理员',
  500 + // })
  501 + // },
  502 + complete: function (res) { },
  503 + })
  504 + },
  505 +
  506 +
  507 +
  508 + /**
  509 + * 生命周期函数--监听页面初次渲染完成
  510 + */
  511 + onReady: function() {
  512 +
  513 + },
  514 +
  515 + /**
  516 + * 生命周期函数--监听页面显示
  517 + */
  518 + onShow: function() {
  519 +
  520 + },
  521 +
  522 + /**
  523 + * 生命周期函数--监听页面隐藏
  524 + */
  525 + onHide: function() {
  526 +
  527 + },
  528 +
  529 + /**
  530 + * 生命周期函数--监听页面卸载
  531 + */
  532 + onUnload: function() {
  533 + // wx.navigateTo({
  534 + // url: '/pages/homepage/homepage',
  535 + // })
  536 + },
  537 +
  538 + /**
  539 + * 页面相关事件处理函数--监听用户下拉动作
  540 + */
  541 + onPullDownRefresh: function() {
  542 +
  543 + },
  544 +
  545 + /**
  546 + * 页面上拉触底事件的处理函数
  547 + */
  548 + onReachBottom: function() {
  549 +
  550 + },
  551 +
  552 + /**
  553 + * 用户点击右上角分享
  554 + */
  555 + onShareAppMessage: function() {
  556 + let that = this;
  557 +
  558 + return {
  559 + title: '我的注意力分享', // 转发后 所显示的title
  560 + // path: '/pages/home/buildtextdetail/buildtextdetail?buildid='+buildid+'&gettoken='+newtoken, // 相对的路径
  561 + path: '/pages/attentionone/attentionone?id='+that.data.id, //分娩笔记分享2
  562 +
  563 + success: (res) => { // 成功后要做的事情
  564 + console.log(res)
  565 +
  566 + },
  567 + fail: function (res) {
  568 + // 分享失败
  569 + console.log(res)
  570 + }
  571 + }
  572 + }
  573 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="myattention">
  2 + <image src="/img/atten.png"></image>
  3 +</view>
  4 +<view class="noke">[{{title}}]</view>
  5 +
  6 +<view class='noketext'>{{description}}</view>
  7 +
  8 +<!-- <view class="noketext up">每个方向都有同样的上升空间!</view> -->
  9 +
  10 +<!-- <view class='roleone'>
  11 + <image src="/img/roleone.png"></image>
  12 + <view class="redname">对不起,我可能不配拥有它!</view>
  13 + <view class="redkuang">视觉追踪25%</view>
  14 +
  15 + <view class="pink">我听的见但听不懂!</view>
  16 + <view class="pinkkuang">视觉追踪25%</view>
  17 +
  18 + <view class="yellowname">说来惭愧我啥也记不住!</view>
  19 + <view class="yellowkuang">听觉记忆25%</view>
  20 +
  21 + <view class="purplename">听见,是我最大的努力!</view>
  22 + <view class="purplekuang">听觉转移25%</view>
  23 +
  24 + <view class="grayname">好险,我不色弱,也没色盲!</view>
  25 + <view class="graykuang">视觉分辨25%</view>
  26 +
  27 + <view class="greenname">请你慢点说再慢点说...</view>
  28 + <view class="greenkuang">听觉追踪25%</view>
  29 +
  30 + <view class="bluename">跟我说话,请不要超过5个字</view>
  31 + <view class="bluekuang">听觉广度25%</view>
  32 +
  33 +</view> -->
  34 +
  35 +<view class="tupic">
  36 + <image src="/img/roleone.png"></image>
  37 +
  38 +
  39 + <view class="redname">{{rings[6].description}}</view>
  40 + <view class="redkuang">{{rings[6].sort_name}}{{rings[6].percent}}</view>
  41 +
  42 + <view class="pink">{{rings[5].description}}</view>
  43 + <view class="pinkkuang">{{rings[5].sort_name}}{{rings[5].percent}}</view>
  44 +
  45 + <view class="yellowname">{{rings[0].description}}</view>
  46 + <view class="yellowkuang">{{rings[0].sort_name}}{{rings[0].percent}}</view>
  47 +
  48 + <view class="purplename">{{rings[4].description}}</view>
  49 + <view class="purplekuang">{{rings[4].sort_name}}{{rings[4].percent}}</view>
  50 +
  51 + <view class="grayname">{{rings[1].description}}</view>
  52 + <view class="graykuang">{{rings[1].sort_name}}{{rings[1].percent}}</view>
  53 +
  54 + <view class="greenname">{{rings[2].description}}</view>
  55 + <view class="greenkuang">{{rings[2].sort_name}}{{rings[2].percent}}</view>
  56 +
  57 + <view class="bluename">{{rings[3].description}}</view>
  58 + <view class="bluekuang">{{rings[3].sort_name}}{{rings[3].percent}}</view>
  59 +</view>
  60 +<view class="code">
  61 + <view class="codeleft">
  62 + <image src="{{qrcode}}"></image>
  63 + </view>
  64 +
  65 + <view class="coderight">
  66 + <view class="coderighttop">长按识别二维码</view>
  67 + <view class="coderighttopk">获取你的注意力测验单</view>
  68 + </view>
  69 +</view>
  70 +
  71 +
  72 +<view class="sharehai">
  73 + <!-- <view class="shareleft">分享给好友</view> -->
  74 + <view class="shareright" bindtap="savephoto">生成海报</view>
  75 +</view>
  76 +
  77 +<!-- 海报 -->
  78 +<view class='pp' bindtap="hideceng">
  79 + <view class='imagePathBox' hidden="{{maskHidden == false}}">
  80 + <image src="{{imagePath}}" class='shengcheng'></image>
  81 +
  82 + <view class="share">
  83 + <button class="shareleft" catchtap="share" open-type='share'>分享给好友</button>
  84 + <!-- <button class="lj_share" bindtap="childshare" open-type='share'>分享</button> -->
  85 + <view class="shareright" catchtap="baocun">保存到相册</view>
  86 + </view>
  87 +
  88 +
  89 + <!-- <button class='baocun' bindtap='baocun'>保存图片至相册</button> -->
  90 + </view>
  91 +
  92 +
  93 + <view hidden="{{maskHidden == false}}" class="mask"></view>
  94 + <view class="canvas-box">
  95 + <canvas style="width:375px;height:603px;position:fixed;top:9999px;border-radius:56rpx" canvas-id="mycanvas" />
  96 + </view>
  97 +</view>
  1 +.myattention {
  2 + width: 750rpx;
  3 + height: 170rpx;
  4 + font-size: 0;
  5 +}
  6 +
  7 +image {
  8 + width: 100%;
  9 + height: 100%;
  10 +}
  11 +
  12 +.noke {
  13 + color: #ce6198;
  14 + font-size: 42rpx;
  15 + font-weight: bold;
  16 + margin-top: 12rpx;
  17 + text-align: center;
  18 +}
  19 +
  20 +.noketext {
  21 + color: #ce6198;
  22 + font-size: 39rpx;
  23 + font-weight: bold;
  24 + text-align: center;
  25 + margin-top: 15rpx;
  26 +}
  27 +
  28 +.up {
  29 + margin-top: 10rpx;
  30 +}
  31 +
  32 +.roleone {
  33 + width: 260rxp;
  34 + height: 740rpx;
  35 + font-size: 0;
  36 + margin: 50rpx auto 0;
  37 +
  38 +}
  39 +.roleone image{
  40 + width:100%;
  41 + height:100%;
  42 +}
  43 +
  44 +.redname {
  45 + color: #fff;
  46 + font-size: 24rpx;
  47 + position: absolute;
  48 + width: 156rpx;
  49 + top: 100rpx;
  50 + left: 154rpx;
  51 + line-height: 1.8;
  52 +}
  53 +
  54 +.redkuang {
  55 + color: #ea575d;
  56 + font-size: 26rpx;
  57 + font-weight: bold;
  58 + width: 130rpx;
  59 + position: absolute;
  60 + top: -25rpx;
  61 + left: 117rpx;
  62 + background: #fff;
  63 + text-align: center;
  64 + padding: 10rpx;
  65 + border: 1rpx solid #ea575d;
  66 +}
  67 +
  68 +.pink {
  69 + color: #fff;
  70 + font-size: 24rpx;
  71 + position: absolute;
  72 + width: 135rpx;
  73 + top: 100rpx;
  74 + left: 338rpx;
  75 + line-height: 1.8;
  76 +}
  77 +
  78 +.pinkkuang {
  79 + color: #ce6198;
  80 + font-size: 26rpx;
  81 + font-weight: bold;
  82 + width: 130rpx;
  83 + position: absolute;
  84 + top: -25rpx;
  85 + left: 353rpx;
  86 + background: #fff;
  87 + text-align: center;
  88 + padding: 10rpx;
  89 + border: 1rpx solid #ce6198;
  90 +}
  91 +
  92 +.yellowname {
  93 + color: #fff;
  94 + font-size: 24rpx;
  95 + position: absolute;
  96 + width: 185rpx;
  97 + top: 252rpx;
  98 + left: 35rpx;
  99 + line-height: 1.8;
  100 + text-align: center;
  101 +}
  102 +
  103 +.yellowkuang {
  104 + color: #f49f19;
  105 + font-size: 26rpx;
  106 + font-weight: bold;
  107 + width: 130rpx;
  108 + position: absolute;
  109 + top: 146rpx;
  110 + left: -26rpx;
  111 + background: #fff;
  112 + text-align: center;
  113 + padding: 10rpx;
  114 + border: 1rpx solid #f49f19;
  115 +}
  116 +
  117 +.purplename {
  118 + color: #fff;
  119 + font-size: 24rpx;
  120 + position: absolute;
  121 + width: 185rpx;
  122 + top: 250rpx;
  123 + right: 35rpx;
  124 + line-height: 1.8;
  125 + text-align: center;
  126 +}
  127 +
  128 +.purplekuang {
  129 + color: #a5639e;
  130 + font-size: 26rpx;
  131 + font-weight: bold;
  132 + width: 130rpx;
  133 + position: absolute;
  134 + top: 146rpx;
  135 + right: -23rpx;
  136 + background: #fff;
  137 + text-align: center;
  138 + padding: 10rpx;
  139 + border: 1rpx solid #a5639e;
  140 +}
  141 +
  142 +.grayname {
  143 + color: #fff;
  144 + font-size:24rpx;
  145 + position: absolute;
  146 + width: 185rpx;
  147 + bottom: 168rpx;
  148 + left: 67rpx;
  149 + line-height: 1.8;
  150 + text-align: center;
  151 +}
  152 +
  153 +.graykuang {
  154 + color: #898989;
  155 + font-size: 26rpx;
  156 + font-weight: bold;
  157 + width: 130rpx;
  158 + position: absolute;
  159 + bottom: 24rpx;
  160 + left: 18rpx;
  161 + background: #fff;
  162 + text-align: center;
  163 + padding: 10rpx;
  164 + border: 1rpx solid #898989;
  165 +}
  166 +
  167 +.greenname {
  168 + color: #fff;
  169 + font-size: 22rpx;
  170 + position: absolute;
  171 + width: 109rpx;
  172 + bottom: 95rpx;
  173 + left: 254rpx;
  174 + line-height: 1.8;
  175 + text-align: center;
  176 +}
  177 +
  178 +.greenkuang {
  179 + color: #14b4a6;
  180 + font-size: 26rpx;
  181 + font-weight: bold;
  182 + width: 130rpx;
  183 + position: absolute;
  184 + bottom: -20rpx;
  185 + left: 227rpx;
  186 + background: #fff;
  187 + text-align: center;
  188 + padding: 10rpx;
  189 + border: 1rpx solid #14b4a6;
  190 +}
  191 +
  192 +.bluename {
  193 + color: #fff;
  194 + font-size: 24rpx;
  195 + position: absolute;
  196 + width: 217rpx;
  197 + bottom: 166rpx;
  198 + right: 35rpx;
  199 + line-height: 1.8;
  200 + text-align: center;
  201 +}
  202 +.bluekuang{
  203 + color: #1C96D0;
  204 + font-size: 26rpx;
  205 + font-weight: bold;
  206 + width: 130rpx;
  207 + position: absolute;
  208 + bottom: 63rpx;
  209 + right:17rpx;
  210 + background: #fff;
  211 + text-align: center;
  212 + padding: 10rpx;
  213 + border: 1rpx solid #1C96D0;
  214 +}
  215 +.tupic{
  216 + width:613rpx;
  217 + height:613rpx;
  218 + font-size: 0;
  219 + position: relative;
  220 + margin:31rpx auto 0;
  221 +}
  222 +
  223 +.code {
  224 + display: flex;
  225 + align-items: center;
  226 + width: 613rpx;
  227 + height: 128rpx;
  228 + margin:10rpx auto 0;
  229 +
  230 + /* position: absolute;
  231 + left: 28rpx;
  232 + bottom: 122rpx;
  233 + */
  234 + padding: 0 16rpx;
  235 + box-sizing: border-box;
  236 +}
  237 +
  238 +.codeleft {
  239 + width: 105rpx;
  240 + height: 105rpx;
  241 + font-size: 0;
  242 +}
  243 +
  244 +.coderight {
  245 + margin-left: 17rpx;
  246 +}
  247 +
  248 +.coderighttop {
  249 + color: #000;
  250 + font-size: 28rpx;
  251 +}
  252 +
  253 +.coderighttopk {
  254 + color: #000;
  255 + font-size: 28rpx;
  256 + margin-top: 10rpx;
  257 +}
  258 +
  259 +.share {
  260 + display: flex;
  261 + align-items: center;
  262 + position: absolute;
  263 + top:1138rpx;
  264 + z-index:999;
  265 + left: 58rpx;
  266 +}
  267 +
  268 +.shareleft {
  269 + width: 289rpx;
  270 + height: 68rpx;
  271 + color: #ce6198;
  272 + font-size: 28rpx;
  273 + text-align: center;
  274 + line-height: 68rpx;
  275 + background: #f9f9f9;
  276 + border-radius: 44rpx;
  277 +}
  278 +
  279 +.shareright {
  280 + width: 289rpx;
  281 + height: 68rpx;
  282 + color: #fff;
  283 + font-size: 28rpx;
  284 + text-align: center;
  285 + line-height:68rpx;
  286 + background: #ce6198;
  287 + border-radius: 44rpx;
  288 + margin-left: 57rpx;
  289 +}
  290 +.imagePathBox{
  291 + width: 100%;
  292 + height: 100%;
  293 + background: rgba(0,0,0,0.7);
  294 + position: fixed;
  295 + top: 0;
  296 + left: 0;
  297 + right: 0;
  298 + bottom: 0;
  299 + z-index: 10;
  300 +}
  301 +.shengcheng{
  302 + width:665rpx;
  303 + height:1100rpx;
  304 +
  305 + position: fixed;
  306 +
  307 + left: 50%;
  308 + top:30rpx;
  309 + transform: translateX(-50%);
  310 +
  311 + /* margin-left: -40%; */
  312 + z-index: 10;
  313 +}
  314 +.baocun{
  315 + display: block;
  316 + width: 80%;
  317 + height: 92rpx;
  318 + padding: 0;
  319 + line-height: 92rpx;
  320 + text-align: center;
  321 + position: fixed;
  322 + bottom: 12rpx;
  323 + left: 10%;
  324 + background:linear-gradient(180deg,rgba(252,169,162,1) 0%,rgba(255,119,117,1) 100%);
  325 + color: #fff;
  326 + font-size: 32rpx;
  327 + border-radius: 44rpx;
  328 + z-index:999999
  329 +
  330 +}
  331 +button[class="baocun"]::after{
  332 + border: 0;
  333 +}
  334 +.canvas-box{
  335 + word-break: break-word;
  336 + word-wrap: break-word;
  337 +}
  338 +.pp{
  339 + position: relative
  340 +}
  341 +.sharehai{
  342 + width:750rpx;
  343 + display:flex;
  344 + justify-content: center;
  345 + align-items: center;
  346 + /* margin-top:8rpx; */
  347 + /* position: absolute;
  348 + bottom:5rpx; */
  349 +}
  1 +// pages/attentiontwo/attentiontwo.js
  2 +const app=getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + maskHidden: false,
  10 + id:'',
  11 + description:'',
  12 + qrcode:'',
  13 + rings:'',
  14 + title:""
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面加载
  20 + */
  21 + onLoad: function (options) {
  22 + this.setData({
  23 + id: options.id
  24 + })
  25 +
  26 + this.getresult()
  27 + },
  28 + // 获取结果
  29 + getresult() {
  30 + let that = this;
  31 + var url = 'index/answer_log_detail';
  32 + var params = {
  33 + answer_log_id: that.data.id,
  34 +
  35 + }
  36 + app.post(url, params).then((res) => {
  37 + console.log(res);
  38 + that.setData({
  39 +
  40 + description: res.description,
  41 + qrcode: res.qrcode,
  42 + rings: res.rings,
  43 + title:res.title
  44 +
  45 +
  46 + })
  47 + that.savefilecode()
  48 +
  49 +
  50 + }).catch((err) => {
  51 +
  52 + })
  53 + },
  54 +
  55 + createNewImg: function () {
  56 + var that = this;
  57 + console.log(9999)
  58 + var context = wx.createCanvasContext('mycanvas');
  59 + // var img = '/img/no.png';
  60 +
  61 + // context.createPattern(img, 0, 0, 375, 667)
  62 + // context.style.background ='/img/tuijianimg1.png'
  63 + // context.setFillStyle("#ffe200");
  64 + context.fillRect(0, 0, 375, 603);
  65 + var path = "/img/attentionsix.png";
  66 + context.drawImage(path, 0, 0, 375, 603);
  67 + // context.drawImage(path, 0, 0, 680, 300);
  68 +
  69 + var path2 = that.data.qrcode;
  70 + context.drawImage(path2, 10, 539, 55, 55);
  71 +
  72 + context.setFontSize(20);
  73 + context.setFillStyle('#CE6198');
  74 + context.setTextAlign('center');
  75 + context.fillText(that.data.title, 185, 120);
  76 +
  77 +
  78 + context.setFontSize(16);
  79 + context.setFillStyle('#CE6198');
  80 + context.setTextAlign('center');
  81 +
  82 + var str =that.data.description;
  83 + var x = 145;
  84 + var len = Math.ceil(str.length / 12);
  85 + for (var i = 0; i < len; i++) {
  86 + var j = i * 12;
  87 + var strs = str.substring(j, 12 * (i + 1));
  88 + context.fillText(strs, 180, x + 22 * i,900);
  89 + }
  90 +
  91 + context.setFontSize(14);
  92 + context.setFillStyle('#EA595D');
  93 + context.setTextAlign('center');
  94 + context.fillText(that.data.rings[1].sort_name +that.data.rings[1].percent, 114, 220);
  95 +
  96 + context.setFontSize(14);
  97 + context.setFillStyle('#fff');
  98 + context.setTextAlign('center');
  99 +
  100 + var str = that.data.rings[1].description;
  101 + var x = 250;
  102 + var len = Math.ceil(str.length / 5);
  103 + for (var i = 0; i < len; i++) {
  104 + var j = i * 5;
  105 + var strs = str.substring(j, 5 * (i + 1));
  106 + context.fillText(strs, 140, x + 22 * i, 2000);
  107 + }
  108 +
  109 + context.setFontSize(14);
  110 + context.setFillStyle('#CE6198');
  111 + context.setTextAlign('center');
  112 + context.fillText(that.data.rings[0].sort_name + that.data.rings[0].percent, 270, 233);
  113 +
  114 +
  115 +
  116 + context.setFontSize(14);
  117 + context.setFillStyle('#fff');
  118 + context.setTextAlign('center');
  119 +
  120 + var str = that.data.rings[0].description;
  121 + var x = 265;
  122 + var len = Math.ceil(str.length / 5);
  123 + for (var i = 0; i < len; i++) {
  124 + var j = i * 5;
  125 + var strs = str.substring(j, 5 * (i + 1));
  126 + context.fillText(strs, 245, x + 22 * i, 2000);
  127 + }
  128 +
  129 +
  130 + context.setFontSize(14);
  131 + context.setFillStyle('#F49E15');
  132 + context.setTextAlign('center');
  133 + context.fillText(that.data.rings[4].sort_name + that.data.rings[4].percent, 90, 317);
  134 +
  135 + context.setFontSize(14);
  136 + context.setFillStyle('#fff');
  137 + context.setTextAlign('center');
  138 +
  139 + var str = that.data.rings[4].description;
  140 + var x = 345;
  141 + var len = Math.ceil(str.length / 5);
  142 + for (var i = 0; i < len; i++) {
  143 + var j = i * 5;
  144 + var strs = str.substring(j, 5 * (i + 1));
  145 + context.fillText(strs, 115, x + 22 * i, 2000);
  146 + }
  147 +
  148 + context.setFontSize(14);
  149 + context.setFillStyle('#A6639E');
  150 + context.setTextAlign('center');
  151 + context.fillText(that.data.rings[2].sort_name + that.data.rings[2].percent, 280, 397);
  152 +
  153 + context.setFontSize(12);
  154 + context.setFillStyle('#fff');
  155 + context.setTextAlign('center');
  156 +
  157 + var str = that.data.rings[2].description;
  158 + var x = 342;
  159 + var len = Math.ceil(str.length / 8);
  160 + for (var i = 0; i < len; i++) {
  161 + var j = i * 8;
  162 + var strs = str.substring(j, 8 * (i + 1));
  163 + context.fillText(strs, 288, x + 18 * i, 2000);
  164 + }
  165 +
  166 + context.setFontSize(14);
  167 + context.setFillStyle('#1BB4A5');
  168 + context.setTextAlign('center');
  169 + context.fillText(that.data.rings[5].sort_name + that.data.rings[5].percent, 110, 487);
  170 +
  171 + context.setFontSize(14);
  172 + context.setFillStyle('#fff');
  173 + context.setTextAlign('center');
  174 +
  175 + var str = that.data.rings[5].description;;
  176 + var x = 420;
  177 + var len = Math.ceil(str.length / 5);
  178 + for (var i = 0; i < len; i++) {
  179 + var j = i * 5;
  180 + var strs = str.substring(j, 5 * (i + 1));
  181 + context.fillText(strs, 140, x + 22 * i, 2000);
  182 + }
  183 +
  184 +
  185 + context.setFontSize(14);
  186 + context.setFillStyle('#1A97D0');
  187 + context.setTextAlign('center');
  188 + context.fillText(that.data.rings[3].sort_name + that.data.rings[3].percent, 270, 504);
  189 +
  190 + context.setFontSize(14);
  191 + context.setFillStyle('#fff');
  192 + context.setTextAlign('center');
  193 +
  194 + var str = that.data.rings[3].description;;
  195 + var x = 425;
  196 + var len = Math.ceil(str.length / 5);
  197 + for (var i = 0; i < len; i++) {
  198 + var j = i * 5;
  199 + var strs = str.substring(j, 5 * (i + 1));
  200 + context.fillText(strs, 240, x + 22 * i, 2000);
  201 + }
  202 +
  203 +
  204 +
  205 +
  206 +
  207 + // var path2 = that.data.codeurl;
  208 + // console.log('888777666554433', path2)
  209 + // var path3 = "/img/feihuiyuan.png";
  210 + // var path4 = "/img/dali.png";
  211 + // var path5 = "/img/tiyanactive.png";
  212 +
  213 + // this.drawCircular(context, 96, 96, this.data.imgwidth * 0.7, this.data.imgheight * 0.7, path2);
  214 +
  215 + context.save(); // 保存当前context的状态
  216 +
  217 + // context.setFontSize(20);
  218 + // context.setFillStyle('#78482F');
  219 + // context.setTextAlign('center');
  220 + // let nickname = wx.getStorageSync("nickname");
  221 + // console.log('889900', nickname)
  222 + // context.fillText(nickname, 184, 45);
  223 +
  224 + // context.setFontSize(15);
  225 + // context.setFillStyle('#78482F');
  226 + // context.setTextAlign('center');
  227 + // context.fillText('期待你的加入', 185, 75);
  228 +
  229 + // var path1 = that.data.saveimg;
  230 + // console.log('头像', path1)
  231 +
  232 + // context.arc(76, 56, 35, 0, 2 * Math.PI) //画出圆
  233 + // context.setFillStyle('#ffffff')
  234 + // context.strokeStyle = "#ffe200";
  235 + // context.clip(); //裁剪上面的圆形00
  236 + // context.drawImage(path1, 41, 21, 70, 70); // 在刚刚裁剪的园上画图
  237 + context.draw();
  238 +
  239 +
  240 +
  241 + //将生成好的图片保存到本地,需要延迟一会,绘制期间耗时
  242 + setTimeout(function () {
  243 + wx.canvasToTempFilePath({
  244 + canvasId: 'mycanvas',
  245 + success: function (res) {
  246 + console.log(res)
  247 + var tempFilePath = res.tempFilePath;
  248 + console.log(tempFilePath)
  249 + that.setData({
  250 + imagePath: tempFilePath,
  251 + canvasHidden: true
  252 + });
  253 + },
  254 + fail: function (res) {
  255 + console.log(res);
  256 + }
  257 + });
  258 + }, 200);
  259 + },
  260 +
  261 +
  262 + drawCircular(ctx, width, height, x, y, url) {
  263 +
  264 + var avatarurl_width = width;
  265 + var avatarurl_heigth = height;
  266 + var avatarurl_x = x;
  267 + var avatarurl_y = y;
  268 +
  269 + console.log(avatarurl_width);
  270 + console.log(avatarurl_heigth);
  271 + console.log(avatarurl_x);
  272 + console.log(avatarurl_y);
  273 + ctx.save();
  274 + ctx.beginPath();
  275 + ctx.arc(avatarurl_width / 2 + avatarurl_x, avatarurl_heigth / 2 + avatarurl_y, avatarurl_width / 2, 0, Math.PI * 2, false);
  276 + ctx.clip();
  277 + ctx.drawImage(url, avatarurl_x, avatarurl_y, avatarurl_width, avatarurl_heigth);
  278 + ctx.restore();
  279 + },
  280 +
  281 + //点击保存到相册
  282 + baocun: function () {
  283 + console.log(999)
  284 + var that = this
  285 + wx.getSetting({
  286 + success(res) {
  287 + if (!res.authSetting['scope.writePhotosAlbum']) {
  288 + wx.authorize({
  289 + scope: 'scope.writePhotosAlbum',
  290 + success() { //这里是用户同意授权后的回调
  291 +
  292 +
  293 + wx.saveImageToPhotosAlbum({
  294 + filePath: that.data.imagePath,
  295 + success(res) {
  296 + wx.showModal({
  297 + content: '图片已保存到相册',
  298 + showCancel: false,
  299 + confirmText: '好的',
  300 + confirmColor: '#333',
  301 + success: function (res) {
  302 + if (res.confirm) {
  303 + console.log('用户点击确定');
  304 + /* 该隐藏的隐藏 */
  305 + that.setData({
  306 + maskHidden: false
  307 + })
  308 + }
  309 + },
  310 + fail: function (res) {
  311 +
  312 + }
  313 + })
  314 + }
  315 + })
  316 +
  317 +
  318 +
  319 + },
  320 + fail() { //这里是用户拒绝授权后的回调
  321 +
  322 +
  323 + // wx.openSetting({
  324 + // success: function (data) {
  325 + // console.log(data)
  326 + // if (data.authSetting["scope.writePhotosAlbum"] === true) {
  327 + // console.log("是否授权成功")
  328 + // } else {
  329 + // applyApi.toast("授权失败");
  330 + // }
  331 + // }
  332 + // })
  333 + wx.showModal({
  334 + title: '提示',
  335 + content: '您取消授权,无法保存图片,点击确定打开权限',
  336 + success(res) {
  337 + if (res.confirm) {
  338 + console.log('用户点击确定')
  339 + wx.openSetting({
  340 + success(res) {
  341 + console.log(res.authSetting)
  342 + // res.authSetting = {
  343 + // "scope.userInfo": true,
  344 + // "scope.userLocation": true
  345 + // }
  346 + }
  347 + })
  348 + } else if (res.cancel) {
  349 + console.log('用户点击取消')
  350 + }
  351 + }
  352 + })
  353 +
  354 + }
  355 + })
  356 + } else { //用户已经授权过了
  357 +
  358 + console.log(that.data.imagePath)
  359 + wx.saveImageToPhotosAlbum({
  360 + filePath: that.data.imagePath,
  361 + success(res) {
  362 + wx.showModal({
  363 + content: '图片已保存到相册',
  364 + showCancel: false,
  365 + confirmText: '好的',
  366 + confirmColor: '#333',
  367 + success: function (res) {
  368 + if (res.confirm) {
  369 + console.log('用户点击确定');
  370 + /* 该隐藏的隐藏 */
  371 + that.setData({
  372 + maskHidden: false
  373 + })
  374 + }
  375 + },
  376 + fail: function (res) {
  377 +
  378 + }
  379 + })
  380 + }
  381 + })
  382 + }
  383 + }
  384 + })
  385 +
  386 + },
  387 +
  388 + hideceng() {
  389 + this.setData({
  390 + maskHidden: false
  391 + })
  392 + },
  393 +
  394 +
  395 + savephoto() {
  396 +
  397 + console.log(54683485)
  398 + let that = this;
  399 + this.setData({
  400 + maskHidden: false
  401 + });
  402 + wx.showToast({
  403 + title: '海报生成中',
  404 + icon: 'loading',
  405 + duration: 1000
  406 + });
  407 + setTimeout(function () {
  408 + wx.hideToast()
  409 + that.createNewImg();
  410 + that.setData({
  411 + maskHidden: true
  412 + });
  413 + }, 1000)
  414 +
  415 + },
  416 +
  417 + savefilecode() {
  418 + let that = this;
  419 + console.log(that.data.codeurl)
  420 + wx.downloadFile({
  421 + url: that.data.qrcode,
  422 + header: {},
  423 + success: function (res) {
  424 + console.log('下载图片下载图片下载图片', res)
  425 + var tempFilePath = res.tempFilePath
  426 + //console.log('临时文件地址是:' + tempFilePath)
  427 + wx.saveFile({
  428 + tempFilePath: tempFilePath,
  429 + success: function (res) {
  430 + console.log(res)
  431 + var saveFilePath = res.savedFilePath;
  432 + that.setData({
  433 + qrcode: res.savedFilePath
  434 + })
  435 +
  436 + console.log('123456855555555', that.data.qrcode)
  437 +
  438 + }, //可以将saveFilePath写入到页面数据中
  439 + fail: function (res) { },
  440 + complete: function (res) {
  441 + console.log('complete后的res数据:')
  442 + },
  443 + }) //,
  444 + },
  445 + // fail: function (res) {
  446 + // wx.showModal({
  447 + // title: '下载失败',
  448 + // content: '请联系管理员',
  449 + // })
  450 + // },
  451 + complete: function (res) { },
  452 + })
  453 + },
  454 +
  455 + /**
  456 + * 生命周期函数--监听页面初次渲染完成
  457 + */
  458 + onReady: function () {
  459 +
  460 + },
  461 +
  462 + /**
  463 + * 生命周期函数--监听页面显示
  464 + */
  465 + onShow: function () {
  466 +
  467 + },
  468 +
  469 + /**
  470 + * 生命周期函数--监听页面隐藏
  471 + */
  472 + onHide: function () {
  473 +
  474 + },
  475 +
  476 + /**
  477 + * 生命周期函数--监听页面卸载
  478 + */
  479 + onUnload: function () {
  480 + // wx.navigateTo({
  481 + // url: '/pages/homepage/homepage',
  482 + // })
  483 + },
  484 +
  485 + /**
  486 + * 页面相关事件处理函数--监听用户下拉动作
  487 + */
  488 + onPullDownRefresh: function () {
  489 +
  490 + },
  491 +
  492 + /**
  493 + * 页面上拉触底事件的处理函数
  494 + */
  495 + onReachBottom: function () {
  496 +
  497 + },
  498 +
  499 + /**
  500 + * 用户点击右上角分享
  501 + */
  502 + onShareAppMessage: function () {
  503 + let that = this;
  504 +
  505 + return {
  506 + title: '我的注意力分享', // 转发后 所显示的title
  507 + // path: '/pages/home/buildtextdetail/buildtextdetail?buildid='+buildid+'&gettoken='+newtoken, // 相对的路径
  508 + path: '/pages/attentiontwo/attentiontwo?id=' + that.data.id, //分娩笔记分享2
  509 +
  510 + success: (res) => { // 成功后要做的事情
  511 + console.log(res)
  512 +
  513 + },
  514 + fail: function (res) {
  515 + // 分享失败
  516 + console.log(res)
  517 + }
  518 + }
  519 + }
  520 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="myattention">
  2 + <image src="/img/atten.png"></image>
  3 +</view>
  4 +<view class="noke">[{{title}}]</view>
  5 +
  6 +<view class='noketext'>{{description}}</view>
  7 +
  8 +<!-- <view class="noketext up">每个方向都有同样的上升空间!</view> -->
  9 +
  10 +<view class='tupic'>
  11 + <image src="/img/roletwo.png"></image>
  12 + <view class="redname">{{rings[1].description}}</view>
  13 + <view class="redkuang">{{rings[1].sort_name}}{{rings[1].percent}}</view>
  14 +
  15 + <view class="pink">{{rings[0].description}}</view>
  16 + <view class="pinkkuang">{{rings[0].sort_name}}{{rings[0].percent}}</view>
  17 +
  18 + <view class="yellowname">{{rings[4].description}}</view>
  19 + <view class="yellowkuang">{{rings[4].sort_name}}{{rings[4].percent}}</view>
  20 +
  21 + <view class="purplename">{{rings[2].description}}</view>
  22 + <view class="purplekuang">{{rings[2].sort_name}}{{rings[2].percent}}</view>
  23 +
  24 +
  25 +
  26 + <view class="greenname">{{rings[5].description}}</view>
  27 + <view class="greenkuang">{{rings[5].sort_name}}{{rings[5].percent}}</view>
  28 +
  29 + <view class="bluename">{{rings[3].description}}</view>
  30 + <view class="bluekuang">{{rings[3].sort_name}}{{rings[3].percent}}</view>
  31 +
  32 +</view>
  33 +<view class="code">
  34 + <view class="codeleft">
  35 + <image src="{{qrcode}}"></image>
  36 + </view>
  37 +
  38 + <view class="coderight">
  39 + <view class="coderighttop">长按识别二维码</view>
  40 + <view class="coderighttopk">获取你的注意力测验单</view>
  41 + </view>
  42 +</view>
  43 +
  44 +
  45 +
  46 +
  47 +
  48 +<view class="sharehai">
  49 + <!-- <view class="shareleft">分享给好友</view> -->
  50 + <view class="shareright" bindtap="savephoto">生成海报</view>
  51 +</view>
  52 +
  53 +
  54 +<!-- 海报 -->
  55 +<view class='pp' bindtap="hideceng">
  56 + <view class='imagePathBox' hidden="{{maskHidden == false}}">
  57 + <image src="{{imagePath}}" class='shengcheng'></image>
  58 + <!-- <button class='baocun' bindtap='baocun'>保存图片至相册</button> -->
  59 + <view class="share">
  60 + <!-- <view class="shareleft">分享给好友</view> -->
  61 + <button class="shareleft" catchtap="share" open-type='share'>分享给好友</button>
  62 + <view class="shareright" bindtap="baocun">保存图片</view>
  63 + </view>
  64 + </view>
  65 + <view hidden="{{maskHidden == false}}" class="mask"></view>
  66 + <view class="canvas-box">
  67 + <canvas style="width:375px;height:603px;position:fixed;top:9999px;border-radius:56rpx" canvas-id="mycanvas" />
  68 + </view>
  69 +</view>
  1 +.myattention {
  2 + width: 750rpx;
  3 + height: 170rpx;
  4 + font-size: 0;
  5 +}
  6 +
  7 +image {
  8 + width: 100%;
  9 + height: 100%;
  10 +}
  11 +
  12 +.noke {
  13 + color: #ce6198;
  14 + font-size: 39rpx;
  15 + font-weight: bold;
  16 + margin-top: 20rpx;
  17 + text-align: center;
  18 +}
  19 +
  20 +.noketext {
  21 + color: #ce6198;
  22 + font-size: 30rpx;
  23 + font-weight: bold;
  24 + text-align: center;
  25 + margin-top: 15rpx;
  26 +}
  27 +
  28 +.up {
  29 + margin-top: 10rpx;
  30 +}
  31 +
  32 +.tupic{
  33 + width:613rpx;
  34 + height:613rpx;
  35 + font-size: 0;
  36 + position: relative;
  37 + margin:36rpx auto 0;
  38 +}
  39 +
  40 +.redname {
  41 + color: #fff;
  42 + font-size: 24rpx;
  43 + position: absolute;
  44 + width: 172rpx;
  45 + top: 72rpx;
  46 + left: 127rpx;
  47 + line-height: 1.8;
  48 +}
  49 +
  50 +.redkuang {
  51 + color: #ea575d;
  52 + font-size: 26rpx;
  53 + font-weight: bold;
  54 + width: 220rpx;
  55 + position: absolute;
  56 + top: -7rpx;
  57 + left:23rpx;
  58 + background: #fff;
  59 + text-align: center;
  60 + padding: 10rpx;
  61 + border: 1rpx solid #ea575d;
  62 +}
  63 +
  64 +.pink {
  65 + color: #fff;
  66 + font-size: 24rpx;
  67 + position: absolute;
  68 + width: 135rpx;
  69 + top: 84rpx;
  70 + left: 367rpx;
  71 + line-height: 1.8;
  72 +}
  73 +
  74 +.pinkkuang {
  75 + color: #ce6198;
  76 + font-size: 26rpx;
  77 + font-weight: bold;
  78 + width: 220rpx;
  79 + position: absolute;
  80 + top: 14rpx;
  81 + left: 345rpx;
  82 + background: #fff;
  83 + text-align: center;
  84 + padding: 10rpx;
  85 + border: 1rpx solid #ce6198;
  86 +}
  87 +
  88 +.yellowname {
  89 + color: #fff;
  90 + font-size: 24rpx;
  91 + position: absolute;
  92 + width: 185rpx;
  93 + top: 280rpx;
  94 + left: 21rpx;
  95 + line-height: 1.8;
  96 + text-align: center;
  97 +}
  98 +
  99 +.yellowkuang {
  100 + color: #f49f19;
  101 + font-size: 26rpx;
  102 + font-weight: bold;
  103 + width: 220rpx;
  104 + position: absolute;
  105 + top: 202rpx;
  106 + left: -28rpx;
  107 + background: #fff;
  108 + text-align: center;
  109 + padding: 10rpx;
  110 + border: 1rpx solid #f49f19;
  111 +}
  112 +
  113 +.purplename {
  114 + color: #fff;
  115 + font-size: 22rpx;
  116 + position: absolute;
  117 + width: 185rpx;
  118 + top:265rpx;
  119 + right: 35rpx;
  120 + line-height: 1.8;
  121 + text-align: center;
  122 +}
  123 +
  124 +.purplekuang {
  125 + color: #a5639e;
  126 + font-size: 26rpx;
  127 + font-weight: bold;
  128 + width: 220rpx;
  129 + position: absolute;
  130 + top: 334rpx;
  131 + right:-23rpx;
  132 + background: #fff;
  133 + text-align: center;
  134 + padding: 10rpx;
  135 + border: 1rpx solid #a5639e;
  136 +}
  137 +
  138 +.grayname {
  139 + color: #fff;
  140 + font-size: 30rpx;
  141 + position: absolute;
  142 + width: 185rpx;
  143 + bottom: 185rpx;
  144 + left: 92rpx;
  145 + line-height: 1.8;
  146 + text-align: center;
  147 +}
  148 +
  149 +.graykuang {
  150 + color: #898989;
  151 + font-size: 30rpx;
  152 + font-weight: bold;
  153 + width: 130rpx;
  154 + position: absolute;
  155 + bottom: 38rpx;
  156 + left: 18rpx;
  157 + background: #fff;
  158 + text-align: center;
  159 + padding: 10rpx;
  160 + border: 1rpx solid #898989;
  161 +}
  162 +
  163 +.greenname {
  164 + color: #fff;
  165 + font-size: 24rpx;
  166 + position: absolute;
  167 + width: 145rpx;
  168 + bottom: 112rpx;
  169 + left: 130rpx;
  170 + line-height: 1.8;
  171 + text-align: center;
  172 +}
  173 +
  174 +.greenkuang {
  175 + color: #14b4a6;
  176 + font-size: 26rpx;
  177 + font-weight: bold;
  178 + width:220rpx;
  179 + position: absolute;
  180 + bottom: 18rpx;
  181 + left: 36rpx;
  182 + background: #fff;
  183 + text-align: center;
  184 + padding: 10rpx;
  185 + border: 1rpx solid #14b4a6;
  186 +}
  187 +
  188 +.bluename {
  189 + color: #fff;
  190 + font-size: 24rpx;
  191 + position: absolute;
  192 + width: 126rpx;
  193 + bottom: 78rpx;
  194 + right: 135rpx;
  195 + line-height: 1.8;
  196 + text-align: center;
  197 +}
  198 +.bluekuang{
  199 + color: #1C96D0;
  200 + font-size: 26rpx;
  201 + font-weight: bold;
  202 + width: 220rpx;
  203 + position: absolute;
  204 + bottom: 12rpx;
  205 + right:28rpx;
  206 + background: #fff;
  207 + text-align: center;
  208 + padding: 10rpx;
  209 + border: 1rpx solid #1C96D0;
  210 +}
  211 +
  212 +.code {
  213 + display: flex;
  214 + align-items: center;
  215 + width: 613rpx;
  216 + height: 128rpx;
  217 + margin:10rpx auto 0;
  218 +
  219 + /* position: absolute;
  220 + left: 28rpx;
  221 + bottom: 122rpx;
  222 + */
  223 + padding: 0 16rpx;
  224 + box-sizing: border-box;
  225 +}
  226 +
  227 +.codeleft {
  228 + width: 105rpx;
  229 + height: 105rpx;
  230 + font-size: 0;
  231 +}
  232 +
  233 +.coderight {
  234 + margin-left: 17rpx;
  235 +}
  236 +
  237 +.coderighttop {
  238 + color: #000;
  239 + font-size: 28rpx;
  240 +}
  241 +
  242 +.coderighttopk {
  243 + color: #000;
  244 + font-size: 28rpx;
  245 + margin-top: 10rpx;
  246 +}
  247 +
  248 +.share {
  249 + display: flex;
  250 + align-items: center;
  251 + position: absolute;
  252 + top:1138rpx;
  253 + z-index:999;
  254 + left: 58rpx;
  255 +}
  256 +.shareleft {
  257 + width: 289rpx;
  258 + height: 68rpx;
  259 + color: #ce6198;
  260 + font-size: 28rpx;
  261 + text-align: center;
  262 + line-height: 68rpx;
  263 + background: #f9f9f9;
  264 + border-radius: 44rpx;
  265 +}
  266 +
  267 +.shareright {
  268 + width: 289rpx;
  269 + height: 68rpx;
  270 + color: #fff;
  271 + font-size: 28rpx;
  272 + text-align: center;
  273 + line-height:68rpx;
  274 + background: #ce6198;
  275 + border-radius: 44rpx;
  276 + margin-left: 57rpx;
  277 +}
  278 +
  279 +.imagePathBox{
  280 + width: 100%;
  281 + height: 100%;
  282 + background: rgba(0,0,0,0.7);
  283 + position: fixed;
  284 + top: 0;
  285 + left: 0;
  286 + right: 0;
  287 + bottom: 0;
  288 + z-index: 10;
  289 +}
  290 +.shengcheng{
  291 + width:650rpx;
  292 + height:1080rpx;
  293 +
  294 + position: fixed;
  295 +
  296 + left: 50%;
  297 + top:30rpx;
  298 + transform: translateX(-50%);
  299 +
  300 + /* margin-left: -40%; */
  301 + z-index: 10;
  302 +}
  303 +.baocun{
  304 + display: block;
  305 + width: 80%;
  306 + height: 92rpx;
  307 + padding: 0;
  308 + line-height: 92rpx;
  309 + text-align: center;
  310 + position: fixed;
  311 + bottom: 12rpx;
  312 + left: 10%;
  313 + background:linear-gradient(180deg,rgba(252,169,162,1) 0%,rgba(255,119,117,1) 100%);
  314 + color: #fff;
  315 + font-size: 32rpx;
  316 + border-radius: 44rpx;
  317 + z-index:999999
  318 +
  319 +}
  320 +button[class="baocun"]::after{
  321 + border: 0;
  322 +}
  323 +.canvas-box{
  324 + word-break: break-word;
  325 + word-wrap: break-word;
  326 +}
  327 +
  328 +.sharehai{
  329 + width:750rpx;
  330 + display:flex;
  331 + justify-content: center;
  332 + align-items: center;
  333 + /* margin-top:8rpx; */
  334 + /* position: absolute;
  335 + bottom:5rpx; */
  336 +}
  1 +// pages/homepage/homepage.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 +
  16 + },
  17 +
  18 + // 家长评估
  19 + jiazhang(){
  20 + wx.navigateTo({
  21 + url: '/pages/question/question?type=1',
  22 + })
  23 + },
  24 +
  25 + three(){
  26 + wx.navigateTo({
  27 + url: '/pages/question/question?type=2',
  28 + })
  29 + },
  30 + seven(){
  31 + wx.navigateTo({
  32 + url: '/pages/question/question?type=3',
  33 + })
  34 + },
  35 + about(){
  36 + wx.navigateTo({
  37 + url: '/pages/aboutdanke/aboutdanke',
  38 + })
  39 + },
  40 + /**
  41 + * 生命周期函数--监听页面初次渲染完成
  42 + */
  43 + onReady: function () {
  44 +
  45 + },
  46 +
  47 + /**
  48 + * 生命周期函数--监听页面显示
  49 + */
  50 + onShow: function () {
  51 +
  52 + },
  53 +
  54 + /**
  55 + * 生命周期函数--监听页面隐藏
  56 + */
  57 + onHide: function () {
  58 +
  59 + },
  60 +
  61 + /**
  62 + * 生命周期函数--监听页面卸载
  63 + */
  64 + onUnload: function () {
  65 +
  66 + },
  67 +
  68 + /**
  69 + * 页面相关事件处理函数--监听用户下拉动作
  70 + */
  71 + onPullDownRefresh: function () {
  72 +
  73 + },
  74 +
  75 + /**
  76 + * 页面上拉触底事件的处理函数
  77 + */
  78 + onReachBottom: function () {
  79 +
  80 + },
  81 +
  82 + /**
  83 + * 用户点击右上角分享
  84 + */
  85 + onShareAppMessage: function () {
  86 +
  87 + }
  88 +})
  1 +{
  2 + "navigationBarTitleText": "注意力测试"
  3 +}
  1 +
  2 +<view class="homeimg">
  3 + <image src="/img/index.png" mode="widthFix"></image>
  4 +
  5 + <view class="jiazhangkuang" bindtap="jiazhang"></view>
  6 + <view class="threetosix" bindtap="three"></view>
  7 + <view class="seventotwelve" bindtap="seven"></view>
  8 +
  9 + <view class="aboutdanke" bindtap="about">
  10 + <image src="/img/danke.png"></image>
  11 + </view>
  12 +</view>
  1 +page {
  2 + width: 750rpx;
  3 + height: 100%;
  4 + overflow-y: hidden;
  5 + background: #00BEAE;
  6 +}
  7 +
  8 +.homeimg {
  9 + width: 100%;
  10 + height: 100%;
  11 + position: relative
  12 +}
  13 +
  14 +image {
  15 + width: 100%;
  16 + height: 100%;
  17 +}
  18 +
  19 +.jiazhangkuang {
  20 + width: 211rpx;
  21 + height: 255rpx;
  22 + border: 1rpx solid transparent;
  23 + position: absolute;
  24 + top:422rpx;
  25 + right:99rpx;
  26 +
  27 +}
  28 +
  29 +.threetosix {
  30 + width: 211rpx;
  31 + height: 255rpx;
  32 + border: 1rpx solid transparent;
  33 + position: absolute;
  34 + top:641rpx;
  35 + right:99rpx;
  36 +}
  37 +
  38 +.seventotwelve {
  39 + width: 211rpx;
  40 + height: 255rpx;
  41 + border: 1rpx solid transparent;
  42 + position: absolute;
  43 + top:861rpx;
  44 + right:99rpx;
  45 +}
  46 +.aboutdanke{
  47 + width:182rpx;
  48 + height:61rpx;
  49 + font-size: 0;
  50 + position: absolute;
  51 + right:0;
  52 + bottom:45rpx;
  53 +
  54 +}
  55 +.aboutdanke image{
  56 + width:100%;
  57 + height:100%;
  58 +}
  1 +//index.js
  2 +//获取应用实例
  3 +const app = getApp()
  4 +
  5 +Page({
  6 + data: {
  7 + motto: 'Hello World',
  8 + userInfo: {},
  9 + hasUserInfo: false,
  10 + canIUse: wx.canIUse('button.open-type.getUserInfo')
  11 + },
  12 + //事件处理函数
  13 + bindViewTap: function() {
  14 + wx.navigateTo({
  15 + url: '../logs/logs'
  16 + })
  17 + },
  18 + onLoad: function () {
  19 + if (app.globalData.userInfo) {
  20 + this.setData({
  21 + userInfo: app.globalData.userInfo,
  22 + hasUserInfo: true
  23 + })
  24 + } else if (this.data.canIUse){
  25 + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  26 + // 所以此处加入 callback 以防止这种情况
  27 + app.userInfoReadyCallback = res => {
  28 + this.setData({
  29 + userInfo: res.userInfo,
  30 + hasUserInfo: true
  31 + })
  32 + }
  33 + } else {
  34 + // 在没有 open-type=getUserInfo 版本的兼容处理
  35 + wx.getUserInfo({
  36 + success: res => {
  37 + app.globalData.userInfo = res.userInfo
  38 + this.setData({
  39 + userInfo: res.userInfo,
  40 + hasUserInfo: true
  41 + })
  42 + }
  43 + })
  44 + }
  45 + },
  46 + getUserInfo: function(e) {
  47 + console.log(e)
  48 + app.globalData.userInfo = e.detail.userInfo
  49 + this.setData({
  50 + userInfo: e.detail.userInfo,
  51 + hasUserInfo: true
  52 + })
  53 + }
  54 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!--index.wxml-->
  2 +<view class="container">
  3 + <view class="userinfo">
  4 + <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
  5 + <block wx:else>
  6 + <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
  7 + <text class="userinfo-nickname">{{userInfo.nickName}}</text>
  8 + </block>
  9 + </view>
  10 + <view class="usermotto">
  11 + <text class="user-motto">{{motto}}</text>
  12 + </view>
  13 +</view>
  1 +/**index.wxss**/
  2 +.userinfo {
  3 + display: flex;
  4 + flex-direction: column;
  5 + align-items: center;
  6 +}
  7 +
  8 +.userinfo-avatar {
  9 + width: 128rpx;
  10 + height: 128rpx;
  11 + margin: 20rpx;
  12 + border-radius: 50%;
  13 +}
  14 +
  15 +.userinfo-nickname {
  16 + color: #aaa;
  17 +}
  18 +
  19 +.usermotto {
  20 + margin-top: 200px;
  21 +}
  1 +//logs.js
  2 +const util = require('../../utils/util.js')
  3 +
  4 +Page({
  5 + data: {
  6 + logs: []
  7 + },
  8 + onLoad: function () {
  9 + this.setData({
  10 + logs: (wx.getStorageSync('logs') || []).map(log => {
  11 + return util.formatTime(new Date(log))
  12 + })
  13 + })
  14 + }
  15 +})
  1 +{
  2 + "navigationBarTitleText": "查看启动日志",
  3 + "usingComponents": {}
  4 +}
  1 +<!--logs.wxml-->
  2 +<view class="container log-list">
  3 + <block wx:for="{{logs}}" wx:for-item="log">
  4 + <text class="log-item">{{index + 1}}. {{log}}</text>
  5 + </block>
  6 +</view>
  1 +.log-list {
  2 + display: flex;
  3 + flex-direction: column;
  4 + padding: 40rpx;
  5 +}
  6 +.log-item {
  7 + margin: 10rpx;
  8 +}
  1 +// pages/parentping/parentping.js
  2 +const app=getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + maskHidden: false,
  10 + imgwidth: '',
  11 + imgheight: '',
  12 + picwidth: '',
  13 + pciheight: '',
  14 + attenwidth: '',
  15 + textheight:'',
  16 + codewidth:'',
  17 + codeheight:'',
  18 + changanwidth:'',
  19 + changanheight:'',
  20 + cedanwidth:'',
  21 + cedanheight:'',
  22 + id:'',
  23 + star:'',
  24 + description:'',
  25 + qrcode:'',
  26 + title:""
  27 +
  28 + },
  29 +
  30 + /**
  31 + * 生命周期函数--监听页面加载
  32 + */
  33 + onLoad: function(options) {
  34 +
  35 + this.setData({
  36 + id:options.id
  37 + })
  38 +
  39 + this.getresult()
  40 +
  41 + },
  42 +
  43 + // 获取结果
  44 + getresult(){
  45 + let that = this;
  46 + var url = 'index/answer_log_detail';
  47 + var params = {
  48 + answer_log_id: that.data.id,
  49 +
  50 + }
  51 + app.post(url, params).then((res) => {
  52 + console.log(res);
  53 + that.setData({
  54 + star:res.star,
  55 + description: res.description,
  56 + qrcode: res.qrcode,
  57 + title:res.title
  58 + })
  59 +
  60 + that.savefilecode()
  61 +
  62 +
  63 +
  64 + }).catch((err) => {
  65 +
  66 + })
  67 + },
  68 +
  69 + createNewImg: function() {
  70 + var that = this;
  71 + console.log(9999)
  72 + var context = wx.createCanvasContext('mycanvas');
  73 + // var img = '/img/no.png';
  74 +
  75 + // context.createPattern(img, 0, 0, 375, 667)
  76 + // context.style.background ='/img/tuijianimg1.png'
  77 + // context.setFillStyle("#ffe200");
  78 + context.fillRect(0, 0, 375, 603);
  79 + var path = "/img/no.png";
  80 + context.drawImage(path, 0, 0, 375, 603);
  81 + // context.drawImage(path, 0, 0, 680, 300);
  82 + context.setFontSize(26);
  83 + context.setFillStyle('#fff');
  84 + context.setTextAlign('center');
  85 + context.fillText(that.data.title, 190, 50);
  86 +
  87 + var path1 = '';
  88 + if(that.data.star==1){
  89 + path1 = "/img/onestar.png"
  90 + } else if (that.data.star==2){
  91 + path1 = "/img/twostar.png"
  92 + } else if (that.data.star==3){
  93 + path1 = "/img/threestar.png"
  94 + } else if (that.data.star == 4) {
  95 + path1 = "/img/fourstar.png"
  96 + } else if (that.data.star == 5) {
  97 + path1 = "/img/fivestar.png"
  98 + }
  99 + context.drawImage(path1, 125, 60, 110, 16);
  100 +
  101 + context.setFontSize(16);
  102 + context.setFillStyle('#333');
  103 + context.setTextAlign('left');
  104 +
  105 + // var str = '孩子有较明显的注意力缺陷倾向,基本无法完成学业要求,建议到正规医院和机构进行专业检查。';
  106 + var str=that.data.description;
  107 + var x = 170;
  108 + var len = Math.ceil(str.length / 20);
  109 + for (var i = 0; i < len; i++) {
  110 + var j = i * 20;
  111 + var strs = str.substring(j, 20 * (i + 1));
  112 + context.fillText(strs, 25, x + 32 * i, this.data.imgwidth * 0.88);
  113 + }
  114 +
  115 + var drawTxt = ''; // 当前绘制的内容
  116 + var drawLine = 1; // 第几行开始绘制
  117 + var drawIndex = 0; // 当前绘制内容的索引
  118 +
  119 + // var path2 = "/img/code.png";
  120 + var path2 = that.data.qrcode
  121 + context.drawImage(path2,12,525 , 70, 70);
  122 +
  123 + context.setFontSize(16);
  124 + context.setFillStyle('#333');
  125 + context.setTextAlign('center');
  126 + context.fillText('长按识别二维码', 160,550);
  127 +
  128 + context.setFontSize(16);
  129 + context.setFillStyle('#333');
  130 + context.setTextAlign('center');
  131 + context.fillText('获取你的注意力测验单', 185, 580);
  132 +
  133 +
  134 +
  135 +
  136 +
  137 +
  138 + // var path2 = that.data.codeurl;
  139 + // console.log('888777666554433', path2)
  140 + // var path3 = "/img/feihuiyuan.png";
  141 + // var path4 = "/img/dali.png";
  142 + // var path5 = "/img/tiyanactive.png";
  143 +
  144 + // this.drawCircular(context, 96, 96, this.data.imgwidth * 0.7, this.data.imgheight * 0.7, path2);
  145 +
  146 + context.save(); // 保存当前context的状态
  147 +
  148 + // context.setFontSize(20);
  149 + // context.setFillStyle('#78482F');
  150 + // context.setTextAlign('center');
  151 + // let nickname = wx.getStorageSync("nickname");
  152 + // console.log('889900', nickname)
  153 + // context.fillText(nickname, 184, 45);
  154 +
  155 + // context.setFontSize(15);
  156 + // context.setFillStyle('#78482F');
  157 + // context.setTextAlign('center');
  158 + // context.fillText('期待你的加入', 185, 75);
  159 +
  160 + // var path1 = that.data.saveimg;
  161 + // console.log('头像', path1)
  162 +
  163 + // context.arc(76, 56, 35, 0, 2 * Math.PI) //画出圆
  164 + // context.setFillStyle('#ffffff')
  165 + // context.strokeStyle = "#ffe200";
  166 + // context.clip(); //裁剪上面的圆形00
  167 + // context.drawImage(path1, 41, 21, 70, 70); // 在刚刚裁剪的园上画图
  168 + context.draw();
  169 +
  170 +
  171 +
  172 + //将生成好的图片保存到本地,需要延迟一会,绘制期间耗时
  173 + setTimeout(function() {
  174 + wx.canvasToTempFilePath({
  175 + canvasId: 'mycanvas',
  176 + success: function(res) {
  177 + console.log(res)
  178 + var tempFilePath = res.tempFilePath;
  179 + console.log(tempFilePath)
  180 + that.setData({
  181 + imagePath: tempFilePath,
  182 + canvasHidden: true
  183 + });
  184 + },
  185 + fail: function(res) {
  186 + console.log(res);
  187 + }
  188 + });
  189 + }, 200);
  190 + },
  191 +
  192 +
  193 + drawCircular(ctx, width, height, x, y, url) {
  194 +
  195 + var avatarurl_width = width;
  196 + var avatarurl_heigth = height;
  197 + var avatarurl_x = x;
  198 + var avatarurl_y = y;
  199 +
  200 + console.log(avatarurl_width);
  201 + console.log(avatarurl_heigth);
  202 + console.log(avatarurl_x);
  203 + console.log(avatarurl_y);
  204 + ctx.save();
  205 + ctx.beginPath();
  206 + ctx.arc(avatarurl_width / 2 + avatarurl_x, avatarurl_heigth / 2 + avatarurl_y, avatarurl_width / 2, 0, Math.PI * 2, false);
  207 + ctx.clip();
  208 + ctx.drawImage(url, avatarurl_x, avatarurl_y, avatarurl_width, avatarurl_heigth);
  209 + ctx.restore();
  210 + },
  211 +
  212 + //点击保存到相册
  213 + baocun: function() {
  214 + console.log(999)
  215 + var that = this
  216 + wx.getSetting({
  217 + success(res) {
  218 + if (!res.authSetting['scope.writePhotosAlbum']) {
  219 + wx.authorize({
  220 + scope: 'scope.writePhotosAlbum',
  221 + success() { //这里是用户同意授权后的回调
  222 +
  223 +
  224 + wx.saveImageToPhotosAlbum({
  225 + filePath: that.data.imagePath,
  226 + success(res) {
  227 + wx.showModal({
  228 + content: '图片已保存到相册',
  229 + showCancel: false,
  230 + confirmText: '好的',
  231 + confirmColor: '#333',
  232 + success: function(res) {
  233 + if (res.confirm) {
  234 + console.log('用户点击确定');
  235 + /* 该隐藏的隐藏 */
  236 + that.setData({
  237 + maskHidden: false
  238 + })
  239 + }
  240 + },
  241 + fail: function(res) {
  242 +
  243 + }
  244 + })
  245 + }
  246 + })
  247 +
  248 +
  249 +
  250 + },
  251 + fail() { //这里是用户拒绝授权后的回调
  252 +
  253 +
  254 + // wx.openSetting({
  255 + // success: function (data) {
  256 + // console.log(data)
  257 + // if (data.authSetting["scope.writePhotosAlbum"] === true) {
  258 + // console.log("是否授权成功")
  259 + // } else {
  260 + // applyApi.toast("授权失败");
  261 + // }
  262 + // }
  263 + // })
  264 + wx.showModal({
  265 + title: '提示',
  266 + content: '您取消授权,无法保存图片,点击确定打开权限',
  267 + success(res) {
  268 + if (res.confirm) {
  269 + console.log('用户点击确定')
  270 + wx.openSetting({
  271 + success(res) {
  272 + console.log(res.authSetting)
  273 + // res.authSetting = {
  274 + // "scope.userInfo": true,
  275 + // "scope.userLocation": true
  276 + // }
  277 + }
  278 + })
  279 + } else if (res.cancel) {
  280 + console.log('用户点击取消')
  281 + }
  282 + }
  283 + })
  284 +
  285 + }
  286 + })
  287 + } else { //用户已经授权过了
  288 +
  289 + console.log(that.data.imagePath)
  290 + wx.saveImageToPhotosAlbum({
  291 + filePath: that.data.imagePath,
  292 + success(res) {
  293 + wx.showModal({
  294 + content: '图片已保存到相册',
  295 + showCancel: false,
  296 + confirmText: '好的',
  297 + confirmColor: '#333',
  298 + success: function(res) {
  299 + if (res.confirm) {
  300 + console.log('用户点击确定');
  301 + /* 该隐藏的隐藏 */
  302 + that.setData({
  303 + maskHidden: false
  304 + })
  305 + }
  306 + },
  307 + fail: function(res) {
  308 +
  309 + }
  310 + })
  311 + }
  312 + })
  313 + }
  314 + }
  315 + })
  316 +
  317 + },
  318 +
  319 + hideceng(){
  320 + this.setData({
  321 + maskHidden:false
  322 + })
  323 + },
  324 +
  325 +
  326 +
  327 + savephoto() {
  328 +
  329 + console.log(54683485)
  330 + let that = this;
  331 + this.setData({
  332 + maskHidden: false
  333 + });
  334 + wx.showToast({
  335 + title: '海报生成中',
  336 + icon: 'loading',
  337 + duration: 1000
  338 + });
  339 + setTimeout(function() {
  340 + wx.hideToast()
  341 + that.createNewImg();
  342 + that.setData({
  343 + maskHidden: true
  344 + });
  345 + }, 1000)
  346 +
  347 + },
  348 +
  349 + savefilecode() {
  350 + let that = this;
  351 + console.log(that.data.codeurl)
  352 + wx.downloadFile({
  353 + url: that.data.qrcode ,
  354 + header: {},
  355 + success: function (res) {
  356 + console.log('下载图片下载图片下载图片', res)
  357 + var tempFilePath = res.tempFilePath
  358 + //console.log('临时文件地址是:' + tempFilePath)
  359 + wx.saveFile({
  360 + tempFilePath: tempFilePath,
  361 + success: function (res) {
  362 + console.log(res)
  363 + var saveFilePath = res.savedFilePath;
  364 + that.setData({
  365 + qrcode: res.savedFilePath
  366 + })
  367 +
  368 + console.log('123456855555555', that.data.qrcode)
  369 +
  370 + }, //可以将saveFilePath写入到页面数据中
  371 + fail: function (res) { },
  372 + complete: function (res) {
  373 + console.log('complete后的res数据:')
  374 + },
  375 + }) //,
  376 + },
  377 + // fail: function (res) {
  378 + // wx.showModal({
  379 + // title: '下载失败',
  380 + // content: '请联系管理员',
  381 + // })
  382 + // },
  383 + complete: function (res) { },
  384 + })
  385 + },
  386 +
  387 +
  388 + /**
  389 + * 生命周期函数--监听页面初次渲染完成
  390 + */
  391 + onReady: function() {
  392 +
  393 + },
  394 +
  395 + /**
  396 + * 生命周期函数--监听页面显示
  397 + */
  398 + onShow: function() {
  399 + let width = wx.getSystemInfoSync().windowWidth;
  400 + width = width
  401 + width = Math.ceil(width)
  402 + console.log(width)
  403 +
  404 + let height = wx.getSystemInfoSync().windowHeight;
  405 + height = height
  406 + height = Math.ceil(height);
  407 + console.log(height)
  408 + // if (height == 572){
  409 + // this.setData({
  410 + // pciheight: height * 0.82,
  411 + // attenwidth: width * 0.52,
  412 + // textheight: height * 0.22,
  413 + // codewidth: width * 0.1,
  414 + // codeheight: height * 0.68,
  415 +
  416 + // changanwidth: width * 0.5,
  417 + // changanheight: height * 0.8,
  418 + // cedanwidth: width * 0.57,
  419 + // cedanheight: height * 0.77
  420 + // })
  421 +
  422 + // }else if (height == 672) {
  423 + // console.log(666)
  424 + // this.setData({
  425 + // pciheight: height * 0.85,
  426 + // attenwidth: width * 0.5,
  427 + // textheight: height*0.22,
  428 + // codewidth:width*0.1,
  429 + // codeheight:height*0.73,
  430 + // changanwidth:width*0.46,
  431 + // changanheight:height*0.85,
  432 + // cedanwidth: width * 0.53,
  433 + // cedanheight:height*0.81
  434 + // })
  435 + // } else if (height == 808) {
  436 + // console.log(9999)
  437 + // this.setData({
  438 + // pciheight: height * 0.77,
  439 + // attenwidth: width * 0.48,
  440 + // textheight: height * 0.22
  441 +
  442 + // })
  443 +
  444 +
  445 + // } else if (height==724){
  446 + // this.setData({
  447 + // pciheight: height * 0.82,
  448 + // attenwidth: width * 0.52,
  449 + // textheight: height * 0.22,
  450 + // codewidth: width * 0.1,
  451 + // codeheight: height * 0.68,
  452 + // codewidth: width * 0.1,
  453 + // codeheight: height * 0.71,
  454 + // changanwidth: width * 0.47,
  455 + // changanheight: height * 0.83,
  456 + // cedanwidth: width * 0.54,
  457 + // cedanheight: height * 0.79
  458 +
  459 + // })
  460 + // }else {
  461 + // console.log(888)
  462 + // this.setData({
  463 + // pciheight: height * 0.82,
  464 + // attenwidth: width * 0.52,
  465 + // textheight: height * 0.22,
  466 + // codewidth: width * 0.1,
  467 + // codeheight: height * 0.68,
  468 + // codewidth: width * 0.1,
  469 + // codeheight: height * 0.73,
  470 + // changanwidth: width * 0.46,
  471 + // changanheight: height * 0.85,
  472 + // cedanwidth: width * 0.53,
  473 + // cedanheight: height * 0.81
  474 +
  475 + // })
  476 + // }
  477 +
  478 + console.log(this.data.textheight)
  479 +
  480 + this.setData({
  481 + imgwidth: width,
  482 + imgheight: height
  483 + })
  484 + },
  485 +
  486 + /**
  487 + * 生命周期函数--监听页面隐藏
  488 + */
  489 + onHide: function() {
  490 +
  491 + },
  492 +
  493 + /**
  494 + * 生命周期函数--监听页面卸载
  495 + */
  496 + onUnload: function() {
  497 + // wx.navigateTo({
  498 + // url: '/pages/homepage/homepage',
  499 + // })
  500 + },
  501 +
  502 + /**
  503 + * 页面相关事件处理函数--监听用户下拉动作
  504 + */
  505 + onPullDownRefresh: function() {
  506 +
  507 + },
  508 +
  509 + /**
  510 + * 页面上拉触底事件的处理函数
  511 + */
  512 + onReachBottom: function() {
  513 +
  514 + },
  515 +
  516 + /**
  517 + * 用户点击右上角分享
  518 + */
  519 + onShareAppMessage: function() {
  520 + let that = this;
  521 +
  522 + return {
  523 + title: '我的注意力分享', // 转发后 所显示的title
  524 + // path: '/pages/home/buildtextdetail/buildtextdetail?buildid='+buildid+'&gettoken='+newtoken, // 相对的路径
  525 + path: '/pages/parentping/parentping?id=' + that.data.id, //分娩笔记分享2
  526 +
  527 + success: (res) => { // 成功后要做的事情
  528 + console.log(res)
  529 +
  530 + },
  531 + fail: function (res) {
  532 + // 分享失败
  533 + console.log(res)
  534 + }
  535 + }
  536 + }
  537 +})
  1 +<view class="evalute">
  2 + <image src="/img/no.png" mode="widthFix"></image>
  3 + <view class="attentionname">{{title}}</view>
  4 + <view class="attentionlist">
  5 + <view class="attentionlistitem">
  6 + <image src="/img/star.png" wx:if="{{star>=1}}"></image>
  7 + <image src="/img/starkong.png" wx:else></image>
  8 + </view>
  9 + <view class="attentionlistitem">
  10 + <image src="/img/star.png" wx:if="{{star>=2}}"></image>
  11 + <image src="/img/starkong.png" wx:else></image>
  12 + </view>
  13 + <view class="attentionlistitem">
  14 + <image src="/img/star.png" wx:if="{{star>=3}}"></image>
  15 + <image src="/img/starkong.png" wx:else></image>
  16 + </view>
  17 + <view class="attentionlistitem">
  18 + <image src="/img/star.png" wx:if="{{star>=4}}"></image>
  19 + <image src="/img/starkong.png" wx:else></image>
  20 + </view>
  21 + <view class="attentionlistitem">
  22 + <image src="/img/star.png" wx:if="{{star>=5}}"></image>
  23 + <image src="/img/starkong.png" wx:else></image>
  24 + </view>
  25 + </view>
  26 + <view class="attentext">
  27 + {{description}}
  28 + </view>
  29 + <view class="code">
  30 + <view class="codeleft">
  31 + <image src="{{qrcode}}"></image>
  32 + </view>
  33 +
  34 + <view class="coderight">
  35 + <view class="coderighttop">长按识别二维码</view>
  36 + <view class="coderighttopk">获取你的注意力测验单</view>
  37 + </view>
  38 + </view>
  39 +</view>
  40 +
  41 +<view class="sharehai">
  42 + <!-- <view class="shareleft" catchtap="jietu">分享给好友</view> -->
  43 + <view class="shareright" catchtap="savephoto">分享海报</view>
  44 +</view>
  45 +
  46 +
  47 +<!-- 海报 -->
  48 +<view class='pp' bindtap="hideceng">
  49 + <view class='imagePathBox' hidden="{{maskHidden == false}}">
  50 + <image src="{{imagePath}}" class='shengcheng'></image>
  51 + <!-- <button class='baocun' bindtap='baocun'>保存图片至相册</button> -->
  52 + <view class="share">
  53 + <!-- <view class="shareleft" catchtap="jietu">分享给好友</view> -->
  54 + <button class="shareleft" catchtap="share" open-type='share'>分享给好友</button>
  55 + <view class="shareright" catchtap="baocun">保存到相册</view>
  56 + </view>
  57 + </view>
  58 + <view hidden="{{maskHidden == false}}" class="mask"></view>
  59 + <view class="canvas-box">
  60 + <canvas style="width:375px;height:603px;position:fixed;top:9999px;border-radius:56rpx" canvas-id="mycanvas" />
  61 + </view>
  62 +</view>
  1 +page {
  2 + background: #eee;
  3 + width: 750rpx;
  4 + height: 100%;
  5 +
  6 +}
  7 +
  8 +.bigbox {
  9 + height: 100%;
  10 +}
  11 +
  12 +.evalute {
  13 + width: 692rpx;
  14 + height: 1110rpx;
  15 + margin: 0 atuo;
  16 + position: relative;
  17 + background: #fff;
  18 + left:30rpx;
  19 +
  20 +}
  21 +
  22 +image {
  23 + width: 100%;
  24 + height: 100%;
  25 +}
  26 +
  27 +.attentionname {
  28 + color: #fff;
  29 + font-size: 45rpx;
  30 + font-weight: bold;
  31 + position: absolute;
  32 + top:44rpx;
  33 + left: 249rpx;
  34 +}
  35 +
  36 +.attentionlist {
  37 + display: flex;
  38 + align-items: center;
  39 + position: absolute;
  40 + top: 120rpx;
  41 + left: 249rpx;
  42 +}
  43 +
  44 +.attentionlistitem {
  45 + width: 26rpx;
  46 + height: 26rpx;
  47 + font-size: 0;
  48 + margin-right: 10rpx;
  49 +}
  50 +
  51 +.attentext {
  52 + width: 570rpx;
  53 + color: #1b1b1b;
  54 + font-size: 30rpx;
  55 + position: absolute;
  56 + top: 245rpx;
  57 + left: 68rpx;
  58 + font-weight: bold;
  59 + line-height: 1.5;
  60 +}
  61 +
  62 +.code {
  63 + display: flex;
  64 + align-items: center;
  65 + width: 636rpx;
  66 + height: 128rpx;
  67 +
  68 + position: absolute;
  69 + left: 28rpx;
  70 + bottom:16rpx;
  71 +
  72 + padding: 0 16rpx;
  73 + box-sizing: border-box;
  74 +}
  75 +
  76 +.codeleft {
  77 + width: 105rpx;
  78 + height: 105rpx;
  79 + font-size: 0;
  80 +}
  81 +
  82 +.coderight {
  83 + margin-left: 17rpx;
  84 +}
  85 +
  86 +.coderighttop {
  87 + color: #000;
  88 + font-size: 28rpx;
  89 +}
  90 +
  91 +.coderighttopk {
  92 + color: #000;
  93 + font-size: 28rpx;
  94 + margin-top: 10rpx;
  95 +}
  96 +
  97 +.share {
  98 + display: flex;
  99 + align-items: center;
  100 + justify-content: space-between;
  101 +
  102 + width:657rpx;
  103 + margin:20rpx auto 0;
  104 + position: absolute;
  105 + top:1107rpx;
  106 + z-index:999;
  107 + left:47rpx;
  108 + /* position: fixed;
  109 + bottom: 11rpx;
  110 + left: 58rpx; */
  111 +}
  112 +.sharehai{
  113 + display: flex;
  114 + align-items: center;
  115 + justify-content: center;
  116 +
  117 + width:692rpx;
  118 + margin:20rpx auto 0;
  119 +}
  120 +
  121 +.shareleft {
  122 + width: 289rpx;
  123 + height:68rpx;
  124 + color: #ce6198;
  125 + font-size: 28rpx;
  126 + text-align: center;
  127 + line-height: 68rpx;
  128 + background: #fff;
  129 + border-radius: 44rpx;
  130 +}
  131 +
  132 +.shareright {
  133 + width: 289rpx;
  134 + height: 68rpx;
  135 + color: #fff;
  136 + font-size: 28rpx;
  137 + text-align: center;
  138 + line-height:68rpx;
  139 + background: #ce6198;
  140 + border-radius: 44rpx;
  141 + margin-left: 57rpx;
  142 +}
  143 +
  144 +
  145 +.imagePathBox{
  146 + width: 100%;
  147 + height: 100%;
  148 + background: rgba(0,0,0,0.7);
  149 + position: fixed;
  150 + top: 0;
  151 + left: 0;
  152 + right: 0;
  153 + bottom: 0;
  154 + z-index: 10;
  155 +}
  156 +.shengcheng{
  157 + width:650rpx;
  158 + height:1080rpx;
  159 +
  160 + position: fixed;
  161 +
  162 + left: 50%;
  163 + top:570rpx;
  164 + transform: translate(-50%,-50%);
  165 +
  166 + /* margin-left: -40%; */
  167 + z-index: 10;
  168 +}
  169 +.baocun{
  170 + display: block;
  171 + width: 80%;
  172 + height: 92rpx;
  173 + padding: 0;
  174 + line-height: 92rpx;
  175 + text-align: center;
  176 + position: fixed;
  177 + bottom: 18rpx;
  178 + left: 10%;
  179 + background:linear-gradient(180deg,rgba(252,169,162,1) 0%,rgba(255,119,117,1) 100%);
  180 + color: #fff;
  181 + font-size: 32rpx;
  182 + border-radius: 44rpx;
  183 + z-index:999999
  184 +
  185 +}
  186 +button[class="baocun"]::after{
  187 + border: 0;
  188 +}
  189 +.canvas-box{
  190 + word-break: break-word;
  191 + word-wrap: break-word;
  192 +}
  1 +// pages/question/question.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + type: 0,
  10 + quesname: '',
  11 + sela: false,
  12 + selb: false,
  13 + selc: false,
  14 + seld: false,
  15 + kxuan: 2,
  16 + one: 1,
  17 + questionlist: [],
  18 + result: ''
  19 +
  20 + },
  21 +
  22 + /**
  23 + * 生命周期函数--监听页面加载
  24 + */
  25 + onLoad: function(options) {
  26 + this.setData({
  27 + type: options.type
  28 + })
  29 +
  30 + if (options.type == 1) {
  31 + this.setData({
  32 + quesname: '家长评估'
  33 + })
  34 + } else if (options.type == 2) {
  35 + this.setData({
  36 + quesname: '3-6岁测试'
  37 + })
  38 + } else {
  39 + this.setData({
  40 + quesname: '7-12岁测试'
  41 + })
  42 + }
  43 +
  44 + this.getquestionlist()
  45 + },
  46 + // 获取题目列表
  47 + getquestionlist() {
  48 + let that = this;
  49 + var url = 'index/question';
  50 + var params = {
  51 + type: that.data.type
  52 +
  53 + }
  54 + app.post(url, params).then((res) => {
  55 + console.log(res);
  56 + that.setData({
  57 + questionlist: res.list
  58 + })
  59 +
  60 + let newquestionlist = that.data.questionlist;
  61 + for (var i = 0; i < newquestionlist.length; i++) {
  62 + newquestionlist[i].key = ''
  63 + if (i == 0) {
  64 + newquestionlist[i].show = true
  65 + } else {
  66 + newquestionlist[i].show = false
  67 + }
  68 +
  69 + }
  70 +
  71 + that.setData({
  72 + questionlist: newquestionlist
  73 + })
  74 +
  75 + console.log(that.data.questionlist)
  76 +
  77 +
  78 +
  79 + }).catch((err) => {
  80 +
  81 + })
  82 + },
  83 +
  84 +
  85 +
  86 + selyuana(e) {
  87 + let that = this;
  88 + console.log(e)
  89 + this.setData({
  90 + sela: !this.data.sela,
  91 + selb: false,
  92 + selc: false,
  93 + seld: false,
  94 +
  95 + })
  96 + let id = e.currentTarget.dataset.id;
  97 + let daan = e.currentTarget.dataset.answer;
  98 + let newquestionlist = that.data.questionlist;
  99 + for (var obj of newquestionlist) {
  100 + if (obj.id == id) {
  101 + obj.key = daan
  102 + }
  103 + }
  104 +
  105 + that.setData({
  106 + questionlist: newquestionlist
  107 + })
  108 +
  109 + console.log(this.data.questionlist)
  110 +
  111 +
  112 + // obj[id] = daan;
  113 + // let newresult=this.data.result;
  114 + // newresult.push(obj);
  115 + // console.log(newresult);
  116 + },
  117 +
  118 + selyuanb(e) {
  119 + let that = this;
  120 + console.log(e)
  121 + this.setData({
  122 + sela: false,
  123 + selb: !this.data.selb,
  124 + selc: false,
  125 + seld: false,
  126 +
  127 + })
  128 +
  129 + let id = e.currentTarget.dataset.id;
  130 + let daan = e.currentTarget.dataset.answer;
  131 + let newquestionlist = that.data.questionlist;
  132 + for (var obj of newquestionlist) {
  133 + if (obj.id == id) {
  134 + obj.key = daan
  135 + }
  136 +
  137 + }
  138 +
  139 + that.setData({
  140 + questionlist: newquestionlist
  141 + })
  142 +
  143 +
  144 + },
  145 + selyuanc(e) {
  146 + let that = this;
  147 + console.log(e)
  148 + this.setData({
  149 + sela: false,
  150 + selb: false,
  151 + selc: !this.data.selc,
  152 + seld: false,
  153 +
  154 + })
  155 + let id = e.currentTarget.dataset.id;
  156 + let daan = e.currentTarget.dataset.answer;
  157 + let newquestionlist = that.data.questionlist;
  158 + for (var obj of newquestionlist) {
  159 + if (obj.id == id) {
  160 + obj.key = daan
  161 + }
  162 +
  163 + }
  164 +
  165 + that.setData({
  166 + questionlist: newquestionlist
  167 + })
  168 +
  169 +
  170 + },
  171 +
  172 + selyuand(e) {
  173 + console.log(e)
  174 + let that = this;
  175 + this.setData({
  176 + sela: false,
  177 + selb: false,
  178 + selc: false,
  179 + seld: !this.data.seld,
  180 +
  181 + })
  182 +
  183 + let id = e.currentTarget.dataset.id;
  184 + let daan = e.currentTarget.dataset.answer;
  185 + let newquestionlist = that.data.questionlist;
  186 + for (var obj of newquestionlist) {
  187 + if (obj.id == id) {
  188 + obj.key = daan
  189 + }
  190 +
  191 + }
  192 +
  193 + that.setData({
  194 + questionlist: newquestionlist
  195 + })
  196 +
  197 + },
  198 +
  199 + shang(e) {
  200 + let one = this.data.one;
  201 + console.log(one)
  202 + let that = this;
  203 + let preindex = e.currentTarget.dataset.index - 1;
  204 + if (preindex==-1){
  205 + preindex=0
  206 + }
  207 + console.log(preindex)
  208 + let index = that.data.one;
  209 + index = index - 1
  210 + this.setData({
  211 + kxuan: 1,
  212 + one: index,
  213 +
  214 + })
  215 +
  216 + console.log(index)
  217 +
  218 + let newquestionlist = that.data.questionlist;
  219 + for (var i = 0; i < newquestionlist.length; i++) {
  220 +
  221 +
  222 + if (i == preindex) {
  223 + newquestionlist[i].show = true;
  224 +
  225 + console.log(newquestionlist[i])
  226 +
  227 + if (newquestionlist[i].key == 'A') {
  228 + that.setData({
  229 + sela: true,
  230 + selb: false,
  231 + selc: false,
  232 + seld: false,
  233 + })
  234 + } else if (newquestionlist[i].key == 'B') {
  235 + that.setData({
  236 + sela: false,
  237 + selb: true,
  238 + selc: false,
  239 + seld: false,
  240 + })
  241 + } else if (newquestionlist[i].key == 'C') {
  242 + that.setData({
  243 + sela: false,
  244 + selb: false,
  245 + selc: true,
  246 + seld: false,
  247 + })
  248 + } else if (newquestionlist[i].key == 'D') {
  249 + that.setData({
  250 + sela: false,
  251 + selb: false,
  252 + selc: false,
  253 + seld: true,
  254 + })
  255 + }
  256 + } else {
  257 + newquestionlist[i].show = false;
  258 + }
  259 + }
  260 +
  261 + that.setData({
  262 + questionlist: newquestionlist
  263 + })
  264 +
  265 +
  266 +
  267 + if (this.data.one == 0) {
  268 + this.setData({
  269 + one: 1
  270 + })
  271 + wx.showToast({
  272 + title: '已经是第一道题了',
  273 + icon: 'none'
  274 + })
  275 + }
  276 + },
  277 +
  278 + next(e) {
  279 + console.log(e)
  280 + let that = this;
  281 + let preindex = e.currentTarget.dataset.index;
  282 + let index = e.currentTarget.dataset.index + 1;
  283 + console.log(index);
  284 + console.log(preindex)
  285 +
  286 +
  287 + let newquestionlist = that.data.questionlist;
  288 + for (var i = 0; i < newquestionlist.length; i++) {
  289 +
  290 +
  291 +
  292 +
  293 + if (preindex == i) {
  294 + if (newquestionlist[i].key == '') {
  295 + wx.showToast({
  296 + title: '请选择答案',
  297 + icon: 'none'
  298 + })
  299 +
  300 + return false
  301 + }
  302 + }
  303 +
  304 + console.log('484884',index)
  305 + console.log('484884', that.data.questionlist.length - 1)
  306 + if(index==that.data.questionlist.length){
  307 + index = that.data.questionlist.length - 1
  308 + }
  309 + console.log(index)
  310 +
  311 + if (i == index) {
  312 + newquestionlist[i].show = true;
  313 +
  314 + console.log(newquestionlist[i])
  315 +
  316 + if (newquestionlist[i].key == 'A') {
  317 + that.setData({
  318 + sela: true,
  319 + selb: false,
  320 + selc: false,
  321 + seld: false,
  322 + })
  323 + } else if (newquestionlist[i].key == 'B') {
  324 + that.setData({
  325 + sela: false,
  326 + selb: true,
  327 + selc: false,
  328 + seld: false,
  329 + })
  330 + } else if (newquestionlist[i].key == 'C') {
  331 + that.setData({
  332 + sela: false,
  333 + selb: false,
  334 + selc: true,
  335 + seld: false,
  336 + })
  337 + } else if (newquestionlist[i].key == 'D') {
  338 + that.setData({
  339 + sela: false,
  340 + selb: false,
  341 + selc: false,
  342 + seld: true,
  343 + })
  344 + } else {
  345 + that.setData({
  346 + sela: false,
  347 + selb: false,
  348 + selc: false,
  349 + seld: false,
  350 + })
  351 + }
  352 + } else {
  353 + newquestionlist[i].show = false;
  354 + }
  355 + }
  356 +
  357 + that.setData({
  358 + questionlist: newquestionlist
  359 + })
  360 +
  361 + console.log(that.data.questionlist)
  362 + if(index<that.data.questionlist.length){
  363 + index = index + 1
  364 + }
  365 +
  366 +
  367 + this.setData({
  368 + one: index,
  369 + kxuan: 2,
  370 + // sela: false,
  371 + // selb: false,
  372 + // selc: false,
  373 + // seld: false
  374 + })
  375 +
  376 + console.log(that.data.one);
  377 + console.log(that.data.questionlist.length)
  378 +
  379 +
  380 +
  381 + if (that.data.one == that.data.questionlist.length) {
  382 + if (this.data.type == 1) {
  383 +
  384 +
  385 + let answerobj = {}
  386 + let newquestionlist = that.data.questionlist;
  387 + console.log(newquestionlist)
  388 +
  389 + for (var obj of newquestionlist) {
  390 +
  391 + answerobj[obj.id] = obj.key;
  392 +
  393 + }
  394 +
  395 + that.setData({
  396 + result: answerobj
  397 + })
  398 +
  399 + that.dati()
  400 +
  401 +
  402 + } else if (this.data.type == 2) {
  403 +
  404 + let answerobj = {}
  405 + let newquestionlist = that.data.questionlist;
  406 + console.log(newquestionlist)
  407 +
  408 + for (var obj of newquestionlist) {
  409 +
  410 + answerobj[obj.id] = obj.key;
  411 +
  412 + }
  413 +
  414 + that.setData({
  415 + result: answerobj
  416 + })
  417 + that.dati()
  418 +
  419 + } else if (this.data.type == 3) {
  420 + let answerobj = {}
  421 + let newquestionlist = that.data.questionlist;
  422 + console.log(newquestionlist)
  423 +
  424 + for (var obj of newquestionlist) {
  425 +
  426 + answerobj[obj.id] = obj.key;
  427 +
  428 + }
  429 +
  430 + that.setData({
  431 + result: answerobj
  432 + })
  433 +
  434 + that.dati()
  435 + // wx.navigateTo({
  436 + // url: '/pages/attentiontwo/attentiontwo',
  437 + // })
  438 + }
  439 + }
  440 + // if (this.data.one == 3) {
  441 + // this.setData({
  442 + // one:2
  443 + // })
  444 + // if (this.data.type == 1) {
  445 + // wx.navigateTo({
  446 + // url: '/pages/parentping/parentping',
  447 + // })
  448 + // } else if (this.data.type == 2) {
  449 + // wx.navigateTo({
  450 + // url: '/pages/attentionone/attentionone',
  451 + // })
  452 + // } else if (this.data.type == 3) {
  453 + // wx.navigateTo({
  454 + // url: '/pages/attentiontwo/attentiontwo',
  455 + // })
  456 + // }
  457 + // }
  458 +
  459 +
  460 + },
  461 +
  462 + dati() {
  463 + let that = this;
  464 + var url = 'index/add_answer';
  465 + var params = {
  466 + type: that.data.type,
  467 + result: JSON.stringify(that.data.result)
  468 + }
  469 + app.post(url, params).then((res) => {
  470 + console.log(res);
  471 + let id = res.answer_log_id
  472 + if (that.data.type == 1) {
  473 + wx.showToast({
  474 + title: '答题完成',
  475 + icon:"none"
  476 + })
  477 +
  478 + setTimeout(function(){
  479 + wx.navigateTo({
  480 + url: '/pages/parentping/parentping?id=' + id,
  481 + })
  482 + },1500)
  483 +
  484 + } else if (that.data.type == 2) {
  485 + wx.showToast({
  486 + title: '答题完成',
  487 + icon: "none"
  488 + })
  489 +
  490 + setTimeout(function(){
  491 + wx.navigateTo({
  492 + url: '/pages/attentiontwo/attentiontwo?id=' + id,
  493 + })
  494 + },1500)
  495 +
  496 + } else if (that.data.type == 3) {
  497 + wx.showToast({
  498 + title: '答题完成',
  499 + icon:"none"
  500 + })
  501 + setTimeout(function(){
  502 + wx.navigateTo({
  503 + url: '/pages/attentionone/attentionone?id=' + id,
  504 + })
  505 + },1500)
  506 +
  507 + }
  508 +
  509 +
  510 +
  511 +
  512 + }).catch((err) => {
  513 +
  514 + })
  515 +
  516 + },
  517 +
  518 +
  519 +
  520 +
  521 + /**
  522 + * 生命周期函数--监听页面初次渲染完成
  523 + */
  524 + onReady: function() {
  525 +
  526 + },
  527 +
  528 + /**
  529 + * 生命周期函数--监听页面显示
  530 + */
  531 + onShow: function() {
  532 +
  533 + },
  534 +
  535 + /**
  536 + * 生命周期函数--监听页面隐藏
  537 + */
  538 + onHide: function() {
  539 +
  540 + },
  541 +
  542 + /**
  543 + * 生命周期函数--监听页面卸载
  544 + */
  545 + onUnload: function() {
  546 +
  547 + },
  548 +
  549 + /**
  550 + * 页面相关事件处理函数--监听用户下拉动作
  551 + */
  552 + onPullDownRefresh: function() {
  553 +
  554 + },
  555 +
  556 + /**
  557 + * 页面上拉触底事件的处理函数
  558 + */
  559 + onReachBottom: function() {
  560 +
  561 + },
  562 +
  563 + /**
  564 + * 用户点击右上角分享
  565 + */
  566 + onShareAppMessage: function() {
  567 +
  568 + }
  569 +})
  1 +<view class="questop">
  2 + {{quesname}}
  3 + <view class="topnum">{{one}}/{{questionlist.length}}</view>
  4 +</view>
  5 +
  6 +<view class="quesboxpage">
  7 +
  8 + <view class="quesbox" wx:for="{{questionlist}}" wx:key="" wx:if="{{item.show==true}}">
  9 + <view class="quesname">{{index+1}}. {{item.title}} <text wx:if="{{item.red_title!=''}}" class="redtitle">{{item.red_title}}</text></view>
  10 +
  11 + <view class="quesimg" wx:if="{{item.image!=''}}">
  12 + <image src="{{item.image}}" mode="aspectFit"></image>
  13 + </view>
  14 +
  15 + <view class="supply" wx:if="{{item.supply!=''}}">
  16 + <text> {{item.supply}}</text>
  17 +
  18 + </view>
  19 +
  20 + <view class="quesboxlist">
  21 + <view class="quesboxitem {{sela==true?'quesactive':''}}" bindtap="selyuana" data-id="{{item.id}}" data-answer="A">
  22 + <view class="quesboxitemleft" >
  23 + <image src="/img/yesa.png" wx:if="{{sela==true}}"></image>
  24 + <image src="/img/noa.png" wx:else></image>
  25 +
  26 + </view>
  27 + <view class="quesboxitemright {{sela==true?'nametive':''}}">{{item.selectA}}</view>
  28 + </view>
  29 + <view class="quesboxitem {{selb==true?'quesactive':''}}" bindtap="selyuanb" data-id="{{item.id}}" data-answer="B">
  30 + <view class="quesboxitemleft">
  31 + <image src="/img/yesb.png" wx:if="{{selb==true}}"></image>
  32 + <image src="/img/nob.png" wx:else></image>
  33 + </view>
  34 + <view class="quesboxitemright {{selb==true?'nametive':''}}">{{item.selectB}}</view>
  35 + </view>
  36 + <view class="quesboxitem {{selc==true?'quesactive':''}}" bindtap="selyuanc" data-id="{{item.id}}" data-answer="C">
  37 + <view class="quesboxitemleft">
  38 + <image src="/img/yesc.png" wx:if="{{selc==true}}"></image>
  39 + <image src="/img/noc.png" wx:else></image>
  40 + </view>
  41 + <view class="quesboxitemright {{selc==true?'nametive':''}}">{{item.selectC}}</view>
  42 + </view>
  43 + <view class="quesboxitem {{seld==true?'quesactive':''}}" bindtap="selyuand" data-id="{{item.id}}" data-answer="D">
  44 + <view class="quesboxitemleft">
  45 + <image src="/img/yesd.png" wx:if="{{seld==true}}"></image>
  46 + <image src="/img/nod.png" wx:else></image>
  47 + </view>
  48 + <view class="quesboxitemright {{seld==true?'nametive':''}}">{{item.selectD}}</view>
  49 + </view>
  50 +
  51 +
  52 +
  53 + </view>
  54 +
  55 +
  56 + <view class="quesfoot">
  57 + <view class="quesfootleft lef {{kxuan==1?'kactive':''}} " bindtap="shang" data-index="{{index}}" data-id="{{item.id}}">上一题</view>
  58 + <view class="quesfootleft {{kxuan==2?'kactive':''}}" bindtap="next" data-index="{{index}}" data-id="{{item.id}}">下一题</view>
  59 + </view>
  60 + </view>
  61 +</view>
  62 +
  63 +<!-- <view class="quesboxpage" wx:if="{{one==2}}">
  64 + <view class="quesbox">
  65 + <view class="quesname">2. 经常出现不小心打翻、打烂东西、爬楼梯、走路不小心摔跤现象</view>
  66 +
  67 + <view class="quesboxlist">
  68 + <view class="quesboxitem {{sela==true?'quesactive':''}}" bindtap="selyuana" data-id="1">
  69 + <view class="quesboxitemleft">
  70 + <image src="/img/yesa.png" wx:if="{{sela==true}}"></image>
  71 + <image src="/img/noa.png" wx:else></image>
  72 +
  73 + </view>
  74 + <view class="quesboxitemright {{sela==true?'nametive':''}}">从不</view>
  75 + </view>
  76 + <view class="quesboxitem {{selb==true?'quesactive':''}}" bindtap="selyuanb" data-id="2">
  77 + <view class="quesboxitemleft">
  78 + <image src="/img/yesb.png" wx:if="{{selb==true}}"></image>
  79 + <image src="/img/nob.png" wx:else></image>
  80 + </view>
  81 + <view class="quesboxitemright {{selb==true?'nametive':''}}">偶尔</view>
  82 + </view>
  83 + <view class="quesboxitem {{selc==true?'quesactive':''}}" bindtap="selyuanc" data-id="3">
  84 + <view class="quesboxitemleft">
  85 + <image src="/img/yesc.png" wx:if="{{selc==true}}"></image>
  86 + <image src="/img/noc.png" wx:else></image>
  87 + </view>
  88 + <view class="quesboxitemright {{selc==true?'nametive':''}}">经常</view>
  89 + </view>
  90 + <view class="quesboxitem {{seld==true?'quesactive':''}}" bindtap="selyuand" data-id="4">
  91 + <view class="quesboxitemleft">
  92 + <image src="/img/yesd.png" wx:if="{{seld==true}}"></image>
  93 + <image src="/img/nod.png" wx:else></image>
  94 + </view>
  95 + <view class="quesboxitemright {{seld==true?'nametive':''}}">总是</view>
  96 + </view>
  97 + </view>
  98 + </view>
  99 +</view> -->
  1 +.questop {
  2 + width: 750rpx;
  3 + height: 106rpx;
  4 + background: rgba(0, 191, 175, 1);
  5 + box-shadow: 1px 2px 29px 0px rgba(50, 57, 61, 0.24);
  6 + color: #fff;
  7 + font-size: 36rpx;
  8 + text-align: center;
  9 + line-height: 106rpx;
  10 + position: relative;
  11 +}
  12 +
  13 +.topnum {
  14 + color: #fff;
  15 + font-size: 36rpx;
  16 + position: absolute;
  17 + right: 31rpx;
  18 + top: 0;
  19 +}
  20 +
  21 +.quesname {
  22 + /* width: 690rpx; */
  23 + color: #1b1b1b;
  24 + font-size: 28rpx;
  25 + border-bottom: 1rpx solid #d2d2d2;
  26 + margin: 55rpx auto 0;
  27 + padding-bottom: 33rpx;
  28 + box-sizing: border-box;
  29 + font-weight: bold;
  30 + line-height: 1.5;
  31 +}
  32 +
  33 +.quesfoot {
  34 + display: flex;
  35 + align-items: center;
  36 + position: fixed;
  37 + bottom: 0;
  38 + left: 0;
  39 +}
  40 +
  41 +.quesfootleft {
  42 + width: 375rpx;
  43 + height: 81rpx;
  44 + background: rgba(255, 255, 255, 1);
  45 + color: #959595;
  46 + font-size: 30rpx;
  47 + text-align: center;
  48 + line-height: 81rpx;
  49 + border-top:1rpx solid #DCDCDC;
  50 +}
  51 +
  52 +.quesfootright {
  53 + width: 375rpx;
  54 + height: 81rpx;
  55 + background: #00BFAF;
  56 + color:#fff;
  57 + font-size: 30rpx;
  58 + text-align: center;
  59 + line-height: 81rpx;
  60 + border-top:1rpx solid #00BFAF
  61 +}
  62 +.kactive{
  63 + background: #00BFAF;
  64 + color:#fff;
  65 +}
  66 +.quesbox{
  67 + padding: 0 45rpx;
  68 + box-sizing: border-box;
  69 + margin-top:48rpx;
  70 +}
  71 +.quesboxitem{
  72 + display:flex;
  73 + align-items: center;
  74 + padding: 20rpx 10rpx;
  75 + box-sizing: border-box;
  76 + border:2rpx solid #fff;
  77 + /* margin-bottom:61rpx; */
  78 +}
  79 +.quesboxitemleft{
  80 + width:42rpx;
  81 + height:42rpx;
  82 + font-size: 0
  83 +}
  84 +image{
  85 + width:100%;
  86 + height:100%;
  87 +}
  88 +.quesboxitemright{
  89 + color:#535353;
  90 + font-size: 28rpx;
  91 + margin-left:34rpx;
  92 +}
  93 +.quesactive{
  94 + border:2rpx solid rgba(0,191,175,1);
  95 +}
  96 +.nametive{
  97 + color:#00BFAF;
  98 +}
  99 +.lef{
  100 + border-right:1rpx solid #DCDCDC;
  101 +
  102 + }
  103 + .quesboxpage{
  104 + padding-bottom:150rpx;
  105 + }
  106 + .quesboxlist{
  107 + margin-top:20rpx;
  108 + }
  109 + .redtitle{
  110 + color:#FF5A5F;
  111 + font-size: 28rpx;
  112 + font-weight: bold;
  113 + }
  114 + .supply{
  115 + color:#1B1B1B;
  116 + font-size: 35rpx;
  117 + font-weight: bold;
  118 + margin-top:20rpx;
  119 + }
  120 + .quesimg{
  121 + width:672rpx;
  122 + height:342rpx;
  123 + font-size: 0;
  124 + margin:20rpx auto 0;
  125 + }
  1 +{
  2 + "description": "项目配置文件",
  3 + "packOptions": {
  4 + "ignore": []
  5 + },
  6 + "setting": {
  7 + "urlCheck": true,
  8 + "es6": true,
  9 + "postcss": true,
  10 + "minified": true,
  11 + "newFeature": true,
  12 + "autoAudits": false,
  13 + "checkInvalidKey": true
  14 + },
  15 + "compileType": "miniprogram",
  16 + "libVersion": "2.9.4",
  17 + "appid": "wx9f9310ed9be8c3e0",
  18 + "projectname": "attentionceshi",
  19 + "debugOptions": {
  20 + "hidedInDevtools": []
  21 + },
  22 + "isGameTourist": false,
  23 + "simulatorType": "wechat",
  24 + "simulatorPluginLibVersion": {},
  25 + "condition": {
  26 + "search": {
  27 + "current": -1,
  28 + "list": []
  29 + },
  30 + "conversation": {
  31 + "current": -1,
  32 + "list": []
  33 + },
  34 + "plugin": {
  35 + "current": -1,
  36 + "list": []
  37 + },
  38 + "game": {
  39 + "currentL": -1,
  40 + "list": []
  41 + },
  42 + "miniprogram": {
  43 + "current": 5,
  44 + "list": [
  45 + {
  46 + "id": -1,
  47 + "name": "关于蛋壳",
  48 + "pathName": "pages/aboutdanke/aboutdanke",
  49 + "query": "",
  50 + "scene": null
  51 + },
  52 + {
  53 + "id": -1,
  54 + "name": "结果",
  55 + "pathName": "pages/parentping/parentping",
  56 + "query": "",
  57 + "scene": null
  58 + },
  59 + {
  60 + "id": -1,
  61 + "name": "家长",
  62 + "pathName": "pages/parentping/parentping",
  63 + "query": "",
  64 + "scene": null
  65 + },
  66 + {
  67 + "id": -1,
  68 + "name": "保存图片",
  69 + "pathName": "pages/attentiontwo/attentiontwo",
  70 + "query": "",
  71 + "scene": null
  72 + },
  73 + {
  74 + "id": -1,
  75 + "name": "注意力七",
  76 + "pathName": "pages/attentionone/attentionone",
  77 + "query": "",
  78 + "scene": null
  79 + },
  80 + {
  81 + "id": -1,
  82 + "name": "家长测试结果",
  83 + "pathName": "pages/parentping/parentping",
  84 + "scene": null
  85 + }
  86 + ]
  87 + }
  88 + }
  89 +}
  1 +{
  2 + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
  3 + "rules": [{
  4 + "action": "allow",
  5 + "page": "*"
  6 + }]
  7 +}
  1 +const formatTime = date => {
  2 + const year = date.getFullYear()
  3 + const month = date.getMonth() + 1
  4 + const day = date.getDate()
  5 + const hour = date.getHours()
  6 + const minute = date.getMinutes()
  7 + const second = date.getSeconds()
  8 +
  9 + return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
  10 +}
  11 +
  12 +const formatNumber = n => {
  13 + n = n.toString()
  14 + return n[1] ? n : '0' + n
  15 +}
  16 +
  17 +module.exports = {
  18 + formatTime: formatTime
  19 +}