init project

This commit is contained in:
limqhz
2020-06-21 16:27:58 +08:00
commit e8fe10b5fb
178 changed files with 9964 additions and 0 deletions

93
pages/questions/index.js Normal file
View File

@@ -0,0 +1,93 @@
// pages/questions/index.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
questions: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
app.$api.faqs({}).then(res => {
this.setData({
questions: res.faqs
})
}, err => {
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return {
title: '智慧云馆'
}
},
// 打开答案
openAnswer(e) {
let index = e.currentTarget.dataset.index;
let list = [];
for (let i = 0; i < this.data.questions.length; i++) {
let item = this.data.questions[i]
if (i == index) {
item.isOpenAnswer = !item.isOpenAnswer;
} else {
item.isOpenAnswer = false;
}
list.push(item)
}
this.setData({
questions: list
})
}
})

View File

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "常见问题",
"usingComponents": {
"header": "/component/header/header"
}
}

View File

@@ -0,0 +1,14 @@
<!--pages/questions/index.wxml-->
<header title="常见问题"></header>
<view class='container'>
<view class='body'>
<view class='cell' wx:for="{{questions}}" wx:key="{{index}}">
<view class='question' bindtap='openAnswer' data-index='{{index}}'>
<text>{{index + 1}}. {{item.problem}}</text>
<image src='../../images/48@3x.png' wx:if="{{item.isOpenAnswer}}"></image>
<image src='../../images/49@3x.png' wx:else></image>
</view>
<view class='answer' wx:if="{{item.isOpenAnswer}}">{{item.answer}}</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,40 @@
/* pages/questions/index.wxss */
.container {
padding: 20rpx;
padding-top: 150rpx;
min-height: calc(100vh - 170rpx);
}
.body {
background: #1a191e;
border-radius: 10rpx;
}
.body .cell {
overflow: hidden;
border-bottom: 2rpx solid #212025;
}
.body .cell .question {
display: flex;
justify-content: space-between;
align-items: center;
height: 90rpx;
padding: 0 20rpx;
color: #fff;
font-size: 24rpx;
}
.body .cell .question>image {
width: 22rpx;
height: 12rpx;
}
.body .cell .answer {
padding: 50rpx;
border-top: 2rpx solid #212025;
color: rgba(255, 255, 255, 0.6);
font-size: 22rpx;
line-height: 38rpx;
}