Skip to content

Commit

Permalink
第二课堂功能发布调整
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhenShaw committed Oct 20, 2019
1 parent 81eac58 commit c56208f
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 24 deletions.
64 changes: 50 additions & 14 deletions MinProgram/pages/Campus/second/second.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const Page = require('../../../utils/sdk/ald-stat.js').Page
import Data from './data.js';
var baseUrl = "https://gzhu.ifeel.vip"

var url1 = "https://gzhu.ifeel.vip"
var url2 = "https://cst.ifeel.vip"
var baseUrl = url1

Page({

Expand All @@ -27,11 +30,14 @@ Page({
collegeMap: Data.collegeMap,
queryStr: "",

gridCol: 2,
gridCol: 3,
iconList: [{
icon: 'https://cos.ifeel.vip/gzhu-pi/images/icon/tongji.svg',
name: '学分统计'
}, {
}, {
icon: 'https://cos.ifeel.vip/gzhu-pi/images/icon/switch.svg',
name: '切换网络'
}, {
icon: 'https://cos.ifeel.vip/gzhu-pi/images/icon/shaixuan.svg',
name: '筛选'
}],
Expand Down Expand Up @@ -80,6 +86,7 @@ Page({
},

search(e) {

if (this.data.queryStr == "") return
let user = wx.getStorageSync("account")
if (!user) {
Expand All @@ -89,6 +96,20 @@ Page({
})
return
}
if (this.data.queryStr == "肖镇") {
wx.showToast({
title: '搜啥捏?!',
icon: "none"
})
let data = {
info: user.username
}
let Table = new wx.BaaS.TableObject('tmprecord')
let record = Table.create()
record.set(data).save()
return
}

let form = {}
form["username"] = user.username
form["password"] = user.password
Expand All @@ -99,13 +120,12 @@ Page({
}
if (e.currentTarget.id == "item_name") {
form["item_name"] = this.data.queryStr
this.setData({
queryStr: this.data.queryStr
})
}
this.data.filter = form
this.getSearchData(form)

this.setData({
queryStr: this.data.queryStr
})
},

searchInput: function(e) {
Expand Down Expand Up @@ -139,6 +159,7 @@ Page({
form["college_no"] = this.data.collegeMap[college]

form["item_name"] = this.data.queryStr
form["stu_name"] = ""

this.getSearchData(form)

Expand All @@ -155,6 +176,21 @@ Page({
case "学分统计":
this.count()
break
case "切换网络":
wx.showModal({
title: '切换网络',
content: '默认使用校园网访问,非校园网无法访问;若使用移动网络或非校园网可切换为校外网络,但查询速度会很慢,同时无法查看图片。',
confirmText: "校外网络",
cancelText: "校园网",
success(res) {
if (res.confirm) {
baseUrl = url2
}else{
baseUrl = url1
}
}
})
break
case "筛选":
this.setData({
showFilter: true
Expand Down Expand Up @@ -239,14 +275,14 @@ Page({
})
return
}
if (res.data.data.length == 0) {
wx.showToast({
title: '没有更多啦',
icon: "none"
})
return
}
if (loadMore) {
if (res.data.data.length == 0) {
wx.showToast({
title: '没有更多啦',
icon: "none"
})
return
}
that.setData({
applyList: that.data.applyList.concat(res.data.data),
})
Expand Down
2 changes: 1 addition & 1 deletion MinProgram/pages/Campus/second/second.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<!-- 列表 -->
<view wx:for="{{applyList}}" wx:key="{{index}}" class="cu-card article" style="overflow:visible">

<view class="cu-item shadow bg-gray" bindtap="tapItem" id="{{index}}" style="background:rgb(250, 250, 250)">
<view class="cu-item shadow bg-gray" bindtap="tapItem" id="{{index}}" style="background:rgb(245, 245, 245)">
<view class="title flex align-center">
<view class="text-cut">{{index+1}}
<text class='cuIcon-titles text-orange'></text> {{item.name}}</view>
Expand Down
2 changes: 1 addition & 1 deletion MinProgram/project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"ignore": []
},
"setting": {
"urlCheck": false,
"urlCheck": true,
"es6": false,
"enhance": true,
"postcss": true,
Expand Down
5 changes: 5 additions & 0 deletions Server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
version: '3.6'

networks:
gzhupi-net:

services:
backend:
build:
context: .
dockerfile: Dockerfile
container_name: gzhu-pi
restart: always
networks:
- gzhupi-net
ports:
- 9000:9000
volumes:
Expand Down
4 changes: 2 additions & 2 deletions Server/env/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func InitLogger() error {
log.Fatal("创建日志目录失败 ", err)
return err
}
fileName := "./log/log.log"
fileName := "/tmp/log/gzhupi.log"
f, err := os.OpenFile(fileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
log.Fatal("创建日志文件失败 ", err)
Expand All @@ -28,7 +28,7 @@ func InitLogger() error {
//logs.Async() //提升性能, 可以设置异步输出

config := make(map[string]interface{})
config["filename"] = `/tmp/log/gzhupi.log`
config["filename"] = fileName

logs.SetLevel(logs.LevelDebug)

Expand Down
5 changes: 1 addition & 4 deletions Server/pkg/gzhu_second/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ func (c *SecondClient) Search(r *http.Request) (items []*SecondItem, err error)
c.EVENTVALIDATION, _ = doc.Find("#__EVENTVALIDATION").Attr("value")

items = []*SecondItem{}
doc.Find("#MainContent_labPage").Each(func(i int, selection *goquery.Selection) {
logs.Info(selection.Text())
})
//记录最大页数
maxPage := 1
doc.Find("#MainContent_LabCountPage").Each(func(i int, selection *goquery.Selection) {
Expand Down Expand Up @@ -260,7 +257,7 @@ func (c *SecondClient) updateFormInfo() (err error) {
}

func (c *SecondClient) getForm(r *http.Request) (form *url.Values, err error) {
logs.Debug(r.PostForm)

year := r.PostForm["year"]
status_no := r.PostForm["status_no"]
grade := r.PostForm["grade"]
Expand Down
2 changes: 1 addition & 1 deletion Server/routers/jw.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func JWMiddleWare(next http.HandlerFunc) http.HandlerFunc {
client.ExpiresAt = time.Now().Add(20 * time.Minute)
}
}()

logs.Info("用户:%s 接口:%s",username, r.URL.Path)
//把客户端通过context传递给下一级
ctx := context.WithValue(r.Context(), "client", client)
// 创建新的请求
Expand Down
2 changes: 1 addition & 1 deletion Server/routers/second.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func SecondMiddleWare(next http.HandlerFunc) http.HandlerFunc {
client.ExpiresAt = time.Now().Add(20 * time.Minute)
}
}()

logs.Info("用户:%s 接口:%s",username, r.URL.Path)
//把客户端通过context传递给下一级
ctx := context.WithValue(r.Context(), "client", client)
// 创建新的请求
Expand Down

0 comments on commit c56208f

Please sign in to comment.