抖音小程序上线

master
yujialong 5 months ago
parent 3123e5f30b
commit 26d4d20643
  1. 10
      apis/modules/user.js
  2. 4
      components/notAuth/notAuth.vue
  3. 2
      libs/uma.js
  4. 7
      order/addCourse/addCourse.vue
  5. 2
      order/curClient/curClient.vue
  6. 22
      order/orderDetail/orderDetail.vue
  7. 2
      order/productDetail/productDetail.vue
  8. 2
      order/shopCart/shopCart.vue
  9. 81
      pages/login/login.vue
  10. 4
      pages/orders/orders.vue
  11. 3
      pages/person/person.vue
  12. 17
      pages/reg/reg.vue
  13. 6
      team/qrcode/qrcode.vue

@ -13,6 +13,10 @@ export const douYinLoginByOpenid = (data) => {
return post('users/users/user/douYinLoginByOpenid?openid=' + data)
}
export const douYinUserBinding = (data) => {
return post('users/users/user/douYinUserBinding', data)
}
export const queryProvince = () => {
return get('nakadai/nakadai/province/queryProvince')
}
@ -72,8 +76,8 @@ export const checkIfThePhoneNumberExists = phone => {
return post(`users/users/applets/mine/checkIfThePhoneNumberExists?phone=${phone}`)
}
export const queryPartnerAccount = phone => {
return post(`nakadai/nakadai/partnerAccount/queryPartnerAccount?phone=${phone}`)
export const queryPartnerAccount = data => {
return post(`nakadai/nakadai/partnerAccount/queryPartnerAccount?phone=${data.phone}&openId=${data.openId}&douYinOpenId=${data.douYinOpenId}`)
}
export const getSessionKey = data => {
@ -85,7 +89,7 @@ export const partnerAccountApplication = data => {
}
export const loginByOpenid = openid => {
return post(`users/users/user/loginByOpenid?openid=` + openid)
return post(`users/users/user/loginByOpenid?openid=${openid}`)
}
export const checkWorkNumOrAccount = account => {

@ -3,7 +3,7 @@
<view class="mask"></view>
<view class="texts">
<view class="text">权限审核中可联系下方平台运营加快审核进度</view>
<image class="qrcode" src="https://occupationlab.com/images/customer.png" mode="widthFix"></image>
<image class="qrcode" :src="src" mode="widthFix"></image>
</view>
</view>
</template>
@ -12,7 +12,7 @@
export default {
data() {
return {
src: uni.getSystemInfoSync().uniPlatform === 'mp-toutiao' ? 'https://occupationlab.com/images/dyQrcode.jpg' : 'https://occupationlab.com/images/customer.png'
}
},
methods: {

@ -1,5 +1,4 @@
// #ifdef MP-WEIXIN
import uma from 'umtrack-wx';
uma.init({
appKey: '64cc98d5a1a164591b62da3e', // 由友盟分配的APP_KEY
@ -17,4 +16,3 @@ uma.install = function(Vue) {
Vue.prototype.$uma = uma;
}
export default uma;
// #endif

@ -67,7 +67,8 @@
value: 1
}],
checked: uni.getStorageSync('courses') || [], //
courses: uni.getStorageSync('courses') || []
courses: uni.getStorageSync('courses') || [],
submiting: false,
}
},
watch: {
@ -259,6 +260,9 @@
submit() {
const list = this.checked //
if (list.length) {
if (this.submiting) return false
this.submiting = true
const result = this.courses
const list1 = [] //
const list0 = [] //
@ -317,6 +321,7 @@
this.handleRenew(4, customerId, list4, result, resolve, reject)
}))
Promise.all(promises).then(_ => {
this.submiting = false
uni.setStorageSync('courses', result) //
uni.redirectTo({
url: `../editCourse/editCourse?customerId=${customerId}&orderType=${this.orderType}`

@ -216,8 +216,10 @@
margin-top: 20rpx;
background-color: #fff;
.item {
width: 100%;
padding: 20rpx 40rpx;
border-bottom: 1px solid #f1f1f1;
box-sizing: border-box;
}
.c-name {
font-size: 30rpx;

@ -41,11 +41,11 @@
<uni-data-picker v-else class="picker-input" placeholder="请选择订单类型" popup-title="请选择订单类型" preload :clear-icon="false" :localdata="orderTypes" v-model="form.orderType" @change="calcTotal(1)"></uni-data-picker>
</view> -->
<template v-if="edited">
<view class="line">
<view v-if="form.orderNumber" class="line">
<view class="name">订单编号</view>
<view class="val">{{ form.orderNumber }}</view>
</view>
<view class="line">
<view v-if="form.createTime" class="line">
<view class="name">订单时间</view>
<view class="val">{{ form.createTime }}</view>
</view>
@ -57,8 +57,9 @@
</view>
</view>
<view id="products">
<template v-for="c in courseList">
<view v-if="c.list.length" class="block pro-wrap" id="products">
<view v-if="c.list.length" class="block pro-wrap">
<view class="l-title">{{ c.name }}</view>
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons>
<ul class="pro-list" v-show="!c.shrink">
@ -133,6 +134,7 @@
</ul>
</view>
</template>
</view>
<view class="bottom">
<template v-if="!edited && !orderId">
@ -293,6 +295,9 @@
}
this.courseList = store
this.courses = list
uni.pageScrollTo({
selector: '#products'
})
try {
uni.removeStorageSync('courses')
} catch (e) {}
@ -759,7 +764,18 @@
this.delShopCart(courses)
uni.hideLoading()
this.$util.sucMsg('添加成功')
// #ifdef MP-WEIXIN
this.publicNotice()
// #endif
// #ifdef MP-TOUTIAO
setTimeout(() => {
uni.switchTab({
url: '/pages/orders/orders'
})
}, 1500)
// #endif
}).catch(res => {
uni.hideLoading()
})

@ -414,7 +414,7 @@
white-space: nowrap;
}
.des-html {
width: 100%;;
width: calc(100% - 140rpx);
font-size: 28rpx !important;
}
.rich-text-content span {

@ -259,10 +259,12 @@
li {
display: flex;
align-items: center;
width: 100%;
padding: 30rpx 24rpx;
margin: 16rpx 24rpx;
background-color: #fff;
border-radius: 16rpx;
box-sizing: border-box;
}
.name {
margin-bottom: 10rpx;

@ -26,7 +26,7 @@
</template>
<script>
import { login, userBinding, getSessionKey, queryPartnerAccount, douYinLogin, douYinLoginByOpenid } from '@/apis/modules/user.js'
import { login, userBinding, getSessionKey, queryPartnerAccount, douYinLogin, douYinLoginByOpenid, douYinUserBinding } from '@/apis/modules/user.js'
import WXBizDataCrypt from '@/libs/WXBizDataCrypt'
export default {
data() {
@ -75,40 +75,37 @@
if (code) {
this.submiting = true
let fn = login
let param = {
code,
avatarUrl: userInfo.avatarUrl
}
//
if (this.isDy) {
fn = douYinLogin
param = code
const res1 = await douYinLoginByOpenid('_000P6jr9bt8gW0ySNSzGsNBnCB0er4KtN3M')
uni.setStorageSync('token', res1.data.token)
this.toIndex()
// fn(param).then(async res => {
// const { data, status } = res
// this.submiting = false
// this.sessionKey = data.sessionKey
// this.openid = data.openid
// this.unionid = data.unionid
// uni.setStorageSync('sessionKey', data.sessionKey)
// uni.setStorageSync('openid', data.openid)
try {
const res = await douYinLogin(code)
const { data, status } = res
this.submiting = false
this.sessionKey = data.sessionKey
this.openid = data.openid
this.unionid = data.unionid
uni.setStorageSync('sessionKey', data.sessionKey)
uni.setStorageSync('openid', data.openid)
// const res1 = await douYinLoginByOpenid('_000P6jr9bt8gW0ySNSzGsNBnCB0er4KtN3M')
// //
// // if (data.state === 'login') {
// // this.toIndex()
// // uni.setStorageSync('token', data.token)
// // } else {
// // this.isLogin = true
// // }
// }).catch(e => {
// this.submiting = false
// })
//
if (data.state === 'login') {
this.toIndex()
uni.setStorageSync('token', data.token)
} else {
fn(param).then((res) => {
this.isLogin = true
// this.isReg = true
}
} catch (e) {
this.submiting = false
}
} else {
//
try {
const res = await login({
code,
avatarUrl: userInfo.avatarUrl
})
const { data, status } = res
this.submiting = false
//
@ -141,11 +138,10 @@
this.isLogin = true
}
}
}).catch(e => {
} catch (e) {
this.submiting = false
})
}
}
} else {
this.submiting = false
that.$util.errMsg('登录失败!')
@ -162,14 +158,12 @@
}
},
//
onGetPhoneNumber(e){
async onGetPhoneNumber(e){
if (this.submiting) return false
const { encryptedData, iv } = e.detail
// 1.使js2.使 ()
const appId = this.isDy ? 'tt2192572fbea04fe601' : uni.getAccountInfoSync().miniProgram.appId
console.log(1121, appId, this.sessionKey)
const pc = new WXBizDataCrypt(appId , this.sessionKey)
console.log(22, pc, encryptedData, e)
const data = pc.decryptData(encryptedData , iv)
this.submiting = true
const phone = data.phoneNumber
@ -177,12 +171,14 @@
this.submiting = false
this.$util.to(`../reg/reg?openid=${this.openid}&phone=${phone}`)
} else { //
userBinding({
try {
const fn = this.isDy ? douYinUserBinding : userBinding
const res = await fn({
openid: this.openid,
phone,
unionid: this.unionid,
platformId: 4
}).then(res => {
})
const { token, status } = res
if (status == 10014) {
// unilogincode
@ -203,13 +199,13 @@
uni.setStorageSync('token', token)
this.toIndex()
}
}).catch(e => {
} catch (e) {
this.submiting = false
uni.showToast({
title: e.message,
icon: 'none'
})
})
}
}
},
//
@ -221,7 +217,6 @@
lang: 'zh_CN',
desc: '登录',
success: ({ userInfo }) => {
console.log(22, userInfo)
uni.setStorageSync('userName', userInfo.nickName)
uni.setStorageSync('avatar', userInfo.avatarUrl)
uni.login({
@ -231,12 +226,10 @@
getSessionKey({
code,
}).then(({ sessionKey }) => {
console.log(11, sessionKey)
this.sessionKey = sessionKey.session_key
this.openid = sessionKey.openid
this.submiting = false
this.isLogin = true
}).catch(e => {
this.submiting = false
})
@ -256,7 +249,7 @@
}
},
toAgreement(id) {
this.$util.openFile(id)
this.$util.to(id ? `/order/privacyAgreement/privacyAgreement` : `/order/serviceAgreement/serviceAgreement`)
},
//
toIndex() {

@ -148,7 +148,6 @@
}
},
onShow() {
this.$uma.trackEvent('order') //
this.per = true
//
try {
@ -156,6 +155,7 @@
uni.removeStorageSync('courses')
} catch (e) {}
this.initRole()
this.$uma.trackEvent('order') //
},
methods: {
//
@ -299,8 +299,10 @@
margin-top: 20rpx;
background-color: #fff;
.item {
width: 100%;
padding: 20rpx 40rpx;
border-bottom: 1px solid #f1f1f1;
box-sizing: border-box;
}
.c-name {
font-size: 30rpx;

@ -314,7 +314,10 @@
}
.bg {
width: 100%;
height: calc(var(--status-bar-height) + 250rpx);
// #ifdef MP-WEIXIN
height: calc(var(--status-bar-height) + 317rpx);
// #endif
}
.wrap {
position: relative;

@ -33,6 +33,7 @@
export default {
data() {
return {
isDy: uni.getSystemInfoSync().uniPlatform === 'mp-toutiao', //
openid: '',
phone: '',
my: false,
@ -60,7 +61,11 @@
//
checkLogin() {
// isTeam 10team
queryPartnerAccount(this.phone).then(({ team, username }) => {
queryPartnerAccount({
phone: this.phone,
openId: this.isDy ? '' : this.openid,
douYinOpenId: this.isDy ? this.openid : '',
}).then(({ team, username }) => {
if (team) {
team.teamId && uni.setStorageSync('teamId', team.teamId)
this.form.userName = team.userName
@ -97,21 +102,20 @@
if (val) this.form.cityId = ''
},
//
submit() {
async submit() {
const { form } = this
if (!form.userName) return this.$util.errMsg('请输入姓名!')
if (!form.provinceId) return this.$util.errMsg('请选择意向省份!')
if (!form.cityId) return this.$util.errMsg('请选择意向城市!')
form.phone = this.phone
form.appOpenId = this.openid
form[this.isDy ? 'douYinOpenId' : 'appOpenId'] = this.openid
form.uniqueIdentification = Date.now()
if (form.isTeam) { //
loginByOpenid(this.openid).then(({ data }) => {
const { data } = await loginByOpenid(this.openid)
uni.setStorageSync('token', data.token)
this.toIndex()
}).catch(res => {})
} else { // or
partnerAccountApplication(form).then(({ token, teamId }) => {
const { token, teamId } = await partnerAccountApplication(form)
this.$util.sucMsg(form.isTeam === 0 ? '创建成功' : '注册成功')
// tokenteamId
if (token) {
@ -127,7 +131,6 @@
})
}, 1500)
}
}).catch(res => {})
}
},
//

@ -11,7 +11,7 @@
</view>
</view>
<view class="com">{{ team.partnerClassificationName }}</view>
<u-qrcode class="qrcode" ref="qrcode" canvas-id="qrcode" isQueueLoadImage :size="size" :value="link" @complete="qrcodeComplete"></u-qrcode>
<u-qrcode v-if="link" class="qrcode" ref="qrcode" canvas-id="qrcode" isQueueLoadImage :size="size" :value="link" @complete="qrcodeComplete"></u-qrcode>
<image class="qrcode-img" :src="qrcodeImg" show-menu-by-longpress @click="previewImage"></image>
<view class="tips" style="margin-top: 20rpx;">扫一扫加入我们吧</view>
@ -69,9 +69,13 @@
},
// imageimage
qrcodeComplete() {
console.log('complete', this.$refs.qrcode.toTempFilePath, this.link)
this.$refs.qrcode.toTempFilePath({
success: res => {
this.qrcodeImg = res.tempFilePath
},
fail: res => {
console.log('fail', res)
}
});
},

Loading…
Cancel
Save