增加了 视频 讨论 积分页面

This commit is contained in:
xuxu 2024-06-16 23:32:15 +08:00
parent 3382462036
commit 7d972a7d99
51 changed files with 2798 additions and 1310 deletions

View File

@ -50,7 +50,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx0beef2b22e05d3d1",
"appid" : "Ewx0beef2b22e05d3d1",
"setting" : {
"urlCheck" : false
},

View File

@ -1,13 +1,13 @@
{
"easycom": {
"autoscan": true,
// customhttps://ask.dcloud.net.cn/question/131175
"custom": {
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
}
},
"autoscan": true,
// customhttps://ask.dcloud.net.cn/question/131175
"custom": {
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
}
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
@ -35,6 +35,29 @@
"navigationBarTitleText": "登录",
"navigationStyle": "default"
}
},
{
"path": "pages/video/video",
"style": {
"navigationBarTitleText": "视频",
"navigationStyle": "default"
}
},
{
"path": "pages/intergral/intergral",
"style": {
"navigationBarTitleText": "积分",
"navigationStyle": "default"
}
},
{
"path": "pages/discuss/discuss",
"style": {
"navigationBarTitleText": "评论",
"navigationStyle": "default"
}
}
],
"globalStyle": {
@ -47,25 +70,24 @@
"tabBar": {
"color": "#dcedc1",
"selectedColor": "#ffd3b6",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/icon/home.png",
"selectedIconPath": "static/icon/homeSelect.png"
},
{
"pagePath": "pages/news/news",
"text": "资讯",
"iconPath": "static/icon/neq.png",
"selectedIconPath": "static/icon/newSelecgt.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "static/icon/user.png",
"selectedIconPath": "static/icon/user1.png"
}
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/icon/home.png",
"selectedIconPath": "static/icon/homeSelect.png"
},
{
"pagePath": "pages/news/news",
"text": "资讯",
"iconPath": "static/icon/neq.png",
"selectedIconPath": "static/icon/newSelecgt.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "static/icon/user.png",
"selectedIconPath": "static/icon/user1.png"
}
]
}

103
pages/discuss/discuss.vue Normal file
View File

@ -0,0 +1,103 @@
<template>
<view class="container">
<view class="header">{{ post.title }}</view>
<view class="content">{{ post.content }}</view>
<view class="comments">
<view v-for="comment in comments" :key="comment.id" class="comment">
<view class="username">{{ comment.username }}</view>
<view class="text">{{ comment.text }}</view>
</view>
</view>
<view class="add-comment">
<input v-model="newComment" placeholder="发表评论" />
<button @click="addComment">发表</button>
</view>
</view>
</template>
<script setup>
import {
reactive,ref
} from 'vue';
const post = ref({
title: "这是一个讨论帖子",
content: "这是帖子的内容,大家可以在评论区讨论。",
} )
const comments = ref([
{ id: 1, username: "Alice", text: "非常好的帖子!" },
{ id: 2, username: "Bob", text: "同意楼上的观点!" },
])
const newComment = ref("")
const addComment = () => {
const newId = comments.value.length + 1;
comments.value.push({
id: newId,
username: "匿名用户",
text: this.newComment,
});
newComment.value = "";
};
</script>
<style scoped>
.container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20px;
}
.header {
font-size: 24px;
font-weight: bold;
}
.content {
margin-top: 20px;
line-height: 1.5;
}
.comments {
margin-top: 20px;
width: 100%;
}
.comment {
display: flex;
flex-direction: column;
margin-bottom: 10px;
}
.username {
font-weight: bold;
}
.add-comment {
margin-top: 20px;
display: flex;
}
input {
flex-grow: 1;
margin-right: 10px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
padding: 10px;
background-color: #007aff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>

View File

@ -14,7 +14,7 @@
</view>
<view class="seton">
<up-grid :border="false" col="4">
<up-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex">
<up-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex" @click="NavicatToBaseItems(baseListItem)">
<!-- <up-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.name" :size="22"></up-icon> -->
<image :src="baseListItem.src" style="width: 60rpx;" mode="widthFix"></image>
<text class="grid-text" style="margin: 10rpx;">{{baseListItem.title}}</text>
@ -47,23 +47,31 @@
const baseList = ref([
{
src:'/static/icon/video.png',
title: '视频'
},
{
src:'/static/icon/talk.png',
title: '讨论'
},
{
src: '/static/icon/score.png',
title: '积分'
},
{
src: '/static/icon/me.png',
title: '我的'
},
{
src:'/static/icon/video.png',
title: '视频' ,
url:"/pages/video/video"
},
{
src:'/static/icon/talk.png',
title: '讨论',
url:'/pages/discuss/discuss'
},
{
src: '/static/icon/score.png',
title: '积分',
url:'/pages/intergral/intergral'
},
{
src: '/static/icon/me.png',
title: '我的',
},
]);
function NavicatToBaseItems(item){
uni.navigateTo({
url:item.url
})
}
</script>
<style lang="scss">

View File

@ -0,0 +1,56 @@
<template>
<view class="container">
<view class="score-title">积分</view>
<view class="score-content">
<view class="score-item">
<text class="score-label">我的积分</text>
<text class="score-value">1234</text>
</view>
<view class="score-item">
<text class="score-label">可用积分</text>
<text class="score-value">100</text>
</view>
<view class="score-item">
<text class="score-label">积分使用规则</text>
</view>
<!-- 更多积分规则和说明 -->
</view>
</view>
</template>
<script>
export default {
data() {
return {
//
};
},
//
};
</script>
<style scoped>
.container {
padding: 20px;
}
.score-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 20px;
}
.score-item {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.score-label {
flex: 1;
text-align: right;
}
.score-value {
flex: 1;
text-align: left;
font-weight: bold;
color: #5677fc;
}
</style>

View File

@ -10,35 +10,43 @@
import {
loginByCode
} from "@/comm/api.js"
import {setToken} from "@/utils/Auth.js"
import {
setToken,
getToken
} from "@/utils/Auth.js"
async function login() {
const __this = this
uni.login({
provider: "weixin",
async success(e) {
console.log(e.code)
try {
const resp = await loginByCode({
code: e.code
})
console.log(resp)
console.log(resp, "resp")
uni.showToast({
icon:"none",
title:"登录成功"
icon: "none",
title: "登录成功"
})
setToken(resp.token)
setTimeout(()=>{
setTimeout(() => {
uni.switchTab({
url:"/pages/user/user"
url: "/pages/user/user"
})
},800)
}catch(err){
}, 800)
} catch (err) {
console.log(err,"errorCatch")
uni.showToast({
icon:"none",
title:"登录失败"
icon: "none",
title: "登录失败"
})
}
}
,
fail(err) {
console.log(err,"error")
}
})
}
</script>

View File

@ -26,7 +26,6 @@
nickName: "点击登录"
})
function gologin(){
console.log(getToken())
if(isLogin()){
return
}
@ -36,7 +35,6 @@
}
async function getUserInfo(){
const resp = await userInfo()
console.log(resp)
user.value = resp.data
}
onShow(()=>{

View File

@ -1,5 +1,22 @@
<template>
<view>
<!--swiper实现整屏划动播放视频-->
<swiper circular vertical duration="200" @transition="transition" @change="changed"
:style="{height: screenHeight-navBarHeight +'px'}">
<block v-for="(item,index) in displaySwiperList" :key="index">
<swiper-item>
<!-- v-if="index==changeIndex" 只渲染当前页的视频能够有效解决数组不断追加后引起黑屏的问题 -->
<video v-if="index==changeIndex" :src="item.src" autoplay="true" controls="true"
custom-cache="false" loop="false" enable-play-gesture="true" enable-progress-gesture="true"
show-center-play-btn="true">
</video>
<!-- 文本标题 -->
<view class="video-text">
<view class="tips"> {{item.title}} </view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</template>
@ -8,15 +25,163 @@
export default {
data() {
return {
screenHeight: 0,
statusBarHeight: 0,
navBarHeight: 0,
originList: [], //
displaySwiperList: [], // swiper
displayIndex: 0, // swiper012
originIndex: 0, //
changeIndex: 0, //video
page: 0, //
num: 0,
flag: true
}
},
methods: {
onLoad() {
/* 获取系统信息 */
wx.getSystemInfo({
success: (res) => {
//
this.screenHeight = res.screenHeight
//
this.statusBarHeight = res.statusBarHeight
//
if (res.system.substring(0, 3) == "iOS") {
this.navBarHeight = 42
} else {
this.navBarHeight = 40
}
}
})
//
this.getPageID()
},
methods: {
/* 生成随机的 pageID */
getPageID() {
let pageID = parseInt(Math.random() * (0 - 100 + 1) + 100) // [min,max]
this.getVideoList(pageID)
},
/* 获取视频数据 */
getVideoList(pageID) {
uni.request({
url: 'https://api.apiopen.top/api/getMiniVideo?page=' + pageID +
'&size=10&pageSize=10', //
data: {},
success: (res) => {
if (res.data.code == 200) {
res.data.result.list.forEach(item => {
//
let obj = {}
obj.src = item.playurl
obj.title = item.title
this.originList.push(obj)
})
}
//
if (this.flag) {
this.flag = false
this.initSwiperData(0)
}
}
})
},
changed(event) {
let {
current
} = event.detail;
let originListLength = this.originList.length;
this.changeIndex = current;
// console.log(this.displayIndex,current)
// 2-1
if (this.displayIndex - current == 2 || this.displayIndex - current == -1) {
this.originIndex = this.originIndex + 1 == originListLength ? 0 : this.originIndex + 1;
this.displayIndex = this.displayIndex + 1 == 3 ? 0 : this.displayIndex + 1;
this.initSwiperData(this.originIndex);
//
this.num++
console.log('num', this.num, this.originList.length)
if (this.num + 5 >= this.originList.length) {
this.getPageID()
}
}
// -21
else if (this.displayIndex - current == -2 || this.displayIndex - current == 1) {
this.originIndex = this.originIndex - 1 == -1 ? originListLength - 1 : this.originIndex - 1;
this.displayIndex = this.displayIndex - 1 == -1 ? 2 : this.displayIndex - 1;
this.initSwiperData(this.originIndex);
if (this.num > 0) {
this.num--
}
}
},
initSwiperData(originIndex = this.originIndex) {
// console.log(this.displayIndex,originIndex)
// 0 0
// 1 1
// 2 2
// 0 3
// 1 4
//
let originListLength = this.originList.length;
let displayList = [];
displayList[this.displayIndex] = this.originList[originIndex];
displayList[this.displayIndex - 1 == -1 ? 2 : this.displayIndex - 1] = this.originList[originIndex - 1 == -
1 ? originListLength - 1 : originIndex - 1];
displayList[this.displayIndex + 1 == 3 ? 0 : this.displayIndex + 1] = this.originList[originIndex + 1 ==
originListLength ? 0 : originIndex + 1];
// console.log(originIndex, (originIndex - 1 == -1 ? originListLength - 1 : originIndex - 1), (originIndex +
// 1 == originListLength ? 0 : originIndex + 1))
// 0 9 1
// 1 0 2
// 2 1 3
// 3 2 4
// 4 3 5
//
this.displaySwiperList = displayList;
// console.log(this.displaySwiperList,this.originList)
},
}
}
</script>
<style>
swiper {
width: 100%;
background: #000
}
swiper-item {
height: 100%;
width: 100%
}
video {
height: 96%;
width: 100%
}
.video-text {
position: absolute;
margin-left: 32rpx;
width: 580rpx;
bottom: 200rpx;
z-index: 9999;
}
.tips {
width: 560rpx;
font-size: 26rpx;
color: #ffffff;
}
</style>

28
project.config.json Normal file
View File

@ -0,0 +1,28 @@
{
"appid": "wx0b2e6f02015ee7c1",
"compileType": "miniprogram",
"libVersion": "3.4.7",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

View File

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "gree_leran",
"setting": {
"compileHotReLoad": true
}
}

View File

@ -6,6 +6,9 @@ if (!Math) {
"./pages/news/news.js";
"./pages/user/user.js";
"./pages/user/login.js";
"./pages/video/video.js";
"./pages/intergral/intergral.js";
"./pages/discuss/discuss.js";
}
const _sfc_main = {
onLaunch: function() {
@ -18,7 +21,7 @@ const _sfc_main = {
console.log("App Hide");
}
};
const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/App.vue"]]);
const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/App.vue"]]);
function createApp() {
const app = common_vendor.createSSRApp(App);
return {

View File

@ -3,7 +3,10 @@
"pages/index/index",
"pages/news/news",
"pages/user/user",
"pages/user/login"
"pages/user/login",
"pages/video/video",
"pages/intergral/intergral",
"pages/discuss/discuss"
],
"window": {
"navigationBarTextStyle": "black",

File diff suppressed because it is too large Load Diff

View File

@ -16,5 +16,5 @@ const _sfc_main = {
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/components/newsCard.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/components/newsCard.vue"]]);
wx.createComponent(Component);

View File

@ -132,5 +132,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
p: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-14a988f2"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-avatar/u-avatar.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-14a988f2"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-avatar/u-avatar.vue"]]);
wx.createComponent(Component);

View File

@ -195,5 +195,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
G: common_vendor.n($options.bemClass)
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-461e713c"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-button/u-button.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-461e713c"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-button/u-button.vue"]]);
wx.createComponent(Component);

View File

@ -95,5 +95,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
D: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b4243719"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-cell/u-cell.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b4243719"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-cell/u-cell.vue"]]);
wx.createComponent(Component);

View File

@ -107,5 +107,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
d: common_vendor.s($options.itemStyle)
} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-d5274fb5"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-grid-item/u-grid-item.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-d5274fb5"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-grid-item/u-grid-item.vue"]]);
wx.createComponent(Component);

View File

@ -64,5 +64,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
a: common_vendor.s($options.gridStyle)
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-85602471"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-grid/u-grid.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-85602471"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-grid/u-grid.vue"]]);
wx.createComponent(Component);

View File

@ -88,5 +88,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
t: common_vendor.n("u-icon--" + _ctx.labelPos)
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1c933a9a"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-icon/u-icon.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1c933a9a"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-icon/u-icon.vue"]]);
wx.createComponent(Component);

View File

@ -30,5 +30,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
a: common_vendor.s($options.lineStyle)
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-bbd9963c"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-line/u-line.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-bbd9963c"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-line/u-line.vue"]]);
wx.createComponent(Component);

View File

@ -40,5 +40,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
d: common_vendor.s($options.addStyle(_ctx.customStyle))
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-dedad317"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-link/u-link.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-dedad317"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-link/u-link.vue"]]);
wx.createComponent(Component);

View File

@ -70,5 +70,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
c: common_vendor.n(`u-list-item-${_ctx.anchor}`)
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-32197ac9"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-list-item/u-list-item.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-32197ac9"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-list-item/u-list-item.vue"]]);
wx.createComponent(Component);

View File

@ -114,5 +114,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
v: common_vendor.o((...args) => $options.refresherabort && $options.refresherabort(...args))
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9ad03670"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-list/u-list.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9ad03670"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-list/u-list.vue"]]);
wx.createComponent(Component);

View File

@ -96,5 +96,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
t: common_vendor.n(_ctx.vertical && "u-loading-icon--vertical")
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-00752c6d"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-loading-icon/u-loading-icon.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-00752c6d"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-loading-icon/u-loading-icon.vue"]]);
wx.createComponent(Component);

View File

@ -157,5 +157,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
F: common_vendor.s($options.addStyle(_ctx.customStyle))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ed789780"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-search/u-search.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ed789780"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-search/u-search.vue"]]);
wx.createComponent(Component);

View File

@ -50,5 +50,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
})
} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-23112adb"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-23112adb"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue"]]);
wx.createComponent(Component);

View File

@ -159,5 +159,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
w: $options.addUnit(_ctx.radius)
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-eda42115"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-swiper/u-swiper.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-eda42115"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-swiper/u-swiper.vue"]]);
wx.createComponent(Component);

View File

@ -118,5 +118,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
O: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args))
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5fec1d8b"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/node_modules/uview-plus/components/u-text/u-text.vue"]]);
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5fec1d8b"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/node_modules/uview-plus/components/u-text/u-text.vue"]]);
wx.createComponent(Component);

View File

@ -0,0 +1,43 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
__name: "discuss",
setup(__props) {
const post = common_vendor.ref({
title: "这是一个讨论帖子",
content: "这是帖子的内容,大家可以在评论区讨论。"
});
const comments = common_vendor.ref([
{ id: 1, username: "Alice", text: "非常好的帖子!" },
{ id: 2, username: "Bob", text: "同意楼上的观点!" }
]);
const newComment = common_vendor.ref("");
const addComment = () => {
const newId = comments.value.length + 1;
comments.value.push({
id: newId,
username: "匿名用户",
text: this.newComment
});
newComment.value = "";
};
return (_ctx, _cache) => {
return {
a: common_vendor.t(post.value.title),
b: common_vendor.t(post.value.content),
c: common_vendor.f(comments.value, (comment, k0, i0) => {
return {
a: common_vendor.t(comment.username),
b: common_vendor.t(comment.text),
c: comment.id
};
}),
d: newComment.value,
e: common_vendor.o(($event) => newComment.value = $event.detail.value),
f: common_vendor.o(addComment)
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9635802b"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/discuss/discuss.vue"]]);
wx.createPage(MiniProgramPage);

View File

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "评论",
"navigationStyle": "default",
"usingComponents": {}
}

View File

@ -0,0 +1 @@
<view class="container data-v-9635802b"><view class="header data-v-9635802b">{{a}}</view><view class="content data-v-9635802b">{{b}}</view><view class="comments data-v-9635802b"><view wx:for="{{c}}" wx:for-item="comment" wx:key="c" class="comment data-v-9635802b"><view class="username data-v-9635802b">{{comment.a}}</view><view class="text data-v-9635802b">{{comment.b}}</view></view></view><view class="add-comment data-v-9635802b"><input class="data-v-9635802b" placeholder="发表评论" value="{{d}}" bindinput="{{e}}"/><button class="data-v-9635802b" bindtap="{{f}}">发表</button></view></view>

View File

@ -0,0 +1,46 @@
.container.data-v-9635802b {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20px;
}
.header.data-v-9635802b {
font-size: 24px;
font-weight: bold;
}
.content.data-v-9635802b {
margin-top: 20px;
line-height: 1.5;
}
.comments.data-v-9635802b {
margin-top: 20px;
width: 100%;
}
.comment.data-v-9635802b {
display: flex;
flex-direction: column;
margin-bottom: 10px;
}
.username.data-v-9635802b {
font-weight: bold;
}
.add-comment.data-v-9635802b {
margin-top: 20px;
display: flex;
}
input.data-v-9635802b {
flex-grow: 1;
margin-right: 10px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
button.data-v-9635802b {
padding: 10px;
background-color: #007aff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}

View File

@ -32,21 +32,29 @@ const _sfc_main = {
const baseList = common_vendor.ref([
{
src: "/static/icon/video.png",
title: "视频"
title: "视频",
url: "/pages/video/video"
},
{
src: "/static/icon/talk.png",
title: "讨论"
title: "讨论",
url: "/pages/discuss/discuss"
},
{
src: "/static/icon/score.png",
title: "积分"
title: "积分",
url: "/pages/intergral/intergral"
},
{
src: "/static/icon/me.png",
title: "我的"
}
]);
function NavicatToBaseItems(item) {
common_vendor.index.navigateTo({
url: item.url
});
}
return (_ctx, _cache) => {
return {
a: common_vendor.o(($event) => _ctx.keyword = $event),
@ -65,7 +73,8 @@ const _sfc_main = {
a: baseListItem.src,
b: common_vendor.t(baseListItem.title),
c: baseListIndex,
d: "5cad4243-3-" + i0 + ",5cad4243-2"
d: common_vendor.o(($event) => NavicatToBaseItems(baseListItem), baseListIndex),
e: "6b80012b-3-" + i0 + ",6b80012b-2"
};
}),
e: common_vendor.p({
@ -79,7 +88,7 @@ const _sfc_main = {
}),
g: common_vendor.f(newsList, (i, k0, i0) => {
return {
a: "5cad4243-5-" + i0,
a: "6b80012b-5-" + i0,
b: common_vendor.p({
info: i
})
@ -89,5 +98,5 @@ const _sfc_main = {
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/pages/index/index.vue"]]);
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/index/index.vue"]]);
wx.createPage(MiniProgramPage);

View File

@ -1 +1 @@
<view class="content"><view class="nav"><view class="tit-box"> 学习平台 </view><view class="search-box" style="width:80%;margin:0 auto"><up-search wx:if="{{b}}" class="search" u-i="5cad4243-0" bind:__l="__l" bindupdateModelValue="{{a}}" u-p="{{b}}"></up-search></view></view><view class="hand"><up-swiper wx:if="{{c}}" u-i="5cad4243-1" bind:__l="__l" u-p="{{c}}"></up-swiper></view><view class="seton"><up-grid wx:if="{{e}}" u-s="{{['d']}}" u-i="5cad4243-2" bind:__l="__l" u-p="{{e}}"><up-grid-item wx:for="{{d}}" wx:for-item="baseListItem" wx:key="c" u-s="{{['d']}}" u-i="{{baseListItem.d}}" bind:__l="__l"><image src="{{baseListItem.a}}" style="width:60rpx" mode="widthFix"></image><text class="grid-text" style="margin:10rpx">{{baseListItem.b}}</text></up-grid-item></up-grid></view><view class="newlist"><up-text wx:if="{{f}}" u-i="5cad4243-4" bind:__l="__l" u-p="{{f}}"></up-text><view class=""><news-card wx:for="{{g}}" wx:for-item="i" u-i="{{i.a}}" bind:__l="__l" u-p="{{i.b}}"></news-card></view></view></view>
<view class="content"><view class="nav"><view class="tit-box"> 学习平台 </view><view class="search-box" style="width:80%;margin:0 auto"><up-search wx:if="{{b}}" class="search" u-i="6b80012b-0" bind:__l="__l" bindupdateModelValue="{{a}}" u-p="{{b}}"></up-search></view></view><view class="hand"><up-swiper wx:if="{{c}}" u-i="6b80012b-1" bind:__l="__l" u-p="{{c}}"></up-swiper></view><view class="seton"><up-grid wx:if="{{e}}" u-s="{{['d']}}" u-i="6b80012b-2" bind:__l="__l" u-p="{{e}}"><up-grid-item wx:for="{{d}}" wx:for-item="baseListItem" wx:key="c" u-s="{{['d']}}" bindclick="{{baseListItem.d}}" u-i="{{baseListItem.e}}" bind:__l="__l"><image src="{{baseListItem.a}}" style="width:60rpx" mode="widthFix"></image><text class="grid-text" style="margin:10rpx">{{baseListItem.b}}</text></up-grid-item></up-grid></view><view class="newlist"><up-text wx:if="{{f}}" u-i="6b80012b-4" bind:__l="__l" u-p="{{f}}"></up-text><view class=""><news-card wx:for="{{g}}" wx:for-item="i" u-i="{{i.a}}" bind:__l="__l" u-p="{{i.b}}"></news-card></view></view></view>

View File

@ -0,0 +1,15 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
// 数据部分可以根据实际需求添加,比如用户积分、可用积分等
};
}
// 方法部分可以根据需要添加,比如用户积分可用于兑换商品等
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e7fd672d"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/intergral/intergral.vue"]]);
wx.createPage(MiniProgramPage);

View File

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "积分",
"navigationStyle": "default",
"usingComponents": {}
}

View File

@ -0,0 +1 @@
<view class="container data-v-e7fd672d"><view class="score-title data-v-e7fd672d">积分</view><view class="score-content data-v-e7fd672d"><view class="score-item data-v-e7fd672d"><text class="score-label data-v-e7fd672d">我的积分:</text><text class="score-value data-v-e7fd672d">1234</text></view><view class="score-item data-v-e7fd672d"><text class="score-label data-v-e7fd672d">可用积分:</text><text class="score-value data-v-e7fd672d">100</text></view><view class="score-item data-v-e7fd672d"><text class="score-label data-v-e7fd672d">积分使用规则:</text></view></view></view>

View File

@ -0,0 +1,24 @@
.container.data-v-e7fd672d {
padding: 20px;
}
.score-title.data-v-e7fd672d {
font-size: 18px;
font-weight: bold;
margin-bottom: 20px;
}
.score-item.data-v-e7fd672d {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.score-label.data-v-e7fd672d {
flex: 1;
text-align: right;
}
.score-value.data-v-e7fd672d {
flex: 1;
text-align: left;
font-weight: bold;
color: #5677fc;
}

View File

@ -17,7 +17,7 @@ const _sfc_main = {
return {
a: common_vendor.f(newsList, (i, k0, i0) => {
return {
a: "2b6dbdfd-0-" + i0,
a: "5399d236-0-" + i0,
b: common_vendor.p({
info: i
})
@ -27,5 +27,5 @@ const _sfc_main = {
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/pages/news/news.vue"]]);
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/news/news.vue"]]);
wx.createPage(MiniProgramPage);

View File

@ -2,7 +2,6 @@
const common_vendor = require("../../common/vendor.js");
const comm_api = require("../../comm/api.js");
const utils_Auth = require("../../utils/Auth.js");
require("../../utils/http.js");
if (!Array) {
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
_easycom_up_button2();
@ -18,11 +17,12 @@ const _sfc_main = {
common_vendor.index.login({
provider: "weixin",
async success(e) {
console.log(e.code);
try {
const resp = await comm_api.loginByCode({
code: e.code
});
console.log(resp);
console.log(resp, "resp");
common_vendor.index.showToast({
icon: "none",
title: "登录成功"
@ -34,11 +34,15 @@ const _sfc_main = {
});
}, 800);
} catch (err) {
console.log(err, "errorCatch");
common_vendor.index.showToast({
icon: "none",
title: "登录失败"
});
}
},
fail(err) {
console.log(err, "error");
}
});
}
@ -53,5 +57,5 @@ const _sfc_main = {
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/pages/user/login.vue"]]);
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/user/login.vue"]]);
wx.createPage(MiniProgramPage);

View File

@ -1 +1 @@
<view class="main"><view class="" style="width:80%;margin:0 auto"><up-button wx:if="{{b}}" bindclick="{{a}}" u-i="35531eb2-0" bind:__l="__l" u-p="{{b}}"></up-button></view></view>
<view class="main"><view class="" style="width:80%;margin:0 auto"><up-button wx:if="{{b}}" bindclick="{{a}}" u-i="d9879682-0" bind:__l="__l" u-p="{{b}}"></up-button></view></view>

View File

@ -2,7 +2,6 @@
const common_vendor = require("../../common/vendor.js");
const utils_Auth = require("../../utils/Auth.js");
const comm_api = require("../../comm/api.js");
require("../../utils/http.js");
if (!Array) {
const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
const _easycom_up_cell2 = common_vendor.resolveComponent("up-cell");
@ -37,7 +36,6 @@ const _sfc_main = {
nickName: "点击登录"
});
function gologin() {
console.log(utils_Auth.getToken());
if (utils_Auth.isLogin()) {
return;
}
@ -47,7 +45,6 @@ const _sfc_main = {
}
async function getUserInfo() {
const resp = await comm_api.userInfo();
console.log(resp);
user.value = resp.data;
}
common_vendor.onShow(() => {
@ -85,5 +82,5 @@ const _sfc_main = {
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0f7520f0"], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/pages/user/user.vue"]]);
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0f7520f0"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/user/user.vue"]]);
wx.createPage(MiniProgramPage);

View File

@ -0,0 +1,119 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
screenHeight: 0,
statusBarHeight: 0,
navBarHeight: 0,
originList: [],
// 源数据
displaySwiperList: [],
// swiper需要的数据
displayIndex: 0,
// 用于显示swiper的真正的下标数值只有012。
originIndex: 0,
// 记录源数据的下标
changeIndex: 0,
//控制video是否渲染
page: 0,
// 视频分页
num: 0,
flag: true
};
},
onLoad() {
common_vendor.wx$1.getSystemInfo({
success: (res) => {
this.screenHeight = res.screenHeight;
this.statusBarHeight = res.statusBarHeight;
if (res.system.substring(0, 3) == "iOS") {
this.navBarHeight = 42;
} else {
this.navBarHeight = 40;
}
}
});
this.getPageID();
},
methods: {
/* 生成随机的 pageID */
getPageID() {
let pageID = parseInt(Math.random() * (0 - 100 + 1) + 100);
this.getVideoList(pageID);
},
/* 获取视频数据 */
getVideoList(pageID) {
common_vendor.index.request({
url: "https://api.apiopen.top/api/getMiniVideo?page=" + pageID + "&size=10&pageSize=10",
// 请求数据接口
data: {},
success: (res) => {
if (res.data.code == 200) {
res.data.result.list.forEach((item) => {
let obj = {};
obj.src = item.playurl;
obj.title = item.title;
this.originList.push(obj);
});
}
if (this.flag) {
this.flag = false;
this.initSwiperData(0);
}
}
});
},
changed(event) {
let {
current
} = event.detail;
let originListLength = this.originList.length;
this.changeIndex = current;
if (this.displayIndex - current == 2 || this.displayIndex - current == -1) {
this.originIndex = this.originIndex + 1 == originListLength ? 0 : this.originIndex + 1;
this.displayIndex = this.displayIndex + 1 == 3 ? 0 : this.displayIndex + 1;
this.initSwiperData(this.originIndex);
this.num++;
console.log("num", this.num, this.originList.length);
if (this.num + 5 >= this.originList.length) {
this.getPageID();
}
} else if (this.displayIndex - current == -2 || this.displayIndex - current == 1) {
this.originIndex = this.originIndex - 1 == -1 ? originListLength - 1 : this.originIndex - 1;
this.displayIndex = this.displayIndex - 1 == -1 ? 2 : this.displayIndex - 1;
this.initSwiperData(this.originIndex);
if (this.num > 0) {
this.num--;
}
}
},
initSwiperData(originIndex = this.originIndex) {
let originListLength = this.originList.length;
let displayList = [];
displayList[this.displayIndex] = this.originList[originIndex];
displayList[this.displayIndex - 1 == -1 ? 2 : this.displayIndex - 1] = this.originList[originIndex - 1 == -1 ? originListLength - 1 : originIndex - 1];
displayList[this.displayIndex + 1 == 3 ? 0 : this.displayIndex + 1] = this.originList[originIndex + 1 == originListLength ? 0 : originIndex + 1];
this.displaySwiperList = displayList;
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.f($data.displaySwiperList, (item, index, i0) => {
return common_vendor.e({
a: index == $data.changeIndex
}, index == $data.changeIndex ? {
b: item.src
} : {}, {
c: common_vendor.t(item.title),
d: index
});
}),
b: common_vendor.o((...args) => _ctx.transition && _ctx.transition(...args)),
c: common_vendor.o((...args) => $options.changed && $options.changed(...args)),
d: $data.screenHeight - $data.navBarHeight + "px"
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/video/video.vue"]]);
wx.createPage(MiniProgramPage);

View File

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "视频",
"navigationStyle": "default",
"usingComponents": {}
}

View File

@ -0,0 +1 @@
<view><swiper circular vertical duration="200" bindtransition="{{b}}" bindchange="{{c}}" style="{{'height:' + d}}"><block wx:for="{{a}}" wx:for-item="item" wx:key="d"><swiper-item><video wx:if="{{item.a}}" src="{{item.b}}" autoplay="true" controls="true" custom-cache="false" loop="false" enable-play-gesture="true" enable-progress-gesture="true" show-center-play-btn="true"></video><view class="video-text"><view class="tips">{{item.c}}</view></view></swiper-item></block></swiper></view>

View File

@ -0,0 +1,25 @@
swiper {
width: 100%;
background: #000
}
swiper-item {
height: 100%;
width: 100%
}
video {
height: 96%;
width: 100%
}
.video-text {
position: absolute;
margin-left: 32rpx;
width: 580rpx;
bottom: 200rpx;
z-index: 9999;
}
.tips {
width: 560rpx;
font-size: 26rpx;
color: #ffffff;
}

View File

@ -1,30 +1,28 @@
{
"description": "项目配置文件。",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"urlCheck": false,
"es6": true,
"postcss": false,
"minified": false,
"newFeature": true,
"bigPackageSizeSupport": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"ignoreUploadUnusedFiles": false
},
"compileType": "miniprogram",
"libVersion": "3.4.6",
"appid": "wx0beef2b22e05d3d1",
"projectname": "greenStu",
"condition": {},
"editorSetting": {
"tabIndent": "tab",
"tabSize": 2
}
"appid": "wx0b2e6f02015ee7c1",
"compileType": "miniprogram",
"libVersion": "3.4.7",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

View File

@ -1,7 +1,8 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "greenStu",
"setting": {
"compileHotReLoad": true
}
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "gree_leran",
"setting": {
"compileHotReLoad": true,
"urlCheck": false
}
}

View File

@ -1,12 +1,15 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const utils_Auth = require("./Auth.js");
const baseUrl = "http://127.0.0.1:8085";
const baseUrl = "https://9miao.fun/prod-api";
const http = (option) => {
if (!option instanceof Object) {
throw "参数非法";
}
const { url, data } = option;
const {
url,
data
} = option;
const token = utils_Auth.getToken();
return new Promise((resolve, reject) => {
common_vendor.index.request({

View File

@ -1,29 +1,33 @@
// export const baseUrl = "https://9miao.fun/prod-api/"
import {getToken} from "./Auth.js"
export const baseUrl = "http://127.0.0.1:8085"
export const http = (option) =>{
if (!option instanceof Object){
throw "参数非法"
import {
getToken
} from "./Auth.js"
export const baseUrl = "https://9miao.fun/prod-api"
export const http = (option) => {
if (!option instanceof Object) {
throw "参数非法"
}
const {url,data} = option
const token = getToken()
return new Promise((resolve,reject)=>{
const {
url,
data
} = option
const token = getToken()
return new Promise((resolve, reject) => {
uni.request({
header:{
Authorization:token,
header: {
Authorization: token,
...option.header
},
url:baseUrl+url,
url: baseUrl + url,
data,
method:option.method,
method: option.method,
success(res) {
resolve(res.data)
if(res.data.code==401){
if (res.data.code == 401) {
uni.showToast({
icon:"none",
title:"请登录后使用该功能"
icon: "none",
title: "请登录后使用该功能"
})
uni.removeStorageSync("token")
}