页面修改

master
kefei 6 years ago
parent d472f5a24b
commit c641c95000

@ -0,0 +1,14 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/

@ -0,0 +1,41 @@
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null
}
})

@ -1,11 +1,16 @@
{
"pages": [
"pages/shouye/shouye",
"pages/index/index",
"pages/logs/logs",
"pages/fenlei/fenlei",
"pages/gouwu/gouwu",
"pages/wode/wode"
"pages/wode/wode",
"pages/detail/detail",
"pages/shdz/shdz"
],
"window": {
"backgroundTextStyle": "light",

@ -1,6 +1,4 @@
/**app.wxss**/
@import 'weui.wxss';
@import "html-view/index.wxss";
.container {
height: 100%;
display: flex;
@ -10,11 +8,3 @@
padding: 200rpx 0;
box-sizing: border-box;
}
.containers {
height: 100%;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}

@ -1,79 +0,0 @@
const html5Entities = require('../vendors/html5-entities')
const { windowWidth } = wx.getSystemInfoSync()
module.exports = item => {
// decode html entities
if (item.type === 'Text') {
item.content = html5Entities.decode(item.content)
return
}
// <video> and <audio>
if (item.tagName === 'video' || item.tagName === 'audio') {
item.wxTag = item.tagName
if (!item.attributes.src) {
item.children.some(child => {
if (child.tagName === 'source') {
item.attributes.src = child.attributes.src
return true
}
return false
})
}
return
}
// <br>
if (item.tagName === 'br') {
item.wxTag = 'text'
item.children = [{ type: 'Text', content: '\n' }]
return
}
// other tags
if (['b', 'big', 'i', 'small', 'tt', 'abbr', 'acronym', 'cite', 'code', 'dfn', 'em', 'kbd', 'strong', 'samp', 'time', 'var', 'a', 'bdo', 'map', 'object', 'q', 'script', 'span', 'sub', 'sup', 'button', 'input', 'label', 'select', 'textarea'].indexOf(item.tagName) !== -1) {
item.wxTag = 'text'
} else {
item.wxTag = 'view'
}
// <img>
if (item.tagName === 'img') {
item.wxTag = 'image'
let width, height
if (!item.attributes.style) item.attributes.style = {}
if (item.attributes.style.width && item.attributes.style.width.indexOf('px')) {
width = item.attributes.style.width.slice(0, -2)
} else if (item.attributes.width) {
width = item.attributes.width
}
if (item.attributes.style.height && item.attributes.style.height.indexOf('px')) {
height = item.attributes.style.height.slice(0, -2)
} else if (item.attributes.height) {
height = item.attributes.height
}
if (item.attributes.style) {
delete item.attributes.style.width
delete item.attributes.style.height
}
delete item.attributes.width
delete item.attributes.height
if (width && width < windowWidth) {
item.attributes.style.width = width + 'px'
if (height) item.attributes.style.height = height + 'px'
}
}
// generate inline style string
if (item.attributes && item.attributes.style) {
item.attributes.styleString = Object.keys(item.attributes.style).map(key => key + ': ' + item.attributes.style[key]).join(';')
}
}

@ -1,12 +0,0 @@
// 七牛图片裁剪
const { pixelRatio, windowWidth } = wx.getSystemInfoSync()
const width = pixelRatio * windowWidth
module.exports = (domain, quality) =>
item => {
if (item.tagName === 'img' && item.attributes.src.indexOf(domain) !== -1 && item.attributes.src.indexOf('?') === -1) {
item.attributes.src += '?imageView2/2/w/' + width
if (quality) item.attributes.src += '/q/' + quality
}
}

@ -1,19 +0,0 @@
// <a> to <navigator>
const url = require('../vendors/url')
const Router = require('../vendors/Router')
module.exports = (domain, routes) =>
item => {
if (item.tagName === 'a') {
const u = url.parse(item.attributes.href)
if (u.hostname === domain) {
const router = new Router(routes)
const route = router.match(u.pathname)
if (route) {
item.wxTag = 'navigator'
item.url = url.format({ pathname: route.path, query: Object.assign(u.query, route.params, route.options) })
}
}
}
}

@ -1,10 +0,0 @@
const { resolve } = require('../vendors/url')
module.exports = baseUrl =>
item => {
if (['img', 'video', 'audio', 'source'].indexOf(item.tagName) !== -1) {
if (item.attributes.src) item.attributes.src = resolve(baseUrl, item.attributes.src)
} else if (item.tagName === 'a') {
item.attributes.href = resolve(baseUrl, item.attributes.href)
}
}

@ -1,52 +0,0 @@
const himalaya = require('./vendors/himalaya')
const defaultEachFn = require('./each/default')
const resolveUrl = require('./each/resolveUrl')
class HtmlParser {
constructor(html, { baseUrl } = {}) {
this.nodes = himalaya.parse(html)
if (baseUrl) this.each(resolveUrl(baseUrl))
this.each(defaultEachFn)
}
each(fn) {
this._each(fn, this.nodes)
return this
}
_each(fn, nodes) {
nodes.forEach((item, ...args) => {
fn(item, ...args)
if (item.children) this._each(fn, item.children)
})
}
filter(fn) {
this.nodes = this._filter(fn, this.nodes)
return this
}
_filter(fn, nodes) {
return nodes.filter((item, ...args) => {
const result = fn(item, ...args)
if (result && item.children) item.children = this._filter(fn, item.children)
return result
})
}
map(fn) {
this.nodes = this._map(fn, this.nodes)
return this
}
_map(fn, nodes) {
return nodes.map((item, ...args) => {
item = fn(item, ...args)
if (item.children) item.children = this._map(fn, item.children)
return item
})
}
}
module.exports = HtmlParser

@ -1,7 +0,0 @@
<import src="nodes.wxml" />
<template name="html-view">
<view class="html-view">
<template is="html-view-nodes" data="{{nodes: data}}" />
</view>
</template>

@ -1,21 +0,0 @@
@import "reset.wxss";
.html-view {
font-size: 36rpx;
color: #333;
line-height: 1.6;
overflow-wrap: break-word;
}
.img, .video {
width: 100%;
}
.table {
border-collapse: collapse;
}
.th, .td {
border: 1rpx solid #333;
padding: 10rpx;
}

@ -1,241 +0,0 @@
<template name="html-view-nodes">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-1" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-1" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-1" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-1">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-2" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-2" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-2" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-2">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-3" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-3" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-3" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-3">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-4" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-4" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-4" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-4">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-5" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-5" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-5" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-5">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-6" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-6" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-6" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-6">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-7" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-7" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-7" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-7">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-8" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-8" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-8" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-8">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-9" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-9" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-9" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-9">
<block wx:for="{{nodes}}" wx:key="">
<block wx:if="{{item.type === 'Text'}}">{{item.content}}</block>
<block wx:elif="{{item.type === 'Element'}}">
<view wx:if="{{item.wxTag === 'view'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-10" data="{{nodes: item.children}}" />
</view>
<text wx:elif="{{item.wxTag === 'text'}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-10" data="{{nodes: item.children}}" />
</text>
<navigator wx:elif="{{item.wxTag === 'navigator'}}" url="{{item.url}}" class="{{item.tagName}} {{item.attributes.className}}" style="{{item.attributes.styleString}}">
<template is="html-view-nodes-10" data="{{nodes: item.children}}" />
</navigator>
<image wx:if="{{item.wxTag === 'image'}}" src="{{item.attributes.src}}" class="img" mode="widthFix" style="{{item.attributes.styleString}}" />
<video wx:elif="{{item.wxTag === 'video'}}" src="{{item.attributes.src}}" class="video"></video>
<audio wx:elif="{{item.wxTag === 'audio'}}" src="{{item.attributes.src}}" class="audio" controls></audio>
</block>
</block>
</template>
<template name="html-view-nodes-10"></template>

@ -1,306 +0,0 @@
/*
css reset
based on https://chromium.googlesource.com/chromium/blink/+/master/Source/core/css/html.css
*/
.html {
display: block;
}
/* children of the <head> element all have display:none */
.head {
display: none;
}
.meta {
display: none;
}
.title {
display: none;
}
.link {
display: none;
}
.style {
display: none;
}
.script {
display: none;
}
/* generic block-level elements */
.body {
display: block;
margin: 8rpx;
}
.p {
display: block;
margin: 1em 0;
}
.div {
display: block;
}
.layer {
display: block;
}
.article, .aside, .footer, .header, .hgroup, .main, .nav, .section {
display: block;
}
.marquee {
display: inline-block;
}
.address {
display: block;
}
.blockquote {
display: block;
margin: 1em 40rpx;
}
.figcaption {
display: block;
}
.figure {
display: block;
margin: 1em 40rpx;
}
.q {
display: inline;
}
.q:before {
content: open-quote;
}
.q:after {
content: close-quote;
}
.center {
display: block;
text-align: center;
}
.hr {
display: block;
margin: 0.5em 0;
border: 1rpx inset;
}
.map {
display: inline;
}
/* heading elements */
.h1 {
display: block;
font-size: 2em;
font-weight: bold;
margin: 0.67em 0;
}
.h2 {
display: block;
font-size: 1.5em;
font-weight: bold;
margin: 0.83em 0;
}
.h3 {
display: block;
font-size: 1.17em;
font-weight: bold;
margin: 1em 0;
}
.h4 {
display: block;
font-weight: bold;
margin: 1.33em 0;
}
.h5 {
display: block;
font-size: 0.83em;
font-weight: bold;
margin: 1.67em 0;
}
.h6 {
display: block;
font-size: 0.67em;
font-weight: bold;
margin: 2.33em 0;
}
/* tables */
.table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: gray;
}
.thead {
display: table-header-group;
vertical-align: middle;
border-color: inherit;
}
.tbody {
display: table-row-group;
vertical-align: middle;
border-color: inherit;
}
.tfoot {
display: table-footer-group;
vertical-align: middle;
border-color: inherit;
}
.col {
display: table-column;
}
.colgroup {
display: table-column-group;
}
.tr {
display: table-row;
vertical-align: inherit;
border-color: inherit
}
.td, .th {
display: table-cell;
vertical-align: inherit;
}
.th {
font-weight: bold;
}
.caption {
display: table-caption;
text-align: center;
}
/* lists */
.ul, .menu, .dir {
list-style-type: disc;
margin: 1em 0;
padding-left: 40rpx;
}
.ol {
display: block;
list-style-type: decimal;
margin: 1em 0;
padding-left: 40rpx;
}
.li {
display: list-item;
text-align: match-parent;
}
.ul .ul, .ol .ul {
list-style-type: circle
}
.ol .ol .ul, .ol .ul .ul, .ul .ol .ul, .ul .ul .ul {
list-style-type: square;
}
.dd {
display: block;
margin-left: 40rpx;
}
.dl {
display: block;
margin: 1em 0;
}
.dt {
display: block
}
.ol .ul, .ul .ol, .ul .ul, .ol .ol {
margin: 0;
}
/* inline elements */
.u, .ins {
text-decoration: underline;
}
.strong, .b {
font-weight: bold;
}
.i, .cite, .em, .var, .address, .dfn {
font-style: italic;
}
.tt, .code, .kbd, .samp {
font-family: monospace;
}
.pre, .xmp, .plaintext, .listing {
display: block;
font-family: monospace;
white-space: pre;
margin: 1em 0;
}
.mark {
background-color: yellow;
color: black;
}
.big {
font-size: larger;
}
.small {
font-size: smaller;
}
.s, .strike, .del {
text-decoration: line-through;
}
.sub {
vertical-align: sub;
font-size: smaller;
}
.sup {
vertical-align: super;
font-size: smaller;
}
.nobr {
white-space: nowrap;
}

@ -1,198 +0,0 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['module', 'exports'], factory);
} else if (typeof exports !== "undefined") {
factory(module, exports);
} else {
var mod = {
exports: {}
};
factory(mod, mod.exports);
global.Router = mod.exports;
}
})(this, function (module, exports) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var Router = function () {
function Router(conf) {
_classCallCheck(this, Router);
this.routes = {};
if (conf.constructor === Array) conf = { ALL: conf };
for (var method in conf) {
var routes = conf[method];
var rts = this.routes[method] = {
string: {},
regex: []
};
var _loop = function _loop() {
if (_isArray) {
if (_i >= _iterator.length) return 'break';
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) return 'break';
_ref = _i.value;
}
var _rt = _ref;
var pattern = void 0,
replacement = void 0,
params = void 0,
options = void 0;
if (_rt.constructor === String) {
pattern = _rt;
replacement = '$&';
params = [];
options = {};
} else {
var rt = _rt.concat();
pattern = rt.shift();
replacement = rt.shift() || '$&';
options = _typeof(rt[rt.length - 1]) == 'object' ? rt.pop() : {};
params = rt;
}
if (pattern.constructor === RegExp) {
rts.regex.push({
pattern: pattern,
replacement: replacement,
params: params,
options: options,
origin: _rt
});
} else {
if (!/:|\*|\$/.test(pattern)) {
rts.string[pattern] = {
replacement: replacement === '$&' ? pattern : replacement,
options: options,
origin: _rt
};
} else {
params = [];
pattern = pattern.replace(/[\\&()+.[?^{|]/g, '\\$&').replace(/:(\w+)/g, function (str, key) {
params.push(key);
return '([^/]+)';
}).replace(/\*/g, '.*');
rts.regex.push({
pattern: new RegExp('^' + pattern + '$'),
replacement: replacement,
params: params,
options: options,
origin: _rt
});
}
}
};
for (var _iterator = routes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
var _ret = _loop();
if (_ret === 'break') break;
}
}
}
Router.prototype.match = function match(path) {
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ALL';
var rts = this.routes[method];
if (rts) {
if (rts.string[path]) {
var match = {
path: rts.string[path].replacement,
params: {},
options: rts.string[path].options,
origin: rts.string[path].origin
};
if (Router.log) {
console.log('path:', path, '\n', 'method:', method, '\n', 'match:', match); // eslint-disable-line
}
return match;
}
var _replacement = void 0;
var _params = {};
for (var _iterator2 = rts.regex, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var rt = _ref2;
var matches = path.match(rt.pattern);
if (matches) {
_replacement = rt.replacement;
if (_replacement.indexOf('$') !== -1) {
_replacement = _replacement === '$&' ? path : path.replace(rt.pattern, _replacement);
}
matches.shift();
for (var j = 0; j < rt.params.length; j++) {
if (rt.params[j]) {
_params[rt.params[j]] = matches[j];
}
}
var _match = {
path: _replacement,
params: _params,
options: rt.options,
origin: rt.origin
};
if (Router.log) {
console.log('path:', path, '\n', 'method:', method, '\n', 'match:', _match); // eslint-disable-line
}
return _match;
}
}
}
if (Router.log) {
console.log('path:', path, '\n', 'method:', method, '\n', 'match:', null); // eslint-disable-line
}
return method === 'ALL' ? null : this.match(path);
};
return Router;
}();
exports.default = Router;
module.exports = exports['default'];
});

@ -1,317 +0,0 @@
(function() {
var root = this;
var tagStart = '<';
var tagEnd = '>';
var commentStart = '<!--';
var commentEnd = '-->';
var voidTags = [
"!doctype", "area", "base", "br", "col", "command",
"embed", "hr", "img", "input", "keygen", "link",
"meta", "param", "source", "track", "wbr"
];
var closingTags = [
"colgroup", "dd", "dt", "li", "options", "p",
"td", "tfoot", "th", "thead", "tr"
];
var childlessTags = ['style', 'script', 'template'];
function parse(str) {
return parseUntil(str + '</root>', ['root']).nodes;
}
function parseUntil(str, stack) {
var nodes = [];
while (str.length) {
var nextTag = str.indexOf(tagStart);
if (nextTag === -1) {
// only text left
nodes.push({
type: 'Text',
content: str
});
str = '';
break;
}
if (nextTag) {
// text before tag
nodes.push({
type: 'Text',
content: str.slice(0, nextTag)
});
str = str.slice(nextTag);
continue;
}
if (startsWithCommentStart(str)) {
// comment
var end = str.indexOf(commentEnd);
nodes.push({
type: 'Comment',
content: str.slice(commentStart.length, end)
});
str = str.slice(end + commentEnd.length);
continue;
}
var isClosingTag = str.charAt(nextTag + 1) === '/';
if (isClosingTag) {
var endTagEnd = str.indexOf(tagEnd);
var innerTag = str.slice(2, endTagEnd);
var tagName = innerTag.trim().split(' ')[0];
str = str.slice(endTagEnd + 1);
var loc = stack.lastIndexOf(tagName);
if (~loc) {
stack = stack.slice(0, loc);
break;
}
continue;
}
// open tag
var results = parseTag(str, stack);
if (results.tag) {
results.tag.type = 'Element';
nodes.push(results.tag);
str = results.str;
}
if (results.stack.length !== stack.length) {
stack = results.stack;
break;
}
}
return {
nodes: nodes,
stack: stack,
str: str
};
}
function parseTag(str, stack) {
var idxTagEnd = str.indexOf(tagEnd);
var idxSpace = str.indexOf(' ');
var tagNameEnd = ~idxSpace ?
Math.min(idxTagEnd, idxSpace) :
idxTagEnd;
var tagName = str.slice(1, tagNameEnd);
var lowTagName = tagName.toLowerCase();
if (stack[stack.length - 1] === tagName && ~closingTags.indexOf(lowTagName)) {
return {
stack: stack.slice(0, -1)
};
}
var attrs = parseAttrs(str.slice(tagNameEnd));
var tag = {
tagName: tagName,
attributes: attrs.attributes
};
str = attrs.str;
if (startsWithSelfClose(str)) {
str = str.slice(2);
} else {
str = str.slice(1);
if (~childlessTags.indexOf(lowTagName)) {
var end = '</' + tagName + '>';
var idx = str.indexOf(end);
if (!~idx) idx = Infinity;
tag.content = str.slice(0, idx);
str = str.slice(idx);
} else if (!~voidTags.indexOf(lowTagName)) {
var results = parseUntil(str, stack.concat(tagName));
tag.children = results.nodes;
str = results.str;
stack = results.stack;
}
}
return {
tag: tag,
str: str,
stack: stack
};
}
function parseAttrs(str) {
str = str.trim();
var results = tagPairs(str, 0);
str = str.slice(results.cursor);
var attributes = results.kvs.map(function(pair) {
var kv = splitHead(pair.trim(), '=');
kv[1] = kv[1] ? unquote(kv[1]) : kv[0];
return kv;
}).reduce(function(attrs, kv) {
var property = kv[0];
var value = kv[1];
if (property === 'class') {
attrs.className = value.split(' ');
} else if (property === 'style') {
attrs.style = parseStyle(value);
} else if (startsWithDataDash(property)) {
attrs.dataset = attrs.dataset || {};
var key = camelCase(property.slice(5));
attrs.dataset[key] = castValue(value);
} else {
attrs[camelCase(property)] = castValue(value);
}
return attrs;
}, {});
return {
str: str,
attributes: attributes
};
}
function splitHead(str, sep) {
var idx = str.indexOf(sep);
if (idx === -1) return [str];
return [str.slice(0, idx), str.slice(idx + sep.length)];
}
function tagPairs(str, index) {
var words = []; // "key", "key=value", "key='value'", etc
var quote = null; // null, single-, or double-quote
var cursor = index; // index of parse into str
var wordBegin = cursor; // index of word start
var len = str.length;
while(cursor < len) {
var char = str.charAt(cursor);
var isTagEnd = !quote && (char === '/' || char === tagEnd);
if (isTagEnd) {
if (cursor !== wordBegin) {
words.push(str.slice(wordBegin, cursor));
}
break;
}
var isWordEnd = !quote && char === ' ';
if (isWordEnd) {
if (cursor !== wordBegin) {
words.push(str.slice(wordBegin, cursor));
}
wordBegin = cursor + 1;
cursor++;
continue;
}
var isQuoteEnd = char === quote;
if (isQuoteEnd) {
quote = null;
cursor++;
continue;
}
var isQuoteStart = !quote && (char === '\'' || char === '"');
if (isQuoteStart) {
quote = char;
cursor++;
continue;
}
cursor++;
}
var attrs = [];
var wLen = words.length;
for (var i = 0; i < wLen; i++) {
var word = words[i];
if (!(word && word.length)) continue;
var isNotPair = word.indexOf('=') === -1;
if (isNotPair) {
var secondWord = words[i + 1];
var thirdWord = words[i + 2];
var isSpacedPair = secondWord === '=' && thirdWord;
if (isSpacedPair) {
var newWord = word + '=' + thirdWord;
attrs.push(newWord);
i += 2;
continue;
}
}
attrs.push(word);
}
return {
cursor: cursor,
kvs: attrs
};
}
function unquote(str) {
var car = str.charAt(0);
var end = str.length - 1;
if (car === '"' || car === "'" && car === str.charAt(end)) {
return str.slice(1, end);
}
return str;
}
function parseStyle(str) {
return str.trim().split(';').map(function(statement) {
return statement.trim().split(':');
}).reduce(function(styles, kv) {
if (kv[1]) styles[camelCase(kv[0].trim())] = castValue(kv[1].trim());
return styles;
}, {});
}
function camelCase(str) {
return str.split('-').reduce(function(str, word) {
return str + word.charAt(0).toUpperCase() + word.slice(1);
});
}
function castValue(str) {
if (typeof str !== 'string') return str;
var num = +str;
if (!isNaN(num)) return num;
return str;
}
function startsWithCommentStart(s) {
return (
s.charAt(0) === '<' &&
s.charAt(1) === '!' &&
s.charAt(2) === '-' &&
s.charAt(3) === '-');
}
function startsWithSelfClose(s) {
return (
s.charAt(0) === '/' &&
s.charAt(1) === '>');
}
function startsWithDataDash(s) {
return (
s.charAt(0) === 'd' &&
s.charAt(1) === 'a' &&
s.charAt(2) === 't' &&
s.charAt(3) === 'a' &&
s.charAt(4) === '-');
}
var himalaya = {
parse: parse,
parseTag: parseTag,
parseUntil: parseUntil,
parseAttrs: parseAttrs,
parseStyle: parseStyle
};
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = himalaya;
}
exports.himalaya = himalaya;
} else {
root.himalaya = himalaya;
}
}).call(this);

File diff suppressed because one or more lines are too long

@ -1,186 +0,0 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['module', 'exports'], factory);
} else if (typeof exports !== "undefined") {
factory(module, exports);
} else {
var mod = {
exports: {}
};
factory(mod, mod.exports);
global.url = mod.exports;
}
})(this, function (module, exports) {
'use strict';
exports.__esModule = true;
function parseQuery(str) {
var query = {};
if (str.length) {
str.replace(/\+/g, ' ').split('&').forEach(function (s) {
var pair = s.split('=');
var key = decodeURIComponent(pair[0]);
var val = pair.length === 1 ? '' : decodeURIComponent(pair[1]);
if (query[key] == null) {
query[key] = val;
} else {
if (query[key].constructor !== Array) query[key] = [query[key]];
query[key].push(val);
}
});
}
return query;
}
function formatQuery(obj) {
var str = '';
var _loop = function _loop(p) {
var key = encodeURIComponent(p);
[].concat(obj[p]).forEach(function (val) {
if (val == null) return;
str += '&' + key;
if (val !== '') str += '=' + encodeURIComponent(val);
});
};
for (var p in obj) {
_loop(p);
}
return str.slice(1);
}
function parse(str) {
var m = /^(?:([^:/?#]+:))?(?:\/\/(?:(([^:@]*)(?::([^:@]*))?)?@)?(([^:/?#]*)(?::(\d*))?))?(((?:[^?#/]*\/)*[^?#]*)(?:(\?[^#]*))?)(?:(#.*))?/.exec(str);
var url = {};['href', 'protocol', 'auth', 'username', 'password', 'host', 'hostname', 'port', 'path', 'pathname', 'search', 'hash'].forEach(function (key, i) {
return url[key] = m[i] || '';
});
if (!url.path && !url.pathname) url.path = url.pathname = '/';
url.query = parseQuery(url.search.slice(1));
return url;
}
function format() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$protocol = _ref.protocol,
protocol = _ref$protocol === undefined ? '' : _ref$protocol,
_ref$auth = _ref.auth,
auth = _ref$auth === undefined ? '' : _ref$auth,
_ref$username = _ref.username,
username = _ref$username === undefined ? '' : _ref$username,
_ref$password = _ref.password,
password = _ref$password === undefined ? '' : _ref$password,
_ref$host = _ref.host,
host = _ref$host === undefined ? '' : _ref$host,
_ref$hostname = _ref.hostname,
hostname = _ref$hostname === undefined ? '' : _ref$hostname,
_ref$port = _ref.port,
port = _ref$port === undefined ? '' : _ref$port,
_ref$path = _ref.path,
path = _ref$path === undefined ? '' : _ref$path,
_ref$pathname = _ref.pathname,
pathname = _ref$pathname === undefined ? '' : _ref$pathname,
_ref$search = _ref.search,
search = _ref$search === undefined ? '' : _ref$search,
_ref$query = _ref.query,
query = _ref$query === undefined ? null : _ref$query,
_ref$hash = _ref.hash,
hash = _ref$hash === undefined ? '' : _ref$hash;
var str = '';
if (protocol) {
str += protocol;
if (protocol.slice(-1) !== ':') str += ':';
}
if (protocol || host || hostname) str += '//';
if (host || hostname) {
if (auth) {
str += auth + '@';
} else if (username) {
str += username;
if (password) str += ':' + password;
str += '@';
}
if (host) {
str += host;
} else {
str += hostname;
if (port) str += ':' + port;
}
}
if (path) {
str += path;
} else {
str += pathname || '/';
if (search) {
str += search;
} else if (query) {
var q = formatQuery(query);
if (q) str += '?' + q;
}
}
str += hash;
return str;
}
function resolve(from, to) {
from = parse(from);
to = parse(to);
// 'to' is an absolute URL
if (to.protocol) return to.href;
// 'to' only need to complete the protocol
if (to.host) {
to.protocol = from.protocol;
return format(to);
}
// 'to' has aboslute path
if (to.path[0] === '/') {
from.path = to.path;
from.pathname = from.search = '';
from.query = null;
from.hash = to.hash;
return format(from);
}
if (to.pathname) {
(function () {
var dirFrom = from.pathname.split('/');
// pop the filename
dirFrom.pop();
to.pathname.split('/').forEach(function (d) {
switch (d) {
case '.':
return;
case '..':
return dirFrom.length > 1 ? dirFrom.pop() : null;
default:
dirFrom.push(d);
}
});
from.pathname = dirFrom.join('/');
})();
}
from.path = '';
from.search = to.search;
from.query = null;
from.hash = to.hash;
return format(from);
}
exports.default = { parse: parse, format: format, resolve: resolve, parseQuery: parseQuery, formatQuery: formatQuery };
module.exports = exports['default'];
});

@ -0,0 +1,39 @@
Page({
data: {
isLike: true,
// banner
imgUrls: [
"/pages/index/image/suanfa.jpg"
],
// 商品详情介绍
detailImg: [
"/pages/index/image/suanfa.jpg"
],
},
//预览图片
previewImage: function (e) {
var current = e.target.dataset.src;
wx.previewImage({
current: current, // 当前显示图片的http链接
urls: this.data.imgUrls // 需要预览的图片http链接列表
})
},
// 跳到购物车
addCar() {
wx.switchTab({
url: '/pages/gouwu/gouwu'
})
},
// 立即购买
immeBuy() {
wx.showToast({
title: '购买成功',
icon: 'success',
duration: 2000
});
},
})

@ -0,0 +1,32 @@
<!--pages/detail/detail.wxml-->
<!-- banner -->
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrls}}">
<swiper-item>
<image src="{{item}}" data-src="{{item}}" bindtap="previewImage"></image>
</swiper-item>
</block>
</swiper>
<scroll-view scroll-y="true">
<view class="detail">
<text class="title">算法设计</text>
<text class="price">¥20</text>
</view>
<view class="separate"></view>
<!-- sku选择 -->
<text bindtap="toggleDialog">请选择购买数量</text>
<view class="separate"></view>
<text>商品评价</text>
<view class="separate"></view>
<text>商品详情</text>
<block wx:for-items="{{detailImg}}" wx:key="name">
<image class="image_detail" src="{{item}}" />
</block>
<view class="temp"></view>
</scroll-view>
<!-- 底部悬浮栏 -->
<view class="detail-nav">
<view class="line_nav"></view>
<button class="button-green" bindtap="addCar" formType="submit">加入购物车</button>
<button class="button-red" bindtap="immeBuy" formType="submit">立即购买</button>
</view>

@ -0,0 +1,106 @@
/* pages/detail/detail.wxss */
page {
display: flex;
flex-direction: column;
height: 100%;
}
/* 直接设置swiper属性 */
swiper {
height: 500rpx;
}
swiper-item image {
width: 100%;
height: 100%;
}
.detail {
display: flex;
flex-direction: column;
margin-top: 15rpx;
margin-bottom: 0rpx;
}
.detail .title {
font-size: 40rpx;
margin: 10rpx;
color: black;
text-align: justify;
}
.detail .price {
color: red;
font-size: 40rpx;
margin: 10rpx;
}
.line_flag {
width: 80rpx;
height: 1rpx;
display: inline-block;
margin: 20rpx auto;
background-color: gainsboro;
text-align: center;
}
.line {
width: 100%;
height: 2rpx;
display: inline-block;
margin: 20rpx 0rpx;
background-color: gainsboro;
text-align: center;
}
.detail-nav {
display: flex;
flex-direction: row;
align-items: center;
float: left;
background-color: #fff;
position: fixed;
bottom: 0;
right: 0;
z-index: 1;
width: 100%;
height: 100rpx;
}
.button-green {
background-color: #4caf50; /* Green */
}
.button-red {
background-color: #f44336; /* 红色 */
}
.image_detail {
width: 100%;
}
button {
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 30rpx;
border-radius: 0rpx;
width: 50%;
height: 100%;
line-height: 100rpx;
}
.detail-nav image {
width: 70rpx;
height: 50rpx;
margin: 20rpx 40rpx;
}
.line_nav {
width: 5rpx;
height: 100%;
background-color: gainsboro;
}
/* 占位 */
.temp {
height: 100rpx;
}
text {
display: block;
height: 60rpx;
line-height: 60rpx;
font-size: 30rpx;
margin: 10rpx;
}
.text-remark {
display: block;
font-size: 25rpx;
margin: 10rpx;
}

@ -16,7 +16,7 @@
<block wx:for="{{cateItems[curIndex].children}}">
<view class="nav_right_items">
<!--界面跳转 -->
<navigator url="../../detail/detail}}">
<navigator url="/pages/detail/detail">
<image src="{{item.image}}"></image>
<text>{{item.name}}</text>
</navigator>

@ -35,6 +35,7 @@
<input class='count' type='number' value='{{good.count}}'></input>
<view class='add' data-index="{{index}}" catchtap='addtap'>+</view>
</view>
</view>
</view>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,34 @@
// pages/shdz/shdz.js
//获取应用实例
const app = getApp()
Page({
data: {
tapCurrent: 0,
},
onLoad: function () {
},
userInfo: function () {
wx.navigateTo({
url: '/pages/userInfo/userInfo'
})
},
bindDateChange: function (e) {
this.setData({
date: e.detail.value
})
},
discount: function (e) {
var current = e.currentTarget.dataset.current;
this.setData({
tapCurrent: current
})
},
newAddress: function () {
wx.navigateTo({
url: "/pages/wode/wode"
})
},
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,36 @@
<!--pages/shdz/shdz.wxml-->
<view id="address">
<view class="address_item flexRowBetween">
<view class="address_left">
<view class="text1">
李雷
</view>
<view class="text1 text_other">
科技路高新大都荟
</view>
</view>
<view class="address_right">
18888888888
</view>
</view>
<view class="address_set flexRowBetween">
<view class="default">
<image src="/pages/index/image/select_active.jpg"></image>
<text>默认地址</text>
</view>
<view class="edit">
<image src="/pages/index/image/edit.jpg"></image>
<text>编辑</text>
</view>
<view class="edit delete">
<image src="/pages/index/image/del.jpg"></image>
<text>删除</text>
</view>
</view>
<view class="submit_info" bindtap="newAddress">
保存
</view>
</view>

@ -0,0 +1,52 @@
/* pages/shdz/shdz.wxss */
#address{
width:100%;
height:100%;
background:#f5f5f5}
.address_item{
border-bottom:solid 1px #ececec;
padding:40rpx 25rpx;
background:#fff;
}
.address_left .text1{
color:#262626;
font-size:34rpx;}
.text_other{
margin-top:30rpx;
}
.address_right{
font-size:30rpx;
color:#262626;
}
.address_set{
padding:20px 25rpx;
border-bottom:solid 1px #ececec;
background:#fff;
justify-content:center;
}
.address_set text{font-size:24rpx;}
.address_set .default{
color:#2c9fe1;
width:71%;
align-items:center;
height:30rpx;
display:flex;
align-items:center;
}
.address_set .default image{
margin-right:15px;
width:29rpx;
height:29rpx;}
.address_set .edit image{
width:26rpx;
height:26rpx;
margin-right:10rpx;
}
.edit{color:#7d7d7d;width:15%;display:flex;
align-items:center;}
.de_color{color:#7d7d7d}
.submit_info{
margin-top:0rpx;
position:absolute;
bottom:120rpx;
}

@ -1,112 +1,66 @@
//index.js
//获取应用实例
const app = getApp()
const api = require('../../utils/api.js');
// pages/shouye/shouye.js
Page({
/**
* 页面的初始数据
*/
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
imgUrls: [
'../index/image/banner/banner1.jpg',
'../index/image/banner/banner2.jpg',
'../index/image/banner/banner3.jpg'
],
indicatorDots: true,
autoplay: true,
interval: 5000,
duration: 1000,
forumList: [],
},
//事件处理函数
// bindViewTap: function () {
// wx.navigateTo({
// url: '../logs/logs'
// })
//},
onShow() {
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
onLoad: function () {
let that = this;
wx.getStorage({
key: 'bbsProfile',
fail: function (res) {
that.login();
}
})
this.getForum();
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse) {
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
getUserInfo: function (e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
getForum() {
let data = {
pageNo: "0",
pageSize: "5"
};
api.getForum({
data,
success: (res) => {
this.setData({
forumList: res.data.content
})
}
})
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
login() {
let data = {
"username": "3f8bbbfaafda4d3e83e06b689d785e52",
"password": "3f8bbbfaafda4d3e83e06b689d785e52"
}
api.login({
data,
success: (res) => {
wx.setStorage({
key: 'bbsProfile',
data: res.data.item
})
}
})
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
toList(e) {
wx.navigateTo({
url: '../logs/logs?id=0',
})
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -1,3 +1,3 @@
{
"navigationBarTitleText": "首页"
"usingComponents": {}
}

@ -1,55 +1,2 @@
<view class="containers">
<!--<view class="userinfo">
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>-->
<view class="swiper-ai">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrls}}">
<swiper-item>
<image src="{{item}}" class="slide-image" width="355" height="240" />
</swiper-item>
</block>
</swiper>
</view>
<!--<view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="14"></icon>
<view class="weui-search-bar__text">搜索</view>
</label>
</view>-->
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
<form bindsubmit="formSubmit">
<input type="text" bindconfirm="bindKeyFirm" class="weui-search-bar__input" placeholder="搜索" value="{{inputVal}}" focus="{{inputShowed}}" bindinput="inputTyping" />
</form>
</view>
</view>
<view class="weui-panel weui-panel_access" style="margin-top:0;">
<view class="weui-panel__hd">推荐模块</view>
<view class="weui-panel__bd">
<navigator wx:for="{{forumList}}" url="../logs/logs?id={{item.id}}" data-id="{{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg" style="width:120px;height:80px;">
<image class="weui-media-box__thumb" src='../index/image/banner/img{{index}}.jpeg' />
</view>
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
<view class="weui-media-box__title">{{item.forum_name}}</view>
<view class="weui-media-box__desc">{{item.forum_description}}</view>
</view>
</navigator>
</view>
<view class="weui-panel__ft">
<view class="weui-cell weui-cell_access weui-cell_link">
<view class="weui-cell__bd" bindtap="toList">查看更多</view>
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view>
</view>
</view>
</view>
<!--pages/shouye/shouye.wxml-->
<text>pages/shouye/shouye.wxml</text>

@ -1,26 +1 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.swiper-ai image{
width: 100%;
}
.swiper-ai swiper{
height:240px;
}
.userinfo-nickname {
color: #aaa;
}
.usermotto {
margin-top: 200px;
}
/* pages/shouye/shouye.wxss */

@ -48,5 +48,18 @@ Page({
userInfo: userInfo
})
})
}
},
getUserInfo: function (e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
},
address: function () {
wx.navigateTo({
url: "/pages/shdz/shdz"
})
},
})

@ -3,10 +3,16 @@
<view class="userinfo">
<image class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
<image src="../../images/person/account_bg.png" class="account-bg">
</image>
<view style="width:30%;">
<view class="user_img">
<open-data type="userAvatarUrl"></open-data>
</view>
</view>
<view class="user_word">
<view class="user_name"><open-data type="userNickName" lang="zh_CN"></open-data></view>
</view>
</view>
<view class="separate"></view>
@ -35,8 +41,8 @@
</view>
<view class="person-line"></view>
<view class="list-item">
<image class="item-image" src="/pages/index/image/shdz.png"></image>
<text class="item-text">收货地址</text>
<image class="item-image" bindtap='address' src="/pages/index/image/shdz.png"></image>
<text class="item-text" bindtap='address'>收货地址</text>
</view>
<view class="person-line"></view>
<view class="list-item">

@ -3,6 +3,8 @@
display: flex;
flex-direction: column;
align-items: center;
width: 750rpx;
height: 300rpx;
background: #f0145a;
}
.account-bg {
@ -10,8 +12,8 @@
height: 150rpx;
}
.userinfo-avatar {
width: 108rpx;
height: 108rpx;
width: 750rpx;
height: 300rpx;
margin: 20rpx;
border-radius: 50%;
}
@ -71,26 +73,49 @@
display: flex;
flex-direction: column;
align-items: left;
}
.list-item {
display: flex;
flex-direction: row;
align-items: center;
height: 80rpx;
}
.item-image {
width: 40rpx;
height: 40rpx;
margin: 20rpx;
}
.item-text {
color: gray;
font-size: 25rpx;
margin-left: 20rpx;
}
.person-line {
width: 100%;
height: 2rpx;
background: lightgray;
margin-left: 90rpx;
background: rgb(211, 211, 211);
margin-left: 0rpx;
}
.user_img{
width:140rpx;
height:140rpx;
border-radius:50%;
overflow:hidden;
margin:0 auto;
}
.user_word{
width:40%;
height:80rpx;
}
.user_name{
font-size:34rpx;
color:#fff;
display:flex;
justify-content: center;
}

@ -13,8 +13,8 @@
},
"compileType": "miniprogram",
"libVersion": "2.4.4",
"appid": "wxd037e598f9fc428d",
"projectname": "%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BC%80%E5%8F%91%E6%B5%8B%E8%AF%95",
"appid": "wx7b4f2c58219ac6b6",
"projectname": "%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BC%80%E5%8F%91%E6%B5%8B%E8%AF%95111",
"debugOptions": {
"hidedInDevtools": []
},

@ -1,62 +0,0 @@
const apiURL = 'http://47.104.244.32:8100';
let headerData= {
}
headerData['Content-Type']= 'application/json';
let userData ={};
wx.getStorage({
key: 'bbsProfile',
success: function(res) {
userData = res.data;
if(userData.token){
headerData['Authorization']=userData.token;
}
}
})
const wxRequest = (params, url) => {
wx.request({
url,
method: params.method || 'POST',
data: params.data || {},
header:headerData, /*{
Accept: 'application/json',
'Content-Type': 'application/json',
},*/
success(res) {
if (params.success) {
params.success(res);
}
},
fail(res) {
if (params.fail) {
params.fail(res);
}
},
complete(res) {
if (params.complete) {
params.complete(res);
}
},
});
};
const getForum = (params) => {
wxRequest(params, `${apiURL}/forumManagement/getForum`);
};
const getQuestion = (params) => {
wxRequest(params, `${apiURL}/question/getQuestion`);
};
const login = (params) => {
wxRequest(params, `${apiURL}/session`);
};
const newAdmin = (params) => {
wxRequest(params, `${apiURL}/user/newAdmin`);
};
module.exports = {
getForum,
getQuestion,
login,
newAdmin
};

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save