Commit e44af9bb authored by 不吃草的咩's avatar 不吃草的咩

对接接口

parent 22ab5288
...@@ -12,7 +12,8 @@ export const colorUISdk = new ColorUISdk({ ...@@ -12,7 +12,8 @@ export const colorUISdk = new ColorUISdk({
}, },
//开发环境 //开发环境
dev: { dev: {
url: 'http://jbzhang.censoft.com.cn/' url: 'http://192.168.15.249:8050/'
// url:'http://jbzhang.censoft.com.cn/'
}, },
//本地环境 //本地环境
host: { host: {
......
...@@ -15,6 +15,14 @@ ...@@ -15,6 +15,14 @@
display: inline-block; display: inline-block;
padding-bottom: 20rpx; padding-bottom: 20rpx;
font-size: 34rpx; font-size: 34rpx;
height: 60rpx;
line-height: 60rpx;
display:-webkit-box;
-webkit-line-clamp:1;
overflow:hidden;
text-overflow:ellipsis;
-webkit-box-orient:vertical;
word-break:break-all;
&::after { &::after {
content: ''; content: '';
position: absolute; position: absolute;
...@@ -28,7 +36,15 @@ ...@@ -28,7 +36,15 @@
.doc-name { .doc-name {
position: relative; position: relative;
display: block; display: block;
padding-top: 20rpx; padding-top: 10rpx;
height: 60rpx;
line-height: 60rpx;
display:-webkit-box;
-webkit-line-clamp:1;
overflow:hidden;
text-overflow:ellipsis;
-webkit-box-orient:vertical;
word-break:break-all;
&::after { &::after {
content: ''; content: '';
position: absolute; position: absolute;
......
<view class="doc-card"> <view class="doc-card">
<navigator url="{{navurl}}" class="flex radius doc-card-navigator {{'bg-'+colorName+'-gradient'}}"> <navigator url="{{navurl}}" class="flex radius doc-card-navigator {{'bg-'+colorName+'-gradient'}}">
<view class="flex-sub p-4 doc-text"> <view class="flex-sub p-4 doc-text">
<view class="doc-title">{{ data.title }}</view> <view class="doc-title">{{ data.courseName }}</view>
<view class="text-lg text-Abc text-lighter doc-name">{{ data.name }}</view> <view class="text-lg text-Abc text-lighter doc-name">{{ data.remark }}</view>
</view> </view>
<view class="mt-2 mr-1 pt-4 pr-4 pl-2 doc-icon"> <view class="mt-2 mr-1 pt-4 pr-4 pl-2 doc-icon">
<text class="icon-xl text-xl {{data.icon}}"/> <text class="icon-xl text-xl {{data.icon}}"/>
......
...@@ -8,6 +8,7 @@ Page({ ...@@ -8,6 +8,7 @@ Page({
*/ */
data: { data: {
course:{ course:{
id:'',
name:'', name:'',
note:'', note:'',
price:'' price:''
...@@ -29,7 +30,7 @@ Page({ ...@@ -29,7 +30,7 @@ Page({
},2000) },2000)
}else{ }else{
wx.navigateTo({ wx.navigateTo({
url: `/pages/document/subsign/subsign?price=${this.data.course.price}&name=${this.data.course.name}`, url: `/pages/document/subsign/subsign?price=${this.data.course.price}&name=${this.data.course.name}&id=${this.data.course.id}`,
}) })
} }
...@@ -38,11 +39,13 @@ Page({ ...@@ -38,11 +39,13 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
const {name,note,price} = options; console.log(options);
const {name,note,price,id} = options;
this.setData({ this.setData({
["course.name"]:name == 'null' ? '' : name, ["course.name"]:name == 'null' ? '' : name,
["course.note"]:note == 'null' ? '暂无介绍' : note, ["course.note"]:note == 'null' ? '暂无介绍' : note,
["course.price"]:price == 'null' ? '' : price ["course.price"]:price == 'null' ? '' : price,
["course.id"]:id
}) })
}, },
......
...@@ -57,7 +57,7 @@ Page({ ...@@ -57,7 +57,7 @@ Page({
'专科', '专科',
'本科','研究生及以上' '本科','研究生及以上'
], ],
columnsHomework:['电工作业','焊接与热切割作业','高处作业','制冷与空调作业','金属与非金属矿山作业','危险化学品作业'], columnsHomework:[],
// columnsHomework:[ // columnsHomework:[
// {text:'电工作业',index:1}, // {text:'电工作业',index:1},
// {text:'焊接与热切割作业',index:2}, // {text:'焊接与热切割作业',index:2},
...@@ -66,7 +66,7 @@ Page({ ...@@ -66,7 +66,7 @@ Page({
// {text:'金属与非金属矿山作业',index:5}, // {text:'金属与非金属矿山作业',index:5},
// {text:'危险化学品作业',index:6}, // {text:'危险化学品作业',index:6},
// ], // ],
columnsZige:['职业资格'], columnsZige:[],
columnsPeixun:['新办','复审','换证'] columnsPeixun:['新办','复审','换证']
// columnsPeixun:[ // columnsPeixun:[
// {text:'新办',index:1}, // {text:'新办',index:1},
...@@ -116,22 +116,30 @@ Page({ ...@@ -116,22 +116,30 @@ Page({
onConfirmHomework(event){ onConfirmHomework(event){
const { picker, value, index } = event.detail; const { picker, value, index } = event.detail;
console.log(event.detail);
//根据选中状态,请求下面列表,动态生成列表项 //根据选中状态,请求下面列表,动态生成列表项
app.colorUISdk.request({ app.colorUISdk.request({
url:'wxcourse/list', url:'dictionary/listByPar3',
method: 'GET', method: 'GET',
data: { data: {
a:'xx' parentKey:value.constantKey
} }
}).then(res=> { }).then(res=> {
this.setData({courseData: res.data.records}) console.log(res);
if(res.code == 0){
let col = res.dictionary.map((a)=>{
return a.fieldKey;
});
this.setData({
columnsZige:col
})
}
}).catch(err=>{ }).catch(err=>{
console.log(err) console.log(err)
}) })
this.setData({ this.setData({
["fromDate.homework"]:value,["popup.homeworkText"]:value, ["fromDate.homework"]:value.text,["popup.homeworkText"]:value.text,
isShowHomework:false, isShowHomework:false,
} }
) )
}, },
...@@ -216,28 +224,39 @@ Page({ ...@@ -216,28 +224,39 @@ Page({
this.setData({ this.setData({
["fromDate.price"]:options.price, ["fromDate.price"]:options.price,
phone:app.phone, phone:app.phone,
["fromDate.phone"]:app.phone ["fromDate.phone"]:app.phone,
}) });
}, //获取课程类型,动态生成列表
app.colorUISdk.request({
/** url:'dictionary/listByPar2',
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
//获取作业类别列表
app.colorUISdk.request({
url:'wxcourse/list',
method: 'GET', method: 'GET',
data: { data: {
a:'xx' courseId:options.id
} }
}).then(res=> { }).then(res=> {
this.setData({courseData: res.data.records}) console.log(res);
if(res.code == 0){
let col = res.dictionary.map((a)=>{
return {text:a.fieldKey,constantKey:a.constantKey}
});
this.setData({
columnsHomework:col
});
console.log(this.data.columnsHomework)
}
// this.setData({courseData: res.data.records})
}).catch(err=>{ }).catch(err=>{
console.log(err) console.log(err)
}) })
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
......
...@@ -3,8 +3,8 @@ Page({ ...@@ -3,8 +3,8 @@ Page({
data: { data: {
diyige:{icon: 'cicon-avatar', name: '通信企业协会', title: '机构介绍' }, diyige:{icon: 'cicon-avatar', name: '通信企业协会', title: '机构介绍' },
jgDetail:[ jgDetail:[
{icon: 'cicon-avatar', name: 'qyDetail', title: '机构介绍',params:{type:'1',name:'23'}}, {icon: 'cicon-avatar', remark: '机构的介绍', courseName: '机构介绍',params:{type:'1',name:'23'}},
{icon: 'cicon-avatar', name: 'qyDetail', title: '报名指南',params:{type:'0',name:'23'}} {icon: 'cicon-avatar', remark: '你不知道的报名指南', courseName: '报名指南',params:{type:'0',name:'23'}}
], ],
scrollTop: 0, scrollTop: 0,
swiperList: [ swiperList: [
...@@ -23,7 +23,7 @@ Page({ ...@@ -23,7 +23,7 @@ Page({
navData: [{ navData: [{
title: '课程报名', title: '课程报名',
sub: [ sub: [
{ icon: 'cicon-set', name: 'signup', title: '在线报名',isTab:true}, { icon: 'cicon-set', remark: 'signup', courseName: '在线报名',isTab:true},
// { icon: 'cicon-set', name: 'system', title: '系统' }, // { icon: 'cicon-set', name: 'system', title: '系统' },
// { icon: 'cicon-paint', name: 'theme', title: '主题' }, // { icon: 'cicon-paint', name: 'theme', title: '主题' },
// { icon: 'cicon-topbar', name: 'navbar', title: '导航栏' }, // { icon: 'cicon-topbar', name: 'navbar', title: '导航栏' },
...@@ -95,15 +95,25 @@ Page({ ...@@ -95,15 +95,25 @@ Page({
}, },
onReady: function () { onReady: function () {
app.colorUISdk.request({ app.colorUISdk.request({
url:'wxcourse/list', url:'infocourse/list',
method: 'GET', method: 'GET',
data: { data: {}
a:'xx' }).then(({data})=> {
if(data.records.length == 0){
wx.showToast({
title: '课程列表为空',
icon:'none'
})
}else{
this.setData({courseData: data.records})
} }
}).then(res=> {
this.setData({courseData: res.data.records})
}).catch(err=>{ }).catch(err=>{
console.log(err) console.log(err);
wx.showToast({
title: '网络故障,请稍后再试',
icon:'none'
})
}) })
} }
}) })
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<block wx:for="{{courseData}}" wx:for-index="id" wx:key="course_index"> <block wx:for="{{courseData}}" wx:for-index="id" wx:key="course_index">
<view class="ui-item p-3" > <view class="ui-item p-3" >
<app-nav-li data="{{item}}" navurl="/pages/document/coursedetails/coursedetails?price={{item.price}}&name={{item.name}}&note={{item.note}}"/> <app-nav-li data="{{item}}" navurl="/pages/document/coursedetails/coursedetails?price={{item.cost}}&name={{item.courseName}}&note={{item.remark}}&id={{item.id}}"/>
</view> </view>
</block> </block>
</view> </view>
......
...@@ -10,9 +10,13 @@ Page({ ...@@ -10,9 +10,13 @@ Page({
// wx.navigateTo({ // wx.navigateTo({
// url: e.currentTarget.dataset.url // url: e.currentTarget.dataset.url
// }) // })
this.setData({ let token = wx.getStorageSync('token');
show:true if(token == ''){
}) this.setData({
show:true
})
};
}, },
randomWord(randomFlag, min, max){ randomWord(randomFlag, min, max){
let str = "", let str = "",
...@@ -32,21 +36,34 @@ Page({ ...@@ -32,21 +36,34 @@ Page({
//如果返回成功手机号,就随机生成一串字符串存进去 //如果返回成功手机号,就随机生成一串字符串存进去
if(e.detail.code !== undefined){ if(e.detail.code !== undefined){
console.log(e.detail); console.log(e.detail);
// let random = Math.random().toString(36).substr(2); app.colorUISdk.request({
let random = this.randomWord(false, 43); url:`wx/gt?code=${e.detail.code}`,
try { method: 'POST'
wx.setStorageSync('token', random); }).then(({data})=> {
Toast.success('登录成功'); console.log(data);
this.setData({ if(data.errcode == 0){
show:false, let random = this.randomWord(false, 43);
title:13520051245 // let random = Math.random().toString(36).substr(2);
}) try {
} catch (e) { wx.setStorageSync('token', random+data.phone_info.phoneNumber);
wx.showToast({ app.phone = data.phone_info.phoneNumber;
title: '数据存储失败!', Toast.success('登录成功');
icon: 'none' this.setData({
}) show:false,
} title:data.phone_info.phoneNumber,
})
} catch (e) {
wx.showToast({
title: '数据存储失败!',
icon: 'none'
})
}
}
this.setData({courseData: res.data.records})
}).catch(err=>{
console.log(err)
})
}else{ }else{
wx.showToast({ wx.showToast({
title: '授权失败,请您重新登录!', title: '授权失败,请您重新登录!',
......
...@@ -64,17 +64,26 @@ Page({ ...@@ -64,17 +64,26 @@ Page({
*/ */
onShow: function () { onShow: function () {
app.colorUISdk.request({ app.colorUISdk.request({
url:'wxcourse/list', url:'infocourse/list',
method: 'GET', method: 'GET',
data: { data: {}
a:'xx' }).then(({data})=> {
if(data.records.length == 0){
wx.showToast({
title: '课程列表为空',
icon:'none'
})
}else{
this.setData({courseData: data.records})
} }
}).then(res=> {
this.setData({courseData: res.data.records});
console.log(res.data.records)
}).catch(err=>{ }).catch(err=>{
console.log(err) console.log(err);
}); wx.showToast({
title: '网络故障,请稍后再试',
icon:'none'
})
})
app.information = {}; app.information = {};
}, },
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<view class="ui-grid ui-cols-2"> <view class="ui-grid ui-cols-2">
<block wx:for="{{courseData}}" wx:for-index="id" wx:key="course_index"> <block wx:for="{{courseData}}" wx:for-index="id" wx:key="course_index">
<view class="ui-item p-3"> <view class="ui-item p-3">
<app-nav-li data="{{item}}" navurl="/pages/document/subsign/subsign?price={{item.price}}&name={{item.name}}"/> <app-nav-li data="{{item}}" navurl="/pages/document/subsign/subsign?price={{item.cost}}&name={{item.courseName}}&id={{item.id}}"/>
</view> </view>
</block> </block>
</view> </view>
......
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