Commit 4d4c3e84 authored by 罗超's avatar 罗超

1

parent 62156b8e
...@@ -2,10 +2,9 @@ import { ...@@ -2,10 +2,9 @@ import {
createApp createApp
} from 'vue' } from 'vue'
import App from './App.vue' import App from './App.vue'
let app=createApp(App) import Toast from "./wxcomponents/vant/toast/toast";
let app = createApp(App)
// app.config.globalProperties.$message = message;//全局挂载方法 app.provide("$toast", Toast)
// app.config.globalProperties.$toast = Toast;//全局挂载方法
// app.component('v-MessageBox',MessageBox);//全局注册组件 // app.component('v-MessageBox',MessageBox);//全局注册组件
app.mount() app.mount()
{ {
"name" : "", "name": "",
"appid" : "", "appid": "",
"description" : "", "description": "",
"versionName" : "1.0.0", "versionName": "1.0.0",
"versionCode" : "100", "versionCode": "100",
"transformPx" : false, "transformPx": false,
"app-plus" : { "app-plus": {
/* 5+App特有相关 */ /* 5+App特有相关 */
"usingComponents" : true, "usingComponents": true,
"splashscreen" : { "splashscreen": {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender": true,
"waiting" : true, "waiting": true,
"autoclose" : true, "autoclose": true,
"delay" : 0 "delay": 0
}, },
"modules" : {}, "modules": {},
/* 模块配置 */ /* 模块配置 */
"distribute" : { "distribute": {
/* 应用发布信息 */ /* 应用发布信息 */
"android" : { "android": {
/* android打包配置 */ /* android打包配置 */
"permissions" : [ "permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
...@@ -45,36 +45,36 @@ ...@@ -45,36 +45,36 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
"ios" : {}, "ios": {},
/* ios打包配置 */ /* ios打包配置 */
"sdkConfigs" : {}, "sdkConfigs": {},
"splashscreen" : { "splashscreen": {
"androidStyle" : "common", "androidStyle": "common",
"iosStyle" : "common" "iosStyle": "common"
} }
} }
}, },
/* SDK配置 */ /* SDK配置 */
"quickapp" : {}, "quickapp": {},
/* 快应用特有相关 */ /* 快应用特有相关 */
"mp-weixin" : { "mp-weixin": {
/* 微信小程序特有相关 */ /* 微信小程序特有相关 */
"appid" : "wx38e054ee42b054f4", "appid": "wxaa108410092fd276",
"setting" : { "setting": {
"urlCheck" : false "urlCheck": false
}, },
"usingComponents" : true "usingComponents": true
}, },
"mp-alipay" : { "mp-alipay": {
"usingComponents" : true "usingComponents": true
}, },
"mp-baidu" : { "mp-baidu": {
"usingComponents" : true "usingComponents": true
}, },
"mp-toutiao" : { "mp-toutiao": {
"usingComponents" : true "usingComponents": true
}, },
"mp-qq" : { "mp-qq": {
"usingComponents" : true "usingComponents": true
} }
} }
\ No newline at end of file
...@@ -16,22 +16,46 @@ ...@@ -16,22 +16,46 @@
</view> </view>
</view> </view>
<view v-for="(item, index) in data" :key="index"> <view v-for="(item, index) in data" :key="index">
<view class="chapter" @click="openLayer"> <view class="chapter" v-if="item.ChildList.length > 0">
<view class="flex flex_between_center"> <view class="flex flex_between_center">
<view class="flex flex_between_center"> <view class="flex flex_between_center">
<view class="dot"></view> <view class="dot"></view>
<text class="chapter-name">{{ item.name }}</text> <text class="chapter-name">{{ item.ChapterName }}</text>
</view> </view>
<view class="course-time"> {{ item.coursetime }} </view> <view class="course-time"> {{ item.StudyHours }}课时 </view>
</view> </view>
<view <view
v-for="(_item, _index) in item.children" v-if="item.ChildList.length > 0"
v-for="(_item, _index) in item.ChildList"
:key="_index" :key="_index"
class="course-list" class="course-list one_line"
@click="openLayer(_item.ChapterContent)"
> >
{{ _item.name }} {{ _item.ChapterName }}
</view> </view>
</view> </view>
<view
class="chapter"
v-if="item.ChildList.length == 0"
@click="openLayer(item.ChapterContent)"
>
<view class="flex flex_between_center">
<view class="flex flex_between_center">
<view class="dot"></view>
<text class="chapter-name">{{ item.ChapterName }}</text>
</view>
<view class="course-time"> {{ item.StudyHours }}课时 </view>
</view>
<!-- <view
v-if="item.ChildList.length 0"
v-for="(_item, _index) in item.ChildList"
:key="_index"
class="course-list one_line"
@click="openLayer(_item.ChapterContent)"
>
{{ _item.ChapterName }}
</view> -->
</view>
</view> </view>
<!-- 章节内容 --> <!-- 章节内容 -->
...@@ -48,14 +72,7 @@ ...@@ -48,14 +72,7 @@
章节学习内容 章节学习内容
</view> </view>
<view class="info-con"> <view class="info-con">
1、章节学习的具体内容,比如活动篇什 <rich-text :nodes="richTextNode" />
么什么,理解篇什么什么,语法什么。
2、章节学习的具体内容,比如活动篇什
么什么,理解篇什么什么,语法什么。
3、章节学习的具体内容,比如活动篇什
么什么,理解篇什么什么,语法什么。
4、章节学习的具体内容,比如活动篇什
么什么,理解篇什么什么,语法什么。
</view> </view>
<view class="Know-btn flex flex_center_center" @click="closeLayer"> <view class="Know-btn flex flex_center_center" @click="closeLayer">
我知道了 我知道了
...@@ -77,7 +94,9 @@ import { ...@@ -77,7 +94,9 @@ import {
watch, watch,
computed, computed,
onMounted, onMounted,
inject,
} from "vue"; } from "vue";
import { getCourse } from "../../api/index";
export default { export default {
setup() { setup() {
let data = reactive({ let data = reactive({
...@@ -96,24 +115,43 @@ export default { ...@@ -96,24 +115,43 @@ export default {
], ],
}, },
], ],
msg: {
CourseId: 0,
},
richTextNode: "",
}); });
let methods = { let methods = {
openLayer() { openLayer(item) {
data.richTextNode = decodeURIComponent(item);
data.showLayer = true; data.showLayer = true;
console.log("105", data.richTextNode);
}, },
closeLayer() { closeLayer() {
data.showLayer = false; data.showLayer = false;
}, },
async getdata() {
let res = await getCourse(data.msg);
console.log("114", res);
if (res) {
data.data = res.Data;
}
},
}; };
onMounted(() => {});
return { return {
...toRefs(data), ...toRefs(data),
...methods, ...methods,
}; };
}, },
onLoad() { onLoad(options) {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: "课程", title: "课程",
}); });
let { ctx } = getCurrentInstance();
ctx.msg.CourseId = options.id;
ctx.getdata();
}, },
}; };
</script> </script>
...@@ -252,12 +290,14 @@ export default { ...@@ -252,12 +290,14 @@ export default {
margin-right: 10rpx; margin-right: 10rpx;
} }
.info-con { .info-con {
height: 340rpx;
padding-left: 65rpx; padding-left: 65rpx;
padding-right: 55rpx; padding-right: 55rpx;
font-size: 24rpx; font-size: 24rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #111111; color: #111111;
overflow-y: scroll;
} }
.Know-btn { .Know-btn {
width: 300rpx; width: 300rpx;
......
<template> <template>
<view class="timetable-item"> <view
class="timetable-item"
v-for="(item, index) in data.PlanTimeList"
:key="index"
>
<view class="flex flex_start_center title-row"> <view class="flex flex_start_center title-row">
<view class="class-time"> 20:30 </view> <view class="class-time">{{ item.StartTime }} </view>
<view class="circle"></view> <view class="circle"></view>
<view class="class-title"> 今日章节内容 </view> <view class="class-title one_line flex">
{{ data.ClassName }}
<view v-for="(_item, _index) in data.Chapter" :key="_index">
{{ _item.ChapterName }}
<text v-if="_index !== data.Chapter.length - 1">,</text>
</view>
</view>
</view> </view>
<view class="left-line"></view> <view class="left-line"></view>
<view class="class-con flex"> <view class="class-con flex">
...@@ -11,21 +21,29 @@ ...@@ -11,21 +21,29 @@
round round
width="84rpx" width="84rpx"
height="84rpx" height="84rpx"
src="https://img.yzcdn.cn/vant/cat.jpeg" fit="cover"
:src="item.UserIcon"
class="teacherimg" class="teacherimg"
/> />
<view class="class-right flex_grow"> <view class="class-right flex_grow flex flex_start_center">
<view class="study-con"> 今日学习课程内容 </view> <!-- <view class="study-con"> 今日学习课程内容 </view> -->
<view class="teacher-name"> 李琴</view> <view class="teacher-name flex flex_start-center">
{{ item.TeacherName }}</view
>
</view> </view>
</view> </view>
<view class="btn-box"> <view class="btn-box">
<van-button <van-button
custom-class="leave-btn" custom-class="leave-btn"
@click="jumpPage('/pages/course/askForLeave')" @click="jumpPage('/pages/course/askForLeave')"
v-if="item.IsLeave === 1"
>请假</van-button >请假</van-button
> >
<van-button custom-class="already-leave-btn one_line">已请假</van-button> <van-button
custom-class="already-leave-btn one_line"
v-if="item.IsLeave === 0"
>已请假</van-button
>
</view> </view>
</view> </view>
</template> </template>
...@@ -43,10 +61,9 @@ import { ...@@ -43,10 +61,9 @@ import {
} from "vue"; } from "vue";
export default { export default {
name: "", name: "",
props: {}, props: { data: Object },
components: {}, components: {},
setup(props) { setup(props) {
let data = reactive({});
let methods = { let methods = {
jumpPage(url) { jumpPage(url) {
uni.navigateTo({ uni.navigateTo({
...@@ -54,9 +71,9 @@ export default { ...@@ -54,9 +71,9 @@ export default {
}); });
}, },
}; };
console.log(57, props);
return { return {
...toRefs(data), ...toRefs(props),
...methods, ...methods,
}; };
}, },
......
...@@ -87,8 +87,10 @@ ...@@ -87,8 +87,10 @@
</view> </view>
</view> </view>
<view class="Timetable-box"> <view class="Timetable-box">
<Item /> <!-- <Item /> -->
<Item /> <view v-for="(item, index) in dataList" :key="index">
<Item :data="item" />
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -107,6 +109,7 @@ import { ...@@ -107,6 +109,7 @@ import {
nextTick, nextTick,
} from "vue"; } from "vue";
import { getWeek, getToday } from "../../utils/date.js"; import { getWeek, getToday } from "../../utils/date.js";
import { getStundentPlanStatistical } from "../../api/index";
export default { export default {
name: "", name: "",
props: {}, props: {},
...@@ -126,7 +129,7 @@ export default { ...@@ -126,7 +129,7 @@ export default {
let onClose = () => { let onClose = () => {
showPopup.value = false; showPopup.value = false;
}; };
//选择月份
let onConfirm = (val) => { let onConfirm = (val) => {
showPopup.value = false; showPopup.value = false;
isShowAllDay.value = true; isShowAllDay.value = true;
...@@ -142,6 +145,9 @@ export default { ...@@ -142,6 +145,9 @@ export default {
getcalendar(curdate.getFullYear(), curdate.getMonth() + 1); getcalendar(curdate.getFullYear(), curdate.getMonth() + 1);
let newArr = calendar.value.slice(emptyArr.length, calendar.value.length); let newArr = calendar.value.slice(emptyArr.length, calendar.value.length);
sliceWeek(newArr[0]); sliceWeek(newArr[0]);
data.msg.StartTime = currentDate.value + "-01";
data.msg.EndTime = currentDate.value + "-01";
that.getData();
}; };
//获取当月日历数组 //获取当月日历数组
let calendar = ref([]); let calendar = ref([]);
...@@ -150,6 +156,10 @@ export default { ...@@ -150,6 +156,10 @@ export default {
//切换选中日期 //切换选中日期
let calendarActive = (item) => { let calendarActive = (item) => {
activeDay.value = item.day; activeDay.value = item.day;
let day = item.day < 10 ? "0" + item.day : item.day;
data.msg.StartTime = currentDate.value + "-" + day;
data.msg.EndTime = currentDate.value + "-" + day;
that.getData();
}; };
let emptyArr = []; //日历补空 let emptyArr = []; //日历补空
let getcalendar = (y, m) => { let getcalendar = (y, m) => {
...@@ -176,7 +186,32 @@ export default { ...@@ -176,7 +186,32 @@ export default {
let changeCalendar = () => { let changeCalendar = () => {
isShowAllDay.value = !isShowAllDay.value; isShowAllDay.value = !isShowAllDay.value;
}; };
//-------------------上边日历部分---------------------------------------
let data = reactive({
msg: {
ClassId: 0,
StartTime: "",
EndTime: "",
},
dataList: [],
});
let methods = {
async getData() {
let res = await getStundentPlanStatistical(data.msg);
if (res) {
data.dataList = res.Data;
console.log(199, data);
}
},
jumpPage(url) {
uni.navigateTo({
url: url,
});
},
back() {
uni.navigateBack();
},
};
onMounted(() => { onMounted(() => {
getcalendar(new Date().getFullYear(), new Date().getMonth() + 1); getcalendar(new Date().getFullYear(), new Date().getMonth() + 1);
let today = calendar.value.find((e) => { let today = calendar.value.find((e) => {
...@@ -187,14 +222,7 @@ export default { ...@@ -187,14 +222,7 @@ export default {
} }
sliceWeek(today); sliceWeek(today);
}); });
let jumpPage = (url) => { let that = methods;
uni.navigateTo({
url: url,
});
};
let back = () => {
uni.navigateBack();
};
return { return {
currentDate, currentDate,
getCurrentDate, getCurrentDate,
...@@ -210,12 +238,16 @@ export default { ...@@ -210,12 +238,16 @@ export default {
sliceWeek, sliceWeek,
isShowAllDay, isShowAllDay,
changeCalendar, changeCalendar,
jumpPage, ...toRefs(data),
back, ...methods,
}; };
}, },
onLoad() { onLoad(options) {
uni.hideShareMenu(); let { ctx } = getCurrentInstance();
ctx.msg.StartTime = getToday();
ctx.msg.EndTime = getToday();
// ctx.msg.ClassId = JSON.parse(options.classId);
ctx.getData();
}, },
}; };
</script> </script>
......
<template> <template>
<view> <view>
<van-nav-bar :border="fasle"> <van-nav-bar :border="fasle" fixed :z-index="99">
<view slot="left" class="page-title" title="shouye">首页</view> <view slot="left" class="page-title" title="shouye">首页</view>
</van-nav-bar> </van-nav-bar>
<view class="con"> <view class="con" :style="{ 'padding-top': `${statusBarHeight}px` }">
<view style="height: 100rpx"></view>
<view class="personInfo flex flex_start_center"> <view class="personInfo flex flex_start_center">
<van-image <van-image
round round
...@@ -31,11 +32,11 @@ ...@@ -31,11 +32,11 @@
:style="{ 'background-color': item.bgcolor }" :style="{ 'background-color': item.bgcolor }"
@click="jumpPage(item.jumpUrl)" @click="jumpPage(item.jumpUrl)"
> >
<view class=""> <view style="height: 100%; max-width: 120rpx">
<view class="baseInfo_name"> <view class="baseInfo_name">
{{ item.name }} {{ item.name }}
</view> </view>
<view class="baseInfo_desc"> <view class="baseInfo_desc one_line" :title="item.desc">
{{ item.desc }} {{ item.desc }}
</view> </view>
</view> </view>
...@@ -47,16 +48,30 @@ ...@@ -47,16 +48,30 @@
<text class="timetable_title">我的课表</text> <text class="timetable_title">我的课表</text>
<view <view
class="timetable_btn" class="timetable_btn"
@click="jumpPage('/pages/course/timeTable')" @click="
jumpPage(`/pages/course/timeTable?classId=${indexData.ClassId}`)
"
> >
全部 全部
<van-icon name="arrow" style="margin-left: 30rpx" /> <van-icon name="arrow" style="margin-left: 30rpx" />
</view> </view>
</view> </view>
<view class="timetable_item2"> 日期:2021-07-29 </view> <view class="timetable_item2">
<view class="timetable_item2"> 时间:上午09:30 </view> 日期:{{ indexData.ClassPlan.NewPlanDateTimeStr }}
<view class="timetable_item2"> 时间:上午09:30 </view> </view>
<view class="timetable_item2"> 状态:教完 </view> <view class="timetable_item2">
时间:{{ indexData.ClassPlan.TimeStr
}}{{ indexData.ClassPlan.TimeStart }}
</view>
<view class="timetable_item2">
老师:{{ indexData.ClassPlan.TeacherName }}
</view>
<view class="timetable_item2">
状态:
<text v-if="indexData.ClassPlan.TimeStatusStr === 0">待上课</text>
<text v-if="indexData.ClassPlan.TimeStatusStr === 1">上课中</text>
<text v-if="indexData.ClassPlan.TimeStatusStr === 2">下课</text>
</view>
</view> </view>
<van-cell-group :border="false"> <van-cell-group :border="false">
<van-cell title="我的考试" title-class="title" :border="false"> <van-cell title="我的考试" title-class="title" :border="false">
...@@ -96,6 +111,7 @@ ...@@ -96,6 +111,7 @@
</view> </view>
</view> </view>
</view> </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
...@@ -109,17 +125,22 @@ import { ...@@ -109,17 +125,22 @@ import {
watch, watch,
computed, computed,
onMounted, onMounted,
provide,
} from "vue"; } from "vue";
import { getIndexInfo } from "../../api/index";
import { getSystemInfo } from "../../utils/index";
export default { export default {
name: "", name: "",
props: {}, props: {},
components: {}, components: {},
setup(props) { setup(props) {
let data = reactive({ let data = reactive({
statusBarHeight: 0,
indexData: {},
baseInfo: [ baseInfo: [
{ {
name: "区", name: "区",
desc: "锦江校区", desc: "",
img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/icon1.png", img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/icon1.png",
bgcolor: "#CCEDFE", bgcolor: "#CCEDFE",
jumpUrl: "/pages/exam/answerSheet", jumpUrl: "/pages/exam/answerSheet",
...@@ -139,8 +160,8 @@ export default { ...@@ -139,8 +160,8 @@ export default {
jumpUrl: "/pages/progress/progress", jumpUrl: "/pages/progress/progress",
}, },
{ {
name: "剩余时间", name: "剩余课时",
desc: "100课时", desc: "100",
img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/icon4.png", img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/icon4.png",
bgcolor: "#FFEAFE", bgcolor: "#FFEAFE",
jumpUrl: "/pages/surplusTime/surplusTime", jumpUrl: "/pages/surplusTime/surplusTime",
...@@ -179,15 +200,37 @@ export default { ...@@ -179,15 +200,37 @@ export default {
}, },
], ],
}); });
let methods = { let methods = {
jumpPage(url) { jumpPage(url) {
uni.navigateTo({ uni.navigateTo({
url: url, url: url,
}); });
}, },
async getIndexdata() {
let res = await getIndexInfo();
if (res) {
data.indexData = res.Data;
data.baseInfo[0].desc = res.Data.SName;
data.baseInfo[1].desc = res.Data.CourseName;
data.baseInfo[1].jumpUrl =
"/pages/course/course?id=" + res.Data.CourseId;
// data.baseInfo[2].desc = res.Data.SName;
data.baseInfo[3].desc = res.Data.SurplusHours + "课时";
data.baseInfo[4].desc = res.Data.ContractNum;
data.baseInfo[5].desc = res.Data.TeacherName;
}
},
}; };
onMounted(() => {}); onMounted(() => {
getSystemInfo((res) => {
data.statusBarHeight = res.statusBarHeight;
});
that.getIndexdata();
});
let that = methods;
return { return {
...toRefs(data), ...toRefs(data),
...methods, ...methods,
...@@ -208,7 +251,8 @@ export default { ...@@ -208,7 +251,8 @@ export default {
<style scoped> <style scoped>
.con { .con {
box-sizing: border-box; box-sizing: border-box;
padding: 10rpx 30rpx 50rpx; padding: 100rpx 30rpx 50rpx;
/* padding-top: calc(140rpx + env(safe-area-inset-top)); */
} }
.page-title { .page-title {
font-size: 44rpx; font-size: 44rpx;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<view class="main"> <view class="main">
<van-cell-group> <van-cell-group>
<van-field <van-field
:value="username" :value="Account"
clearable clearable
placeholder="请输入用户名" placeholder="请输入用户名"
clearable clearable
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i> <i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i>
</van-field> </van-field>
<van-field <van-field
:value="password" :value="Password"
password password
placeholder="请输入密码" placeholder="请输入密码"
clearable clearable
...@@ -35,8 +35,9 @@ ...@@ -35,8 +35,9 @@
</van-field> </van-field>
</van-cell-group> </van-cell-group>
</view> </view>
<van-button block custom-class="loginBtn">登录</van-button> <van-button block custom-class="loginBtn" @click="login">登录</van-button>
<view class="auth" @click="authLogin"> 授权手机号一键登录 </view> <view class="auth" @click="authLogin"> 授权手机号一键登录 </view>
<van-toast id="van-toast" />
</view> </view>
</template> </template>
...@@ -50,41 +51,43 @@ import { ...@@ -50,41 +51,43 @@ import {
watch, watch,
computed, computed,
onMounted, onMounted,
inject,
} from "vue"; } from "vue";
// import Toast from "../../wxcomponents/vant/toast/toast";
import { login } from "../../api/index";
export default { export default {
setup(props, context) { setup(props, context) {
let Toast = inject("$toast");
let msg = reactive({ let msg = reactive({
username: "123123123", Account: "18170039207",
password: "", Password: "123456",
}); });
let methods = { let methods = {
usernameInput(val) { usernameInput(val) {
msg.username = val.detail; msg.Account = val.detail;
console.log(74, msg); console.log(74, msg);
}, },
passwordInput(val) { passwordInput(val) {
msg.password = val.detail; msg.Password = val.detail;
}, },
back() { back() {
uni.navigateBack(); uni.navigateBack();
}, },
jumpPage() {
uni.navigateTo({
url: "/pages/index/index",
});
clearTimeout();
},
authLogin() { authLogin() {
let that = methods;
that.getUserProfile(); that.getUserProfile();
}, },
getUserProfile() { getUserProfile() {
//新的获取用户资料 //新的获取用户资料
var that = methods;
wx.getUserProfile({ wx.getUserProfile({
desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (info) => { success: (info) => {
console.log(info); console.log(83, info);
// this.msg = {
// Id: 0,
// AliasName: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// };
that.getUserInfo(info); that.getUserInfo(info);
}, },
fail: () => { fail: () => {
...@@ -104,18 +107,7 @@ export default { ...@@ -104,18 +107,7 @@ export default {
provider: "weixin", provider: "weixin",
success: (_res) => { success: (_res) => {
console.log(107, _res); console.log(107, _res);
// //这里请求接口 that.getunionid(_res.code);
// let obj = {
// Source: 1,
// OpenId: "",
// Name: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// Gender: info.userInfo.gender,
// Moblie: "",
// SuperiorId: 0,
// code: res.code,
// };
// that.getCode(obj);
}, },
fail: () => { fail: () => {
uni.showToast({ uni.showToast({
...@@ -133,8 +125,32 @@ export default { ...@@ -133,8 +125,32 @@ export default {
}, },
}); });
}, },
async login() {
let res = await login(msg);
if (res) {
uni.setStorageSync("userInfo", res.Data);
Toast.success("登录成功");
setTimeout(() => {
that.jumpPage();
}, 500);
}
},
getunionid(code) {
let appid = "wxaa108410092fd276";
let secret = "31cd99f321612f95b0006905032de7f0";
uni.request({
url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`,
success: (res) => {
console.log(150, res);
},
fail: (err) => {
console.log(154, err);
},
});
},
}; };
onMounted(() => {}); onMounted(() => {});
let that = methods;
return { return {
...toRefs(msg), ...toRefs(msg),
...methods, ...methods,
......
let host='' let host = 'http://192.168.20.17:8017/api'
export default let request = (param, success, failed) => { import Toast from '../wxcomponents/vant/toast/toast';
let token = uni.getStorageSync('userInfo').Token;
let request = (param) => {
//网络请求 //网络请求
return new Promise((resolve, reject) => {
uni.request({ uni.request({
url: this.host + param.url, url: host + param.url,
method: param.method || "Post", method: param.method || "Post",
header: param.header || { header: param.header || {
'content-type': "application/json" 'content-type': "application/json",
'token': token || ""
}, },
data: { data: {
// MallBaseId: this.GetMiniAppId().MallBaseId,
// TenantId: this.GetMiniAppId().TenantId,
// OpenId: this.GetOpenId().OpenId,
// UserId: this.GetOpenId().UserId,
// SmallShopsId: this.GetOpenId().SmallShopsId,
// MiniAppId: this.GetMiniAppId().AppId,
msg: param.data, msg: param.data,
// token: this.GetOpenId().token
}, },
success: res => { success: res => {
// if (res.data.resultCode == 10000) { if (res.data.Code === 1) {
// let u = uni.getStorageSync("mall_UserInfo"); resolve(res.data)
// if (u) { } else {
// this.getLogin_t(u) Toast.fail(res.data.Message)
// typeof failed == "function" && failed(res.data); }
// }
// } else if (res.data.resultCode != 1) {
// if (res.data.message != '') {
// uni.showToast({
// title: res.data.message,
// icon: "none",
// });
// }
// typeof failed == "function" && failed(res.data);
// } else {
// typeof success == "function" && success(res.data);
// }
}, },
fail: (e) => { fail: (err) => {
// console.log("网络请求fail:" + JSON.stringify(e)); // reject(err)
// uni.showModal({ console.log("fail:" + JSON.stringify(err));
// content: "" + res.errMsg Toast.fail("网络请求失败")
// });
// typeof failed == "function" && failed(res.data);
} }
}); });
})
} }
export default request
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