Commit 66e68b40 by 尹烁恒

完成开发

parent 1d92be17
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
</div> </div>
</div> </div>
<div class="submit-field"> <div class="submit-field">
<img src="../../assets/img/line.png" class="line"/>
<button class="button-submit" open-type="getUserInfo" @getuserinfo="handleGetUserInfo"></button> <button class="button-submit" open-type="getUserInfo" @getuserinfo="handleGetUserInfo"></button>
</div> </div>
</div> </div>
...@@ -62,7 +63,7 @@ export default { ...@@ -62,7 +63,7 @@ export default {
// 性能触发.所有的list只存key // 性能触发.所有的list只存key
return { return {
_cache: {}, _cache: {},
p_index: 1, p_index: 0,
itemList: [], itemList: [],
brandList: [], brandList: [],
hasFoucs: false, hasFoucs: false,
...@@ -75,20 +76,32 @@ export default { ...@@ -75,20 +76,32 @@ export default {
this.getConfig() this.getConfig()
this.login() this.login()
}, },
onLoad() {
},
methods: { methods: {
initData() { initData() {
this._cache = {} this._cache = {}
}, },
resetData() {
this.p_index = 0
this.hasFoucs = false
this.searchValue = ''
this.searchPage = 1
this.getConfig()
},
login() { login() {
const that = this const that = this
wx.login({ return new Promise((resolve, reject) => {
success(res) { wx.login({
that._jscode = res.code success(res) {
wx.setStorageSync('hasLogin', true) that._jscode = res.code
}, wx.setStorageSync('hasLogin', true)
fail() { resolve()
that.login() },
} fail() {
resolve(that.login())
}
})
}) })
}, },
handleInputFoucs() { handleInputFoucs() {
...@@ -107,14 +120,15 @@ export default { ...@@ -107,14 +120,15 @@ export default {
if (obj.loaded) return if (obj.loaded) return
this.fetchDetail(this.brand, obj.page) this.fetchDetail(this.brand, obj.page)
}, },
handleGetUserInfo(e) { async handleGetUserInfo(e) {
console.log(e) console.log(e)
if (e.target.errMsg === 'getUserInfo:ok') { if (e.target.errMsg === 'getUserInfo:ok') {
if (wx.getStorageSync('hasLogin')) { if (wx.getStorageSync('hasLogin')) {
this.handleSubmit() this.getUserInfo(e.target)
return } else {
await this.login()
this.getUserInfo(e.target)
} }
this.getUserInfo(e.target)
} else { } else {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
...@@ -130,7 +144,7 @@ export default { ...@@ -130,7 +144,7 @@ export default {
js_code: this._jscode js_code: this._jscode
}) })
.then(res => { .then(res => {
console.log(res) console.log(res.data.token, 'token')
setAuthorization(res.data.token) setAuthorization(res.data.token)
// 调用提交接口 // 调用提交接口
this.handleSubmit() this.handleSubmit()
...@@ -156,7 +170,7 @@ export default { ...@@ -156,7 +170,7 @@ export default {
this._cache[name].activeList = [] this._cache[name].activeList = []
} }
console.log(this._cache) console.log(this._cache)
this.fetchDetail(this.brandList[1].name) this.fetchDetail(this.brandList[0].name)
}) })
.catch(res => { .catch(res => {
console.log(res) console.log(res)
...@@ -175,13 +189,60 @@ export default { ...@@ -175,13 +189,60 @@ export default {
array = array.concat(...phoneArray) array = array.concat(...phoneArray)
} }
}) })
console.log(array, 'submit array')
console.log(JSON.stringify(array), 'json stringify array') console.log(JSON.stringify(array), 'json stringify array')
this.initData() fly.post('commit', {
wx.redirectTo({ mobiles: JSON.stringify(array)
url: '/pages/logs/main' })
.then(async res => {
console.log('提交之后的数据', res)
await this.fetchImage(res.data)
// 重置数据
this.resetData()
})
.catch(e => {
console.log('异常')
})
},
fetchImage(data) {
// 精简数据
wx.showLoading({
title: '加载中',
mask: true
})
wx.request({
url: 'https://test-api.wxagame.com/game-mobile/api/v1/image',
method: 'POST',
header: {
'content-type': 'application/octet-stream'
},
data: {
data: JSON.stringify(data)
},
success: function (res) {
var data = res.data
console.log(res.statusCode)
if (res.statusCode === 200) {
store.commit('setImage', 'data:image/png;base64,' + data)
wx.hideLoading()
wx.redirectTo({
url: `/pages/logs/main`
})
} else {
wx.hideLoading()
wx.showToast({
title: '生成失败',
icon: 'fail'
})
}
},
fail() {
wx.hideLoading()
wx.showToast({
title: '生成失败',
icon: 'fail'
})
}
}) })
this.initData()
}, },
// 获取详情 // 获取详情
fetchDetail(brand = '', page = 1) { fetchDetail(brand = '', page = 1) {
...@@ -251,17 +312,13 @@ export default { ...@@ -251,17 +312,13 @@ export default {
this.fetchDetail(brand) this.fetchDetail(brand)
this.p_index = index this.p_index = index
}, },
// 点击右侧
handleItemCell(option) { handleItemCell(option) {
// 使用一个activeList去维护激活的id
console.log(option) console.log(option)
// 此时显然没有触发mutated,itemList的引用没变。not mutated,就不会update更不会re-render
option.is_active = !option.is_active option.is_active = !option.is_active
const status = option.is_active const num = option.is_active ? 1 : -1
const num = status ? 1 : -1
// 如果brands有多个分类,做排除自身意外的激活或移除操作 // 如果brands有多个分类,做排除自身意外的激活或移除操作
if (option.brands.length > 1) { if (option.brands.length > 1) {
// 如果包括·经典·,经典的total需要去响应
// num移入外层判断,避免在forEach过程判断
if (num > -1) { if (num > -1) {
// 过滤出不属于当前brand的brands // 过滤出不属于当前brand的brands
option.brands.filter(item => item !== this.brand).forEach(brand => { option.brands.filter(item => item !== this.brand).forEach(brand => {
...@@ -459,6 +516,13 @@ export default { ...@@ -459,6 +516,13 @@ export default {
} }
.submit-field { .submit-field {
flex: 0 0 200rpx; flex: 0 0 200rpx;
text-align: center;
}
.line {
position: relative;
margin: 0 auto;
width: 700rpx;
height: 6rpx;
} }
.button-submit { .button-submit {
width: 489rpx; width: 489rpx;
......
...@@ -7,7 +7,6 @@ app.$mount() ...@@ -7,7 +7,6 @@ app.$mount()
// 这里才会导出page.json // 这里才会导出page.json
export default { export default {
config: { config: {
navigationBarTitleText: '布里吉',
disableScroll: true disableScroll: true
} }
} }
...@@ -7,7 +7,6 @@ app.$mount() ...@@ -7,7 +7,6 @@ app.$mount()
// 这里才会导出page.json // 这里才会导出page.json
export default { export default {
config: { config: {
navigationBarTitleText: '布里吉',
disableScroll: true disableScroll: true
} }
} }
<template> <template>
<div> <div>
<img src="../../assets/img/log-bg.jpg" class="log-bg"/> <img :src="path" class="log-bg"/>
<div class="fixed"> <div class="fixed">
<ul class="list-container"> <ul class="list-container">
<li class="list-item"> <li class="list-item">
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</template> </template>
<script> <script>
import store from '@/store'
export default { export default {
onShareAppMessage() { onShareAppMessage() {
return { return {
...@@ -25,6 +25,13 @@ export default { ...@@ -25,6 +25,13 @@ export default {
}, },
components: { components: {
}, },
onLoad() {
},
computed: {
path() {
return store.state.indexPage.path
}
},
data () { data () {
return { return {
} }
......
...@@ -3,3 +3,9 @@ import App from './index' ...@@ -3,3 +3,9 @@ import App from './index'
const app = new Vue(App) const app = new Vue(App)
app.$mount() app.$mount()
export default {
config: {
disableScroll: true
}
}
...@@ -16,6 +16,7 @@ fly.config.baseURL = 'https://test-api.wxagame.com/game-mobile/api/v1/' ...@@ -16,6 +16,7 @@ fly.config.baseURL = 'https://test-api.wxagame.com/game-mobile/api/v1/'
// add token // add token
fly.interceptors.request.use((config, promise) => { fly.interceptors.request.use((config, promise) => {
log(config, 'request config') log(config, 'request config')
console.log(getAuthorization())
if (getAuthorization()) { if (getAuthorization()) {
config.headers['Authorization'] = getAuthorization() config.headers['Authorization'] = getAuthorization()
} }
......
...@@ -23,11 +23,11 @@ const counterModule = { ...@@ -23,11 +23,11 @@ const counterModule = {
const logsModule = { const logsModule = {
state: { state: {
log: 10 path: ''
}, },
mutations: { mutations: {
increment (state) { setImage (state, payload) {
state.log += 1 state.path = payload
} }
} }
} }
......
File added
static/index-bg.jpg

571 KB | W: | H:

static/index-bg.jpg

242 KB | W: | H:

static/index-bg.jpg
static/index-bg.jpg
static/index-bg.jpg
static/index-bg.jpg
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment