定位和线下活动

feature/v-xuexi
wangdong 10 months ago
parent cbbc1bc533
commit 0c981a57ba
  1. 2
      api/user.js
  2. 13
      components/Course/offlineStyleCourse.vue
  3. 272
      libs/permission.js
  4. 2
      libs/qqmap-wx-jssdk.min.js
  5. 3
      manifest.json
  6. 1
      pages.json
  7. 24
      pages/activity/activity_list.vue
  8. 2
      pages/activity/event.vue
  9. 48
      pages/activity/index.vue
  10. 53
      pages/course/special_cate.vue
  11. 9
      pages/forgotPwd/index.vue
  12. 171
      pages/index/getLocation.js
  13. 61
      pages/index/index.vue
  14. 8
      pages/index/position.vue
  15. 9
      pages/index/search.vue
  16. 44
      pages/learning/index.vue
  17. 1
      pages/my/noticeList.vue
  18. 3
      pages/special/order_store_list.vue
  19. 32
      pages/store/goodsCate.vue
  20. 1
      pages/topic/problem_detail.vue
  21. 2
      store/index.js
  22. 10
      store/modules/app.js
  23. 3
      store/types/muations-types.js

@ -41,7 +41,7 @@ export function getAuthCode(phone) {
}
export function registerAccount(data) {
return http.post('/login/register', data);
return http.get('/login/register', data);
}
export function changePwd(data) {

@ -24,6 +24,7 @@
</template>
<script>
import store from "@/store";
export default {
props: {
specialList: {
@ -33,9 +34,15 @@
},
methods: {
getJumpUrl(item) {
uni.navigateTo({
url: `/pages/special/offline_details?id=${item.id}`,
});
if (store.getters.isLogin) {
uni.navigateTo({
url: `/pages/activity/index?id=${item.id}`,
});
} else {
uni.navigateTo({
url: "/pages/login/index"
});
}
},
},
};

@ -0,0 +1,272 @@
/**
* 本模块封装了AndroidiOS的应用权限判断打开应用权限设置界面以及位置系统服务是否开启
*/
var isIos
// #ifdef APP-PLUS
isIos = (plus.os.name == "iOS")
// #endif
// 判断推送权限是否开启
function judgeIosPermissionPush() {
var result = false;
var UIApplication = plus.ios.import("UIApplication");
var app = UIApplication.sharedApplication();
var enabledTypes = 0;
if (app.currentUserNotificationSettings) {
var settings = app.currentUserNotificationSettings();
enabledTypes = settings.plusGetAttribute("types");
console.log("enabledTypes1:" + enabledTypes);
if (enabledTypes == 0) {
console.log("推送权限没有开启");
} else {
result = true;
console.log("已经开启推送功能!")
}
plus.ios.deleteObject(settings);
} else {
enabledTypes = app.enabledRemoteNotificationTypes();
if (enabledTypes == 0) {
console.log("推送权限没有开启!");
} else {
result = true;
console.log("已经开启推送功能!")
}
console.log("enabledTypes2:" + enabledTypes);
}
plus.ios.deleteObject(app);
plus.ios.deleteObject(UIApplication);
return result;
}
// 判断定位权限是否开启
function judgeIosPermissionLocation() {
var result = false;
var cllocationManger = plus.ios.import("CLLocationManager");
var status = cllocationManger.authorizationStatus();
result = (status != 2)
console.log("定位权限开启:" + result);
// 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
/* var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
console.log("enable:" + enable);
console.log("status:" + status);
if (enable && status != 2) {
result = true;
console.log("手机定位服务已开启且已授予定位权限");
} else {
console.log("手机系统的定位没有打开或未给予定位权限");
} */
plus.ios.deleteObject(cllocationManger);
return result;
}
// 判断麦克风权限是否开启
function judgeIosPermissionRecord() {
var result = false;
var avaudiosession = plus.ios.import("AVAudioSession");
var avaudio = avaudiosession.sharedInstance();
var permissionStatus = avaudio.recordPermission();
console.log("permissionStatus:" + permissionStatus);
if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
console.log("麦克风权限没有开启");
} else {
result = true;
console.log("麦克风权限已经开启");
}
plus.ios.deleteObject(avaudiosession);
return result;
}
// 判断相机权限是否开启
function judgeIosPermissionCamera() {
var result = false;
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
console.log("authStatus:" + authStatus);
if (authStatus == 3) {
result = true;
console.log("相机权限已经开启");
} else {
console.log("相机权限没有开启");
}
plus.ios.deleteObject(AVCaptureDevice);
return result;
}
// 判断相册权限是否开启
function judgeIosPermissionPhotoLibrary() {
var result = false;
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
var authStatus = PHPhotoLibrary.authorizationStatus();
console.log("authStatus:" + authStatus);
if (authStatus == 3) {
result = true;
console.log("相册权限已经开启");
} else {
console.log("相册权限没有开启");
}
plus.ios.deleteObject(PHPhotoLibrary);
return result;
}
// 判断通讯录权限是否开启
function judgeIosPermissionContact() {
var result = false;
var CNContactStore = plus.ios.import("CNContactStore");
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
if (cnAuthStatus == 3) {
result = true;
console.log("通讯录权限已经开启");
} else {
console.log("通讯录权限没有开启");
}
plus.ios.deleteObject(CNContactStore);
return result;
}
// 判断日历权限是否开启
function judgeIosPermissionCalendar() {
var result = false;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
if (ekAuthStatus == 3) {
result = true;
console.log("日历权限已经开启");
} else {
console.log("日历权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
// 判断备忘录权限是否开启
function judgeIosPermissionMemo() {
var result = false;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
if (ekAuthStatus == 3) {
result = true;
console.log("备忘录权限已经开启");
} else {
console.log("备忘录权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
// Android权限查询
function requestAndroidPermission(permissionID) {
return new Promise((resolve, reject) => {
plus.android.requestPermissions(
[permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
function(resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission);
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
resolve(result);
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
// if (result != 1) {
// gotoAppPermissionSetting()
// }
},
function(error) {
console.log('申请权限错误:' + error.code + " = " + error.message);
resolve({
code: error.code,
message: error.message
});
}
);
});
}
// 使用一个方法,根据参数判断权限
function judgeIosPermission(permissionID) {
if (permissionID == "location") {
return judgeIosPermissionLocation()
} else if (permissionID == "camera") {
return judgeIosPermissionCamera()
} else if (permissionID == "photoLibrary") {
return judgeIosPermissionPhotoLibrary()
} else if (permissionID == "record") {
return judgeIosPermissionRecord()
} else if (permissionID == "push") {
return judgeIosPermissionPush()
} else if (permissionID == "contact") {
return judgeIosPermissionContact()
} else if (permissionID == "calendar") {
return judgeIosPermissionCalendar()
} else if (permissionID == "memo") {
return judgeIosPermissionMemo()
}
return false;
}
// 跳转到**应用**的权限页面
function gotoAppPermissionSetting() {
if (isIos) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
// console.log(plus.device.vendor);
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
// 检查系统的设备服务是否开启
// var checkSystemEnableLocation = async function () {
function checkSystemEnableLocation() {
if (isIos) {
var result = false;
var cllocationManger = plus.ios.import("CLLocationManager");
var result = cllocationManger.locationServicesEnabled();
console.log("系统定位开启:" + result);
plus.ios.deleteObject(cllocationManger);
return result;
} else {
var context = plus.android.importClass("android.content.Context");
var locationManager = plus.android.importClass("android.location.LocationManager");
var main = plus.android.runtimeMainActivity();
var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
console.log("系统定位开启:" + result);
return result
}
}
module.exports = {
judgeIosPermission: judgeIosPermission,
requestAndroidPermission: requestAndroidPermission,
checkSystemEnableLocation: checkSystemEnableLocation,
gotoAppPermissionSetting: gotoAppPermissionSetting
}

File diff suppressed because one or more lines are too long

@ -128,7 +128,8 @@
"scope.userLocation" : {
"desc" : "用于小程序首页位置展示"
}
}
},
"requiredPrivateInfos":["getLocation"]
},
"mp-alipay" : {
"usingComponents" : true

@ -817,6 +817,7 @@
// #endif
},
"uniIdRouter": {},
"requiredPrivateInfos":["getLocation"],
"tabBar": {
"selectedColor":"#4ba0ff",
"color":"#b5b5b5",

@ -10,13 +10,13 @@
<view class="text">
<view class="name">{{ item.title }}</view>
<view class="time">
<text class="iconfont iconshijian2"></text>{{ item.time }}
<text class="iconfont iconshijian2"></text>报名时间{{ item.time }}
</view>
<view class="group">
<view class="money">
¥<text class="num">{{ item.price }}</text>
</view>
{{ item.count }}人已报名
<view class="time">
<text class="iconfont iconshijian2"></text>活动时间{{ item.time }}
</view>
<view class="time">
<text class="iconfont icondidian"></text>活动地址{{ item.province }}{{ item.city }}{{ item.district }}{{ item.detail }}
</view>
</view>
</navigator>
@ -105,4 +105,16 @@
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.list {
.item {
width: 690rpx;
margin: 20rpx auto;
background: #fff;
padding: 25rpx 20rpx 32rpx;
.img {
width: 200rpx;
height: 160rpx;
}
}
}
</style>

@ -1,6 +1,6 @@
<template>
<BaseContainer class="activity-event">
<NavBar title="填写资料" />
<NavBar title="线下课预约" />
<view class="form-section">
<form>
<label :class="{ required: item.is_required }" v-for="(item, index) in event" :key="item.id">

@ -18,13 +18,13 @@
<view class="info">
<view class="item">
<view class="iconfont iconshijian2"></view>
<view class="cont">报名时间{{ activity.signup_start_time }}{{
activity.signup_end_time
<view class="cont">报名时间{{ activity.signup_start_time.split(' ')[0] }} {{
activity.signup_end_time.split(' ')[0]
}}</view>
</view>
<view class="item">
<view class="iconfont iconshijian2"></view>
<view class="cont">活动时间{{ activity.start_time }}{{ activity.end_time }}</view>
<view class="cont">活动时间{{ activity.start_time.split(' ')[0] }} {{ activity.end_time.split(' ')[0] }}</view>
</view>
<view class="item">
<view class="iconfont icondidian"></view>
@ -33,7 +33,8 @@
}}{{ activity.district }}{{ activity.detail }}
</view>
</view>
</view>
</view>
</view>
</view>
<view class="chat" v-if="isPay">
<view class="text">赶紧加入活动群聊吧~</view>
@ -83,7 +84,7 @@
<view class="codeTip">长按扫一扫<br />加进群哦</view>
</view>
<view :class="{ mask: open }" @click="open = false"></view>
<BaseLogin :login-show="loginShow" :site-name="siteName" @login-close="loginClose" />
<!-- <BaseLogin :login-show="loginShow" :site-name="siteName" @login-close="loginClose" /> -->
</BaseContainer>
</template>
<script>
@ -242,7 +243,42 @@ body {
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
background-color: #f5f5f5;
}
.header {
background: transparent;
.image {
width: 100%;
height: 270rpx;
}
.text, .info {
width: 690rpx;
margin: 0 auto;
background: #fff;
}
.text {
border-radius: 10rpx 10rpx 0 0;
margin-top: 30rpx;
}
.info {
border-radius: 0 0 10rpx 10rpx;
border-top: none;
position: relative;
color: #999;
&:before {
content: '';
position: absolute;
top: 0;
left: 50%;
height: 2rpx;
width: 635rpx;
background: #F6F6F6;
transform: translateX(-50%);
}
}
}
.main {
width: 690rpx;
margin: 20rpx auto 0;
}
.link .cont {
display: inline-block;
vertical-align: middle;

@ -40,6 +40,29 @@
<line-style-course v-if="item.menuName === '我的课程'" :specialList="specialData[item.key]" @detail="(item) => { handleSpecialClick(item, 'my'); }"></line-style-course>
<square-style-course v-if="item.menuName === '热门课程'" :specialList="specialData[item.key]" @detail="handleSpecialClick"></square-style-course>
<offline-style-course v-if="item.menuName === '线下课堂'" :specialList="specialData[item.key]" @detail="handleSpecialClick"></offline-style-course>
<!-- 线下活动 -->
<!-- <view v-if="item.menuName === '线下课堂'" class="activity-offline">
<view class="list">
<navigator class="item" v-for="(itm, idx) in specialData[item.key]" :key="idx"
@click="jumpNoLogin(`/pages/activity/index?id=${itm.id}`)" url="" hover-class="none">
<view class="pictrue">
<image mode="aspectFill" :src="itm.pic" />
</view>
<view class="text">
<view class="title acea-row row-middle">
<view class="name line1" v-text="itm.title"></view>
</view>
<view class="info">
<view class="infoname">
<text class="iconfont icondidian"></text>{{ itm.province
}}{{ itm.city }}{{ itm.district }}{{ itm.detail }}
</view>
<view class="infoname"><text class="iconfont iconshijian2"></text>{{ itm.time }}</view>
</view>
</view>
</navigator>
</view>
</view> -->
</view>
</template>
@ -169,7 +192,7 @@ import Advert from '@/components/Advert/index.vue';
getsearch(key){
if (key === 'offline_courses') {
uni.navigateTo({
url: `/pages/special/offlineCourseList?specialType=${key || ''}`
url: '/pages/activity/activity_list'
});
} else {
uni.navigateTo({
@ -247,11 +270,10 @@ import Advert from '@/components/Advert/index.vue';
console.log(data, 646);
const { banner, category_list } = data;
this.bannerList = banner;
this.gradeCate = category_list;
// .concat([{
// grade_id: 0,
// name: '',
// }]);
this.gradeCate = category_list.concat([{
grade_id: 0,
name: '全部分类',
}]);
this.specialData = { ...data };
console.log(this.gradeCate);
}
@ -457,6 +479,25 @@ import Advert from '@/components/Advert/index.vue';
font-size: 24rpx;
}
}
.activity-offline .list .item .text .info>div:last-child {
font-size: 22rpx;
}
.activity-offline .list .item .text .info {
margin-top: 12rpx;
font-size: 22rpx;
color: #999999;
}
.activity-offline .list .item .text .info>div div {
margin-top: 10rpx;
}
.activity-offline .list .item .text .info .iconfont {
margin-right: 10rpx;
font-size: 22rpx;
line-height: 1em;
}
}
.submit {

@ -34,7 +34,7 @@
</view>
<view class="pwd-box pos flex flex-center-x">
<image mode="aspectFill" class="form-item-image" :src="require('../../static/images/pwd.png')"></image>
<input v-model.trim="pwd" :type="commitPwdShow ? 'text' : 'password'" maxlength="16" class="flex-auto" placeholder="请再次输入新密码" placeholder-class="input-placeholder"/>
<input v-model.trim="commitPwd" :type="commitPwdShow ? 'text' : 'password'" maxlength="16" class="flex-auto" placeholder="请再次输入新密码" placeholder-class="input-placeholder"/>
<!-- #ifndef MP-WEIXIN -->
<!-- <view class="pwd-show-image" :style="`background-image: url(../../static/images/pwd-${commitPwdShow ? 'show' : 'hide'}.png)`" @click.stop="commitPwdShow = !commitPwdShow"></view> -->
<!-- #endif -->
@ -55,6 +55,7 @@
</template>
<script>
import { registerAccount, getAuthCode } from '@/api/user';
export default {
data() {
@ -144,14 +145,16 @@ export default {
account: this.phone,
pwd: this.$util.hexMd5(this.pwd),
code: this.code,
agent_id: app.globalData.agent_id || 0
type: 2,
});
uni.hideLoading();
this.$util.showMsg(msg);
this.phone = "";
this.pwd = "";
this.code = "";
uni.navigateBack();
setTimeout(() => {
uni.navigateBack();
}, 1000);
} catch (err) {
uni.hideLoading();
this.$util.showMsg(err.msg);

@ -0,0 +1,171 @@
import permision from '../../libs/permission.js'
// 主函数
export const getLocation = async () => {
return new Promise((resolve, reject) => {
uni.getSystemInfo({
success: res => {
// uni-app 运行平台
let uniPlatform = res.uniPlatform;
// 微信小程序是否开启位置信息按钮
let locationEnabled = res.locationEnabled;
// 微信小程序是否位置信息授权
let locationAuthorized = res.locationAuthorized;
let osName = res.osName;
console.log(uniPlatform, locationEnabled, locationAuthorized);
if (uniPlatform == "app") {
// 获取当前手机是否开启或关闭了定位服务
let isLocationPermision = permision.checkSystemEnableLocation();
if (!isLocationPermision) mShowModel("手机定位服务未开启,请到设置界面开启", '');
if (isLocationPermision) {
let permisionStr = osName == "ios" ? "location" : "android.permission.ACCESS_FINE_LOCATION";
// 验证app是否被授权了获取位置权限
let result = osName == "ios" ? iosPermision(permisionStr) :
androidPermision(permisionStr).then(res => {
if (res == -1) mShowModel("你已拒绝获取位置信息授权,请到权限管理进行授权", "授权");
if (res == 0) mShowModel("应用未获取位置信息授权,请到权限管理进行授权", "授权");
if (res == 1) getCoordinate().then(res => {
resolve(res);
})
})
if (result == true) getCoordinate().then(res => {
resolve(res);
})
}
}
if (uniPlatform == "mp-weixin") weiXinPermision(locationEnabled,
locationAuthorized).then(res => {
console.log(res, 38)
if (res == true) getCoordinate().then(res => {
resolve(res);
})
});
}
})
})
}
const iosPermision = (permisionStr) => {
let result = permision.judgeIosPermission(permisionStr);
if (!result) mShowModel("应用未获取位置信息授权,请到权限管理进行授权", "授权");
return result
}
const androidPermision = async (permisionStr) => {
return new Promise((resolve, reject) => {
let result = permision.requestAndroidPermission(permisionStr);
// if (result == -1) mShowModel("您已拒绝获取位置信息授权,是否授权", "授权");
// if (result == 0) mShowModel("应用未获取位置信息授权,是否授权", "授权");
resolve(result);
})
}
const weiXinPermision = async (locationEnabled, locationAuthorized) => {
return new Promise((resolve, reject) => {
if (locationEnabled == false) {
mShowModel("手机定位服务未开启,请到设置界面进行开启", '');
} else {
// 手机定位服务(GPS)已授权
uni.authorize({
scope: "scope.userLocation",
success: res => {
console.log(res, 72);
resolve(true);
},
fail: err => {
uni.showModal({
content: "需要授权位置信息",
confirmText: "确认授权",
success: res => {
if (res.confirm) {
uni.openSetting({success: res => {
if (res.authSetting["scope.userLocation"]) {
mShowToast("授权成功");
resolve(true);
} else {
mShowToast("授权失败,请重新授权")
uni.showModal({
title: "授权",
content: "获取授权失败,是否前往授权设置?",
success: res => {
console.log(res, 91);
if (res.confirm) uni.openSetting();
},
fail: err => {
mShowToast("系统错误")
}
})
}
}
})
} else {
mShowToast("你拒绝了授权,无法获取位置信息")
}
}
})
},
// complete: res => {
// console.log(res, 108);
// if (res.errMsg == "authorize:ok") {
// resolve(true);
// } else {
// uni.showModal({
// title: "授权",
// content: "获取授权失败,是否前往授权设置?",
// success: res => {
// if (res.confirm) uni.openSetting();
// },
// fail: err => {
// mShowToast("系统错误!")
// }
// })
// }
// }
})
}
})
}
const getCoordinate = async (options) => {
// 获取坐标
return new Promise((resolve, reject) => {
uni.getLocation({
type: "wgs84",
success: (res) => {
resolve({
lat: res.latitude,
lng: res.longitude
});
}
})
})
}
const mShowModel = (content, confirmText) => {
console.log(content, confirmText)
const params = {};
uni.showModal({
content: content,
showCancel: !!confirmText,
confirmText: confirmText || '取消',
success: res => {
if (res.confirm) {
if (confirmText) {
permision.gotoAppPermissionSetting();
}
}
},
fail: (e) => {
console.log(e);
},
})
}
const mShowToast = (message, options = {}) => {
uni.showToast({
title: message || "提交成功!",
icon: options.icon || "none"
})
}

@ -43,7 +43,7 @@
<view class="pictrue">
<image :src="item.icon" mode="aspectFit"/>
</view>
<view class="text">{{ item.title }}</view>
<view class="text" style="white-space: nowrap;">{{ item.title }}</view>
</view>
</view>
</view>
@ -311,7 +311,7 @@
<view v-else-if="item.type === 7 && item.list.length" class="essential activity-offline">
<view class="public_title acea-row row-between-wrapper">
<view class="name">{{ item.title }}</view>
<navigator class="more acea-row row-middle" url="/pages/activity/activity_list">查看更多<text
<navigator class="acea-row row-middle" url="/pages/activity/activity_list">查看更多<text
class="iconfont iconxiangyou"></text></navigator>
</view>
<view class="list">
@ -564,6 +564,15 @@ import store from "@/store";
import ColorThief from "colorthief";
import SquareStyleCourse from '@/components/Course/squareStyleCourse.vue';
import Advert from '@/components/Advert/index.vue';
import { SET_POSITION } from "@/store/types/muations-types";
import { getLocation } from './getLocation.js';
const QQMapWx = require('../../libs/qqmap-wx-jssdk.min.js');
const qqmapsdk = new QQMapWx({
key: 'CGZBZ-BSBW3-5FP3V-YXBFC-7FQAF-ZYFFT'
});
const app = getApp();
@ -602,9 +611,13 @@ export default {
goodsList: [],
scrollTop: 0,
unReadMsgNum: 0,
currentPosition: '南京'
};
},
computed: {
currentPosition() {
return store.getters.position;
},
},
onShow() {
if (!this.recommend.legth) {
this.getIndexData();
@ -614,29 +627,18 @@ export default {
onLoad() {
wx.setNavigationBarTitle({
title:"一合知道"
})
});
this.getIndexData();
this.getSpecialList();
this.getGoodsList();
this.getNewsList();
this.getgroupWork();
this.getUnReadMsgNum();
// console.log('=====');
// try{
// uni.getLocation({
// type: 'gcj02',
// geocode: true,
// success: (res) => {
// console.log(res);
// },
// fail: (e) => {
// console.log(e);
// }
// })
// }catch(e){
// console.log(e);
// //TODO handle the exception
// }
if (!this.currentPosition) {
getLocation().then(res => {
this.getPositionAddress(res.lng, res.lat);
});
}
},
created() {
//#ifdef MP-WEIXIN
@ -658,6 +660,25 @@ export default {
return {};
},
methods: {
getPositionAddress(longitude, latitude,) {
qqmapsdk.reverseGeocoder({
location: {
longitude: longitude,
latitude: latitude,
},
success: (res) => {
if (res.status === 0) {
console.log(res);
this.$store.commit("app/" + SET_POSITION, res.result.address_component.city.split('市')[0]);
} else {
console.log('经纬度转换地址失败!');
}
},
fail: (res) => {
console.log(res);
}
});
},
async getSpecialList() {
try {
const { data } = await getSpecialList({

@ -43,6 +43,7 @@
<script>
import { city_list } from '@/api/index';
import { debounce } from 'lodash';
import { SET_POSITION } from "@/store/types/muations-types";
export default {
data() {
@ -61,9 +62,10 @@
// },
watch: {
position() {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.$vm.currentPosition = this.position;
// let pages = getCurrentPages();
// let prevPage = pages[pages.length - 2];
// prevPage.$vm.currentPosition = this.position;
this.$store.commit("app/" + SET_POSITION, this.position);
},
},
onLoad(options) {

@ -47,7 +47,7 @@
<view class="money">
<text>{{ item.money }}</text>
</view>
<view v-if="!item.is_light" class="total">{{ item.count }}</view>
<view v-if="!item.is_light" class="total" style="margin-left: auto;">{{ item.count }}</view>
</view>
</view>
</navigator>
@ -149,3 +149,10 @@ export default {
},
};
</script>
<style lang="scss" scoped>
.search-page {
background: #fff;
}
</style>

@ -13,7 +13,7 @@
<view class="exam-left flex">
<view class="exam-name flex">我的考试:
<text>{{ myExam.examName }}</text>
<image src="@/static/images/learning/change.png" mode="aspectFill"></image>
<image src="@/static/images/learning/change.png" mode="aspectFill" @click="changeCate"></image>
</view>
<view class="exam-time">开考时间:
<text>{{ myExam.examTime}}</text>
@ -98,6 +98,13 @@
<offline-style-course v-if="item.menuName === '线下课堂'" :specialList="specialData[item.key]" @detail="handleOfflineClick"></offline-style-course>
</view>
</template>
<view class="special-content">
<view class="content-title">
课程
<text class="more-content" @click="toMoreCourse">更多 ></text>
</view>
<square-style-course :specialList="specialList" @detail="handleSpecialClick"></square-style-course>
</view>
</view>
<!-- <message-box title="确认收货?" @submit="console.log('提交')"></message-box> -->
</BaseContainer>
@ -105,7 +112,7 @@
<script>
import { getGoodsCateList, getIndexData } from "@/api/store";
import { getSpecialIndexData } from "@/api/special";
import { getSpecialIndexData, getSpecialList } from "@/api/special";
import Advert from '@/components/Advert/index.vue';
import SquareStyleCourse from '@/components/Course/squareStyleCourse.vue';
import OfflineStyleCourse from '@/components/Course/offlineStyleCourse.vue';
@ -124,7 +131,9 @@ import MessageBox from '@/components/Message/index.vue';
categoryList: [],
loading: false,
myExam: {
examName: '英语六级',
examName: '职业技能考试',
grade_id: 1,
subject_id: 7,
examTime: '2024-1-12',
examDays: 180,
},
@ -141,12 +150,14 @@ import MessageBox from '@/components/Message/index.vue';
{ menuName: '线下课堂', key: 'offline_courses' },
],
specialData: [],
specialList: [],
};
},
onLoad() {
this.getGoodsCateList();
this.getIndexData();
this.getSpecialIndexData();
this.getSpecialList();
},
onShareAppMessage() {
return {};
@ -214,6 +225,21 @@ import MessageBox from '@/components/Message/index.vue';
]);
} catch (err) { }
},
async getSpecialList() {
try {
const { data } = await getSpecialList({
grade_id: this.myExam.grade_id,
subject_id: this.myExam.subject_id,
page: 1,
limit: 4,
});
this.specialList = data;
} catch (err) {
console.log(err);
}
this.loading = false;
},
handleSpecialClick(item) {
const url = item.is_light
? '/pages/special/single_details?id=' + item.id
@ -235,6 +261,18 @@ import MessageBox from '@/components/Message/index.vue';
url: '/pages/learningCenter/clockRecord',
})
},
changeCate() {
this.$util.checkLogin(() => {
uni.navigateTo({
url: '/pages/store/goodsCate?type=learning'
});
}, true)
},
toMoreCourse() {
uni.navigateTo({
url: `/pages/special/search?gradeId=${this.myExam.grade_id}&subjectId=${this.myExam.subject_id}`
})
},
},
};
</script>

@ -38,6 +38,7 @@
onShow() {
this.page = 1;
this.finished = false;
this.noticeList = [];
this.getNoticeList();
},
onReachBottom() {

@ -37,7 +37,7 @@
<view class="goods-group">
<view class="goods" v-for="cart in item.cartInfo">
<view class="image">
<image :src="cart.productInfo.image" mode="aspectFill" />
<image :src="cart.productInfo.image" mode="widthFix" />
</view>
<view class="text flex flex-column">
<view class="name" v-text="cart.productInfo.store_name"></view>
@ -495,6 +495,7 @@
width: 156rpx;
height: 184rpx;
margin-right: 52rpx;
border-radius: 0;
}
.text {
.name {

@ -33,10 +33,16 @@
return {
goodsCateList: [],
bigCate: '',
type: '',
};
},
onLoad() {
this.getGoodsCateList();
onLoad(options) {
this.type = options.type;
if (this.type === 'store') {
this.getGoodsCateList();
} else {
}
},
methods: {
//
@ -56,9 +62,25 @@
} catch (err) { }
},
toList(con) {
uni.navigateTo({
url: `/pages/store/goodsList?categoryId=${con.id}`
});
switch (this.type){
case 'store':
uni.navigateTo({
url: `/pages/store/goodsList?categoryId=${con.id}`
});
break;
case 'special':
// uni.navigateTo({
// url: `/pages/store/goodsList?categoryId=${con.id}`
// });
break;
case 'learning':
// uni.navigateTo({
// url: `/pages/store/goodsList?categoryId=${con.id}`
// });
break;
default:
break;
}
},
},
};

@ -330,6 +330,7 @@ export default {
break;
}
});
console.log(questions);
this.questions = questions;
} catch (err) {
uni.hideLoading();

@ -15,6 +15,6 @@ export default new Vuex.Store({
userInfo: state => state.app.userInfo,
rootFontSize: state => state.app.rootFontSize,
token: state => state.app.token,
position: state => state.app.position,
}
})

@ -1,4 +1,4 @@
import { SET_LOGIN, SET_LOGOUT, SET_ROOT_FONT, UPDATE_USER_INFO } from "@/store/types/muations-types";
import { SET_LOGIN, SET_LOGOUT, SET_ROOT_FONT, UPDATE_USER_INFO, SET_POSITION } from "@/store/types/muations-types";
import { VALID_LOGIN_STATUS } from "@/store/types/action-types";
import { validLoginStatus } from "@/api/user";
import utils from "@/utils/utils";
@ -38,7 +38,8 @@ export default {
isLogin: !!getToken(),
token: getToken(),
userInfo: getBaseUserInfo(),
rootFontSize: "50px"
rootFontSize: "50px",
position: '',
}
},
mutations: {
@ -72,7 +73,10 @@ export default {
isInit && uni.onWindowResize(() => {
setRemUnit();
});
}
},
[SET_POSITION](state, res) {
state.position = res;
},
},
actions: {
async [VALID_LOGIN_STATUS]({ commit }) {

@ -1,4 +1,5 @@
export const SET_LOGIN = "SET_LOGIN";
export const SET_LOGOUT = "SET_LOGOUT";
export const SET_ROOT_FONT = "SET_ROOT_FONT";
export const UPDATE_USER_INFO = "UPDATE_USER_INFO";
export const UPDATE_USER_INFO = "UPDATE_USER_INFO";
export const SET_POSITION = "SET_POSITION";
Loading…
Cancel
Save